--- loncom/interface/lonnavmaps.pm 2011/10/21 10:13:57 1.465
+++ loncom/interface/lonnavmaps.pm 2012/05/07 19:43:44 1.484
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.465 2011/10/21 10:13:57 foxr Exp $
+# $Id: lonnavmaps.pm,v 1.484 2012/05/07 19:43:44 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
@@ -464,7 +464,7 @@ returns 4
=item add_linkitem()
-=item show_linkitems()
+=item show_linkitems_toolbar()
=back
@@ -487,7 +487,7 @@ use DateTime();
# For debugging
-use Data::Dumper;
+# use Data::Dumper;
# symbolic constants
@@ -542,9 +542,6 @@ my %colormap =
# is not yet done and due in less than 24 hours
my $hurryUpColor = "#FF0000";
-my $future_slots_checked = 0;
-my $future_slots = 0;
-
sub addToFilter {
my $hashIn = shift;
my $addition = shift;
@@ -618,7 +615,7 @@ sub getDescription {
return &Apache::lonhtmlcommon::direct_parm_link(&mt("Not currently assigned.",$res->symb(),'opendate'),$part);
}
if ($status == $res->OPEN_LATER) {
- return &mt("Open [_1]",&Apache::lonhtmlcommon::direct_parm_link(&timeToHumanString($open,'start')),$res->symb(),'opendate',$part);
+ return &mt("Open [_1]",&Apache::lonhtmlcommon::direct_parm_link(&timeToHumanString($open,'start'),$res->symb(),'opendate',$part));
}
if ($res->simpleStatus($part) == $res->OPEN) {
unless (&Apache::lonnet::allowed('mgr',$env{'request.course.id'})) {
@@ -635,10 +632,10 @@ sub getDescription {
return &mt('Reserved - next open [_1]',
timeToHumanString($slot_time,'start'));
} elsif ($slot_status == $res->RESERVABLE) {
- return &mt('Reservable ending [_1]',
+ return &mt('Reservable, reservations close [_1]',
timeToHumanString($slot_time,'end'));
} elsif ($slot_status == $res->RESERVABLE_LATER) {
- return &mt('Reservable starting [_1]',
+ return &mt('Reservable, reservations open [_1]',
timeToHumanString($slot_time,'start'));
} elsif ($slot_status == $res->NOT_IN_A_SLOT) {
return &mt('Reserve a time/place to work');
@@ -652,22 +649,22 @@ sub getDescription {
if ($status == $res->OPEN) {
if ($due) {
if ($res->is_practice()) {
- return &mt("Closes [_1]",&Apache::lonhtmlcommon::direct_parm_link(&timeToHumanString($due,'start')),$res->symb(),'duedate',$part);
+ return &mt("Closes [_1]",&Apache::lonhtmlcommon::direct_parm_link(&timeToHumanString($due,'start'),$res->symb(),'duedate',$part));
} else {
- return &mt("Due [_1]",&Apache::lonhtmlcommon::direct_parm_link(&timeToHumanString($due,'end')),$res->symb(),'duedate',$part);
+ return &mt("Due [_1]",&Apache::lonhtmlcommon::direct_parm_link(&timeToHumanString($due,'end'),$res->symb(),'duedate',$part));
}
} else {
return &Apache::lonhtmlcommon::direct_parm_link(&mt("Open, no due date"),$res->symb(),'duedate',$part);
}
}
if ($status == $res->PAST_DUE_ANSWER_LATER) {
- return &mt("Answer open [_1]",&Apache::lonhtmlcommon::direct_parm_link(&timeToHumanString($answer,'start')),$res->symb(),'answerdate',$part);
+ return &mt("Answer open [_1]",&Apache::lonhtmlcommon::direct_parm_link(&timeToHumanString($answer,'start'),$res->symb(),'answerdate',$part));
}
if ($status == $res->PAST_DUE_NO_ANSWER) {
if ($res->is_practice()) {
- return &mt("Closed [_1]",&Apache::lonhtmlcommon::direct_parm_link(&timeToHumanString($due,'start')),$res->symb(),'answerdate,duedate',$part);
+ return &mt("Closed [_1]",&Apache::lonhtmlcommon::direct_parm_link(&timeToHumanString($due,'start'),$res->symb(),'answerdate,duedate',$part));
} else {
- return &mt("Was due [_1]",&Apache::lonhtmlcommon::direct_parm_link(&timeToHumanString($due,'end')),$res->symb(),'answerdate,duedate',$part);
+ return &mt("Was due [_1]",&Apache::lonhtmlcommon::direct_parm_link(&timeToHumanString($due,'end'),$res->symb(),'answerdate,duedate',$part));
}
}
if (($status == $res->ANSWER_OPEN || $status == $res->PARTIALLY_CORRECT)
@@ -700,7 +697,7 @@ sub getDescription {
}
}
if ($due) {
- return &mt("Due [_1]",&Apache::lonhtmlcommon::direct_parm_link(&timeToHumanString($due,'end')),$res->symb(),'duedate',$part) .
+ return &mt("Due [_1]",&Apache::lonhtmlcommon::direct_parm_link(&timeToHumanString($due,'end'),$res->symb(),'duedate',$part)) .
" $triesString";
} else {
return &Apache::lonhtmlcommon::direct_parm_link(&mt("No due date"),$res->symb(),'duedate',$part)." $triesString";
@@ -899,6 +896,7 @@ sub part_status_summary { return 4; }
sub render_resource {
my ($resource, $part, $params) = @_;
+ my $editmapLink;
my $nonLinkedText = ''; # stuff after resource title not in link
my $link = $params->{"resourceLink"};
@@ -980,6 +978,14 @@ sub render_resource {
$linkopen = "";
$linkclose = "";
}
+ if ((&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) &&
+ ($resource->symb=~/\_\_\_[^\_]+\_\_\_uploaded/)) {
+ my $icon = &Apache::loncommon::lonhttpdurl('/res/adm/pages').'/editmap.png';
+ $editmapLink=' '.
+ ''.
+ ''.
+ '';
+ }
}
if ($resource->randomout()) {
@@ -1013,8 +1019,10 @@ sub render_resource {
# Is this the current resource?
if (!$params->{'displayedHereMarker'} &&
$resource->symb() eq $params->{'here'} ) {
- $curMarkerBegin = '';
- $curMarkerEnd = '';
+ unless ($resource->is_map()) {
+ $curMarkerBegin = '';
+ $curMarkerEnd = '';
+ }
$params->{'displayedHereMarker'} = 1;
}
@@ -1033,7 +1041,7 @@ sub render_resource {
if (!$params->{'resource_nolink'} && !$resource->is_sequence() && !$resource->is_empty_sequence) {
$result .= "$curMarkerBegin$title$partLabel$curMarkerEnd$nonLinkedText";
} else {
- $result .= "$curMarkerBegin$linkopen$title$partLabel$curMarkerEnd$nonLinkedText";
+ $result .= "$curMarkerBegin$linkopen$title$partLabel$curMarkerEnd$editmapLink$nonLinkedText";
}
return $result;
@@ -1047,6 +1055,7 @@ sub render_communication_status {
my $linkopen = "";
my $linkclose = "";
my $location=&Apache::loncommon::lonhttpdurl("/adm/lonMisc");
+
if ($resource->hasDiscussion()) {
$discussionHTML = $linkopen .
'
' .
@@ -1456,8 +1465,10 @@ sub render {
$link .= '®ister='.$env{'form.register'};
}
if ($args->{'caller'} eq 'navmapsdisplay') {
- &add_linkitem($args->{'linkitems'},'changefolder',
- "location.href='$link'",$text);
+ unless ($args->{'notools'}) {
+ &add_linkitem($args->{'linkitems'},'changefolder',
+ "location.href='$link'",$text);
+ }
} else {
$result.= ''.&mt($text).'';
}
@@ -1465,7 +1476,7 @@ sub render {
}
# 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',
'document.clearbubbles.submit()',
'Mark all posts read');
@@ -1498,18 +1509,20 @@ END
}
$result.='';
}
+ if (($args->{'caller'} eq 'navmapsdisplay') &&
+ (&Apache::lonnet::allowed('mdc',$env{'request.course.id'}))) {
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+ if ($env{'course.'.$env{'request.course.id'}.'.url'} eq
+ "uploaded/$cdom/$cnum/default.sequence") {
+ &add_linkitem($args->{'linkitems'},'edittoplevel',
+ "javascript:gocmd('/adm/coursedocs','editdocs');",
+ 'Content Editor');
+ }
+ }
if ($args->{'caller'} eq 'navmapsdisplay') {
- $result .= '
'. - &Apache::loncommon::help_open_menu('Navigation Screen','Navigation_Screen',undef,'RAT').' | '; - $result .= ''; - $result.=' | '.&mt('Tools:').' | '; - $result.=&show_linkitems_toolbar($args->{'linkitems'}); - if ($args->{'sort_html'}) { - $result.=''. - ' | '.$args->{'sort_html'}.' |