source: main/trunk/greenstone2/macros/deposit.dm@ 31951

Last change on this file since 31951 was 31951, checked in by ak19, 3 years ago

Bugfix to depositor: commas in metadata entered through the depositor were not being preserved, as commas were used to split the many fields (of form cgi params) on in depositoraction.cpp. Now depositor.dm escapes the commas with URL encoding in the metadatafields section of the depositor step1 form, while depositoraction.cpp decodes the URL-encoded commas again.

  • Property svn:keywords set to Author Date Id Revision
File size: 19.6 KB
Line 
1# this file must be UTF-8 encoded
2
3package depositor
4
5_imagethispage_ {_If_("_cgiargdi1local_" eq "1",<a href="_httppagedepositorcurrentcollection_">_textdepositorlocal_</a>,<a href="_httppagedepositor_">_textdepositor_</a>)}
6
7# _pagescriptextra_ will be set to the appropriate _***scriptextra_
8# macro from within the server
9_pagescriptextra_ {}
10
11# a plain header for those pages that need it (the _pagebanner_ macro
12# will be set to this by the server for those pages.
13_plainbanner_ {}
14
15# dont want links to help" or "preferences" pages from within
16# collector
17_globallinks_ {_homelink_}
18
19# metadata fields that will be displayed in the step1 page,
20# this is determined by the depositormetadata array defined in the collection's collect.cfg
21_metadataconf_ {var DepositorMDFields = new Array();}
22# If you are using GLI, and want to modify the depositormetadata, then define
23# the custommetadataconf macrco in exta.dm or collectionmacro in collect.cfg
24
25_custommetadataconf_ {}
26
27# store any existing metadata values
28_cachedmetadatavalues_ {var CachedMDValues = new Array();}
29# set the following to 0 if you don't want to cache metadata values
30_cacheoption_{1}
31#######################################################################
32# steps
33
34_numsteps_ {3}
35
36# clashes with general text (in english2.dm) about what to do at this stage
37# now it doesn't appear in wizard bar, is it needed?
38##_textselect_ {The Depositor}
39_textstep1_ {_textmeta_}
40_textstep2_ {_textintro_}
41_textstep3_ {_textconfirm_}
42
43# set laststep to depositonly if you don't want the item to be indexed
44_laststep_ {bild}
45_textlaststep_ {_textbild_}
46
47
48#######################################################################
49# icons
50
51_iconcross_ {<img src="_httpimg_/cross.gif">}
52_iconcross_ [v=1] {<b>no</b>}
53_icontick_ {<img src="_httpimg_/tick.gif">}
54_icontick_ [v=1] {<b>yes</b>}
55_iconblank_ {<img src="_httpimg_/blank.gif">}
56_iconblank_ [v=1] {}
57
58_imagemore_ {<a href="javascript:more()" onMouseover="roll('more',1);" onMouseOut="roll('more',0);"><img
59name="more" src="_httpimg_/moreof.gif" onLoad="gbutton(this,'_httpimg_/moreon.gif');" border=0 alt="_textmore_"
60title="_textmore_" align=top></a>}
61_imagemore_ [v=1] {_textmore_}
62
63_icongreyarrow_ {<img src="_httpimg_/grarrow.gif">}
64_icongreyuparrow_ {<img src="_httpimg_/guarrow.gif">}
65_iconstop_ {<img src="_httpimg_/stop.gif" border=0>}
66
67
68#######################################################################
69# http macros
70
71_httpinfo_ {_gwcgi_?e=_compressedoptions_&p=info}
72_httpsrce_ {_gwcgi_?e=_compressedoptions_&p=srce}
73_httpconf_ {_gwcgi_?e=_compressedoptions_&p=conf}
74_httpbild_ {_gwcgi_?e=_compressedoptions_&p=bild}
75_httpview_ {_gwcgi_?e=_compressedoptions_&a=p&p=about&c=_cgiargdi1dirnameUrlsafe_}
76_httpdel_ {javascript:do\_delete();}
77_httpexpt_ {_gwcgi_?e=_compressedoptions_&p=expt}
78
79
80#######################################################################
81# select // this really should be intro
82#######################################################################
83
84# _fullnamemenu_ has previous collection selected. Since there is no button
85# on this page to proceed, we reset the drop down box to have no collection
86# selected.
87_selectheader_ {_cgihead_
88_htmlhead_(class="bgimage" onLoad="initialize();")_startspacer_
89}
90
91
92_selectscriptextra_ {
93
94function initialize() \{
95 document.depositorform.di1dirname.value = "";
96\}
97
98function check\_submit (gotopage) \{
99 var form = document.depositorform;
100 form.p.value = gotopage;
101
102 // if 'dirname' given, then link to cgiarg c so collection specific macros work
103 if (form.di1dirname) \{
104 form.c.value = form.di1dirname.value;
105 \}
106
107 form.submit();
108\}
109
110function menuchange() \{
111
112 _buildtypearray_
113
114 var form = document.depositorform;
115
116 if (form.di1dirname.value == "") \{
117 alert("Please choose a collection first");
118 \}
119 else \{
120 var pos = form.di1dirname.selectedIndex;
121 var bt = buildtype[pos];
122 if (bt=="") \{ bt = "mg"; \}
123 form.di1buildtype.value = bt;
124
125 check\_submit('step1');
126 \}
127\}
128
129}
130
131_selectcontent_ {
132<form name="depositorform" method=post action="_gwcgi_">
133<input type=hidden name="e" value="_decodedcompressedoptionsAttrsafe_">
134<input type=hidden name="p" value="intro">
135<input type=hidden name="c" value="">
136<input type=hidden name="di1buildtype" value="">
137
138<center>
139<table width=_pagewidth_>
140<tr><td>
141<div class="divbar">&nbsp;</div>
142<center><h2>_textselect_</h2></center>
143<div class="divbar">&nbsp;</div>
144
145<p> <em>_textselectcol_</em>
146
147<p>_fullnamemenu_<br><br>
148<div class="divbar">&nbsp;</div>
149</td></tr>
150</table>
151</center>
152</form>
153}
154
155
156#######################################################################
157# step 1
158#######################################################################
159
160#here goes the "memorization" macros for each form field.
161#_di1md.Title_ {_If_("_:cgiargdi1md.Title_" eq "_cgiargdi1md.Title_",_cgiargdi1md.Title_,)}
162#_di1md.Creator_ {_If_("_:cgiargdi1md.Creator_" eq "_cgiargdi1md.Creator_",_cgiargdi1md.Creator_,)}
163#_di1md.Description_ {_If_("_:cgiargdi1md.Description_" eq "_cgiargdi1md.Description_",_cgiargdi1md.Description_,)}
164#_di1md.Subject_ {_If_("_:cgiargdi1md.Subject_" eq "_cgiargdi1md.Subject_",_cgiargdi1md.Subject_,)}
165
166_step1scriptextra_ {
167
168_If_("_custommetadataconf_" ne "",_custommetadataconf_,_metadataconf_)
169_cachedmetadatavalues_
170
171function loadForm() \{
172
173 var formcontainer = document.getElementById('formcontainer');
174
175 if (!formcontainer) \{
176 return;
177 \}
178
179 for (i=0; i < DepositorMDFields.length; i++) \{
180 if (DepositorMDFields[i]==null) \{
181 continue;
182 \}
183 metadataField = DepositorMDFields[i];
184
185 var labelCell = document.createElement("td");
186 labelCell.innerHTML = metadataField.label + ": ";
187 labelCell.setAttribute("title", metadataField.tooltip);
188
189 var cachedValue;
190 if(CachedMDValues[0] !=null && CachedMDValues[0]["di1md." + metadataField.name])\{
191 cachedValue = CachedMDValues[0]["di1md." + metadataField.name];
192 \} else \{
193 cachedValue = "";
194 \}
195
196 var inputObj;
197 if (metadataField.type=="text") \{
198 inputObj = document.createElement("input");
199 inputObj.setAttribute("type","text");
200 inputObj.setAttribute("size","74");
201 inputObj.setAttribute("value", cachedValue);
202 \}
203 else if (metadataField.type=="textarea") \{
204 inputObj = document.createElement("textarea");
205 inputObj.setAttribute("rows","5");
206 inputObj.setAttribute("cols", "40");
207 inputObj.innerHTML = cachedValue;
208 \}
209 inputObj.setAttribute("name", "di1md."+ metadataField.name);
210
211 var inputCell = document.createElement("td");
212 inputCell.appendChild(inputObj);
213
214 var entry = document.createElement("tr");
215 entry.appendChild(labelCell);
216 entry.appendChild(inputCell);
217
218 formcontainer.appendChild(entry);
219 \}
220\}
221
222function check\_submit (gotopage) \{
223
224 // escape any commas in the metadata fields in order to preserve them
225 // preserve any commas in the metadata fields by escaping them here
226 // so that meta values containing commas don't end up split at comma by depositoraction.cpp
227
228 // Get just the part of form containing metadata input elements
229 // as we don't want to modify any other part of the form
230 var formContainer = document.getElementById('formcontainer');
231 // https://stackoverflow.com/questions/25302684/getting-all-child-input-elements-within-a-div
232 var inputNodes = formContainer.getElementsByTagName('input');
233 for(var i = 0; i < inputNodes.length; i++) \{
234 var inputNode = inputNodes[i];
235 if(inputNode.type == 'text') \{
236 if(inputNode.value) \{
237 var val = inputNode.value;
238 // To replace all occurrences in a string, and not just the 1st, need to do a global
239 // substitution. See https://www.w3schools.com/jsref/jsref_replace.asp
240 inputNode.value = val.replace(/,/g, "%2C");
241 \}
242 \}
243 \}
244
245 // Proceed as usual from here on to submit the modified form
246
247 var form = document.depositorform;
248 form.p.value = gotopage;
249 form.submit();
250\}
251
252if (window.addEventListener) window.addEventListener("load", loadForm, false);
253else if (window.attachEvent) window.attachEvent("onload", loadForm);
254
255}
256
257_step1content_ {
258
259<form name="depositorform" method=post action="_gwcgi_" enctype="multipart/form-data">
260
261<input type=hidden name="e" value="_decodedcompressedoptionsAttrsafe_">
262<input type=hidden name="p" value="_cgiargpAttrsafe_">
263
264
265<center>
266<table width=_pagewidth_>
267<tr><td>
268<div class="divbar">&nbsp;</div>
269<center>
270<h2>_textstep1_</h2>
271<p>_textdepositorblurb_
272</center>
273<div class="divbar">&nbsp;</div>
274<ul>
275
276<!--input goes here-->
277<!--dynamic load the metadata elements as configured in the collection's collect.cfg-->
278<p><table><tbody id="formcontainer"></tbody></table>
279
280<div class="divbar">&nbsp;</div>
281</td></tr>
282<tr><td>_depositorbar_</td></tr>
283</table></center>
284
285</form>
286
287}
288
289#######################################################################
290# step 2
291#######################################################################
292
293_userfile_ {_If_("_:cgiargdi1userfile_" eq "_cgiargdi1userfile_",_cgiargdi1userfileAttrsafe_,)}
294
295_step2scriptextra_ {
296
297function check\_submit (gotopage) \{
298 var form = document.depositorform;
299 form.p.value = gotopage;
300 form.submit();
301\}
302}
303
304_step2content_ {
305<form name="depositorform" method=post action="_gwcgi_" enctype="multipart/form-data">
306<input type=hidden name="e" value="_decodedcompressedoptionsAttrsafe_">
307<input type=hidden name="p" value="_cgiargpAttrsafe_">
308<center>
309<table width=_pagewidth_>
310<tr><td>
311<div class="divbar">&nbsp;</div>
312<center><h2>_textstep2_</h2></center>
313<div class="divbar">&nbsp;</div>
314<p>_textfilename_: <input type=file name=di1userfileinfo value="_userfile_"></p>
315<div class="divbar">&nbsp;</div>
316</td></tr>
317<tr><td>_depositorbar_</td></tr>
318</table>
319</center>
320</form>
321}
322
323#######################################################################
324# step 3
325#######################################################################
326
327#here goes the "memorization" macros for each form field.
328#_di1_ {_If_("_:cgiargdi1md.Title_" eq "_cgiargdi1md.Title_",_cgiargdi1md.Title_,)}
329#_di1md.Creator_ {_If_("_:cgiargdi1md.Creator_" eq "_cgiargdi1md.Creator_",_cgiargdi1md.Creator_,)}
330
331_step3scriptextra_ {
332
333function check\_submit (gotopage) \{
334 var form = document.depositorform;
335 form.p.value = gotopage;
336 form.submit();
337\}
338}
339
340_step3content_ {
341<form name="depositorform" method=post action="_gwcgi_" enctype="multipart/form-data">
342<input type=hidden name="e" value="_decodedcompressedoptionsAttrsafe_">
343<input type=hidden name="p" value="_cgiargpAttrsafe_">
344<center>
345<table width=_pagewidth_>
346<tr><td>
347<div class="divbar">&nbsp;</div>
348<center><h2>_textstep3_</h2></center>
349<div class="divbar">&nbsp;</div>
350<p>_textfilename_: _di1userfile_ </p>
351<p>_textfilesize_: _di1userfilesize_ </p>
352<div class="divbar">&nbsp;</div>
353</td></tr>
354<tr><td>_depositorbar_</td></tr>
355</table>
356</center>
357</form>
358}
359
360#######################################################################
361# bild (main frameset for build page)
362#######################################################################
363
364_bildcontent_ {
365<html>
366<head>
367<!--
368<script>
369function check\_submit (gotopage) \{
370 var form = document.depositorform;
371 form.p.value = gotopage;
372 form.submit();
373\}
374</script>
375-->
376</head>
377
378<form name="depositorform" method=post action="_gwcgi_">
379<input type=hidden name="e" value="_decodedcompressedoptionsAttrsafe_">
380<input type=hidden name="p" value="_cgiargpAttrsafe_">
381
382<frameset rows="*,160" border=0>
383 <noframes><body bgcolor="#ffffff">
384 <p>You must have a frame enabled browser to obtain feedback
385 on how the building process is progressing. The collection <i>will</i>
386 continue to build as normal however.</p>
387
388 <table>
389 <tr valign=center><td>
390 To stop the building process at any time, click here.
391 <br>The collection you are working on will remain intact.
392 </td>
393 <td><input type="submit" value="stop building"></td>
394 </table>
395
396 </body>
397 </noframes>
398 <frame src="_gwcgi_?e=_compressedoptions_&p=bildframe1">
399 <frame src="_gwcgi_?e=_compressedoptions_&p=bildstatus">
400</frameset>
401</html>
402}
403
404#######################################################################
405# bildframe1
406#######################################################################
407
408# header overridden to allow base target to be set
409
410_bildframe1header_ {_cgihead_
411<html>
412<head>
413<base target=_top>
414<title>_pagetitle_</title>
415_globalscripts_
416_cssheader_
417</head>
418<body class="bgimage">
419_startspacer__pagebanner_
420}
421
422
423_bildframe1header_[v=1] {_cgihead_
424<html>
425<head>
426<base target=_top>
427<title>_pagetitle_</title>
428_globalscripts_
429</head>
430<body class="bgimage">
431_pagebanner_
432}
433
434_bildframe1scriptextra_ {}
435
436_bildframe1content_ {
437<form name="depositorform" method=post action="_gwcgi_">
438<input type=hidden name="e" value="_decodedcompressedoptionsAttrsafe_">
439<input type=hidden name="p" value="bildcancel">
440
441<center>
442<table width=_pagewidth_>
443<tr><td>
444<div class="divbar">&nbsp;</div>
445<center>
446<h2>_textbild_</h2>
447</center>
448<div class="divbar">&nbsp;</div>
449<p>
450_depositor:textbild1_
451<p>
452
453<table>
454<tr valign=center><td>
455_depositor:textbild2_
456</td>
457<td><input type="submit" value="_depositor:textstopbuild_"></td>
458</table>
459
460<p>
461_depositor:textbild3_
462</td></tr>
463</table></center>
464</form>
465}
466
467
468#######################################################################
469# bildcancel
470#######################################################################
471
472_bildcancelscriptextra_ {
473function check\_submit (gotopage) \{
474 var form = document.depositorform;
475 form.p.value = gotopage;
476 form.submit();
477\}
478}
479_bildcancelcontent_ {
480<form name="depositorform" method=post action="_gwcgi_">
481<input type=hidden name="e" value="_decodedcompressedoptionsAttrsafe_">
482<input type=hidden name="p" value="_cgiargpAttrsafe_">
483
484</form>
485<center>
486<table width=_pagewidth_>
487<tr><td>
488<div class="divbar">&nbsp;</div>
489<center>
490<h2>_depositor:textbuildcancelled_</h2>
491</center>
492<div class="divbar">&nbsp;</div>
493<p>
494_depositor:textbildcancel1_
495<p><center>
496_depositorbar_
497</center>
498
499</td></tr>
500</table></center>
501}
502
503
504#######################################################################
505# bildstatus
506#######################################################################
507
508# special header for status page
509_bildstatusheader_ {_cgihead_
510_htmlhead_(class="bgimage" onLoad="initialize();")_startspacer_
511}
512_bildstatusheader_[v=1] {_cgihead_
513_htmlhead_(onLoad="initialize();")
514}
515
516_bildstatusscriptextra_ {
517var timer = 5;
518function initialize() \{
519 setTimeout("count_down()",1000);
520\}
521
522function count_down() \{
523 if (timer==0) \{
524 window.status = "";
525 document.depositorform.submit();
526 \} else \{
527 if (timer==1) \{
528 window.status = "_textbsupdate1_";
529 \} else \{
530 window.status = "_textbsupdate2_ "+timer+" _textseconds_";
531 \}
532 timer--;
533 setTimeout("count_down()",1000);
534 \}
535\}
536}
537
538_bildstatuscontent_ {
539<form name="depositorform" method=post action="_gwcgi_">
540<input type=hidden name="e" value="_decodedcompressedoptionsAttrsafe_">
541
542<center>
543<table width=_pagewidth_>
544<tr><td><center>
545_statusline_
546</center>
547</td></tr>
548</table></center>
549</form>
550}
551
552
553#######################################################################
554# bilddone
555#######################################################################
556
557_bilddoneheader_ {_cgihead_
558_htmlhead_(class="bgimage")_startspacer_
559}
560_bilddonescriptextra_ {
561
562function check\_submit (gotopage) \{
563 var form = document.depositorform;
564 form.p.value = gotopage;
565 form.submit();
566\}
567
568}
569
570
571_bilddonecontent_ {
572<center>
573<table width=_pagewidth_>
574<tr><td>
575<p>_textbildsuc_
576
577<p>_textviewbildsummary_
578
579<p><center>
580_depositorbar_
581</center>
582
583</td></tr>
584</table></center>
585}
586
587
588#######################################################################
589# bildfail
590#######################################################################
591
592_bildfailheader_ {_cgihead_
593_htmlhead_(class="bgimage")_startspacer_
594}
595_bildfailscriptextra_ {
596function check\_submit (gotopage) \{
597 var form = document.depositorform;
598 form.p.value = gotopage;
599 form.submit();
600\}
601}
602_bildfailcontent_ {
603<form name="depositorform" method=post action="_gwcgi_">
604<input type=hidden name="e" value="_decodedcompressedoptionsAttrsafe_">
605<input type=hidden name="p" value="_cgiargpAttrsafe_">
606
607</form>
608
609<table width=_pagewidth_>
610<tr><td>
611_textfailmsg_
612</td></tr>
613<tr><td>
614</td></tr>
615</table></center>
616}
617
618# _textfailmsg_ will be set to one of the following macros from within
619# the server
620
621_textfailmsg1_ {
622_textfailmsg11_
623<p><center>
624_depositorbar_
625</center>
626}
627
628_textfailmsg6_ {_textfailmsg1_}
629
630_textfailmsg2_ {
631_textfailmsg21_
632<p>_textblcont_
633<p>_faillog_
634<p>_texttryagain_
635}
636
637_textfailmsg3_ {
638_textfailmsg31_
639<p>_textblcont_
640<p>_faillog_
641<p>_texttryagain_
642}
643
644_textfailmsg4_ {
645_textfailmsg41_
646<p>_textblcont_
647<p>_faillog_
648}
649
650_textfailmsg5_ {_textfailmsg4_}
651
652_textfailmsg7_ {
653_textfailmsg71_
654<p>_texttryagain_
655}
656
657#######################################################################
658# Error and message pages
659#######################################################################
660
661_messagehead_ {
662<form name="depositorform" method=post action="_gwcgi_">
663<input type=hidden name="e" value="_decodedcompressedoptionsAttrsafe_">
664
665<center>
666<table width=_pagewidth_>
667<tr><td>
668<div class="divbar">&nbsp;</div>
669}
670
671_messagefoot_ {
672<p>
673<a href="javascript:document.depositorform.submit();">_textretcoll_</a>
674<div class="divbar">&nbsp;</div>
675</td></tr>
676</table></center>
677</form>
678}
679
680_messagefootnolink_ {
681<div class="divbar">&nbsp;</div>
682</td></tr>
683</table></center>
684</form>
685}
686
687#_delpermissioncontent_ {
688#_messagehead_
689#<p>
690#_textdelperm_
691#_messagefoot_
692#}
693
694#_delinvalidcontent_ {
695#_messagehead_
696#<p>
697#_textdelinv_
698#_messagefoot_
699#}
700
701#_delsuccesscontent_ {
702#_messagehead_
703#<p>
704#_textdelsuc_
705#_messagefoot_
706#}
707
708#_clonefailcontent_ {
709#_messagehead_
710#<input type=hidden name="bc1clone" value="0">
711#<p>_textclonefail_
712#_messagefoot_
713#}
714
715_genericcontent_ {
716_messagehead_
717<p>_textcolerr_
718_messagefoot_
719}
720
721_tmpfailcontent_ {
722_messagehead_
723<p>
724_texttmpfail_
725_messagefoot_
726}
727
728#_mkcolfailcontent_ {
729#_messagehead_
730#<p>_textmkcolfail_
731#_messagefoot_
732#}
733
734_nocollectioncontent_ {
735_messagehead_
736<p>_textnocontent_
737<br><a href="_httppagedepositor_">_textrestart_</a>
738<p>
739_messagefootnolink_
740}
741
742#_reloaderrorcontent_ {
743#_messagehead_
744#<p>_textreloaderror_
745#<br><a href="_httppagedepositor_">_textrestart_</a>
746#<p>
747#_messagefootnolink_
748#}
749
750_exptscriptextra_ {}
751
752#_exptsuccesscontent_ {
753#_messagehead_
754#<input type=hidden name=p value=existing>
755#<p>_textexptsuc_
756#_messagefoot_
757#}
758
759#_exptfailcontent_ {
760#_messagehead_
761#<input type=hidden name=p value=existing>
762#_textexptfail_
763#_messagefoot_
764#}
765
766#######################################################################
767# depositonly
768#######################################################################
769
770_depositonlyscriptextra_ {}
771
772_depositonlycontent_ {
773
774<center>
775<em>Thanks for using the Depositor! Cick <a href="_gwcgi_">here</a> to return to the Greenstone home page. </em>
776<table width=_pagewidth_>
777<tr><td>
778<div class="divbar">&nbsp;</div>
779<center><h2>_textstep3_</h2></center>
780<div class="divbar">&nbsp;</div>
781<p>_textfilename_: _di1userfile_ </p>
782<p>_textfilesize_: _di1userfilesize_ </p>
783<div class="divbar">&nbsp;</div>
784</td></tr>
785<tr><td></td></tr>
786</table>
787</center>
788
789}
790
791###################################################
792## text macros that are defined by another package
793###################################################
794
795
796_textbsupdate1_ {_wizard:textbsupdate1_}
797_textbsupdate2_ {_wizard:textbsupdate2_}
798_textseconds_ {_wizard:textseconds_}
799
800_textbildsuc_ {_wizard:textbildsuc_}
801_textviewbildsummary_ {_wizard:textviewbildsummary_}
802
803_textview_ {_wizard:textview_}
804_textbild1_ {_wizard:textbild1_}
805
806_textbild2_ {_wizard:textbild2_}
807
808_textstopbuild_ {_wizard:textstopbuild_}
809
810_textbild3_ {_wizard:textbild3_}
811
812_textbuildcancelled_ {_wizard:textbuildcancelled_}
813
814_textbildcancel1_ {_wizard:textbildcancel1_}
815
816_textfailmsg11_ {_wizard:textfailmsg11_}
817_textfailmsg21_ {_wizard:textfailmsg21_}
818_textblcont_ {_wizard:textblcont_}
819
820_textfailmsg31_ {_wizard:textfailmsg31_}
821_textfailmsg41_ {_wizard:textfailmsg41_}
822_textfailmsg71_ {_wizard:textfailmsg71_}
Note: See TracBrowser for help on using the repository browser.