Author: croberts
Date: 2011-06-27 20:01:48 +0000 (Mon, 27 Jun 2011)
New Revision: 4859
Modified:
trunk/cumin/python/cumin/account/widgets.strings
trunk/wooly/python/wooly/pages.py
trunk/wooly/resources/wooly.js
Log:
Addressing BZ 707576 by changing UpdatePage do_process to handle the possibility of a
redirect. Also, changing the wooly javascript that handles the page updates to look for
an indication of needing to be redirected to the login page and redirecting as necessary.
Modified: trunk/cumin/python/cumin/account/widgets.strings
===================================================================
--- trunk/cumin/python/cumin/account/widgets.strings 2011-06-27 16:09:19 UTC (rev 4858)
+++ trunk/cumin/python/cumin/account/widgets.strings 2011-06-27 20:01:48 UTC (rev 4859)
@@ -67,6 +67,7 @@
<div>{hidden_inputs}</div>
</form>
+<div style="display:none;visibility:hidden"
id="loginpage_token"/>
<script type="text/javascript">
$("{id}").elements[0].focus();
Modified: trunk/wooly/python/wooly/pages.py
===================================================================
--- trunk/wooly/python/wooly/pages.py 2011-06-27 16:09:19 UTC (rev 4858)
+++ trunk/wooly/python/wooly/pages.py 2011-06-27 20:01:48 UTC (rev 4859)
@@ -211,7 +211,14 @@
return "no-cache"
def do_process(self, session):
- self.html_page.process(self.session.get(session))
+ # get the session for the main page
+ sess = self.session.get(session)
+ self.html_page.process(sess)
+ # if the main page set it's redirect attribute in it's session
+ redirect = self.html_page.redirect.get(sess)
+ # pass that redirect on to the the update page
+ if redirect:
+ self.redirect.set(session, redirect)
def render_widgets(self, session):
writer = Writer()
Modified: trunk/wooly/resources/wooly.js
===================================================================
--- trunk/wooly/resources/wooly.js 2011-06-27 16:09:19 UTC (rev 4858)
+++ trunk/wooly/resources/wooly.js 2011-06-27 20:01:48 UTC (rev 4859)
@@ -329,13 +329,14 @@
this.updatePage = function(xml) {
var success = true;
+ var had_updates = false;
if(xml == null) {
success = false;
} else {
var child = xml.documentElement.firstChild;
-
while (child) {
if (child.nodeType == 1 && child.nodeName == "widget")
{
+ had_updates = true;
var id = child.getAttribute("id");
var oldElem = document.getElementById(id);
@@ -369,6 +370,30 @@
child = child.nextSibling;
}
+
+ if(!had_updates) {
+ // if there were no updates in the returned XML,
+ // maybe it was because our session timed-out and
+ // we need to be sent to the login page
+ child = xml.documentElement.firstChild;
+ while(child) {
+ if(child.nodeType == 1) {
+ if(child.nodeName == "body") {
+ body = child.firstChild;
+ while(body) {
+ if(body.nodeType == 1) {
+ if(body.getAttribute("id") == "loginpage_token")
{
+ document.location.href = '/login.html';
+ }
+ }
+ body = body.nextSibling;
+ }
+ }
+ }
+ child = child.nextSibling;
+ }
+ }
+
}
var len = wooly.pageUpdateListeners.length;
Show replies by date