Index: trunk/extensions/DataCenter/DataCenter.php |
— | — | @@ -85,6 +85,7 @@ |
86 | 86 | 'DataCenterWidgetBody' => $dir . 'UI/Widgets/Body.php', |
87 | 87 | 'DataCenterWidgetDetails' => $dir . 'UI/Widgets/Details.php', |
88 | 88 | 'DataCenterWidgetDifference' => $dir . 'UI/Widgets/Difference.php', |
| 89 | + 'DataCenterWidgetFieldLinks' => $dir . 'UI/Widgets/FieldLinks.php', |
89 | 90 | 'DataCenterWidgetForm' => $dir . 'UI/Widgets/Form.php', |
90 | 91 | 'DataCenterWidgetGallery' => $dir . 'UI/Widgets/Gallery.php', |
91 | 92 | 'DataCenterWidgetHeading' => $dir . 'UI/Widgets/Heading.php', |
— | — | @@ -101,7 +102,7 @@ |
102 | 103 | 'DataCenterViewPlansPlan' => $dir . 'Views/Plans/Plan.php', |
103 | 104 | 'DataCenterViewPlansRack' => $dir . 'Views/Plans/Rack.php', |
104 | 105 | // Views/Settings/* |
105 | | - 'DataCenterViewSettingsMeta' => $dir . 'Views/Settings/Meta.php', |
| 106 | + 'DataCenterViewSettingsField' => $dir . 'Views/Settings/Field.php', |
106 | 107 | // Views/* |
107 | 108 | 'DataCenterViewAssets' => $dir . 'Views/Assets.php', |
108 | 109 | 'DataCenterViewFacilities' => $dir . 'Views/Facilities.php', |
Index: trunk/extensions/DataCenter/DataCenter.css |
— | — | @@ -88,7 +88,6 @@ |
89 | 89 | /* |
90 | 90 | * Form Widget |
91 | 91 | */ |
92 | | - |
93 | 92 | .datacenter-ui div.widget-form { |
94 | 93 | border: solid 1px silver; |
95 | 94 | } |
— | — | @@ -115,6 +114,26 @@ |
116 | 115 | background-color: #DDEEFF; |
117 | 116 | } |
118 | 117 | |
| 118 | +/* |
| 119 | + * FieldLinks Widget |
| 120 | + */ |
| 121 | +.datacenter-ui div.widget-fieldlinks form { |
| 122 | + margin: 0px; |
| 123 | + padding: 0px; |
| 124 | +} |
| 125 | +.datacenter-ui div.widget-fieldlinks input.reset { |
| 126 | + margin-right: 10px; |
| 127 | +} |
| 128 | +div.datacenter-ui div.widget-fieldlinks tr td { |
| 129 | + padding-top: 8px; |
| 130 | + padding-bottom: 8px; |
| 131 | + padding-left: 8px; |
| 132 | + padding-right: 8px; |
| 133 | +} |
| 134 | +.datacenter-ui div.widget-fieldlinks input.reset { |
| 135 | + margin-right: 10px; |
| 136 | +} |
| 137 | + |
119 | 138 | /** |
120 | 139 | * Heading Widget |
121 | 140 | */ |
— | — | @@ -243,6 +262,29 @@ |
244 | 263 | } |
245 | 264 | |
246 | 265 | /** |
| 266 | + * FieldLinks Widget |
| 267 | + */ |
| 268 | +div.datacenter-ui div.widget-fieldlinks table { |
| 269 | + background-color: white; |
| 270 | + border: solid 1px #DDDDDD; |
| 271 | + width: 100%; |
| 272 | +} |
| 273 | +div.datacenter-ui div.widget-fieldlinks th { |
| 274 | + background-color: #DDDDDD; |
| 275 | + color: #999999; |
| 276 | + padding-top: 4px; |
| 277 | + padding-bottom: 4px; |
| 278 | + padding-left: 8px; |
| 279 | + padding-right: 8px; |
| 280 | +} |
| 281 | +div.datacenter-ui div.widget-fieldlinks tr td { |
| 282 | + padding-top: 4px; |
| 283 | + padding-bottom: 4px; |
| 284 | + padding-left: 8px; |
| 285 | + padding-right: 8px; |
| 286 | +} |
| 287 | + |
| 288 | +/** |
247 | 289 | * Model Widget |
248 | 290 | */ |
249 | 291 | div.datacenter-ui div.widget-model table { |
Index: trunk/extensions/DataCenter/DataCenter.db.php |
— | — | @@ -1091,6 +1091,84 @@ |
1092 | 1092 | return self::numRows( 'meta', 'change', $options ); |
1093 | 1093 | } |
1094 | 1094 | |
| 1095 | + /** |
| 1096 | + * Wraps self::getRows specializing... |
| 1097 | + * - class as DataCenterDBMetaField |
| 1098 | + * - category as meta |
| 1099 | + * - type as field |
| 1100 | + */ |
| 1101 | + public static function getMetaFields( |
| 1102 | + array $options = array() |
| 1103 | + ) { |
| 1104 | + return self::getRows( |
| 1105 | + 'DataCenterDBMetaField', 'meta', 'field', $options |
| 1106 | + ); |
| 1107 | + } |
| 1108 | + |
| 1109 | + /** |
| 1110 | + * Wraps self::getRow specializing... |
| 1111 | + * - class as DataCenterDBMetaFieldLink |
| 1112 | + * - category as meta |
| 1113 | + * - type as field |
| 1114 | + */ |
| 1115 | + public static function getMetaField( |
| 1116 | + $id |
| 1117 | + ) { |
| 1118 | + return self::getRow( |
| 1119 | + 'DataCenterDBMetaField', 'meta', 'field', $id |
| 1120 | + ); |
| 1121 | + } |
| 1122 | + |
| 1123 | + /** |
| 1124 | + * Wraps self::numRows specializing... |
| 1125 | + * - category as meta |
| 1126 | + * - type as field |
| 1127 | + */ |
| 1128 | + public static function numMetaFields( |
| 1129 | + array $options = array() |
| 1130 | + ) { |
| 1131 | + return self::numRows( 'meta', 'field', $options ); |
| 1132 | + } |
| 1133 | + |
| 1134 | + /** |
| 1135 | + * Wraps self::getRows specializing... |
| 1136 | + * - class as DataCenterDBMetaValue |
| 1137 | + * - category as meta |
| 1138 | + * - type as value |
| 1139 | + */ |
| 1140 | + public static function getMetaValues( |
| 1141 | + array $options = array() |
| 1142 | + ) { |
| 1143 | + return self::getRows( |
| 1144 | + 'DataCenterDBMetaValue', 'meta', 'value', $options |
| 1145 | + ); |
| 1146 | + } |
| 1147 | + |
| 1148 | + /** |
| 1149 | + * Wraps self::getRow specializing... |
| 1150 | + * - class as DataCenterDBMetaValueLink |
| 1151 | + * - category as meta |
| 1152 | + * - type as value |
| 1153 | + */ |
| 1154 | + public static function getMetaValue( |
| 1155 | + $id |
| 1156 | + ) { |
| 1157 | + return self::getRow( |
| 1158 | + 'DataCenterDBMetaValue', 'meta', 'value', $id |
| 1159 | + ); |
| 1160 | + } |
| 1161 | + |
| 1162 | + /** |
| 1163 | + * Wraps self::numRows specializing... |
| 1164 | + * - category as meta |
| 1165 | + * - type as value |
| 1166 | + */ |
| 1167 | + public static function numMetaValues( |
| 1168 | + array $options = array() |
| 1169 | + ) { |
| 1170 | + return self::numRows( 'meta', 'value', $options ); |
| 1171 | + } |
| 1172 | + |
1095 | 1173 | /* Option Builders */ |
1096 | 1174 | |
1097 | 1175 | /** |
— | — | @@ -1899,6 +1977,52 @@ |
1900 | 1978 | ) { |
1901 | 1979 | return parent::newFromClass( __CLASS__, 'link', 'field', $values ); |
1902 | 1980 | } |
| 1981 | + |
| 1982 | + /* Functions */ |
| 1983 | + |
| 1984 | + public function getValues() { |
| 1985 | + return DataCenterDB::getMetaValues( |
| 1986 | + array_merge_recursive( |
| 1987 | + DataCenterDB::buildCondition( |
| 1988 | + 'meta', 'value', 'field', $this->get( 'field' ) |
| 1989 | + ), |
| 1990 | + DataCenterDB::buildCondition( |
| 1991 | + 'meta', |
| 1992 | + 'value', |
| 1993 | + 'component_category', |
| 1994 | + $this->get( 'component_category' ) |
| 1995 | + ), |
| 1996 | + DataCenterDB::buildCondition( |
| 1997 | + 'meta', |
| 1998 | + 'value', |
| 1999 | + 'component_type', |
| 2000 | + $this->get( 'component_type' ) |
| 2001 | + ) |
| 2002 | + ) |
| 2003 | + ); |
| 2004 | + } |
| 2005 | + |
| 2006 | + public function numValues() { |
| 2007 | + return DataCenterDB::numMetaValues( |
| 2008 | + array_merge_recursive( |
| 2009 | + DataCenterDB::buildCondition( |
| 2010 | + 'meta', 'value', 'field', $this->get( 'field' ) |
| 2011 | + ), |
| 2012 | + DataCenterDB::buildCondition( |
| 2013 | + 'meta', |
| 2014 | + 'value', |
| 2015 | + 'component_category', |
| 2016 | + $this->get( 'component_category' ) |
| 2017 | + ), |
| 2018 | + DataCenterDB::buildCondition( |
| 2019 | + 'meta', |
| 2020 | + 'value', |
| 2021 | + 'component_type', |
| 2022 | + $this->get( 'component_type' ) |
| 2023 | + ) |
| 2024 | + ) |
| 2025 | + ); |
| 2026 | + } |
1903 | 2027 | } |
1904 | 2028 | |
1905 | 2029 | /* Facility Rows */ |
— | — | @@ -1994,6 +2118,37 @@ |
1995 | 2119 | ) { |
1996 | 2120 | return parent::newFromClass( __CLASS__, 'meta', 'field', $values ); |
1997 | 2121 | } |
| 2122 | + |
| 2123 | + /* Functions */ |
| 2124 | + |
| 2125 | + public function getLinks( |
| 2126 | + array $options = array() |
| 2127 | + ) { |
| 2128 | + return DataCenterDB::getMetaFieldLinks( |
| 2129 | + array_merge_recursive( |
| 2130 | + $options, |
| 2131 | + DataCenterDB::buildCondition( |
| 2132 | + 'link', 'field', 'field', $this->getId() |
| 2133 | + ) |
| 2134 | + ) |
| 2135 | + ); |
| 2136 | + } |
| 2137 | + |
| 2138 | + public function getValues() { |
| 2139 | + return DataCenterDB::getMetaValues( |
| 2140 | + DataCenterDB::buildCondition( |
| 2141 | + 'meta', 'value', 'field', $this->getId() |
| 2142 | + ) |
| 2143 | + ); |
| 2144 | + } |
| 2145 | + |
| 2146 | + public function numValues() { |
| 2147 | + return DataCenterDB::numMetaValues( |
| 2148 | + DataCenterDB::buildCondition( |
| 2149 | + 'meta', 'value', 'field', $this->getId() |
| 2150 | + ) |
| 2151 | + ); |
| 2152 | + } |
1998 | 2153 | } |
1999 | 2154 | |
2000 | 2155 | class DataCenterDBMetaValue extends DataCenterDBRow { |
Index: trunk/extensions/DataCenter/Controllers/Settings.php |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | /* Members */ |
13 | 13 | |
14 | 14 | public $types = array( |
15 | | - 'meta' => array( 'page' => 'settings', 'type' => 'meta' ), |
| 15 | + 'field' => array( 'page' => 'settings', 'type' => 'field' ), |
16 | 16 | ); |
17 | 17 | |
18 | 18 | /* Functions */ |
— | — | @@ -20,21 +20,63 @@ |
21 | 21 | array $path |
22 | 22 | ) { |
23 | 23 | // Actions |
| 24 | + if ( $path['id'] && $path['type'] == 'field' ) { |
| 25 | + $this->actions['remove'] = array( |
| 26 | + 'page' => 'settings', |
| 27 | + 'type' => $path['type'], |
| 28 | + 'action' => 'remove', |
| 29 | + 'id' => $path['id'] |
| 30 | + ); |
| 31 | + $this->actions['configure'] = array( |
| 32 | + 'page' => 'settings', |
| 33 | + 'type' => $path['type'], |
| 34 | + 'action' => 'configure', |
| 35 | + 'id' => $path['id'] |
| 36 | + ); |
| 37 | + $this->actions['view'] = array( |
| 38 | + 'page' => 'settings', |
| 39 | + 'type' => $path['type'], |
| 40 | + 'action' => 'view', |
| 41 | + 'id' => $path['id'] |
| 42 | + ); |
| 43 | + } |
24 | 44 | } |
25 | 45 | |
26 | | - public function add( |
| 46 | + public function save( |
27 | 47 | array $data, |
28 | 48 | $type |
29 | 49 | ) { |
30 | | - $setting = DataCenterMeta::newFromValues( $type, $data['row'] ); |
31 | | - return $setting->save(); |
| 50 | + switch ( $type ) { |
| 51 | + case 'field': |
| 52 | + $field = DataCenterDBMetaField::newFromValues( $data['row'] ); |
| 53 | + $field->save(); |
| 54 | + return true; |
| 55 | + } |
| 56 | + return false; |
32 | 57 | } |
33 | 58 | |
34 | | - public function edit( |
| 59 | + public function remove( |
35 | 60 | array $data, |
36 | 61 | $type |
37 | 62 | ) { |
38 | | - $setting = DataCenterMeta::newFromValues( $type, $data['row'] ); |
39 | | - return $setting->save(); |
| 63 | + switch ( $type ) { |
| 64 | + case 'field': |
| 65 | + $field = DataCenterDBMetaField::newFromValues( $data['row'] ); |
| 66 | + $values = $field->getValues(); |
| 67 | + foreach ( $values as $value ) { |
| 68 | + $value->delete(); |
| 69 | + } |
| 70 | + $field->delete(); |
| 71 | + return true; |
| 72 | + } |
| 73 | + return false; |
40 | 74 | } |
| 75 | + |
| 76 | + public function saveFieldLinks( |
| 77 | + array $data, |
| 78 | + $type |
| 79 | + ) { |
| 80 | + DataCenterWidgetFieldLinks::saveFieldLinks( $data ); |
| 81 | + return true; |
| 82 | + } |
41 | 83 | } |
\ No newline at end of file |
Index: trunk/extensions/DataCenter/DataCenter.page.php |
— | — | @@ -114,7 +114,7 @@ |
115 | 115 | 'controller' => 'DataCenterControllerSettings', |
116 | 116 | 'view' => 'DataCenterViewSettings', |
117 | 117 | 'types' => array( |
118 | | - 'meta' => 'DataCenterViewSettingsMeta', |
| 118 | + 'field' => 'DataCenterViewSettingsField', |
119 | 119 | ), |
120 | 120 | 'default' => 'meta' |
121 | 121 | ) |
— | — | @@ -178,8 +178,14 @@ |
179 | 179 | } |
180 | 180 | |
181 | 181 | private static function loadState() { |
182 | | - // Load state from session |
183 | | - self::$state = $_SESSION['DATA_CENTER_STATE']; |
| 182 | + // Checks if state information is in the session |
| 183 | + if ( isset( $_SESSION['DATA_CENTER_STATE'] ) ) { |
| 184 | + // Load state from session |
| 185 | + self::$state = $_SESSION['DATA_CENTER_STATE']; |
| 186 | + } else { |
| 187 | + // Use fallbacks for expected values where possible |
| 188 | + self::$state['private']['last-page'] = $_SERVER['PHP_SELF']; |
| 189 | + } |
184 | 190 | } |
185 | 191 | |
186 | 192 | private static function saveState() { |
— | — | @@ -209,10 +215,6 @@ |
210 | 216 | } |
211 | 217 | |
212 | 218 | public static function getRefererPath() { |
213 | | - if ( !self::$state['private']['last-page'] ) { |
214 | | - // Use this page as a fallback |
215 | | - self::$state['private']['last-page'] = $_SERVER['PHP_SELF']; |
216 | | - } |
217 | 219 | return self::subToPath( |
218 | 220 | self::urlToSub( self::$state['private']['last-page'] ) |
219 | 221 | ); |
Index: trunk/extensions/DataCenter/DataCenter.ui.php |
— | — | @@ -754,6 +754,7 @@ |
755 | 755 | 'body' => 'DataCenterWidgetBody', |
756 | 756 | 'details' => 'DataCenterWidgetDetails', |
757 | 757 | 'difference' => 'DataCenterWidgetDifference', |
| 758 | + 'fieldlinks' => 'DataCenterWidgetFieldLinks', |
758 | 759 | 'form' => 'DataCenterWidgetForm', |
759 | 760 | 'gallery' => 'DataCenterWidgetGallery', |
760 | 761 | 'heading' => 'DataCenterWidgetHeading', |
— | — | @@ -835,6 +836,9 @@ |
836 | 837 | case 'type': |
837 | 838 | return self::message( 'type', $value ); |
838 | 839 | break; |
| 840 | + case 'category': |
| 841 | + return self::message( 'category', $value ); |
| 842 | + break; |
839 | 843 | case 'side': |
840 | 844 | return self::message( 'option', $value ? 'front' : 'back' ); |
841 | 845 | break; |
Index: trunk/extensions/DataCenter/UI/Widgets/Body.php |
— | — | @@ -32,6 +32,11 @@ |
33 | 33 | */ |
34 | 34 | 'subject' => null, |
35 | 35 | /** |
| 36 | + * Name of type of component to inject as parameter for message |
| 37 | + * @datatype string |
| 38 | + */ |
| 39 | + 'type' => null, |
| 40 | + /** |
36 | 41 | * Text to display |
37 | 42 | * @datatype string |
38 | 43 | */ |
— | — | @@ -40,7 +45,7 @@ |
41 | 46 | * Style of box to display body in |
42 | 47 | * @datatype string |
43 | 48 | */ |
44 | | - 'type' => 'generic', |
| 49 | + 'style' => 'generic', |
45 | 50 | ); |
46 | 51 | |
47 | 52 | /* Functions */ |
— | — | @@ -56,7 +61,7 @@ |
57 | 62 | if ( |
58 | 63 | // Required parameters |
59 | 64 | isset( $parameters['message'] ) && |
60 | | - // Required types |
| 65 | + // Required styles |
61 | 66 | is_scalar( $parameters['message'] ) && |
62 | 67 | // Required values |
63 | 68 | ( $parameters['message'] !== null ) |
— | — | @@ -70,6 +75,14 @@ |
71 | 76 | $message = DataCenterUI::message( |
72 | 77 | 'body', $parameters['message'], $parameters['subject'] |
73 | 78 | ); |
| 79 | + // Checks if a type was given |
| 80 | + } else if ( $parameters['type'] !== null ) { |
| 81 | + // Uses type-based message |
| 82 | + $message = DataCenterUI::message( |
| 83 | + 'body', |
| 84 | + $parameters['message'], |
| 85 | + DataCenterUI::message( 'type', $parameters['type'] ) |
| 86 | + ); |
74 | 87 | } else { |
75 | 88 | // Uses plain message |
76 | 89 | $message = DataCenterUI::message( |
— | — | @@ -78,21 +91,21 @@ |
79 | 92 | } |
80 | 93 | // Returns body with message |
81 | 94 | $xmlOutput .= DataCenterXml::div( |
82 | | - array( 'class' => $parameters['type'] ), |
| 95 | + array( 'class' => $parameters['style'] ), |
83 | 96 | DataCenterXml::div( $message ) |
84 | 97 | ); |
85 | 98 | // Checks if text was given |
86 | 99 | } else if ( |
87 | 100 | // Required parameters |
88 | 101 | isset( $parameters['text'] ) && |
89 | | - // Required types |
| 102 | + // Required styles |
90 | 103 | is_scalar( $parameters['text'] ) && |
91 | 104 | // Required values |
92 | 105 | ( $parameters['text'] !== null ) |
93 | 106 | ) { |
94 | 107 | // Returns a body with text |
95 | 108 | $xmlOutput .= DataCenterXml::div( |
96 | | - array( 'class' => $parameters['type'] ), |
| 109 | + array( 'class' => $parameters['style'] ), |
97 | 110 | DataCenterXml::div( $parameters['text'] ) |
98 | 111 | ); |
99 | 112 | } |
Index: trunk/extensions/DataCenter/UI/Widgets/Form.php |
— | — | @@ -114,22 +114,23 @@ |
115 | 115 | * Default XML attributes for label cell |
116 | 116 | */ |
117 | 117 | 'label' => array( |
| 118 | + 'class' => 'label', |
118 | 119 | 'align' => 'left', |
119 | 120 | 'nowrap' => 'nowrap', |
120 | | - 'class' => 'label' |
121 | 121 | ), |
122 | 122 | /** |
123 | 123 | * Default XML attributes for field cell |
124 | 124 | */ |
125 | 125 | 'field' => array( |
| 126 | + 'class' => 'field', |
126 | 127 | 'width' => '200', |
127 | 128 | 'align' => 'left', |
128 | | - 'class' => 'field' |
129 | 129 | ), |
130 | 130 | /** |
131 | 131 | * Default XML attributes for submit button cell |
132 | 132 | */ |
133 | | - 'submit' => array( |
| 133 | + 'buttons' => array( |
| 134 | + 'class' => 'buttons', |
134 | 135 | 'align' => 'right', |
135 | 136 | 'colspan' => 2 |
136 | 137 | ), |
— | — | @@ -174,9 +175,7 @@ |
175 | 176 | ), |
176 | 177 | ); |
177 | 178 | // Begins form |
178 | | - $xmlOutput .= DataCenterXml::open( |
179 | | - 'form', $formAttributes |
180 | | - ); |
| 179 | + $xmlOutput .= DataCenterXml::open( 'form', $formAttributes ); |
181 | 180 | // Inserts content before fields |
182 | 181 | $xmlOutput .= $parameters['insert']; |
183 | 182 | // Begins table |
— | — | @@ -381,7 +380,7 @@ |
382 | 381 | // Adds cancel and submit button |
383 | 382 | $xmlOutput .= DataCenterXML::row( |
384 | 383 | DataCenterXml::cell( |
385 | | - self::$defaultAttributes['submit'], |
| 384 | + self::$defaultAttributes['buttons'], |
386 | 385 | DataCenterXml::tag( |
387 | 386 | 'input', |
388 | 387 | array( |
Index: trunk/extensions/DataCenter/UI/Widgets/FieldLinks.php |
— | — | @@ -0,0 +1,321 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * UI Class for DataCenter extension |
| 6 | + * |
| 7 | + * @file |
| 8 | + * @ingroup Extensions |
| 9 | + */ |
| 10 | + |
| 11 | +class DataCenterWidgetFieldLinks extends DataCenterWidget { |
| 12 | + |
| 13 | + /* Private Static Members */ |
| 14 | + |
| 15 | + private static $defaultParameters = array( |
| 16 | + /** |
| 17 | + * XML ID attribute of widget |
| 18 | + * @datatype string |
| 19 | + */ |
| 20 | + 'id' => 'fieldlinks', |
| 21 | + /** |
| 22 | + * CSS class of widget |
| 23 | + * @datatype string |
| 24 | + */ |
| 25 | + 'class' => 'widget-fieldlinks', |
| 26 | + /** |
| 27 | + * Data Source |
| 28 | + * @datatype DataCenterField |
| 29 | + */ |
| 30 | + 'field' => null, |
| 31 | + /** |
| 32 | + * Current Path |
| 33 | + * @datatype array |
| 34 | + */ |
| 35 | + 'path' => null, |
| 36 | + ); |
| 37 | + |
| 38 | + private static $targets = array( |
| 39 | + 'facility' => array( |
| 40 | + 'location', |
| 41 | + 'space', |
| 42 | + ), |
| 43 | + 'asset' => array( |
| 44 | + 'rack', |
| 45 | + 'object', |
| 46 | + ), |
| 47 | + 'model' => array( |
| 48 | + 'rack', |
| 49 | + 'object', |
| 50 | + 'port', |
| 51 | + ), |
| 52 | + ); |
| 53 | + |
| 54 | + private static $defaultAttributes = array( |
| 55 | + /** |
| 56 | + * Default XML attributes for table |
| 57 | + */ |
| 58 | + 'table' => array( |
| 59 | + 'width' => '100%', |
| 60 | + 'cellpadding' => 5, |
| 61 | + 'cellspacing' => 0, |
| 62 | + 'border' => 0, |
| 63 | + ), |
| 64 | + /** |
| 65 | + * Default XML attributes for heading cell |
| 66 | + */ |
| 67 | + 'heading' => array( |
| 68 | + 'align' => 'left', |
| 69 | + 'colspan' => 3 |
| 70 | + ), |
| 71 | + /** |
| 72 | + * Default XML attributes for checkbox cell |
| 73 | + */ |
| 74 | + 'checkbox' => array( |
| 75 | + 'class' => 'checkbox', |
| 76 | + 'width' => '10%', |
| 77 | + ), |
| 78 | + /** |
| 79 | + * Default XML attributes for label cell |
| 80 | + */ |
| 81 | + 'label' => array( |
| 82 | + 'class' => 'label', |
| 83 | + ), |
| 84 | + /** |
| 85 | + * Default XML attributes for label cell |
| 86 | + */ |
| 87 | + 'uses' => array( |
| 88 | + 'class' => 'uses', |
| 89 | + ), |
| 90 | + /** |
| 91 | + * Default XML attributes for buttons cell |
| 92 | + */ |
| 93 | + 'buttons' => array( |
| 94 | + 'class' => 'buttons', |
| 95 | + 'align' => 'right', |
| 96 | + 'colspan' => 3 |
| 97 | + ), |
| 98 | + ); |
| 99 | + |
| 100 | + /* Static Functions */ |
| 101 | + |
| 102 | + public static function render( |
| 103 | + array $parameters |
| 104 | + ) { |
| 105 | + global $wgUser; |
| 106 | + // Sets Defaults |
| 107 | + $parameters = array_merge( self::$defaultParameters, $parameters ); |
| 108 | + // Begins widget |
| 109 | + $xmlOutput = parent::begin( $parameters['class'] ); |
| 110 | + // Gets existing links from database |
| 111 | + $metaFieldLinks = $parameters['field']->getLinks(); |
| 112 | + $existsTable = array(); |
| 113 | + foreach ( $metaFieldLinks as $metaFieldLink ) { |
| 114 | + $key = implode( |
| 115 | + '_', |
| 116 | + $metaFieldLink->get( |
| 117 | + array( 'component_category', 'component_type' ) |
| 118 | + ) |
| 119 | + ); |
| 120 | + $existsTable[$key] = $metaFieldLink; |
| 121 | + } |
| 122 | + // Builds form attributes |
| 123 | + $formAttributes = array( |
| 124 | + 'id' => 'form_fieldlinks', |
| 125 | + 'name' => 'form_fieldlinks', |
| 126 | + 'method' => 'post', |
| 127 | + 'action' => DataCenterXml::url( $parameters['path'] ), |
| 128 | + ); |
| 129 | + // Begins form |
| 130 | + $xmlOutput .= DataCenterXml::open( 'form', $formAttributes ); |
| 131 | + // Begins table |
| 132 | + $xmlOutput .= DataCenterXml::open( |
| 133 | + 'table', self::$defaultAttributes['table'] |
| 134 | + ); |
| 135 | + foreach ( self::$targets as $category => $types ) { |
| 136 | + $xmlOutput .= DataCenterXml::row( |
| 137 | + DataCenterXml::headingCell( |
| 138 | + self::$defaultAttributes['heading'], |
| 139 | + DataCenterUI::message( 'category', $category ) |
| 140 | + ) |
| 141 | + ); |
| 142 | + foreach ( $types as $type ) { |
| 143 | + $name = $category . '_' . $type; |
| 144 | + $checkboxAttributes = array( |
| 145 | + 'type' => 'checkbox', |
| 146 | + 'name' => "meta[{$name}]", |
| 147 | + 'id' => "field_{$name}", |
| 148 | + 'value' => 1, |
| 149 | + ); |
| 150 | + $count = 0; |
| 151 | + if ( isset( $existsTable[$name] ) ) { |
| 152 | + $checkboxAttributes['checked'] = 'checked'; |
| 153 | + $count = $existsTable[$name]->numValues(); |
| 154 | + if ( $count > 0 ) { |
| 155 | + $checkboxAttributes['disabled'] = 'true'; |
| 156 | + $checkboxAttributes['name'] = "locked[{$name}]"; |
| 157 | + $xmlOutput .= DataCenterXml::tag( |
| 158 | + 'input', |
| 159 | + array( |
| 160 | + 'type' => 'hidden', |
| 161 | + 'name' => "meta[{$name}]", |
| 162 | + 'value' => 1, |
| 163 | + ) |
| 164 | + ); |
| 165 | + } |
| 166 | + } |
| 167 | + $xmlOutput .= DataCenterXml::row( |
| 168 | + DataCenterXml::cell( |
| 169 | + self::$defaultAttributes['checkbox'], |
| 170 | + DataCenterXml::tag( 'input', $checkboxAttributes ) |
| 171 | + ), |
| 172 | + DataCenterXml::cell( |
| 173 | + self::$defaultAttributes['label'], |
| 174 | + DataCenterXml::tag( |
| 175 | + 'label', |
| 176 | + array( 'for' => "field_{$name}" ), |
| 177 | + DataCenterUI::message( 'type', $type ) |
| 178 | + ) |
| 179 | + ), |
| 180 | + DataCenterXml::cell( |
| 181 | + self::$defaultAttributes['uses'], |
| 182 | + $count > 0 ? |
| 183 | + DataCenterUI::message( 'label', 'num-uses', $count ) : |
| 184 | + '' |
| 185 | + ) |
| 186 | + ); |
| 187 | + } |
| 188 | + } |
| 189 | + // Adds reset and submit button |
| 190 | + $xmlOutput .= DataCenterXML::row( |
| 191 | + DataCenterXml::cell( |
| 192 | + self::$defaultAttributes['buttons'], |
| 193 | + DataCenterXml::tag( |
| 194 | + 'input', |
| 195 | + array( |
| 196 | + 'type' => 'reset', |
| 197 | + 'name' => 'reset', |
| 198 | + 'class' => 'reset', |
| 199 | + 'value' => DataCenterUI::message( 'label', 'reset' ), |
| 200 | + ) |
| 201 | + ) . |
| 202 | + DataCenterXml::tag( |
| 203 | + 'input', |
| 204 | + array( |
| 205 | + 'type' => 'submit', |
| 206 | + 'name' => 'submit', |
| 207 | + 'class' => 'submit', |
| 208 | + 'value' => DataCenterUI::message( 'label', 'save' ), |
| 209 | + ) |
| 210 | + ) |
| 211 | + ) |
| 212 | + ); |
| 213 | + $xmlOutput .= DataCenterXml::close( 'table' ); |
| 214 | + // Adds row fields |
| 215 | + $xmlOutput .= DataCenterXml::tag( |
| 216 | + 'input', array( |
| 217 | + 'type' => 'hidden', |
| 218 | + 'name' => 'row[id]', |
| 219 | + 'value' => $parameters['field']->getId(), |
| 220 | + ) |
| 221 | + ); |
| 222 | + // Adds do field |
| 223 | + $xmlOutput .= DataCenterXml::tag( |
| 224 | + 'input', array( |
| 225 | + 'type' => 'hidden', |
| 226 | + 'name' => 'do', |
| 227 | + 'value' => 'saveFieldLinks' |
| 228 | + ) |
| 229 | + ); |
| 230 | + // Adds token field |
| 231 | + $xmlOutput .= DataCenterXml::tag( |
| 232 | + 'input', array( |
| 233 | + 'type' => 'hidden', |
| 234 | + 'name' => 'token', |
| 235 | + 'value' => $wgUser->editToken() |
| 236 | + ) |
| 237 | + ); |
| 238 | + // Adds success field |
| 239 | + $xmlOutput .= DataCenterXml::tag( |
| 240 | + 'input', |
| 241 | + array( |
| 242 | + 'type' => 'hidden', |
| 243 | + 'name' => 'success', |
| 244 | + 'value' => DataCenterXml::url( $parameters['path'] ) |
| 245 | + ) |
| 246 | + ); |
| 247 | + // Adds failure field |
| 248 | + $xmlOutput .= DataCenterXml::tag( |
| 249 | + 'input', |
| 250 | + array( |
| 251 | + 'type' => 'hidden', |
| 252 | + 'name' => 'failure', |
| 253 | + 'value' => DataCenterXml::url( $parameters['path'] ) |
| 254 | + ) |
| 255 | + ); |
| 256 | + // Adds canellation field |
| 257 | + $xmlOutput .= DataCenterXml::tag( |
| 258 | + 'input', |
| 259 | + array( |
| 260 | + 'type' => 'hidden', |
| 261 | + 'name' => 'cancellation', |
| 262 | + 'value' => DataCenterXml::url( $parameters['path'] ) |
| 263 | + ) |
| 264 | + ); |
| 265 | + $xmlOutput .= DataCenterXml::close( 'form' ); |
| 266 | + // Ends widget |
| 267 | + $xmlOutput .= parent::end(); |
| 268 | + // Returns results |
| 269 | + return $xmlOutput; |
| 270 | + } |
| 271 | + |
| 272 | + public function saveFieldLinks( |
| 273 | + array $data |
| 274 | + ) { |
| 275 | + $metaField = DataCenterDBMetaField::newFromValues( $data['row'] ); |
| 276 | + $metaFieldLinks = $metaField->getLinks(); |
| 277 | + // Build table of links that do exist |
| 278 | + $doesExistTable = array(); |
| 279 | + foreach ( $metaFieldLinks as $metaFieldLink ) { |
| 280 | + $key = implode( |
| 281 | + '_', |
| 282 | + $metaFieldLink->get( |
| 283 | + array( 'component_category', 'component_type' ) |
| 284 | + ) |
| 285 | + ); |
| 286 | + $doesExistTable[$key] = $metaFieldLink; |
| 287 | + } |
| 288 | + // Build table of links that should exist |
| 289 | + $shouldExistTable = array(); |
| 290 | + foreach ( $data['meta'] as $key => $value ) { |
| 291 | + list( $category, $type ) = explode( '_', $key ); |
| 292 | + $shouldExistTable[$category . '_' . $type] = true; |
| 293 | + } |
| 294 | + // Solve the difference |
| 295 | + foreach ( self::$targets as $category => $types ) { |
| 296 | + foreach ( $types as $type ) { |
| 297 | + $key = $category . '_' . $type; |
| 298 | + if ( |
| 299 | + isset( $shouldExistTable[$key] ) && |
| 300 | + !isset( $doesExistTable[$key] ) |
| 301 | + ) { |
| 302 | + // Insert new |
| 303 | + $metaFieldLink = DataCenterDBMetaFieldLink::newFromValues( |
| 304 | + array( |
| 305 | + 'field' => $metaField->getId(), |
| 306 | + 'component_category' => $category, |
| 307 | + 'component_type' => $type, |
| 308 | + ) |
| 309 | + ); |
| 310 | + $metaFieldLink->insert(); |
| 311 | + } else if ( |
| 312 | + !isset( $shouldExistTable[$key] ) && |
| 313 | + isset( $doesExistTable[$key] ) && |
| 314 | + ( $doesExistTable[$key]->numValues() == 0 ) |
| 315 | + ) { |
| 316 | + // Remove existing |
| 317 | + $doesExistTable[$key]->delete(); |
| 318 | + } |
| 319 | + } |
| 320 | + } |
| 321 | + } |
| 322 | +} |
\ No newline at end of file |
Index: trunk/extensions/DataCenter/Views/Settings/Meta.php |
— | — | @@ -1,151 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * Connections UI Class for DataCenter extension |
5 | | - * |
6 | | - * @file |
7 | | - * @ingroup Extensions |
8 | | - */ |
9 | | - |
10 | | -class DataCenterViewSettingsMeta extends DataCenterView { |
11 | | - |
12 | | - /* Private Static Members */ |
13 | | - |
14 | | - private static $componentTypes = array( |
15 | | - 'facility' => array( |
16 | | - 'location', |
17 | | - 'space', |
18 | | - ), |
19 | | - 'asset' => array( |
20 | | - 'rack', |
21 | | - 'object', |
22 | | - ), |
23 | | - 'model' => array( |
24 | | - 'rack', |
25 | | - 'object', |
26 | | - 'port', |
27 | | - ), |
28 | | - ); |
29 | | - |
30 | | - /* Functions */ |
31 | | - |
32 | | - public function main( |
33 | | - $path |
34 | | - ) { |
35 | | - /* |
36 | | - $tables = array(); |
37 | | - foreach ( $types as $type => $label ) { |
38 | | - // Gets all components from database |
39 | | - $fields = DataCenterDB::getMetaFields( |
40 | | - DataCenterDB::buildCondition( |
41 | | - 'meta', 'field', 'asset_type', $type |
42 | | - ) |
43 | | - ); |
44 | | - // Adds table to list of tables |
45 | | - $tables[$label] = DataCenterUI::renderWidget( |
46 | | - 'table', |
47 | | - array( |
48 | | - 'heading' => array( 'message' => 'fields' ), |
49 | | - 'rows' => $fields, |
50 | | - 'fields' => array( |
51 | | - 'name', 'format' => array( 'format' => 'option' ) |
52 | | - ), |
53 | | - 'link' => array( |
54 | | - 'page' => 'settings', |
55 | | - 'type' => 'field', |
56 | | - 'id' => '#id', |
57 | | - 'action' => 'view', |
58 | | - ), |
59 | | - 'actions' => array( |
60 | | - 'links' => array( |
61 | | - array( |
62 | | - 'page' => 'settings', |
63 | | - 'type' => 'field', |
64 | | - 'action' => 'add', |
65 | | - 'parameter' => $type, |
66 | | - ), |
67 | | - ), |
68 | | - ), |
69 | | - ) |
70 | | - ); |
71 | | - } |
72 | | - // Returns tabbed layout with tables of meta fields for each model type |
73 | | - return DataCenterUI::renderLayout( 'tabs', $tables ); |
74 | | - */ |
75 | | - return '[LIST OF META FIELDS]'; |
76 | | - } |
77 | | - |
78 | | - public function add( |
79 | | - $path |
80 | | - ) { |
81 | | - return $this->edit( $path ); |
82 | | - } |
83 | | - |
84 | | - public function edit( |
85 | | - $path |
86 | | - ) { |
87 | | - // Detects mode |
88 | | - if ( !$path['id'] ) { |
89 | | - // Creates new component |
90 | | - $field = DataCenterMeta::newFromValues( |
91 | | - 'field', array( 'asset_type' => $path['parameter'] ) |
92 | | - ); |
93 | | - // Sets 'do' specific parameters |
94 | | - $formParameters = array( |
95 | | - 'do' => 'add', |
96 | | - 'label' => 'add', |
97 | | - 'hidden' => array( 'asset_type' ), |
98 | | - 'success' => array( |
99 | | - 'page' => 'settings', |
100 | | - 'type' => 'meta' |
101 | | - ), |
102 | | - ); |
103 | | - } else { |
104 | | - // Gets component from database |
105 | | - $field = DataCenterDB::getMetaField( $path['id'] ); |
106 | | - // Sets 'do' specific parameters |
107 | | - $formParameters = array( |
108 | | - 'do' => 'edit', |
109 | | - 'label' => 'save', |
110 | | - 'hidden' => array( 'id', 'asset_type' ), |
111 | | - 'success' => array( |
112 | | - 'page' => 'settings', |
113 | | - 'type' => 'meta', |
114 | | - 'action' => 'view', |
115 | | - 'id' => $path['id'], |
116 | | - ), |
117 | | - ); |
118 | | - } |
119 | | - // Returns 2 columm layout with a form and a scene |
120 | | - return DataCenterUI::renderLayout( |
121 | | - 'columns', |
122 | | - array( |
123 | | - DataCenterUI::renderWidget( |
124 | | - 'form', |
125 | | - array_merge( |
126 | | - $formParameters, |
127 | | - array( |
128 | | - 'failure' => $path, |
129 | | - 'action' => array( |
130 | | - 'page' => 'settings', |
131 | | - 'type' => 'meta' |
132 | | - ), |
133 | | - 'row' => $field, |
134 | | - 'fields' => array( |
135 | | - 'name' => array( 'type' => 'string' ), |
136 | | - 'format' => array( |
137 | | - 'type' => 'list', |
138 | | - 'enum' => array( |
139 | | - 'category' => 'meta', |
140 | | - 'type' => 'field', |
141 | | - 'field' => 'format', |
142 | | - ), |
143 | | - ), |
144 | | - ), |
145 | | - ) |
146 | | - ) |
147 | | - ), |
148 | | - '[MODEL VIEWER]', |
149 | | - ) |
150 | | - ); |
151 | | - } |
152 | | -} |
\ No newline at end of file |
Index: trunk/extensions/DataCenter/Views/Settings/Field.php |
— | — | @@ -0,0 +1,271 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Connections UI Class for DataCenter extension |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + */ |
| 9 | + |
| 10 | +class DataCenterViewSettingsField extends DataCenterView { |
| 11 | + |
| 12 | + /* Functions */ |
| 13 | + |
| 14 | + public function main( |
| 15 | + $path |
| 16 | + ) { |
| 17 | + $metaFields = DataCenterDB::getMetaFields(); |
| 18 | + return DataCenterUI::renderLayout( |
| 19 | + 'columns', |
| 20 | + array( |
| 21 | + DataCenterUI::renderLayout( |
| 22 | + 'rows', |
| 23 | + array( |
| 24 | + DataCenterUI::renderWidget( |
| 25 | + 'heading', array( 'message' => 'fields' ) |
| 26 | + ), |
| 27 | + DataCenterUI::renderWidget( |
| 28 | + 'table', |
| 29 | + array( |
| 30 | + 'rows' => $metaFields, |
| 31 | + 'fields' => array( |
| 32 | + 'name', |
| 33 | + 'format' => array( 'format' => 'option' ) |
| 34 | + ), |
| 35 | + 'link' => array( |
| 36 | + 'page' => 'settings', |
| 37 | + 'type' => 'field', |
| 38 | + 'action' => 'view', |
| 39 | + 'id' => '#id', |
| 40 | + ) |
| 41 | + ) |
| 42 | + ), |
| 43 | + DataCenterUI::renderWidget( |
| 44 | + 'actions', |
| 45 | + array( |
| 46 | + 'links' => array( |
| 47 | + array( |
| 48 | + 'page' => 'settings', |
| 49 | + 'type' => 'field', |
| 50 | + 'action' => 'add' |
| 51 | + ) |
| 52 | + ), |
| 53 | + ) |
| 54 | + ), |
| 55 | + ) |
| 56 | + ), |
| 57 | + ) |
| 58 | + ); |
| 59 | + } |
| 60 | + |
| 61 | + public function view( |
| 62 | + $path |
| 63 | + ) { |
| 64 | + $metaField = DataCenterDB::getMetaField( $path['id'] ); |
| 65 | + return DataCenterUI::renderLayout( |
| 66 | + 'columns', |
| 67 | + array( |
| 68 | + DataCenterUI::renderLayout( |
| 69 | + 'rows', |
| 70 | + array( |
| 71 | + DataCenterUI::renderWidget( |
| 72 | + 'heading', array( 'message' => 'field' ) |
| 73 | + ), |
| 74 | + DataCenterUI::renderWidget( |
| 75 | + 'details', |
| 76 | + array( |
| 77 | + 'row' => $metaField, |
| 78 | + 'fields' => array( |
| 79 | + 'name', |
| 80 | + 'format' => array( 'format' => 'option' ) |
| 81 | + ) |
| 82 | + ) |
| 83 | + ), |
| 84 | + ) |
| 85 | + ), |
| 86 | + DataCenterUI::renderLayout( |
| 87 | + 'rows', |
| 88 | + array( |
| 89 | + DataCenterUI::renderWidget( |
| 90 | + 'heading', |
| 91 | + array( 'message' => 'applied-components' ) |
| 92 | + ), |
| 93 | + DataCenterUI::renderWidget( |
| 94 | + 'fieldlinks', |
| 95 | + array( |
| 96 | + 'field' => $metaField, |
| 97 | + 'path' => $path, |
| 98 | + ) |
| 99 | + ), |
| 100 | + ) |
| 101 | + ), |
| 102 | + ) |
| 103 | + ); |
| 104 | + } |
| 105 | + |
| 106 | + public function remove( |
| 107 | + $path |
| 108 | + ) { |
| 109 | + $metaField = DataCenterDB::getMetaField( $path['id'] ); |
| 110 | + $metaFieldLinks = $metaField->getLinks(); |
| 111 | + foreach ( $metaFieldLinks as $metaFieldLink ) { |
| 112 | + $metaFieldLink->set( 'uses', $metaFieldLink->numValues() ); |
| 113 | + } |
| 114 | + // Returns 2 columm layout with a form and a scene |
| 115 | + return DataCenterUI::renderLayout( |
| 116 | + 'columns', |
| 117 | + array( |
| 118 | + DataCenterUI::renderLayout( |
| 119 | + 'rows', |
| 120 | + array( |
| 121 | + DataCenterUI::renderWidget( |
| 122 | + 'heading', |
| 123 | + array( |
| 124 | + 'message' => 'remove-type', |
| 125 | + 'type' => 'field' |
| 126 | + ) |
| 127 | + ), |
| 128 | + DataCenterUI::renderWidget( |
| 129 | + 'body', |
| 130 | + array( |
| 131 | + 'message' => 'notice-removing-field', |
| 132 | + 'style' => 'notice', |
| 133 | + ) |
| 134 | + ), |
| 135 | + DataCenterUI::renderWidget( |
| 136 | + 'table', |
| 137 | + array( |
| 138 | + 'rows' => $metaFieldLinks, |
| 139 | + 'fields' => array( |
| 140 | + 'category' => array( |
| 141 | + 'field' => 'component_category', |
| 142 | + 'format' => 'category' |
| 143 | + ), |
| 144 | + 'type' => array( |
| 145 | + 'field' => 'component_type', |
| 146 | + 'format' => 'type' |
| 147 | + ), |
| 148 | + 'uses' |
| 149 | + ) |
| 150 | + ) |
| 151 | + ), |
| 152 | + DataCenterUI::renderWidget( |
| 153 | + 'form', |
| 154 | + array( |
| 155 | + 'do' => 'remove', |
| 156 | + 'label' => 'remove', |
| 157 | + 'hidden' => array( 'id' ), |
| 158 | + 'success' => array( |
| 159 | + 'page' => 'settings', |
| 160 | + 'type' => 'field', |
| 161 | + ), |
| 162 | + 'failure' => $path, |
| 163 | + 'cancellation' => array( |
| 164 | + 'page' => 'settings', |
| 165 | + 'type' => 'field', |
| 166 | + 'action' => 'view', |
| 167 | + 'id' => $path['id'], |
| 168 | + ), |
| 169 | + 'row' => $metaField, |
| 170 | + 'action' => array( |
| 171 | + 'page' => 'settings', |
| 172 | + 'type' => 'field' |
| 173 | + ), |
| 174 | + 'fields' => array() |
| 175 | + ) |
| 176 | + ) |
| 177 | + ) |
| 178 | + ), |
| 179 | + ' ' |
| 180 | + ) |
| 181 | + ); |
| 182 | + } |
| 183 | + |
| 184 | + public function add( |
| 185 | + $path |
| 186 | + ) { |
| 187 | + return $this->configure( $path ); |
| 188 | + } |
| 189 | + |
| 190 | + public function configure( |
| 191 | + $path |
| 192 | + ) { |
| 193 | + // Detects mode |
| 194 | + if ( !$path['id'] ) { |
| 195 | + // Creates new component |
| 196 | + $field = DataCenterDBMetaField::newFromValues(); |
| 197 | + // Sets 'do' specific parameters |
| 198 | + $formParameters = array( |
| 199 | + 'label' => 'add', |
| 200 | + 'success' => array( |
| 201 | + 'page' => 'settings', |
| 202 | + 'type' => 'field' |
| 203 | + ), |
| 204 | + ); |
| 205 | + } else { |
| 206 | + // Gets component from database |
| 207 | + $field = DataCenterDB::getMetaField( $path['id'] ); |
| 208 | + // Sets 'do' specific parameters |
| 209 | + $formParameters = array( |
| 210 | + 'label' => 'save', |
| 211 | + 'hidden' => array( 'id' ), |
| 212 | + 'success' => array( |
| 213 | + 'page' => 'settings', |
| 214 | + 'type' => 'field', |
| 215 | + 'action' => 'view', |
| 216 | + 'id' => $path['id'], |
| 217 | + ), |
| 218 | + ); |
| 219 | + } |
| 220 | + // Returns 2 columm layout with a form and a scene |
| 221 | + return DataCenterUI::renderLayout( |
| 222 | + 'columns', |
| 223 | + array( |
| 224 | + DataCenterUI::renderLayout( |
| 225 | + 'rows', |
| 226 | + array( |
| 227 | + DataCenterUI::renderWidget( |
| 228 | + 'heading', |
| 229 | + array( |
| 230 | + 'message' => 'configuring-type', |
| 231 | + 'type' => 'field', |
| 232 | + ) |
| 233 | + ), |
| 234 | + DataCenterUI::renderWidget( |
| 235 | + 'body', |
| 236 | + array( |
| 237 | + 'message' => 'important-configuring-field', |
| 238 | + 'style' => 'important', |
| 239 | + ) |
| 240 | + ), |
| 241 | + DataCenterUI::renderWidget( |
| 242 | + 'form', |
| 243 | + array_merge( |
| 244 | + $formParameters, |
| 245 | + array( |
| 246 | + 'do' => 'save', |
| 247 | + 'failure' => $path, |
| 248 | + 'action' => array( |
| 249 | + 'page' => 'settings', 'type' => 'field' |
| 250 | + ), |
| 251 | + 'row' => $field, |
| 252 | + 'fields' => array( |
| 253 | + 'name' => array( 'type' => 'string' ), |
| 254 | + 'format' => array( |
| 255 | + 'type' => 'list', |
| 256 | + 'enum' => array( |
| 257 | + 'category' => 'meta', |
| 258 | + 'type' => 'field', |
| 259 | + 'field' => 'format', |
| 260 | + ), |
| 261 | + ), |
| 262 | + ), |
| 263 | + ) |
| 264 | + ) |
| 265 | + ), |
| 266 | + ) |
| 267 | + ), |
| 268 | + ' ' |
| 269 | + ) |
| 270 | + ); |
| 271 | + } |
| 272 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/DataCenter/Views/Settings/Field.php |
___________________________________________________________________ |
Name: svn:mergeinfo |
1 | 273 | + |
Name: svn:eol-style |
2 | 274 | + native |
Index: trunk/extensions/DataCenter/Views/Overview.php |
— | — | @@ -22,8 +22,8 @@ |
23 | 23 | DataCenterUI::renderWidget( |
24 | 24 | 'body', |
25 | 25 | array( |
26 | | - 'message' => 'welcome', |
27 | | - 'type' => 'important' |
| 26 | + 'message' => 'important-welcome', |
| 27 | + 'style' => 'important' |
28 | 28 | ) |
29 | 29 | ) |
30 | 30 | ) |
Index: trunk/extensions/DataCenter/DataCenter.i18n.php |
— | — | @@ -30,9 +30,15 @@ |
31 | 31 | 'datacenter-ui-type-rack' => 'Rack', |
32 | 32 | 'datacenter-ui-type-object' => 'Object', |
33 | 33 | 'datacenter-ui-type-port' => 'Port', |
34 | | - 'datacenter-ui-type-meta' => 'Meta', |
35 | 34 | 'datacenter-ui-type-model' => 'Model', |
36 | 35 | 'datacenter-ui-type-attachment' => 'Attachment', |
| 36 | + 'datacenter-ui-type-field' => 'Field', |
| 37 | + // Categories |
| 38 | + 'datacenter-ui-category-facility' => 'Facility', |
| 39 | + 'datacenter-ui-category-asset' => 'Asset', |
| 40 | + 'datacenter-ui-category-model' => 'Model', |
| 41 | + 'datacenter-ui-category-link' => 'Link', |
| 42 | + 'datacenter-ui-category-meta' => 'Meta', |
37 | 43 | // Actions |
38 | 44 | 'datacenter-ui-action-configure' => 'Configure', |
39 | 45 | 'datacenter-ui-action-edit' => 'Edit', |
— | — | @@ -49,6 +55,7 @@ |
50 | 56 | 'datacenter-ui-action-create-type' => 'Create $1', |
51 | 57 | 'datacenter-ui-action-design-type' => 'Design and Deploy $1', |
52 | 58 | 'datacenter-ui-action-select-type' => 'Select and Attach $1', |
| 59 | + 'datacenter-ui-action-apply-type' => 'Apply $1', |
53 | 60 | 'datacenter-ui-action-history' => 'History', |
54 | 61 | // Options |
55 | 62 | 'datacenter-ui-option-front' => 'Front', |
— | — | @@ -74,6 +81,11 @@ |
75 | 82 | 'datacenter-ui-option-future' => 'Future', |
76 | 83 | 'datacenter-ui-option-true' => 'True', |
77 | 84 | 'datacenter-ui-option-false' => 'False', |
| 85 | + 'datacenter-ui-option-boolean' => 'Boolean (yes/no)', |
| 86 | + 'datacenter-ui-option-string' => 'String (single-link)', |
| 87 | + 'datacenter-ui-option-text' => 'Text (multi-line)', |
| 88 | + 'datacenter-ui-option-number' => 'Number', |
| 89 | + 'datacenter-ui-option-tag' => 'Tag', |
78 | 90 | // Errors |
79 | 91 | 'datacenter-ui-error-insufficient-data' => 'You have provided insufficient data', |
80 | 92 | 'datacenter-ui-error-invalid-data' => 'You have provided invalid data', |
— | — | @@ -129,7 +141,9 @@ |
130 | 142 | 'datacenter-ui-field-manufacturer' => 'Manufacturer', |
131 | 143 | 'datacenter-ui-field-tense' => 'Tense', |
132 | 144 | 'datacenter-ui-field-change-summary' => 'Change Summary', |
| 145 | + 'datacenter-ui-field-uses' => 'Uses', |
133 | 146 | // Label |
| 147 | + 'datacenter-ui-label-reset' => 'Reset', |
134 | 148 | 'datacenter-ui-label-cancel' => 'Cancel', |
135 | 149 | 'datacenter-ui-label-remove' => 'Remove', |
136 | 150 | 'datacenter-ui-label-save' => 'Save', |
— | — | @@ -140,7 +154,8 @@ |
141 | 155 | 'datacenter-ui-label-add' => 'Add', |
142 | 156 | 'datacenter-ui-label-add-type' => 'Add $1', |
143 | 157 | 'datacenter-ui-label-browse-by' => 'Browse by:', |
144 | | - 'datacenter-ui-label-num-spaces' => '$1 {{PLURAL:$1|Space|Spaces}}', |
| 158 | + 'datacenter-ui-label-num-spaces' => '$1 {{PLURAL:$1|Spaces|Space}}', |
| 159 | + 'datacenter-ui-label-num-uses' => '$1 {{PLURAL:$1|uses|use}}', |
145 | 160 | 'datacenter-ui-label-degrees-value' => '$1°', |
146 | 161 | // Defaults |
147 | 162 | 'datacenter-ui-default-new-type' => 'New $1', |
— | — | @@ -151,6 +166,8 @@ |
152 | 167 | 'datacenter-ui-heading-spaces' => 'Spaces', |
153 | 168 | 'datacenter-ui-heading-racks' => 'Racks', |
154 | 169 | 'datacenter-ui-heading-objects' => 'Objects', |
| 170 | + 'datacenter-ui-heading-fields' => 'Fields', |
| 171 | + 'datacenter-ui-heading-applied-components' => 'Applied Components', |
155 | 172 | // Information Headings |
156 | 173 | 'datacenter-ui-heading-details' => 'Details', |
157 | 174 | 'datacenter-ui-heading-model-attachments' => 'Model Attachments', |
— | — | @@ -161,6 +178,7 @@ |
162 | 179 | 'datacenter-ui-heading-location' => 'Location', |
163 | 180 | 'datacenter-ui-heading-space' => 'Space', |
164 | 181 | 'datacenter-ui-heading-configuration' => 'Configuration', |
| 182 | + 'datacenter-ui-heading-field' => 'Field', |
165 | 183 | // Type-based Headings |
166 | 184 | 'datacenter-ui-heading-history-type' => '$1 History', |
167 | 185 | 'datacenter-ui-heading-remove-type' => 'Remove $1?', |
— | — | @@ -179,9 +197,11 @@ |
180 | 198 | 'datacenter-ui-heading-attaching-type' => 'Attaching $1', |
181 | 199 | 'datacenter-ui-heading-configuring-type' => 'Configuring $1', |
182 | 200 | // Bodies |
183 | | - 'datacenter-ui-body-confirm-remove-type' => 'Removing this $1 will result in the removal of the following links and cannot be recovered from. Do you want to continue with the removal?', |
184 | | - 'datacenter-ui-body-invalid-request' => 'You have requested a page with an invalid path.', |
185 | | - 'datacenter-ui-body-welcome' => 'Welcome to the beta-testing of DataCenter. Please poke around and give feedback Trevor Parscal. If you are going to help out, take a look at the media wiki extension page for DataCenter which has a list of feature priorities.', |
| 201 | + 'datacenter-ui-body-notice-removing-type' => 'Removing this $1 will result in the removal of the following links and cannot be recovered from. Do you want to continue with the removal?', |
| 202 | + 'datacenter-ui-body-notice-removing-field' => 'Removing this field will result in the removal of the following links and all data associated with them and cannot be recovered from. Do you want to continue with the removal?', |
| 203 | + 'datacenter-ui-body-important-configuring-field' => 'Changing the format of this field may cause related data to be interpreted incorectly, espcially when switching between textual, numeric and boolean formats.', |
| 204 | + 'datacenter-ui-body-important-welcome' => 'Welcome to the beta-testing of DataCenter. Please poke around and give feedback Trevor Parscal. If you are going to help out, take a look at the media wiki extension page for DataCenter which has a list of feature priorities.', |
| 205 | + 'datacenter-ui-body-error-invalid-request' => 'You have requested a page with an invalid path.', |
186 | 206 | // Tabs |
187 | 207 | 'datacenter-ui-tab-racks' => 'Racks', |
188 | 208 | 'datacenter-ui-tab-details' => 'Details', |