--- loncom/interface/lonwishlist.pm 2011/01/27 14:38:44 1.9 +++ loncom/interface/lonwishlist.pm 2011/02/15 14:54:51 1.10 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Utility-routines for wishlist # -# $Id: lonwishlist.pm,v 1.9 2011/01/27 14:38:44 wenzelju Exp $ +# $Id: lonwishlist.pm,v 1.10 2011/02/15 14:54:51 wenzelju Exp $ # # Copyright Michigan State University Board of Trustees # @@ -478,6 +478,16 @@ sub getNodesToArray { Calls &wishlistView(nodes), &wishlistEdit(nodes) or &wishlistMove(nodes, marked). +=item * &makePopUpNewLink(title, path) + + Returns the HTML-markup for the pop-up-window 'Add Link'. If this is called up from a browsed resource, the input-fields titel and path are pre-filled with the resources' meta-data-title and it's path. + + +=item * &makePopUpNewFolder() + + Returns the HTML-markup for the pop-up-window 'Add Folder'. + + =item * &makePageSet() Returns the HTML-Markup for the page shown when a link was set by using the icon when viewing a resource. @@ -511,65 +521,6 @@ sub JSforWishlist { &getFoldersToArray(\@childrenRt); &getFoldersForOption(\@childrenRt); - # texthash - my %lt = &Apache::lonlocal::texthash( - 'nl' => 'New Link', - 'nf' => 'New Folder', - 'lt' => 'Link Title', - 'ft' => 'Folder Title', - 'pa' => 'Path', - 'nt' => 'Note', - 'si' => 'Save in', - 'cl' => 'Cancel'); - - - my $inPageNewLink = '

'.$lt{'nl'}.'

'. - '
'. - &Apache::lonhtmlcommon::start_pick_box(). - &Apache::lonhtmlcommon::row_title($lt{'lt'}). - ''. - &Apache::lonhtmlcommon::row_closure(). - &Apache::lonhtmlcommon::row_title($lt{'pa'}). - ''. - &Apache::lonhtmlcommon::row_closure(). - &Apache::lonhtmlcommon::row_title($lt{'nt'}). - ''. - &Apache::lonhtmlcommon::row_closure(1). - &Apache::lonhtmlcommon::end_pick_box(). - '

'. - ''. - ''. - ''. - '
'; - - my $inPageNewFolder = '

'.$lt{'nf'}.'

'. - '
'. - &Apache::lonhtmlcommon::start_pick_box(). - &Apache::lonhtmlcommon::row_title($lt{'ft'}). - '
'. - &Apache::lonhtmlcommon::row_closure(). - &Apache::lonhtmlcommon::row_title($lt{'nt'}). - '
'. - &Apache::lonhtmlcommon::row_closure(1). - &Apache::lonhtmlcommon::end_pick_box(). - '

'. - ''. - ''. - ''. - '
'; - - # Remove all \n for inserting on javascript document.write - $inPageNewLink =~ s/\n//g; - $inPageNewFolder =~ s/\n//g; - # it is checked, wether a path links to a LON-CAPA-resource or an external website. links to course-contents are not allowed # because they probably will return a kind of 'no access' (unless the user is already in the course, the path links to). # also importing these kind of links into a course does not make much sense. @@ -591,49 +542,11 @@ sub JSforWishlist { my $js = &Apache::lonhtmlcommon::scripttag(<' - +'function newlinksubmit(){' - +'var path = document.getElementsByName("path")[0].value;' - +'var title = document.getElementsByName("title")[0].value;' - +'if (!path || !title) {' - +'alert("$warningLink");' - +'return false;}' - +'var linkOK = (path.match(/^http:(\\\\/\\\\/)/) || path.match(/^https:(\\\\/\\\\/)/))' - +'&& !(path.match(/\\.problem/) || path.match(/\\.exam/)' - +'|| path.match(/\\.quiz/) || path.match(/\\.assess/)' - +'|| path.match(/\\.survey/) || path.match(/\\.form/)' - +'|| path.match(/\\.library/) || path.match(/\\.page/)' - +'|| path.match(/\\.sequence/));' - +'if (!path.match(/^(\\\\/res\\\\/)/) && !linkOK) {' - +'alert("$warningLinkNotAllowed1");' - +'return false;}' - +'else {' - +'window.close();' - +'return true;}}' - +'<\/scr'+'ipt>' - +'$inPageNewLink' - +'$endPagePopup'); - newlinkWin.document.close(); + newlinkWin=window.open('/adm/wishlist?mode=newLink','newlinkWin','width=580,height=350, scrollbars=yes'); } function newFolder() { - newfolderWin=window.open('','newfolderWin','width=580,height=270, scrollbars=yes'); - newfolderWin.document.write('$startPagePopup' - +'