Changeset 24005

Show
Ignore:
Timestamp:
06.05.2011 12:18:03 (9 years ago)
Author:
davidb
Message:

Further improvements.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/macros/seaweed.dm

    r23749 r24005  
    11package Global 
     2 
     3_busyicon_ {<img border="0" src="_httpimages_/busy.gif" width="30" height="30">} 
    24 
    35_seaweedscript_ { 
     
    189191  \} 
    190192 
    191   function saveMetadata()  
     193  var savedMetadata = false; 
     194 
     195  function _saveMetadata(confirmSave)  
    192196  \{ 
    193197      var editedArray = de.Changes.getChangedEditableSections(); 
     
    195199 
    196200      if (editedArray.length>0) \{ 
    197           var commitChanges = confirm("Commit edited metadata?"); 
     201          var commitChanges = true; 
     202      if (confirmSave) \{  
     203          commitChanges = confirm("Commit edited metadata?"); 
     204      \} 
     205 
    198206      if (commitChanges) \{ 
    199         for (i=0; i<editedArray.length; i++) 
    200           \{ 
    201                 saveMetadataElement(editedArray[i]); 
    202           \} 
    203  
     207        savedMetadata = true; 
     208        for (i=0; i<editedArray.length; i++) \{ 
     209            saveMetadataElement(editedArray[i],confirmSave); 
     210        \} 
    204211      \} 
    205212 
     
    211218  \} 
    212219 
    213  
    214      
     220  function saveMetadata()  
     221  \{ 
     222      _saveMetadata(true); 
     223  \} 
     224 
     225  function unpromptedSaveMetadata()  
     226  \{ 
     227      _saveMetadata(false); 
     228      alert("Save Completed"); 
     229  \} 
     230 
     231  function saveAsDraftDocument(docid,toCollect)  
     232  \{ 
     233    gsapi.cloneDocument(docid,toCollect); 
     234 
     235    var storeCollect = gsapi.setCollect(toCollect); 
     236    seaweedReindexCollection("incremental",seaweedReindexCallback); 
     237    gsapi.setCollect(storeCollect); 
     238 
     239    alert("Draft Saved and Collection Reindex"); 
     240  \} 
     241 
     242 
     243 
    215244  function seaweedReindexCollection() \{ 
    216245    var arc = document.getElementById("seaweedRC"); 
    217     arc.innerHTML = "Reindexing ..."; 
     246    arc.innerHTML = "Reindexing: " + '_busyicon_'; 
    218247    gsapi.reindexCollection("incremental",seaweedReindexCallback); 
    219248  \} 
     
    222251    var arc = document.getElementById("seaweedRC"); 
    223252    arc.innerHTML = "Reindexing done."; 
     253    setTimeout("seaweedReindexDelayedCallback()",2000); 
    224254  \}             
    225255     
     256  function seaweedReindexDelayedCallback() \{ 
     257    var arc = document.getElementById("seaweedRC"); 
     258    arc.innerHTML = "Reindex"; 
     259  \}             
     260     
    226261 
    227262</script> 
     
    229264} 
    230265 
    231 _first-metadata-spanwrap_ {<span metapos="0" metaname="_1_" docoid="_2_" class="editable-metadata">} 
    232 _/first-metadata-spanwrap_ {</span>} 
     266 
     267_first-metadata-spanwrap_ {<div><span metapos="0" metaname="_1_" docoid="_2_" class="editable-metadata">} 
     268_/first-metadata-spanwrap_ {</span></div>} 
    233269 
    234270_first-metadata-divwrap_ {<div metapos="0" metaname="_1_" docoid="_2_" class="editable-metadata">}