--- loncom/interface/londocs.pm 2011/09/09 20:13:17 1.458
+++ loncom/interface/londocs.pm 2011/12/04 15:51:58 1.467
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.458 2011/09/09 20:13:17 raeburn Exp $
+# $Id: londocs.pm,v 1.467 2011/12/04 15:51:58 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -176,7 +176,7 @@ sub dumpcourse {
$newfilename=&clean($newfilename);
$newfilename.='.'.$ext;
my @dirs=split(/\//,$newfilename);
- my $path='/home/'.$ca.'/public_html';
+ my $path=$r->dir_config('lonDocRoot')."/priv/$cd/$ca";
my $makepath=$path;
my $fail=0;
for (my $i=0;$i<$#dirs;$i++) {
@@ -1577,7 +1577,7 @@ sub handle_edit_cmd {
if ($cmd eq 'del') {
if (($url=~m|/+uploaded/\Q$coursedom\E/\Q$coursenum\E/|) &&
- ($url!~/\.(page|sequence|problem|exam|quiz|assess|survey|form|library|task)$/)) {
+ ($url!~/$LONCAPA::assess_page_seq_re/)) {
&Apache::lonnet::removeuploadedurl($url);
} else {
&LONCAPA::map::makezombie($LONCAPA::map::order[$idx]);
@@ -1787,9 +1787,11 @@ sub editor {
if ($supplementalflag) {
$tid = 2;
}
- $r-print(&generate_edit_table($tid,$orderhash,$to_show));
if ($allowed) {
+ $r->print(&generate_edit_table($tid,$orderhash,$to_show));
&print_paste_buffer($r,$container);
+ } else {
+ $r->print($to_show);
}
return;
}
@@ -2629,7 +2631,7 @@ ENDHEADERS
$r->print(' '.&mt('Diffs').'');
+ '" target="diffs">'.&mt('Diffs').'');
}
$r->print('
');
if (++$entries_count % $entries_per_col == 0) {
@@ -2843,7 +2845,8 @@ sub handler {
#
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['folderpath','pagepath',
- 'pagesymb','forcesupplement','forcestandard']);
+ 'pagesymb','forcesupplement','forcestandard',
+ 'symb','command']);
# standard=1: this is a "new-style" course with an uploaded map as top level
# standard=2: this is a "old-style" course, and there is nothing we can do
@@ -2870,12 +2873,71 @@ sub handler {
my $containertag;
my $uploadtag;
+# Do we directly jump somewhere?
+
+ if ($env{'form.command'} eq 'direct') {
+ my ($mapurl,$id,$resurl) = &Apache::lonnet::decode_symb($env{'form.symb'});
+ if ($resurl=~/\.(sequence|page)$/) {
+ $mapurl=$resurl;
+ }
+ my $mapresobj;
+ my $navmap = Apache::lonnavmaps::navmap->new();
+ if (ref($navmap)) {
+ $mapresobj = $navmap->getResourceByUrl($mapurl);
+ }
+ $mapurl=~s{^.*/([^/]+)\.(\w+)$}{$1};
+ my $type=$2;
+ my $path;
+ if (ref($mapresobj)) {
+ my $pcslist = $mapresobj->map_hierarchy();
+ if ($pcslist ne '') {
+ foreach my $pc (split(/,/,$pcslist)) {
+ next if ($pc <= 1);
+ my $res = $navmap->getByMapPc($pc);
+ if (ref($res)) {
+ my $thisurl = $res->src();
+ $thisurl=~s{^.*/([^/]+)\.\w+$}{$1};
+ my $thistitle = $res->title();
+ $path .= '&'.
+ &Apache::lonhtmlcommon::entity_encode($thisurl).'&'.
+ &Apache::lonhtmlcommon::entity_encode($thistitle).
+ ':'.$res->randompick().
+ ':'.$res->randomout().
+ ':'.$res->encrypted().
+ ':'.$res->randomorder();
+ }
+ }
+ }
+ $path .= '&'.&Apache::lonhtmlcommon::entity_encode($mapurl).'&'.
+ &Apache::lonhtmlcommon::entity_encode($mapresobj->title()).
+ ':'.$mapresobj->randompick().
+ ':'.$mapresobj->randomout().
+ ':'.$mapresobj->encrypted().
+ ':'.$mapresobj->randomorder();
+ } else {
+ my $maptitle = &Apache::lonnet::gettitle($mapurl);
+ $path = '&default&...::::'.
+ '&'.&Apache::lonhtmlcommon::entity_encode($mapurl).'&'.
+ &Apache::lonhtmlcommon::entity_encode($maptitle).'::::';
+ }
+ $path = 'default&'.
+ &Apache::lonhtmlcommon::entity_encode('Main Course Documents').
+ $path;
+ if ($type eq 'sequence') {
+ $env{'form.folderpath'}=$path;
+ $env{'form.pagepath'}='';
+ } else {
+ $env{'form.pagepath'}=$path;
+ $env{'form.folderpath'}='';
+ }
+ }
+
# Where do we store these for when we come back?
my $stored_folderpath='docs_folderpath';
if ($supplementalflag) {
$stored_folderpath='docs_sup_folderpath';
}
-
+
# No folderpath, no pagepath, see if we have something stored
if ((!$env{'form.folderpath'}) && (!$env{'form.pagepath'})) {
&Apache::loncommon::restore_course_settings($stored_folderpath,
@@ -3111,7 +3173,6 @@ CHBO
my $fileuploada = "
$help{'Uploading_From_Harddrive'}";
my $fileuploadform=(<
';
+ $fileuploadform .= $fileuploada.'';
my $simpleeditdefaultform=(<
@@ -3138,7 +3199,7 @@ SEDFFORM
);
$simpleeditdefaultform .= &create_form_ul(&create_list_elements(@simpleeditdefaultforma));
$simpleeditdefaultform .=(<
+
$lt{'copm'}
'=>$extresourcesform},
{''=>$imspform},);
- $fileuploadform = &create_form_ul(&create_list_elements(@importdoc)) . '
' . $fileuploadform;
+ $fileuploadform = &create_form_ul(&create_list_elements(@importdoc)) . '
' . $fileuploadform;
@gradingforma=(
{''=>$newsmpproblemform},
@@ -3537,7 +3598,7 @@ my @supimportdoc = (
{''
=>$supnewextform},
);
-$supupdocform = &create_form_ul(&create_list_elements(@supimportdoc)) . '
' . $supupdocform;
+$supupdocform = &create_form_ul(&create_list_elements(@supimportdoc)) . '
' . $supupdocform;
my %suporderhash = (
'00' => ['Supnewfolder', $supnewfolderform],
'ee' => ['Import Documents',$supupdocform],
@@ -4077,11 +4138,12 @@ function resize_contentdiv(scrollboxname
var minscrollboxw = 250;
var maxtabw = 0;
+ var actabw = 0;
for (var i=0; i maxtabw) {
- maxtabw = tabw;
+ actabw = document.getElementById(alltabs[i]).offsetWidth;
+ if (actabw > maxtabw) {
+ maxtabw = actabw;
}
} else {
if (document.getElementById(alltabs[i]) != null) {
@@ -4132,6 +4194,23 @@ function resize_contentdiv(scrollboxname
listwchange = 1;
}
+ if (activeTab == 'cc1') {
+ if (document.getElementById('cc_hrule') != null) {
+ document.getElementById('cc_hrule').style.width=actabw+"px";
+ }
+ } else {
+ if (activeTab == 'bb1') {
+ if (document.getElementById('bb_hrule') != null) {
+ document.getElementById('bb_hrule').style.width=actabw+"px";
+ }
+ } else {
+ if (activeTab == 'ee2') {
+ if (document.getElementById('ee_hrule') != null) {
+ document.getElementById('ee_hrule').style.width=actabw+"px";
+ }
+ }
+ }
+ }
}
if ((chkh == 1) || (listwchange)) {
var primaryheight = document.getElementById("LC_nav_bar").offsetHeight;