--- loncom/publisher/lonpubdir.pm 2004/11/30 19:08:18 1.66 +++ loncom/publisher/lonpubdir.pm 2005/01/24 21:55:20 1.76 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Construction Space Directory Lister # -# $Id: lonpubdir.pm,v 1.66 2004/11/30 19:08:18 raeburn Exp $ +# $Id: lonpubdir.pm,v 1.76 2005/01/24 21:55:20 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -94,6 +94,8 @@ sub handler { if ($ENV{'environment.remote'} eq 'off') { &dircontrols($r,$uname,$udom,$thisdisfn); # Put out actions for directory, # browse/upload + new file page. + } else { + &pubbuttons($r,$uname,$thisdisfn); } &resourceactions($r,$uname,$udom,$thisdisfn); #Put out form used for printing/deletion etc. @@ -193,28 +195,29 @@ sub startpage { $r->print('LON-CAPA Construction Space'); my $pagetitle; - my $formaction='/priv/'.$uname.'/'.$thisdisfn.'/'; + my $formaction='/priv/'.$uname.$thisdisfn.'/'; $formaction=~s/\/+/\//g; $pagetitle .= &Apache::loncommon::help_open_menu('','','','',3,'Authoring'). - 'Construction Space: '. + 'Construction Space: '. '
'. - &Apache::lonhtmlcommon::crumbs($uname.'/'.$thisdisfn.'/','_top','/priv','','+1'). + '" target="_parent">'. + &Apache::lonhtmlcommon::crumbs($uname.$thisdisfn.'/','_top','/priv','','+1',1)."
". &Apache::lonhtmlcommon::select_recent('construct','recent', 'this.form.action=this.form.recent.value;this.form.submit()'). '
'; &Apache::lonhtmlcommon::store_recent('construct',$formaction,$formaction); if ($ENV{'environment.remote'} eq 'off') { - $ENV{'request.noversionuri'}=$currdir; + $ENV{'request.noversionuri'}=$currdir.'/'; $r->print(&Apache::loncommon::bodytag('Construction Space',undef,undef,undef,undef,undef,$pagetitle)); } else { $r->print($pagetitle); } my $pubdirscript=(< +top.document.title = '$thisdisfn/ - LON-CAPA Construction Space'; // Store directory location for menu bar to find -parent.lastknownpriv='/~$uname/$thisdisfn/'; +parent.lastknownpriv='/~$uname$thisdisfn/'; // Confirmation dialogues @@ -251,7 +254,7 @@ parent.lastknownpriv='/~$uname/$thisdisf } function forcepub(theform) { - if (confirm('Force publication of unmodified files? - OK=yes; Cancel=No.')) { + if (confirm('Force publication of unmodified files? - Cancel=No; OK=yes.')) { theform.forcerepub.value="ON"; } } @@ -266,7 +269,7 @@ parent.lastknownpriv='/~$uname/$thisdisf function SetPubDir(theform,printForm) { if (theform.diraction.options[theform.diraction.selectedIndex].value == "open") { - top.location = theform.filename.value + top.location = theform.openname.value return } if (theform.diraction.options[theform.diraction.selectedIndex].value == "publish") { @@ -278,7 +281,7 @@ parent.lastknownpriv='/~$uname/$thisdisf if (theform.diraction.options[theform.diraction.selectedIndex].value == "editcat") { top.location=theform.filename.value+'default.meta' } - if (theform.diraction.options[theform.diraction.selectedIndex].value == "print") { + if (theform.diraction.options[theform.diraction.selectedIndex].value == "printdir") { theform.action = '/adm/printout' theform.postdata.value = theform.filename.value theform.submit() @@ -298,22 +301,21 @@ parent.lastknownpriv='/~$uname/$thisdisf if (activity == 'delete') { var delform = document.delresource delform.filename.value = theform.filename.value - if (confirm("Are you sure you want to delete "+theform.filename.value+"?")) { - delform.submit() - } + delform.submit() } if (activity == 'obsolete') { - alert("Mark as obsolete - still to be implemented") + var pubform = document.pubresource + pubform.filename.value = theform.filename.value + alert("You will be taken to the publication page.\\nCheck the 'Obsolete' checkbox at the bottom of the page, and click 'Finalize Publication'.") + pubform.submit() } if (activity == 'print') { - document.printresource.postdata = theform.filename.value - document.printresource.curseed = getcurseed() - document.printresource.problemtype = getproblemtype() + document.printresource.postdata.value = theform.filename.value document.printresource.submit() } if (activity == 'retrieve') { - retrieveres.filename.value = theform.filename.value - retrieveres.submit() + document.retrieveres.filename.value = theform.filename.value + document.retrieveres.submit() } return } @@ -327,39 +329,12 @@ parent.lastknownpriv='/~$uname/$thisdisf document.moveresource.action.value = activity document.moveresource.submit(); } - - function getcurseed() { - if (parent.document.lonhomework - && - parent.document.lonhomework.rndseed - && - parent.document.lonhomework.rndseed.value) { - return parent.document.lonhomework.rndseed.value; - } - return 0; - } - - function getproblemtype() { - if (parent.document.lonhomework) { - var optionelement; - var valueIndex=0; - for (var optionIndex=0; - optionIndex < parent.document.lonhomework.problemtype.options.length; - optionIndex++) - { - optionElement=parent.document.lonhomework.problemtype.options[optionIndex]; - if (optionElement.selected) { - return optionElement.value; - } - } - } - return 0; - } ENDPUBDIRSCRIPT $r->print($pubdirscript); - if (($uname ne $ENV{'user.name'}) || ($udom ne $ENV{'user.domain'})) { + if ((($uname ne $ENV{'user.name'}) || ($udom ne $ENV{'user.domain'})) && + $ENV{'environment.remote'} ne 'off') { $r->print('

'.&mt('Co-Author').': '.$uname.' at '.$udom. '

'); } @@ -370,9 +345,9 @@ sub dircontrols { $r->print(< - Actions for current directory - Upload a new document - Create a new directory or LON-CAPA document + Actions for current directory + Upload a new document + Create a new directory or LON-CAPA document @@ -393,8 +368,6 @@ sub dircontrols {
- -
@@ -409,7 +382,7 @@ sub dircontrols { '. + ''. + ''. + ''. + ''. +''); +} + sub resourceactions { my ($r,$uname,$udom,$thisdisfn) = @_; $r->print(<
- -
@@ -511,6 +496,8 @@ sub putdirectory { %Apache::lonpublisher::metadatakeys=(); my $construct=$here; $construct=~s:^/priv/(\w+)$:/home/$1/public_html:; + my $dirpath = $here; + $dirpath=~s:^/priv/:/~:; &Apache::lonpublisher::metaeval(&Apache::lonnet::getfile( $construct.'/'.$dirname.'/default.meta' )); @@ -529,11 +516,10 @@ sub putdirectory { ''. '
'; $$numdir ++; @@ -647,20 +633,16 @@ sub create_pubselect {
+
'; + $uname.$thisdisfn.'/'.$filename.'">'; $$numres ++; }