Annotation of loncom/interface/lonsimplepage.pm, revision 1.95

1.1       www         1: # The LearningOnline Network
                      2: # Simple Page Editor
                      3: #
1.95    ! raeburn     4: # $Id: lonsimplepage.pm,v 1.94 2010/02/23 14:18:12 raeburn Exp $
1.1       www         5: #
                      6: # Copyright Michigan State University Board of Trustees
                      7: #
                      8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
                      9: #
                     10: # LON-CAPA is free software; you can redistribute it and/or modify
                     11: # it under the terms of the GNU General Public License as published by
                     12: # the Free Software Foundation; either version 2 of the License, or
                     13: # (at your option) any later version.
                     14: #
                     15: # LON-CAPA is distributed in the hope that it will be useful,
                     16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
                     17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     18: # GNU General Public License for more details.
                     19: #
                     20: # You should have received a copy of the GNU General Public License
                     21: # along with LON-CAPA; if not, write to the Free Software
                     22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
                     23: #
                     24: # /home/httpd/html/adm/gpl.txt
                     25: #
                     26: # http://www.lon-capa.org/
                     27: #
                     28: 
                     29: package Apache::lonsimplepage;
                     30: 
                     31: use strict;
                     32: use Apache::Constants qw(:common);
                     33: use Apache::loncommon;
1.60      ehlerst    34: use Apache::lontemplate;
1.1       www        35: use Apache::lonnet;
                     36: use Apache::lontexconvert;
1.6       matthew    37: use Apache::lonfeedback;
1.13      www        38: use Apache::lonlocal;
1.14      sakharuk   39: use Apache::lonprintout;
                     40: use Apache::lonxml;
1.40      raeburn    41: use Apache::longroup;
1.94      raeburn    42: use Apache::lonnavmaps();
1.47      albertel   43: use HTML::Entities();
1.44      raeburn    44: use LONCAPA;
1.1       www        45: 
1.51      albertel   46: sub get_db_name {
                     47:     my ($url) = @_;
                     48:     my ($udom,$uname,$marker)=(split(m{/},$url))[2,3,4];
                     49:     my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
                     50:     my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
                     51: 
                     52:     my $db_name;
                     53: 
                     54:     if ($dom && $crs && ($udom eq $dom) && ($uname eq $crs)) {
1.82      amueller   55:         $marker =~ s/\W//g;
                     56:         $db_name = 'grppage_'.$marker;
1.51      albertel   57:     } else {
1.82      amueller   58:         $marker=~s/\D//g;
1.51      albertel   59:         $db_name = 'smppage_'.$marker;
                     60:     }
                     61:     return if (!defined($marker));
                     62: 
                     63:     return $db_name;
                     64: }
                     65: 
