[LON-CAPA-cvs] cvs: loncom /interface londocs.pm
raeburn
raeburn at source.lon-capa.org
Mon Apr 1 15:39:13 EDT 2013
raeburn Mon Apr 1 19:39:13 2013 EDT
Modified files:
/loncom/interface londocs.pm
Log:
- Eliminate javascript error when using Remove, Cut, or Copy links in folder
containing just one item.
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.538 loncom/interface/londocs.pm:1.539
--- loncom/interface/londocs.pm:1.538 Sun Mar 31 22:36:01 2013
+++ loncom/interface/londocs.pm Mon Apr 1 19:39:13 2013
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.538 2013/03/31 22:36:01 raeburn Exp $
+# $Id: londocs.pm,v 1.539 2013/04/01 19:39:13 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -834,7 +834,7 @@
$othercourse = 1;
if ($env{"user.priv.cm./$srcdom/$srcnum"} =~ /\Q:mdc&F\E/) {
if ($canpaste) {
- $othercrs = '<br />'.&mt('(from another course).');
+ $othercrs = '<br />'.&mt('(from another course)');
}
} else {
$canpaste = 0;
@@ -2170,7 +2170,9 @@
}
}
} else {
- map { $allchecked{$which}{$_} = 1; } split(/,/,$env{'form.all'.$which});
+ if ($env{'form.all'.$which}) {
+ map { $allchecked{$which}{$_} = 1; } split(/,/,$env{'form.all'.$which});
+ }
}
}
my $haschanges = 0;
@@ -5643,69 +5645,78 @@
}
function checkForSubmit(targetform,param,context,idx,folderpath,index,oldtitle,skip_confirm,container,folder) {
+ var dosettings;
+ var doaction;
var control = document.togglemultsettings;
if (context == 'actions') {
control = document.togglemultactions;
+ doaction = 1;
+ } else {
+ dosettings = 1;
}
- if (control.showmultpick.length) {
- for (var i=0; i<control.showmultpick.length; i++) {
- if (control.showmultpick[i].checked) {
- if (control.showmultpick[i].value == 0) {
- if (context == 'settings') {
- targetform.changeparms.value=param;
- targetform.submit();
- } else {
- targetform.cmd.value=param+'_'+index;
- targetform.folderpath.value=folderpath;
- targetform.markcopy.value=idx+':'+param;
- targetform.copyfolder.value=folder+'.'+container;
- if (param == 'remove') {
- if (skip_confirm || confirm('$lt{"p_rmr1"}\\n\\n$lt{"p_rmr2a"} "'+oldtitle+'" $lt{"p_rmr2b"}')) {
- targetform.markcopy.value='';
- targetform.copyfolder.value='';
- targetform.submit();
- }
- }
- if (param == 'cut') {
- if (skip_confirm || confirm('$lt{"p_ctr1a"}\\n$lt{"p_ctr1b"}\\n\\n$lt{"p_ctr2a"} "'+oldtitle+'" $lt{"p_ctr2b"}')) {
- targetform.submit();
- }
- }
- if (param == 'copy') {
- targetform.submit();
- }
- targetform.markcopy.value='';
- targetform.copyfolder.value='';
- targetform.cmd.value='';
- targetform.folderpath.value='';
- }
- } else {
- if (context == 'actions') {
- if (document.getElementById(param+'_'+idx)) {
- item = document.getElementById(param+'_'+idx);
- if (item.type == 'checkbox') {
- if (item.checked) {
- item.checked = false;
- } else {
- item.checked = true;
- }
- }
+ if (control) {
+ if (control.showmultpick.length) {
+ for (var i=0; i<control.showmultpick.length; i++) {
+ if (control.showmultpick[i].checked) {
+ if (control.showmultpick[i].value == 1) {
+ if (context == 'settings') {
+ dosettings = 0;
+ } else {
+ doaction = 0;
}
}
}
- } else {
- if (document.getElementById(param+'_'+idx)) {
- checkbox = document.getElementById(param+'_'+idx);
- singleCheck(checkbox,idx,param);
- }
}
}
- } else {
- if (context == 'settings') {
+ }
+ if (context == 'settings') {
+ if (dosettings == 1) {
targetform.changeparms.value=param;
targetform.submit();
}
}
+ if (context == 'actions') {
+ if (doaction == 1) {
+ targetform.cmd.value=param+'_'+index;
+ targetform.folderpath.value=folderpath;
+ targetform.markcopy.value=idx+':'+param;
+ targetform.copyfolder.value=folder+'.'+container;
+ if (param == 'remove') {
+ if (skip_confirm || confirm('$lt{"p_rmr1"}\\n\\n$lt{"p_rmr2a"} "'+oldtitle+'" $lt{"p_rmr2b"}')) {
+ targetform.markcopy.value='';
+ targetform.copyfolder.value='';
+ targetform.submit();
+ }
+ }
+ if (param == 'cut') {
+ if (skip_confirm || confirm('$lt{"p_ctr1a"}\\n$lt{"p_ctr1b"}\\n\\n$lt{"p_ctr2a"} "'+oldtitle+'" $lt{"p_ctr2b"}')) {
+ targetform.submit();
+ return;
+ }
+ }
+ if (param == 'copy') {
+ targetform.submit();
+ return;
+ }
+ targetform.markcopy.value='';
+ targetform.copyfolder.value='';
+ targetform.cmd.value='';
+ targetform.folderpath.value='';
+ return;
+ } else {
+ if (document.getElementById(param+'_'+idx)) {
+ item = document.getElementById(param+'_'+idx);
+ if (item.type == 'checkbox') {
+ if (item.checked) {
+ item.checked = false;
+ } else {
+ item.checked = true;
+ singleCheck(item,idx,param);
+ }
+ }
+ }
+ }
+ }
return;
}
@@ -5955,7 +5966,7 @@
if (dosettings == 1) {
form.allencrypturl.value = '';
form.allhiddenresource.value = '';
- form.changeparams.value = 'all';
+ form.changeparms.value = 'all';
var allidxlist = document.cumulativesettings.allidx.value;
if ((allidxlist != '') && (allidxlist != null)) {
var allidxs = allidxlist.split(',');
More information about the LON-CAPA-cvs
mailing list