Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Maarch
maarchRM
Commits
77a4a9f2
Commit
77a4a9f2
authored
Apr 19, 2019
by
Cyril Vazquez
Browse files
Merge branch 'fix/miscellaneous_fixes' into 'master'
Fix/miscellaneous fixes See merge request
!262
parents
9b580ab3
e07b0fe1
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/bundle/recordsManagement/archivalProfileInterface.php
View file @
77a4a9f2
...
...
@@ -92,4 +92,21 @@ interface archivalProfileInterface
*/
public
function
delete_archivalProfileId_
();
/**
* upload an archival profile
* @param recordsManagement/archivalProfile $archivalProfile The profile object
* @param base64 $content The profile binary file
* @param string $format The profile file format
*
* @action recordsManagement/archivalProfile/uploadArchivalProfile
*/
public
function
createArchivalprofileUpload_profileReference_
(
$archivalProfile
,
$content
,
$format
=
"rng"
);
/**
* Download the profile file
*
* @action recordsManagement/archivalProfile/export
*/
public
function
readArchivalprofileExport_profileReference_
();
}
src/presentation/maarchRM/Presenter/recordsManagement/archivalProfile.php
View file @
77a4a9f2
...
...
@@ -215,6 +215,18 @@ class archivalProfile
}
else
{
$archivalProfile
->
type
=
1
;
}
if
(
$archivalProfile
->
type
!=
2
)
{
$profileFileTab
=
$this
->
view
->
createDocumentFragment
();
$profileFileTab
->
appendHtmlFile
(
"recordsManagement/archivalProfile/profileUploadTab.html"
);
$this
->
view
->
getElementById
(
'archivalProfileNavControl'
)
->
appendChild
(
$profileFileTab
);
$profileFileForm
=
$this
->
view
->
createDocumentFragment
();
$profileFileForm
->
appendHtmlFile
(
"recordsManagement/archivalProfile/profileUpload.html"
);
$this
->
view
->
getElementById
(
'archivalProfileNavTabs'
)
->
appendChild
(
$profileFileForm
);
}
}
/**
...
...
src/presentation/maarchRM/Presenter/recordsManagement/archive.php
View file @
77a4a9f2
...
...
@@ -1157,10 +1157,19 @@ class archive
$archivalProfile
=
$this
->
loadArchivalProfile
(
$archive
->
archivalProfileReference
);
$modificationPrivilege
=
\
laabs
::
callService
(
'auth/userAccount/readHasprivilege'
,
"archiveManagement/modifyDescription"
);
// Define if we display or not the button to modify metadata
$editMetadata
=
false
;
if
(
!
empty
(
$archive
->
descriptionObject
))
{
if
(
!
empty
(
$archive
->
descriptionClass
))
{
$presenter
=
\
laabs
::
newPresenter
(
$archive
->
descriptionClass
);
$descriptionHtml
=
/*'<br/>'.*/
$presenter
->
read
(
$archive
->
descriptionObject
);
// Edit Metadata button is display only if the content is in SEDA 1 & if the archive status is 'preserved'
if
(
$archive
->
descriptionClass
==
"archivesPubliques/content"
&&
$archive
->
status
==
"preserved"
)
{
$editMetadata
=
true
;
}
}
else
{
$descriptionHtml
=
$this
->
setDescription
(
$archive
->
descriptionObject
,
$archivalProfile
);
}
...
...
@@ -1173,6 +1182,7 @@ class archive
$this
->
view
->
addContent
(
$descriptionHtml
,
$node
);
}
$this
->
view
->
setSource
(
'editMetadata'
,
$editMetadata
);
$this
->
view
->
setSource
(
'modificationPrivilege'
,
$modificationPrivilege
);
}
...
...
src/presentation/maarchRM/Resources/view/dashboard/mainScreen/archiveForm.html
View file @
77a4a9f2
...
...
@@ -177,9 +177,6 @@
},
error
:
function
(
response
)
{
gritter
.
show
(
response
.
responseJSON
.
message
,
response
.
responseJSON
.
status
,
response
.
responseJSON
.
errors
);
},
complete
:
function
(
response
){
$
(
"
#syncImport
"
).
attr
(
"
disabled
"
,
false
);
}
}
);
...
...
src/presentation/maarchRM/Resources/view/dashboard/mainScreen/import.html
View file @
77a4a9f2
...
...
@@ -84,7 +84,6 @@
});
$
(
'
#syncImport
'
).
on
(
'
click
'
,
function
(
e
)
{
$
(
this
).
attr
(
"
disabled
"
,
"
disabled
"
);
ArchiveForm
.
send
(
'
sync
'
,
e
,
$
(
this
));
});
...
...
src/presentation/maarchRM/Resources/view/recordsManagement/archivalProfile/profileUpload.html
0 → 100644
View file @
77a4a9f2
<div
role=
"tabpanel"
class=
"tab-pane fade [?merge archivalProfile.sedaType ?] in"
id=
"messageIntegrityTab"
>
<div
class=
"col-md-8"
>
<div
class=
"col-md-offset-2"
>
<input
type=
"file"
id=
"archivalProfile_filesBrowser"
class=
"hide"
>
<div
id=
"archivalProfile_XMLDropZone"
class=
"[?merge archivalProfile.profileFile.bool().then('hide', '') ?]"
>
<i
class=
"fa fa-file-text fileIcon"
>
</i>
<h4>
Click or drop a file
<h4>
</div>
<div
id=
"archivalProfile_fileInfo"
class=
"col-md-12 col-md-offset-2 [?merge archivalProfile.profileFile.bool().then('', 'hide') ?]"
>
<br/>
<table>
<tr>
<td><i
class=
"fa fa-file-text fileIcon"
>
</i></td>
<td>
<div
class=
"form-group"
style=
"padding-left:10px"
>
<label
class=
"control-label"
>
File name
</label>
:
<span
id=
"archivalProfile_fileName"
>
<?merge profileFileName ?>
</span>
<br/>
<label
class=
"control-label"
>
Format
</label>
:
<span
id=
"archivalProfile_fileFormat"
>
<?merge profileFileFormat ?>
</span>
<br/>
<label
class=
"control-label"
>
Date
</label>
:
<span
id=
"archivalProfile_fileDate"
>
<?merge profileFileLastModified.format('Y-m-d H:i:s') ?>
</span>
</div>
</td>
</tr>
</table>
<div
class=
"row"
>
<br/>
<div
class=
"pull-right"
>
<button
type=
"button"
class=
"btn btn-warning btn-sm [?merge archive.profileFile.bool().then('', 'hide') ?]"
id=
"archivalProfile_cancelImport"
title=
"Cancel"
><i
class=
'fa fa-times'
>
</i>
Cancel
</button>
<button
type=
"button"
class=
"btn btn-success btn-sm [?merge archive.profileFile.bool().then('', 'hide') ?]"
id=
"archivalProfile_submitImport"
title=
"Import"
><i
class=
'fa fa-level-down'
>
</i>
Import
</button>
<button
type=
"button"
class=
"btn btn-success btn-sm [?merge archive.profileFile.bool().then('hide', '') ?]"
id=
"archivalProfile_download"
data-ref=
"[?merge archivalProfile.reference ?]"
title=
"download"
><i
class=
'fa fa-download'
>
</i>
Download file
</button>
<button
type=
"button"
class=
"btn btn-info btn-sm [?merge archive.profileFile.bool().then('hide', '') ?]"
id=
"archivalProfile_replaceFile"
title=
"Replace file"
><i
class=
'fa fa-refresh'
>
</i>
Replace file
</button>
</div>
</div>
</div>
</div>
</div>
<div
class=
"hide"
>
<span
id=
"cantUploadFileError"
>
Can't upload file. You have to save the profile first.
</span>
<span
id=
"wrongFileFormat"
>
The profile file's extention must be rng or xsd.
</span>
</div>
</div>
<div
class=
"modal fade"
id=
"messageSavingModal"
tabindex=
"-1"
role=
"dialog"
aria-hidden=
"true"
>
<div
class=
"modal-dialog"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-hidden=
"true"
>
×
</button>
<h4
class=
"modal-title"
>
Enregistrer le profil d'archive
</h4>
</div>
<div
class=
"modal-body"
>
<p>
Le profil d'archive sera enregistré afin de pouvoir ajouter le fichier. Voulez-vous continuer ?
</p>
</div>
<div
class=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-default"
data-dismiss=
"modal"
title=
"Annuler"
>
Non
</button>
<button
type=
"button"
id=
"confirmSaving"
class=
"btn btn-success"
data-dismiss=
"modal"
title=
"Enregistrer"
>
Oui
</button>
</div>
</div>
</div>
</div>
<style>
#archivalProfile_XMLDropZone
{
border
:
2px
dashed
grey
;
cursor
:
pointer
;
padding
:
100px
;
text-align
:
center
;
color
:
grey
;
opacity
:
0.5
;
}
.fileIcon
{
font-size
:
400%
;
}
</style>
<script>
// Drag & drop
$
(
"
#archivalProfile_XMLDropZone
"
).
on
(
'
dragenter
'
,
function
(
e
)
{
e
.
preventDefault
();
e
.
stopPropagation
();
})
$
(
"
#archivalProfile_XMLDropZone
"
).
on
(
'
dragover
'
,
function
(
e
)
{
e
.
preventDefault
();
e
.
stopPropagation
();
$
(
'
#archivalProfile_XMLDropZone
'
).
css
(
'
opacity
'
,
'
1
'
);
})
$
(
"
#archivalProfile_XMLDropZone
"
).
on
(
'
dragleave
'
,
function
(
e
)
{
$
(
'
#archivalProfile_XMLDropZone
'
).
css
(
'
opacity
'
,
'
0.5
'
);
})
$
(
'
#archivalProfile_XMLDropZone
'
).
on
(
'
drop
'
,
function
(
e
)
{
if
(
e
.
originalEvent
.
dataTransfer
)
{
if
(
e
.
originalEvent
.
dataTransfer
.
files
.
length
)
{
e
.
preventDefault
();
e
.
stopPropagation
();
$
(
'
#archivalProfile_XMLDropZone
'
).
css
(
'
opacity
'
,
'
0.5
'
);
uploadProfile
(
e
.
originalEvent
.
dataTransfer
.
files
[
0
]);
}
}
})
// Files browser
$
(
'
#archivalProfile_XMLDropZone
'
).
on
(
'
click
'
,
function
()
{
$
(
'
#archivalProfile_filesBrowser
'
).
click
();
})
$
(
'
#archivalProfile_filesBrowser
'
).
on
(
'
change
'
,
function
()
{
uploadProfile
(
$
(
this
).
context
.
files
[
0
]);
})
// Cancel
$
(
'
#archivalProfile_cancelImport
'
).
on
(
'
click
'
,
function
()
{
cancelProfileForm
();
})
$
(
'
#archivalProfile_submitImport
'
).
on
(
'
click
'
,
function
()
{
$
(
'
#messageSavingModal
'
).
modal
();
});
// Submit
$
(
'
#confirmSaving
'
).
on
(
'
click
'
,
function
()
{
var
icon
=
$
(
'
<i/>
'
).
addClass
(
'
fa fa-spinner fa-spin
'
);
var
submitButton
=
$
(
'
#messageImport_submit
'
);
var
reference
=
$
(
'
#archivalProfile_form
'
).
find
(
'
input[name="reference"]
'
).
val
();
var
format
=
$
(
'
#archivalProfile_filesBrowser
'
).
val
().
split
(
'
.
'
).
pop
();
submitButton
.
find
(
'
i
'
).
removeClass
(
'
fa-level-down
'
).
addClass
(
'
fa-spin fa-spinner
'
);
if
(
!
reference
)
{
gritter
.
show
(
$
(
'
#cantUploadFileError
'
).
text
(),
false
);
return
;
}
var
fileName
=
$
(
'
#archivalProfile_fileName
'
).
text
().
split
(
'
.
'
);
var
ext
=
[
'
rng
'
,
'
RNG
'
,
'
xsd
'
,
'
XSD
'
];
if
(
$
.
inArray
(
fileName
[
fileName
.
length
-
1
],
ext
)
==
-
1
)
{
gritter
.
show
(
$
(
'
#wrongFileFormat
'
).
text
(),
false
);
return
;
}
$
(
'
.btn
'
).
prop
(
'
disabled
'
,
true
);
var
archivalProfile
=
ArchivalProfile
.
serialize
();
var
content
=
$
(
'
#archivalProfile_filesBrowser
'
).
data
(
'
base64
'
);
ajax
(
$
(
this
),
{
type
:
'
POST
'
,
url
:
'
/archivalProfile/upload/
'
+
reference
,
data
:
JSON
.
stringify
({
archivalProfile
:
archivalProfile
,
content
:
content
,
format
:
format
}),
contentType
:
'
application/json
'
,
dataType
:
'
json
'
,
success
:
function
(
response
)
{
gritter
.
show
(
response
.
message
,
response
.
status
,
response
.
errors
);
if
(
response
.
status
)
{
$
(
'
#archivalProfile_cancelImport
'
).
addClass
(
'
hide
'
);
$
(
'
#archivalProfile_submitImport
'
).
addClass
(
'
hide
'
);
$
(
'
#archivalProfile_replaceFile
'
).
removeClass
(
'
hide
'
);
$
(
"
#archivalProfile_download
"
).
removeClass
(
'
hide
'
);
}
$
(
'
#messageSavingModal
'
).
modal
(
'
hide
'
);
$
(
'
#messageSavingModal
'
).
one
(
'
hidden.bs.modal
'
,
function
()
{
load
(
'
/archivalProfiles
'
);
});
$
(
'
.btn
'
).
prop
(
'
disabled
'
,
false
);
},
error
:
function
(
response
)
{
gritter
.
show
(
response
.
responseJSON
.
message
,
response
.
responseJSON
.
status
,
response
.
responseJSON
.
errors
);
$
(
'
.btn
'
).
prop
(
'
disabled
'
,
false
);
}
});
})
// Replace
$
(
'
#archivalProfile_replaceFile
'
).
on
(
'
click
'
,
function
()
{
cancelProfileForm
();
})
$
(
"
#archivalProfile_download
"
).
on
(
'
click
'
,
function
()
{
var
reference
=
$
(
this
).
data
(
'
ref
'
);
window
.
open
(
'
/archivalProfile/export/
'
+
reference
);
})
function
cancelProfileForm
()
{
$
(
'
#archivalProfile_XMLDropZone
'
).
removeClass
(
'
hide
'
);
$
(
'
#archivalProfile_fileInfo
'
).
addClass
(
'
hide
'
);
$
(
'
#archivalProfile_filesBrowser
'
).
val
(
''
);
$
(
'
#archivalProfile_cancelImport
'
).
removeClass
(
'
hide
'
);
$
(
'
#archivalProfile_submitImport
'
).
removeClass
(
'
hide
'
);
$
(
'
#archivalProfile_replaceFile
'
).
addClass
(
'
hide
'
);
}
function
uploadProfile
(
file
)
{
oFileReader
=
new
FileReader
();
oFileReader
.
readAsText
(
file
);
oFileReader
.
onload
=
function
()
{
$
(
'
#archivalProfile_filesBrowser
'
).
data
(
'
base64
'
,
btoa
(
unescape
(
encodeURIComponent
(
oFileReader
.
result
))));
var
ext
=
file
.
name
.
split
(
'
.
'
).
pop
();
var
format
=
''
;
if
(
ext
==
'
rng
'
)
format
=
'
Relax NG (Regular Language for XML Next Generation)
'
;
if
(
ext
==
'
xsd
'
)
format
=
"
XML Schema Definition
"
;
$
(
'
#archivalProfile_fileFormat
'
).
html
(
format
);
$
(
'
#archivalProfile_fileName
'
).
html
(
file
.
name
);
$
(
'
#archivalProfile_fileDate
'
).
addClass
(
'
hide
'
);
$
(
'
#archivalProfile_XMLDropZone
'
).
addClass
(
'
hide
'
);
$
(
'
#archivalProfile_fileInfo
'
).
removeClass
(
'
hide
'
);
$
(
'
#archivalProfile_cancelImport
'
).
removeClass
(
'
hide
'
);
$
(
'
#archivalProfile_submitImport
'
).
removeClass
(
'
hide
'
);
$
(
'
#archivalProfile_replaceFile
'
).
addClass
(
'
hide
'
);
}
$
(
"
#archivalProfile_download
"
).
addClass
(
'
hide
'
);
}
</script>
\ No newline at end of file
src/presentation/maarchRM/Resources/view/recordsManagement/archivalProfile/profileUploadTab.html
0 → 100644
View file @
77a4a9f2
<li
role=
"presentation"
><a
href=
"#messageIntegrityTab"
aria-controls=
"messageIntegrityTab"
role=
"tab"
data-toggle=
"tab"
>
Profile file
</a></li>
src/presentation/maarchRM/Resources/view/recordsManagement/archive/description.html
View file @
77a4a9f2
...
...
@@ -10,9 +10,10 @@
<span
id=
'archiveNameH3'
>
<?merge archive.archiveName ?>
</span>
<?merge archive.archiveName.bool().not() ?>
<span
id=
'archiveNameH3'
>
Archive
</span>
<?merge
modificationPrivilege
.bool() ?>
<?merge
editMetadata
.bool() ?>
<div
class=
"pull-right"
>
<button
type=
"button"
class=
"btn btn-warning editMetadata"
data-archiveid=
"[?merge archive.archiveId ?]"
title=
"Edit metadata"
><i
class=
"fa fa-edit"
>
</i>
Edit metadata
</button>
<?merge modificationPrivilege.bool() ?>
<button
type=
"button"
class=
"btn btn-warning editMetadata"
data-archiveid=
"[?merge archive.archiveId ?]"
title=
"Edit metadata"
><i
class=
"fa fa-edit"
>
</i>
Edit metadata
</button>
</div>
</h3>
</div>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment