version 1.402, 2008/06/27 00:02:55
|
version 1.403, 2008/07/01 01:35:28
|
Line 2135 sub crsenv {
|
Line 2135 sub crsenv {
|
} |
} |
# Update environment and nohist_courseids.db |
# Update environment and nohist_courseids.db |
if (($name eq 'description') || ($name eq 'cloners') || |
if (($name eq 'description') || ($name eq 'cloners') || |
($name eq 'hidefromcat')) { |
($name eq 'hidefromcat') || ($name eq 'categories')) { |
if ($chome eq '') { |
if ($chome eq '') { |
%crsinfo = |
%crsinfo = |
&Apache::lonnet::courseiddump($dom,'.',1,'.','.', |
&Apache::lonnet::courseiddump($dom,'.',1,'.','.', |
$crs,undef,undef,'Course'); |
$crs,undef,undef,'.'); |
$chome = &Apache::lonnet::homeserver($crs,$dom); |
$chome = &Apache::lonnet::homeserver($crs,$dom); |
} |
} |
} |
} |
Line 2152 sub crsenv {
|
Line 2152 sub crsenv {
|
$chome,'notime'); |
$chome,'notime'); |
} |
} |
} |
} |
if ($name eq 'cloners') { |
if (($name eq 'cloners') || ($name eq 'hidefromcat') || ($name eq 'categories')) { |
if (ref($crsinfo{$env{'request.course.id'}}) eq 'HASH') { |
if (ref($crsinfo{$env{'request.course.id'}}) eq 'HASH') { |
$crsinfo{$env{'request.course.id'}}{'cloners'} = $value; |
&Apache::lonnet::appenv({'course.'.$env{'request.course.id'}.'.'.$name => $value}); |
my $putresult = |
$crsinfo{$env{'request.course.id'}}{$name} = $value; |
&Apache::lonnet::courseidput($dom,\%crsinfo, |
|
$chome,'notime'); |
|
} |
|
} |
|
if ($name eq 'hidefromcat') { |
|
if (ref($crsinfo{$env{'request.course.id'}}) eq 'HASH') { |
|
$crsinfo{$env{'request.course.id'}}{'hidefromcat'} = $value; |
|
my $putresult = |
my $putresult = |
&Apache::lonnet::courseidput($dom,\%crsinfo, |
&Apache::lonnet::courseidput($dom,\%crsinfo, |
$chome,'notime'); |
$chome,'notime'); |
Line 2218 sub crsenv {
|
Line 2211 sub crsenv {
|
my $SelectStyleFile=&mt('Select Style File'); |
my $SelectStyleFile=&mt('Select Style File'); |
my $SelectSpreadsheetFile=&mt('Select Spreadsheet File'); |
my $SelectSpreadsheetFile=&mt('Select Spreadsheet File'); |
my $output=''; |
my $output=''; |
|
my $can_categorize; |
if (! exists($values{'con_lost'})) { |
if (! exists($values{'con_lost'})) { |
my %descriptions= |
my %descriptions= |
('url' => '<b>'.&mt('Top Level Map').'</b><br />'. |
('url' => '<b>'.&mt('Top Level Map').'</b><br />'. |
Line 2355 sub crsenv {
|
Line 2349 sub crsenv {
|
'suppress_embed_prompt' |
'suppress_embed_prompt' |
=> '<b>'.&mt('Suppress prompt to upload items referenced in a web page being uploaded to portfolio, when current role is student.').'</b><br />'. |
=> '<b>'.&mt('Suppress prompt to upload items referenced in a web page being uploaded to portfolio, when current role is student.').'</b><br />'. |
' ('.&mt('[_1] to suppress, anything else to not suppress','"<tt>yes</tt>"').')', |
' ('.&mt('[_1] to suppress, anything else to not suppress','"<tt>yes</tt>"').')', |
'hidefromcat' |
'hidefromcat' |
=> '<b>'.&mt('Exclude from course catalog').'</b><br />'. |
=> '<b>'.&mt('Exclude from course catalog').'</b><br />'. |
' ('.&mt('[_1] to exclude, anything else to include - included if assigned an institutional code, or manually catagorized','"<tt>yes</tt>"').')', |
' ('.&mt('[_1] to exclude, anything else to include - included if assigned an institutional code, or manually catagorized','"<tt>yes</tt>"').')', |
|
'categories' |
|
=> '<b>'.&mt('Categorize course').'</b> <a href="javascript:catsbrowser()">'. |
|
&mt('Display Categories').'</a>', |
); |
); |
my @Display_Order = ('url','description','courseid','cloners'); |
my @Display_Order = ('url','description','courseid','cloners'); |
if (&can_toggle_cat($dom)) { |
(my $can_toggle_cat,$can_categorize) = &can_modify_catsettings($dom); |
|
if ($can_toggle_cat) { |
push(@Display_Order,'hidefromcat'); |
push(@Display_Order,'hidefromcat'); |
} |
} |
|
if ($can_categorize) { |
|
push(@Display_Order,'categories'); |
|
} |
push (@Display_Order,('grading', |
push (@Display_Order,('grading', |
'externalsyllabus', |
'externalsyllabus', |
'default_xml_style','pageseparators', |
'default_xml_style','pageseparators', |
Line 2461 sub crsenv {
|
Line 2462 sub crsenv {
|
my $Parameter=&mt('Parameter'); |
my $Parameter=&mt('Parameter'); |
my $Value=&mt('Value'); |
my $Value=&mt('Value'); |
my $Set=&mt('Set'); |
my $Set=&mt('Set'); |
my $browse_js= |
my ($jscript,$categorize_js); |
'<script type="text/javascript" language="Javascript">'. |
my $browse_js = &Apache::loncommon::browser_and_searcher_javascript('parmset'); |
&Apache::loncommon::browser_and_searcher_javascript('parmset'). |
if ($can_categorize) { |
'</script>'; |
$categorize_js = <<ENDSCRIPT; |
|
function catsbrowser() { |
|
var catswin = null; |
|
var url = '/adm/parmset?action=categorizecourse'; |
|
if (!catswin || catswin.closed) { |
|
catswin=window.open(url,'categorieswin','height=480,width=600,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no'); |
|
} else { |
|
catswin.focus(); |
|
} |
|
} |
|
ENDSCRIPT |
|
} |
|
$jscript = '<script type="text/javascript" language="Javascript">'."\n". |
|
$browse_js."\n".$categorize_js."\n".'</script>'; |
my $start_page = |
my $start_page = |
&Apache::loncommon::start_page('Set Course Environment', |
&Apache::loncommon::start_page('Set Course Environment', |
$browse_js); |
$jscript); |
my $end_page = |
my $end_page = |
&Apache::loncommon::end_page(); |
&Apache::loncommon::end_page(); |
my $end_table=&Apache::loncommon::end_data_table(); |
my $end_table=&Apache::loncommon::end_data_table(); |
Line 2490 $end_page
|
Line 2503 $end_page
|
ENDENV |
ENDENV |
} |
} |
|
|
sub can_toggle_cat { |
sub can_modify_catsettings { |
my ($dom) = @_; |
my ($dom) = @_; |
my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$dom); |
my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$dom); |
my $can_toggle_cat = ''; |
my ($can_toggle_cat,$can_categorize); |
if (ref($domconf{'coursecategories'}) eq 'HASH') { |
if (ref($domconf{'coursecategories'}) eq 'HASH') { |
if ($domconf{'coursecategories'}{'togglecats'} eq 'crs') { |
if ($domconf{'coursecategories'}{'togglecats'} eq 'crs') { |
$can_toggle_cat = 1; |
$can_toggle_cat = 1; |
} |
} |
|
if ($domconf{'coursecategories'}{'categorize'} eq 'crs') { |
|
$can_categorize = 1; |
|
} |
|
} |
|
return ($can_toggle_cat,$can_categorize); |
|
} |
|
|
|
sub assign_course_categories { |
|
my ($r) = @_; |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $hascats = 0; |
|
my $cathash; |
|
my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$cdom); |
|
if (ref($domconf{'coursecategories'}) eq 'HASH') { |
|
$cathash = $domconf{'coursecategories'}{'cats'}; |
|
if (ref($cathash) eq 'HASH') { |
|
$hascats = 1; |
|
} |
|
} |
|
my $catwin_js; |
|
if ($hascats) { |
|
my $alert = &mt('Use \"Save\" in the main window to save course categories'); |
|
$catwin_js = <<ENDSCRIPT; |
|
<script type="text/javascript"> |
|
|
|
function updateCategories() { |
|
var newcategories = ''; |
|
if (document.chgcats.usecategory.length) { |
|
for (var i=0; i<document.chgcats.usecategory.length; i++) { |
|
if (document.chgcats.usecategory[i].checked == true) { |
|
newcategories = newcategories + document.chgcats.usecategory[i].value + '&'; |
|
} |
|
} |
|
if (newcategories.length > 0) { |
|
newcategories = newcategories.slice(0,-1); |
|
} |
|
} else { |
|
if (document.chgcats.usecategory.checked == true) { |
|
newcategories = document.chgcats.usecategory.value; |
|
} |
|
} |
|
opener.document.envform.categories_value.value = newcategories; |
|
opener.document.envform.categories_setparmval.checked = true; |
|
alert("$alert"); |
|
self.close(); |
|
return; |
|
} |
|
|
|
</script> |
|
ENDSCRIPT |
|
} else { |
|
my $onload; |
} |
} |
return $can_toggle_cat; |
my $start_page = |
|
&Apache::loncommon::start_page('Course Categories',$catwin_js, |
|
{'only_body' => 1,}); |
|
my $end_page = &Apache::loncommon::end_page(); |
|
my $categoriesform = '<h3>'.&mt('Categorize Course').'</h3>'; |
|
if ($hascats) { |
|
my %currsettings = |
|
&Apache::lonnet::get('environment',['hidefromcat','categories'],$cdom,$cnum); |
|
$categoriesform .= &mt('Assign one or more categories to this course.').'<br /><br />'. |
|
'<form name="chgcats" action="/adm/parmset" method="post">'."\n" |
|
.&Apache::loncommon::assign_categories_table($cathash, |
|
$currsettings{'categories'})."\n" |
|
.'<br /><input type="button" name="changes" value="' |
|
.&mt('Copy to main window').'" ' |
|
.'onclick="javascript:updateCategories()" /></form><br />'; |
|
} else { |
|
$categoriesform .= &mt('No categories defined for this domain'); |
|
} |
|
$r->print($start_page.$categoriesform.$end_page); |
|
return; |
} |
} |
|
|
################################################## |
################################################## |
Line 4363 sub handler {
|
Line 4448 sub handler {
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'}, |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'}, |
text=>"Shifting Dates"}); |
text=>"Shifting Dates"}); |
&date_shift_two($r); |
&date_shift_two($r); |
} |
} elsif ($env{'form.action'} eq 'categorizecourse' && $parm_permission) { |
|
&assign_course_categories($r); |
|
} |
} else { |
} else { |
# ----------------------------- Not in a course, or not allowed to modify parms |
# ----------------------------- Not in a course, or not allowed to modify parms |
if ($exists) { |
if ($exists) { |