Changeset 1060
- Timestamp:
- 09/20/06 16:27:25 (7 years ago)
- Location:
- ccsd
- Files:
-
- 1 added
- 3 edited
-
private/resources/rurallink.js (modified) (1 diff)
-
trunk/crcnetd/_utils/ccsd_cfengine.py (modified) (1 diff)
-
trunk/crcnetd/modules/ccs_monitor_web.py (modified) (7 diffs)
-
trunk/resources/homepage.js (added)
Legend:
- Unmodified
- Added
- Removed
-
ccsd/private/resources/rurallink.js
r1051 r1060 70 70 }; 71 71 Behaviour.register(myrules); 72 Behaviour.addLoadEvent(initialisePage);72 mvBehaviour.addLoadEvent(initialisePage); 73 73 74 74 function doAjaxWizard() { -
ccsd/trunk/crcnetd/_utils/ccsd_cfengine.py
r1041 r1060 1119 1119 # PHP sends in an associative array we want the values only 1120 1120 hosts = hosts.values() 1121 print hosts 1121 1122 1122 1123 # Loop through the specified hosts and mark them as pending -
ccsd/trunk/crcnetd/modules/ccs_monitor_web.py
r1045 r1060 28 28 from crcnetd._utils.ccsd_clientserver import registerPage, registerDir, \ 29 29 registerRealm 30 from crcnetd._utils.ccsd_config import config_get, init_pref_store, pref_get 30 from crcnetd._utils.ccsd_config import config_get, init_pref_store, pref_get, \ 31 config_getboolean 31 32 from crcnetd.version import ccsd_version, ccsd_revision 32 33 … … 332 333 # Content Pages 333 334 ############################################################################## 334 def displayMOTD(request): 335 @registerPage("/motd") 336 def getMOTD(request, method): 335 337 """Returns HTML to display the Message of the Day""" 336 338 … … 340 342 DEFAULT_MOTD_REFRESH) 341 343 motdURL = config_get("www", "motdURL", DEFAULT_MOTD_URL) 344 fetchMotd = config_getboolean("www", "fetch_motd", False) 342 345 updateNote = "" 343 346 … … 347 350 mtime = -1 348 351 349 if mtime == -1 or time.time()-mtime > motdRefreshInterval or \350 request.query.find("refreshMotd=true") != -1 :352 if (mtime == -1 or time.time()-mtime > motdRefreshInterval or \ 353 request.query.find("refreshMotd=true") != -1) and fetchMotd: 351 354 # Get new MOTD 352 355 try: … … 366 369 mtime = -1 367 370 else: 368 fd = open(motdFile, "r") 369 motd = fd.read() 370 fd.close() 371 371 try: 372 fd = open(motdFile, "r") 373 motd = fd.read() 374 fd.close() 375 except: 376 motd = "No news available" 377 372 378 # Calculate how long till next update 373 379 if mtime != -1: … … 378 384 379 385 # Generate the output 380 output = """<div class="content"> 381 <h2>Latest News <span class="note">%s 386 output = """<h2>Latest News <span class="note">%s 382 387 <a href="/?refreshMotd=true">[Refresh Now]</a> 383 388 </span> 384 389 </h2><br /> 385 390 %s 386 </div>387 391 """ % (updateNote, motd.replace("\n", "<br />")) 388 389 return output 392 393 length = len(output) 394 request.send_response(200) 395 request.send_header("Length", length) 396 request.end_headers() 397 request.wfile.write(output) 398 request.finish() 399 return 390 400 391 401 @registerPage("/") 392 402 def homepage(request, method): 393 403 394 output = "" 404 output = """<div class="content" id="motd">""" 395 405 396 406 # MOTD at the top 397 output += displayMOTD(request) 407 output += "<h2>Loading Latest News...</h2><br />" 408 output += "Please wait while the latest news is retrieved." 409 output += "</div>" 398 410 399 411 # Try and load the status summary from the status module … … 412 424 """ % status 413 425 414 returnPage(request, "CPE Navigation", output) 426 returnPage(request, "CPE Navigation", output, 427 scripts=["/resources/homepage.js"]) 415 428 416 429 @registerPage("/contact")
Note: See TracChangeset
for help on using the changeset viewer.
