File:  [LON-CAPA] / loncom / publisher / publisher.html
Revision 1.32: download - view: text, annotated - select for diffs
Fri Sep 5 02:22:25 2003 UTC (20 years, 8 months ago) by albertel
Branches: MAIN
CVS tags: HEAD
- some of BUG#988, web and pdf have different seeds

- BTW, if anyone has a better sugestion on how to test if the lonhomework form exsts and has a rndseed field, I'd love to know it

    1: <html>
    2: <head>
    3: <title>LON-CAPA Publishing Frame</title>
    4: <script language="JavaScript">
    5: 
    6: function frameloc() {
    7:     if (parent.LONCAPAToBePublished.location.pathname.indexOf("/~")!=-1) {
    8:        parent.lastknownpriv=parent.LONCAPAToBePublished.location.pathname;
    9:     }
   10: // alert ('We are at '+parent.lastknownpriv);
   11:     return unescape(parent.lastknownpriv);
   12: }
   13: 
   14: function getfilename() {
   15:    document.publisher.filename.value=frameloc();
   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 {
   21:       alert('Cannot publish directory');
   22:    }
   23: }
   24: 
   25: function getdfilename() {
   26:   document.dpublisher.filename.value=frameloc();
   27:   if (document.dpublisher.filename.value.indexOf('/adm/pubdir')==-1) {
   28:       document.dpublisher.submit();
   29:   }
   30: }
   31: 
   32: function getufilename() {
   33:   document.upublisher.filename.value=frameloc();
   34:   if (document.upublisher.filename.value.indexOf('/adm/pubdir')!=-1) {
   35:       document.upublisher.filename.value=document.dpublisher.filename.value;
   36:   }
   37:   document.upublisher.submit();
   38: }
   39: 
   40: function getrfilename() {
   41:   document.rpublisher.filename.value=frameloc();
   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 {
   47:       alert('Cannot retrieve directory');
   48:    }
   49: }
   50: 
   51: function getactionfilename() {
   52:   document.fileaction.filename.value=frameloc();
   53:   var test=document.fileaction.action.selectedIndex;
   54:   if (test == 4) { // trying to create a directory
   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)) {
   61:           alert('Must create new subdirectory inside a directory');
   62:           return;
   63:       }
   64:    }
   65:    document.fileaction.submit();
   66: }
   67: 
   68: function getdelfilename() {
   69:   document.del.filename.value=frameloc();
   70:   document.del.submit();
   71: }
   72: 
   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: 
   84: function getpostdata() {
   85:   document.printout.postdata.value=frameloc();
   86:   document.printout.curseed.value=getcurseed();
   87:   document.printout.submit();
   88: }
   89: </script>
   90:     </head>
   91:     <body bgcolor="#ccffdd" text='#002200' link='#003333' vlink='#006666'>
   92:       <font size="-2">
   93: 	<table border="0" align="center"><tr><th bgcolor="#004400" height="20">
   94: 	      <table border="0" cellspacing="2" cellpadding="2"><tr valign="middle">
   95: 		  <form name="publisher" action="/adm/publish" target="_parent" method="post">
   96: 		    <td bgcolor="#ccddaa" align="center">
   97: 		      <input type="hidden" name="filename" value="" />
   98: 	              <input type="button" value="Publish this Resource" onClick="getfilename();" />
   99: 		    </td>
  100: 		  </form>
  101: 		  <form name="dpublisher" action="/adm/pubdir" target="LONCAPAToBePublished" method="post">
  102: 		    <td bgcolor="#ccddaa" align="center">
  103: 		      <input type="hidden" name="filename" value="" />
  104: 		      <input type="button" value="List Directory" onClick="getdfilename();" />
  105: 		    </td>
  106: 		  </form>
  107: 		  <form name="upublisher" action="/adm/upload" target="_parent"
  108: 			method="post" enctype="multipart/form-data">
  109: 		    <td bgcolor="#ccddaa" valign="top" align="center">
  110: 		      <input type="hidden" name="filename" value="" />
  111: 		      <input type="file" name="upfile" size="20" />
  112: 		      <input type="button" value="Upload file"  onClick="getufilename();" />
  113: 		    </td>
  114: 		  </form>
  115: 		  <form name="printout" target="_parent" action="/adm/printout" target="LONCAPAToBePublished" method="post" onSubmit="getpostdata();">
  116: 		    <td rowspan="2" bgcolor="#ccddaa" align="center">
  117: 		      <input type="hidden" name="postdata" value="" />
  118: 		      <input type="hidden" name="curseed" value="" />
  119: 		      <input type="button" value="Print" onClick="getpostdata();" />
  120: 		    </td>
  121: 		  </form>
  122: 
  123: 		</tr>
  124: 		<tr valign="middle">
  125: 		  <form name="rpublisher" action="/adm/retrieve" target="_parent" method="post">
  126: 		    <td bgcolor="#ccddaa" align="center">
  127: 		      <input type="hidden" name="filename" value="" />
  128: 		      <input type="button" value="Retrieve Old Version" onClick="getrfilename();" />
  129: 		    </td>
  130: 		  </form>
  131: 		  <form name="del" action="/adm/cfile" target="_parent" method="post">
  132: 		    <td bgcolor="#ccddaa">
  133: 		      <input type="hidden" name="filename" value="" />
  134: 		      <input type="hidden" name="action" value="delete" />
  135: 	              <input type="button" value="Delete" onClick="getdelfilename();" />
  136: 		    </td>
  137: 		  </form>
  138: 		  <form name="fileaction" action="/adm/cfile" target="_parent" method="post" onSubmit="getactionfilename();">
  139: 		    <td bgcolor="#ccddaa" align="center">
  140: 		      <nobr>
  141: 			<input type="hidden" name="filename" value="" />
  142: 			  <select name="action">
  143: 			    <option>Select Action</option>
  144: 			    <option value="newfile">New file:</option>
  145: 			    <option value="newhtmlfile">New HTML file:</option>
  146: 			    <option value="newproblemfile">New problem:</option>
  147:                             <option value="newpagefile">New assembled page:</option>
  148:                             <option value="newsequencefile">New assembled sequence:</option>
  149:                             <option value="newrightsfile">New custom rights file:</option>
  150:                             <option value="newstyfile">New style file:</option>
  151: 			    <option value="newdir">New subdirectory:</option>
  152: 			    <option value="rename">Rename current file to:</option>
  153: 			    <option value="copy">Copy current file to:</option>
  154: 			  </select>&nbsp;<input type="text" name="newfilename" value="Type Name Here" onFocus="if (this.value == 'Type Name Here') this.value=''" />&nbsp;<input type="button" value="Go" onClick="getactionfilename();" />
  155: 		      </nobr>
  156: 		    </td>
  157: 		  </form>
  158: 		</td>
  159: 		</form>
  160: 		</tr>
  161: 	      </table>
  162: 	    </th>
  163: 	  </tr>
  164: 	</table>
  165:       </font>
  166:     </body>
  167:   </html>

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