Annotation of loncom/publisher/publisher.html, revision 1.40

1.1       www         1: <html>
                      2: <head>
                      3: <title>LON-CAPA Publishing Frame</title>
1.38      albertel    4: <script type="text/javascript">
                      5: //<!--
1.29      www         6: function frameloc() {
1.31      www         7:     if (parent.LONCAPAToBePublished.location.pathname.indexOf("/~")!=-1) {
                      8:        parent.lastknownpriv=parent.LONCAPAToBePublished.location.pathname;
1.29      www         9:     }
1.31      www        10: // alert ('We are at '+parent.lastknownpriv);
1.29      www        11:     return unescape(parent.lastknownpriv);
                     12: }
1.1       www        13: 
                     14: function getfilename() {
1.29      www        15:    document.publisher.filename.value=frameloc();
1.7       www        16:    if ((document.publisher.filename.value.charAt(
                     17:         document.publisher.filename.value.length-1)!='/') &&
                     18:        (document.publisher.filename.value.indexOf('/adm/pubdir')==-1)) {
                     19:         document.publisher.submit();
                     20:    } else {
1.35      www        21:       alert('MT{Cannot publish directory}');
1.7       www        22:    }
1.1       www        23: }
                     24: 
1.4       www        25: function getdfilename() {
1.29      www        26:   document.dpublisher.filename.value=frameloc();
1.6       www        27:   if (document.dpublisher.filename.value.indexOf('/adm/pubdir')==-1) {
                     28:       document.dpublisher.submit();
                     29:   }
1.4       www        30: }
                     31: 
1.9       www        32: function getufilename() {
1.29      www        33:   document.upublisher.filename.value=frameloc();
1.14      www        34:   if (document.upublisher.filename.value.indexOf('/adm/pubdir')!=-1) {
                     35:       document.upublisher.filename.value=document.dpublisher.filename.value;
1.9       www        36:   }
1.14      www        37:   document.upublisher.submit();
1.9       www        38: }
                     39: 
1.4       www        40: function getrfilename() {
1.29      www        41:   document.rpublisher.filename.value=frameloc();
1.8       www        42:    if ((document.rpublisher.filename.value.charAt(
                     43:         document.rpublisher.filename.value.length-1)!='/') &&
                     44:        (document.rpublisher.filename.value.indexOf('/adm/pubdir')==-1)) {
                     45:         document.rpublisher.submit();
                     46:    } else {
1.35      www        47:       alert('MT{Cannot retrieve directory}');
1.8       www        48:    }
1.4       www        49: }
                     50: 
1.24      albertel   51: function getactionfilename() {
1.29      www        52:   document.fileaction.filename.value=frameloc();
1.24      albertel   53:   var test=document.fileaction.action.selectedIndex;
1.34      albertel   54:   if (test == 8) { // trying to create a directory
1.24      albertel   55:       if (document.fileaction.filename.value.indexOf('/adm/pubdir')!=-1) {
                     56:           document.fileaction.filename.value=document.dpublisher.filename.value;
                     57:       }
                     58:       if ((document.fileaction.filename.value.charAt(
                     59:            document.fileaction.filename.value.length-1)!='/') &&
                     60:            (document.fileaction.filename.value.indexOf('/adm/pubdir')==-1)) {
1.35      www        61:           alert('MT{Must create new subdirectory inside a directory}');
1.24      albertel   62:           return;
                     63:       }
1.11      www        64:    }
1.24      albertel   65:    document.fileaction.submit();
1.11      www        66: }
1.20      www        67: 
1.25      albertel   68: function getdelfilename() {
1.29      www        69:   document.del.filename.value=frameloc();
1.25      albertel   70:   document.del.submit();
                     71: }
                     72: 
1.32      albertel   73: function getcurseed() {
                     74:   if (parent.LONCAPAToBePublished.document.lonhomework
                     75:        &&
                     76:       parent.LONCAPAToBePublished.document.lonhomework.rndseed
                     77:        &&
                     78:       parent.LONCAPAToBePublished.document.lonhomework.rndseed.value) {
                     79:     return parent.LONCAPAToBePublished.document.lonhomework.rndseed.value;
                     80:   }
                     81:   return 0;
                     82: }
                     83: 
1.37      sakharuk   84: function getproblemtype() {
1.39      albertel   85:   if (parent.LONCAPAToBePublished.document.lonhomework
                     86:        &&
                     87:       parent.LONCAPAToBePublished.document.lonhomework.problemtype) {
                     88:     if (parent.LONCAPAToBePublished.document.lonhomework.problemtype.value) {
                     89:       return parent.LONCAPAToBePublished.document.lonhomework.problemtype.value;
                     90:     }
                     91:     if (parent.LONCAPAToBePublished.document.lonhomework.problemtype.options) {
                     92:        var optionelement;
                     93:        var valueIndex=0;
                     94:        for (var optionIndex=0;
                     95:             optionIndex < parent.LONCAPAToBePublished.document.lonhomework.problemtype.options.length;
                     96: 	    optionIndex++)
                     97:        {
                     98:            optionElement=parent.LONCAPAToBePublished.document.lonhomework.problemtype.options[optionIndex];
                     99: 	   if (optionElement.selected) {
                    100: 	      return optionElement.value;
                    101:            }	  
                    102:        } 	  
                    103:     }
1.37      sakharuk  104:   }
                    105:   return 0;
                    106: }
                    107: 
