'."\n";
+ }
+ return $form;
+}
+
+sub editing_js {
+ my ($udom,$uname,$supplementalflag) = @_;
+ my %js_lt = &Apache::lonlocal::texthash(
+ p_mnf => 'Name of New Folder',
+ t_mnf => 'New Folder',
+ p_mnp => 'Name of New Page',
+ t_mnp => 'New Page',
+ p_mxu => 'Title for the External Score',
+ p_msp => 'Name of Simple Course Page',
+ p_msb => 'Title for the Problem',
+ p_mdb => 'Title for the Drop Box',
+ p_mbb => 'Title for the Discussion Board',
+ p_mwp => 'Title for Web Page',
+ p_mab => "Enter user:domain for User's Personal Information Page",
+ p_mab2 => 'Personal Information Page of ',
+ p_mab_alrt1 => 'Not a valid user:domain',
+ p_mab_alrt2 => 'Please enter both user and domain in the format user:domain',
+ p_chn => 'New Title',
+ p_rmr1 => 'WARNING: Removing a resource makes associated grades and scores inaccessible!',
+ p_rmr2a => 'Remove[_99]',
+ p_rmr2b => '?[_99]',
+ p_rmr3a => 'Remove those [_2]',
+ p_rmr3b => 'items?[_2]',
+ p_ctr1a => 'WARNING: Cutting a resource makes associated grades and scores inaccessible!',
+ p_ctr1b => 'Grades remain inaccessible if resource is pasted into another folder.',
+ p_ctr2a => 'Cut[_98]',
+ p_ctr2b => '?[_98]',
+ p_ctr3a => 'Cut those[_2]',
+ p_ctr3b => 'items?[_2]',
+ 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',
+ invurl => 'Invalid URL',
+ titbl => 'Title is blank',
+ more => '(More ...)',
+ less => '(Less ...)',
+ noor => 'No actions selected or changes to settings specified.',
+ noch => 'No changes to settings specified.',
+ noac => 'No actions selected.',
+ );
+ &js_escape(\%js_lt);
+ my $crstype = &Apache::loncommon::course_type();
+ my $docs_folderpath = &HTML::Entities::encode($env{'environment.internal.'.$env{'request.course.id'}.'.docs_folderpath.folderpath'},'<>&"');
+ my $main_container_page;
+ if (&HTML::Entities::decode($env{'environment.internal.'.$env{'request.course.id'}.'.docs_folderpath.folderpath'}) =~ /\:1$/) {
+ $main_container_page = 1;
+ }
+ my $toplevelmain =
+ &escape(&mt('Main Content').':::::');
+ my $toplevelsupp = &supplemental_base();
+
+ my $backtourl;
+ if ($env{'docs.exit.'.$env{'request.course.id'}} =~ /^direct_(.+)$/) {
+ my $caller = $1;
+ if ($caller =~ /^supplemental/) {
+ $backtourl = '/adm/supplemental?folderpath='.&escape($caller);
+ } else {
+ my ($map,$id,$res)=&Apache::lonnet::decode_symb($caller);
+ $res = &Apache::lonnet::clutter($res);
+ if (&Apache::lonnet::is_on_map($res)) {
+ $backtourl = &HTML::Entities::encode(&Apache::lonnet::clutter($res),'<>&"').'?symb='.
+ &HTML::Entities::encode($caller,'<>&"');
+ $backtourl = &Apache::loncommon::escape_single($backtourl);
+ } else {
+ $backtourl = '/adm/navmaps';
+ }
+ }
+ } elsif ($env{'docs.exit.'.$env{'request.course.id'}} eq '/adm/menu') {
+ $backtourl = '/adm/menu';
+ } elsif ($supplementalflag) {
+ $backtourl = '/adm/supplemental';
+ } else {
+ $backtourl = '/adm/navmaps';
+ }
+
+ my $fieldsets = "'ext','doc'";
+ unless ($main_container_page) {
+ $fieldsets .=",'ims'";
+ }
+ if ($supplementalflag) {
+ $fieldsets = "'suppext','suppdoc'";
+ }
+
+ return <'+picknum+'';
+ if (caller == 'link') {
+ propagateState(targetform,'rpicknum');
+ }
+ } else {
+ picknumtext.innerHTML = ' '+picknum+'';
+ checkForSubmit(targetform,'randompick','settings');
+ }
+ } else {
+ if (caller == 'check') {
+ if (index == 'all') {
+ picknumtext.innerHTML = '';
+ if (caller == 'link') {
+ propagateState(targetform,'rpicknum');
+ }
+ } else {
+ pickitem.checked=false;
+ checkForSubmit(targetform,'randompick','settings');
+ }
+ }
+ return;
+ }
+ }
+ } else {
+ picknumitem.value = '';
+ picknumtext.innerHTML = '';
+ if (index == 'all') {
+ if (caller == 'link') {
+ propagateState(targetform,'rpicknum');
+ }
+ } else {
+ checkForSubmit(targetform,'randompick','settings');
+ }
+ }
+}
+
+function propagateState(form,param) {
+ if (document.getElementById(param+'all')) {
+ var setcheck = 0;
+ var rpick = 0;
+ if (param == 'rpicknum') {
+ if (document.getElementById('randompickall')) {
+ if (document.getElementById('randompickall').checked) {
+ if (document.getElementById('rpicknumall')) {
+ rpick = document.getElementById('rpicknumall').value;
+ }
+ }
+ }
+ } else {
+ if (document.getElementById(param+'all').checked) {
+ setcheck = 1;
+ }
+ }
+ var allidxlist;
+ if ((param == 'remove') || (param == 'cut') || (param == 'copy')) {
+ if (document.getElementById('all'+param+'idx')) {
+ allidxlist = document.getElementById('all'+param+'idx').value;
+ }
+ var actions = new Array ('remove','cut','copy');
+ for (var i=0; i 1) {
+ for (var i=0; i 0) {
+ document.getElementById('randompicknum_'+allidxs[i]).innerHTML = ': '+rpick+'';
+ } else {
+ document.getElementById('randompicknum_'+allidxs[i]).innerHTML = '';
+ }
+ }
+ }
+ } else {
+ if (setcheck == 1) {
+ document.getElementById(param+'_'+allidxs[i]).checked = true;
+ } else {
+ document.getElementById(param+'_'+allidxs[i]).checked = false;
+ if (param == 'randompick') {
+ document.getElementById('randompicknum_'+allidxs[i]).innerHTML = '';
+ }
+ }
+ }
+ }
+ }
+ if (setcheck == 1) {
+ if ((param == 'remove') || (param == 'cut') || (param == 'copy')) {
+ var actions = new Array('copy','cut','remove');
+ for (var i=0; i 1) {
+ for (var j=0; j 2 ){
+ currentNav = document.getElementById(tabnav[1].id);
+ currentLis = currentNav.getElementsByTagName('LI');
+ for(i = 0; i< currentLis.length; i++){
+ if(currentLis[i].className == 'active') {
+ funcString = currentLis[i].onclick.toString();
+ tab = funcString.split('"');
+ if(tab.length < 2) {
+ tab = funcString.split("'");
+ }
+ currentData = document.getElementById(tab[1]);
+ currentData.style.display = 'block';
+ }
+ }
+ }
+}
+
+function showPage(current, pageId, nav, data) {
+ currstate = current.className;
+ hideAll(current, nav, data);
+ openTabs(pageId);
+ unselectInactive(nav);
+ if ((currstate == 'active') || (currstate == 'right active')) {
+ if (currstate == 'active') {
+ current.className = '';
+ } else {
+ current.className = 'right';
+ }
+ activeTab = '';
+ toggleUpload();
+ toggleMap();
+ resize_scrollbox('contentscroll','1','0');
+ return;
+ } else {
+ current.className = 'active';
+ }
+ currentData = document.getElementById(pageId);
+ currentData.style.display = 'block';
+ activeTab = pageId;
+ toggleUpload();
+ toggleMap();
+ if (nav == 'mainnav') {
+ var storedpath = "$docs_folderpath";
+ var storedpage = "$main_container_page";
+ var reg = new RegExp("^supplemental");
+ if (pageId == 'mainCourseDocuments') {
+ if (storedpage == 1) {
+ document.simpleedit.folderpath.value = '';
+ document.uploaddocument.folderpath.value = '';
+ } else {
+ if (reg.test(storedpath)) {
+ document.simpleedit.folderpath.value = '$toplevelmain';
+ document.uploaddocument.folderpath.value = '$toplevelmain';
+ document.newext.folderpath.value = '$toplevelmain';
+ } else {
+ document.simpleedit.folderpath.value = storedpath;
+ document.uploaddocument.folderpath.value = storedpath;
+ document.newext.folderpath.value = storedpath;
+ }
+ }
+ } else {
+ if (reg.test(storedpath)) {
+ document.simpleedit.folderpath.value = storedpath;
+ document.supuploaddocument.folderpath.value = storedpath;
+ document.supnewext.folderpath.value = storedpath;
+ } else {
+ document.simpleedit.folderpath.value = '$toplevelsupp';
+ document.supuploaddocument.folderpath.value = '$toplevelsupp';
+ document.supnewext.folderpath.value = '$toplevelsupp';
+ }
+ }
+ }
+ resize_scrollbox('contentscroll','1','0');
+ return false;
+}
+
+function toContents(jumpto) {
+ var newurl = '$backtourl';
+ if ((newurl == '/adm/navmaps') && (jumpto != '')) {
+ newurl = newurl+'?postdata='+jumpto;
+ }
+ location.href=newurl;
+}
+
+function togglePick(caller,value) {
+ var disp = 'none';
+ if (document.getElementById('multi'+caller)) {
+ var curr = document.getElementById('multi'+caller).style.display;
+ if (value == 1) {
+ disp='block';
+ }
+ if (curr == disp) {
+ return;
+ }
+ document.getElementById('multi'+caller).style.display=disp;
+ if (value == 1) {
+ document.getElementById('more'+caller).innerHTML = ' $js_lt{'more'}';
+ } else {
+ document.getElementById('more'+caller).innerHTML = '';
+ }
+ if (caller == 'actions') {
+ setClass(value);
+ setBoxes(value);
+ }
+ }
+ var showButton = multiSettings();
+ if (showButton != 1) {
+ showButton = multiActions();
+ }
+ if (document.getElementById('multisave')) {
+ if (showButton == 1) {
+ document.getElementById('multisave').style.display='block';
+ } else {
+ document.getElementById('multisave').style.display='none';
+ }
+ }
+ resize_scrollbox('contentscroll','1','1');
+ return;
+}
+
+function toggleCheckUncheck(caller,more) {
+ if (more == 1) {
+ document.getElementById('more'+caller).innerHTML = ' $js_lt{'less'}';
+ document.getElementById('allfields'+caller).style.display='block';
+ } else {
+ document.getElementById('more'+caller).innerHTML = ' $js_lt{'more'}';
+ document.getElementById('allfields'+caller).style.display='none';
+ }
+ resize_scrollbox('contentscroll','1','1');
+}
+
+function multiSettings() {
+ var inuse = 0;
+ var settingsform = document.togglemultsettings;
+ if (settingsform.showmultpick.length > 1) {
+ for (var i=0; i 1) {
+ for (var i=0; i 0) {
+ form.multichange.value = numchanges;
+ }
+ }
+ var dosettings = multiSettings();
+ var haschanges = 0;
+ if (dosettings == 1) {
+ form.allencrypturl.value = '';
+ form.allhiddenresource.value = '';
+ form.changeparms.value = 'all';
+ var patt=new RegExp(",\$");
+ var allidxlist = document.cumulativesettings.allidx.value;
+ if ((allidxlist != '') && (allidxlist != null)) {
+ var allidxs = allidxlist.split(',');
+ if (allidxs.length > 1) {
+ for (var i=0; i 0) {
+ if ((cutwarnings > 0) || (remwarnings > 0)) {
+ if (remwarnings > 0) {
+ if (!confirm('$js_lt{"p_rmr1"}\\n\\n$js_lt{"p_rmr3a"} '+remwarnings+' $js_lt{"p_rmr3b"}')) {
+ return false;
+ }
+ }
+ if (cutwarnings > 0) {
+ if (!confirm('$js_lt{"p_ctr1a"}\\n$js_lt{"p_ctr1b"}\\n\\n$js_lt{"p_ctr3a"} '+cutwarnings+' $js_lt{"p_ctr3b"}')) {
+ return false;
+ }
+ }
+ }
+ form.submit();
+ return true;
+ }
+ }
+ if (dosettings == 1) {
+ if (haschanges == 1) {
+ form.submit();
+ return true;
+ }
+ }
+ if ((dosettings == 1) && (doactions == 1)) {
+ alert("$js_lt{'noor'}");
+ } else {
+ if (dosettings == 1) {
+ alert("$js_lt{'noch'}");
+ } else {
+ alert("$js_lt{'noac'}");
+ }
+ }
+ return false;
+}
+
+function setClass(value) {
+ var cutclass = 'LC_docs_cut';
+ var copyclass = 'LC_docs_copy';
+ var removeclass = 'LC_docs_remove';
+ var cutreg = new RegExp("\\\\b"+cutclass+"\\\\b");
+ var copyreg = new RegExp("\\\\b"+copyclass+"\\\\b");
+ var removereg = new RegExp("\\\\"+removeclass+"\\\\b");
+ var links = document.getElementsByTagName('a');
+ for (var i=0; i
ENDNEWSCRIPT
- }
-# -------------------------------------------------------------------- Body tag
- $r->print(''.
- &Apache::loncommon::bodytag('Course Documents','',$events,
- '','',$showdoc));
- unless ($showdoc) {
-# -----------------------------------------------------------------------------
- my %lt=&Apache::lonlocal::texthash(
- 'uplm' => 'Upload a new main course document',
- 'upls' => 'Upload a new supplemental course document',
- 'impp' => 'Import a published document',
- 'spec' => 'Special documents',
- 'upld' => 'Upload Document',
- 'srch' => 'Search',
- 'impo' => 'Import',
- 'selm' => 'Select Map',
- 'load' => 'Load Map',
- 'newf' => 'New Folder',
- 'extr' => 'External Resource',
- 'syll' => 'Syllabus',
- 'navc' => 'Navigate Contents',
- 'sipa' => 'Simple Page',
- 'sipr' => 'Simple Problem',
- 'scuf' => 'Score Upload Form',
- 'bull' => 'Bulletin Board',
- 'mypi' => 'My Personal Info'
- );
-# -----------------------------------------------------------------------------
- if ($allowed) {
- my $dumpbut=&dumpbutton();
- my %lt=&Apache::lonlocal::texthash(
- 'vc' => 'Verify Content',
- 'cv' => 'Check/Set Resource Versions',
- );
- $r->print(<
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-$dumpbut
-
-
-ENDCOURSEVERIFY
- $r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc',
- 'Editing the Table of Contents for your Course'));
- }
-# --------------------------------------------------------- Standard documents
- $r->print('