1.1       www        66: sub handler {
                     67:     my $r = shift;
1.24      albertel   68:     &Apache::loncommon::content_type($r,'text/html');
1.1       www        69:     $r->send_http_header;
                     70:     return OK if $r->header_only;
1.25      albertel   71:     my $target=$env{'form.grade_target'};
1.1       www        72: # ------------------------------------------------------------ Print the screen
1.34      albertel   73:     if ($target eq 'tex') {
1.82      amueller   74:         $r->print(&Apache::lonprintout::print_latex_header($env{'form.latex_type'}));
1.78      bisitz     75:     }
1.51      albertel   76: 
1.1       www        77: # Is this even in a course?
1.25      albertel   78:     unless ($env{'request.course.id'}) {
1.82      amueller   79:         if ($target ne 'tex') {
                     80:             &Apache::loncommon::simple_error_page($r,'','Not in a course');
                     81:         } else {
                     82:             $r->print('\textbf{Not in a course}\end{document}');
                     83:         }
                     84:         return OK;
1.1       www        85:     }
                     86: 
1.51      albertel   87:     my $db_name = &get_db_name($r->uri);
                     88: 
1.28      raeburn    89:     my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
                     90:     my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
1.51      albertel   91:     my ($group,$group_desc,$group_home_view,$group_home_edit,
1.45      raeburn    92:         $group_view_perm,$group_edit_perm);
1.28      raeburn    93:     my %curr_group = ();
                     94:     my %groupinfo = ();
1.51      albertel   95:     if ($db_name =~ /^grppage_/) {
1.52      raeburn    96:         $group = (split(m{/},$r->uri))[4];
1.82      amueller   97:         $group =~ s/\W//g;
1.43      raeburn    98:         my %curr_groups = &Apache::longroup::coursegroups($dom,$crs,$group);
1.39      albertel   99:         if (!%curr_groups) {
1.82      amueller  100:             &Apache::loncommon::simple_error_page($r,'','Invalid group name');
                    101:             return OK;
1.28      raeburn   102:         }
1.78      bisitz    103:         %groupinfo =
1.82      amueller  104:         &Apache::longroup::get_group_settings($curr_groups{$group});
1.45      raeburn   105:         $group_desc = &unescape($groupinfo{'description'});
1.28      raeburn   106:     }
1.1       www       107: 
1.51      albertel  108:     if (!$db_name) {
1.82      amueller  109:         &Apache::loncommon::simple_error_page($r,'','Invalid call');
                    110:         return OK;
1.1       www       111:     }
                    112: 
                    113: # --------------------------------------------------------- The syllabus fields
1.13      www       114:     my %syllabusfields=&Apache::lonlocal::texthash(
1.1       www       115:        'aaa_title'         => 'Page Title',
                    116:        'bbb_content'       => 'Content',
                    117:        'ccc_webreferences' => 'Web References');
1.43      raeburn   118:     if ($group ne '') {
1.45      raeburn   119:         $syllabusfields{'abb_links'} = &mt('Available Group Tools');
1.28      raeburn   120:     }
1.1       www       121: 
1.7       www       122: 
                    123: # ------------------------------------------------------------ Get query string
                    124:     &Apache::loncommon::get_unprocessed_cgi
1.44      raeburn   125:                         ($ENV{'QUERY_STRING'},['forcestudent','forceedit',
                    126:                                                'register','ref']);
1.1       www       127: # --------------------------------------------------------------- Force Student
                    128:     my $forcestudent='';
1.25      albertel  129:     if ($env{'form.forcestudent'} || $target eq 'tex' ) { $forcestudent='student'; };
1.38      albertel  130:     my $forceedit='';
                    131:     if ($env{'form.forceedit'}) { $forceedit='edit'; }
1.1       www       132: 
1.45      raeburn   133:     my $refarg;
                    134:     if ($env{'form.ref'}) {
                    135:         $refarg = '&ref='.$env{'form.ref'};
                    136:     }
1.78      bisitz    137: 
1.51      albertel  138:     my %syllabus=&Apache::lonnet::dump($db_name,$dom,$crs);
1.78      bisitz    139: 
1.1       www       140: # --------------------------------------- There is such a user, get environment
                    141: 
1.18      sakharuk  142:     if ($target ne 'tex') {
1.66      biermanm  143:         my $title = 'Simple Course Page';
1.43      raeburn   144:         if ($group ne '') {
1.66      biermanm  145:             $title = 'Simple Group Page';
1.28      raeburn   146:         }
1.82      amueller  147:         my $start_page =
                    148:         &Apache::loncommon::start_page($title,undef,
                    149:                        {'function'       => $forcestudent,
                    150:                         'domain'         => $dom,
                    151:                         'force_register' =>
                    152:                         $env{'form.register'},});
                    153:         $r->print($start_page);
1.28      raeburn   154:     }
                    155: 
1.43      raeburn   156:     if ($group ne '') {
1.45      raeburn   157:         my $group_view_perm =
                    158:                &Apache::lonnet::allowed('vcg',$env{'request.course.id'}.
                    159:                ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));
                    160:         $group_edit_perm =
                    161:                &Apache::lonnet::allowed('mdg',$env{'request.course.id'}.
                    162:                ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));
                    163:         $group_home_view = &Apache::lonnet::allowed('vgh',
                    164:                                          $env{'request.course.id'}.'/'.$group);
                    165:         $group_home_edit = &Apache::lonnet::allowed('mgh',
                    166:                                          $env{'request.course.id'}.'/'.$group);
