[LON-CAPA-cvs] cvs: loncom /homework inputtags.pm
raeburn
raeburn at source.lon-capa.org
Mon Aug 19 20:46:36 EDT 2013
raeburn Tue Aug 20 00:46:36 2013 EDT
Modified files:
/loncom/homework inputtags.pm
Log:
- Currently submitted files for dropboxes.
- Show/Hide link toggles display of path for items uploaded from portfolio.
- default is to show only file name.
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.319 loncom/homework/inputtags.pm:1.320
--- loncom/homework/inputtags.pm:1.319 Wed Jul 24 18:21:42 2013
+++ loncom/homework/inputtags.pm Tue Aug 20 00:46:35 2013
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# input definitons
#
-# $Id: inputtags.pm,v 1.319 2013/07/24 18:21:42 bisitz Exp $
+# $Id: inputtags.pm,v 1.320 2013/08/20 00:46:35 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -691,7 +691,8 @@
my $uploadedfile=$Apache::lonhomework::history{"resource.$part.$id.uploadedfile"};
my $portfiles=$Apache::lonhomework::history{"resource.$part.$id.portfiles"};
return if (($uploadedfile eq '') && ($portfiles !~/[^\s]/));
- my $header = &Apache::loncommon::start_data_table().
+ my $header = &portpath_popup_js().
+ &Apache::loncommon::start_data_table().
&Apache::loncommon::start_data_table_header_row();
if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
$header .= '<th>'.&mt('Delete?').'</th>';
@@ -757,13 +758,24 @@
' value="'.$portfile.'" id="HWFILE'.$jspart.'_'.$id.'_'.$num.'_delete" /></td>'."\n";
$num ++;
}
- my $showname = $rows{$url}{path}.$name;
+ my $pathid = 'HWFILE'.$jspart.'_'.$id.'_'.$num.'_path';
+ my $pathidtext = $pathid.'text';
+ my ($showname,$showpath);
if ($legacy{$url}) {
$showname = $name.' '.&mt('not in portfolio');
+ } else {
+ $showname = $name;
+ $showpath = '<br />'.
+ '<span id="'.$pathidtext.'" class="LC_cusr_subheading">'.
+ '<a href="javascript:showPortPath('."'$pathid','$pathidtext'".');" '.
+ 'class="LC_menubuttons_link">'.
+ &mt('(Show path)').'</a></span>'.
+ '<div id="'.$pathid.'" class="LC_dccid">'.$rows{$url}{path}.$name.
+'</div>';
}
$result .=
'<td><a href="'.$link.'"><img src="'.$icon.
- '" border="0" alt="" />'.$showname.'</a></td>'."\n".
+ '" border="0" alt="" />'.$showname.'</a>'.$showpath.'</td>'."\n".
'<td align="right" valign="bottom">'.$rows{$url}{size}.'</td>'."\n".
'<td align="right" valign="bottom">'.$rows{$url}{lastmodified}.'</td>'."\n".
&Apache::loncommon::end_data_table_row();
@@ -818,6 +830,43 @@
return ($status,\%info,$error);
}
+sub portpath_popup_js {
+ my %lt = &Apache::lonlocal::texthash(
+ show => '(Show path)',
+ hide => '(Hide)',
+ );
+ return <<"END";
+<script type="text/javascript">
+// <![CDATA[
+
+function showPortPath(id,idtext) {
+ document.getElementById(id).style.display='block';
+ document.getElementById(id).style.textAlign='left';
+ document.getElementById(id).style.textFace='normal';
+ if (document.getElementById(idtext)) {
+ document.getElementById(idtext).innerHTML ='<a href="javascript:hidePortPath(\\''+id+'\\',\\''+idtext+'\\'); '+
+ '"class="LC_menubuttons_link">$lt{'hide'}</a> ';
+ }
+ return;
+}
+
+function hidePortPath(id,idtext) {
+ if (document.getElementById(id)) {
+ document.getElementById(id).style.display='none';
+ }
+ if (document.getElementById(idtext)) {
+ document.getElementById(idtext).innerHTML ='<a href="javascript:showPortPath(\\''+id+'\\',\\''+idtext+'\\');" '+
+ 'class="LC_menubuttons_link">$lt{'show'}</a>';
+ }
+ return;
+}
+
+// ]]>
+</script>
+
+END
+}
+
sub valid_award {
my ($award) =@_;
foreach my $possibleaward ('EXTRA_ANSWER','MISSING_ANSWER', 'ERROR',
More information about the LON-CAPA-cvs
mailing list