--- loncom/interface/lonhtmlcommon.pm 2010/03/19 22:34:23 1.182.4.13 +++ loncom/interface/lonhtmlcommon.pm 2008/11/11 20:12:17 1.183 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common html routines # -# $Id: lonhtmlcommon.pm,v 1.182.4.13 2010/03/19 22:34:23 raeburn Exp $ +# $Id: lonhtmlcommon.pm,v 1.183 2008/11/11 20:12:17 droeschl Exp $ # # Copyright Michigan State University Board of Trustees # @@ -62,46 +62,6 @@ use Apache::lonlocal; use Apache::lonnet; use LONCAPA; -sub coursepreflink { - my ($text,$category)=@_; - if (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) { - return ''.$text.''; - } else { - return ''; - } -} - -sub raw_href_to_link { - my ($message)=@_; - $message=~s/(https?\:\/\/[^\s\'\"\<]+)([\s\<]|$)/$1<\/tt><\/a>$2/gi; - return $message; -} - -############################################## -############################################## - -=pod - -=item confirm_success - -Successful completion of an operation message - -=cut - -sub confirm_success { - my ($message,$failure)=@_; - if ($failure) { - return ''."\n" - .''.&mt('Error').' '."\n" - .$message."\n" - .''."\n"; - } else { - return ''."\n" - .''.&mt('OK').' '."\n" - .$message."\n" - .''."\n"; - } -} ############################################## ############################################## @@ -145,13 +105,11 @@ sub dragmath_js { my ($popup) = @_; return < - // ENDDRAGMATHJS @@ -237,9 +195,6 @@ sub select_recent { unless ($value =~/^error\:/) { my $escaped = &Apache::loncommon::escape_url($value); &Apache::loncommon::inhibit_menu_check(\$escaped); - if ($area eq 'residx') { - next if ((!&Apache::lonnet::allowed('bre',$value)) && (!&Apache::lonnet::allowed('bro',$value))); - } $return.="\n'; @@ -330,7 +285,7 @@ sub checkbox { $Str .= 'value="'.$value.'"'; } if ($checked) { - $Str .= ' checked="checked"'; + $Str .= ' checked="1"'; } $Str .= ' />'; return $Str; @@ -352,7 +307,7 @@ sub radio { $Str .= 'value="'.$value.'"'; } if ($checked eq $value) { - $Str .= ' checked="checked"'; + $Str .= ' checked="1"'; } $Str .= ' />'; return $Str; @@ -436,8 +391,8 @@ sub date_setter { ($tzname,$sec,$min,$hour,$mday,$month,$year) = &get_timedates($currentvalue); } unless ($wasdefined) { + ($tzname,$sec,$min,$hour,$mday,$month,$year) = &get_timedates($now); if (($defhour) || ($defmin) || ($defsec)) { - ($tzname,$sec,$min,$hour,$mday,$month,$year) = &get_timedates($now); $sec=($defsec?$defsec:0); $min=($defmin?$defmin:0); $hour=($defhour?$defhour:0); @@ -450,7 +405,6 @@ sub date_setter { my $result = "\n\n"; $result .= < -// ENDJS $result .= ' '; @@ -523,23 +476,23 @@ ENDJS unshift(@Months,'If you can read this an error occurred'); if ($includeempty) { $monthselector.=""; } for(my $m = 1;$m <=$#Months;$m++) { - $monthselector .= qq{ '; } @@ -1846,7 +1749,8 @@ sub topic_bar { return '
'.&mt('Step [_1]',$imgnum).
-              ' '.$title.' + '"src="/res/adm/pages/bl_step'.$imgnum.'.gif" />  + '.$title.'
'; } @@ -1983,7 +1887,7 @@ sub set_form_elements { $values{$name}[$i] =~ s/([\r\n\f]+)/\\n/g; $values{$name}[$i] =~ s/"/\\"/g; } - if (($$elements{$name} eq 'text') || ($$elements{$name} eq 'hidden')) { + if ($$elements{$name} eq 'text') { my $numvalues = @{$values{$name}}; if ($numvalues > 1) { my $valuestring = join('","',@{$values{$name}}); @@ -2018,8 +1922,6 @@ sub set_form_elements { $output .= qq| if (courseForm.elements['$name'].value == "$value") { courseForm.elements['$name'].checked = true; - } else { - courseForm.elements['$name'].checked = false; }|; } } @@ -2061,7 +1963,6 @@ sub set_form_elements { } } $output .= " - return; }\n"; return $output; } @@ -2103,6 +2004,59 @@ END 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', +# 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. +# -------------------------- + +sub generate_menu { + my @menu = @_; + my $menu_html = ''; + + foreach my $category (@menu) { #FIXME: insert appropriate classnames for styles when they're finished. + $menu_html .='
'; + } + return $menu_html; +} 1;

'.$category->{'categorytitle'}.'