[LON-CAPA-cvs] cvs: loncom /auth lonroles.pm /interface londocs.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Sun, 05 Jun 2005 07:10:34 -0000
albertel Sun Jun 5 03:10:34 2005 EDT
Modified files:
/loncom/interface londocs.pm
/loncom/auth lonroles.pm
Log:
- trying to be moe helpful in access control problem cases, throw up the 're-init course' button if the get the access control message and have modified the course with reinit (Kinda BUG# 3646)
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.176 loncom/interface/londocs.pm:1.177
--- loncom/interface/londocs.pm:1.176 Fri Apr 22 14:21:05 2005
+++ loncom/interface/londocs.pm Sun Jun 5 03:10:32 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.176 2005/04/22 18:21:05 albertel Exp $
+# $Id: londocs.pm,v 1.177 2005/06/05 07:10:32 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1837,25 +1837,29 @@
}
sub changewarning {
- my ($r,$postexec)=@_;
+ my ($r,$postexec,$message,$url)=@_;
if (!&is_hash_old()) { return; }
my $pathvar='folderpath';
my $path=&Apache::lonnet::escape($env{'form.folderpath'});
- if (defined($env{'form.pagepath'})) {
- $pathvar='pagepath';
- $path=&Apache::lonnet::escape($env{'form.pagepath'});
- $path.='&symb='.&Apache::lonnet::escape($env{'form.pagesymb'});
+ if (!defined($url)) {
+ if (defined($env{'form.pagepath'})) {
+ $pathvar='pagepath';
+ $path=&Apache::lonnet::escape($env{'form.pagepath'});
+ $path.='&symb='.&Apache::lonnet::escape($env{'form.pagesymb'});
+ }
+ $url='/adm/coursedocs?'.$pathvar.'='.$path;
+ }
+ if (!defined($message)) {
+ $message='Changes will become active for your current session after [_1], or the next time you log in.';
}
$r->print(
'<script>function reinit(tf) { tf.submit();'.$postexec.' }</script>'.
'<form method="post" action="/adm/roles" target="loncapaclient">'.
-'<input type="hidden" name="orgurl" value="/adm/coursedocs?'.
-$pathvar.'='.$path.
+'<input type="hidden" name="orgurl" value="'.$url.
'" /><input type="hidden" name="selectrole" value="1" /><h3><font color="red">'.
-&mt('Changes will become active for your current session after').
-' <input type="hidden" name="'.
-$env{'request.role'}.'" value="1" /><input type="button" value="'.
-&mt('re-initializing course').'" onClick="reinit(this.form)"/>'.&mt(', or the next time you log in.').
+&mt($message,' <input type="hidden" name="'.
+ $env{'request.role'}.'" value="1" /><input type="button" value="'.
+ &mt('re-initializing course').'" onClick="reinit(this.form)" />').
$help{'Caching'}.'</font></h3></form>');
}
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.119 loncom/auth/lonroles.pm:1.120
--- loncom/auth/lonroles.pm:1.119 Fri Apr 22 16:54:43 2005
+++ loncom/auth/lonroles.pm Sun Jun 5 03:10:32 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# User Roles Screen
#
-# $Id: lonroles.pm,v 1.119 2005/04/22 20:54:43 albertel Exp $
+# $Id: lonroles.pm,v 1.120 2005/06/05 07:10:32 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -39,6 +39,7 @@
use Apache::lonhtmlcommon;
use Apache::lonannounce;
use Apache::lonlocal;
+use GDBM_File;
sub redirect_user {
my ($r,$title,$url,$msg,$launch_nav) = @_;
@@ -338,7 +339,18 @@
$r->print("<hr><pre>Access : ".
Apache::lonnet::plaintext($priv)."\n");
$r->print("Resource: ".&Apache::lonenc::check_encrypt($fn)."\n");
- $r->print("Action : $msg\n</pre><hr>");
+ $r->print("Action : $msg\n</pre><hr />");
+ my $url=$fn;
+ my $last;
+ if (tie(my %hash,'GDBM_File',$env{'request.course.fn'}.'_symb.db',
+ &GDBM_READER(),0640)) {
+ $last=$hash{'last_known'};
+ untie(%hash);
+ }
+ if ($last) { $fn.='?symb='.&Apache::lonnet::escape($last); }
+
+ &Apache::londocs::changewarning($r,undef,'You have modified your course recently, [_1] may fix this access problem.',
+ &Apache::lonenc::check_encrypt($fn));
} else {
if ($env{'user.error.msg'}) {
$r->print(