Diff for /loncom/homework/daxepage.pm between versions 1.14 and 1.15

version 1.14, 2024/03/31 01:50:18 version 1.15, 2024/04/14 17:12:28
Line 46  sub handler { Line 46  sub handler {
     my $uri = $request->uri;      my $uri = $request->uri;
     $uri =~ s{^/daxepage}{};      $uri =~ s{^/daxepage}{};
     &Apache::loncommon::content_type($request,'text/html');      &Apache::loncommon::content_type($request,'text/html');
     my ($is_not_assess,$is_assess);      my ($is_not_assess,$is_assess,$is_course_doc,$is_supp,$supp_path,$supp_title);
     if ($uri =~/\.(xml|html|htm|xhtml|xhtm)$/) {      if ($uri =~/\.(xml|html|htm|xhtml|xhtm)$/) {
         $is_not_assess = 1;          $is_not_assess = 1;
           if ($Apache::lonnet::env{'request.course.id'}) {
               my $cid = $Apache::lonnet::env{'request.course.id'};
               my $cdom = $Apache::lonnet::env{'course.'.$cid.'.domain'};
               my $cnum = $Apache::lonnet::env{'course.'.$cid.'.num'};
               if ($uri =~ m{^/uploaded/\Q$cdom/$cnum\E/(docs|supplemental)/}) {
                   if ($1 eq 'supplemental') {
                       &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
                                                               ['folderpath','title']);
                       $is_supp = 1;
                       $supp_path = &escape(&HTML::Entities::decode($Apache::lonnet::env{'form.folderpath'}));
                       $supp_title = &escape(&HTML::Entities::decode($Apache::lonnet::env{'form.title'}));
                       &Apache::lonhtmlcommon::clear_breadcrumbs();
                   }
                   $is_course_doc = 1;
                   $Apache::lonnet::env{'form.forceedit'} = 1;
               }
           }
     } elsif ($uri =~ /$LONCAPA::assess_re/) {      } elsif ($uri =~ /$LONCAPA::assess_re/) {
         unless ($uri =~ /\.form$/) {          unless ($uri =~ /\.form$/) {
             $is_assess = 1;              $is_assess = 1;
Line 58  sub handler { Line 75  sub handler {
         $request->status(406);          $request->status(406);
         return OK;          return OK;
     }      }
     my %editors = &Apache::loncommon::permitted_editors();      my %editors = &Apache::loncommon::permitted_editors($uri);
     unless ($editors{'daxe'}) {      unless ($editors{'daxe'}) {
         my $msg = '<p class="LC_warning">'.          my $msg = '<p class="LC_warning">'.
                   &mt('Daxe editor is not enabled for this Authoring Space.').'</p>';                    &mt('Daxe editor is not enabled for this Authoring Space.').'</p>';
Line 73  sub handler { Line 90  sub handler {
                                           'noif' => 'No iframe support.',                                            'noif' => 'No iframe support.',
                                           'show' => 'Show content in pop-up window',                                            'show' => 'Show content in pop-up window',
                                           'save' => 'Save',                                            'save' => 'Save',
                                           'text' => 'Text Editor',                                             'text' => 'Text Editor',
                                           'oeds' => 'other editors',                                            'oeds' => 'other editors',
                                           'othe' => 'other editor',                                            'othe' => 'other editor',
                                           'edit' => 'Save and Edit',                                            'edit' => 'Save and Edit',
Line 96  sub handler { Line 113  sub handler {
         $headjs .= &Apache::lonxml::setmode_javascript();          $headjs .= &Apache::lonxml::setmode_javascript();
         $clickexit = "javascript:setmode(this.form,'view');";          $clickexit = "javascript:setmode(this.form,'view');";
     } else {      } else {
         $headjs .= &Apache::lonxml::seteditor_javascript();          $headjs .= &Apache::lonxml::seteditor_javascript($is_course_doc,$is_supp,
                                                            $supp_path,$supp_title);
         $clickexit = "javascript:seteditmode(this.form,'view');";          $clickexit = "javascript:seteditmode(this.form,'view');";
     }      }
     $clicksave = "javascript:daxesave('exit');";      $clicksave = "javascript:daxesave('exit');";
     $clickedit = "javascript:daxesave();";      $clickedit = "javascript:daxesave();";
     my $form_events = &Apache::edit::form_change_detection();      my $form_events = &Apache::edit::form_change_detection();
     my $editheader = '<form '.$form_events.' method="post" name="daxeedit" action="'.$uri.'">'.      my $editheader = '<form '.$form_events.' method="post" name="daxeedit" action="'.$uri.'">';
                      '<input type="hidden" name="problemmode" value="daxe" />'."\n".      if ($is_assess) {
                      '<div class="LC_edit_problem_editxml_header">'."\n";          $editheader .= '<input type="hidden" name="problemmode" value="daxe" />'."\n";
       }
       $editheader .= '<div class="LC_edit_problem_editxml_header">'."\n";
     my $saveeditbutton = '<input type="button" name="submitmode" accesskey="s" value="'.$lt{'edit'}.      my $saveeditbutton = '<input type="button" name="submitmode" accesskey="s" value="'.$lt{'edit'}.
                      '" onclick="'.$clickedit.'" />'."\n";                       '" onclick="'.$clickedit.'" />'."\n";
     my $exitbutton = '<input type="button" name="submitmode" accesskey="d" value="'.$lt{'disc'}.      my $exitbutton = '<input type="button" name="submitmode" accesskey="d" value="'.$lt{'disc'}.
Line 121  sub handler { Line 141  sub handler {
         if ($is_not_assess) {          if ($is_not_assess) {
             $editheader .= '<input type="hidden" name="editmode" value="" />'."\n".              $editheader .= '<input type="hidden" name="editmode" value="" />'."\n".
                            '<input type="button" name="editordefault" value="'.$lt{'text'}.                             '<input type="button" name="editordefault" value="'.$lt{'text'}.
                            '" onclick="seteditmode(this.form,'."'edit'".');" />'."\n";                             '" onclick="javascript:seteditmode(this.form,'."'edit'".');" />'."\n";
         } else {          } else {
             if ($editors{'edit'}) {              if ($editors{'edit'}) {
                 $editheader .= '<input type="button" name="submitmode" accesskey="e" value="'.&mt('Edit').'" '.                  $editheader .= '<input type="button" name="submitmode" accesskey="e" value="'.&mt('Edit').'" '.

Removed from v.1.14  
changed lines
  Added in v.1.15


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