[LON-CAPA-cvs] cvs: loncom /interface londocs.pm
raeburn
raeburn at source.lon-capa.org
Tue Nov 13 21:49:19 EST 2012
raeburn Wed Nov 14 02:49:19 2012 EDT
Modified files:
/loncom/interface londocs.pm
Log:
- Scalar: $uploadtag renamed $pathitem to be more meaningful.
- $pathitem used in additional cases where a hidden form element
containing the current folderpath is needed.
- $pathitem set correctly for supplemental content items, so renaming or
modification of External Resource in supplemental content area works.
-------------- next part --------------
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.507 loncom/interface/londocs.pm:1.508
--- loncom/interface/londocs.pm:1.507 Wed Nov 14 01:09:32 2012
+++ loncom/interface/londocs.pm Wed Nov 14 02:49:19 2012
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.507 2012/11/14 01:09:32 raeburn Exp $
+# $Id: londocs.pm,v 1.508 2012/11/14 02:49:19 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -454,7 +454,8 @@
if ($folderpath eq '') {
$folderpath = 'default&'.&escape(&mt('Main '.$crstype.' Documents'));
}
- $pathitem = '<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($folderpath,'<>&"').'" />';
+ $pathitem = '<input type="hidden" name="folderpath" value="'.
+ &HTML::Entities::encode($folderpath,'<>&"').'" />';
}
my $readfile="/uploaded/$coursedom/$coursenum/$folder.$container";
my $jumpto = $readfile;
@@ -1743,7 +1744,7 @@
sub editor {
my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype,
- $supplementalflag,$orderhash,$iconpath,$uploadtag)=@_;
+ $supplementalflag,$orderhash,$iconpath,$pathitem)=@_;
my $container= ($env{'form.pagepath'}) ? 'page'
: 'sequence';
@@ -1912,7 +1913,7 @@
unless ($name) { $idx++; next; }
$output .= &entryline($idx,$name,$url,$folder,$allowed,$res,
$coursenum,$coursedom,$crstype,
- $uploadtag,$supplementalflag);
+ $pathitem,$supplementalflag);
$idx++;
$shown++;
}
@@ -2130,7 +2131,7 @@
sub entryline {
my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$coursedom,
- $crstype,$uploadtag,$supplementalflag)=@_;
+ $crstype,$pathitem,$supplementalflag)=@_;
my ($foldertitle,$pagetitle,$renametitle);
if (&is_supplemental_title($title)) {
($title,$foldertitle,$renametitle) = &Apache::loncommon::parse_supplemental_title($title);
@@ -2287,7 +2288,7 @@
$skip_confirm = 1;
}
- if ($nocopy) {
+ if ($nocopy) {
$copylink=(<<ENDCOPY);
<span style="visibility: hidden;">$lt{'cp'}</span>
ENDCOPY
@@ -2296,7 +2297,7 @@
<a href="javascript:markcopy('$esc_path','$index','$renametitle','$container','$symb','$folder');" class="LC_docs_copy">$lt{'cp'}</a>
ENDCOPY
}
- if ($nocut) {
+ if ($nocut) {
$cutlink=(<<ENDCUT);
<span style="visibility: hidden;">$lt{'ct'}</span>
ENDCUT
@@ -2488,17 +2489,25 @@
<span class="LC_nobreak">
<span class="LC_docs_ext_edit">$lt{'ti'} </span>
<input type="text" size="40" name="exttitle" value="$title" />
- $uploadtag
+ $pathitem
<input type="hidden" name="importdetail" value="" />
<input type="button" value="$lt{'sv'}" onclick="javascript:setExternal(this.form,'$residx')" />
</span>
</fieldset>
</form>
EXTLNK
- } else {
+ } else {
my ($cfile,$home,$switchserver,$forceedit,$forceview) =
&Apache::lonnet::can_edit_resource($fileloc,$coursenum,$coursedom,$orig_url);
- if (($cfile ne '') && ($symb ne '')) {
+ my $geteditlink;
+ if ($supplementalflag) {
+ if ($orig_url eq "/adm/$env{'user.domain'}/$env{'user.name'}/aboutme") {
+ $geteditlink = 1;
+ }
+ } elsif (($cfile ne '') && ($symb ne '')) {
+ $geteditlink = 1;
+ }
+ if ($geteditlink) {
my $jscall =
&Apache::lonhtmlcommon::jump_to_editres($cfile,$home,
$switchserver,
@@ -3286,7 +3295,7 @@
my $addentries = {};
my $container;
my $containertag;
- my $uploadtag;
+ my $pathitem;
# Do we directly jump somewhere?
@@ -3419,7 +3428,7 @@
$container='page';
$containertag = '<input type="hidden" name="pagepath" value="" />'.
'<input type="hidden" name="pagesymb" value="" />';
- $uploadtag =
+ $pathitem =
'<input type="hidden" name="pagepath" value="'.&HTML::Entities::encode($env{'form.pagepath'},'<>&"').'" />'.
'<input type="hidden" name="pagesymb" value="'.&HTML::Entities::encode($env{'form.pagesymb'},'<>&"').'" />'.
'<input type="hidden" name="folderpath" value="" />';
@@ -3433,7 +3442,7 @@
}
}
$containertag = '<input type="hidden" name="folderpath" value="" />';
- $uploadtag = '<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($folderpath,'<>&"').'" />';
+ $pathitem = '<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($folderpath,'<>&"').'" />';
}
if ($r->uri=~/^\/adm\/coursedocs\/showdoc\/(.*)$/) {
$showdoc='/'.$1;
@@ -3678,7 +3687,7 @@
<br />
$lt{'title'}:<br />
<input type="text" size="60" name="comment" />
- $uploadtag
+ $pathitem
<input type="hidden" name="cmd" value="upload_default" />
<br />
<span class="LC_nobreak" style="float:left">
@@ -3708,7 +3717,7 @@
SEDFFORM
my @importpubforma = (
- { '<img class="LC_noBorder LC_middle" src="/res/adm/pages/src.png" alt="'.$lt{srch}.'" onclick="javascript:groupsearch()" />' => "$uploadtag<a class='LC_menubuttons_link' href='javascript:groupsearch()'>$lt{'srch'}</a>" },
+ { '<img class="LC_noBorder LC_middle" src="/res/adm/pages/src.png" alt="'.$lt{srch}.'" onclick="javascript:groupsearch()" />' => $pathitem."<a class='LC_menubuttons_link' href='javascript:groupsearch()'>$lt{'srch'}</a>" },
{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/res.png" alt="'.$lt{impo}.'" onclick="javascript:groupimport();"/>' => "<a class='LC_menubuttons_link' href='javascript:groupimport();'>$lt{'impo'}</a>$help{'Importing_LON-CAPA_Resource'}" },
{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/wishlist.png" alt="'.$lt{lnks}.'" onclick="javascript:open_StoredLinks_Import();" />' => "<a class='LC_menubuttons_link' href='javascript:open_StoredLinks_Import();'>$lt{'lnks'}</a>" },
{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/sequence.png" alt="'.$lt{impm}.'" onclick="javascript:toggleMap();" />' => $importpubform }
@@ -3726,7 +3735,7 @@
<input type="button" name="view" value="$lt{'prev'}" onclick="javascript:extUrlPreview('exturl');" /><br />
$lt{'title'}:<br />
<input type="text" size="60" name="exttitle" value="$lt{'extr'}" />
- $uploadtag
+ $pathitem
<br />
<input type="hidden" name="importdetail" value="" />
<input type="button" value="$lt{'lnk'}" onclick="javascript:setExternal(this.form,0)" />
@@ -3751,8 +3760,8 @@
</form>
HIDDENFORM
- $r->print(&makesimpleeditform($uploadtag)."\n".
- &makedocslogform($uploadtag."\n".
+ $r->print(&makesimpleeditform($pathitem)."\n".
+ &makedocslogform($pathitem."\n".
'<input type="hidden" name="folder" value="'.
$env{'form.folder'}.'" />'."\n"));
}
@@ -3775,7 +3784,7 @@
$folder='default';
$savefolderpath = $env{'form.folderpath'};
$env{'form.folderpath'}='default&'.&escape(&mt('Content'));
- $uploadtag = '<input type="hidden" name="folderpath" value="'.
+ $pathitem = '<input type="hidden" name="folderpath" value="'.
&HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />';
}
my $postexec='';
@@ -3800,7 +3809,7 @@
my $newnavform=(<<NNFORM);
<form action="/adm/coursedocs" method="post" name="newnav">
<input type="hidden" name="active" value="cc" />
- $uploadtag
+ $pathitem
<input type="hidden" name="importdetail"
value="$lt{'navc'}=/adm/navmaps" />
<a class="LC_menubuttons_link" href="javascript:document.newnav.submit()">$lt{'navc'}</a>
@@ -3810,7 +3819,7 @@
my $newsmppageform=(<<NSPFORM);
<form action="/adm/coursedocs" method="post" name="newsmppg">
<input type="hidden" name="active" value="cc" />
- $uploadtag
+ $pathitem
<input type="hidden" name="importdetail" value="" />
<a class="LC_menubuttons_link" href="javascript:makesmppage();"> $lt{'sipa'}</a>
$help{'Simple Page'}
@@ -3820,7 +3829,7 @@
my $newsmpproblemform=(<<NSPROBFORM);
<form action="/adm/coursedocs" method="post" name="newsmpproblem">
<input type="hidden" name="active" value="cc" />
- $uploadtag
+ $pathitem
<input type="hidden" name="importdetail" value="" />
<a class="LC_menubuttons_link" href="javascript:makesmpproblem();">$lt{'sipr'}</a>
$help{'Simple Problem'}
@@ -3831,7 +3840,7 @@
my $newdropboxform=(<<NDBFORM);
<form action="/adm/coursedocs" method="post" name="newdropbox">
<input type="hidden" name="active" value="cc" />
- $uploadtag
+ $pathitem
<input type="hidden" name="importdetail" value="" />
<a class="LC_menubuttons_link" href="javascript:makedropbox();">$lt{'drbx'}</a>
</form>
@@ -3840,7 +3849,7 @@
my $newexuploadform=(<<NEXUFORM);
<form action="/adm/coursedocs" method="post" name="newexamupload">
<input type="hidden" name="active" value="cc" />
- $uploadtag
+ $pathitem
<input type="hidden" name="importdetail" value="" />
<a class="LC_menubuttons_link" href="javascript:makeexamupload();">$lt{'scuf'}</a>
$help{'Score_Upload_Form'}
@@ -3850,7 +3859,7 @@
my $newbulform=(<<NBFORM);
<form action="/adm/coursedocs" method="post" name="newbul">
<input type="hidden" name="active" value="cc" />
- $uploadtag
+ $pathitem
<input type="hidden" name="importdetail" value="" />
<a class="LC_menubuttons_link" href="javascript:makebulboard();" >$lt{'bull'}</a>
$help{'Bulletin Board'}
@@ -3860,7 +3869,7 @@
my $newaboutmeform=(<<NAMFORM);
<form action="/adm/coursedocs" method="post" name="newaboutme">
<input type="hidden" name="active" value="cc" />
- $uploadtag
+ $pathitem
<input type="hidden" name="importdetail"
value="$plainname=/adm/$udom/$uname/aboutme" />
<a class="LC_menubuttons_link" href="javascript:document.newaboutme.submit()">$lt{'mypi'}</a>
@@ -3871,7 +3880,7 @@
my $newaboutsomeoneform=(<<NASOFORM);
<form action="/adm/coursedocs" method="post" name="newaboutsomeone">
<input type="hidden" name="active" value="cc" />
- $uploadtag
+ $pathitem
<input type="hidden" name="importdetail" value="" />
<a class="LC_menubuttons_link" href="javascript:makeabout();">$lt{'abou'}</a>
</form>
@@ -3881,7 +3890,7 @@
my $newrosterform=(<<NROSTFORM);
<form action="/adm/coursedocs" method="post" name="newroster">
<input type="hidden" name="active" value="cc" />
- $uploadtag
+ $pathitem
<input type="hidden" name="importdetail"
value="$lt{'rost'}=/adm/viewclasslist" />
<a class="LC_menubuttons_link" href="javascript:document.newroster.submit()">$lt{'rost'}</a>
@@ -3913,7 +3922,7 @@
$newfolderform=(<<NFFORM);
<form action="/adm/coursedocs" method="post" name="newfolder">
- <input type="hidden" name="folderpath" value="$path" />
+ $pathitem
<input type="hidden" name="importdetail" value="" />
<input type="hidden" name="active" value="aa" />
<a href="javascript:makenewfolder(document.newfolder,'$folderseq');">$lt{'newf'}</a>$help{'Adding_Folders'}
@@ -3923,7 +3932,7 @@
my $newsylform=(<<NSYLFORM);
<form action="/adm/coursedocs" method="post" name="newsyl">
<input type="hidden" name="active" value="cc" />
- $uploadtag
+ $pathitem
<input type="hidden" name="importdetail"
value="$lt{'syll'}=/public/$coursedom/$coursenum/syllabus" />
<a class="LC_menubuttons_link" href="javascript:document.newsyl.submit()">$lt{'syll'}</a>
@@ -3935,7 +3944,7 @@
my $newgroupfileform=(<<NGFFORM);
<form action="/adm/coursedocs" method="post" name="newgroupfiles">
<input type="hidden" name="active" value="cc" />
- $uploadtag
+ $pathitem
<input type="hidden" name="importdetail"
value="$lt{'grpo'}=/adm/$coursedom/$coursenum/aboutme" />
<a class="LC_menubuttons_link" href="javascript:document.newgroupfiles.submit()">$lt{'grpo'}</a>
@@ -3989,7 +3998,7 @@
$hadchanges=0;
unless (($supplementalflag || $toolsflag)) {
my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
- $supplementalflag,\%orderhash,$iconpath,$uploadtag);
+ $supplementalflag,\%orderhash,$iconpath,$pathitem);
if ($error) {
$r->print('<p><span class="LC_error">'.$error.'</span></p>');
}
@@ -4014,12 +4023,12 @@
$env{'form.folderpath'} = $savefolderpath;
}
$env{'form.pagepath'} = '';
+ $pathitem = '<input type="hidden" name="folderpath" value="'.
+ &HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />';
if ($allowed) {
my $folderseq=
'/uploaded/'.$coursedom.'/'.$coursenum.'/supplemental_new.sequence';
- my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
-
my $supupdocform=(<<SUPDOCFORM);
<a class="LC_menubuttons_link" href="javascript:toggleUpload('suppdoc');">
$lt{'upfi'}</a> $help{'Uploading_From_Harddrive'}
@@ -4037,7 +4046,7 @@
$lt{'comment'}:<br />
<textarea cols="50" rows="4" name="comment"></textarea>
<br />
- <input type="hidden" name="folderpath" value="$path" />
+ $pathitem
<input type="hidden" name="cmd" value="upload_supplemental" />
<input type='submit' value="$lt{'upld'}" />
</form>
@@ -4046,7 +4055,7 @@
my $supnewfolderform=(<<SNFFORM);
<form action="/adm/coursedocs" method="post" name="supnewfolder">
<input type="hidden" name="active" value="ee" />
- <input type="hidden" name="folderpath" value="$path" />
+ $pathitem
<input type="hidden" name="importdetail" value="" />
<a class="LC_menubuttons_link" href="javascript:makenewfolder(document.supnewfolder,'$folderseq');">$lt{'newf'}</a>
$help{'Adding_Folders'}
@@ -4064,8 +4073,8 @@
<input type="button" name="view" value="$lt{'prev'}" onclick="javascript:extUrlPreview('exturl');" /><br />
$lt{'title'}:<br />
<input type="text" size="60" name="exttitle" value="$lt{'extr'}" />
- $uploadtag
<br />
+ $pathitem
<input type="hidden" name="importdetail" value="" />
<input type="button" value="$lt{'lnk'}" onclick="javascript:setExternal(this.form,0)" />
</fieldset>
@@ -4075,7 +4084,7 @@
my $supnewsylform=(<<SNSFORM);
<form action="/adm/coursedocs" method="post" name="supnewsyl">
<input type="hidden" name="active" value="ff" />
- <input type="hidden" name="folderpath" value="$path" />
+ $pathitem
<input type="hidden" name="importdetail"
value="Syllabus=/public/$coursedom/$coursenum/syllabus" />
<a class="LC_menubuttons_link" href="javascript:document.supnewsyl.submit()">$lt{'syll'}</a>
@@ -4086,7 +4095,7 @@
my $supnewaboutmeform=(<<SNAMFORM);
<form action="/adm/coursedocs" method="post" name="supnewaboutme">
<input type="hidden" name="active" value="ff" />
- <input type="hidden" name="folderpath" value="$path" />
+ $pathitem
<input type="hidden" name="importdetail"
value="$plainname=/adm/$udom/$uname/aboutme" />
<a class="LC_menubuttons_link" href="javascript:document.supnewaboutme.submit()">$lt{'mypi'}</a>
@@ -4116,14 +4125,14 @@
);
if ($supplementalflag) {
my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
- $supplementalflag,\%suporderhash,$iconpath,$uploadtag);
+ $supplementalflag,\%suporderhash,$iconpath,$pathitem);
if ($error) {
$r->print('<p><span class="LC_error">'.$error.'</span></p>');
}
}
} elsif ($supplementalflag) {
my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
- $supplementalflag,'',$iconpath,$uploadtag);
+ $supplementalflag,'',$iconpath,$pathitem);
if ($error) {
$r->print('<p><span class="LC_error">'.$error.'</span></p>');
}
More information about the LON-CAPA-cvs
mailing list