Diff for /loncom/xml/lonxml.pm between versions 1.531.2.24.2.1 and 1.531.2.24.2.5

version 1.531.2.24.2.1, 2023/12/29 23:40:37 version 1.531.2.24.2.5, 2024/09/04 17:22:51
Line 1708  FULLPAGE Line 1708  FULLPAGE
       my %lt=&Apache::lonlocal::texthash('st' => 'Save and Edit',        my %lt=&Apache::lonlocal::texthash('st' => 'Save and Edit',
  'vi' => 'Save and View',   'vi' => 'Save and View',
  'dv' => 'Discard Edits and View',   'dv' => 'Discard Edits and View',
  'un' => 'undo',   'un' => 'Undo',
  'ed' => 'Edit');   'ed' => 'Edit',
    'ew' => 'Edit with Daxe');
       my $spelllink = &Apache::lonhtmlcommon::spelllink('xmledit','filecont');        my $spelllink = &Apache::lonhtmlcommon::spelllink('xmledit','filecont');
       my $textarea_events = &Apache::edit::element_change_detection();        my $textarea_events = &Apache::edit::element_change_detection();
       my $form_events     = &Apache::edit::form_change_detection();        my $form_events     = &Apache::edit::form_change_detection();
Line 1717  FULLPAGE Line 1718  FULLPAGE
       if ($filetype eq 'html') {        if ($filetype eq 'html') {
           $htmlerror=&verify_html($filecontents);            $htmlerror=&verify_html($filecontents);
           if ($htmlerror) {            if ($htmlerror) {
               $htmlerror='<span class="LC_error">'.$htmlerror.'</span>';                $htmlerror=('&nbsp;'x3).' <span class="LC_error">'.$htmlerror.'</span>';
           }            }
           if (&Apache::lonhtmlcommon::htmlareabrowser()) {            if (&Apache::lonhtmlcommon::htmlareabrowser()) {
               unless ($textareaclass) {                unless ($textareaclass) {
Line 1725  FULLPAGE Line 1726  FULLPAGE
               }                }
           }            }
       }        }
       my ($undo,%onclick);        my ($undo,$daxebutton,%onclick);
       foreach my $item ('discard','undo','daxe') {        foreach my $item ('discard','undo','daxe') {
           $onclick{$item} = 'onclick="still_ask=true;setmode(this.form,'."'$item'".')"';            $onclick{$item} = 'onclick="still_ask=true;setmode(this.form,'."'$item'".')"';
       }        }
Line 1733  FULLPAGE Line 1734  FULLPAGE
           $onclick{$item} = 'onclick="is_submit=true;setmode(this.form,'."'$item'".')"';            $onclick{$item} = 'onclick="is_submit=true;setmode(this.form,'."'$item'".')"';
       }        }
       unless ($uri =~ m{^/uploaded/}) {        unless ($uri =~ m{^/uploaded/}) {
           $undo = '<input type="button" name="Undo" accesskey="u" value="'.$lt{'un'}.'" '.            $undo = '<input type="button" name="undo" accesskey="u" value="'.$lt{'un'}.'" '.
                   $onclick{'undo'}.' />'."\n";                    $onclick{'undo'}.' />'."\n";
       }        }
       $initialize .= &setmode_javascript();        $initialize .= &setmode_javascript();
         if ($filetype eq 'html') {
             my %editors = &Apache::loncommon::permitted_editors();
             if ($editors{'daxe'}) {
                 $daxebutton = '<input type="button" name="editwithdaxe" accesskey="w" value="'.$lt{'ew'}.'" '.
                               $onclick{'daxe'}.' />'."\n";
             }
         }
       my $editfooter=(<<ENDFOOTER);        my $editfooter=(<<ENDFOOTER);
 $initialize  $initialize
 <a name="editsection" />  <a name="editsection" />
Line 1755  $initialize Line 1763  $initialize
     </div>      </div>
     <div>      <div>
       <input type="button" name="discardview" accesskey="d" value="$lt{'dv'}" $onclick{'discard'} />        <input type="button" name="discardview" accesskey="d" value="$lt{'dv'}" $onclick{'discard'} />
       $undo $htmlerror $deps_button $dragmath_button        $undo $deps_button $daxebutton $dragmath_button $htmlerror
     </div>      </div>
   </div>    </div>
   <textarea $textarea_events style="width:100%" cols="80" rows="44" name="filecont" id="filecont" $textareaclass>$filecontents</textarea><br />$spelllink    <textarea $textarea_events style="width:100%" cols="80" rows="44" name="filecont" id="filecont" $textareaclass>$filecontents</textarea><br />$spelllink
