Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Wikipedia: Mediawiki-CVS

SVN: [58725] trunk/extensions/DataCenter/UI/Widgets

 

 

Wikipedia mediawiki-cvs RSS feed   Index | Next | Previous | View Threaded


ashley at svn

Nov 7, 2009, 10:03 AM

Post #1 of 1 (22 views)
Permalink
SVN: [58725] trunk/extensions/DataCenter/UI/Widgets

http://www.mediawiki.org/wiki/Special:Code/MediaWiki/58725

Revision: 58725
Author: ashley
Date: 2009-11-07 18:03:57 +0000 (Sat, 07 Nov 2009)

Log Message:
-----------
DataCenter: coding style cleanup for UI/Widgets

Modified Paths:
--------------
trunk/extensions/DataCenter/UI/Widgets/Actions.php
trunk/extensions/DataCenter/UI/Widgets/Body.php
trunk/extensions/DataCenter/UI/Widgets/Details.php
trunk/extensions/DataCenter/UI/Widgets/Export.php
trunk/extensions/DataCenter/UI/Widgets/FieldLinks.php
trunk/extensions/DataCenter/UI/Widgets/Form.php
trunk/extensions/DataCenter/UI/Widgets/Gallery.php
trunk/extensions/DataCenter/UI/Widgets/Heading.php
trunk/extensions/DataCenter/UI/Widgets/History.php
trunk/extensions/DataCenter/UI/Widgets/Map.php
trunk/extensions/DataCenter/UI/Widgets/Model.php
trunk/extensions/DataCenter/UI/Widgets/Plan.php
trunk/extensions/DataCenter/UI/Widgets/Search.php
trunk/extensions/DataCenter/UI/Widgets/SearchResults.php
trunk/extensions/DataCenter/UI/Widgets/Space.php
trunk/extensions/DataCenter/UI/Widgets/Table.php

Modified: trunk/extensions/DataCenter/UI/Widgets/Actions.php
===================================================================
--- trunk/extensions/DataCenter/UI/Widgets/Actions.php 2009-11-07 18:00:05 UTC (rev 58724)
+++ trunk/extensions/DataCenter/UI/Widgets/Actions.php 2009-11-07 18:03:57 UTC (rev 58725)
@@ -40,9 +40,7 @@

/* Functions */

