--- loncom/publisher/lonpubdir.pm 2004/10/29 18:40:40 1.64 +++ loncom/publisher/lonpubdir.pm 2004/12/02 19:45:39 1.68 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Construction Space Directory Lister # -# $Id: lonpubdir.pm,v 1.64 2004/10/29 18:40:40 raeburn Exp $ +# $Id: lonpubdir.pm,v 1.68 2004/12/02 19:45:39 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -91,10 +91,10 @@ sub handler { my %bombs=&Apache::lonmsg::all_url_author_res_msg($uname,$udom); &startpage($r, $uname, $udom, $thisdisfn); # Put out the start of page. - - &dircontrols($r,$uname,$udom,$thisdisfn); # Put out actions for directory, + if ($ENV{'environment.remote'} eq 'off') { + &dircontrols($r,$uname,$udom,$thisdisfn); # Put out actions for directory, # browse/upload + new file page. - + } &resourceactions($r,$uname,$udom,$thisdisfn); #Put out form used for printing/deletion etc. my $numdir = 0; @@ -192,26 +192,29 @@ sub startpage { $r->print('LON-CAPA Construction Space'); - my $pagetitle; - my $formaction='/priv/'.$uname.'/'.$thisdisfn; + my $pagetitle; + my $formaction='/priv/'.$uname.$thisdisfn.'/'; $formaction=~s/\/+/\//g; - $pagetitle .= ('
'. - 'Construction Space: '. - &Apache::lonhtmlcommon::crumbs($uname.'/'.$thisdisfn,'top','/priv','','-1'). + $pagetitle .= &Apache::loncommon::help_open_menu('','','','',3,'Authoring'). + 'Construction Space: '. + ''. + &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); - - $r->print(&Apache::loncommon::bodytag('Construction Space',undef,undef,undef,undef,undef,$pagetitle)); - - $r->print(&Apache::loncommon::help_open_menu('','','','',3,'Authoring')); + ''; + &Apache::lonhtmlcommon::store_recent('construct',$formaction,$formaction); + if ($ENV{'environment.remote'} eq 'off') { + $ENV{'request.noversionuri'}=$currdir.'/'; + $r->print(&Apache::loncommon::bodytag('Construction Space',undef,undef,undef,undef,undef,$pagetitle)); + } else { + $r->print($pagetitle); + } my $pubdirscript=(< // Store directory location for menu bar to find -parent.lastknownpriv='/~$uname/$thisdisfn/'; +parent.lastknownpriv='/~$uname$thisdisfn/'; // Confirmation dialogues @@ -225,7 +228,7 @@ parent.lastknownpriv='/~$uname/$thisdisf pubrecdir(document.publishdir) } if (theform.dirtask.options[theform.dirtask.selectedIndex].value == 'editcat') { - window.location=theform.filename.value+'default.meta' + top.location=theform.filename.value+'default.meta' } if (theform.dirtask.options[theform.dirtask.selectedIndex].value == 'printdir' ) { document.printdir.postdata.value=theform.filename.value @@ -263,7 +266,7 @@ parent.lastknownpriv='/~$uname/$thisdisf function SetPubDir(theform,printForm) { if (theform.diraction.options[theform.diraction.selectedIndex].value == "open") { - window.location = theform.filename.value + top.location = theform.filename.value return } if (theform.diraction.options[theform.diraction.selectedIndex].value == "publish") { @@ -273,9 +276,9 @@ parent.lastknownpriv='/~$uname/$thisdisf pubrecdir(theform) } if (theform.diraction.options[theform.diraction.selectedIndex].value == "editcat") { - window.location=theform.filename.value+'default.meta' + 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() @@ -300,17 +303,18 @@ parent.lastknownpriv='/~$uname/$thisdisf } } 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 } @@ -324,34 +328,6 @@ 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); @@ -367,9 +343,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 @@ -390,8 +366,6 @@ sub dircontrols {
- -
@@ -421,8 +395,6 @@ sub dircontrols { -
-
END } @@ -445,8 +417,6 @@ sub resourceactions {
- -
@@ -508,6 +478,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' )); @@ -526,11 +498,9 @@ sub putdirectory { ''. '
'; $$numdir ++; @@ -644,20 +614,16 @@ sub create_pubselect {
+
'; + $uname.$thisdisfn.'/'.$filename.'">'; $$numres ++; }