Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuxhuang/72217 to your computer and use it in GitHub Desktop.
Save yuxhuang/72217 to your computer and use it in GitHub Desktop.
From 4a050b1687f645b0e9eb9510e382639dbfd7167b Mon Sep 17 00:00:00 2001
From: Felix Huang <gzfelix@gmail.com>
Date: Tue, 17 Feb 2009 14:44:04 -0400
Subject: [PATCH] * fix overhead monitor memory usage problem
* awards to feedapi change to new schema
---
campus/js/overhead_monitor_cem_receiver.js | 2 +-
campus/js/overhead_monitor_cem_receiver.jsrc | 14 ++++++++++----
xml/awards-to-feedapi.xsl | 6 +++++-
3 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/campus/js/overhead_monitor_cem_receiver.js b/campus/js/overhead_monitor_cem_receiver.js
index 06e2900..6fb736e 100644
--- a/campus/js/overhead_monitor_cem_receiver.js
+++ b/campus/js/overhead_monitor_cem_receiver.js
@@ -1 +1 @@
-$(document).ready(function(){var E=15*1000;var B="/emergency/cem/endpoint/json?"+Math.random();var A=function(F){this.te=false;this.emergency=false};var C=$("#swf_screenManager, #swf_screenManager *");A.prototype.fetchAndDisplay=function(F){this.url=F;var G=this;$.getJSON(F,function(K){G.emergency=K["in-emergency"];if(G.emergency){if(G.te){G.te.dialog("close");G.te.dialog("destroy");var J=G.te;$("body").oneTime(500,function(){J.remove()})}G.te=$.create("div",{id:"campus_emergency"});$("body").append(G.te);var I=K.messages;G.title=I[0]["title"];G.body=I[0]["body"];C.addClass("elem-hidden");D.display();var H=new Date()}else{if(G.te){G.te.dialog("close");G.te.dialog("destroy");$("body").oneTime(500,function(){G.te.remove()});G.te=null;C.removeClass("elem-hidden")}}});return true};A.prototype.display=function(){var F=$.create("div",{style:"margin: 10px 10px;"},[]);F.html(this.body);this.te.append(F);this.te.dialog($.extend(this.dialogOptions||{},{title:this.title,modal:true,draggable:true,resizable:"se",closeOnEscape:false,height:512,width:900,overlay:{opacity:0.9,background:"black"}}));return true};var D=new A("#campus_emergency");D.fetchAndDisplay(B);$("body").everyTime(E,function(F){D.fetchAndDisplay(B)})});
\ No newline at end of file
+$(document).ready(function(){var G=30*1000;var D="/emergency/cem/endpoint/json?"+Math.random();var C=unescape(window.location.pathname);function A(){window.location.href=C}var B=function(H){this.te=false;this.emergency=false};var E=$("#swf_screenManager, #swf_screenManager *");B.prototype.fetchAndDisplay=function(H){this.url=H;var I=this;$.getJSON(H,function(L){I.emergency=L["in-emergency"];if(I.emergency){if(I.te){I.te.dialog("close");I.te.dialog("destroy");var K=I.te;$("body").oneTime(500,function(){K.remove()})}I.te=$.create("div",{id:"campus_emergency"});$("body").append(I.te);var J=L.messages;I.title=J[0]["title"];I.body=J[0]["body"];E.addClass("elem-hidden");F.display()}else{if(I.te){I.te.dialog("close");I.te.dialog("destroy");$("body").oneTime(500,function(){I.te.remove()});I.te=null;E.removeClass("elem-hidden");A()}}});return true};B.prototype.display=function(){var H=$.create("div",{style:"margin: 10px 10px;"},[]);H.html(this.body);this.te.append(H);this.te.dialog($.extend(this.dialogOptions||{},{title:this.title,modal:true,draggable:true,resizable:"se",closeOnEscape:false,height:512,width:900,overlay:{opacity:0.9,background:"black"}}));return true};var F=new B("#campus_emergency");F.fetchAndDisplay(D);$("body").everyTime(G,function(H){F.fetchAndDisplay(D)})});
\ No newline at end of file
diff --git a/campus/js/overhead_monitor_cem_receiver.jsrc b/campus/js/overhead_monitor_cem_receiver.jsrc
index 4cc7214..16e4c3b 100644
--- a/campus/js/overhead_monitor_cem_receiver.jsrc
+++ b/campus/js/overhead_monitor_cem_receiver.jsrc
@@ -1,9 +1,16 @@
/* $Id: campus_emergency_receiver.jsrc 55 2008-10-27 17:45:27Z yxh $ */
$(document).ready(function() {
-var checkEmergencyPeriod = 15 * 1000; // 30 seconds
+var checkEmergencyPeriod = 30 * 1000; // 30 seconds
var emergencyJSONURL = '/emergency/cem/endpoint/json?' + Math.random();
-
+
+var sURL = unescape(window.location.pathname);
+
+function refresh()
+{
+ window.location.href = sURL;
+}
+
var CampusEmergencyReceiver = function(id) {
this.te = false;
this.emergency = false;
@@ -37,8 +44,6 @@ CampusEmergencyReceiver.prototype.fetchAndDisplay = function(url) {
obj.body = messages[0]['body'];
flashObject.addClass('elem-hidden');
messageReceiver.display();
- // set the browser session cookie
- var date = new Date();
}
else {
if (obj.te) {
@@ -49,6 +54,7 @@ CampusEmergencyReceiver.prototype.fetchAndDisplay = function(url) {
});
obj.te = null;
flashObject.removeClass('elem-hidden');
+ refresh();
}
}
});
diff --git a/xml/awards-to-feedapi.xsl b/xml/awards-to-feedapi.xsl
index 9441391..bb8a088 100644
--- a/xml/awards-to-feedapi.xsl
+++ b/xml/awards-to-feedapi.xsl
@@ -52,7 +52,11 @@
<xsl:value-of select="sab:type" />
</type>
<student-status>
- <xsl:value-of select="sab:student-status" />
+ <xsl:for-each select="sab:student-status/status">
+ <status>
+ <xsl:value-of select="." />
+ </status>
+ </xsl:for-each>
</student-status>
<maximum-amount>
<xsl:value-of select="sab:maximum-amount" />
--
1.6.0.6+GitX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment