summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2007-10-12 15:55:00 -0400
committerMichael DeHaan <mdehaan@redhat.com>2007-10-12 15:55:00 -0400
commit427514b86d143d0c12766a9a6fb683a69d997e29 (patch)
tree613a3167bb9ba1d23759526a5c4f49191d28d873
parented637d1920d8bba36032612ff0847de627a66222 (diff)
downloadthird_party-cobbler-427514b86d143d0c12766a9a6fb683a69d997e29.tar.gz
third_party-cobbler-427514b86d143d0c12766a9a6fb683a69d997e29.tar.xz
third_party-cobbler-427514b86d143d0c12766a9a6fb683a69d997e29.zip
Working on WebUI, still some work to do in regards to hiding MACs and so forth...
-rw-r--r--cobbler.spec1
-rw-r--r--cobbler/webui/master.py78
-rw-r--r--setup.py5
-rw-r--r--webui_content/cobbler.js (renamed from webui_content/showhide.js)32
-rw-r--r--webui_content/list-collapse.pngbin0 -> 215 bytes
-rw-r--r--webui_content/list-expand.pngbin0 -> 400 bytes
-rw-r--r--webui_content/list-parent.pngbin0 -> 923 bytes
-rw-r--r--webui_templates/master.tmpl6
-rw-r--r--webui_templates/system_edit.tmpl90
9 files changed, 129 insertions, 83 deletions
diff --git a/cobbler.spec b/cobbler.spec
index 61ff75f..fcfc229 100644
--- a/cobbler.spec
+++ b/cobbler.spec
@@ -164,6 +164,7 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
%config(noreplace) /var/lib/cobbler/snippets/partition_select
/var/lib/cobbler/elilo-3.6-ia64.efi
/var/lib/cobbler/menu.c32
+%defattr(660,root,root)
%config(noreplace) /etc/cobbler/auth.conf
%defattr(664,root,root)
diff --git a/cobbler/webui/master.py b/cobbler/webui/master.py
index 0c1e9c2..5e8f9e7 100644
--- a/cobbler/webui/master.py
+++ b/cobbler/webui/master.py
@@ -33,10 +33,10 @@ VFN=valueForName
currentTime=time.time
__CHEETAH_version__ = '2.0rc8'
__CHEETAH_versionTuple__ = (2, 0, 0, 'candidate', 8)
-__CHEETAH_genTime__ = 1192140723.448333
-__CHEETAH_genTimestamp__ = 'Thu Oct 11 18:12:03 2007'
+__CHEETAH_genTime__ = 1192212078.11906
+__CHEETAH_genTimestamp__ = 'Fri Oct 12 14:01:18 2007'
__CHEETAH_src__ = 'webui_templates/master.tmpl'
-__CHEETAH_srcLastModified__ = 'Thu Oct 11 11:30:22 2007'
+__CHEETAH_srcLastModified__ = 'Fri Oct 12 11:53:14 2007'
__CHEETAH_docstring__ = 'Autogenerated by CHEETAH: The Python-Powered Template Engine'
if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
@@ -69,7 +69,7 @@ class master(Template):
- ## CHEETAH: generated from #block body at line 56, col 1.
+ ## CHEETAH: generated from #block body at line 60, col 1.
trans = KWS.get("trans")
if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
trans = self.transaction # is None unless self.awake() was called
@@ -124,15 +124,19 @@ class master(Template):
<link rel="stylesheet" type="text/css" media="all" href="/cobbler/webui/style.css" />
<link rel="stylesheet" type="text/css" media="all" href="/cobbler/webui/cobblerweb.css" />
+
+<script language="Javascript" src="/cobbler/webui/cobbler.js" ></script>
+
</head>
-<body>
+
+<body onload="global_onload();">
<div id="wrap">
<h1 id="masthead">
<a href="''')
- _v = VFFSL(SL,"base_url",True) # '$base_url' on line 16, col 18
- if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 16, col 18.
+ _v = VFFSL(SL,"base_url",True) # '$base_url' on line 20, col 18
+ if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 20, col 18.
write('''/index">
<img alt="Cobbler Logo"
src="/cobbler/webui/logo-cobbler.png"/>
@@ -145,70 +149,70 @@ class master(Template):
<div id="sidebar">
<ul id="nav">
''')
- if not VFFSL(SL,"logged_in",True): # generated from line 27, col 9
+ if not VFFSL(SL,"logged_in",True): # generated from line 31, col 9
write(''' <li><a href="''')
- _v = VFFSL(SL,"base_url",True) # '$base_url' on line 28, col 26
- if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 28, col 26.
+ _v = VFFSL(SL,"base_url",True) # '$base_url' on line 32, col 26
+ if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 32, col 26.
write('''/login" class="menu">Log In</a></li>
''')
- else: # generated from line 29, col 9
+ else: # generated from line 33, col 9
write(''' <li><a href="/cobbler/webui/wui.html" class="menu">Docs</a></li>
<li><a href="''')
- _v = VFFSL(SL,"base_url",True) # '$base_url' on line 31, col 26
- if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 31, col 26.
+ _v = VFFSL(SL,"base_url",True) # '$base_url' on line 35, col 26
+ if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 35, col 26.
write('''/settings_view" class="menu">Settings</a></li>
<li><a href="''')
- _v = VFFSL(SL,"base_url",True) # '$base_url' on line 32, col 26
- if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 32, col 26.
+ _v = VFFSL(SL,"base_url",True) # '$base_url' on line 36, col 26
+ if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 36, col 26.
write('''/logout_submit" class="menu">Log Out</a></li>
<li><hr/></li>
<li>LIST</li>
<li><a href="''')
- _v = VFFSL(SL,"base_url",True) # '$base_url' on line 35, col 26
- if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 35, col 26.
+ _v = VFFSL(SL,"base_url",True) # '$base_url' on line 39, col 26
+ if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 39, col 26.
write('''/distro_list" class="menu">Distros</a></li>
<li><a href="''')
- _v = VFFSL(SL,"base_url",True) # '$base_url' on line 36, col 26
- if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 36, col 26.
+ _v = VFFSL(SL,"base_url",True) # '$base_url' on line 40, col 26
+ if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 40, col 26.
write('''/profile_list" class="menu">Profiles</a></li>
<li><a href="''')
- _v = VFFSL(SL,"base_url",True) # '$base_url' on line 37, col 26
- if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 37, col 26.
+ _v = VFFSL(SL,"base_url",True) # '$base_url' on line 41, col 26
+ if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 41, col 26.
write('''/system_list" class="menu">Systems</a></li>
<li><a href="''')
- _v = VFFSL(SL,"base_url",True) # '$base_url' on line 38, col 26
- if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 38, col 26.
+ _v = VFFSL(SL,"base_url",True) # '$base_url' on line 42, col 26
+ if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 42, col 26.
write('''/ksfile_list" class="menu">Kickstarts</a></li>
<li><a href="''')
- _v = VFFSL(SL,"base_url",True) # '$base_url' on line 39, col 26
- if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 39, col 26.
+ _v = VFFSL(SL,"base_url",True) # '$base_url' on line 43, col 26
+ if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 43, col 26.
write('''/repo_list" class="menu">Repos</a></li>
<li><hr/></li>
<li>ADD</li>
<li><a href="''')
- _v = VFFSL(SL,"base_url",True) # '$base_url' on line 42, col 26
- if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 42, col 26.
+ _v = VFFSL(SL,"base_url",True) # '$base_url' on line 46, col 26
+ if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 46, col 26.
write('''/distro_edit" class="menu">Distro</a></li>
<li><a href="''')
- _v = VFFSL(SL,"base_url",True) # '$base_url' on line 43, col 26
- if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 43, col 26.
+ _v = VFFSL(SL,"base_url",True) # '$base_url' on line 47, col 26
+ if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 47, col 26.
write('''/profile_edit" class="menu">Profile</a></li>
<li><a href="''')
- _v = VFFSL(SL,"base_url",True) # '$base_url' on line 44, col 26
- if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 44, col 26.
+ _v = VFFSL(SL,"base_url",True) # '$base_url' on line 48, col 26
+ if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 48, col 26.
write('''/subprofile_edit" class="menu">Subprofile</a></li>
<li><a href="''')
- _v = VFFSL(SL,"base_url",True) # '$base_url' on line 45, col 26
- if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 45, col 26.
+ _v = VFFSL(SL,"base_url",True) # '$base_url' on line 49, col 26
+ if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 49, col 26.
write('''/system_edit" class="menu">System</a></li>
<li><a href="''')
- _v = VFFSL(SL,"base_url",True) # '$base_url' on line 46, col 26
- if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 46, col 26.
+ _v = VFFSL(SL,"base_url",True) # '$base_url' on line 50, col 26
+ if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 50, col 26.
write('''/repo_edit" class="menu">Repo</a></li>
<li><hr/><br/></li>
<li><a class="button sync" href="''')
- _v = VFFSL(SL,"base_url",True) # '$base_url' on line 48, col 46
- if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 48, col 46.
+ _v = VFFSL(SL,"base_url",True) # '$base_url' on line 52, col 46
+ if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 52, col 46.
write('''/sync">Sync</a></li>
''')
write('''
diff --git a/setup.py b/setup.py
index 4e2a7e3..87fcd39 100644
--- a/setup.py
+++ b/setup.py
@@ -155,7 +155,10 @@ if __name__ == "__main__":
(wwwgfx, ['docs/cobbler.html']),
(wwwgfx, []),
(wwwgfx, ['webui_content/icon_16_sync.png']),
- (wwwgfx, ['webui_content/showhide.js']),
+ (wwwgfx, ['webui_content/list-expand.png']),
+ (wwwgfx, ['webui_content/list-collapse.png']),
+ (wwwgfx, ['webui_content/list-parent.png']),
+ (wwwgfx, ['webui_content/cobbler.js']),
(wwwgfx, ['webui_content/style.css']),
(wwwgfx, ['webui_content/logo-cobbler.png']),
(wwwgfx, ['webui_content/cobblerweb.css']),
diff --git a/webui_content/showhide.js b/webui_content/cobbler.js
index d2f39e1..0680576 100644
--- a/webui_content/showhide.js
+++ b/webui_content/cobbler.js
@@ -1,9 +1,13 @@
-// Javascript code by Máirín Duffy <duffy@redhat.com>
+function global_onload() {
+ if (page_onload) {
+ page_onload();
+ }
+}
-IMAGE_COLLAPSED_PATH = '/img/list-expand.gif';
-IMAGE_EXPANDED_PATH = '/img/list-collapse.gif';
-IMAGE_CHILDLESS_PATH = '/img/rhn-bullet-parentchannel.gif';
+IMAGE_COLLAPSED_PATH = '/cobbler/webui/list-expand.png';
+IMAGE_EXPANDED_PATH = '/cobbler/webui/list-collapse.png';
+IMAGE_CHILDLESS_PATH = '/cobbler/webui/list-parent.png';
var rowHash = new Array();
var browserType;
@@ -26,7 +30,10 @@ function onLoadStuff(columns) {
function iconifyChildlessParents(rowHash) {
for (var i in rowHash) {
- if (!rowHash[i].hasChildren && rowHash[i].image) { rowHash[i].image.src = IMAGE_CHILDLESS_PATH; }
+ if (!rowHash[i].hasChildren && rowHash[i].image) {
+ // FIXME: not needed in this implementation
+ // rowHash[i].image.src = IMAGE_CHILDLESS_PATH;
+ }
}
}
@@ -78,7 +85,8 @@ function Row(cells, image) {
this.image.src = IMAGE_COLLAPSED_PATH;
// we start with columnsPerRow, because we want to skip the td cells of the parent tr.
for (var i = columnsPerRow; i < this.cells.length; i++) {
- this.cells[i].parentNode.style.display = 'none';
+ // FIXME: this looks suspicious
+ // this.cells[i].parentNode.style.display = 'none';
this.cells[i].style.display = 'none';
}
this.isHidden = 1;
@@ -91,7 +99,8 @@ function Row(cells, image) {
for (var i = 0; i < this.cells.length; i++) {
this.cells[i].style.display = displayType;
- this.cells[i].parentNode.style.display = displayType;
+ // FIXME: also suspicious
+ // this.cells[i].parentNode.style.display = displayType;
}
this.isHidden = 0;
return;
@@ -146,11 +155,17 @@ function getNodeTagName(node) {
return tagName.toLowerCase();
}
+// note: parent detection seems to work fine
+// all items are parents if they have an id except if they start with child
function isParentRowNode(node) {
var nodeInLowercase = getNodeTagName(node);
if (nodeInLowercase != 'tr') { return 0; }
nodeId = node.id;
- if ((nodeId.indexOf('id')) && !(nodeId.indexOf('child'))) { return 0; }
+ if ((nodeId.indexOf('id')) && !(nodeId.indexOf('child'))) {
+ //alert("row id: " + nodeId + " is not a parent");
+ return 0;
+ }
+ //alert("row id: " + nodeId + "IS A PARENT");
return 1;
}
@@ -189,3 +204,4 @@ function findRowImageFromCells(cells, id) {
}
return null;
}
+
diff --git a/webui_content/list-collapse.png b/webui_content/list-collapse.png
new file mode 100644
index 0000000..6b8361e
--- /dev/null
+++ b/webui_content/list-collapse.png
Binary files differ
diff --git a/webui_content/list-expand.png b/webui_content/list-expand.png
new file mode 100644
index 0000000..c541e6e
--- /dev/null
+++ b/webui_content/list-expand.png
Binary files differ
diff --git a/webui_content/list-parent.png b/webui_content/list-parent.png
new file mode 100644
index 0000000..46ad8a0
--- /dev/null
+++ b/webui_content/list-parent.png
Binary files differ
diff --git a/webui_templates/master.tmpl b/webui_templates/master.tmpl
index b5b1fcf..58ecdfa 100644
--- a/webui_templates/master.tmpl
+++ b/webui_templates/master.tmpl
@@ -7,9 +7,13 @@
<link rel="stylesheet" type="text/css" media="all" href="/cobbler/webui/style.css" />
<link rel="stylesheet" type="text/css" media="all" href="/cobbler/webui/cobblerweb.css" />
+
+<script language="Javascript" src="/cobbler/webui/cobbler.js" ></script>
+
</head>
-<body>
+
+<body onload="global_onload();">
<div id="wrap">
<h1 id="masthead">
diff --git a/webui_templates/system_edit.tmpl b/webui_templates/system_edit.tmpl
index 65310ae..e101832 100644
--- a/webui_templates/system_edit.tmpl
+++ b/webui_templates/system_edit.tmpl
@@ -1,10 +1,7 @@
#extends cobbler.webui.master
-
#block body
-<script language=javascript" src="/cobbler/webui/showhide.js"/>
-
<script language="javascript">
#if $system
@@ -52,6 +49,34 @@ function get_random_mac()
#set $defined_interfaces = [ "intf0" ]
#end if
+###
+### here's a list of all the NIC fields we use
+###
+### FIXME: add gateway, subnet, and any other missing fields
+
+#set $fields = [ "mac", "ip", "hostname", "dhcptag"]
+
+
+###
+### now generate the onload function.
+###
+
+<script language="javascript">
+
+function page_onload() {
+
+ onLoadStuff(1);
+ hideAllRows();
+ #set counter = 0
+ #for $interface in $all_interfaces
+ #if $interface in $defined_interfaces
+ toggleRowVisibility("id${counter}");
+ #end if
+ #set $counter = $counter+1
+ #end for
+
+}
+</script>
<form method="post" action="$base_url/system_save">
<fieldset id="cform">
@@ -65,9 +90,10 @@ function get_random_mac()
<legend>Edit a System</legend>
- <table border=0>
+ ## FIXME: this ID doesn't make sense but it's there for the javascript
+ <table border=0 id="channel-list">
- <tr>
+ <tr id="id9000">
<td>
<label for="name">System Name</label>
</td>
@@ -86,7 +112,7 @@ function get_random_mac()
</tr>
#if $system
- <tr>
+ <tr id="id9001">
<td>
<label for="mode">Edit Mode</label>
</td>
@@ -99,7 +125,7 @@ function get_random_mac()
</tr>
#end if
- <tr>
+ <tr id="id9002">
<td>
<label for="profile">Profile</label>
</td>
@@ -119,19 +145,9 @@ function get_random_mac()
## ====================================== start of looping through interfaces
+ #set $counter = -1
#for $interface in $all_interfaces
-
- ## ----------------------------------
- ## calculate some initial CSS visibility
- ## ----------------------------------
-
- #if $interface in $defined_interfaces
- #set $toggler_visibile = "hidden"
- #set $panel_visibile = "visible"
- #else
- #set $toggler_visibile = "visible"
- #set $panel_visibile = "hidden"
- #end if
+ #set $counter = $counter+1
## ----------------------------------
## load up initial variable values
@@ -159,32 +175,34 @@ function get_random_mac()
## render the toggle link to hide the interfaces not yet defined
## ----------------------------------------
- ## FIXME: these tables need CSS classes, don't they?
- <tr class="listrow" id="$interface">
+ <tr class="listrow" id="1000${counter}">
<td>
- <label>Interface ($interface)
+ <label><hr width="95%"/></label>
</td>
<td>
- <hr width="95%">
+ <hr width="95%"/>
</td>
</tr>
- <tr class="listrow" id="toggle_$interface">
+##
+##<td><a onclick="toggleRowVisibility('id263');" style="cursor: pointer;"><img name="id263-image" src="/img/list-expand.gif" alt=""/></a><a href="/network/software/channels/details.pxt?cid=263">Red Hat Enterprise Linux (v. 5 for 32-bit x86)</a></td>
+##
+
+ <tr class="listrow" id="id${counter}">
<td>
- <label>Expand</label>
+ Interface $interface
</td>
<td>
- <A href="javascript:void('')" onclick="show_interface('$interface');">Click to expand $interface</A>
+ <a onclick="toggleRowVisibility('id${counter}');" style="cursor: pointer;"><img name="id${counter}-image" src="/cobbler/webui/list-expand.png" alt=""/></A>
</td>
</tr>
-
## ----------------------------------------
## now show all of the interface fields which may or may not
## be hidden but are always there
## ----------------------------------------
- <tr class="listrow" id="panel_${interface}_mac">
+ <tr class="listrow" id="child-id${counter}-0">
<td>
<label for="mac-$interface">MAC</label>
</td>
@@ -199,7 +217,7 @@ function get_random_mac()
</td>
</tr>
- <tr class="listrow" id="panel_${interface}_ip">
+ <tr class="listrow" id="child-id${counter}-1">
<td>
<label for="ip-$interface">IP</label>
</td>
@@ -211,7 +229,7 @@ function get_random_mac()
</td>
</tr>
- <tr class="listrow" id="panel_${interface}_hostname">
+ <tr class="listrow" id="child-id${counter}-3">
<td>
<label for="hostname-$interface">Hostname</label>
</td>
@@ -223,7 +241,7 @@ function get_random_mac()
</td>
</tr>
- <tr class="listrow" id="panel_${interface}_dhcptag">
+ <tr class="listrow" id="child-id${counter}-4">
<td>
<label for="dhcptag-$interface">DHCP Tag</label>
</td>
@@ -251,7 +269,7 @@ function get_random_mac()
## restart the table that we un-started for the DIVs
- <tr>
+ <tr id="id9004">
<td>
<label for="kopts">Kernel Options</label>
</td>
@@ -265,7 +283,7 @@ function get_random_mac()
</td>
</tr>
- <tr>
+ <tr id="id9005">
<td>
<label for="ksmeta">Kickstart Metadata</label>
</td>
@@ -279,7 +297,7 @@ function get_random_mac()
</td>
</tr>
- <tr>
+ <tr id="id9006">
<td>
<label for="netboot">Netboot Enabled</label>
</td>
@@ -294,7 +312,7 @@ function get_random_mac()
</tr>
#if $system
- <tr>
+ <tr id="id9007">
<td>
<label for="delete">Delete</label>
</td>
@@ -306,7 +324,7 @@ function get_random_mac()
</tr>
#end if
- <tr>
+ <tr id="9008">
<td>
</td>
<td>