
ashley at svn
Nov 7, 2009, 9:55 AM
Post #1 of 1
(13 views)
Permalink
|
|
SVN: [58722] trunk/extensions/DataCenter
|
|
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/58722 Revision: 58722 Author: ashley Date: 2009-11-07 17:55:58 +0000 (Sat, 07 Nov 2009) Log Message: ----------- DataCenter: coding style cleanup for controllers & resources Modified Paths: -------------- trunk/extensions/DataCenter/Controllers/Assets.php trunk/extensions/DataCenter/Controllers/Facilities.php trunk/extensions/DataCenter/Controllers/Models.php trunk/extensions/DataCenter/Controllers/Overview.php trunk/extensions/DataCenter/Controllers/Plans.php trunk/extensions/DataCenter/Controllers/Search.php trunk/extensions/DataCenter/Controllers/Settings.php trunk/extensions/DataCenter/Resources/Widgets/Plan/Plan.js trunk/extensions/DataCenter/Resources/Widgets/Space/Space.js Modified: trunk/extensions/DataCenter/Controllers/Assets.php =================================================================== --- trunk/extensions/DataCenter/Controllers/Assets.php 2009-11-07 17:44:50 UTC (rev 58721) +++ trunk/extensions/DataCenter/Controllers/Assets.php 2009-11-07 17:55:58 UTC (rev 58722) @@ -17,9 +17,7 @@ /* Functions */ - public function __construct( - array $path - ) { + public function __construct( array $path ) { // Actions if ( $path['id'] ) { if ( DataCenterPage::userCan( 'change' ) ) { @@ -53,10 +51,7 @@ } } - public function save( - array $data, - $type - ) { + public function save( array $data, $type ) { if ( !DataCenterPage::userCan( 'change' ) ) { return false; } @@ -67,10 +62,7 @@ return true; } - public function export( - array $data, - $type - ) { + public function export( array $data, $type ) { if ( !DataCenterPage::userCan( 'export' ) ) { return false; } @@ -78,10 +70,7 @@ return null; } - public function compareChanges( - array $data, - $type - ) { + public function compareChanges( array $data, $type ) { DataCenterWidgetHistory::compareChanges( $data ); return null; } Modified: trunk/extensions/DataCenter/Controllers/Facilities.php =================================================================== --- trunk/extensions/DataCenter/Controllers/Facilities.php 2009-11-07 17:44:50 UTC (rev 58721) +++ trunk/extensions/DataCenter/Controllers/Facilities.php 2009-11-07 17:55:58 UTC (rev 58722) @@ -17,9 +17,7 @@ /* Functions */ - public function __construct( - array $path - ) { + public function __construct( array $path ) { // Actions if ( $path['id'] ) { if ( DataCenterPage::userCan( 'change' ) ) { @@ -45,10 +43,7 @@ } } - public function save( - array $data, - $type - ) { + public function save( array $data, $type ) { if ( !DataCenterPage::userCan( 'change' ) ) { return false; } @@ -73,10 +68,7 @@ return false; } - public function compareChanges( - array $data, - $type - ) { + public function compareChanges( array $data, $type ) { DataCenterWidgetHistory::compareChanges( $data ); return null; } Modified: trunk/extensions/DataCenter/Controllers/Models.php =================================================================== --- trunk/extensions/DataCenter/Controllers/Models.php 2009-11-07 17:44:50 UTC (rev 58721) +++ trunk/extensions/DataCenter/Controllers/Models.php 2009-11-07 17:55:58 UTC (rev 58722) @@ -18,9 +18,7 @@ /* Functions */ - public function __construct( - array $path - ) { + public function __construct( array $path ) { // Actions if ( $path['id'] && isset( $this->types[$path['type']] ) ) { if ( DataCenterPage::userCan( 'change' ) ) { @@ -46,10 +44,7 @@ } } - public function save( - array $data, - $type - ) { + public function save( array $data, $type ) { if ( !DataCenterPage::userCan( 'change' ) ) { return false; } @@ -60,10 +55,7 @@ return true; } - public function link( - array $data, - $type - ) { + public function link( array $data, $type ) { if ( !DataCenterPage::userCan( 'change' ) ) { return false; } @@ -76,10 +68,7 @@ return true; } - public function compareChanges( - array $data, - $type - ) { + public function compareChanges( array $data, $type ) { DataCenterWidgetHistory::compareChanges( $data ); return null; } Modified: trunk/extensions/DataCenter/Controllers/Overview.php =================================================================== --- trunk/extensions/DataCenter/Controllers/Overview.php 2009-11-07 17:44:50 UTC (rev 58721) +++ trunk/extensions/DataCenter/Controllers/Overview.php 2009-11-07 17:55:58 UTC (rev 58722) @@ -10,9 +10,7 @@ /* Functions */ - public function __construct( - array $path - ) { + public function __construct( array $path ) { // Actions } } \ No newline at end of file Modified: trunk/extensions/DataCenter/Controllers/Plans.php =================================================================== --- trunk/extensions/DataCenter/Controllers/Plans.php 2009-11-07 17:44:50 UTC (rev 58721) +++ trunk/extensions/DataCenter/Controllers/Plans.php 2009-11-07 17:55:58 UTC (rev 58722) @@ -18,9 +18,7 @@ /* Functions */ - public function __construct( - array $path - ) { + public function __construct( array $path ) { // Actions if ( $path['id'] ) { if ( DataCenterPage::userCan( 'remove' ) ) { @@ -50,7 +48,7 @@ if ( $path['id'] ) { $type = $path['type']; $id = $path['id']; - } else if ( + } elseif ( is_array( $path['parameter'] ) && count( $path['parameter'] ) >= 2 ) { @@ -92,10 +90,7 @@ } } - public function remove( - array $data, - $type - ) { + public function remove( array $data, $type ) { if ( !DataCenterPage::userCan( 'remove' ) ) { return false; } @@ -126,10 +121,7 @@ return false; } - public function save( - array $data, - $type - ) { + public function save( array $data, $type ) { if ( !DataCenterPage::userCan( 'change' ) ) { return false; } Modified: trunk/extensions/DataCenter/Controllers/Search.php =================================================================== --- trunk/extensions/DataCenter/Controllers/Search.php 2009-11-07 17:44:50 UTC (rev 58721) +++ trunk/extensions/DataCenter/Controllers/Search.php 2009-11-07 17:55:58 UTC (rev 58722) @@ -10,16 +10,11 @@ /* Functions */ - public function __construct( - array $path - ) { + public function __construct( array $path ) { // Actions } - public function search( - array $data, - $type - ) { + public function search( array $data, $type ) { DataCenterWidgetSearch::redirect( $data ); return null; } Modified: trunk/extensions/DataCenter/Controllers/Settings.php =================================================================== --- trunk/extensions/DataCenter/Controllers/Settings.php 2009-11-07 17:44:50 UTC (rev 58721) +++ trunk/extensions/DataCenter/Controllers/Settings.php 2009-11-07 17:55:58 UTC (rev 58722) @@ -16,9 +16,7 @@ /* Functions */ - public function __construct( - array $path - ) { + public function __construct( array $path ) { // Actions if ( $path['id'] && $path['type'] == 'field' ) { if ( DataCenterPage::userCan( 'remove' ) ) { @@ -46,10 +44,7 @@ } } - public function save( - array $data, - $type - ) { + public function save( array $data, $type ) { if ( !DataCenterPage::userCan( 'change' ) ) { return false; } @@ -62,10 +57,7 @@ return false; } - public function remove( - array $data, - $type - ) { + public function remove( array $data, $type ) { if ( !DataCenterPage::userCan( 'remove' ) ) { return false; } @@ -89,10 +81,7 @@ return false; } - public function saveFieldLinks( - array $data, - $type - ) { + public function saveFieldLinks( array $data, $type ) { if ( !DataCenterPage::userCan( 'change' ) ) { return false; } Modified: trunk/extensions/DataCenter/Resources/Widgets/Plan/Plan.js =================================================================== --- trunk/extensions/DataCenter/Resources/Widgets/Plan/Plan.js 2009-11-07 17:44:50 UTC (rev 58721) +++ trunk/extensions/DataCenter/Resources/Widgets/Plan/Plan.js 2009-11-07 17:55:58 UTC (rev 58722) @@ -9,11 +9,7 @@ * @param physical Object of space/rack/object physical structure * @param state Object of highlight/focus state */ -function DataCenterScenePlan( - id, - physical, - state -) { +function DataCenterScenePlan( id, physical, state ) { /* Private Members */ var self = this; @@ -34,26 +30,26 @@ outline: 'rgba( 0, 0, 0, 0.75 )', safe: { normal: { - side: 'rgba( 25, 25, 25, 0.75 )', - bottom: 'rgba( 50, 50, 50, 0.75 )', - top: 'rgba( 75, 75, 75, 0.75 )' + side: 'rgba( 25, 25, 25, 0.75 )', + bottom: 'rgba( 50, 50, 50, 0.75 )', + top: 'rgba( 75, 75, 75, 0.75 )' }, current: { side: 'rgba( 50, 75, 100, 0.5 )', - bottom: 'rgba( 125, 150, 175, 0.5 )', - top: 'rgba( 150, 175, 200, 0.5 )' + bottom: 'rgba( 125, 150, 175, 0.5 )', + top: 'rgba( 150, 175, 200, 0.5 )' } }, overlap: { normal: { side: 'rgba( 150, 100, 100, 0.75 )', - bottom: 'rgba( 175, 125, 125, 0.75 )', - top: 'rgba( 200, 150, 150, 0.75 )' + bottom: 'rgba( 175, 125, 125, 0.75 )', + top: 'rgba( 200, 150, 150, 0.75 )' }, current: { side: 'rgba( 200, 150, 150, 0.5 )', - bottom: 'rgba( 225, 175, 175, 0.5 )', - top: 'rgba( 250, 200, 200, 0.5 )' + bottom: 'rgba( 225, 175, 175, 0.5 )', + top: 'rgba( 250, 200, 200, 0.5 )' } } }, @@ -62,7 +58,7 @@ safe: { normal: { side: 'rgb( 100, 100, 100 )', - top: 'rgb( 125, 125, 125 )' + top: 'rgb( 125, 125, 125 )' }, current: { side: 'rgb( 100, 125, 150 )', @@ -90,9 +86,9 @@ highlight: { rack: null, object: null } }; } - + /* Public Functions */ - + /** * Sets a flag that the current virtual dimensions are invalid */ @@ -114,9 +110,7 @@ /** * Sets reference to scene this plan is in */ - this.setScene = function( - newScene - ) { + this.setScene = function( newScene ) { scene = newScene } /** @@ -130,11 +124,7 @@ * @param rackId Integer of row ID of rack to modify * @param orientation Integer of orientation to set */ - this.setRackOrientation = function( - rackId, - orientation, - update - ) { + this.setRackOrientation = function( rackId, orientation, update ) { physical.racks[rackId].orientation = orientation; self.resync(); self.update( update ); @@ -145,12 +135,7 @@ * @param x Integer of x position to set * @param y Integer of y position to set */ - this.setRackPosition = function( - rackId, - x, - y, - update - ) { + this.setRackPosition = function( rackId, x, y, update ) { physical.racks[rackId].x = x; physical.racks[rackId].y = y; self.resync(); @@ -178,12 +163,7 @@ * @param objectId Integer of row ID of object to modify * @param z Integer of x position to set */ - this.setObjectPosition = function( - rackId, - objectId, - z, - update - ) { + this.setObjectPosition = function( rackId, objectId, z, update ) { physical.racks[rackId].objects[objectId].z = z; self.resync(); self.update( update ); @@ -192,19 +172,14 @@ * Sets rack highlight * @param rackId Integer of row ID of rack to highlight */ - this.setRackHighlight = function( - rackId, - update - ) { + this.setRackHighlight = function( rackId, update ) { state.highlight.rack = rackId ? rackId : null; self.update( update ); } /** * Clears rack highlight */ - this.clearRackHighlight = function( - update - ) { + this.clearRackHighlight = function( update ) { state.highlight.rack = null; self.update( update ); } @@ -212,19 +187,14 @@ * Sets object highlight * @param rackId Integer of row ID of rack to highlight */ - this.setObjectHighlight = function( - objectId, - update - ) { + this.setObjectHighlight = function( objectId, update ) { state.highlight.object = objectId ? objectId : null; self.update( update ); } /** * Clears object highlight */ - this.clearObjectHighlight = function( - update - ) { + this.clearObjectHighlight = function( update ) { state.highlight.object = null; self.update( update ); } @@ -240,9 +210,7 @@ * Updates rendering of space * @param update Flag of whether to actually update */ - this.update = function( - update - ) { + this.update = function( update ) { if ( update && scene && scene.isLive() ) { scene.render(); } @@ -292,10 +260,10 @@ virtual.y = ( cache.canvas.height / 2 ) - ( virtual.depth / 2 ); virtual.meter = virtual.width / physical.width; virtual.base = [. - { x: virtual.width, y: 0 }, - { x: 0, y: 0 }, - { x: 0, y: virtual.depth }, - { x: virtual.width, y: virtual.depth }, + { x: virtual.width, y: 0 }, + { x: 0, y: 0 }, + { x: 0, y: virtual.depth }, + { x: virtual.width, y: virtual.depth }, ]; virtual.top = { x: virtual.normal.x * virtual.height, @@ -474,9 +442,7 @@ /** * Synchronizes rack's virtual and physical dimensions */ - this.syncRack = function( - rackId - ) { + this.syncRack = function( rackId ) { var rack = {}; // Calculates and stores rack dimensional information rack.orientation = @@ -510,11 +476,7 @@ /** * Draws rack onto it's plan's canvas */ - this.renderRack = function( - rackId, - pass, - overlap - ) { + this.renderRack = function( rackId, pass, overlap ) { var rack = { physical: physical.racks[rackId], virtual: virtual.racks[rackId], @@ -674,10 +636,7 @@ /** * Synchronizes object's virtual and physical dimensions */ - this.syncObject = function( - rackId, - objectId - ) { + this.syncObject = function( rackId, objectId ) { var object = {}; // Scale and orientation var unit = virtual.meter * DATACENTER_PLAN_U_HEIGHT * @@ -718,11 +677,7 @@ /** * Draws object onto it's plan's canvas */ - this.renderObject = function( - rackId, - objectId, - overlap - ) { + this.renderObject = function( rackId, objectId, overlap ) { var object = { physical: physical.racks[rackId].objects[objectId], virtual: virtual.racks[rackId].objects[objectId], Modified: trunk/extensions/DataCenter/Resources/Widgets/Space/Space.js =================================================================== --- trunk/extensions/DataCenter/Resources/Widgets/Space/Space.js 2009-11-07 17:44:50 UTC (rev 58721) +++ trunk/extensions/DataCenter/Resources/Widgets/Space/Space.js 2009-11-07 17:55:58 UTC (rev 58722) @@ -7,10 +7,7 @@ * @param id Integer of row ID of plan * @param physical Object of space physical structure */ -function DataCenterSceneSpace( - id, - physical -) { +function DataCenterSceneSpace( id, physical ) { /* Private Members */ var self = this; @@ -29,9 +26,9 @@ if ( !physical ) { physical = { width: 1, height: 1, depth: 1, orientation: 0 }; } - + /* Public Functions */ - + /** * Sets a flag that the current virtual dimensions are invalid */ @@ -53,9 +50,7 @@ /** * Sets reference to scene this plan is in */ - this.setScene = function( - newScene - ) { + this.setScene = function( newScene ) { scene = newScene } /** @@ -64,10 +59,8 @@ this.getID = function() { return id; } - - this.setWidth = function( - width - ) { + + this.setWidth = function( width ) { physical.width = width; self.resync(); // Automatically re-render @@ -76,9 +69,7 @@ } } - this.setHeight = function( - height - ) { + this.setHeight = function( height ) { physical.height = height; self.resync(); // Automatically re-render @@ -87,9 +78,7 @@ } } - this.setDepth = function( - depth - ) { + this.setDepth = function( depth ) { physical.depth = depth; self.resync(); // Automatically re-render @@ -97,7 +86,7 @@ scene.render(); } } - + /** * Handles click event */ @@ -129,7 +118,7 @@ * Synchronizes space's virtual and physical dimensions */ this.syncSpace = function() { - if ( !physical.orientation ) { + if ( !physical.orientation ) { physical.orientation = 0; } var factor = Math.min( @@ -148,10 +137,10 @@ virtual.y = ( cache.canvas.height / 2 ) - ( virtual.depth / 2 ); virtual.meter = virtual.width / physical.width; virtual.base = [. - { x: virtual.width, y: 0 }, - { x: 0, y: 0 }, - { x: 0, y: virtual.depth }, - { x: virtual.width, y: virtual.depth } + { x: virtual.width, y: 0 }, + { x: 0, y: 0 }, + { x: 0, y: virtual.depth }, + { x: virtual.width, y: virtual.depth } ]; virtual.top = { x: virtual.normal.x * virtual.height, @@ -165,7 +154,7 @@ self.sync(); self.renderSpace(); } - + this.renderSpace = function() { // View offset var offset = { _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS[at]lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
|