version 1.476, 2011/12/25 19:39:08
|
version 1.481, 2012/03/05 11:15:37
|
Line 225 automatically.
|
Line 225 automatically.
|
|
|
=over 4 |
=over 4 |
|
|
=item * B<iterator: default: constructs one from %env |
=item * B<iterator: default: constructs one from %env> |
|
|
A reference to a fresh ::iterator to use from the navmaps. The |
A reference to a fresh ::iterator to use from the navmaps. The |
rendering will reflect the options passed to the iterator, so you can |
rendering will reflect the options passed to the iterator, so you can |
Line 896 sub part_status_summary { return 4; }
|
Line 896 sub part_status_summary { return 4; }
|
sub render_resource { |
sub render_resource { |
my ($resource, $part, $params) = @_; |
my ($resource, $part, $params) = @_; |
|
|
|
my $editmapLink; |
my $nonLinkedText = ''; # stuff after resource title not in link |
my $nonLinkedText = ''; # stuff after resource title not in link |
|
|
my $link = $params->{"resourceLink"}; |
my $link = $params->{"resourceLink"}; |
Line 977 sub render_resource {
|
Line 978 sub render_resource {
|
$linkopen = ""; |
$linkopen = ""; |
$linkclose = ""; |
$linkclose = ""; |
} |
} |
|
if ((&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) && |
|
($resource->symb=~/\_\_\_[^\_]+\_\_\_uploaded/)) { |
|
my $icon = &Apache::loncommon::lonhttpdurl('/res/adm/pages').'/editmap.png'; |
|
$editmapLink=' '. |
|
'<a href="/adm/coursedocs?command=direct&symb='.&escape($resource->symb()).'">'. |
|
'<img src="'.$icon.'" alt="'.&mt('Edit Content').'" title="'.&mt('Edit Content').'" />'. |
|
'</a>'; |
|
} |
} |
} |
|
|
if ($resource->randomout()) { |
if ($resource->randomout()) { |
Line 1010 sub render_resource {
|
Line 1019 sub render_resource {
|
# Is this the current resource? |
# Is this the current resource? |
if (!$params->{'displayedHereMarker'} && |
if (!$params->{'displayedHereMarker'} && |
$resource->symb() eq $params->{'here'} ) { |
$resource->symb() eq $params->{'here'} ) { |
$curMarkerBegin = '<span class="LC_current_nav_location">'; |
unless ($resource->is_map()) { |
$curMarkerEnd = '</span>'; |
$curMarkerBegin = '<span class="LC_current_nav_location">'; |
|
$curMarkerEnd = '</span>'; |
|
} |
$params->{'displayedHereMarker'} = 1; |
$params->{'displayedHereMarker'} = 1; |
} |
} |
|
|
Line 1030 sub render_resource {
|
Line 1041 sub render_resource {
|
if (!$params->{'resource_nolink'} && !$resource->is_sequence() && !$resource->is_empty_sequence) { |
if (!$params->{'resource_nolink'} && !$resource->is_sequence() && !$resource->is_empty_sequence) { |
$result .= "$curMarkerBegin<a href=\"$link\">$title$partLabel</a>$curMarkerEnd$nonLinkedText</td>"; |
$result .= "$curMarkerBegin<a href=\"$link\">$title$partLabel</a>$curMarkerEnd$nonLinkedText</td>"; |
} else { |
} else { |
$result .= "$curMarkerBegin$linkopen$title$partLabel</a>$curMarkerEnd$nonLinkedText</td>"; |
$result .= "$curMarkerBegin$linkopen$title$partLabel</a>$curMarkerEnd$editmapLink$nonLinkedText</td>"; |
} |
} |
|
|
return $result; |
return $result; |
Line 1044 sub render_communication_status {
|
Line 1055 sub render_communication_status {
|
my $linkopen = "<a href=\"$link\">"; |
my $linkopen = "<a href=\"$link\">"; |
my $linkclose = "</a>"; |
my $linkclose = "</a>"; |
my $location=&Apache::loncommon::lonhttpdurl("/adm/lonMisc"); |
my $location=&Apache::loncommon::lonhttpdurl("/adm/lonMisc"); |
|
|
if ($resource->hasDiscussion()) { |
if ($resource->hasDiscussion()) { |
$discussionHTML = $linkopen . |
$discussionHTML = $linkopen . |
'<img alt="'.&mt('New Discussion').'" src="'.$location.'/chat.gif" title="'.&mt('New Discussion').'"/>' . |
'<img alt="'.&mt('New Discussion').'" src="'.$location.'/chat.gif" title="'.&mt('New Discussion').'"/>' . |
Line 1132 sub render_long_status {
|
Line 1144 sub render_long_status {
|
$result .= getDescription($resource, $part); |
$result .= getDescription($resource, $part); |
if ($color) {$result .= "</b></font>"; } |
if ($color) {$result .= "</b></font>"; } |
} |
} |
if ($resource->is_map()) { |
|
if (&Apache::lonnet::allowed('mdc')) { |
|
if ($resource->symb=~/\_\_\_[^\_]+\_\_\_uploaded/) { |
|
$result.=" <a href='/adm/coursedocs?command=direct&symb=".&escape($resource->symb())."'>". |
|
"<span class='LC_setting'>".&mt("Edit Content").'</span></a> '; |
|
} |
|
} |
|
} |
|
if ($resource->is_map() && &advancedUser() && $resource->randompick()) { |
if ($resource->is_map() && &advancedUser() && $resource->randompick()) { |
$result .= &mt('(randomly select [_1])', $resource->randompick()); |
$result .= &mt('(randomly select [_1])', $resource->randompick()); |
} |
} |
Line 1462 sub render {
|
Line 1466 sub render {
|
$link .= '&register='.$env{'form.register'}; |
$link .= '&register='.$env{'form.register'}; |
} |
} |
if ($args->{'caller'} eq 'navmapsdisplay') { |
if ($args->{'caller'} eq 'navmapsdisplay') { |
&add_linkitem($args->{'linkitems'},'changefolder', |
unless ($args->{'notools'}) { |
"location.href='$link'",$text); |
&add_linkitem($args->{'linkitems'},'changefolder', |
|
"location.href='$link'",$text); |
|
} |
} else { |
} else { |
$result.= '<a href="'.$link.'">'.&mt($text).'</a>'; |
$result.= '<a href="'.$link.'">'.&mt($text).'</a>'; |
} |
} |
Line 1471 sub render {
|
Line 1477 sub render {
|
} |
} |
|
|
# Check for any unread discussions in all resources. |
# Check for any unread discussions in all resources. |
if ($args->{'caller'} eq 'navmapsdisplay') { |
if (($args->{'caller'} eq 'navmapsdisplay') && (!$args->{'notools'})) { |
&add_linkitem($args->{'linkitems'},'clearbubbles', |
&add_linkitem($args->{'linkitems'},'clearbubbles', |
'document.clearbubbles.submit()', |
'document.clearbubbles.submit()', |
'Mark all posts read'); |
'Mark all posts read'); |
Line 1503 END
|
Line 1509 END
|
} |
} |
} |
} |
$result.='</form>'; |
$result.='</form>'; |
if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) { |
} |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
if (($args->{'caller'} eq 'navmapsdisplay') && |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
(&Apache::lonnet::allowed('mdc',$env{'request.course.id'}))) { |
if ($env{'course.'.$env{'request.course.id'}.'.url'} eq |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
"uploaded/$cdom/$cnum/default.sequence") { |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
&add_linkitem($args->{'linkitems'},'edittoplevel', |
if ($env{'course.'.$env{'request.course.id'}.'.url'} eq |
"javascript:gocmd('/adm/coursedocs','direct');", |
"uploaded/$cdom/$cnum/default.sequence") { |
'Content Editor'); |
&add_linkitem($args->{'linkitems'},'edittoplevel', |
} |
"javascript:gocmd('/adm/coursedocs','editdocs');", |
|
'Content Editor'); |
} |
} |
} |
} |
|
|
Line 1855 sub add_linkitem {
|
Line 1862 sub add_linkitem {
|
|
|
sub show_linkitems_toolbar { |
sub show_linkitems_toolbar { |
my ($args,$condition) = @_; |
my ($args,$condition) = @_; |
my $result = |
my $result; |
'<table><tr><td>'. |
|
&Apache::loncommon::help_open_menu('Navigation Screen','Navigation_Screen',undef,'RAT'). |
|
'</td>'. |
|
'<td> </td>'. |
|
'<td class="LC_middle">'.&mt('Tools:').'</td>'; |
|
if (ref($args) eq 'HASH') { |
if (ref($args) eq 'HASH') { |
if (ref($args->{'linkitems'}) eq 'HASH') { |
if (ref($args->{'linkitems'}) eq 'HASH') { |
|
my $numlinks = scalar(keys(%{$args->{'linkitems'}})); |
|
if ($numlinks > 1) { |
|
$result = '<td>'. |
|
&Apache::loncommon::help_open_menu('Navigation Screen','Navigation_Screen', |
|
undef,'RAT'). |
|
'</td>'. |
|
'<td> </td>'. |
|
'<td class="LC_middle">'.&mt('Tools:').'</td>'; |
|
} |
|
$result .= '<td align="left">'."\n". |
|
'<span class="LC_nobreak">'."\n". |
|
'<ul id="LC_toolbar">'; |
my @linkorder = ('firsthomework','everything','uncompleted', |
my @linkorder = ('firsthomework','everything','uncompleted', |
'changefolder','clearbubbles','edittoplevel'); |
'changefolder','clearbubbles','edittoplevel'); |
$result .='<td align="left">'."\n". |
|
'<span class="LC_nobreak">'."\n". |
|
'<ul id="LC_toolbar">'; |
|
foreach my $link (@linkorder) { |
foreach my $link (@linkorder) { |
my $link_id = 'LC_content_toolbar_'.$link; |
|
if (ref($args->{'linkitems'}{$link}) eq 'HASH') { |
if (ref($args->{'linkitems'}{$link}) eq 'HASH') { |
if ($args->{'linkitems'}{$link}{'text'} ne '') { |
if ($args->{'linkitems'}{$link}{'text'} ne '') { |
$args->{'linkitems'}{$link}{'cmd'}=~s/"/'/g; |
$args->{'linkitems'}{$link}{'cmd'}=~s/"/'/g; |
if ($args->{'linkitems'}{$link}{'cmd'}) { |
if ($args->{'linkitems'}{$link}{'cmd'}) { |
|
my $link_id = 'LC_content_toolbar_'.$link; |
if ($link eq 'changefolder') { |
if ($link eq 'changefolder') { |
if ($condition) { |
if ($condition) { |
$link_id='LC_content_toolbar_changefolder_toggled'; |
$link_id='LC_content_toolbar_changefolder_toggled'; |
Line 1892 sub show_linkitems_toolbar {
|
Line 1903 sub show_linkitems_toolbar {
|
} |
} |
} |
} |
$result .= '</ul>'. |
$result .= '</ul>'. |
'</span></td>'."\n"; |
'</span></td>'; |
|
if (($numlinks==1) && (exists($args->{'linkitems'}{'edittoplevel'}))) { |
|
$result .= '<td><a href="'.$args->{'linkitems'}{'edittoplevel'}{'cmd'}.'">'. |
|
&mt('Content Editor').'</a></td>'; |
|
} |
} |
} |
if ($args->{'sort_html'}) { |
if ($args->{'sort_html'}) { |
$result .= '<td> </td><td> </td><td> </td>'. |
$result .= '<td> </td><td> </td><td> </td>'. |
'<td align="right">'.$args->{'sort_html'}.'</td>'; |
'<td align="right">'.$args->{'sort_html'}.'</td>'; |
} |
} |
} |
} |
$result .= '</tr></table>'; |
if ($result) { |
|
$result = "<table><tr>$result</tr></table>"; |
|
} |
return $result; |
return $result; |
} |
} |
|
|
|
|
1; |
1; |
|
|
|
|
Line 3598 sub new {
|
Line 3614 sub new {
|
$self->{NAV_MAP}->{RESOURCE_CACHE}->{$self->{ID}} = $self; |
$self->{NAV_MAP}->{RESOURCE_CACHE}->{$self->{ID}} = $self; |
$self->{RESOURCE_ERROR} = 0; |
$self->{RESOURCE_ERROR} = 0; |
|
|
|
$self->{DUEDATE_CACHE} = undef; |
|
|
# A hash that can be used by two-pass algorithms to store data |
# A hash that can be used by two-pass algorithms to store data |
# about this resource in. Not used by the resource object |
# about this resource in. Not used by the resource object |
# directly. |
# directly. |
Line 4236 sub checkedin {
|
Line 4254 sub checkedin {
|
|
|
sub duedate { |
sub duedate { |
(my $self, my $part) = @_; |
(my $self, my $part) = @_; |
|
if (defined ($self->{DUEDATE_CACHE}->{$part})) { |
|
return $self->{DUEDATE_CACHE}->{$part}; |
|
} |
my $date; |
my $date; |
my @interval=$self->parmval("interval", $part); |
my @interval=$self->parmval("interval", $part); |
my $due_date=$self->parmval("duedate", $part); |
my $due_date=$self->parmval("duedate", $part); |
Line 4252 sub duedate {
|
Line 4273 sub duedate {
|
} else { |
} else { |
$date = $due_date; |
$date = $due_date; |
} |
} |
|
$self->{DUEDATE_CACHE}->{$part} = $date; |
return $date; |
return $date; |
} |
} |
sub handgrade { |
sub handgrade { |