--- loncom/publisher/lonpubdir.pm 2004/10/29 18:40:40 1.64
+++ 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.64 2004/10/29 18:40:40 raeburn Exp $
+# $Id: lonpubdir.pm,v 1.76 2005/01/24 21:55:20 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -91,10 +91,12 @@ 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.
-
+ } else {
+ &pubbuttons($r,$uname,$thisdisfn);
+ }
&resourceactions($r,$uname,$udom,$thisdisfn); #Put out form used for printing/deletion etc.
my $numdir = 0;
@@ -192,26 +194,30 @@ 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 .= ('');
- &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=(<
+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
@@ -225,7 +231,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
@@ -248,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";
}
}
@@ -263,7 +269,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.openname.value
return
}
if (theform.diraction.options[theform.diraction.selectedIndex].value == "publish") {
@@ -273,9 +279,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()
@@ -295,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
}
@@ -324,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.
'
');
}
@@ -367,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
@@ -390,8 +368,6 @@ sub dircontrols {
@@ -406,7 +382,7 @@ sub dircontrols {
-
-
END
}
+sub pubbuttons {
+ my ($r,$uname,$thisdisfn) = @_;
+ $r->print('');
+}
+
sub resourceactions {
my ($r,$uname,$udom,$thisdisfn) = @_;
$r->print(<
';
$$numdir ++;
@@ -644,20 +633,16 @@ sub create_pubselect {
';
+ $uname.$thisdisfn.'/'.$filename.'">';
$$numres ++;
}