--- loncom/html/res/adm/pages/annotator/admannotations.pm 2009/01/08 19:37:53 1.32 +++ loncom/html/res/adm/pages/annotator/admannotations.pm 2021/12/24 00:48:31 1.37 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # This will take annotations and then plug them into a page. # -# $Id: admannotations.pm,v 1.32 2009/01/08 19:37:53 raeburn Exp $ +# $Id: admannotations.pm,v 1.37 2021/12/24 00:48:31 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -75,6 +75,12 @@ sub construct_editor { my $get_symb = &js_get_symb(); + my %lt = &Apache::lonlocal::texthash( + 'close no save' => 'Close', + 'save' => 'Save', + 'cancel' => 'Cancel', + ); + my $js = < var timeout; @@ -89,6 +95,11 @@ function changed() { } timeout=setTimeout('changed();','1000'); } + +function renameButton(){ + document.getElementById("close").value="$lt{'cancel'}"; +} + ENDJS @@ -102,20 +113,17 @@ ENDJS my $end_page = &Apache::loncommon::end_page(); - my %lt = ( 'close no save' => "Close (no save)", - 'save' => "Save and Update",); - %lt = &Apache::lonlocal::texthash(%lt); return(< -
-
+ +
-
@@ -139,14 +147,15 @@ ENDJS {'only_body' => 1,}); my $end_page = &Apache::loncommon::end_page(); - my %lt = ( 'close' => "Close", - 'button' => $button_name,); - %lt = &Apache::lonlocal::texthash(%lt); + my %lt = &Apache::lonlocal::texthash( + 'close' => 'Close', + 'button' => $button_name, + ); return(< -
+
@@ -166,6 +175,27 @@ $end_page END_HTML2 } +sub block_check { + my ($clientip) = @_; + my ($blocked,$blocktext) = + &Apache::loncommon::blocking_status('annotate',$clientip); + if ($blocked) { + my %lt = &Apache::lonlocal::texthash( + 'close' => 'Close', + ); + my $start_page = + &Apache::loncommon::start_page('Annotations',undef, + {'only_body' => 1,}); + my $end_page = ''."\n". + ''."\n". + ''."\n". + &Apache::loncommon::end_page(); + return ($blocked,$start_page.$blocktext.$end_page); + } else { + return (); + } +} # ---------------------------------------------------------------Main Handler @@ -176,6 +206,14 @@ sub handler { $r->send_http_header; return OK if $r->header_only; + my $clientip = &Apache::lonnet::get_requestor_ip($r); + if ($clientip ne '') { + my ($blocked,$output) = &block_check($clientip); + if ($blocked) { + $r->print($output); + return OK; + } + } my $page;