From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci/storage cylinder_select.js
Date: 25 Sep 2007 03:49:51 -0000 [thread overview]
Message-ID: <20070925034951.6553.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2007-09-25 03:49:50
Added files:
luci/storage : cylinder_select.js
Log message:
Javascript code for selecting parts of the storage cylinder display
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/storage/cylinder_select.js.diff?cvsroot=cluster&r1=NONE&r2=1.1
/cvs/cluster/conga/luci/storage/cylinder_select.js,v --> standard output
revision 1.1
--- conga/luci/storage/cylinder_select.js
+++ - 2007-09-25 03:49:51.046752000 +0000
@@ -0,0 +1,118 @@
+/*
+** 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 properties_span_id = '';
+var current_selection = '';
+var ellipse_dict = [ 2, 3, 4, 5, 5, 6, 6, 7, 7, 7, 8, 8, 8, 8 ];
+
+function ellipse(y) {
+ if (y > 26)
+ return ellipse(40 - y);
+ if (y > 13)
+ return 9;
+ return ellipse_dict[y];
+}
+
+function select_subcyl(id, h_data) {
+ var old_selection = current_selection;
+ unselect_cyl(old_selection, h_data);
+ if (id == old_selection)
+ current_selection = h_data[0][0];
+ else
+ current_selection = id;
+ display_props(h_data);
+}
+
+function unselect_cyl(id, h_data) {
+ for (var i = 0 ; i < h_data.length ; i++) {
+ var t_id = h_data[i][0];
+ if (t_id == id) {
+ var list = h_data[i][1];
+ for (var j = 0 ; j < list.length ; j++) {
+ var el = document.getElementById(list[j]);
+ if (el)
+ el.className = 'invisible';
+ }
+ }
+ }
+ current_selection = '';
+}
+
+function display_props(h_data) {
+ for (var i = 0 ; i < h_data.length ; i++) {
+ var id = h_data[i][0];
+ if (id == current_selection) {
+ var list = h_data[i][1];
+ for (var j = 0; j < list.length ; j++) {
+ var el = document.getElementById(list[j]);
+ el.className = 'visible';
+ }
+ }
+ }
+
+ parent = top.document.getElementById(properties_span_id);
+
+ for (var i = 0 ; i < parent.childNodes.length ; i++) {
+ var item = parent.childNodes[i];
+ var item_type = item.nodeName.lower();
+ if (item_type == 'span' || item.type == 'div') {
+ if (item.id == current_selection) {
+ item.className = 'visible';
+ } else if (item.className == 'visible') {
+ item.className = 'invisible';
+ }
+ }
+ }
+}
+
+function cyl_click(X, Y, c_data, h_data) {
+ if (Y < 0 || Y > 40) {
+ return;
+ }
+
+ var x = X - ellipse(Y);
+ var y = Y;
+
+ for (var i = 0 ; i < c_data.length ; i++) {
+ var elem = c_data[i];
+ var id = elem[0];
+ var beg = elem[1][0];
+ var end = elem[1][1];
+ if (x > beg && x < end) {
+ select_subcyl(id, h_data);
+ }
+ }
+}
+
+function cyl_over(msg_board, X, Y, c_data, h_data) {
+ if (Y < 0 || Y > 40) {
+ msg_board.style.visibility = 'invisible';
+ return;
+ }
+
+ var x = X - ellipse(Y);
+ var y = Y;
+
+ for (var i = 0 ; i < c_data.length ; i++) {
+ var elem = c_data[i];
+ var beg = elem[1][0];
+ var end = elem[1][1];
+
+ if (x > beg && x < end) {
+ var descr = elem[2];
+ msg_board.innerHTML = descr;
+ msg_board.style.width = (descr.length + 1) + 'ex';
+ msg_board.style.left = X - 35;
+ msg_board.style.top = Y + 15;
+ msg_board.style.visibility = 'visible';
+ return;
+ }
+ }
+ msg_board.style.visibility = 'invisible';
+}
reply other threads:[~2007-09-25 3:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070925034951.6553.qmail@sourceware.org \
--to=rmccabe@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.