[LON-CAPA-cvs] cvs: loncom / loncapa_apache.conf /auth lonroles.pm /interface lonpreferences.pm /publisher lonpublisher.pm

www lon-capa-cvs-allow@mail.lon-capa.org
Mon, 12 May 2008 23:47:50 -0000


www		Mon May 12 19:47:50 2008 EDT

  Modified files:              
    /loncom	loncapa_apache.conf 
    /loncom/auth	lonroles.pm 
    /loncom/interface	lonpreferences.pm 
    /loncom/publisher	lonpublisher.pm 
  Log:
  Locking
  
  
Index: loncom/loncapa_apache.conf
diff -u loncom/loncapa_apache.conf:1.173 loncom/loncapa_apache.conf:1.174
--- loncom/loncapa_apache.conf:1.173	Thu May  1 10:20:50 2008
+++ loncom/loncapa_apache.conf	Mon May 12 19:47:31 2008
@@ -1,7 +1,7 @@
 ##
 ## loncapa_apache.conf -- Apache HTTP LON-CAPA configuration file
 ##
-## $Id: loncapa_apache.conf,v 1.173 2008/05/01 14:20:50 raeburn Exp $
+## $Id: loncapa_apache.conf,v 1.174 2008/05/12 23:47:31 www Exp $
 ##
 
 #
@@ -463,6 +463,7 @@
 SetHandler perl-script
 PerlHandler Apache::lonroles
 ErrorDocument     403 /adm/login
+ErrorDocument     409 /adm/preferences?action=lockwarning
 ErrorDocument	  500 /adm/errorhandler
 </Location>
 
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.187 loncom/auth/lonroles.pm:1.188
--- loncom/auth/lonroles.pm:1.187	Mon Mar 17 10:38:30 2008
+++ loncom/auth/lonroles.pm	Mon May 12 19:47:37 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.187 2008/03/17 14:38:30 bisitz Exp $
+# $Id: lonroles.pm,v 1.188 2008/05/12 23:47:37 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -106,6 +106,10 @@
 
 # ================================================================== Roles Init
     if ($env{'form.selectrole'}) {
+
+        my $locknum=&Apache::lonnet::get_locks();
+        if ($locknum) { return 409; }
+
         if ($env{'form.newrole'}) {
             $env{'form.'.$env{'form.newrole'}}=1;
 	}
Index: loncom/interface/lonpreferences.pm
diff -u loncom/interface/lonpreferences.pm:1.117 loncom/interface/lonpreferences.pm:1.118
--- loncom/interface/lonpreferences.pm:1.117	Mon Mar 24 00:56:22 2008
+++ loncom/interface/lonpreferences.pm	Mon May 12 19:47:43 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Preferences
 #
-# $Id: lonpreferences.pm,v 1.117 2008/03/24 04:56:22 raeburn Exp $
+# $Id: lonpreferences.pm,v 1.118 2008/05/12 23:47:43 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -609,6 +609,42 @@
     $r->print(&mt('Registering clickers: [_1]',$newclickers));
 }
 
+#################################################################
+##                      Lock Subroutines                        #
+#################################################################
+
+sub lockwarning {
+    my $r = shift;
+    my $title=&mt('Action locked');
+    my $texttop=&mt('LON-CAPA is currently performing the following actions:');
+    my $textbottom=&mt('Changing roles or logging out may result in data corruption.');
+    my ($num,%which)=&Apache::lonnet::get_locks();
+    my $which='';
+    foreach my $id (keys %which) {
+       $which.='<li>'.$which{$id}.'</li>';
+    }
+    my $change=&mt('Override');
+    $r->print(<<ENDSCREEN);
+<form name="prefs" action="/adm/preferences" method="post">
+<input type="hidden" name="action" value="verify_and_change_locks" />
+<h1>$title</h1>
+$texttop
+<ul>
+$which
+</ul>
+$textbottom
+<input type="submit" value="$change" />
+</form>
+ENDSCREEN
+}
+
+sub verify_and_change_lockwarning {
+    my $r = shift;
+    &Apache::lonnet::remove_all_locks();
+    $r->print(&mt('Cleared locks.'));
+}
+
+
 ################################################################
 #         Message Forward                                      #
 ################################################################
@@ -1825,7 +1861,7 @@
                       href     => '/adm/preferences',
                       subroutine => \&clickerchanger,
                       breadcrumb =>
-                          { href => '/adm/preferences?action=changeicons',
+                          { href => '/adm/preferences?action=changeclicker',
                             text => 'Register Clicker'},
                       },
                     { action   => 'verify_and_change_clicker',
@@ -1836,6 +1872,20 @@
                       printmenu => 'yes',
                       }));
 
+    push (@Options,({ action   => 'lockwarning',
+                      subroutine => \&lockwarning,
+                      breadcrumb =>
+                          { href => '/adm/preferences?action=lockwarning',
+                            text => 'Lock Warnings'},
+                      },
+                    { action   => 'verify_and_change_locks',
+                      subroutine => \&verify_and_change_lockwarning,
+                      breadcrumb =>
+                          { href => '/adm/preferences?action=lockwarning',
+                            text => 'Lockwarnings'},
+                      printmenu => 'yes',
+                      }));
+
 
     if (&Apache::lonnet::allowed('whn',$env{'request.course.id'})
 	|| &Apache::lonnet::allowed('whn',$env{'request.course.id'}.'/'
Index: loncom/publisher/lonpublisher.pm
diff -u loncom/publisher/lonpublisher.pm:1.233 loncom/publisher/lonpublisher.pm:1.234
--- loncom/publisher/lonpublisher.pm:1.233	Mon May 12 16:59:22 2008
+++ loncom/publisher/lonpublisher.pm	Mon May 12 19:47:49 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Publication Handler
 #
-# $Id: lonpublisher.pm,v 1.233 2008/05/12 20:59:22 www Exp $
+# $Id: lonpublisher.pm,v 1.234 2008/05/12 23:47:49 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1818,7 +1818,7 @@
 		  '<br /><input type="submit" value="'.&mt('Publish Directory').'" /></form>');
         $lock=0;
     } else {
-        unless ($lock) { $lock=&Apache::lonnet::set_lock('Publishing '.$fn); }
+        unless ($lock) { $lock=&Apache::lonnet::set_lock(&mt('Publishing [_1]',$fn)); }
 # actually publish things
 	opendir(DIR,$fn);
 	my @files=sort(readdir(DIR));