Diff for /loncom/interface/lonhtmlcommon.pm between versions 1.176 and 1.190

version 1.176, 2008/07/07 11:02:05 version 1.190, 2008/12/03 18:53:54
Line 68  use LONCAPA; Line 68  use LONCAPA;
   
 =pod  =pod
   
 =item dragmath  =item dragmath_button
   
 Creates a button that will allow dragmath to edit an equation into   Creates a button that launches a dragmath popup-window, in which an 
 a specified textbox.  expression can be edited and pasted as LaTeX into a specified textarea. 
   
     textarea - Name of the textarea to edit.
     helpicon - If true, show a help icon to the right of the button.
   
   textarea - Name of the text area to edit.  
 =cut  =cut
   
 ##############################################  sub dragmath_button {
 # TODO: Figure out a way to only emit the mathedit function once.      my ($textarea,$helpicon) = @_;
 #       per html output document.      my $help_text; 
 #      if ($helpicon) {
           $help_text = &Apache::loncommon::help_open_topic('Authoring_Math_Editor');
       }
       my $buttontext=&mt('Edit Math');
       return <<ENDDRAGMATH;
                   <input type="button" value="$buttontext", onclick="javascript:mathedit('$textarea',document)" />$help_text
   ENDDRAGMATH
   }
   
 ##############################################  ##############################################
   
 sub dragmath {  =pod
     my ($textarea) = @_;  
   
     return <<ENDDRAGMATH;  =item dragmath_js
                 <script language="JavaScript">  
   Javascript used to open pop-up window containing dragmath applet which 
   can be used to paste LaTeX into a textarea.
    
   =cut
   
   sub dragmath_js {
       my ($popup) = @_;
       return <<ENDDRAGMATHJS;
                   <script type="text/javascript">
                   function mathedit(textarea, doc) {                    function mathedit(textarea, doc) {
                      targetEntry = textarea;                       targetEntry = textarea;
      targetDoc   = doc;                       targetDoc   = doc;
                      newwin  = window.open("/adm/dragmath/applet/EditMathPopup.html","","width=565,height=500,resizable");                       newwin  = window.open("/adm/dragmath/applet/$popup.html","","width=565,height=500,resizable");
                   }                    }
                 </script>                  </script>
                 <input type="button" value="Edit Math", onclick="javascript:mathedit('$textarea',document)" />  
 ENDDRAGMATH  ENDDRAGMATHJS
 }  }
   
   
 ##############################################  ##############################################
 ##############################################  ##############################################
   
Line 1293  returns: nothing Line 1312  returns: nothing
         my $faq = '';          my $faq = '';
         my $bug = '';          my $bug = '';
  my $help='';   my $help='';
    # Crumb Symbol
    my $crumbsymbol = ' &#x25b6; ';
         # The last breadcrumb does not have a link, so handle it separately.          # The last breadcrumb does not have a link, so handle it separately.
         my $last = pop(@Crumbs);          my $last = pop(@Crumbs);
         #          #