1.78      bisitz    167:         if ($group_view_perm || $group_edit_perm || $group_home_view ||
1.45      raeburn   168:             $group_home_edit || &Apache::longroup::check_group_access($group)) {
1.95    ! raeburn   169:             if (($env{'form.ref'} eq 'grouplist') && ($target ne 'tex') &&
        !           170:                 (!$env{'form.register'})) {
1.45      raeburn   171:                 $r->print(&grouppage_breadcrumbs($dom,$crs,$group,$group_desc));
                    172:             }
1.78      bisitz    173:             if ((!$group_home_edit) && (!$group_home_view) &&
1.49      raeburn   174:                 (!$group_view_perm) && (!$group_edit_perm)) {
1.45      raeburn   175:                 &display_group_links($r,$target,$group,'view',$refarg,%groupinfo);
1.49      raeburn   176:                 if ($env{'form.grade_target'} ne 'tex') {
                    177:                     $r->print(&Apache::loncommon::end_page());
                    178:                 } else {
                    179:                     $r->print('\end{document}');
                    180:                 }
1.28      raeburn   181:                 return OK;
                    182:             }
                    183:         } else {
1.82      amueller  184:             my $msg =
                    185:             &mt('You do not currently have rights to view this group.');
1.28      raeburn   186:             if ($target ne 'tex') {
1.84      bisitz    187:                 $r->print('<p class="LC_warning">'.$msg.'</p>'.
1.82      amueller  188:                 &Apache::loncommon::end_page());
1.28      raeburn   189:             } else {
1.35      albertel  190:                 $r->print('\textbf{'.$msg.'}\end{document}');
1.28      raeburn   191:             }
1.82      amueller  192:             return OK;
1.28      raeburn   193:         }
1.78      bisitz    194:         my ($blocked,$blocktext) =
1.49      raeburn   195:              &Apache::loncommon::blocking_status('groups');
                    196:         if ($blocked) {
                    197:             $r->print($blocktext);
                    198:             $r->print(&Apache::loncommon::end_page());
                    199:             return OK;
                    200:         }
1.14      sakharuk  201:     }
1.1       www       202: 
1.28      raeburn   203:     my $allowed;
1.78      bisitz    204: 
1.43      raeburn   205:     if ($group ne '') {
1.45      raeburn   206:         $allowed  = $group_edit_perm;
1.42      raeburn   207:         if (!$allowed) {
1.78      bisitz    208:             $allowed = $group_home_edit;
1.28      raeburn   209:         }
1.78      bisitz    210:     } else {
1.28      raeburn   211:         $allowed=&Apache::lonnet::allowed('mdc',$env{'request.course.id'});
                    212:     }
1.16      www       213:     my $privileged=$allowed;
                    214:     if (($syllabus{'uploaded.lastmodified'}) && (!$forceedit)) {
1.82      amueller  215:         $forcestudent='student';
1.16      www       216:     }
1.1       www       217: 
1.18      sakharuk  218:     if ($forcestudent or $target eq 'tex') { $allowed=0; }
1.78      bisitz    219: 
1.25      albertel  220:     if (($env{'form.uploaddoc.filename'} and $target ne 'tex') &&
1.82      amueller  221:     ($env{'form.storeupl'}) && ($allowed)) {
                    222:         if ($env{'form.uploaddoc.filename'}=~/\.(gif|jpg|png|jpeg)$/i) {
                    223:             if ($syllabus{'uploaded.photourl'}) {
                    224:                 &Apache::lonnet::removeuploadedurl($syllabus{'uploaded.photourl'});
                    225:             }
1.45      raeburn   226:             if ($group ne '') {
1.28      raeburn   227:                 $syllabus{'uploaded.photourl'}=&Apache::lonnet::userfileupload(
1.45      raeburn   228:                                               'uploaddoc',1,"grouppage/$group");
1.28      raeburn   229:             } else {
1.82      amueller  230:                 $syllabus{'uploaded.photourl'}=
                    231:                 &Apache::lonnet::userfileupload('uploaddoc',1,'simplepage');
1.28      raeburn   232:             }
1.82      amueller  233:         }
                    234:         $syllabus{'uploaded.lastmodified'}=time;
                    235:         &Apache::lonnet::put($db_name,\%syllabus,$dom,$crs);
1.18      sakharuk  236:     }
1.87      amueller  237: #    if ($allowed && $env{'form.delupl'}) {
                    238: #        if ($syllabus{'uploaded.photourl'}) {
                    239: #            &Apache::lonnet::removeuploadedurl($syllabus{'uploaded.photourl'});
                    240: #            delete($syllabus{'uploaded.photourl'});
                    241: #            &Apache::lonnet::del('simplepage',['uploaded.photourl']);
                    242: #        }
                    243: #    }
