--- loncom/interface/loncommon.pm 2008/03/28 21:05:28 1.651
+++ loncom/interface/loncommon.pm 2008/12/01 14:38:49 1.698
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.651 2008/03/28 21:05:28 www Exp $
+# $Id: loncommon.pm,v 1.698 2008/12/01 14:38:49 harmsja Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -61,12 +61,15 @@ use POSIX qw(strftime mktime);
use Apache::lonmenu();
use Apache::lonenc();
use Apache::lonlocal;
+use Apache::lonnet();
use HTML::Entities;
use Apache::lonhtmlcommon();
use Apache::loncoursedata();
use Apache::lontexconvert();
use Apache::lonclonecourse();
use LONCAPA qw(:DEFAULT :match);
+use DateTime::TimeZone;
+use DateTime::Locale::Catalog;
# ---------------------------------------------- Designs
use vars qw(%defaultdesign);
@@ -447,6 +450,25 @@ sub selectstudent_link {
return '';
}
+sub authorbrowser_javascript {
+ return <<"ENDAUTHORBRW";
+
+ENDAUTHORBRW
+}
+
sub coursebrowser_javascript {
my ($domainfilter,$sec_element,$formname)=@_;
my $crs_or_grp_alert = &mt('Please select the type of LON-CAPA entity - Course or Group - for which you wish to add/modify a user role');
@@ -584,6 +606,12 @@ sub selectcourse_link {
'","'.$udomele.'","'.$desc.'","'.$extra_element.'","'.$multflag.'","'.$selecttype.'");'."'>".&mt('Select Course')."";
}
+sub selectauthor_link {
+ my ($form,$udom)=@_;
+ return ''.
+ &mt('Select Author').'';
+}
+
sub check_uncheck_jscript {
my $jscript = <<"ENDSCRT";
function checkAll(field) {
@@ -609,6 +637,78 @@ ENDSCRT
return $jscript;
}
+sub select_timezone {
+ my ($name,$selected,$onchange,$includeempty)=@_;
+ my $output='";
+ return $output;
+}
+
+sub select_datelocale {
+ my ($name,$selected,$onchange,$includeempty)=@_;
+ my $output='";
+ return $output;
+}
=pod
@@ -826,16 +926,16 @@ sub help_open_topic {
if ($text ne "") {
$template .=
"
$text";
}
# Add the graphic
my $title = &mt('Online Help');
- my $helpicon=&lonhttpdurl("/res/adm/pages/help.png");
+ my $helpicon=&lonhttpdurl("/adm/help/help.png");
$template .= <<"ENDTEMPLATE";
ENDTEMPLATE
- if ($text ne '') { $template.='
' };
+ if ($text ne '') { $template.='' };
return $template;
}
@@ -857,6 +957,9 @@ sub helpLatexCheatsheet {
.'
';
+ $itemcount ++;
+ }
+ $output .= &Apache::loncommon::end_data_table();
+ }
+ }
+ }
+ return $output;
+}
+
+=pod
+
+=item *&assign_category_rows()
+
+Create a datatable row for display of nested categories in a domain,
+with checkboxes to allow a course to be categorized,called recursively.
+
+Inputs:
+
+itemcount - track row number for alternating colors
+
+cats - reference to array of arrays/hashes which encapsulates hierarchy of
+ categories and subcategories.
+
+depth - current depth in hierarchy of categories and sub-categories - 0 indexed.
+
+parent - parent of current category item
+
+path - Array containing all categories back up through the hierarchy from the
+ current category to the top level.
+
+currcategories - reference to array of current categories assigned to the course
+
+Returns: $output (markup to be displayed).
+
+=cut
+
+sub assign_category_rows {
+ my ($itemcount,$cats,$depth,$parent,$path,$currcategories) = @_;
+ my ($text,$name,$item,$chgstr);
+ if (ref($cats) eq 'ARRAY') {
+ my $maxdepth = scalar(@{$cats});
+ if (ref($cats->[$depth]) eq 'HASH') {
+ if (ref($cats->[$depth]{$parent}) eq 'ARRAY') {
+ my $numchildren = @{$cats->[$depth]{$parent}};
+ my $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ $text .= '
';
+ for (my $j=0; $j<$numchildren; $j++) {
+ $name = $cats->[$depth]{$parent}[$j];
+ $item = &escape($name).':'.&escape($parent).':'.$depth;
+ my $deeper = $depth+1;
+ my $checked = '';
+ if (ref($currcategories) eq 'ARRAY') {
+ if (@{$currcategories} > 0) {
+ if (grep(/^\Q$item\E$/,@{$currcategories})) {
+ $checked = ' checked="checked" ';
+ }
+ }
+ }
+ $text .= '