version 1.58, 2010/01/31 06:03:55
|
version 1.64, 2012/11/08 22:01:00
|
Line 78 sub handler {
|
Line 78 sub handler {
|
|
|
# ------------------------------------------------------------ Get Query String |
# ------------------------------------------------------------ Get Query String |
&Apache::loncommon::get_unprocessed_cgi |
&Apache::loncommon::get_unprocessed_cgi |
($ENV{'QUERY_STRING'},['forcestudent','forceedit','register', |
($ENV{'QUERY_STRING'},['forceedit','register', |
'origpage','group','ref']); |
'origpage','group','ref']); |
# ----------------------------------------------------- Force menu registration |
# ----------------------------------------------------- Force menu registration |
my %addentries; |
my %addentries; |
Line 86 sub handler {
|
Line 86 sub handler {
|
$addentries{'onload'} = "document.location='#newpost';"; |
$addentries{'onload'} = "document.location='#newpost';"; |
} |
} |
# --------------------------------------------------------------- Force Student |
# --------------------------------------------------------------- Force Student |
my $forcestudent=''; |
my ($forceedit,$forcestudent); |
if ($env{'form.forcestudent'}) { $forcestudent='student'; } |
$forceedit = $env{'form.forceedit'}; |
|
if (!$forceedit) { |
my $forceedit=''; |
$forcestudent=1; |
if ($env{'form.forceedit'}) { $forceedit='edit'; } |
} |
my $refarg = ''; |
my $refarg = ''; |
if (exists($env{'form.ref'})) { $refarg = 'ref='.$env{'form.ref'}; } |
if (exists($env{'form.ref'})) { $refarg = 'ref='.$env{'form.ref'}; } |
|
|
Line 125 sub handler {
|
Line 125 sub handler {
|
|
|
# --------------------------------------- There is such a user, get environment |
# --------------------------------------- There is such a user, get environment |
if ($target ne 'tex') { |
if ($target ne 'tex') { |
my $course_or_group; |
my ($course_or_group,$brcrum); |
if($group eq '') { |
if($group eq '') { |
$course_or_group="Course"; |
$course_or_group="Course"; |
} else { |
} else { |
$course_or_group="Group"; |
$course_or_group="Group"; |
} |
} |
my $start_page = |
|
&Apache::loncommon::start_page("$course_or_group Discussion Board",undef, |
|
{'function' => $forcestudent, |
|
'add_entries' => \%addentries, |
|
'domain' => $dom, |
|
'force_register' => |
|
$env{'form.register'}}); |
|
$r->print($start_page); |
|
if ($group ne '' && $env{'form.group'} eq $group) { |
if ($group ne '' && $env{'form.group'} eq $group) { |
my $gpterm = &Apache::loncommon::group_term(); |
my $gpterm = &Apache::loncommon::group_term(); |
my $ucgpterm = $gpterm; |
my $ucgpterm = $gpterm; |
Line 150 sub handler {
|
Line 142 sub handler {
|
$boardtitle = $$boards{$$groupboards[0]}{'title'}; |
$boardtitle = $$boards{$$groupboards[0]}{'title'}; |
} |
} |
$boardurl .= '?register=1&group='.$group; |
$boardurl .= '?register=1&group='.$group; |
$r->print(&groupboard_breadcrumbs($dom,$crs,$group,$refarg,$gpterm, |
$brcrum = |
$ucgpterm,$grp_desc,$boardurl,$boardtitle)); |
&groupboard_breadcrumbs($dom,$crs,$group,$refarg,$gpterm, |
|
$ucgpterm,$grp_desc,$boardurl,$boardtitle); |
|
} else { |
|
$brcrum = []; |
} |
} |
|
my $start_page = |
|
&Apache::loncommon::start_page("$course_or_group Discussion Board",undef, |
|
{'add_entries' => \%addentries, |
|
'domain' => $dom, |
|
'bread_crumbs' => $brcrum, |
|
'group' => $group, |
|
'force_register' => |
|
$env{'form.register'}}); |
|
$r->print($start_page); |
} |
} |
my ($allowed); |
my ($allowed); |
if ($group ne '') { |
if ($group ne '') { |
Line 173 sub handler {
|
Line 177 sub handler {
|
$allowed=&Apache::lonnet::allowed('mdc',$env{'request.course.id'}); |
$allowed=&Apache::lonnet::allowed('mdc',$env{'request.course.id'}); |
} |
} |
|
|
my $privileged=$allowed; |
|
if (($syllabus{'uploaded.lastmodified'}) && (!$forceedit)) { |
|
$forcestudent='student'; |
|
} |
|
if ($forcestudent or $target eq 'tex') { $allowed=0; } |
if ($forcestudent or $target eq 'tex') { $allowed=0; } |
|
|
if ($allowed) { |
|
my $query_str = 'forcestudent=1'; |
|
if (($group ne '') && ($env{'form.group'} eq $group)) { |
|
$query_str.='&group='.$group.'&'.$refarg; |
|
} |
|
#Function Box for Edit Mode. |
|
my $functionbox = &Apache::lonhtmlcommon::start_funclist(); |
|
$functionbox .= &Apache::lonhtmlcommon::add_item_funclist( |
|
'<a href="'.$r->uri.'?'.$query_str.'">'.&mt('Show Student View').'</a>'. |
|
&Apache::loncommon::help_open_topic('Uploaded_Templates_PublicView')); |
|
$functionbox.=&Apache::lonhtmlcommon::end_funclist(); |
|
$r->print(&Apache::loncommon::head_subbox($functionbox).&Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes',&mt('Help with filling in text boxes'))); |
|
} elsif ($privileged and $target ne 'tex') { |
|
my $query_str = 'forceedit=edit'; |
|
if (($group ne '') && ($env{'form.group'} eq $group)) { |
|
$query_str.='&group='.$group.'&'.$refarg; |
|
} |
|
#Functionbox for Student view. |
|
my $functionbox = &Apache::lonhtmlcommon::start_funclist(); |
|
$functionbox .= &Apache::lonhtmlcommon::add_item_funclist( |
|
"<a href='".$r->uri.'?'.$query_str."'>".&mt('Edit')."</a>"); |
|
$functionbox.=&Apache::lonhtmlcommon::end_funclist(); |
|
$r->print(&Apache::loncommon::head_subbox($functionbox)); |
|
} |
|
|
|
if (($env{'form.uploaddoc.filename'}) && |
if (($env{'form.uploaddoc.filename'}) && |
($env{'form.storeupl'}) && ($allowed)) { |
($env{'form.storeupl'}) && ($allowed)) { |
if ($env{'form.uploaddoc.filename'}=~/\.(gif|jpg|png|jpeg)$/i) { |
if ($env{'form.uploaddoc.filename'}=~/\.(gif|jpg|png|jpeg)$/i) { |
Line 212 sub handler {
|
Line 187 sub handler {
|
} |
} |
if ($group ne '') { |
if ($group ne '') { |
$syllabus{'uploaded.photourl'}= |
$syllabus{'uploaded.photourl'}= |
&Apache::lonnet::userfileupload('uploaddoc',1, |
&Apache::lonnet::userfileupload('uploaddoc','coursedoc', |
'bulletin/'.$group.'/'.$marker); |
'bulletin/'.$group.'/'.$marker); |
} else { |
} else { |
$syllabus{'uploaded.photourl'}= |
$syllabus{'uploaded.photourl'}= |
&Apache::lonnet::userfileupload('uploaddoc',1, |
&Apache::lonnet::userfileupload('uploaddoc','coursedoc', |
'bulletin/'.$marker); |
'bulletin/'.$marker); |
} |
} |
} |
} |
Line 259 sub handler {
|
Line 234 sub handler {
|
&Apache::lonnet::allowuploaded('/adm/syllabus', |
&Apache::lonnet::allowuploaded('/adm/syllabus', |
$syllabus{'uploaded.photourl'}); |
$syllabus{'uploaded.photourl'}); |
} |
} |
my @htmlids=(); |
|
#Outputbox and Inputbox for Image upload |
#Outputbox and Inputbox for Image upload |
if ($allowed) { |
if ($allowed) { |
my $message = '<img src="'.$syllabus{'uploaded.photourl'}.'" alt="'.&mt('Image').'"/>'; |
my $message = '<img src="'.$syllabus{'uploaded.photourl'}.'" alt="'.&mt('Image').'"/>'; |
Line 267 sub handler {
|
Line 241 sub handler {
|
$r->print($message); |
$r->print($message); |
$r->print("<br /><br />"); |
$r->print("<br /><br />"); |
$r->print( |
$r->print( |
'<input type="hidden" name="forceedit" value="edit" />'. |
'<input type="hidden" name="forceedit" value="'.$env{'form.forceedit'}.'" />'. |
'<input type="file" name="uploaddoc" size="50" />'. |
'<input type="file" name="uploaddoc" size="50" />'. |
'<input type="submit" name="storeupl" value="'.&mt('Upload').'" />'. |
'<input type="submit" name="storeupl" value="'.&mt('Upload').'" />'); |
'<input type="hidden" name="forceedit" value="edit" />'); |
|
&Apache::lontemplate::print_end_template($r); |
&Apache::lontemplate::print_end_template($r); |
} |
} |
#Image in Student view. |
#Image in Student view. |
Line 279 sub handler {
|
Line 252 sub handler {
|
} |
} |
|
|
my %custom_handlers = ( 'aaa_title' => sub {} ); |
my %custom_handlers = ( 'aaa_title' => sub {} ); |
@htmlids = &Apache::lontemplate::print_template_fields($r, \%syllabus, \%syllabusfields, |
&Apache::lontemplate::print_template_fields($r, \%syllabus, \%syllabusfields, |
$target, $allowed, Apache::lontemplate->RICH_TEXT_DETECT_HTML, \%custom_handlers); |
$target, $allowed, Apache::lontemplate->RICH_TEXT_DETECT_HTML, \%custom_handlers); |
if ($allowed) { |
if ($allowed) { |
$r->print('</form>'. |
$r->print('</form>'); |
&Apache::lonhtmlcommon::htmlareaselectactive(@htmlids)); |
|
} |
} |
if ($target ne 'tex'){ |
if ($target ne 'tex'){ |
$r->print('<br/><br/><hr/><br/>'); |
$r->print('<br/><br/><hr/><br/>'); |
Line 292 sub handler {
|
Line 264 sub handler {
|
$r->print(&Apache::lonxml::xmlparse($r,'tex','<br/><br/><hr/><br/>')); |
$r->print(&Apache::lonxml::xmlparse($r,'tex','<br/><br/><hr/><br/>')); |
} |
} |
} else { |
} else { |
$r->print('<p>'.&mt('No page information provided.').'</p>'); |
if ($target ne 'tex') { |
|
$r->print('<p>'.&mt('No page information provided.').'</p>'); |
|
} |
} |
} |
#Lists discussion posts and box for a new discussion post. |
#Lists discussion posts and box for a new discussion post. |
if ($target ne 'tex') { |
if ($target ne 'tex') { |
Line 321 sub groupboard_breadcrumbs {
|
Line 295 sub groupboard_breadcrumbs {
|
my ($cdom,$cnum,$group,$refarg,$gpterm,$ucgpterm,$description,$boardurl, |
my ($cdom,$cnum,$group,$refarg,$gpterm,$ucgpterm,$description,$boardurl, |
$boardtitle)= @_; |
$boardtitle)= @_; |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
|
my $brcrum = []; |
if ($refarg ne '') { |
if ($refarg ne '') { |
&Apache::lonhtmlcommon::add_breadcrumb |
push(@{$brcrum}, |
({href=>"/adm/coursegroups", |
{href=>"/adm/coursegroups", |
text=>"Groups", |
text=>"Groups", |
title=>"View course groups"}); |
title=>"View course groups"}); |
} |
} |
&Apache::lonhtmlcommon::add_breadcrumb |
push(@{$brcrum}, |
({href=>"/adm/$cdom/$cnum/$group/smppg?$refarg", |
{href=>"/adm/$cdom/$cnum/$group/smppg?$refarg", |
text=>"$ucgpterm: $description", |
text=>"$ucgpterm: $description", |
title=>"Go to group's home page"}, |
title=>"Go to group's home page"}, |
{href=>"/adm/groupboards?group=$group&$refarg", |
{href=>"/adm/groupboards?group=$group&$refarg", |
text=>"Discussion Boards", |
text=>"Discussion Boards", |
title=>"Display group discussion boards"}, |
title=>"Display group discussion boards"}, |
{href=>"$boardurl", |
{href=>"$boardurl", |
text=>"$boardtitle", |
text=>"$boardtitle", |
title=>"$boardtitle"}, |
title=>"$boardtitle"}, |
); |
); |
my $output .= &Apache::lonhtmlcommon::breadcrumbs(&mt('[_1] discussion boards - [_2]',$gpterm,$description)); |
return $brcrum; |
return $output; |
|
} |
} |
|
|
1; |
1; |