[Cluster-devel] conga/luci/storage index_html storage_async.js
rmccabe at sourceware.org
rmccabe at sourceware.org
Tue Sep 25 18:54:59 UTC 2007
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2007-09-25 18:54:59
Modified files:
luci/storage : index_html
Added files:
luci/storage : storage_async.js
Log message:
Extract more javascript from the page templates
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/storage/storage_async.js.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/storage/index_html.diff?cvsroot=cluster&r1=1.12&r2=1.13
/cvs/cluster/conga/luci/storage/storage_async.js,v --> standard output
revision 1.1
--- conga/luci/storage/storage_async.js
+++ - 2007-09-25 18:54:59.491457000 +0000
@@ -0,0 +1,67 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
+var xmlHttp_object = false;
+
+function initiate_async_get(url, funct) {
+ xmlHttp_object = false;
+
+ /*@cc_on @*/
+ /*@if (@_jscript_version >= 5)
+ try {
+ xmlHttp_object = new ActiveXObject("Msxml2.XMLHTTP");
+ } catch (e) {
+ try {
+ xmlHttp_object = new ActiveXObject("Microsoft.XMLHTTP");
+ } catch (e2) {
+ xmlHttp_object = false;
+ }
+ }
+ @end @*/
+
+ if (!xmlHttp_object && typeof XMLHttpRequest != 'undefined') {
+ xmlHttp_object = new XMLHttpRequest();
+ }
+
+ if (xmlHttp_object) {
+ xmlHttp_object.open("GET", url, true);
+ xmlHttp_object.onreadystatechange = funct;
+ xmlHttp_object.send(null);
+ } else {
+ alert("Unable to initiate async GET");
+ }
+}
+
+var span_to_replace = "";
+var replace_span_button_to_disable_id = "";
+
+function replace_span_content_callback() {
+ if (xmlHttp_object.readyState == 4) {
+ if (xmlHttp_object.status == 200) {
+ var response = xmlHttp_object.responseText;
+ document.getElementById(span_to_replace).innerHTML = response;
+ } else {
+ alert("Error retrieving data from server");
+ }
+ if (replace_span_button_to_disable_id != "") {
+ document.getElementById(replace_span_button_to_disable_id).disabled = false;
+ }
+ replace_span_button_to_disable_id = '';
+ }
+}
+
+function replace_span_content(span_id, url, button_to_disable_id) {
+ span_to_replace = span_id;
+ replace_span_button_to_disable_id = button_to_disable_id;
+
+ initiate_async_get(url, replace_span_content_callback);
+ if (replace_span_button_to_disable_id != "") {
+ document.getElementById(replace_span_button_to_disable_id).disabled = true;
+ }
+}
--- conga/luci/storage/index_html 2007/09/25 04:00:24 1.12
+++ conga/luci/storage/index_html 2007/09/25 18:54:59 1.13
@@ -38,86 +38,12 @@
<metal:javascriptslot fill-slot="javascript_head_slot">
<tal:comment replace="nothing"> A slot where you can insert javascript in the header from a template </tal:comment>
<metal:javascriptslot define-slot="javascript_head_slot">
-
-
-
-
-
-
-<!-- async helper functions -->
-<script type="text/javascript" src="/luci/conga.js"></script>
-<script language="javascript" type="text/javascript">
-
-var xmlHttp_object = false;
-
-function initiate_async_get(url, funct) {
- xmlHttp_object = false;
-
- /*@cc_on @*/
- /*@if (@_jscript_version >= 5)
- try {
- xmlHttp_object = new ActiveXObject("Msxml2.XMLHTTP");
- } catch (e) {
- try {
- xmlHttp_object = new ActiveXObject("Microsoft.XMLHTTP");
- } catch (e2) {
- xmlHttp_object = false;
- }
- }
- @end @*/
-
- if (!xmlHttp_object && typeof XMLHttpRequest != 'undefined') {
- xmlHttp_object = new XMLHttpRequest();
- }
-
- if (xmlHttp_object) {
- xmlHttp_object.open("GET", url, true);
- xmlHttp_object.onreadystatechange = funct;
- xmlHttp_object.send(null);
- } else {
- alert("Unable to initiate async GET");
- }
-}
-
-var span_to_replace = "";
-var replace_span_button_to_disable_id = "";
-
-function replace_span_content_callback() {
- if (xmlHttp_object.readyState == 4) {
- if (xmlHttp_object.status == 200) {
- var response = xmlHttp_object.responseText;
- document.getElementById(span_to_replace).innerHTML = response;
- } else {
- alert("Error retrieving data from server");
- }
- if (replace_span_button_to_disable_id != "")
- document.getElementById(replace_span_button_to_disable_id).disabled = false;
- replace_span_button_to_disable_id = '';
- }
-}
-function replace_span_content(span_id, url, button_to_disable_id) {
- span_to_replace = span_id;
- replace_span_button_to_disable_id = button_to_disable_id;
- initiate_async_get(url, replace_span_content_callback);
- if (replace_span_button_to_disable_id != "")
- document.getElementById(replace_span_button_to_disable_id).disabled = true;
-}
-
-</script>
-
-
-
-
-
-
-
-
+ <!-- async helper functions -->
+ <script type="text/javascript" src="conga.js"></script>
+ <script type="text/javascript" src="storage_async.js"></script>
</metal:javascriptslot>
</metal:javascriptslot>
-
-
-
</head>
<body tal:attributes="class here/getSectionFromURL;
More information about the Cluster-devel
mailing list