Line 1773  sub setmode_javascript { Line 1781  sub setmode_javascript {
 <script type="text/javascript">  <script type="text/javascript">
 // <![CDATA[  // <![CDATA[
 function setmode(form,probmode) {  function setmode(form,probmode) {
     var initial = form.problemmode.value;      if (probmode == 'daxe') {
     form.problemmode.value = probmode;          var url = new URL(document.location.href);
     form.submit();          window.location = url.protocol+'//'+url.hostname+'/daxepage'+url.pathname;
     form.problemmode.value = initial;      } else {
           var initial = form.problemmode.value;
           form.problemmode.value = probmode;
           form.submit();
           form.problemmode.value = initial;
       }
 }  }
 // ]]>  // ]]>
 </script>  </script>
Line 1784  ENDSCRIPT Line 1797  ENDSCRIPT
 }  }
   
 sub seteditor_javascript {  sub seteditor_javascript {
       my ($is_course_doc,$is_supp,$supp_path,$supp_title) = @_;
       my $symb;
       if ($is_course_doc) {
           if (!$is_supp) {
               ($symb) = &Apache::lonnet::whichuser();
               if ($symb) {
                   $symb = &escape($symb);
               }
           }
       }
     return <<"ENDSCRIPT";      return <<"ENDSCRIPT";
 <script type="text/javascript">  <script type="text/javascript">
 // <![CDATA[  // <![CDATA[
 function seteditmode(form,editor) {  function seteditmode(form,editor) {
     form.editmode.value = editor;      var querystr = '';
     form.submit();      var supplemental = '$is_supp';
       var coursedoc = '$is_course_doc';
       if (coursedoc)  {
           if (supplemental) {
               var supppath = '$supp_path';
               var supptitle = '$supp_title';
               if (supppath) {
                   querystr = 'folderpath='+supppath;
               }
               if (supptitle) {
                   if (querystr) {
                       querystr += '&';
                   }
                   querystr += 'title='+supptitle;
               }
           }
       }
       if (editor == 'daxe') {
           var url = new URL(document.location.href);
           var newloc = url.protocol+'//'+url.hostname+'/daxepage'+url.pathname;
           if (querystr) {
               if (/\\?/.test(url.pathname)) {
                   newloc += '&';
               } else {
                   newloc += '?';
               }
               newloc += querystr;
           }
           window.location = newloc;
       } else {
           if (coursedoc) {
               var curraction = form.action;
               var idx = curraction.indexOf('?');
               if (idx !== -1) {
                   form.action = curraction.substring(0,idx);
               }
               form.action += '?forceedit=1&register=1';
               if (querystr) {
                   form.action += '&'+querystr;
               }
           }
           if (editor == 'edit') {
               form.editmode.value = editor;
           } else {
               form.editmode.value = '';
           }
           form.submit();
       }
 }  }
 // ]]>  // ]]>
 </script>  </script>
Line 2022  ENDNOTFOUND Line 2092  ENDNOTFOUND
     $displayfile=$request->uri;      $displayfile=$request->uri;
             if ($request->uri =~ m{^/uploaded/}) {              if ($request->uri =~ m{^/uploaded/}) {
                 if ($env{'request.course.id'}) {                  if ($env{'request.course.id'}) {
                     if ($request->uri =~ m{^\Q/uploaded/$cdom/$cnum/supplemental/\E}) {                      if ($request->uri =~ m{^\Q/uploaded/$cdom/$cnum/\E(docs|supplemental)/}) {
                         &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},                          if ($1 eq 'supplemental') {
                                                                 ['folderpath','title']);                              &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
                                                                       ['folderpath','title']);
                           }
                           if (($env{'request.state'} eq 'edit') && ($env{'form.editmode'} eq 'edit') &&
                               ($filetype eq 'html')) {
                               &Apache::lonhtmlcommon::clear_breadcrumbs();
                           }
                     } elsif ($request->uri =~ m{^\Q/uploaded/$cdom/$cnum/portfolio/syllabus/\E(.+)$}) {                      } elsif ($request->uri =~ m{^\Q/uploaded/$cdom/$cnum/portfolio/syllabus/\E(.+)$}) {
                         my $filename = $1;                          my $filename = $1;
                         if ($1 eq 'loncapa.html') {                          if ($1 eq 'loncapa.html') {

Removed from v.1.531.2.24.2.1  
changed lines
  Added in v.1.531.2.24.2.5


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>