[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm londocs.pm lonparmset.pm
raeburn
raeburn at source.lon-capa.org
Mon Jul 10 08:48:42 EDT 2017
raeburn Mon Jul 10 12:48:42 2017 EDT
Modified files:
/loncom/interface loncommon.pm londocs.pm lonparmset.pm
Log:
- Bug 6853
- mapalias can be set in Course Editor.
- mapalias not editable in parameter manager table view
-------------- next part --------------
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1283 loncom/interface/loncommon.pm:1.1284
--- loncom/interface/loncommon.pm:1.1283 Mon Jul 10 12:35:07 2017
+++ loncom/interface/loncommon.pm Mon Jul 10 12:48:41 2017
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1283 2017/07/10 12:35:07 raeburn Exp $
+# $Id: loncommon.pm,v 1.1284 2017/07/10 12:48:41 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -5101,7 +5101,7 @@
# Retrieve blocking times and identity of locker for course
# of specified user, unless user has 'evb' privilege.
-
+
my ($start,$end,$trigger) =
&get_blocks($setters,$activity,$cdom,$cnum,$url);
if (($start != 0) &&
@@ -7124,6 +7124,11 @@
color: #990000;
}
+.LC_docs_alias {
+ color: #440055;
+}
+
+.LC_docs_alias_name,
.LC_docs_reinit_warn,
.LC_docs_ext_edit {
font-size: x-small;
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.632 loncom/interface/londocs.pm:1.633
--- loncom/interface/londocs.pm:1.632 Fri May 19 18:24:03 2017
+++ loncom/interface/londocs.pm Mon Jul 10 12:48:41 2017
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.632 2017/05/19 18:24:03 raeburn Exp $
+# $Id: londocs.pm,v 1.633 2017/07/10 12:48:41 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3018,8 +3018,9 @@
sub handle_edit_cmd {
my ($coursenum,$coursedom) =@_;
+ my $haschanges = 0;
if ($env{'form.cmd'} eq '') {
- return 0;
+ return $haschanges;
}
my ($cmd,$idx)=split('_',$env{'form.cmd'});
@@ -3034,19 +3035,19 @@
&LONCAPA::map::makezombie($LONCAPA::map::order[$idx]);
}
splice(@LONCAPA::map::order, $idx, 1);
-
+ $haschanges = 1;
} elsif ($cmd eq 'cut') {
&LONCAPA::map::makezombie($LONCAPA::map::order[$idx]);
splice(@LONCAPA::map::order, $idx, 1);
-
+ $haschanges = 1;
} elsif ($cmd eq 'up'
&& ($idx) && (defined($LONCAPA::map::order[$idx-1]))) {
@LONCAPA::map::order[$idx-1,$idx] = @LONCAPA::map::order[$idx,$idx-1];
-
+ $haschanges = 1;
} elsif ($cmd eq 'down'
&& defined($LONCAPA::map::order[$idx+1])) {
@LONCAPA::map::order[$idx+1,$idx] = @LONCAPA::map::order[$idx,$idx+1];
-
+ $haschanges = 1;
} elsif ($cmd eq 'rename') {
my $comment = &LONCAPA::map::qtunescape($env{'form.title'});
if ($comment=~/\S/) {
@@ -3056,11 +3057,26 @@
# Devalidate title cache
my $renamed_url=&LONCAPA::map::qtescape($url);
&Apache::lonnet::devalidate_title_cache($renamed_url);
-
- } else {
- return 0;
+ $haschanges = 1;
+ } elsif ($cmd eq 'setalias') {
+ my $newvalue = $env{'form.alias'};
+ if ($newvalue ne '') {
+ unless (Apache::lonnet::get_symb_from_alias($newvalue)) {
+ &LONCAPA::map::storeparameter($idx,'parameter_0_mapalias',$newvalue,
+ 'string');
+ &remember_parms($idx,'mapalias','set',$newvalue);
+ $haschanges = 1;
+ }
+ }
+ } elsif ($cmd eq 'delalias') {
+ my $current = (&LONCAPA::map::getparameter($idx,'parameter_0_mapalias'))[0];
+ if ($current ne '') {
+ &LONCAPA::map::delparameter($idx,'parameter_0_mapalias');
+ &remember_parms($idx,'mapalias','del');
+ $haschanges = 1;
+ }
}
- return 1;
+ return $haschanges;
}
sub editor {
@@ -3184,7 +3200,7 @@
# Rename, cut, copy or remove a single resource
if (&handle_edit_cmd($coursenum,$coursedom)) {
my $contentchg;
- if ($env{'form.cmd'} =~ m{^(remove|cut)_}) {
+ if ($env{'form.cmd'} =~ m{^(remove|cut|setalias|delalias)_}) {
$contentchg = 1;
}
($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container,$contentchg);
@@ -3424,10 +3440,10 @@
.&Apache::loncommon::start_data_table(undef,'contentlist')
.&Apache::loncommon::start_data_table_header_row()
.'<th colspan="2">'.&mt('Move').'</th>'
- .'<th colspan="2">'.&mt('Actions').'</th>'
+ .'<th colspan="3">'.&mt('Actions').'</th>'
.'<th>'.&mt('Document').'</th>';
if ($folder !~ /^supplemental/) {
- $to_show .= '<th colspan="4">'.&mt('Settings').'</th>';
+ $to_show .= '<th colspan="2">'.&mt('Settings').'</th>';
}
$to_show .= &Apache::loncommon::end_data_table_header_row();
if ($folder !~ /^supplemental/) {
@@ -3455,9 +3471,8 @@
'<td>'.
&multiple_check_form('actions',\%lists,$canedit).
'</td>'.
- '<td> </td>'.
- '<td> </td>'.
- '<td colspan="4">'.
+ '<td colspan="3"> </td>'.
+ '<td colspan="2">'.
&multiple_check_form('settings',\%lists,$canedit).
'</td>'.
&Apache::loncommon::end_data_table_row();
@@ -3805,7 +3820,7 @@
my $line=&Apache::loncommon::start_data_table_row();
my ($form_start,$form_end,$form_common,$form_param);
# Edit commands
- my ($esc_path, $path, $symb);
+ my ($esc_path, $path, $symb, $curralias);
if ($env{'form.folderpath'}) {
$esc_path=&escape($env{'form.folderpath'});
$path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
@@ -3874,6 +3889,8 @@
'ct' => 'Cut',
'rn' => 'Rename',
'cp' => 'Copy',
+ 'da' => 'Unset alias',
+ 'sa' => 'Set alias',
'ex' => 'External Resource',
'et' => 'External Tool',
'ed' => 'Edit',
@@ -3904,6 +3921,9 @@
($url!~/$LONCAPA::assess_page_seq_re/)) {
$confirm_removal = 1;
}
+ if ($url =~ /$LONCAPA::assess_re/) {
+ $curralias = (&LONCAPA::map::getparameter($orderidx,'parameter_0_mapalias'))[0];
+ }
if ($denied{'copy'}) {
$copylink=(<<ENDCOPY)
@@ -4291,6 +4311,17 @@
$reinit = &mt('(re-initialize course to access)');
}
$line.='<td class="LC_docs_entry_commands"'.$tdalign.'><span class="LC_nobreak">'.$editlink.$renamelink;
+ if ($url =~ /$LONCAPA::assess_re/) {
+ $line.= '<br />';
+ if ($curralias ne '') {
+ $line.='<span class="LC_nobreak"><a href="javascript:delalias('."'$esc_path','$orderidx'".');" class="LC_docs_alias">'.
+ $lt{'da'}.'</a></span>';
+ } else {
+ $line.='<span class="LC_nobreak"><a href="javascript:setalias('."'$esc_path','$orderidx'".');" class="LC_docs_alias">'.
+ $lt{'sa'}.'</a></span>';
+ }
+ }
+ $line.='</td><td>';
my $link;
if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) {
$line.='<a href="'.$url.'"><img src="'.$icon.'" alt="" class="LC_icon" /></a>';
@@ -4334,7 +4365,12 @@
} else {
$line.=$title.' <span class="LC_docs_reinit_warn">'.$reinit.'</span>';
}
- $line.="$extresform</td>";
+ if (($allowed) && ($curralias ne '')) {
+ $line .= '<br /><span class="LC_docs_alias_name">('.$curralias.')</span>';
+ } else {
+ $line .= $extresform;
+ }
+ $line .= '</td>';
$rand_pick_text = ' ' if ($rand_pick_text eq '');
$rand_order_text = ' ' if ($rand_order_text eq '');
if (($allowed) && ($folder!~/^supplemental/)) {
@@ -5836,6 +5872,11 @@
<input type="hidden" name="copyfolder" />
$containertag
</form>
+ <form name="aliasform" method="post" action="/adm/coursedocs">
+ <input type="hidden" name="alias" />
+ <input type="hidden" name="cmd" />
+ $containertag
+ </form>
HIDDENFORM
$r->print(&makesimpleeditform($pathitem)."\n".
@@ -6903,6 +6944,8 @@
p_ctr2b => '?',
p_ctr3a => 'Cut those',
p_ctr3b => 'items?',
+ setal => 'Enter a (unique) alias',
+ delal => 'Are you sure you want to eliminate the alias?',
rpck => 'Enter number to pick (e.g., 3)',
imsfile => 'You must choose an IMS package for import',
imscms => 'You must select which Course Management System was the source of the IMS package',
@@ -7105,6 +7148,24 @@
}
}
+function setalias(folderpath,index) {
+ var alias = prompt('$js_lt{"setal"}');
+ if ((alias != null) && (alias != '')) {
+ this.document.forms.aliasform.alias.value=alias;
+ this.document.forms.aliasform.cmd.value='setalias_'+index;
+ this.document.forms.aliasform.folderpath.value=folderpath;
+ this.document.forms.aliasform.submit();
+ }
+}
+
+function delalias(folderpath,index) {
+ if (confirm('$js_lt{"delal"}')) {
+ this.document.forms.aliasform.cmd.value='delalias_'+index;
+ this.document.forms.aliasform.folderpath.value=folderpath;
+ this.document.forms.aliasform.submit();
+ }
+}
+
ENDNEWSCRIPT
} else {
$jsmakefunctions = <<ENDNEWSCRIPT;
@@ -7149,6 +7210,14 @@
alert("$js_lt{'edri'}");
}
+function setalias() {
+ alert("$js_lt{'edri'}");
+}
+
+function delalias() {
+ alert("$js_lt{'edri'}");
+}
+
function makenew() {
alert("$js_lt{'edri'}");
}
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.573 loncom/interface/lonparmset.pm:1.574
--- loncom/interface/lonparmset.pm:1.573 Tue Jul 4 21:20:14 2017
+++ loncom/interface/lonparmset.pm Mon Jul 10 12:48:41 2017
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.573 2017/07/04 21:20:14 raeburn Exp $
+# $Id: lonparmset.pm,v 1.574 2017/07/10 12:48:41 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1543,7 +1543,7 @@
if ($readonly) {
$nolink = 1;
} else {
- if ($which == 14 || $which == 15) {
+ if ($which == 14 || $which == 15 || $mprefix =~ /mapalias\&/) {
$nolink = 1;
} elsif (($env{'request.course.sec'} ne '') && ($which > 12)) {
$nolink = 1;
More information about the LON-CAPA-cvs
mailing list