1.25      albertel  244:     if (($allowed) && ($env{'form.storesyl'})) {
1.82      amueller  245:         foreach my $syl_field (keys(%syllabusfields)) {
                    246:             my $field=$env{'form.'.$syl_field};
                    247:             chomp($field);
                    248:             $field=~s/\s+$//s;
                    249:             $field=~s/^\s+//s;
                    250:             $field=~s/\<br\s*\/*\>$//s;
                    251:             $field=&Apache::lonfeedback::clear_out_html($field,1);
                    252:             $syllabus{$syl_field}=$field;
                    253:         }
                    254:         $syllabus{'uploaded.lastmodified'}=time;
                    255:         &Apache::lonnet::put($db_name,\%syllabus,$dom,$crs);
1.18      sakharuk  256:     }
1.1       www       257: 
1.72      neumanie  258: #---Print Function
1.82      amueller  259:     if ($target ne 'tex') {
                    260:         if ($allowed || $privileged) {
1.84      bisitz    261:             my $functions=&Apache::lonhtmlcommon::start_funclist();
1.94      raeburn   262:             my $url = $r->uri;
                    263:             if ($group ne '') {
                    264:                 my $navmap=Apache::lonnavmaps::navmap->new();
                    265:                 if (ref($navmap)) {
                    266:                     $url = &Apache::longroup::get_group_link($dom,$crs,$group,$navmap);
                    267:                 }
                    268:             }
1.82      amueller  269:             if ($allowed) {
1.94      raeburn   270:                 $url .= (($url=~/\?/)?'&amp;':'?').'forcestudent=1';
1.84      bisitz    271:                 $functions.=&Apache::lonhtmlcommon::add_item_funclist(
1.94      raeburn   272:                                 '<a href="'.$url.'">'
1.84      bisitz    273:                                .&mt('Show Student View').'</a>'
                    274:                                .&Apache::loncommon::help_open_topic(
                    275:                                     'Uploaded_Templates_PublicView'));
1.82      amueller  276:             } elsif ($privileged) {
                    277:                 my $edittext = &mt('Edit');
1.94      raeburn   278:                 $url .= (($url=~/\?/)?'&amp;':'?').'forceedit=edit'.$refarg;
                    279:                 if ($group ne '') {
1.82      amueller  280:                     $edittext = &mt('Edit Group Homepage');
                    281:                 }
1.84      bisitz    282:                 $functions.=&Apache::lonhtmlcommon::add_item_funclist(
1.94      raeburn   283:                                 '<a href="'.$url.'">'
1.84      bisitz    284:                                .$edittext.'</a>');
1.82      amueller  285:                 if ($group ne '') {
                    286:                     if ($group_edit_perm) {
1.84      bisitz    287:                         $functions.=&Apache::lonhtmlcommon::add_item_funclist(
                    288:                                         '<a href="/adm/coursegroups'
                    289:                                        .'?action=modify&amp;refpage=grouplist'
                    290:                                        .'&amp;state=pick_task&amp;groupname='
                    291:                                        .$group.'">'
                    292:                                        .&mt('Edit Group Settings')
                    293:                                        .'</a>');
1.82      amueller  294:                        }
                    295:                     }
                    296:             }
1.84      bisitz    297:             $functions.=&Apache::lonhtmlcommon::end_funclist();
                    298:             $r->print(&Apache::loncommon::head_subbox($functions));
                    299:         }
                    300:     }
                    301: 
                    302: #---Print help Text
                    303:     if($target ne 'tex'){
                    304:         if ($allowed) {
                    305:             $r->print(&Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes',&mt('Help with filling in text boxes')));
1.81      amueller  306:         }
                    307:     }
1.72      neumanie  308: 
                    309: # ---------------------------------------------------------------- Get syllabus
1.78      bisitz    310:     if ((($syllabus{'uploaded.lastmodified'}) &&
                    311:          (($group ne '' && ($group_home_view || $group_edit_perm ||
1.72      neumanie  312:            $group_view_perm)) || ($group eq ''))) || ($allowed)) {
1.88      amueller  313:         #Print the title
1.91      faziophi  314:         my $titletext=&HTML::Entities::encode($syllabus{'aaa_title'},'<>&"');
1.88      amueller  315:         if ($target ne 'tex') {
                    316:             if ($allowed) {
                    317:             }
                    318:             $r->print('<h2>'.$titletext.'</h2>');
                    319:         } else {
                    320:             my $safeinit;
                    321:             $r->print(&Apache::lonxml::xmlparse($r,'tex','<h1>'.$titletext.'</h1>'));
                    322:         }
                    323:         if ($allowed) {
                    324:             if ($env{'form.grade_target'} ne 'tex') {
                    325:                 #editbox for title
                    326:                 $r->print('<form method="post" action="" enctype="multipart/form-data">');
1.91      faziophi  327: 				&Apache::lontemplate::print_start_template($r,&mt('Title'),'LC_Box');
                    328: 				$r->print($titletext);
                    329: 				$r->print("<br /><div>");
                    330: 				&Apache::lontemplate::print_textarea_template($r, $syllabus{'aaa_title'},
                    331: 					'aaa_title', Apache::lontemplate->RICH_TEXT_ALWAYS_OFF);
                    332: 				&Apache::lontemplate::print_saveall_template($r);
                    333: 				$r->print("</div>");
                    334: 				&Apache::lontemplate::print_end_template($r);
1.88      amueller  335:             } else {
                    336:                 my $safeinit;
                    337:                 $r->print(&Apache::lonxml::xmlparse($r,'tex',$syllabus{'aaa_title'},$safeinit));
                    338:             }
                    339:         }
                    340: 
                    341:         #print the image
1.92      wenzelju  342:         my $image='';
1.82      amueller  343:         if ($syllabus{'uploaded.photourl'}) {
                    344:             &Apache::lonnet::allowuploaded('/adm/smppg',
                    345:                     $syllabus{'uploaded.photourl'});
1.78      bisitz    346: 
1.85      bisitz    347:             $image='<img src="'.$syllabus{'uploaded.photourl'}
                    348:                   .'" alt="'.&mt('Image').'" />';
1.82      amueller  349:             if ($target eq 'tex') {
                    350:                 $image=&Apache::lonxml::xmlparse($r,'tex',$image);
1.72      neumanie  351:             }
                    352:         }
1.78      bisitz    353: 
1.82      amueller  354:         if ($allowed) {
1.92      wenzelju  355:             &Apache::lontemplate::print_start_template($r, &mt('Upload a Photo'),'LC_Box');
                    356:             $r->print($image);
                    357:             $r->print("<br /><br />");
                    358:             $r->print(
                    359:                 '<input type="hidden" name="forceedit" value="edit" />'.
                    360:                 '<input type="file" name="uploaddoc" size="50" />'.
                    361:                 '<input type="submit" name="storeupl" value="'.&mt('Upload').'" />'.
                    362:                 '<input type="hidden" name="forceedit" value="edit" />');
                    363:             &Apache::lontemplate::print_end_template($r);
                    364:     
1.89      amueller  365: 
1.87      amueller  366: #            if ($syllabus{'uploaded.photourl'}) {
                    367: #                $r->print('<input type="submit" name="delupl"'
                    368: #                         .' value="'.&mt('Delete Photo').'" />');
                    369: #            }
1.81      amueller  370:         }
1.92      wenzelju  371:         #Image in Student view and printout.
                    372:         else {
                    373:             $r->print($image);
1.79      amueller  374:         }
1.93      faziophi  375:        	
                    376:         my $links_handler = sub { 
                    377:         	my ($r, $field, $message, $group, $data_ref, $fields_ref, $target, $allowed) = @_;
                    378: 			if ($group ne '') {
                    379: 				my %data = %{$data_ref};
                    380: 				my %fields = %{$fields_ref};
                    381: 				$r->print('<br /><input type="hidden" name="'.$field.
                    382: 					'" value="'.$data{$field}.'" />');
                    383: 				&display_group_links($r, $target, $group, 'edit', $refarg, %groupinfo);
                    384: 				$r->print('<br />');
                    385: 			}
                    386:         };
                    387:         my $title_handler = sub {};
                    388: 		my %custom_handlers = (
                    389: 			'abb_links' => $links_handler,
                    390: 			'aaa_title' => $title_handler
                    391: 		);
                    392: 		&Apache::lontemplate::print_template_fields($r, \%syllabus, \%syllabusfields, 
                    393: 			$target, $allowed, Apache::lontemplate->RICH_TEXT_DETECT_HTML, \%custom_handlers, $group);
                    394: 		
1.82      amueller  395:         if ($allowed && ($env{'form.grade_target'} ne 'tex')) {
                    396:             $r->print(&Apache::lonhtmlcommon::htmlareaselectactive
                    397:                 ('bbb_content').'</form>');
                    398:         }
1.81      amueller  399: 
1.1       www       400:     } else {
1.45      raeburn   401:         if ($group ne '') {
                    402:             &display_group_links($r,$target,$group,'view',$refarg,%groupinfo);
                    403:         } else {
1.84      bisitz    404:             my $text=&mt('No page information provided.');
                    405:             if ($target ne 'tex') {
                    406:                 $r->print('<p class="LC_info">'.$text.'</p>');
                    407:             } else {
                    408:             $r->print($text)
                    409:             }
1.45      raeburn   410:         }
1.1       www       411:     }
1.25      albertel  412:     if ($env{'form.grade_target'} ne 'tex') {
1.81      amueller  413:         $r->print(&Apache::loncommon::end_page());
1.14      sakharuk  414:     } else {
1.82      amueller  415:         $r->print('\end{document}');
1.14      sakharuk  416:     }
1.1       www       417:     return OK;
1.28      raeburn   418: }
                    419: 
                    420: sub display_group_links {
1.45      raeburn   421:     my ($r,$target,$group,$context,$refarg,%groupinfo) = @_;
1.28      raeburn   422:     my @available = ();
                    423:     my %menu = ();
                    424:     %{$menu{'email'}} = (
1.59      schafran  425:                         text => 'Group Message',
1.45      raeburn   426:                         href => '/adm/email?compose=group&amp;group='.$group.
                    427:                                 $refarg,
1.28      raeburn   428:                       );
                    429:     %{$menu{'discussion'}} = (
                    430:                         text => 'Discussion Boards',
1.45      raeburn   431:                         href => '/adm/groupboards?group='.$group.$refarg,
1.28      raeburn   432:                       );
                    433:     %{$menu{'chat'}} = (
1.71      hauer     434:                         text => 'Group Chat Room',
1.45      raeburn   435:                         href => "javascript:group_chat('$group')",
1.28      raeburn   436:                       );
                    437:     %{$menu{'files'}} = (
1.75      weissno   438:                         text => 'Group Portfolio',
1.45      raeburn   439:                         href => '/adm/coursegrp_portfolio?group='.$group.
                    440:                                 $refarg,
1.28      raeburn   441:                       );
                    442:     %{$menu{'roster'}} = (
1.59      schafran  443:                         text => 'Membership Roster',
1.45      raeburn   444:                         href => '/adm/grouproster?group='.$group.$refarg,
1.28      raeburn   445:                       );
                    446:     foreach my $tool (sort(keys(%menu))) {
                    447:         if ($groupinfo{functions}{$tool} eq 'on') {
                    448:             push(@available,$tool);
                    449:         }
                    450:     }
                    451:     if (@available > 0) {
1.64      bisitz    452:         my $output = '';
                    453:         if ($target eq 'tex') {
                    454:             $output = '<table cellspacing="4" cellpadding="4">';
                    455:         } else {
                    456:             $output = &Apache::loncommon::start_data_table();
                    457:         }
1.28      raeburn   458:         foreach my $tool (@available) {
                    459:             if ($target eq 'tex') {
1.64      bisitz    460:                 $output .= '<tr><td>'.&mt($menu{$tool}{text}).'</td></tr>';
1.28      raeburn   461:             } else {
1.64      bisitz    462:                 $output .= &Apache::loncommon::start_data_table_row()
                    463:                           .'<td><a href="'.$menu{$tool}{href}.'">'
                    464:                           .&mt($menu{$tool}{text}).'</a></td>'
                    465:                           .&Apache::loncommon::end_data_table_row();
1.28      raeburn   466:             }
                    467:         }
1.64      bisitz    468:         if ($target eq 'tex') {
                    469:             $output .= '</table>';
                    470:         } else {
                    471:             $output .= &Apache::loncommon::end_data_table();
                    472:         }
1.28      raeburn   473:         if ($target eq 'tex') {
1.45      raeburn   474:             $r->print(&Apache::lonxml::xmlparse($r,'tex',&mt('Available functions').'<br /><br />'.$output));
1.28      raeburn   475:         } else {
1.45      raeburn   476:             $r->print('<h3>'.&mt('Available Group Tools').'</h3>'.$output);
1.28      raeburn   477:         }
                    478:     } else {
1.29      raeburn   479:         my $output;
                    480:         if ($context eq 'edit') {
1.45      raeburn   481:             $output = &mt('No group functionality.');
1.78      bisitz    482:         } else {
1.71      hauer     483:             $output = &mt('No group functionality (e.g., e-mail, discussion, chat room or file upload) is currently available to you in this group: [_1].','<b>'.&unescape($groupinfo{'description'}).'</b>');
1.29      raeburn   484:         }
1.28      raeburn   485:         if ($target eq 'tex') {
                    486:             $r->print(&Apache::lonxml::xmlparse($r,'tex',$output));
                    487:         } else {
                    488:             $r->print($output);
                    489:         }
                    490:     }
                    491: }
1.44      raeburn   492: 
                    493: sub grouppage_breadcrumbs {
1.45      raeburn   494:     my ($cdom,$cnum,$group,$description) = @_;
1.44      raeburn   495:     &Apache::lonhtmlcommon::clear_breadcrumbs();
                    496:     &Apache::lonhtmlcommon::add_breadcrumb
                    497:         ({href=>"/adm/coursegroups",
1.45      raeburn   498:           text=>"Groups",
                    499:           title=>"Display Groups"},
1.44      raeburn   500:         {href=>"/adm/$cdom/$cnum/$group/smppg?ref=grouplist",
1.64      bisitz    501:           text=>&mt('Group:')." $description",
1.44      raeburn   502:           title=>"Go to group's home page"},
                    503:         );
1.45      raeburn   504:     my $output .= &Apache::lonhtmlcommon::breadcrumbs(&mt('Group page - [_1]',
                    505:                                                            $description));
1.44      raeburn   506:     return $output;
                    507: }
1.1       www       508: 
                    509: 1;
                    510: __END__

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