--- loncom/interface/loncourserespicker.pm 2016/10/16 21:49:51 1.14
+++ loncom/interface/loncourserespicker.pm 2018/01/12 13:33:38 1.15
@@ -1,6 +1,6 @@
# The LearningOnline Network
#
-# $Id: loncourserespicker.pm,v 1.14 2016/10/16 21:49:51 raeburn Exp $
+# $Id: loncourserespicker.pm,v 1.15 2018/01/12 13:33:38 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -39,6 +39,7 @@ resources are to be either:
(a) exported to an IMS Content Package
(b) subject to access blocking for the duriation of an exam/quiz.
(c) dumped to an Authoring Space
+(d) receive shortened URLs to be used when deep-linking into a course
=head1 DESCRIPTION
@@ -80,7 +81,8 @@ Inputs: 11.
(encapsulates information about resources in the course).
- $context -- Context in which course resource selection is being made.
- Currently imsexport and examblock are supported.
+ Currently imsexport, examblock, dumpdocs, and shorturls
+ are supported.
- $formname -- Name of the form in the window from which the pop-up
used to select course items was launched.
@@ -106,10 +108,13 @@ Inputs: 11.
- $uploadedfiles -- Reference to hash: keys are paths to files in
/home/httpd/lonUsers/$cdom/$1/$2/$3/$cnum/userfiles.
-
+
+ - $tiny -- Reference to hash: keys are symbs of course items for which
+ shortened URLs have already been created.
+
- $readonly -- if true, no "check all" or "uncheck all" buttons will
be displayed, and checkboxes will be disabled, if this
- is for an exam block.
+ is for an exam block or for shortened URL creation.
Output: $output is the HTML mark-up for display/selection of content
@@ -211,9 +216,14 @@ use LONCAPA qw(:DEFAULT :match);
sub create_picker {
my ($navmap,$context,$formname,$crstype,$blockedmaps,$blockedresources,$block,$preamble,
- $numhome,$uploadedfiles,$readonly) = @_;
+ $numhome,$uploadedfiles,$tiny,$readonly) = @_;
return unless (ref($navmap));
- my ($it,$output,$numdisc,%maps,%resources,%discussiontime,%currmaps,%currresources,%files);
+ my ($it,$output,$numdisc,%maps,%resources,%discussiontime,%currmaps,%currresources,%files,
+ %shorturls,$chkname);
+ $chkname = 'archive';
+ if ($context eq 'shorturls') {
+ $chkname = 'addtiny';
+ }
$it = $navmap->getIterator(undef,undef,undef,1,undef,undef);
if (ref($blockedmaps) eq 'HASH') {
%currmaps = %{$blockedmaps};
@@ -222,6 +232,8 @@ sub create_picker {
%currresources = %{$blockedresources};
} elsif (ref($uploadedfiles) eq 'HASH') {
%files = %{$uploadedfiles};
+ } elsif (ref($tiny) eq 'HASH') {
+ %shorturls = %{$tiny};
}
my @checked_maps;
my $curRes;
@@ -256,7 +268,11 @@ sub create_picker {
&mt('Choose the uploaded course items and templated pages/problems to be copied to Authoring Space.').
'
';
$startcount = 3 + $numhome;
- $onsubmit = ' onsubmit="return checkUnique(document.'.$formname.',document.'.$formname.'.archive);"';
+ $onsubmit = ' onsubmit="return checkUnique(document.'.$formname.',document.'.$formname.'.'.$chkname.');"';
+ } elsif ($context eq 'shorturls') {
+ $info = ''.
+ &mt('Choose the resource(s) and/or folder(s) from Main Content for which shortened URL(s) are needed.').
+ '
';
} elsif ($context eq 'imsexport') {
$info = &mt('Choose which items you wish to export from your '.$crstype.'.');
$startcount = 5;
@@ -265,9 +281,9 @@ sub create_picker {
$togglebuttons = '
';
} else {
$togglebuttons = ''.
+ 'onclick="javascript:checkAll(document.'.$formname.'.'.$chkname.')" />'.
' ';
+ ' onclick="javascript:uncheckAll(document.'.$formname.'.'.$chkname.')" />';
}
$display = '