Line 1316  returns: nothing Line 1337  returns: nothing
                 });                  });
         }          }
         my $links .=           my $links .= 
             join('-&gt;',              join($crumbsymbol,
                  map {                   map {
                      $faq = $_->{'faq'} if (exists($_->{'faq'}));                       $faq = $_->{'faq'} if (exists($_->{'faq'}));
                      $bug = $_->{'bug'} if (exists($_->{'bug'}));                       $bug = $_->{'bug'} if (exists($_->{'bug'}));
Line 1335  returns: nothing Line 1356  returns: nothing
                      $result;                       $result;
                      } @Crumbs                       } @Crumbs
                  );                   );
         $links .= '-&gt;' if ($links ne '');          $links .= $crumbsymbol if ($links ne '');
  if ($last->{'no_mt'}) {   if ($last->{'no_mt'}) {
     $links .= '<b>'.$last->{'text'}.'</b>';      $links .= '<b>'.$last->{'text'}.'</b>';
  } else {   } else {
Line 1464  END Line 1485  END
     return $output;      return $output;
 }  }
   
   sub row_headline {
       my $output = <<"END";
              <tr><td colspan="2">
   END
       return $output;
   }
   
 sub row_title {  sub row_title {
     my ($title,$css_title_class,$css_value_class) = @_;      my ($title,$css_title_class,$css_value_class) = @_;
     $css_title_class ||= 'LC_pick_box_title';      $css_title_class ||= 'LC_pick_box_title';
Line 1680  sub email_default_row { Line 1708  sub email_default_row {
   
 sub submit_row {  sub submit_row {
     my ($title,$cmd,$submit_text,$css_class) = @_;      my ($title,$cmd,$submit_text,$css_class) = @_;
       $submit_text = &mt($submit_text);
     my $output = &row_title($title,$css_class,'LC_pick_box_submit');      my $output = &row_title($title,$css_class,'LC_pick_box_submit');
     $output .= qq|      $output .= qq|
              <br />               <br />
Line 1710  sub course_custom_roles { Line 1739  sub course_custom_roles {
   
 ##############################################  ##############################################
 ##############################################  ##############################################
   
   # topic_bar
   #
   # Generates a div containing a numbered (static image) followed by a title
   # with a background color defined in the corresponding CSS: LC_topic_bar
   #
   sub topic_bar {
       my ($imgnum,$title) = @_;
       return '
   <div class="LC_topic_bar">
       <img alt="'.&mt('Step [_1]',$imgnum).
                 '"src="/res/adm/pages/bl_step'.$imgnum.'.gif" />&nbsp;
       <span>'.$title.'</span>
   </div>
   ';
   }
   
   ##############################################
   ##############################################
                                                                                                                                                             
 # echo_form_input  # echo_form_input
 #  #
Line 1957  END Line 2005  END
     return $scripttag;      return $scripttag;
 }  }
   
   ##############################################
   ##############################################
   
   # generate_menu
   #
   # Generates html markup for a menu. 
   #
   # Inputs:
   # An array of following structure:
   #   ({ categorytitle => 'Categorytitle',
   # items => [
   #    { linktext    => 'Text to be displayed',
   # url    => 'URL the link is pointing to, i.e. /adm/site?action=dosomething',
   # permission  => 'Contains permissions as returned from lonnet::allowed(),
   # must evaluate to true in order to activate the link',
   # icon        =>  'icon filename',
   # alttext    => 'alt text for the icon',
   # help    => 'Name of the corresponding helpfile',
   # linktitle   => 'Description of the link (used for title tag)'
   #    },
   #    ...
   # ]
   #   }, 
   #   ...
   #   )
   #
   # Outputs: A scalar containing the html markup for the menu.
   
   # ---- Remove when done ----
   # This routine is part of the redesign of LON-CAPA and it's 
   # subject to change during this project.
   # Don't rely on its current functionality as it might be 
   # changed or removed.
   # TODO:
   # check for empty values
   # --------------------------
   
   sub generate_menu {
       my @menu = @_;
       my $menu_html = qq|<div class="columnSection">|;
   
       foreach my $category (@menu) { #FIXME: insert appropriate classnames for styles when they're finished.
    $menu_html .='<div class="ContentBoxSpecial">
    <h3 class="hcell">'.mt($category->{'categorytitle'}).'</h3>
    <ul class="ListStyleNormal">';
    foreach my $item ( @{ $category->{items} } ) {
       next unless $item->{'permission'};
       $menu_html .= qq|<li class="LC_menubuttons_inline_text"><a href="$item->{'url'}" title="|.mt($item->{'linktitle'}).'">';
               if($item->{'icon'}){
                   $menu_html .= qq|<img class ="noBorder" src="/res/adm/pages/$item->{'icon'}" alt="|;
    if($item->{'alttext'}){
       $menu_html .= $item->{'alttext'}.'"/></a>';
    } else { #use linktext as alt text for the icon
       $menu_html .= qq|$item->{'linktext'}"/></a>|;
                   } 
               }
       $menu_html .= qq|<a href="$item->{'url'}" title="|.mt($item->{'linktitle'}).'">';
               $menu_html .= mt($item->{'linktext'}).'</a>';
       if (exists($item->{'help'})) {
    $menu_html .= Apache::loncommon::help_open_topic($item->{'help'});
       }
       $menu_html .= '</li>';
    }
    $menu_html .= '</div>';
       }
       $menu_html .= qq|</div>|;
       return $menu_html;
   }
   
   
 1;  1;

Removed from v.1.176  
changed lines
  Added in v.1.190


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