r4583 - trunk/cumin/python/cumin/grid
by eallen@fedoraproject.org
Author: eallen
Date: 2011-03-08 21:36:16 +0000 (Tue, 08 Mar 2011)
New Revision: 4583
Modified:
trunk/cumin/python/cumin/grid/negotiator.py
Log:
Added a class that will return the youngest negotiator for a pool
Modified: trunk/cumin/python/cumin/grid/negotiator.py
===================================================================
--- trunk/cumin/python/cumin/grid/negotiator.py 2011-03-08 21:35:03 UTC (rev 4582)
+++ trunk/cumin/python/cumin/grid/negotiator.py 2011-03-08 21:36:16 UTC (rev 4583)
@@ -437,3 +437,29 @@
negotiator = self.frame.negotiator_attribute.get(osession)
self.form.negotiator.set(session, negotiator)
+
+class NegotiatorAttribute(Attribute):
+ def __init__(self, app, name, collector):
+ super(NegotiatorAttribute, self).__init__(app, name)
+
+ self.collector = collector
+
+ def get(self, session):
+ negotiator = super(NegotiatorAttribute, self).get(session)
+ if not negotiator:
+ cls = self.app.model.com_redhat_grid.Negotiator
+
+ pool = self.collector.get(session)
+ if pool:
+ negotiators = cls.get_selection(session.cursor, Pool=pool.Pool)
+ # use the most recently updated one if there are multiple
+ if len(negotiators) > 0:
+ recent_negotiator = negotiators[0]
+ for neg in negotiators:
+ if neg._qmf_update_time > \
+ recent_negotiator._qmf_update_time:
+ recent_negotiator = neg
+ self.set(session, recent_negotiator)
+ negotiator = recent_negotiator
+ return negotiator
+
13 years, 3 months
r4582 - trunk/cumin/resources
by eallen@fedoraproject.org
Author: eallen
Date: 2011-03-08 21:35:03 +0000 (Tue, 08 Mar 2011)
New Revision: 4582
Added:
trunk/cumin/resources/body.png
trunk/cumin/resources/chart-20.png
trunk/cumin/resources/closebtn.gif
trunk/cumin/resources/full.png
Log:
Added preliminary version of graphics for displaying a popup div and the chart icon
Added: trunk/cumin/resources/body.png
===================================================================
(Binary files differ)
Property changes on: trunk/cumin/resources/body.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/cumin/resources/chart-20.png
===================================================================
(Binary files differ)
Property changes on: trunk/cumin/resources/chart-20.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/cumin/resources/closebtn.gif
===================================================================
(Binary files differ)
Property changes on: trunk/cumin/resources/closebtn.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/cumin/resources/full.png
===================================================================
(Binary files differ)
Property changes on: trunk/cumin/resources/full.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
13 years, 3 months
r4581 - trunk/wooly/resources
by eallen@fedoraproject.org
Author: eallen
Date: 2011-03-08 21:33:47 +0000 (Tue, 08 Mar 2011)
New Revision: 4581
Modified:
trunk/wooly/resources/mootools.js
Log:
Added javascript to display a popup div whose content comes from an ajax call
Modified: trunk/wooly/resources/mootools.js
===================================================================
--- trunk/wooly/resources/mootools.js 2011-03-08 21:32:46 UTC (rev 4580)
+++ trunk/wooly/resources/mootools.js 2011-03-08 21:33:47 UTC (rev 4581)
@@ -563,6 +563,47 @@
/*
---
+script: Class.Refactor.js
+
+name: Class.Refactor
+
+description: Extends a class onto itself with new property, preserving any items attached to the class's namespace.
+
+license: MIT-style license
+
+authors:
+ - Aaron Newton
+
+requires:
+ - Core/Class
+ - /MooTools.More
+
+# Some modules declare themselves dependent on Class.Refactor
+provides: [Class.refactor, Class.Refactor]
+
+...
+*/
+
+Class.refactor = function(original, refactors){
+
+ $each(refactors, function(item, name){
+ var origin = original.prototype[name];
+ if (origin && (origin = origin._origin ? origin._origin: origin) && typeof item == 'function') original.implement(name, function(){
+ var old = this.previous;
+ this.previous = origin;
+ var value = item.apply(this, arguments);
+ this.previous = old;
+ return value;
+ }); else original.implement(name, item);
+ });
+
+ return original;
+
+};
+
+/*
+---
+
script: Class.Binds.js
description: Automagically binds specified methods in a class to the instance of the class.
@@ -3994,4 +4035,1070 @@
Fx.Reveal.implement({
hideInputs: Browser.Engine.trident ? 'select, input, textarea, object, embed, .overTxtLabel' : false
});
-}
\ No newline at end of file
+}
+
+/* Clientcide Copyright (c) 2006-2009, http://www.clientcide.com/wiki/cnet-libraries#license*/
+
+//Contents: Clientcide, Class.ToElement, dbug, StyleWriter, StickyWin, StickyWin.Fx, StickyWin.Modal, StickyWin.UI, StickyWin.Ajax
+
+//This lib: http://www.clientcide.com/js/build.php?excludeLibs[]=mootools-core&exclud...
+
+/*
+Script: Clientcide.js
+ The Clientcide namespace.
+
+License:
+ http://www.clientcide.com/wiki/cnet-libraries#license
+*/
+var Clientcide = {
+ version: '%build%',
+ assetLocation: "http://github.com/anutron/clientcide/raw/master/Assets",
+ setAssetLocation: function(baseHref) {
+ Clientcide.assetLocation = baseHref;
+ if (Clientcide.preloaded) Clientcide.preLoadCss();
+ },
+ preLoadCss: function(){
+ if (window.StickyWin && StickyWin.ui) StickyWin.ui();
+ if (window.StickyWin && StickyWin.pointy) StickyWin.pointy();
+ Clientcide.preloaded = true;
+ return true;
+ },
+ preloaded: false
+};
+(function(){
+ if (!window.addEvent) return;
+ var preload = function(){
+ if (window.dbug) dbug.log('preloading clientcide css');
+ if (!Clientcide.preloaded) Clientcide.preLoadCss();
+ };
+ window.addEvent('domready', preload);
+ window.addEvent('load', preload);
+})();
+setCNETAssetBaseHref = Clientcide.setAssetLocation;/*
+Script: ToElement.js
+ Defines the toElement method for a class.
+
+License:
+ http://www.clientcide.com/wiki/cnet-libraries#license
+*/
+Class.ToElement = new Class({
+ toElement: function(){
+ return this.element;
+ }
+});
+var ToElement = Class.ToElement;/*
+Script: dbug.js
+ A wrapper for Firebug console.* statements.
+
+License:
+ http://www.clientcide.com/wiki/cnet-libraries#license
+*/
+var dbug = {
+ logged: [],
+ timers: {},
+ firebug: false,
+ enabled: false,
+ log: function() {
+ dbug.logged.push(arguments);
+ },
+ nolog: function(msg) {
+ dbug.logged.push(arguments);
+ },
+ time: function(name){
+ dbug.timers[name] = new Date().getTime();
+ },
+ timeEnd: function(name){
+ if (dbug.timers[name]) {
+ var end = new Date().getTime() - dbug.timers[name];
+ dbug.timers[name] = false;
+ dbug.log('%s: %s', name, end);
+ } else dbug.log('no such timer: %s', name);
+ },
+ enable: function(silent) {
+ var con = window.firebug ? firebug.d.console.cmd : window.console;
+
+ if((!!window.console && !!window.console.warn) || window.firebug) {
+ try {
+ dbug.enabled = true;
+ dbug.log = function(){
+ try {
+ (con.debug || con.log).apply(con, arguments);
+ } catch(e) {
+ console.log(Array.slice(arguments));
+ }
+ };
+ dbug.time = function(){
+ con.time.apply(con, arguments);
+ };
+ dbug.timeEnd = function(){
+ con.timeEnd.apply(con, arguments);
+ };
+ if(!silent) dbug.log('enabling dbug');
+ for(var i=0;i<dbug.logged.length;i++){ dbug.log.apply(con, dbug.logged[i]); }
+ dbug.logged=[];
+ } catch(e) {
+ dbug.enable.delay(400);
+ }
+ }
+ },
+ disable: function(){
+ if(dbug.firebug) dbug.enabled = false;
+ dbug.log = dbug.nolog;
+ dbug.time = function(){};
+ dbug.timeEnd = function(){};
+ },
+ cookie: function(set){
+ var value = document.cookie.match('(?:^|;)\\s*jsdebug=([^;]*)');
+ var debugCookie = value ? unescape(value[1]) : false;
+ if((!$defined(set) && debugCookie != 'true') || ($defined(set) && set)) {
+ dbug.enable();
+ dbug.log('setting debugging cookie');
+ var date = new Date();
+ date.setTime(date.getTime()+(24*60*60*1000));
+ document.cookie = 'jsdebug=true;expires='+date.toGMTString()+';path=/;';
+ } else dbug.disableCookie();
+ },
+ disableCookie: function(){
+ dbug.log('disabling debugging cookie');
+ document.cookie = 'jsdebug=false;path=/;';
+ }
+};
+
+(function(){
+ var fb = !!window.console || !!window.firebug;
+ var con = window.firebug ? window.firebug.d.console.cmd : window.console;
+ var debugMethods = ['debug','info','warn','error','assert','dir','dirxml'];
+ var otherMethods = ['trace','group','groupEnd','profile','profileEnd','count'];
+ function set(methodList, defaultFunction) {
+ for(var i = 0; i < methodList.length; i++){
+ dbug[methodList[i]] = (fb && con[methodList[i]])?con[methodList[i]]:defaultFunction;
+ }
+ };
+ set(debugMethods, dbug.log);
+ set(otherMethods, function(){});
+})();
+if ((!!window.console && !!window.console.warn) || window.firebug){
+ dbug.firebug = true;
+ var value = document.cookie.match('(?:^|;)\\s*jsdebug=([^;]*)');
+ var debugCookie = value ? unescape(value[1]) : false;
+ if(window.location.href.indexOf("jsdebug=true")>0 || debugCookie=='true') dbug.enable();
+ if(debugCookie=='true')dbug.log('debugging cookie enabled');
+ if(window.location.href.indexOf("jsdebugCookie=true")>0){
+ dbug.cookie();
+ if(!dbug.enabled)dbug.enable();
+ }
+ if(window.location.href.indexOf("jsdebugCookie=false")>0)dbug.disableCookie();
+}/*
+Script: StyleWriter.js
+
+Provides a simple method for injecting a css style element into the DOM if it's not already present.
+
+License:
+ http://www.clientcide.com/wiki/cnet-libraries#license
+*/
+
+var StyleWriter = new Class({
+ createStyle: function(css, id) {
+ window.addEvent('domready', function(){
+ try {
+ if (document.id(id) && id) return;
+ var style = new Element('style', {id: id||''}).inject($$('head')[0]);
+ if (Browser.Engine.trident) style.styleSheet.cssText = css;
+ else style.set('text', css);
+ }catch(e){dbug.log('error: %s',e);}
+ }.bind(this));
+ }
+});/*
+Script: StickyWin.js
+
+Creates a div within the page with the specified contents at the location relative to the element you specify; basically an in-page popup maker.
+
+License:
+ http://www.clientcide.com/wiki/cnet-libraries#license
+*/
+
+
+var StickyWin = new Class({
+ Binds: ['destroy', 'hide', 'togglepin', 'esc'],
+ Implements: [Options, Events, StyleWriter, Class.ToElement],
+ options: {
+// onDisplay: $empty,
+// onClose: $empty,
+// onDestroy: $empty,
+ closeClassName: 'closeSticky',
+ pinClassName: 'pinSticky',
+ content: '',
+ zIndex: 10000,
+ className: '',
+// id: ... set above in initialize function
+/* these are the defaults for Element.position anyway
+ ************************************************
+ edge: false, //see Element.position
+ position: 'center', //center, corner == upperLeft, upperRight, bottomLeft, bottomRight
+ offset: {x:0,y:0},
+ relativeTo: document.body, */
+ width: false,
+ height: false,
+ timeout: -1,
+ allowMultipleByClass: true,
+ allowMultiple: true,
+ showNow: true,
+ useIframeShim: true,
+ iframeShimSelector: '',
+ destroyOnClose: false,
+ closeOnClickOut: false,
+ closeOnEsc: false,
+ getWindowManager: function(){ return StickyWin.WM; }
+ },
+
+ css: '.SWclearfix:after {content: "."; display: block; height: 0; clear: both; visibility: hidden;}'+
+ '.SWclearfix {display: inline-table;} * html .SWclearfix {height: 1%;} .SWclearfix {display: block;}',
+
+ initialize: function(options){
+ this.options.inject = this.options.inject || {
+ target: document.body,
+ where: 'bottom'
+ };
+ this.setOptions(options);
+ this.windowManager = this.options.getWindowManager();
+ this.id = this.options.id || 'StickyWin_'+new Date().getTime();
+ this.makeWindow();
+ if (this.windowManager) this.windowManager.add(this);
+
+ if (this.options.content) this.setContent(this.options.content);
+ if (this.options.timeout > 0) {
+ this.addEvent('onDisplay', function(){
+ this.hide.delay(this.options.timeout, this);
+ }.bind(this));
+ }
+ //add css for clearfix
+ this.createStyle(this.css, 'StickyWinClearFix');
+ if (this.options.closeOnClickOut || this.options.closeOnEsc) this.attach();
+ if (this.options.destroyOnClose) this.addEvent('close', this.destroy);
+ if (this.options.showNow) this.show();
+ },
+ attach: function(attach){
+ var method = $pick(attach, true) ? 'addEvents' : 'removeEvents';
+ var events = {};
+ if (this.options.closeOnClickOut) events.click = this.esc;
+ if (this.options.closeOnEsc) events.keyup = this.esc;
+ document[method](events);
+ },
+ esc: function(e) {
+ if (e.key == "esc") this.hide();
+ if (e.type == "click" && this.element != e.target && !this.element.hasChild(e.target)) this.hide();
+ },
+ makeWindow: function(){
+ this.destroyOthers();
+ if (!document.id(this.id)) {
+ this.win = new Element('div', {
+ id: this.id
+ }).addClass(this.options.className).addClass('StickyWinInstance').addClass('SWclearfix').setStyles({
+ display:'none',
+ position:'absolute',
+ zIndex:this.options.zIndex
+ }).inject(this.options.inject.target, this.options.inject.where).store('StickyWin', this);
+ } else this.win = document.id(this.id);
+ this.element = this.win;
+ if (this.options.width && $type(this.options.width.toInt())=="number") this.win.setStyle('width', this.options.width.toInt());
+ if (this.options.height && $type(this.options.height.toInt())=="number") this.win.setStyle('height', this.options.height.toInt());
+ return this;
+ },
+ show: function(suppressEvent){
+ this.showWin();
+ if (!suppressEvent) this.fireEvent('display');
+ if (this.options.useIframeShim) this.showIframeShim();
+ this.visible = true;
+ return this;
+ },
+ showWin: function(){
+ if (this.windowManager) this.windowManager.focus(this);
+ if (!this.positioned) this.position();
+ this.win.show();
+ },
+ hide: function(suppressEvent){
+ if ($type(suppressEvent) == "event" || !suppressEvent) this.fireEvent('close');
+ this.hideWin();
+ if (this.options.useIframeShim) this.hideIframeShim();
+ this.visible = false;
+ return this;
+ },
+ hideWin: function(){
+ this.win.setStyle('display','none');
+ },
+ destroyOthers: function() {
+ if (!this.options.allowMultipleByClass || !this.options.allowMultiple) {
+ $$('div.StickyWinInstance').each(function(sw) {
+ if (!this.options.allowMultiple || (!this.options.allowMultipleByClass && sw.hasClass(this.options.className)))
+ sw.retrieve('StickyWin').destroy();
+ }, this);
+ }
+ },
+ setContent: function(html) {
+ if (this.win.getChildren().length>0) this.win.empty();
+ if ($type(html) == "string") this.win.set('html', html);
+ else if (document.id(html)) this.win.adopt(html);
+ this.win.getElements('.'+this.options.closeClassName).each(function(el){
+ el.addEvent('click', this.hide);
+ }, this);
+ this.win.getElements('.'+this.options.pinClassName).each(function(el){
+ el.addEvent('click', this.togglepin);
+ }, this);
+ return this;
+ },
+ position: function(options){
+ this.positioned = true;
+ this.setOptions(options);
+ this.win.position({
+ allowNegative: $pick(this.options.allowNegative, this.options.relativeTo != document.body),
+ relativeTo: this.options.relativeTo,
+ position: this.options.position,
+ offset: this.options.offset,
+ edge: this.options.edge
+ });
+ if (this.shim) this.shim.position();
+ return this;
+ },
+ pin: function(pin) {
+ if (!this.win.pin) {
+ dbug.log('you must include element.pin.js!');
+ return this;
+ }
+ this.pinned = $pick(pin, true);
+ this.win.pin(pin);
+ return this;
+ },
+ unpin: function(){
+ return this.pin(false);
+ },
+ togglepin: function(){
+ return this.pin(!this.pinned);
+ },
+ makeIframeShim: function(){
+ if (!this.shim){
+ var el = (this.options.iframeShimSelector)?this.win.getElement(this.options.iframeShimSelector):this.win;
+ this.shim = new IframeShim(el, {
+ display: false,
+ name: 'StickyWinShim'
+ });
+ }
+ },
+ showIframeShim: function(){
+ if (this.options.useIframeShim) {
+ this.makeIframeShim();
+ this.shim.show();
+ }
+ },
+ hideIframeShim: function(){
+ if (this.shim) this.shim.hide();
+ },
+ destroy: function(){
+ if (this.windowManager) this.windowManager.remove(this);
+ if (this.win) this.win.destroy();
+ if (this.options.useIframeShim && this.shim) this.shim.destroy();
+ if (document.id('modalOverlay')) document.id('modalOverlay').destroy();
+ this.fireEvent('destroy');
+ }
+});
+
+StickyWin.Stacker = new Class({
+ Implements: [Options, Events],
+ Binds: ['click'],
+ instances: [],
+ options: {
+ zIndexBase: 9000
+ },
+ initialize: function(options) {
+ this.setOptions(options);
+ this.zIndex = this.options.zIndex;
+ },
+ add: function(sw) {
+ this.instances.include(sw);
+ $(sw).addEvent('mousedown', this.click);
+ },
+ click: function(e) {
+ this.instances.each(function(sw){
+ var el = $(sw);
+ if (el == e.target || el.hasChild($(e.target))) this.focus(sw);
+ }, this);
+ },
+ focus: function(instance){
+ if (this.focused == instance) return;
+ this.focused = instance;
+ if (instance) this.instances.erase(instance).push(instance);
+ this.instances.each(function(current, i){
+ $(current).setStyle('z-index', this.options.zIndexBase + i);
+ }, this);
+ this.focused = instance;
+ },
+ remove: function(sw) {
+ this.instances.erase(sw);
+ $(sw).removeEvent('click', this.click);
+ }
+});
+StickyWin.WM = new StickyWin.Stacker();/*
+Script: StickyWin.Fx.js
+
+ Extends StickyWin to create popups that fade in and out.
+
+ License:
+ MIT-style license.
+
+ Authors:
+ Aaron Newton
+*/
+
+/*
+Script: StickyWin.Fx.js
+
+Extends StickyWin to create popups that fade in and out and can be dragged and resized (requires StickyWin.Fx.Drag.js).
+
+License:
+ http://www.clientcide.com/wiki/cnet-libraries#license
+*/
+StickyWin = Class.refactor(StickyWin, {
+ options: {
+ //fadeTransition: 'sine:in:out',
+ fade: true,
+ fadeDuration: 150
+ },
+ hideWin: function(){
+ if (this.options.fade) this.fade(0);
+ else this.previous();
+ },
+ showWin: function(){
+ if (this.options.fade) this.fade(1);
+ else this.previous();
+ },
+ hide: function(){
+ this.previous(this.options.fade);
+ },
+ show: function(){
+ this.previous(this.options.fade);
+ },
+ fade: function(to){
+ if (!this.fadeFx) {
+ this.win.setStyles({
+ opacity: 0,
+ display: 'block'
+ });
+ var opts = {
+ property: 'opacity',
+ duration: this.options.fadeDuration
+ };
+ if (this.options.fadeTransition) opts.transition = this.options.fadeTransition;
+ this.fadeFx = new Fx.Tween(this.win, opts);
+ }
+ if (to > 0) {
+ this.win.setStyle('display','block');
+ this.position();
+ }
+ this.fadeFx.clearChain();
+ this.fadeFx.start(to).chain(function (){
+ if (to == 0) {
+ this.win.setStyle('display', 'none');
+ this.fireEvent('onClose');
+ } else {
+ this.fireEvent('onDisplay');
+ }
+ }.bind(this));
+ return this;
+ }
+});
+StickyWin.Fx = StickyWin;/*
+Script: StickyWin.Modal.js
+
+This script extends StickyWin and StickyWin.Fx classes to add Mask functionality.
+
+License:
+ http://www.clientcide.com/wiki/cnet-libraries#license
+*/
+StickyWin.Modal = new Class({
+
+ Extends: StickyWin,
+
+ options: {
+ modalize: true,
+ maskOptions: {
+ style: {
+ 'background-color':'#333',
+ opacity:0.8
+ }
+ },
+ hideOnClick: true,
+ getWindowManager: function(){ return StickyWin.ModalWM; }
+ },
+
+ initialize: function(options) {
+ this.options.maskTarget = this.options.maskTarget || document.body;
+ this.setOptions(options);
+ this.mask = new Mask(this.options.maskTarget, this.options.maskOptions).addEvent('click', function() {
+ if (this.options.hideOnClick) this.hide();
+ }.bind(this));
+ this.parent(options);
+ },
+
+ show: function(showModal){
+ if ($pick(showModal, this.options.modalize)) this.mask.show();
+ this.parent();
+ },
+
+ hide: function(hideModal){
+ if ($pick(hideModal, true)) this.mask.hide();
+ this.parent();
+ }
+
+});
+
+StickyWin.ModalWM = new StickyWin.Stacker({
+ zIndexBase: 11000
+});
+if (StickyWin.Fx) StickyWin.Fx.Modal = StickyWin.Modal;
+
+/*
+Script: StickyWin.ui.js
+
+Creates an html holder for in-page popups using a default style.
+
+License:
+ http://www.clientcide.com/wiki/cnet-libraries#license
+*/
+StickyWin.UI = new Class({
+ Implements: [Options, Class.ToElement, StyleWriter],
+ options: {
+ width: 300,
+ css: "div.DefaultStickyWin {font-family:verdana; font-size:11px; line-height: 13px;position: relative;}"+
+ "div.DefaultStickyWin div.top{-moz-user-select: none;-khtml-user-select: none;}"+
+ "div.DefaultStickyWin div.top_ul{background:url({%baseHref%}full.png) top left no-repeat; height:30px; width:15px; float:left}"+
+ "div.DefaultStickyWin div.top_ur{position:relative; left:0px !important; left:-4px; background:url({%baseHref%}full.png) top right !important; height:30px; margin:0px 0px 0px 15px !important; margin-right:-4px; padding:0px}"+
+ "div.DefaultStickyWin h1.caption{clear: none !important; margin:0px !important; overflow: hidden; padding:0 !important; font-weight:bold; color:#555; font-size:14px !important; position:relative; top:8px !important; left:5px !important; float: left; height: 22px !important;}"+
+ "div.DefaultStickyWin div.middle, div.DefaultStickyWin div.closeBody {background:url({%baseHref%}body.png) top left repeat-y; margin:0px 20px 0px 0px !important; margin-bottom: -3px; position: relative; top: 0px !important; top: -3px;}"+
+ "div.DefaultStickyWin div.body{background:url({%baseHref%}body.png) top right repeat-y; padding:8px 23px 8px 0px !important; margin-left:5px !important; position:relative; right:-20px !important; z-index: 1;}"+
+ "div.DefaultStickyWin div.bottom{clear:both;}"+
+ "div.DefaultStickyWin div.bottom_ll{background:url({%baseHref%}full.png) bottom left no-repeat; width:15px; height:15px; float:left}"+
+ "div.DefaultStickyWin div.bottom_lr{background:url({%baseHref%}full.png) bottom right; position:relative; left:0px !important; left:-4px; margin:0px 0px 0px 15px !important; margin-right:-4px; height:15px}"+
+ "div.DefaultStickyWin div.closeButtons{text-align: center; background:url({%baseHref%}body.png) top right repeat-y; padding: 4px 30px 8px 0px; margin-left:5px; position:relative; right:-20px}"+
+ "div.DefaultStickyWin a.button:hover{background:url({%baseHref%}big_button_over.gif) repeat-x}"+
+ "div.DefaultStickyWin a.button {background:url({%baseHref%}big_button.gif) repeat-x; margin: 2px 8px 2px 8px; padding: 2px 12px; cursor:pointer; border: 1px solid #999 !important; text-decoration:none; color: #000 !important;}"+
+ "div.DefaultStickyWin div.closeButton{width:13px; height:13px; background:url({%baseHref%}closebtn.gif) no-repeat; position: absolute; right: 0px; margin:10px 15px 0px 0px !important; cursor:pointer;top:0px}"+
+ "div.DefaultStickyWin div.dragHandle { width: 11px; height: 25px; position: relative; top: 5px; left: -3px; cursor: move; background: url({%baseHref%}drag_corner.gif); float: left;}",
+ cornerHandle: false,
+ cssClass: '',
+ buttons: [],
+ cssId: 'defaultStickyWinStyle',
+ cssClassName: 'DefaultStickyWin',
+ baseHref: 'resource?name=',
+ closeButton: true
+/* These options are deprecated:
+ closeTxt: false,
+ onClose: $empty,
+ confirmTxt: false,
+ onConfirm: $empty */
+ },
+ initialize: function() {
+ var args = this.getArgs(arguments);
+ this.setOptions(args.options);
+ this.legacy();
+ var css = this.options.css.substitute({baseHref: this.options.baseHref || Clientcide.assetLocation + '/stickyWinHTML/'}, /\\?\{%([^}]+)%\}/g);
+ if (Browser.Engine.trident4) css = css.replace(/png/g, 'gif');
+ this.createStyle(css, this.options.cssId);
+ this.build();
+ if (args.caption || args.body) this.setContent(args.caption, args.body);
+ },
+ getArgs: function(){
+ return StickyWin.UI.getArgs.apply(this, arguments);
+ },
+ legacy: function(){
+ var opt = this.options; //saving bytes
+ //legacy support
+ if (opt.confirmTxt) opt.buttons.push({text: opt.confirmTxt, onClick: opt.onConfirm || $empty});
+ if (opt.closeTxt) opt.buttons.push({text: opt.closeTxt, onClick: opt.onClose || $empty});
+ },
+ build: function(){
+ var opt = this.options;
+
+ var container = new Element('div', {
+ 'class': opt.cssClassName
+ });
+ if (opt.width) container.setStyle('width', opt.width);
+ this.element = container;
+ this.element.store('StickyWinUI', this);
+ if (opt.cssClass) container.addClass(opt.cssClass);
+
+
+ var bodyDiv = new Element('div').addClass('body');
+ this.body = bodyDiv;
+
+ var top_ur = new Element('div').addClass('top_ur');
+ this.top_ur = top_ur;
+ this.top = new Element('div').addClass('top').adopt(
+ new Element('div').addClass('top_ul')
+ ).adopt(top_ur);
+ container.adopt(this.top);
+
+ if (opt.cornerHandle) new Element('div').addClass('dragHandle').inject(top_ur, 'top');
+
+ //body
+ container.adopt(new Element('div').addClass('middle').adopt(bodyDiv));
+ //close buttons
+ if (opt.buttons.length > 0){
+ var closeButtons = new Element('div').addClass('closeButtons');
+ opt.buttons.each(function(button){
+ if (button.properties && button.properties.className){
+ button.properties['class'] = button.properties.className;
+ delete button.properties.className;
+ }
+ var properties = $merge({'class': 'closeSticky'}, button.properties);
+ new Element('a').addEvent('click', button.onClick || $empty)
+ .appendText(button.text).inject(closeButtons).set(properties).addClass('button');
+ });
+ container.adopt(new Element('div').addClass('closeBody').adopt(closeButtons));
+ }
+ //footer
+ container.adopt(
+ new Element('div').addClass('bottom').adopt(
+ new Element('div').addClass('bottom_ll')
+ ).adopt(
+ new Element('div').addClass('bottom_lr')
+ )
+ );
+ if (this.options.closeButton) container.adopt(new Element('div').addClass('closeButton').addClass('closeSticky'));
+ return this;
+ },
+ setCaption: function(caption) {
+ this.caption = caption;
+ if (!this.h1) {
+ this.makeCaption(caption);
+ } else {
+ if (document.id(caption)) this.h1.adopt(caption);
+ else this.h1.set('html', caption);
+ }
+ return this;
+ },
+ makeCaption: function(caption) {
+ if (!caption) return this.destroyCaption();
+ var opt = this.options;
+ this.h1 = new Element('h1').addClass('caption');
+ if (opt.width) this.h1.setStyle('width', (opt.width-(opt.cornerHandle?55:40)-(opt.closeButton?10:0)));
+ this.setCaption(caption);
+ this.top_ur.adopt(this.h1);
+ if (!this.options.cornerHandle) this.h1.addClass('dragHandle');
+ return this;
+ },
+ destroyCaption: function(){
+ if (this.h1) {
+ this.h1.destroy();
+ this.h1 = null;
+ }
+ return this;
+ },
+ setContent: function(){
+ var args = this.getArgs.apply(this, arguments);
+ var caption = args.caption;
+ var body = args.body;
+ this.setCaption(caption);
+ if (document.id(body)) this.body.empty().adopt(body);
+ else this.body.set('html', body);
+ return this;
+ }
+});
+StickyWin.UI.getArgs = function(){
+ var input = $type(arguments[0]) == "arguments"?arguments[0]:arguments;
+ if (Browser.Engine.presto && 1 === input.length) input = input[0];
+
+ var cap = input[0], bod = input[1];
+ var args = Array.link(input, {options: Object.type});
+ if (input.length == 3 || (!args.options && input.length == 2)) {
+ args.caption = cap;
+ args.body = bod;
+ } else if (($type(bod) == 'object' || !bod) && cap && $type(cap) != 'object'){
+ args.body = cap;
+ }
+ return args;
+};
+
+StickyWin.ui = function(caption, body, options){
+ return document.id(new StickyWin.UI(caption, body, options));
+};
+/*
+Script: StickyWin.Ajaxjs
+
+Adds ajax functionality to all the StickyWin classes.
+
+License:
+ http://www.clientcide.com/wiki/cnet-libraries#license
+*/
+(function(){
+ var SWA = function(extend){
+ return {
+ Extends: extend,
+ options: {
+ //onUpdate: $empty,
+ url: '',
+ showNow: false,
+ requestOptions: {
+ method: 'get',
+ evalScripts: true
+ },
+ wrapWithUi: false,
+ caption: '',
+ uiOptions:{},
+ handleResponse: function(response){
+ var responseScript = "";
+ this.Request.response.text.stripScripts(function(script){ responseScript += script; });
+ if (this.options.wrapWithUi) response = StickyWin.ui(this.options.caption, response, this.options.uiOptions);
+ this.setContent(response);
+ this.show();
+ if (this.evalScripts) $exec(responseScript);
+ this.fireEvent('update');
+ }
+ },
+ initialize: function(options){
+ var showNow;
+ if (options && options.showNow) {
+ showNow = true;
+ options.showNow = false;
+ }
+ this.parent(options);
+ this.evalScripts = this.options.requestOptions.evalScripts;
+ this.options.requestOptions.evalScripts = false;
+ this.createRequest();
+ if (showNow) this.update();
+ },
+ createRequest: function(){
+ this.Request = new Request(this.options.requestOptions).addEvent('onSuccess',
+ this.options.handleResponse.bind(this));
+ },
+ update: function(url, options){
+ this.Request.setOptions(options).send({url: url||this.options.url});
+ return this;
+ }
+ };
+ };
+ try { StickyWin.Ajax = new Class(SWA(StickyWin)); } catch(e){}
+ try { StickyWin.Modal.Ajax = new Class(SWA(StickyWin.Modal)); } catch(e){}
+})();
+
+/*
+---
+
+script: Mask.js
+
+description: Creates a mask element to cover another.
+
+license: MIT-style license
+
+authors:
+- Aaron Newton
+
+requires:
+- core:1.2.4/Options
+- core:1.2.4/Events
+- core:1.2.4/Element.Event
+- /Class.Binds
+- /Element.Position
+- /IframeShim
+
+provides: [Mask]
+
+...
+*/
+
+var Mask = new Class({
+
+ Implements: [Options, Events],
+
+ Binds: ['position'],
+
+ options: {
+ // onShow: $empty,
+ // onHide: $empty,
+ // onDestroy: $empty,
+ // onClick: $empty,
+ //inject: {
+ // where: 'after',
+ // target: null,
+ //},
+ // hideOnClick: false,
+ // id: null,
+ // destroyOnHide: false,
+ style: {},
+ 'class': 'mask',
+ maskMargins: false,
+ useIframeShim: true,
+ iframeShimOptions: {}
+ },
+
+ initialize: function(target, options){
+ this.target = document.id(target) || document.id(document.body);
+ this.target.store('Mask', this);
+ this.setOptions(options);
+ this.render();
+ this.inject();
+ },
+
+ render: function() {
+ this.element = new Element('div', {
+ 'class': this.options['class'],
+ id: this.options.id || 'mask-' + $time(),
+ styles: $merge(this.options.style, {
+ display: 'none'
+ }),
+ events: {
+ click: function(){
+ this.fireEvent('click');
+ if (this.options.hideOnClick) this.hide();
+ }.bind(this)
+ }
+ });
+ this.hidden = true;
+ },
+
+ toElement: function(){
+ return this.element;
+ },
+
+ inject: function(target, where){
+ where = where || this.options.inject ? this.options.inject.where : '' || this.target == document.body ? 'inside' : 'after';
+ target = target || this.options.inject ? this.options.inject.target : '' || this.target;
+ this.element.inject(target, where);
+ if (this.options.useIframeShim) {
+ this.shim = new IframeShim(this.element, this.options.iframeShimOptions);
+ this.addEvents({
+ show: this.shim.show.bind(this.shim),
+ hide: this.shim.hide.bind(this.shim),
+ destroy: this.shim.destroy.bind(this.shim)
+ });
+ }
+ },
+
+ position: function(){
+ this.resize(this.options.width, this.options.height);
+ this.element.position({
+ relativeTo: this.target,
+ position: 'topLeft',
+ ignoreMargins: !this.options.maskMargins,
+ ignoreScroll: this.target == document.body
+ });
+ return this;
+ },
+
+ resize: function(x, y){
+ var opt = {
+ styles: ['padding', 'border']
+ };
+ if (this.options.maskMargins) opt.styles.push('margin');
+ var dim = this.target.getComputedSize(opt);
+ if (this.target == document.body) {
+ var win = window.getSize();
+ if (dim.totalHeight < win.y) dim.totalHeight = win.y;
+ if (dim.totalWidth < win.x) dim.totalWidth = win.x;
+ }
+ this.element.setStyles({
+ width: $pick(x, dim.totalWidth, dim.x),
+ height: $pick(y, dim.totalHeight, dim.y)
+ });
+ return this;
+ },
+
+ show: function(){
+ if (!this.hidden) return this;
+ window.addEvent('resize', this.position);
+ this.position();
+ this.showMask.apply(this, arguments);
+ return this;
+ },
+
+ showMask: function(){
+ this.element.setStyle('display', 'block');
+ this.hidden = false;
+ this.fireEvent('show');
+ },
+
+ hide: function(){
+ if (this.hidden) return this;
+ window.removeEvent('resize', this.position);
+ this.hideMask.apply(this, arguments);
+ if (this.options.destroyOnHide) return this.destroy();
+ return this;
+ },
+
+ hideMask: function(){
+ this.element.setStyle('display', 'none');
+ this.hidden = true;
+ this.fireEvent('hide');
+ },
+
+ toggle: function(){
+ this[this.hidden ? 'show' : 'hide']();
+ },
+
+ destroy: function(){
+ this.hide();
+ this.element.destroy();
+ this.fireEvent('destroy');
+ this.target.eliminate('mask');
+ }
+
+});
+
+Element.Properties.mask = {
+
+ set: function(options){
+ var mask = this.retrieve('mask');
+ return this.eliminate('mask').store('mask:options', options);
+ },
+
+ get: function(options){
+ if (options || !this.retrieve('mask')){
+ if (this.retrieve('mask')) this.retrieve('mask').destroy();
+ if (options || !this.retrieve('mask:options')) this.set('mask', options);
+ this.store('mask', new Mask(this, this.retrieve('mask:options')));
+ }
+ return this.retrieve('mask');
+ }
+
+};
+
+Element.implement({
+
+ mask: function(options){
+ this.get('mask', options).show();
+ return this;
+ },
+
+ unmask: function(){
+ this.get('mask').hide();
+ return this;
+ }
+
+});
+
+/*
+---
+
+script: IframeShim.js
+
+description: Defines IframeShim, a class for obscuring select lists and flash objects in IE.
+
+license: MIT-style license
+
+authors:
+- Aaron Newton
+
+requires:
+- core:1.2.4/Element.Event
+- core:1.2.4/Element.Style
+- core:1.2.4/Options Events
+- /Element.Position
+- /Class.Occlude
+
+provides: [IframeShim]
+
+...
+*/
+
+var IframeShim = new Class({
+
+ Implements: [Options, Events, Class.Occlude],
+
+ options: {
+ className: 'iframeShim',
+ src: 'javascript:false;document.write("");',
+ display: false,
+ zIndex: null,
+ margin: 0,
+ offset: {x: 0, y: 0},
+ browsers: (Browser.Engine.trident4 || (Browser.Engine.gecko && !Browser.Engine.gecko19 && Browser.Platform.mac))
+ },
+
+ property: 'IframeShim',
+
+ initialize: function(element, options){
+ this.element = document.id(element);
+ if (this.occlude()) return this.occluded;
+ this.setOptions(options);
+ this.makeShim();
+ return this;
+ },
+
+ makeShim: function(){
+ if(this.options.browsers){
+ var zIndex = this.element.getStyle('zIndex').toInt();
+
+ if (!zIndex){
+ zIndex = 1;
+ var pos = this.element.getStyle('position');
+ if (pos == 'static' || !pos) this.element.setStyle('position', 'relative');
+ this.element.setStyle('zIndex', zIndex);
+ }
+ zIndex = ($chk(this.options.zIndex) && zIndex > this.options.zIndex) ? this.options.zIndex : zIndex - 1;
+ if (zIndex < 0) zIndex = 1;
+ this.shim = new Element('iframe', {
+ src: this.options.src,
+ scrolling: 'no',
+ frameborder: 0,
+ styles: {
+ zIndex: zIndex,
+ position: 'absolute',
+ border: 'none',
+ filter: 'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)'
+ },
+ 'class': this.options.className
+ }).store('IframeShim', this);
+ var inject = (function(){
+ this.shim.inject(this.element, 'after');
+ this[this.options.display ? 'show' : 'hide']();
+ this.fireEvent('inject');
+ }).bind(this);
+ if (!IframeShim.ready) window.addEvent('load', inject);
+ else inject();
+ } else {
+ this.position = this.hide = this.show = this.dispose = $lambda(this);
+ }
+ },
+
+ position: function(){
+ if (!IframeShim.ready || !this.shim) return this;
+ var size = this.element.measure(function(){
+ return this.getSize();
+ });
+ if (this.options.margin != undefined){
+ size.x = size.x - (this.options.margin * 2);
+ size.y = size.y - (this.options.margin * 2);
+ this.options.offset.x += this.options.margin;
+ this.options.offset.y += this.options.margin;
+ }
+ this.shim.set({width: size.x, height: size.y}).position({
+ relativeTo: this.element,
+ offset: this.options.offset
+ });
+ return this;
+ },
+
+ hide: function(){
+ if (this.shim) this.shim.setStyle('display', 'none');
+ return this;
+ },
+
+ show: function(){
+ if (this.shim) this.shim.setStyle('display', 'block');
+ return this.position();
+ },
+
+ dispose: function(){
+ if (this.shim) this.shim.dispose();
+ return this;
+ },
+
+ destroy: function(){
+ if (this.shim) this.shim.destroy();
+ return this;
+ }
+
+});
+
+window.addEvent('load', function(){
+ IframeShim.ready = true;
+});
+
13 years, 3 months
r4580 - trunk/wooly/python/wooly
by eallen@fedoraproject.org
Author: eallen
Date: 2011-03-08 21:32:46 +0000 (Tue, 08 Mar 2011)
New Revision: 4580
Modified:
trunk/wooly/python/wooly/table.py
trunk/wooly/python/wooly/table.strings
Log:
Added ability to make a column header static instead of a link to sort the column
Modified: trunk/wooly/python/wooly/table.py
===================================================================
--- trunk/wooly/python/wooly/table.py 2011-03-08 21:32:04 UTC (rev 4579)
+++ trunk/wooly/python/wooly/table.py 2011-03-08 21:32:46 UTC (rev 4580)
@@ -97,6 +97,7 @@
self.sortable = True
self.visible = True
self.width = None
+ self.static_header = False
def render_class(self, session):
tokens = list()
@@ -171,6 +172,19 @@
return self.parent.render_width(session)
class TableColumnHeader(TableChild):
+ def __init__(self, app, name):
+ super(TableColumnHeader, self).__init__(app, name)
+
+ self.static_tmpl = WidgetTemplate(self, "static_html")
+
+ def do_render(self, session, *args):
+ if self.parent.static_header:
+ writer = Writer()
+ self.static_tmpl.render(writer, session)
+ return writer.to_string()
+
+ return super(TableColumnHeader, self).do_render(session, *args)
+
def render_class(self, session):
cls = self.parent.render_class(session)
align = self.parent.render_text_align(session)
Modified: trunk/wooly/python/wooly/table.strings
===================================================================
--- trunk/wooly/python/wooly/table.strings 2011-03-08 21:32:04 UTC (rev 4579)
+++ trunk/wooly/python/wooly/table.strings 2011-03-08 21:32:46 UTC (rev 4580)
@@ -55,6 +55,9 @@
[TableColumnHeader.html]
<th class="{class}"><a class="{link_class}" title="{title}" href="{href}"><span><span class="{sorted_dir}">{content}</span></span></a></th>
+[TableColumnHeader.static_html]
+<th class="{class}">{content}</th>
+
[TableColumnCell.html]
<td class="{class}">{content}</td>
13 years, 3 months
r4579 - trunk/wooly/python/wooly
by eallen@fedoraproject.org
Author: eallen
Date: 2011-03-08 21:32:04 +0000 (Tue, 08 Mar 2011)
New Revision: 4579
Modified:
trunk/wooly/python/wooly/pages.py
trunk/wooly/python/wooly/pages.strings
Log:
Added a new popup page to support the display of a single widget in a popup div.
Modified: trunk/wooly/python/wooly/pages.py
===================================================================
--- trunk/wooly/python/wooly/pages.py 2011-03-08 14:40:15 UTC (rev 4578)
+++ trunk/wooly/python/wooly/pages.py 2011-03-08 21:32:04 UTC (rev 4579)
@@ -96,6 +96,9 @@
self.update_page = UpdatePage(app, self.base_name + ".update", self)
self.app.add_page(self.update_page)
+ self.popup_page = PopupPage(app, self.base_name + ".popup", self)
+ self.app.add_page(self.popup_page)
+
self.css_page = CssPage(app, self.base_name + ".css", self)
self.app.add_page(self.css_page)
@@ -129,6 +132,14 @@
return sess.marshal()
+ def get_popup_url(self, session, widget):
+ sess = Session(self.page.popup_page)
+
+ self.page.popup_page.widgets.set(sess, [widget])
+ self.page.popup_page.session.set(sess, session)
+
+ return sess.marshal()
+
def do_process(self, session):
self.update_script.process(session)
self.defer_script.process(session)
@@ -244,6 +255,10 @@
def do_unmarshal(self, path):
return self.page.page_widgets_by_path.get(path)
+class PopupPage(UpdatePage):
+ def get_content_type(self, session):
+ return self.html_content_type
+
class CssPage(Page):
def __init__(self, app, name, html_page):
super(CssPage, self).__init__(app, name)
Modified: trunk/wooly/python/wooly/pages.strings
===================================================================
--- trunk/wooly/python/wooly/pages.strings 2011-03-08 14:40:15 UTC (rev 4578)
+++ trunk/wooly/python/wooly/pages.strings 2011-03-08 21:32:04 UTC (rev 4579)
@@ -51,3 +51,9 @@
[UpdatePage.widget_html]
<widget id="{widget_id}">{widget}</widget>
+
+[PopupPage.html]
+{widgets}
+
+[PopupPage.widget_html]
+{widget}
13 years, 3 months
r4578 - trunk/cumin/python/cumin/messaging
by eallen@fedoraproject.org
Author: eallen
Date: 2011-03-08 14:40:15 +0000 (Tue, 08 Mar 2011)
New Revision: 4578
Modified:
trunk/cumin/python/cumin/messaging/binding.py
Log:
Probable fix for BZ 680890
Modified: trunk/cumin/python/cumin/messaging/binding.py
===================================================================
--- trunk/cumin/python/cumin/messaging/binding.py 2011-03-08 13:54:28 UTC (rev 4577)
+++ trunk/cumin/python/cumin/messaging/binding.py 2011-03-08 14:40:15 UTC (rev 4578)
@@ -607,7 +607,7 @@
class ExchangeBindings(ExchangeKeysField):
def render_id(self, session, *args):
cls = "ExchangeHiddenRow"
- exchange = self.exchange.get(session)
+ exchange = self.get_exchange(session)
if exchange and exchange.type == 'headers':
cls = ""
return cls and "%s\" class=\"%s" % (self.path, cls) or self.path
13 years, 3 months
r4576 - trunk/wooly/python/wooly
by eallen@fedoraproject.org
Author: eallen
Date: 2011-03-03 22:25:57 +0000 (Thu, 03 Mar 2011)
New Revision: 4576
Modified:
trunk/wooly/python/wooly/__init__.py
trunk/wooly/python/wooly/profile.py
Log:
Consolidate update_enabled and defer_enabled processing
Modified: trunk/wooly/python/wooly/__init__.py
===================================================================
--- trunk/wooly/python/wooly/__init__.py 2011-03-03 18:32:31 UTC (rev 4575)
+++ trunk/wooly/python/wooly/__init__.py 2011-03-03 22:25:57 UTC (rev 4576)
@@ -285,20 +285,18 @@
child.save_parameters(session, params)
def process(self, session, *args):
+ if self.update_enabled:
+ self.page.enable_update(session, self)
+
+ if self.defer_enabled:
+ self.page.enable_defer(session, self)
+
if self.app.debug:
profile = self.page.profile.get(session)
call = ProcessCall(profile, self, args)
call.do(session)
else:
- # XXX these should move into do_process
-
- if self.update_enabled:
- self.page.enable_update(session, self)
-
- if self.defer_enabled:
- self.page.enable_defer(session, self)
-
self.do_process(session, *args)
def do_process(self, session, *args):
Modified: trunk/wooly/python/wooly/profile.py
===================================================================
--- trunk/wooly/python/wooly/profile.py 2011-03-03 18:32:31 UTC (rev 4575)
+++ trunk/wooly/python/wooly/profile.py 2011-03-03 22:25:57 UTC (rev 4576)
@@ -140,12 +140,6 @@
self.start = time.time()
- if self.widget.update_enabled:
- self.widget.page.enable_update(session, self.widget)
-
- if self.widget.defer_enabled:
- self.widget.page.enable_defer(session, self.widget)
-
self.widget.do_process(session, *self.args)
self.end = time.time()
13 years, 3 months
r4575 - trunk/cumin/python/cumin/grid
by eallen@fedoraproject.org
Author: eallen
Date: 2011-03-03 18:32:31 +0000 (Thu, 03 Mar 2011)
New Revision: 4575
Modified:
trunk/cumin/python/cumin/grid/dashboard.py
Log:
Filter on Pool for os breakdown
Modified: trunk/cumin/python/cumin/grid/dashboard.py
===================================================================
--- trunk/cumin/python/cumin/grid/dashboard.py 2011-03-03 18:14:32 UTC (rev 4574)
+++ trunk/cumin/python/cumin/grid/dashboard.py 2011-03-03 18:32:31 UTC (rev 4575)
@@ -450,6 +450,7 @@
super(DashboardOSData, self).__init__(app, cls)
self.collector = collector
+ self.add_value_filter(cls.Pool)
self.sum_column = "\"OpSys\""
13 years, 3 months
r4574 - trunk/cumin/python/cumin/grid
by eallen@fedoraproject.org
Author: eallen
Date: 2011-03-03 18:14:32 +0000 (Thu, 03 Mar 2011)
New Revision: 4574
Modified:
trunk/cumin/python/cumin/grid/dashboard.py
Log:
python 2.4 doesn't support .index() on a tuple
Modified: trunk/cumin/python/cumin/grid/dashboard.py
===================================================================
--- trunk/cumin/python/cumin/grid/dashboard.py 2011-03-03 16:59:57 UTC (rev 4573)
+++ trunk/cumin/python/cumin/grid/dashboard.py 2011-03-03 18:14:32 UTC (rev 4574)
@@ -425,8 +425,8 @@
def __init__(self, app, name, collector):
super(GridSlotsSummary, self).__init__(app, name, collector)
- self.attrs = ("HostsClaimed", "HostsUnclaimed",
- "HostsOwner", "HostsTotal")
+ self.attrs = ["HostsClaimed", "HostsUnclaimed",
+ "HostsOwner", "HostsTotal"]
self.has_total = True
self.color_scheme = PieChartPage.BLUES
13 years, 3 months
r4573 - trunk/cumin/python/cumin/grid
by eallen@fedoraproject.org
Author: eallen
Date: 2011-03-03 16:59:57 +0000 (Thu, 03 Mar 2011)
New Revision: 4573
Modified:
trunk/cumin/python/cumin/grid/dashboard.py
trunk/cumin/python/cumin/grid/dashboard.strings
Log:
css tweaks to dashboard
Modified: trunk/cumin/python/cumin/grid/dashboard.py
===================================================================
--- trunk/cumin/python/cumin/grid/dashboard.py 2011-03-03 16:56:42 UTC (rev 4572)
+++ trunk/cumin/python/cumin/grid/dashboard.py 2011-03-03 16:59:57 UTC (rev 4573)
@@ -103,7 +103,7 @@
styles = list()
for color in colors:
hx = rgb_to_string(*color)
- styles.append(".DefinitionSet dt span.legend%s { background-color: #%s;}" % (hx, hx))
+ styles.append(".DefinitionSet dt.legend%s span { background-color: #%s;}" % (hx, hx))
return "\n".join(styles)
def render_class(self, session):
@@ -113,6 +113,13 @@
def is_total(self, item):
return False
+ def render_legend_class(self, session, item):
+ return ""
+
+ def render_dd_class(self, session, item):
+ dt_class = self.render_legend_class(session, item)
+ return "total" is dt_class and " class=\"total\"" or ""
+
class AliasSqlColumn(object):
def __init__(self, identifier, alias):
self.identifier = identifier
@@ -367,7 +374,7 @@
def render_legend_class(self, session, item):
if self.is_total(item):
- return "blank"
+ return "total"
index = self.sum_columns.index(item.name)
return "legend%s" % rgb_to_string(*(PieChartPage.color_schemes[self.color_scheme][index]))
@@ -433,7 +440,7 @@
def render_legend_class(self, session, item):
if self.is_total(item):
- return "blank"
+ return "total"
index = self.attrs.index(item[0].name)
return "legend%s" % rgb_to_string(*(PieChartPage.color_schemes[self.color_scheme][index]))
@@ -484,6 +491,17 @@
records.append(("%s Used" % os, recs_by_os[os]["used"]))
records.append(("%s Unused" % os, recs_by_os[os]["unused"]))
records.append(("%s Total" % os, recs_by_os[os]["total"]))
+
+ ########## dummy test data
+ """
+ records.append(("WINNT70 Used", 10))
+ records.append(("WINNT70 Unused", 20))
+ records.append(("WINNT70 Total", 30))
+ records.append(("SOLARIS27 Used", 12))
+ records.append(("SOLARIS27 Unused", 34))
+ records.append(("SOLARIS27 Total", 46))
+ """
+
return records
def get_sql_options(self, options):
@@ -528,9 +546,15 @@
_, record = item
return record[1]
- def render_legend_class(self, session, item):
- if self.is_total(item):
- return "blank"
- index, _ = item
- return "legend%s" % rgb_to_string(*(PieChartPage.color_schemes[self.color_scheme][index]))
+ def render_legend_class(self, session, this_item):
+ if self.is_total(this_item):
+ return "total"
+ items = self.do_get_items(session)
+ real_index = 0
+ for item in items:
+ if item[1][0] is this_item[1][0]:
+ break
+ if not self.is_total(item):
+ real_index += 1
+ return "legend%s" % rgb_to_string(*(PieChartPage.color_schemes[self.color_scheme][real_index]))
Modified: trunk/cumin/python/cumin/grid/dashboard.strings
===================================================================
--- trunk/cumin/python/cumin/grid/dashboard.strings 2011-03-03 16:56:42 UTC (rev 4572)
+++ trunk/cumin/python/cumin/grid/dashboard.strings 2011-03-03 16:59:57 UTC (rev 4573)
@@ -70,6 +70,11 @@
border-top: 1px solid #999;
}
+.DefinitionSet dt.total, .DefinitionSet dd.total {
+ font-weight: bold;
+ padding-bottom: 1em;
+}
+
.DefinitionSet span {
display: block;
float: left;
@@ -101,8 +106,8 @@
</div>
[DefinitionSet.item_html]
- <dt><span class="{legend_class}"></span>{item_title}</dt>
- <dd>{item_value}</dd>
+ <dt class="{legend_class}"><span></span>{item_title}</dt>
+ <dd{dd_class}>{item_value}</dd>
[MinimalTableHeader.html]
13 years, 3 months