- public static function render(
- array $parameters
- ) {
+ public static function render( array $parameters ) {
// Sets defaults
$parameters = array_merge( self::$defaultParameters, $parameters );
// Checks for permissions
@@ -72,7 +70,7 @@
}
// Builds label
$label = DataCenterUI::message( 'action', $label . '-type',
- DataCenterUI::message('type', $subject )
+ DataCenterUI::message( 'type', $subject )
);
// Builds link
$link = DataCenterXml::link( $label, $link );

Modified: trunk/extensions/DataCenter/UI/Widgets/Body.php
===================================================================
--- trunk/extensions/DataCenter/UI/Widgets/Body.php 2009-11-07 18:00:05 UTC (rev 58724)
+++ trunk/extensions/DataCenter/UI/Widgets/Body.php 2009-11-07 18:03:57 UTC (rev 58725)
@@ -50,9 +50,7 @@

/* Functions */

- public static function render(
- array $parameters
- ) {
+ public static function render( array $parameters ) {
// Sets defaults
$parameters = array_merge( self::$defaultParameters, $parameters );
// Begins widget
@@ -76,7 +74,7 @@
'body', $parameters['message'], $parameters['subject']
);
// Checks if a type was given
- } else if ( $parameters['type'] !== null ) {
+ } elseif ( $parameters['type'] !== null ) {
// Uses type-based message
$message = DataCenterUI::message(
'body',
@@ -95,7 +93,7 @@
DataCenterXml::div( $message )
);
// Checks if text was given
- } else if (
+ } elseif (
// Required parameters
isset( $parameters['text'] ) &&
// Required styles

Modified: trunk/extensions/DataCenter/UI/Widgets/Details.php
===================================================================
--- trunk/extensions/DataCenter/UI/Widgets/Details.php 2009-11-07 18:00:05 UTC (rev 58724)
+++ trunk/extensions/DataCenter/UI/Widgets/Details.php 2009-11-07 18:03:57 UTC (rev 58725)
@@ -39,9 +39,7 @@

/* Functions */

- public static function render(
- array $parameters
- ) {
+ public static function render( array $parameters ) {
// Sets defaults
$parameters = array_merge( self::$defaultParameters, $parameters );
// Begins widget

Modified: trunk/extensions/DataCenter/UI/Widgets/Export.php
===================================================================
--- trunk/extensions/DataCenter/UI/Widgets/Export.php 2009-11-07 18:00:05 UTC (rev 58724)
+++ trunk/extensions/DataCenter/UI/Widgets/Export.php 2009-11-07 18:03:57 UTC (rev 58725)
@@ -79,9 +79,7 @@

/* Static Functions */

- public static function render(
- array $parameters
- ) {
+ public static function render( array $parameters ) {
global $wgUser;
// Gets current path
$path = DataCenterPage::getPath();
@@ -232,11 +230,9 @@
return $xmlOutput;
}

- public static function export(
- array $data
- ) {
+ public static function export( array $data ) {
global $wgOut;
- // Disables mediawiki output
+ // Disables MediaWiki output
$wgOut->disable();
// Gets current path
$path = DataCenterPage::getPath();
@@ -253,8 +249,8 @@
) .
' - ' . $date . '.' . $data['meta']['format'];
// Sets headers for downloading CSV file
- header("Content-type: application/octet-stream");
- header("Content-Disposition: attachment; filename=\"{$fileName}\"");
+ header( 'Content-type: application/octet-stream' );
+ header( "Content-Disposition: attachment; filename=\"{$fileName}\"" );
$rows = DataCenterDB::getRows(
'DataCenterDBRow',
$data['meta']['category'],
@@ -340,9 +336,7 @@
}
}

- private static function exportValue(
- $value
- ) {
+ private static function exportValue( $value ) {
if (
strpos( $value, ',' ) !== false ||
strpos( $value, '"' ) !== false ||

Modified: trunk/extensions/DataCenter/UI/Widgets/FieldLinks.php
===================================================================
--- trunk/extensions/DataCenter/UI/Widgets/FieldLinks.php 2009-11-07 18:00:05 UTC (rev 58724)
+++ trunk/extensions/DataCenter/UI/Widgets/FieldLinks.php 2009-11-07 18:03:57 UTC (rev 58725)
@@ -93,9 +93,7 @@

/* Static Functions */

- public static function render(
- array $parameters
- ) {
+ public static function render( array $parameters ) {
global $wgUser;
// Gets current path
$path = DataCenterPage::getPath();
@@ -274,9 +272,7 @@
return $xmlOutput;
}

- public function saveFieldLinks(
- array $data
- ) {
+ public function saveFieldLinks( array $data ) {
$metaField = DataCenterDBMetaField::newFromValues( $data['row'] );
$metaFieldLinks = $metaField->getLinks();
// Build table of links that do exist
@@ -313,7 +309,7 @@
)
);
$metaFieldLink->insert();
- } else if (
+ } elseif (
!isset( $shouldExistTable[$key] ) &&
isset( $doesExistTable[$key] ) &&
( $doesExistTable[$key]->numValues() == 0 )

Modified: trunk/extensions/DataCenter/UI/Widgets/Form.php
===================================================================
--- trunk/extensions/DataCenter/UI/Widgets/Form.php 2009-11-07 18:00:05 UTC (rev 58724)
+++ trunk/extensions/DataCenter/UI/Widgets/Form.php 2009-11-07 18:03:57 UTC (rev 58725)
@@ -157,9 +157,7 @@

/* Functions */

- public static function render(
- array $parameters
- ) {
+ public static function render( array $parameters ) {
global $wgUser;
// Sets defaults
$parameters = array_merge( self::$defaultParameters, $parameters );
@@ -260,7 +258,7 @@
// Sets name of input for form processing
$inputOptions['name'] = "row[{$inputOptions['field']}]";
// Alternatively checks if a list of fields were given
- } else if ( isset( $inputOptions['fields'] ) ) {
+ } elseif ( isset( $inputOptions['fields'] ) ) {
// Loops over each sub-field
foreach( $inputOptions['fields'] as $key => $field ) {
// Checks if sub-field is an array

Modified: trunk/extensions/DataCenter/UI/Widgets/Gallery.php
===================================================================
--- trunk/extensions/DataCenter/UI/Widgets/Gallery.php 2009-11-07 18:00:05 UTC (rev 58724)
+++ trunk/extensions/DataCenter/UI/Widgets/Gallery.php 2009-11-07 18:03:57 UTC (rev 58725)
@@ -54,9 +54,7 @@

/* Static Functions */

- public static function render(
- array $parameters
- ) {
+ public static function render( array $parameters ) {
// Sets defaults
$parameters = array_merge_recursive(
self::$defaultParameters, $parameters

Modified: trunk/extensions/DataCenter/UI/Widgets/Heading.php
===================================================================
--- trunk/extensions/DataCenter/UI/Widgets/Heading.php 2009-11-07 18:00:05 UTC (rev 58724)
+++ trunk/extensions/DataCenter/UI/Widgets/Heading.php 2009-11-07 18:03:57 UTC (rev 58725)
@@ -45,9 +45,7 @@

/* Functions */

- public static function render(
- array $parameters
- ) {
+ public static function render( array $parameters ) {
// Sets defaults
$parameters = array_merge( self::$defaultParameters, $parameters );
// Begins widget
@@ -65,9 +63,7 @@
$message = DataCenterUI::message(
'heading', $parameters['message'], $parameters['subject']
);
- }
- // Checks if a type was given
- else if ( $parameters['type'] !== null ) {
+ } elseif ( $parameters['type'] !== null ) { // Checks if a type was given
// Uses type-based message
$message = DataCenterUI::message(
'heading',
@@ -83,7 +79,7 @@
// Returns heading with message
$xmlOutput .= $message;
// Checks if text was given
- } else if ( $parameters['text'] !== null ) {
+ } elseif ( $parameters['text'] !== null ) {
// Adds a heading with text
$xmlOutput .= $parameters['text'];
}

Modified: trunk/extensions/DataCenter/UI/Widgets/History.php
===================================================================
--- trunk/extensions/DataCenter/UI/Widgets/History.php 2009-11-07 18:00:05 UTC (rev 58724)
+++ trunk/extensions/DataCenter/UI/Widgets/History.php 2009-11-07 18:03:57 UTC (rev 58725)
@@ -83,9 +83,7 @@

/* Static Functions */

- public static function render(
- array $parameters
- ) {
+ public static function render( array $parameters ) {
global $wgUser;
// Gets current path
$path = DataCenterPage::getPath();
@@ -388,9 +386,7 @@
return $xmlOutput;
}

- public static function compareChanges(
- $data
- ) {
+ public static function compareChanges( $data ) {
global $wgOut;
$path = DataCenterPage::getPath();
$path['parameter'] = array(

Modified: trunk/extensions/DataCenter/UI/Widgets/Map.php
===================================================================
--- trunk/extensions/DataCenter/UI/Widgets/Map.php 2009-11-07 18:00:05 UTC (rev 58724)
+++ trunk/extensions/DataCenter/UI/Widgets/Map.php 2009-11-07 18:03:57 UTC (rev 58725)
@@ -46,9 +46,7 @@

/* Static Functions */

- public static function render(
- array $parameters
- ) {
+ public static function render( array $parameters ) {
global $egDataCenterGoogleMapsAPIKey;
DataCenterUI::addScript(
'http://maps.google.com/maps?file=api&v=2&key=' .
@@ -83,7 +81,7 @@
self::addMarkersJsFunction( $parameters )
);
// Alternatively checks if a single location was given
- } else if ( $parameters['location'] ) {
+ } elseif ( $parameters['location'] ) {
// Builds script to add setup job to renderer
$jsOutput = sprintf(
"dataCenter.renderer.addJob( 'map', %s, %s );",
@@ -107,10 +105,7 @@

/* Private Funtions */

- private static function markerOptions(
- array $parameters,
- $location
- ) {
+ private static function markerOptions( array $parameters, $location ) {
// Begins window
$xmlOutput = DataCenterXml::open( 'div', array( 'class' => 'window' ) );
// Adds heading
@@ -150,9 +145,7 @@
return DataCenterJs::toObject( array( 'content' => $xmlOutput ) );
}

- private static function showPositionJsFunction(
- array $parameters
- ) {
+ private static function showPositionJsFunction( array $parameters ) {
$location = $parameters['location'];
// Builds script to show position
return sprintf(
@@ -163,9 +156,7 @@
);
}

- private static function addMarkersJsFunction(
- array $parameters
- ) {
+ private static function addMarkersJsFunction( array $parameters ) {
// Begins building javascript for adding markers
$jsMarkers = '';
// Loops over each location

Modified: trunk/extensions/DataCenter/UI/Widgets/Model.php
===================================================================
--- trunk/extensions/DataCenter/UI/Widgets/Model.php 2009-11-07 18:00:05 UTC (rev 58724)
+++ trunk/extensions/DataCenter/UI/Widgets/Model.php 2009-11-07 18:03:57 UTC (rev 58725)
@@ -41,9 +41,7 @@

/* Static Functions */

- public static function render(
- array $parameters
- ) {
+ public static function render( array $parameters ) {
// Sets Defaults
$parameters = array_merge( self::$defaultParameters, $parameters );
// Begins widget
@@ -82,17 +80,13 @@

/* Private Static Functions */

- private static function renderModel(
- $parameters,
- $structure,
- $level = 0
- ) {
+ private static function renderModel( $parameters, $structure, $level = 0 ) {
$xmlOutput = '';
foreach ( $structure as $model ) {
$modelLink = DataCenterDB::getModelLink( $model->get( 'link' ) );
if ( !DataCenterPage::userCan( 'change' ) ) {
$rowAttributes = array();
- } else if ( $level == 0 && count( $parameters['link'] ) > 0 ) {
+ } elseif ( $level == 0 && count( $parameters['link'] ) > 0 ) {
$rowAttributes = array_merge(
array( 'class' => 'link' ),
DataCenterXml::buildLink( $parameters['link'], $model )

Modified: trunk/extensions/DataCenter/UI/Widgets/Plan.php
===================================================================
--- trunk/extensions/DataCenter/UI/Widgets/Plan.php 2009-11-07 18:00:05 UTC (rev 58724)
+++ trunk/extensions/DataCenter/UI/Widgets/Plan.php 2009-11-07 18:03:57 UTC (rev 58725)
@@ -75,9 +75,7 @@

/* Static Functions */

- public static function render(
- array $parameters
- ) {
+ public static function render( array $parameters ) {
// Adds script to UI
DataCenterUI::addScript(
'/extensions/DataCenter/Resources/Widgets/Plan/Plan.js'
@@ -125,9 +123,7 @@
return $xmlOutput;
}

- private static function addPlanJsFunction(
- array $parameters
- ) {
+ private static function addPlanJsFunction( array $parameters ) {
// Adds script to add plan to scene
$jsOutput = DataCenterJs::callFunction(
'scene.setModule',
@@ -148,9 +144,7 @@
return DataCenterJs::buildFunction( array( 'scene' ), $jsOutput );
}

- private static function buildStateJsObject(
- $parameters
- ) {
+ private static function buildStateJsObject( $parameters ) {
// Builds array for state
$state = array(
'focus' => array(
@@ -170,11 +164,11 @@
$state['focus']['id'] = $parameters['look-at-rack'];
$state['focus']['progress'] = 1;
$state['focus']['inc'] = true;
- } else if ( $parameters['zoom-to-rack'] !== null ) {
+ } elseif ( $parameters['zoom-to-rack'] !== null ) {
$state['focus']['id'] = $parameters['zoom-to-rack'];
$state['focus']['progress'] = 0;
$state['focus']['inc'] = true;
- } else if ( $parameters['zoom-from-rack'] !== null ) {
+ } elseif ( $parameters['zoom-from-rack'] !== null ) {
$state['focus']['id'] = $parameters['zoom-from-rack'];
$state['focus']['progress'] = 0;
$state['focus']['inc'] = false;
@@ -183,9 +177,7 @@
return DataCenterJs::toObject( $state );
}

- private static function buildPhysicalJsObject(
- $parameters
- ) {
+ private static function buildPhysicalJsObject( $parameters ) {
// Creates shortcut to plan
$plan = $parameters['plan'];
// Gets plan's space from database
@@ -256,7 +248,7 @@
// Creates empty array
$physical = array();
}
- // Returns javascript object
+ // Returns JavaScript object
return DataCenterJs::toObject( $physical );
}
}
\ No newline at end of file

Modified: trunk/extensions/DataCenter/UI/Widgets/Search.php
===================================================================
--- trunk/extensions/DataCenter/UI/Widgets/Search.php 2009-11-07 18:00:05 UTC (rev 58724)
+++ trunk/extensions/DataCenter/UI/Widgets/Search.php 2009-11-07 18:03:57 UTC (rev 58725)
@@ -83,9 +83,7 @@

/* Static Functions */

- public static function render(
- array $parameters
- ) {
+ public static function render( array $parameters ) {
global $wgUser;
// Gets current path
$path = DataCenterPage::getPath();
@@ -151,9 +149,7 @@
return $xmlOutput;
}

- public static function redirect(
- $data
- ) {
+ public static function redirect( $data ) {
global $wgOut;
$path = DataCenterPage::getPath();
if ( isset( $data['meta']['query'] ) ) {

Modified: trunk/extensions/DataCenter/UI/Widgets/SearchResults.php
===================================================================
--- trunk/extensions/DataCenter/UI/Widgets/SearchResults.php 2009-11-07 18:00:05 UTC (rev 58724)
+++ trunk/extensions/DataCenter/UI/Widgets/SearchResults.php 2009-11-07 18:03:57 UTC (rev 58725)
@@ -82,9 +82,7 @@

/* Static Functions */

- public static function render(
- array $parameters
- ) {
+ public static function render( array $parameters ) {
global $wgUser;
// Gets current path
$path = DataCenterPage::getPath();
@@ -139,8 +137,7 @@
'body',
array( 'message' => 'notice-no-results', 'style' => 'notice' )
);
- }
- else {
+ } else {
$joins = array();
if ( $currentTarget['class'] == 'DataCenterDBAsset' ) {
$joins = array_merge_recursive(

Modified: trunk/extensions/DataCenter/UI/Widgets/Space.php
===================================================================
--- trunk/extensions/DataCenter/UI/Widgets/Space.php 2009-11-07 18:00:05 UTC (rev 58724)
+++ trunk/extensions/DataCenter/UI/Widgets/Space.php 2009-11-07 18:03:57 UTC (rev 58725)
@@ -40,9 +40,7 @@

/* Static Functions */

- public static function render(
- array $parameters
- ) {
+ public static function render( array $parameters ) {
// Adds script to UI
DataCenterUI::addScript(
'/extensions/DataCenter/Resources/Widgets/Space/Space.js'
@@ -92,9 +90,7 @@
return $xmlOutput;
}

- private static function addSpaceJsFunction(
- array $parameters
- ) {
+ private static function addSpaceJsFunction( array $parameters ) {
// Adds script to add space to scene
$jsOutput = DataCenterJs::callFunction(
'scene.setModule',
@@ -114,9 +110,7 @@
return DataCenterJs::buildFunction( array( 'scene' ), $jsOutput );
}

- private static function buildPhysicalJsObject(
- $parameters
- ) {
+ private static function buildPhysicalJsObject( $parameters ) {
// Creates shortcut to space
$space = $parameters['space'];
// Checks if space was valid

Modified: trunk/extensions/DataCenter/UI/Widgets/Table.php
===================================================================
--- trunk/extensions/DataCenter/UI/Widgets/Table.php 2009-11-07 18:00:05 UTC (rev 58724)
+++ trunk/extensions/DataCenter/UI/Widgets/Table.php 2009-11-07 18:03:57 UTC (rev 58725)
@@ -79,9 +79,7 @@

/* Static Functions */

- public static function render(
- array $parameters
- ) {
+ public static function render( array $parameters ) {
// Sets defaults
$parameters = array_merge_recursive(
self::$defaultParameters, $parameters
@@ -195,9 +193,7 @@
* the widget as options for the entire column,
* merging with default options to ensure keys exist
*/
- private static function processFields(
- $fields
- ) {
+ private static function processFields( $fields ) {
// Checks that fields is an array with at least one element
if ( count( $fields ) == 0 ) {
return null;



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Wikipedia mediawiki-cvs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.