[Cluster-devel] conga/luci Makefile load_site.py homebase/inde ...

rmccabe at sourceware.org rmccabe at sourceware.org
Fri Jun 30 17:45:21 UTC 2006


CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2006-06-30 17:45:20

Modified files:
	luci           : Makefile load_site.py 
	luci/homebase  : index_html 

Log message:
	fix importing and exporting of page templates/css/js/imgs

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/Makefile.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/load_site.py.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/index_html.diff?cvsroot=cluster&r1=1.8&r2=1.9

--- conga/luci/Makefile	2006/06/30 17:00:02	1.6
+++ conga/luci/Makefile	2006/06/30 17:45:20	1.7
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.6 2006/06/30 17:00:02 rmccabe Exp $
+# $Id: Makefile,v 1.7 2006/06/30 17:45:20 rmccabe Exp $
 
 
 all: luci
@@ -62,19 +62,36 @@
 ZOPEFTP=localhost:8021
 ZOPEHTTP=http://localhost:25639/
 ZOPEDIRS=cluster storage homebase
+HBDIR=homebase
+CLUSTERDIR=cluster
+STORAGEDIR=storage
 
 all_old: tar
 
 tar:
 
-export_pts:
-	@./make_tools/load_site.py $(ZOPEHTTP)/$(PLONEINSTANCE)/ $(PT_DIR)/*
+# import page local page templates to the Luci server
 
-import_pts:
+import_storage:
+	@find $(STORAGEDIR) -follow -maxdepth 1 -type f -print0 | xargs -0 ./load_site.py http://localhost:25639/luci/storage/
+
+import_cluster:
+	@find $(CLUSTERDIR) -follow -maxdepth 1 -type f -print0 | xargs -0 ./load_site.py http://localhost:25639/luci/cluster/
+
+import_homebase:
+	@find $(HBDIR) -follow -maxdepth 1 -type f -print0 | xargs -0 ./load_site.py http://localhost:25639/luci/homebase/
+
+import_pts: import_storage import_cluster import_homebase
+
+pt_dir:
+	@mkdir pts >& /dev/null
+
+# export page templates from the Luci server
+export_pts: pt_dir
 	@pwd=`pwd` ; cd $(PT_DIR) && \
-	( for i in $(ZOPEDIRS) ; do wget -r -nH --cut-dirs=1 "ftp://$(ZOPEUSER):$(ZOPEPASS)@$(ZOPEFTP)/$(PLONEINSTANCE)/$$i/*" ; done) ; cd $$pwd
+	( for i in $(ZOPEDIRS) ; do wget -q -r -nH --cut-dirs=1 "ftp://$(ZOPEUSER):$(ZOPEPASS)@$(ZOPEFTP)/$(PLONEINSTANCE)/$$i/*" ; done) ; cd $$pwd
 
 pack:
-	@./make_tools/pack.py $(ZOPEINSTANCE)/var/Data.fs
+	@./pack.py $(ZOPEINSTANCE)/var/Data.fs
 
 cert:
--- conga/luci/load_site.py	2006/06/19 19:31:08	1.6
+++ conga/luci/load_site.py	2006/06/30 17:45:20	1.7
@@ -1,5 +1,5 @@
 #!/usr/bin/python
-# $Id: load_site.py,v 1.6 2006/06/19 19:31:08 rmccabe Exp $
+# $Id: load_site.py,v 1.7 2006/06/30 17:45:20 rmccabe Exp $
 
 ##############################################################################
 #
@@ -135,6 +135,9 @@
 def upload_css(object, f):
 	upload_txt(object, f, t='text/css')
 
+def upload_js(object, f):
+	upload_txt(object, f, t='text/javascript')
+
 def upload_pt(object, f):
 	dir, name = os.path.split(f)
 
--- conga/luci/homebase/index_html	2006/06/20 23:05:41	1.8
+++ conga/luci/homebase/index_html	2006/06/30 17:45:20	1.9
@@ -15,7 +15,7 @@
 					xml:lang language">
 
 <tal:comment replace="nothing">
-	$Id: index_html,v 1.8 2006/06/20 23:05:41 rmccabe Exp $
+	$Id: index_html,v 1.9 2006/06/30 17:45:20 rmccabe Exp $
 </tal:comment>
 
 <head metal:use-macro="here/header/macros/html_header">
@@ -51,215 +51,17 @@
 <tal:block tal:omit-tag="" 
 	tal:define="global data python:here.homebaseControl(request)" />
 
-<metal:cssslot define-slot="css_slot" />
+	<metal:cssslot define-slot="css_slot" />
 	</metal:cssslot>
 
 	<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" />
-
-<script type="text/javascript">
-function error_dialog(errors) {
-	if (!errors || errors.length < 1)
-		return (null);
-	alert('The following errors were found:\n\n' + errors.join('\n'));
-	return (-1);
-}
-
-function str_is_blank(str) {
-	return (!str || !str.replace(/\s/g, ''));
-}
-
-function str_is_valid(str, valid_regex_str) {
-	if (!str || !valid_regex_str)
-		return (null);
-	var re = eval(valid_regex_str);
-	var invalid = str.replace(re, '');
-	if (!invalid)
-		return (null);
-	return (invalid);
-}
-
-function checkAllBoxes(str, val) {
-	var i = 0;
-	var element;
-	while ((element = document.getElementById(str + i++)))
-		element.checked = val;
-}
-
-function checkChildren(parent_cont, parent_input) {
-	if (!parent_cont || !parent_input)
-		return
-	parent = document.getElementById(parent_cont);
-	children = parent.getElementsByTagName('input')
-	for (var i = 0 ; i < children.length ; i++) {
-		if (children[i] == parent_input)
-			continue;
-		if (children[i].type == 'checkbox')
-			children[i].checked = parent_input.checked;
-	}
-}
-
-function hide_element(id) {
-	var elem = document.getElementById(id);
-	if (elem)
-		elem.style['visibility'] = 'hidden';
-}
-
-function isValidHost(str) {
-	var i = str.split('.');
-
-	if (i.length == 1)
-		return ('Hostnames must be fully qualified.');
-
-	if (i.length == 4 && !isNaN(parseInt(i[3]))) {
-		var o1 = parseInt(i[0]);
-		var o2 = parseInt(i[1]);
-		var o3 = parseInt(i[2]);
-		var o4 = parseInt(i[3]);
-
-		if (isNaN(o1) || isNaN(o2) || isNaN(o3) ||
-			((o1 & 0xff) != o1) ||
-			((o2 & 0xff) != o2) ||
-			((o3 & 0xff) != o3) ||
-			((o4 & 0xff) != o4))
-		{
-			return ('Invalid IP Address.');
-		}
-
-		return (null);
-	}
-
-	if (!isNaN(parseInt(i[i.length - 1])))
-		return ('Invalid IP Address.');
-
-	if (!str.match(/^[0-9A-Za-z][0-9A-Za-z.-]*$/))
-		return ('Hostnames can contain only alphanumeric characters and hyphens.');
-
-	return (null);
-}
-
-function allPasswdsSame(form) {
-	var cb = document.getElementById('allSameCheckBox');
-	if (!cb)
-		return (-1);
-	var num_systems = form.numStorage.value;
-
-	var state = cb.checked;
-	var passwd = document.getElementById('__SYSTEM0:Passwd').value;
-	if (!passwd || !state)
-		passwd = '';
-
-	for (var i = 1 ; i < num_systems ; i++) {
-		var element = document.getElementById('__SYSTEM' + i + ':Passwd')
-		if (element) {
-			element.value = passwd;
-			element.disabled = state;
-		}
-	}
-}
-
-function pwd0Change(form) {
-	var element = document.getElementById('allSameCheckBox');
-	if (element && element.checked)
-		allPasswdsSame(form);
-}
-
-function addSystem(form) {
-	var sltab = document.getElementById('systemsTable');
-	if (!sltab)
-		return;
-	var num_systems = form.numStorage.value;
-
-	var newsys = document.createElement('input');
-	newsys.setAttribute('style', 'padding:.20em !important;width:200px;');
-	newsys.setAttribute('name', '__SYSTEM' + num_systems + ':Addr');
-	newsys.setAttribute('id', '__SYSTEM' + num_systems + ':Addr');
-	newsys.setAttribute('type', 'text');
-	newsys.setAttribute('value', '');
-
-	var newsysp = document.createElement('input');
-	newsysp.setAttribute('style', 'padding:.20em !important;width:160px;');
-	newsysp.setAttribute('name', '__SYSTEM' + num_systems + ':Passwd');
-	newsysp.setAttribute('id', '__SYSTEM' + num_systems + ':Passwd');
-	newsysp.setAttribute('type', 'password');
-	newsysp.setAttribute('value', '');
-
-	var allSameCB = document.getElementById('allSameCheckBox');
-	if (allSameCB && allSameCB.checked) {
-		newsysp.setAttribute('value', document.getElementById('__SYSTEM0:Passwd').value);
-		newsysp.setAttribute('disabled', true);
-	}
-
-	var newrow = document.createElement('tr');
-	var hcol = document.createElement('td')
-	hcol.setAttribute('style', 'margin: 0em;padding: 0em 1em .33em 0em;background: #dee7ec;padding-left: .5em;text-align: left;');
-	var pcol = document.createElement('td')
-	pcol.setAttribute('style', 'margin: 0em;padding: 0em 1em .33em 0em;background: #dee7ec;padding-left: .5em;text-align: left;');
-
-	hcol.appendChild(newsys)
-	pcol.appendChild(newsysp)
-	newrow.appendChild(hcol)
-	newrow.appendChild(pcol)
-	sltab.appendChild(newrow)
-
-	form.numStorage.value = ++num_systems;
-	if (num_systems == 2) {
-		var temp = document.getElementById('allSameDiv');
-		temp.style.visibility = 'visible';
-		temp = document.getElementById('allSameCheckBox');
-		temp.style.visibility = 'visible';
-	}
-}
-
-function validate_systems(form, errors) {
-	var allSameCB = document.getElementById('allSameCheckBox');
-	var added_storage = new Array();
-	var num_systems = form.numStorage.value;
-
-	for (var i = 0 ; i < num_systems ; i++) {
-		var element = document.getElementById('__SYSTEM' + i + ':Addr');
-
-		if (!element)
-			continue;
-
-		var pwdElem = document.getElementById('__SYSTEM' + i + ':Passwd');
-		if (!element.value) {
-			if (pwdElem.value) {
-				if (!allSameCB.checked) {
-					errors.push('You entered a password, but no hostname for system ' + (i + 1));
-					continue;
-				} else
-					pwdElem.value = '';
-			}
-
-			continue;
-		} else if (!pwdElem || !pwdElem.value)
-			errors.push('No password was given for \"' + element.value + '\"');
-		else if (str_is_blank(pwdElem.value))
-			errors.push('The password entered for \"' + element.value + '\" is blank.');
-
-		if (str_is_blank(element.value)) {
-			errors.push('You entered a blank hostname for system ' + (i + 1));
-			element.value = '';
-		} else {
-			var errmsg;
-			if ((errmsg = isValidHost(element.value)))
-				errors.push('\"' + element.value + '\" is not a valid hostname: ' + errmsg);
-			else {
-				pwdElem.disabled = false;
-				added_storage.push(element.value);
-			}
-		}
-	}
-
-	return (added_storage);
-}
-</script>
-</metal:javascriptslot>
-
+	</metal:javascriptslot>
+<script type="text/javascript" src="/luci/homebase/homebase_common.js" />
 </head>
 
+
 <body tal:attributes="class here/getSectionFromURL;
 						dir python:test(isRTL, 'rtl', 'ltr')">
 	<div id="visual-portal-wrapper">




More information about the Cluster-devel mailing list