Diff for /loncom/publisher/lonpubdir.pm between versions 1.174 and 1.175

version 1.174, 2022/05/27 04:24:55 version 1.175, 2023/06/10 23:01:15
Line 549  sub dircontrols { Line 549  sub dircontrols {
        acti => 'Actions for current directory',         acti => 'Actions for current directory',
        updc => 'Upload a new document',         updc => 'Upload a new document',
        pick => 'Please select an action to perform using the new filename',         pick => 'Please select an action to perform using the new filename',
                                          shcu => 'Shortcuts',
                                       );                                        );
       my %js_lt = &Apache::lonlocal::texthash(
                                          nanf => 'Name of New File',
                                          nans => 'Name of New Subdirectory',
                                          psfn => 'Please specify file name',
       ); 
       &js_escape(\%js_lt);
     my $mytype = $lt{'type'}; # avoid conflict with " and ' in javascript      my $mytype = $lt{'type'}; # avoid conflict with " and ' in javascript
     # Calculate free space in bytes.      # Calculate free space in bytes.
     # $disk_quota is in MB and $current_disk_usage is in kB      # $disk_quota is in MB and $current_disk_usage is in kB
Line 584  sub dircontrols { Line 591  sub dircontrols {
       <fieldset>        <fieldset>
         <legend>$lt{'updc'}</legend>          <legend>$lt{'updc'}</legend>
         <input type="hidden" name="filename" value="/priv$thisdisfn/" />          <input type="hidden" name="filename" value="/priv$thisdisfn/" />
         <input type="file" name="upfile" class="LC_flUpload" size="20" />          <input type="file" name="upfile" class="LC_flUpload" />
         <input type="hidden" id="LC_free_space" value="$free_space" />          <input type="hidden" id="LC_free_space" value="$free_space" />
         <input type="button" value="$lt{'uplo'}"  onclick="checkUpload(this.form)" />          <input type="button" value="$lt{'uplo'}"  onclick="checkUpload(this.form)" />
       </fieldset>        </fieldset>
Line 619  sub dircontrols { Line 626  sub dircontrols {
                     <option value="newtaskfile">$lt{'nbt'}:</option>                      <option value="newtaskfile">$lt{'nbt'}:</option>
                     <option value="newlibraryfile">$lt{'nlib'}:</option>                      <option value="newlibraryfile">$lt{'nlib'}:</option>
             <option value="newdir">$lt{'nsub'}:</option>              <option value="newdir">$lt{'nsub'}:</option>
   </select>&nbsp;<input type="text" name="newfilename" placeholder="$lt{'type'}" value="" onfocus="if (this.value == is.empty()) this.value=''" />&nbsp;<input type="button" value="Go" onclick="validate_go();" />    </select>&nbsp;<input type="text" id="newnameid" name="newfilename" placeholder="$lt{'type'}" value="" onfocus="if (this.value == is.empty()) this.value=''" />&nbsp;<input type="button" value="Go" onclick="validate_go();" />
  <br />   <br />
                 <span>Quickactions:                  <span>$lt{'shcu'}:
                  <input type="hidden" name="mode"/>                   <input type="hidden" name="mode"/>
                  <a href="javascript:void(0)" onclick="javascript:validate_action('blank')">                   <a href="javascript:void(0)" onclick="javascript:validate_action('blank')">
     <img src="/adm/lonIcons/unknown.gif" title="Create blank problem file"></a>      <img src="/adm/lonIcons/unknown.gif" title="Create blank problem file"></a>
Line 634  sub dircontrols { Line 641  sub dircontrols {
                 </span>                  </span>
                  <script type="text/javascript">                   <script type="text/javascript">
                      function validate_action(action){                       function validate_action(action){
                            if (document.getElementById('newnameid')) {
                          if (document.getElementsByName(\'newfilename\')[0].value != \'\'){                               if (document.getElementById('newnameid').value == '') {
                              if (action == "blank") {                                   var newname;
  document.fileaction.action.value=\'newproblemfile\';                                   var prompttext = "$js_lt{'nanf'}";
  document.fileaction.mode.value=\'blank\';                                   if (action == 'folder') {
  } else if (action == "problemtempl") {                                       prompttext = "$js_lt{'nans'}";
  document.fileaction.action.value=\'newproblemfile\';                                   }
                                  validate_go();                                   newname=prompt(prompttext);
                              } else if (action == "blankhtml") {                                   if (newname != '') {
                                  document.fileaction.action.value=\'newhtmlfile\';                                       document.getElementById('newnameid').value = newname;
                                  validate_go();                                   }
                              } else if (action == "folder") {                               }
                                  document.fileaction.action.value=\'newdir\';                               if (document.getElementById('newnameid').value != '') {
                                  document.fileaction.mode.value=\'folder\';                                   if (action == 'blank') {
        document.fileaction.action.value='newproblemfile';
        document.fileaction.mode.value='blank';
            } else if (action == 'problemtempl') {
        document.fileaction.action.value='newproblemfile';
                                        validate_go();
                                    } else if (action == 'blankhtml') {
                                        document.fileaction.action.value='newhtmlfile';
                                        validate_go();
                                    } else if (action == 'folder') {
                                        document.fileaction.action.value='newdir';
                                        document.fileaction.mode.value='folder';
                                    }
                                    fileaction.submit();
                                } else {
                                    alert("$js_lt{'psfn'}");
                              }                               }
                              fileaction.submit();  
                          } else {  
                              alert(\'Please specify file name.\');  
                              // TODO: ask for filename? if so, do some refactoring  
   
                          }                           }
                      }                       }
                  </script>                   </script>

Removed from v.1.174  
changed lines
  Added in v.1.175


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>