version 1.331, 2010/06/14 09:16:33
|
version 1.339, 2010/09/09 19:33:18
|
Line 525 sub innerregister {
|
Line 525 sub innerregister {
|
if ($nocrsedit) { |
if ($nocrsedit) { |
$editbutton=&clear(6,1); |
$editbutton=&clear(6,1); |
} else { |
} else { |
|
my $bot = "go('$cfile')"; |
if ($switchserver) { |
if ($switchserver) { |
if ( $env{'request.symb'} && $env{'request.course.id'} ) { |
if ( $env{'request.symb'} && $env{'request.course.id'} ) { |
my ($mapurl,$rid,$resurl) = &Apache::lonnet::decode_symb(&Apache::lonnet::symbread()); |
$cfile = '/adm/switchserver?otherserver='.$home.'&role='. |
$cfile = '/adm/switchserver?otherserver='.$home.'&role='.$env{'request.role'}.'&symb='.$env{'request.symb'}.'&origurl='.$resurl; |
&HTML::Entities::encode($env{'request.role'},'"<>&').'&symb='. |
|
&HTML::Entities::encode($env{'request.symb'},'"<>&'); |
|
$bot = "need_switchserver('$cfile');"; |
} |
} |
} |
} |
$editbutton=&switch |
$editbutton=&switch |
('','',6,1,'pcstr.png','edit[_1]','resource[_2]', |
('','',6,1,'pcstr.png','edit[_1]','resource[_2]', |
"go('".$cfile."');","Edit this resource"); |
$bot,"Edit this resource"); |
$noeditbutton = 0; |
$noeditbutton = 0; |
} |
} |
} elsif ($editbutton eq '') { |
} elsif ($editbutton eq '') { |
Line 604 c&6&3
|
Line 607 c&6&3
|
c&8&1 |
c&8&1 |
c&8&2 |
c&8&2 |
s&8&3&prt.png&prepare[_1]&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document |
s&8&3&prt.png&prepare[_1]&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document |
s&9&1&sbkm.png&set[_1]&bookmark[_2]&set_bookmark()&Set a bookmark for this resource&&1 |
|
ENDMENUITEMS |
ENDMENUITEMS |
|
if (&Apache::lonnet::allowed('bre', $env{'request.course.id'}) eq 'F' && $env{'request.uri'} =~ /^\/res/) { |
|
# wishlist is only available for users with access to resource-pool |
|
# and links can only be set for resources within the resource-pool |
|
$menuitems .= (<<ENDMENUITEMS); |
|
s&9&1&wishlist-link.png&set[_1]&wishlistlink[_2]&set_wishlistlink()&Set a link for this resource to wishlist&&1 |
|
ENDMENUITEMS |
|
} |
|
|
my $currentURL = &Apache::loncommon::get_symb(); |
my $currentURL = &Apache::loncommon::get_symb(); |
my ($symb_old,$symb_old_enc) = &Apache::loncommon::clean_symb($currentURL); |
my ($symb_old,$symb_old_enc) = &Apache::loncommon::clean_symb($currentURL); |
Line 635 ENDREALRES
|
Line 644 ENDREALRES
|
$menuitems .= (<<ENDMENUITEMS); |
$menuitems .= (<<ENDMENUITEMS); |
s&8&3&prt.png&prepare[_1]&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document |
s&8&3&prt.png&prepare[_1]&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document |
ENDMENUITEMS |
ENDMENUITEMS |
|
if (&Apache::lonnet::allowed('bre', $env{'request.course.id'}) eq 'F') { |
|
# wishlist is only available for users with access to resource-pool |
|
$menuitems .= (<<ENDMENUITEMS); |
|
s&9&1&wishlist-link.png&set[_1]&wishlistlink[_2]&set_wishlistlink()&Set a link for this resource to wishlist&&1 |
|
ENDMENUITEMS |
|
} |
} |
} |
my $buttons=''; |
my $buttons=''; |
foreach (split(/\n/,$menuitems)) { |
foreach (split(/\n/,$menuitems)) { |
Line 1092 sub utilityfunctions {
|
Line 1107 sub utilityfunctions {
|
my $end_page_annotate = |
my $end_page_annotate = |
&Apache::loncommon::end_page({'js_ready' => 1}); |
&Apache::loncommon::end_page({'js_ready' => 1}); |
|
|
my $start_page_bookmark = |
my $confirm_switch = &mt("Editing requires switching to the resource's home server.").'\n'. |
&Apache::loncommon::start_page('Bookmarks',undef, |
&mt('Switch server?'); |
|
|
|
my $start_page_wishlistlink = |
|
&Apache::loncommon::start_page('Set link to wishlist',undef, |
{'only_body' => 1, |
{'only_body' => 1, |
'js_ready' => 1, |
'js_ready' => 1, |
'bgcolor' => '#BBBBBB',}); |
'bgcolor' => '#FFFFFF',}); |
|
|
my $end_page_bookmark = |
my $warningLink = &mt('You must insert a title!'); |
|
|
|
# HTML-Markup for 'Set a link for this resource to wishlist' |
|
# this is written via JavaScript document.write (function set_wishlistlink) |
|
# it is split into 3 parts and the inputfields for title and path are left out |
|
# these fields are inserted later to set the values for title and path |
|
# automatically via JavaScript (document.title and location.pathname) |
|
my %folders = &Apache::lonnet::get('wishlist',['folders']); |
|
if ($folders{'folders'} eq '') { |
|
$folders{'folders'} = '<option value="" selected="selected">('.&mt('Top level').')</option>'; |
|
} |
|
my $in_page_wishlistlink1 = '<h1>'.&mt('Set a link to wishlist').'</h1>'. |
|
'<form method="post" name="newlink" action="/adm/wishlist?mode=set" '. |
|
'onsubmit="return newlinksubmit();" >'. |
|
&Apache::lonhtmlcommon::start_pick_box(). |
|
&Apache::lonhtmlcommon::row_title(&mt('Link Title')); |
|
|
|
my $in_page_wishlistlink2 = &Apache::lonhtmlcommon::row_closure(). |
|
&Apache::lonhtmlcommon::row_title(&mt('Path')); |
|
|
|
my $in_page_wishlistlink3 = &Apache::lonhtmlcommon::row_closure(). |
|
&Apache::lonhtmlcommon::row_title(&mt('Note')). |
|
'<textarea name="note" rows="3" cols="35" style="width:100%"></textarea>'. |
|
&Apache::lonhtmlcommon::row_closure(1). |
|
&Apache::lonhtmlcommon::end_pick_box(). |
|
'<br/><br/>'. |
|
'<input type="submit" value="'.&mt('Save in').'" />'. |
|
'<select name="folders">'. |
|
$folders{'folders'}. |
|
'</select>'. |
|
'<input type="button" value="'.&mt('cancel').'" onclick="javascript:window.close();" />'. |
|
'</form>'; |
|
|
|
# remove all \n for inserting on javascript document.write |
|
$in_page_wishlistlink1 =~ s/\n//g; |
|
$in_page_wishlistlink2 =~ s/\n//g; |
|
$in_page_wishlistlink3 =~ s/\n//g; |
|
|
|
my $end_page_wishlistlink = |
&Apache::loncommon::end_page({'js_ready' => 1}); |
&Apache::loncommon::end_page({'js_ready' => 1}); |
|
|
return (<<ENDUTILITY) |
return (<<ENDUTILITY) |
Line 1117 function go(url) {
|
Line 1173 function go(url) {
|
} |
} |
} |
} |
|
|
|
function need_switchserver(url) { |
|
if (url!='' && url!= null) { |
|
if (confirm("$confirm_switch")) { |
|
go(url); |
|
} |
|
} |
|
return; |
|
} |
|
|
function gopost(url,postdata) { |
function gopost(url,postdata) { |
if (url!='') { |
if (url!='') { |
this.document.server.action=url; |
this.document.server.action=url; |
Line 1202 function group_chat(group) {
|
Line 1267 function group_chat(group) {
|
grpchat=window.open(url,winName,'height=320,width=280,resizable=yes,location=no,menubar=no,toolbar=no'); |
grpchat=window.open(url,winName,'height=320,width=280,resizable=yes,location=no,menubar=no,toolbar=no'); |
} |
} |
|
|
function edit_bookmarks() { |
|
go(''); |
|
w_BookmarkPal_flag=1; |
|
bookmarkpal=window.open("/adm/bookmarks", |
|
"BookmarkPal", "width=500,height=505,scrollbars=0"); |
|
} |
|
|
|
function annotate() { |
function annotate() { |
w_Annotator_flag=1; |
w_Annotator_flag=1; |
annotator=window.open('','Annotator','width=365,height=265,scrollbars=0'); |
annotator=window.open('','Annotator','width=365,height=265,scrollbars=0'); |
Line 1222 function annotate() {
|
Line 1280 function annotate() {
|
annotator.document.close(); |
annotator.document.close(); |
} |
} |
|
|
function set_bookmark() { |
function set_wishlistlink(title, path) { |
go(''); |
if (!title) { |
clienttitle=document.title; |
title=document.title; |
clienthref=location.pathname; |
} |
w_bmquery_flag=1; |
if (!path) { |
bmquery=window.open('','bmquery','width=365,height=165,scrollbars=0'); |
path=location.pathname; |
bmquery.document.write( |
} |
'$start_page_bookmark' |
title = title.replace(/^LON-CAPA /,''); |
+'<center><form method="post"' |
wishlistlink=window.open('','wishlistNewLink','width=560,height=350,scrollbars=0'); |
+' name="newlink" action="/adm/bookmarks" target="bmquery" ' |
wishlistlink.document.write( |
+'> <table width="340" height="150" ' |
'$start_page_wishlistlink' |
+'bgcolor="#FFFFFF" align="center"><tr><td>Link Name:<br /><input ' |
+'<script type="text\/javascript">' |
+'type="text" name="title" size="45" value="'+clienttitle+'" />' |
+'function newlinksubmit(){' |
+'<br />Address:<br /><input type="text" name="address" size="45" ' |
+'var title = document.getElementsByName("title")[0].value;' |
+'value="'+clienthref+'" /><br /><center><input type="submit" ' |
+'if (!title) {' |
+'value="Save" /> <input type="button" value="Close" ' |
+'alert("$warningLink");' |
+'onclick="javascript:window.close();" /></center></td>' |
+'return false;}' |
+'</tr></table></form></center>' |
+'return true;}' |
+'$end_page_bookmark' ); |
+'<\/scr'+'ipt>' |
bmquery.document.close(); |
+'$in_page_wishlistlink1' |
|
+'<input type="text" name="title" size="45" value="'+title+'"/>' |
|
+'$in_page_wishlistlink2' |
|
+'<input type="text" name="path" size="45" value="'+path+'" ' |
|
+'readonly="readonly" style="background-color: #DDDDDD"/>' |
|
+'$in_page_wishlistlink3' |
|
+'$end_page_wishlistlink' ); |
|
wishlistlink.document.close(); |
|
} |
|
|
|
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(); |
} |
} |
|
|
ENDUTILITY |
ENDUTILITY |
Line 1486 function adhocRole(roleitem) {
|
Line 1564 function adhocRole(roleitem) {
|
secok = 0; |
secok = 0; |
var numrolesec = rolesections[selidx].length; |
var numrolesec = rolesections[selidx].length; |
var msgidx = numsec[selidx] - numrolesec; |
var msgidx = numsec[selidx] - numrolesec; |
secchoice = prompt("$lt{'this'}\\n"+secpick[msgidx]+"\\n$lt{'avai'} "+roleseclist[selidx],""); |
secchoice = prompt("$lt{'this'} "+secpick[msgidx]+"\\n$lt{'avai'} "+roleseclist[selidx],""); |
if (secchoice == '') { |
if (secchoice == '') { |
if (msgidx > 0) { |
if (msgidx > 0) { |
secok = 1; |
secok = 1; |