'."\n";
+ }
+ return $form;
+}
+
+sub editing_js {
+ my ($udom,$uname,$supplementalflag,$coursedom,$coursenum,$posslti,
+ $canedit,$hostname,$navmapref) = @_;
+ 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',
+ p_rmr2b => '?',
+ p_rmr3a => 'Remove those',
+ p_rmr3b => 'items?',
+ p_rmr4 => 'WARNING: Removing a resource uploaded to a course cannot be undone via "Undo Delete".',
+ p_rmr5 => 'Push "Cancel" and then use "Cut" instead if you might need to undo this change.',
+ 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',
+ p_ctr2b => '?',
+ p_ctr3a => 'Cut those',
+ p_ctr3b => 'items?',
+ 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.',
+ edri => 'Editing rights unavailable for your current role.',
+ );
+
+ &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 $backtourl;
+ my $toplevelmain = &escape(&default_folderpath($coursenum,$coursedom,$navmapref));
+ my $toplevelsupp = &supplemental_base();
+
+ 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)) {
+ my ($url,$anchor);
+ if ($res =~ /^([^#]+)#([^#]+)$/) {
+ $url = $1;
+ $anchor = $2;
+ if (($caller =~ m{^([^#]+)\Q#$anchor\E$})) {
+ $caller = $1.&escape('#').$anchor;
+ }
+ } else {
+ $url = $res;
+ }
+ $backtourl = &HTML::Entities::encode(&Apache::lonnet::clutter($url),'<>&"');
+ if ($backtourl =~ m{^\Q/uploaded/$coursedom/$coursenum/\Edefault_\d+\.sequence$}) {
+ $backtourl .= '?navmap=1';
+ } else {
+ $backtourl .= '?symb='.
+ &HTML::Entities::encode($caller,'<>&"');
+ }
+ if ($backtourl =~ m{^\Q/public/$coursedom/$coursenum/syllabus\E}) {
+ if (($ENV{'SERVER_PORT'} == 443) &&
+ ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) {
+ unless ((&Apache::lonnet::uses_sts()) || (&Apache::lonnet::waf_allssl($hostname))) {
+ if ($hostname ne '') {
+ $backtourl = 'http://'.$hostname.$backtourl;
+ }
+ $backtourl .= (($backtourl =~ /\?/) ? '&':'?').'usehttp=1';
+ }
+ }
+ } elsif ($backtourl =~ m{^/adm/wrapper/ext/(?!https:)}) {
+ if (($ENV{'SERVER_PORT'} == 443) && ($hostname ne '')) {
+ unless ((&Apache::lonnet::uses_sts()) || (&Apache::lonnet::waf_allssl($hostname))) {
+ if ($hostname ne '') {
+ $backtourl = 'http://'.$hostname.$backtourl;
+ }
+ $backtourl .= (($backtourl =~ /\?/) ? '&':'?').'usehttp=1';
+ }
+ }
+ }
+ if ($anchor ne '') {
+ $backtourl .= '#'.&HTML::Entities::encode($anchor,'<>&"');
+ }
+ $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) {
+ if (($env{'request.role.adv'}) ||
+ (&Apache::lonnet::has_unhidden_suppfiles($coursenum,$coursedom))) {
+ $backtourl = '/adm/supplemental';
+ } else {
+ $backtourl = '/adm/navmaps';
+ }
+ } else {
+ $backtourl = '/adm/navmaps';
+ }
+
+ my $fieldsets = "'ext','doc'";
+ if ($posslti) {
+ $fieldsets .= ",'tool'";
+ }
+ unless ($main_container_page) {
+ $fieldsets .=",'ims'";
+ }
+ if ($supplementalflag) {
+ $fieldsets = "'suppext','suppdoc'";
+ if ($posslti) {
+ $fieldsets .= ",'supptool'";
+ }
+ }
+
+ my $jsmakefunctions;
+ if ($canedit) {
+ $jsmakefunctions = <
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();
- $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('