[LON-CAPA-cvs] cvs: loncom /html/res/adm/pages/bookmarkmenu admbookmarks.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 11 Apr 2006 15:38:26 -0000
albertel Tue Apr 11 11:38:26 2006 EDT
Modified files:
/loncom/html/res/adm/pages/bookmarkmenu admbookmarks.pm
Log:
- style_police
Index: loncom/html/res/adm/pages/bookmarkmenu/admbookmarks.pm
diff -u loncom/html/res/adm/pages/bookmarkmenu/admbookmarks.pm:1.31 loncom/html/res/adm/pages/bookmarkmenu/admbookmarks.pm:1.32
--- loncom/html/res/adm/pages/bookmarkmenu/admbookmarks.pm:1.31 Tue Apr 11 11:26:05 2006
+++ loncom/html/res/adm/pages/bookmarkmenu/admbookmarks.pm Tue Apr 11 11:38:26 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The bookmarks handler
#
-# $Id: admbookmarks.pm,v 1.31 2006/04/11 15:26:05 albertel Exp $
+# $Id: admbookmarks.pm,v 1.32 2006/04/11 15:38:26 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -41,15 +41,15 @@
# --------------------------------------------------------------Put bookmarks
sub write_bookmarks {
- my $marks=shift;
- Apache::lonnet::put("bookmarks",{'bookmarks' => $marks});
+ my ($marks) = @_;
+ &Apache::lonnet::put("bookmarks",{'bookmarks' => $marks});
return;
}
# --------------------------------------------------------------Get bookmarks
sub get_bookmarks {
- my %bookmark=Apache::lonnet::get('bookmarks',['bookmarks']);
+ my %bookmark=&Apache::lonnet::get('bookmarks',['bookmarks']);
my ($errormsg) = $bookmark{'bookmarks'};
if ($errormsg =~ /^error/) { %bookmark = ('bookmarks' => ''); }
@@ -59,7 +59,7 @@
# ---------------------------------------------------Construct bookmark editor
sub construct_editor {
- my $bookmarks=shift;
+ my ($bookmarks) = @_;
my $js = <<ENDJS;
<script src="/res/adm/pages/bookmarkmenu/bookmarklib.js" language="JavaScript"></script>
@@ -114,7 +114,7 @@
# ---------------------------------------------------------------Construct Error window
sub construct_error {
- my $error_message=shift;
+ my ($error_message) = @_;
my $start_page =
&Apache::loncommon::start_page('Bookmark Tree Viewer/Editor',undef,
{'only_body' => 1,
@@ -150,7 +150,7 @@
my $end_page = &Apache::loncommon::end_page();
- return(<<END_TOOLBAR)
+ return(<<END_TOOLBAR)
$start_page
<div align="bottom">
<center>
@@ -165,49 +165,46 @@
# ---------------------------------------------Add bookmark from remote control
sub add_bookmark {
- my $location=shift;
- my $title=shift;
- my $bookmarks=shift;
- my $page='';
+ my ($location, $title, $bookmarks) = @_;
$bookmarks .= "window.tree.bookmarks.addLink(\"$title\",\"$location\");\n";
# $marks{'bookmarks'} += qq/\nwindow.tree.bookmarks.addlink("$title","$location");\n/;
- write_bookmarks($bookmarks);
- $page="<html><body>$bookmarks<p>Bookmarks successfully saved<script language=\"JavaScript\">window.close()</script></body></html>";
+ &write_bookmarks($bookmarks);
+ my $page="<html><body>$bookmarks<p>Bookmarks successfully saved<script language=\"JavaScript\">window.close()</script></body></html>";
return($page);
}
# ----------------------------------------------------------------Main Handler
sub handler {
- my $r=shift;
- my %marks;
- my $save_mark;
- my $page;
- $r->content_type('text/html');
- $r->send_http_header;
- if (defined($env{'form.hiddenbookmarks'})) {
- $marks{'bookmarks'}=$env{'form.hiddenbookmarks'};
- write_bookmarks($marks{'bookmarks'});
- $page=construct_toolbar();
- } else {
- %marks=get_bookmarks();
- if (exists($marks{"con_lost"})) {
- #$page = construct_editor($marks{'bookmarks'}); # Delete this line and uncomment next
- # in order to re-enable connection detection
- $page=construct_error("Connection broken with home server. Please contact your system administrator");
- } else {
- if (defined($env{'form.address'})) {
- $page=add_bookmark($env{'form.address'},$env{'form.title'},$marks{'bookmarks'});
- } else {
- if ($marks{'bookmarks'} eq "") {
- $marks{'bookmarks'}=defaultmarks();
- }
- $page = construct_editor($marks{'bookmarks'});
- }
- }
- }
- $r->print($page);
- return OK;
+ my ($r) = @_;
+ my %marks;
+ my $save_mark;
+ my $page;
+ $r->content_type('text/html');
+ $r->send_http_header;
+ if (defined($env{'form.hiddenbookmarks'})) {
+ $marks{'bookmarks'}=$env{'form.hiddenbookmarks'};
+ &write_bookmarks($marks{'bookmarks'});
+ $page=&construct_toolbar();
+ } else {
+ %marks=&get_bookmarks();
+ if (exists($marks{"con_lost"})) {
+ #$page = construct_editor($marks{'bookmarks'}); # Delete this line and uncomment next
+ # in order to re-enable connection detection
+ $page=&construct_error("Connection broken with home server. Please contact your system administrator");
+ } else {
+ if (defined($env{'form.address'})) {
+ $page=&add_bookmark($env{'form.address'},$env{'form.title'},$marks{'bookmarks'});
+ } else {
+ if ($marks{'bookmarks'} eq "") {
+ $marks{'bookmarks'}=&defaultmarks();
+ }
+ $page = &construct_editor($marks{'bookmarks'});
+ }
+ }
+ }
+ $r->print($page);
+ return OK;
}
####################################