[LON-CAPA-cvs] cvs: loncom /interface lonmenu.pm lonwishlist.pm rat lonratedt.pm lonratmenu.pm
wenzelju
wenzelju@source.lon-capa.org
Fri, 20 Aug 2010 08:13:41 -0000
This is a MIME encoded message
--wenzelju1282292021
Content-Type: text/plain
wenzelju Fri Aug 20 08:13:41 2010 EDT
Modified files:
/rat lonratmenu.pm lonratedt.pm
/loncom/interface lonmenu.pm lonwishlist.pm
Log:
Added wishlist-import in RAT.
--wenzelju1282292021
Content-Type: text/plain
Content-Disposition: attachment; filename="wenzelju-20100820081341.txt"
Index: rat/lonratmenu.pm
diff -u rat/lonratmenu.pm:1.15 rat/lonratmenu.pm:1.16
--- rat/lonratmenu.pm:1.15 Fri Dec 4 15:13:04 2009
+++ rat/lonratmenu.pm Fri Aug 20 08:13:38 2010
@@ -2,7 +2,7 @@
# Build menu bar for Advanced RAT. Uses javascript code originally in
# static file: rat/client/code.html, now in rat/client/ratcode.js
#
-# $Id: lonratmenu.pm,v 1.15 2009/12/04 15:13:04 bisitz Exp $
+# $Id: lonratmenu.pm,v 1.16 2010/08/20 08:13:38 wenzelju Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -111,6 +111,9 @@
'<a href="javascript:bookmarkopen();">'
.&mt('Import Bookmarks').'</a>')
.&Apache::lonhtmlcommon::add_item_funclist(
+ '<a href="javascript:open_Wishlist_Import('."'advanced'".');">'
+ .&mt('Import from Wishlist').'</a>')
+ .&Apache::lonhtmlcommon::add_item_funclist(
'<a href="javascript:groupcopy();">'
.&mt('Copy').'</a>')
.&Apache::lonhtmlcommon::end_funclist();
Index: rat/lonratedt.pm
diff -u rat/lonratedt.pm:1.99 rat/lonratedt.pm:1.100
--- rat/lonratedt.pm:1.99 Wed Mar 10 21:26:15 2010
+++ rat/lonratedt.pm Fri Aug 20 08:13:38 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Edit Handler for RAT Maps
#
-# $Id: lonratedt.pm,v 1.99 2010/03/10 21:26:15 droeschl Exp $
+# $Id: lonratedt.pm,v 1.100 2010/08/20 08:13:38 wenzelju Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -492,6 +492,7 @@
'se' => 'Search',
'im' => 'Import',
'bk' => 'Import Bookmarks',
+ 'wl' => 'Import from Wishlist',
'vi' => 'View',
'lm' => 'Load Map',
'ds' => 'Discard Selected',
@@ -603,6 +604,8 @@
<input type="button" onClick=
"javascript:impfortarget.value=1;groupopen(0,1,1);" value="$lt{'bk'}" />
<input type="button" onClick=
+"javascript:impfortarget.value=1;open_Wishlist_Import('simple');" value="$lt{'wl'}" />
+<input type="button" onClick=
"javascript:impfortarget.value=1;groupopen('$url',1,0);" value="$lt{'reco'}" />
$lt{'as'}
<hr />
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.334 loncom/interface/lonmenu.pm:1.335
--- loncom/interface/lonmenu.pm:1.334 Mon Aug 16 08:58:39 2010
+++ loncom/interface/lonmenu.pm Fri Aug 20 08:13:41 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.334 2010/08/16 08:58:39 wenzelju Exp $
+# $Id: lonmenu.pm,v 1.335 2010/08/20 08:13:41 wenzelju Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1328,9 +1328,16 @@
wishlistlink.document.close();
}
-function open_Wishlist_Import() {
- var newWin = window.open('/adm/wishlist?inhibitmenu=yes&mode=import',
+function open_Wishlist_Import(rat) {
+ var newWin;
+ if (rat) {
+ newWin = window.open('/adm/wishlist?inhibitmenu=yes&mode=import&rat='+rat,
'wishlistImport','scrollbars=1,resizable=1,menubar=0');
+ }
+ else {
+ newWin = window.open('/adm/wishlist?inhibitmenu=yes&mode=import',
+ 'wishlistImport','scrollbars=1,resizable=1,menubar=0');
+ }
newWin.focus();
}
Index: loncom/interface/lonwishlist.pm
diff -u loncom/interface/lonwishlist.pm:1.5 loncom/interface/lonwishlist.pm:1.6
--- loncom/interface/lonwishlist.pm:1.5 Tue Aug 17 12:32:58 2010
+++ loncom/interface/lonwishlist.pm Fri Aug 20 08:13:41 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the wishlist
#
-# $Id: lonwishlist.pm,v 1.5 2010/08/17 12:32:58 wenzelju Exp $
+# $Id: lonwishlist.pm,v 1.6 2010/08/20 08:13:41 wenzelju Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1066,20 +1066,6 @@
newWin.focus();
}
- function finish_import() {
- opener.document.forms.simpleedit.importdetail.value='';
- for (var num = 0; num < document.forms.groupsort.fnum.value; num++) {
- if (eval("document.forms.groupsort.check"+num+".checked") && eval("document.forms.groupsort.filelink"+num+".value") != '') {
- opener.document.forms.simpleedit.importdetail.value+='&'+
- eval("document.forms.groupsort.title"+num+".value")+'='+
- eval("document.forms.groupsort.filelink"+num+".value")+'='+
- eval("document.forms.groupsort.id"+num+".value");
- }
- }
- opener.document.forms.simpleedit.submit();
- self.close();
- }
-
function checkAll() {
var checkboxes = document.getElementsByName('check');
for (var i = 0; i < checkboxes.length; i++) {
@@ -1098,6 +1084,68 @@
return $js;
}
+sub JSforImport{
+ my $rat = shift;
+
+ my $js;
+ if ($rat eq 'simple' || $rat eq '') {
+ $js = &Apache::lonhtmlcommon::scripttag(<<JAVASCRIPT);
+ function finish_import() {
+ opener.document.forms.simpleedit.importdetail.value='';
+ for (var num = 0; num < document.forms.groupsort.fnum.value; num++) {
+ if (eval("document.forms.groupsort.check"+num+".checked") && eval("document.forms.groupsort.filelink"+num+".value") != '') {
+ opener.document.forms.simpleedit.importdetail.value+='&'+
+ eval("document.forms.groupsort.title"+num+".value")+'='+
+ eval("document.forms.groupsort.filelink"+num+".value")+'='+
+ eval("document.forms.groupsort.id"+num+".value");
+ }
+ }
+ opener.document.forms.simpleedit.submit();
+ self.close();
+ }
+JAVASCRIPT
+ }
+ else {
+ $js = &Apache::lonhtmlcommon::scripttag(<<JAVASCRIPT);
+ function finish_import() {
+ var linkflag=false;
+ for (var num=0; num<document.forms.groupsort.fnum.value; num++) {
+ if (eval("document.forms.groupsort.check"+num+".checked") && eval("document.forms.groupsort.filelink"+num+".value") != '') {
+ insertRowInLastRow();
+ placeResourceInLastRow(
+ eval("document.forms.groupsort.title"+num+".value"),
+ eval("document.forms.groupsort.filelink"+num+".value"),
+ eval("document.forms.groupsort.id"+num+".value"),
+ linkflag
+ );
+ linkflag=true;
+ }
+ }
+ opener.editmode=0;
+ opener.notclear=0;
+ opener.linkmode=0;
+ opener.draw();
+ self.close();
+ }
+
+ function insertRowInLastRow() {
+ opener.insertrow(opener.maxrow);
+ opener.addobj(opener.maxrow,'e&2');
+ }
+
+ function placeResourceInLastRow (title,url,id,linkflag) {
+ opener.mostrecent=opener.newresource(opener.maxrow,2,opener.unescape(title),
+ opener.unescape(url),'false','normal',id);
+ opener.save();
+ if (linkflag) {
+ opener.joinres(opener.linkmode,opener.mostrecent,0);
+ }
+ opener.linkmode=opener.mostrecent;
+ }
+JAVASCRIPT
+ }
+ return $js;
+}
# HTML-Markup for table if in view-mode
my $wishlistHTMLview;
@@ -1599,18 +1647,26 @@
# Returns the HTML-Markup for the page, shown when links should be imported into a course
sub makePageImport {
+ my $rat = shift;
# start_page
my $startPage = &Apache::loncommon::start_page('Wishlist',undef,
{'only_body' => 1});
# get javascript-code for wishlist-interactions
my $js = &JSforWishlist();
+ $js .= &JSforImport($rat);
my $inner = '<h1>'.&mt('Import Resources from Wishlist').'</h1>';
- $inner .= '<p><span class="LC_info">'.&mt("Please note that you can use the checkboxes corresponding to a folder to ".
- "easily check all links within this folder. The folder structure itself can't be imported. ".
- "All checked links will be imported into the current folder of your course.").'</span></p>';
-
+ if (!$rat) {
+ $inner .= '<p><span class="LC_info">'.&mt("Please note that you can use the checkboxes corresponding to a folder to ".
+ "easily check all links within this folder. The folder structure itself can't be imported. ".
+ "All checked links will be imported into the current folder of your course.").'</span></p>';
+ }
+ else {
+ $inner .= '<p><span class="LC_info">'.&mt("Please note that you can use the checkboxes corresponding to a folder to ".
+ "easily check all links within this folder. The folder structure itself can't be imported. ")
+ .'</span></p>';
+ }
my %wishlist = &getWishlist();
my $fnum = (keys %wishlist)-1;
@@ -1688,7 +1744,7 @@
}
# get unprocessed_cgi (i.e. marked entries, mode ...)
- &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['action','mark','markedToMove','mode','newtitle','note']);
+ &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['action','mark','markedToMove','mode','newtitle','note','rat']);
# change the order of entries within a level, that means sorting the entries
my $changeOrder = 0;
@@ -1775,7 +1831,7 @@
$page = &makePage("move", \@marked);
}
elsif ($env{'form.mode'} eq 'import') {
- $page = &makePageImport();
+ $page = &makePageImport($env{'form.rat'});
}
elsif ($env{'form.mode'} eq 'set') {
$page = &makePageSet();
--wenzelju1282292021--