1.20      www       108: function getpostdata() {
1.29      www       109:   document.printout.postdata.value=frameloc();
1.32      albertel  110:   document.printout.curseed.value=getcurseed();
1.37      sakharuk  111:   document.printout.problemtype.value=getproblemtype();
1.20      www       112:   document.printout.submit();
                    113: }
1.38      albertel  114: //-->
1.1       www       115: </script>
1.24      albertel  116:     </head>
                    117:     <body bgcolor="#ccffdd" text='#002200' link='#003333' vlink='#006666'>
                    118: 	<table border="0" align="center"><tr><th bgcolor="#004400" height="20">
1.31      www       119: 	      <table border="0" cellspacing="2" cellpadding="2"><tr valign="middle">
1.38      albertel  120: 		  <td bgcolor="#ccddaa" align="center">
                    121: 		    <form name="publisher" action="/adm/publish" target="_parent" method="post">
1.24      albertel  122: 		      <input type="hidden" name="filename" value="" />
1.38      albertel  123: 	              <input type="button" value="MT{Publish this Resource}" onclick="getfilename();" />
                    124: 		    </form>
                    125: 		  </td>
                    126: 		  <td bgcolor="#ccddaa" align="center">
                    127: 		    <form name="dpublisher" action="/adm/pubdir" target="LONCAPAToBePublished" method="post">
1.24      albertel  128: 		      <input type="hidden" name="filename" value="" />
1.38      albertel  129: 		      <input type="button" value="MT{List Directory}" onclick="getdfilename();" />
                    130: 		    </form>
                    131: 		  </td>
                    132: 		  <td bgcolor="#ccddaa" valign="top" align="center">
                    133: 		    <form name="upublisher" action="/adm/upload" target="_parent"
1.24      albertel  134: 			method="post" enctype="multipart/form-data">
                    135: 		      <input type="hidden" name="filename" value="" />
                    136: 		      <input type="file" name="upfile" size="20" />
1.38      albertel  137: 		      <input type="button" value="MT{Upload file}"  onclick="getufilename();" />
                    138: 		    </form>
                    139: 		  </td>
                    140: 		  <td rowspan="2" bgcolor="#ccddaa" align="center">
                    141: 		    <form name="printout" target="_parent" action="/adm/printout" method="post" onsubmit="getpostdata();">
1.25      albertel  142: 		      <input type="hidden" name="postdata" value="" />
1.32      albertel  143: 		      <input type="hidden" name="curseed" value="" />
1.37      sakharuk  144: 		      <input type="hidden" name="problemtype" value="" />
1.38      albertel  145: 		      <input type="button" value="MT{Print}" onclick="getpostdata();" />
                    146: 		    </form>
                    147: 		  </td>
1.25      albertel  148: 
1.24      albertel  149: 		</tr>
                    150: 		<tr valign="middle">
1.38      albertel  151: 		  <td bgcolor="#ccddaa" align="center">
                    152: 		    <form name="rpublisher" action="/adm/retrieve" target="_parent" method="post">
1.24      albertel  153: 		      <input type="hidden" name="filename" value="" />
1.38      albertel  154: 		      <input type="button" value="MT{Retrieve Old Version}" onclick="getrfilename();" />
                    155: 		    </form>
                    156: 		  </td>
                    157: 		  <td bgcolor="#ccddaa">
                    158: 		    <form name="del" action="/adm/cfile" target="_parent" method="post">
1.25      albertel  159: 		      <input type="hidden" name="filename" value="" />
                    160: 		      <input type="hidden" name="action" value="delete" />
1.38      albertel  161: 	              <input type="button" value="MT{Delete}" onclick="getdelfilename();" />
                    162: 		    </form>
                    163: 		  </td>
                    164: 		  <td bgcolor="#ccddaa" align="center">
                    165: 		    <form name="fileaction" action="/adm/cfile" target="_parent" method="post" onsubmit="getactionfilename();">
1.24      albertel  166: 		      <nobr>
                    167: 			<input type="hidden" name="filename" value="" />
                    168: 			  <select name="action">
1.35      www       169: 			    <option>MT{Select Action}</option>
                    170: 			    <option value="newfile">MT{New file}:</option>
                    171: 			    <option value="newhtmlfile">MT{New HTML file}:</option>
                    172: 			    <option value="newproblemfile">MT{New problem}:</option>
                    173:                             <option value="newpagefile">MT{New assembled page}:</option>
                    174:                             <option value="newsequencefile">MT{New assembled sequence}:</option>
                    175:                             <option value="newrightsfile">MT{New custom rights file}:</option>
                    176:                             <option value="newstyfile">MT{New style file}:</option>
1.40    ! www       177:                             <option value="newlibraryfile">MT{New library file}:</option>
1.35      www       178: 			    <option value="newdir">MT{New subdirectory}:</option>
                    179: 			    <option value="rename">MT{Rename current file to}:</option>
1.36      albertel  180: 			    <option value="move">MT{Move current file to}:</option>
1.35      www       181: 			    <option value="copy">MT{Copy current file to}:</option>
1.38      albertel  182: 			  </select>&nbsp;<input type="text" name="newfilename" value="MT{Type Name Here}" onfocus="if (this.value == 'MT{Type Name Here}') this.value=''" />&nbsp;<input type="button" value="MT{Go}" onclick="getactionfilename();" />
1.24      albertel  183: 		      </nobr>
1.38      albertel  184: 		    </form>
                    185: 		   </td>
1.24      albertel  186: 		</tr>
                    187: 	      </table>
                    188: 	    </th>
                    189: 	  </tr>
                    190: 	</table>
                    191:     </body>
                    192:   </html>

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