Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 209a7b7

Browse files
committed
[IM] Enlarge fields - especially chosen dropdowns
An update of Bootstrap sometime ago changed how the spans worked introducing this issue. Closes inex#133
1 parent d202c38 commit 209a7b7

3 files changed

Lines changed: 47 additions & 49 deletions

File tree

library/IXP/Form/Customer.php

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ class IXP_Form_Customer extends IXP_Form
3636
public function init()
3737
{
3838
$this->setDecorators( [ [ 'ViewScript', [ 'viewScript' => 'customer/forms/edit.phtml' ] ] ] );
39-
39+
4040
$name = $this->createElement( 'text', 'name' );
4141
$name->addValidator( 'stringLength', false, array( 1, 255 ) )
4242
->setRequired( true )
4343
->setLabel( 'Name' )
44-
->setAttrib( 'class', 'span6' )
44+
->setAttrib( 'class', 'span10' )
4545
->addFilter( 'StringTrim' )
4646
->addFilter( new OSS_Filter_StripSlashes() );
4747
$this->addElement( $name );
@@ -51,7 +51,7 @@ public function init()
5151
->setRegisterInArrayValidator( true )
5252
->setLabel( 'Type' )
5353
->setRequired( true )
54-
->setAttrib( 'class', 'chzn-select span4' )
54+
->setAttrib( 'class', 'chzn-select span8' )
5555
->setErrorMessages( array( 'Please select a customer type' ) );
5656
$this->addElement( $type );
5757

@@ -60,7 +60,7 @@ public function init()
6060
->addValidator( 'alnum' )
6161
->addValidator( 'regex', false, array('/^[a-z0-9]+/' ) )
6262
->setRequired( true )
63-
->setAttrib( 'class', 'span4' )
63+
->setAttrib( 'class', 'span8' )
6464
->setLabel( 'Short Name' )
6565
->addFilter( 'StringToLower' )
6666
->addFilter( 'StringTrim' );
@@ -70,7 +70,7 @@ public function init()
7070
$corpwww->addValidator( 'stringLength', false, array( 0, 255 ) )
7171
->setRequired( false )
7272
->setAttrib( 'placeholder', 'http://www.example.com/' )
73-
->setAttrib( 'class', 'span6' )
73+
->setAttrib( 'class', 'span10' )
7474
->setLabel( 'Corporate Website' )
7575
->addFilter( 'StringTrim' )
7676
->addFilter( new OSS_Filter_StripSlashes() );
@@ -102,21 +102,21 @@ public function init()
102102
->setRegisterInArrayValidator( true )
103103
->setLabel( 'Status' )
104104
->setRequired( true )
105-
->setAttrib( 'class', 'chzn-select span3' )
105+
->setAttrib( 'class', 'chzn-select span8' )
106106
->setErrorMessages( array( 'Please set the customer\'s status' ) );
107107
$this->addElement( $status );
108-
108+
109109
$MD5Support = $this->createElement( 'select', 'MD5Support' );
110110
$MD5Support->setMultiOptions( \Entities\Customer::$MD5_SUPPORT )
111111
->setRegisterInArrayValidator( true )
112112
->setLabel( 'MD5 Support' )
113113
->setRequired( false )
114-
->setAttrib( 'class', 'chzn-select span6' );
114+
->setAttrib( 'class', 'chzn-select span8' );
115115
$this->addElement( $MD5Support );
116-
116+
117117
$abbreviatedName = $this->createElement( 'text', 'abbreviatedName' );
118118
$abbreviatedName->setRequired( false )
119-
->setAttrib( 'class', 'span6' )
119+
->setAttrib( 'class', 'span10' )
120120
->setLabel( 'Abbreviated Name' )
121121
->addFilter( 'StringTrim' )
122122
->addFilter( new OSS_Filter_StripSlashes() );
@@ -127,23 +127,23 @@ public function init()
127127
$autsys->addValidator('int')
128128
->addValidator( 'greaterThan', false, array( -1 ) )
129129
->setRequired( false )
130-
->setAttrib( 'class', 'span4' )
130+
->setAttrib( 'class', 'span6' )
131131
->setLabel( 'AS Number' );
132132
$this->addElement( $autsys );
133133

134134
$maxprefixes = $this->createElement( 'text', 'maxprefixes' );
135135
$maxprefixes->addValidator('int')
136136
->addValidator( 'greaterThan', false, array( -1 ) )
137137
->setRequired( false )
138-
->setAttrib( 'class', 'span2' )
138+
->setAttrib( 'class', 'span6' )
139139
->setLabel( 'Max Prefixes' );
140140
$this->addElement( $maxprefixes );
141141

142142
$peeringemail = $this->createElement( 'text', 'peeringemail' );
143143
$peeringemail->addValidator('emailAddress' )
144144
->addValidator( 'stringLength', false, array( 0, 64 ) )
145145
->setRequired( false )
146-
->setAttrib( 'class', 'span6' )
146+
->setAttrib( 'class', 'span8' )
147147
->setAttrib( 'placeholder', '[email protected]' )
148148
->setLabel( 'Email' );
149149
$this->addElement( $peeringemail );
@@ -153,17 +153,17 @@ public function init()
153153
->setRegisterInArrayValidator( true )
154154
->setLabel( 'Peering Policy' )
155155
->setRequired( false )
156-
->setAttrib( 'class', 'chzn-select span3' );
157-
156+
->setAttrib( 'class', 'chzn-select span8' );
157+
158158
$this->addElement( $peeringpolicy );
159-
160-
159+
160+
161161
$peeringmacro = $this->createElement( 'text', 'peeringmacro' );
162162
$peeringmacro->addValidator( 'stringLength', false, array( 0, 255 ) )
163163
->setRequired( false )
164164
->setLabel( 'Peering Macro' )
165165
->addFilter( 'StringTrim' )
166-
->setAttrib( 'class', 'span4' )
166+
->setAttrib( 'class', 'span8' )
167167
->addFilter( new OSS_Filter_StripSlashes() );
168168
$this->addElement( $peeringmacro );
169169

@@ -183,13 +183,13 @@ public function init()
183183
'peeringDisplayGroup'
184184
);
185185
$this->getDisplayGroup( 'peeringDisplayGroup' )->setLegend( 'Peering Details' );
186-
186+
187187
$nocphone = $this->createElement( 'text', 'nocphone' );
188188
$nocphone->addValidator( 'stringLength', false, array( 0, 255 ) )
189189
->setRequired( false )
190190
->setLabel( 'Phone' )
191191
->setAttrib( 'placeholder', '+353 1 123 4567' )
192-
->setAttrib( 'class', 'span4' )
192+
->setAttrib( 'class', 'span8' )
193193
->addFilter( 'StringTrim' )
194194
->addFilter( new OSS_Filter_StripSlashes() );
195195
$this->addElement( $nocphone );
@@ -198,7 +198,7 @@ public function init()
198198
$noc24hphone->addValidator( 'stringLength', false, array( 0, 255 ) )
199199
->setRequired( false )
200200
->setAttrib( 'placeholder', '+353 86 876 5432' )
201-
->setAttrib( 'class', 'span4' )
201+
->setAttrib( 'class', 'span8' )
202202
->setLabel( '24h Phone' )
203203
->addFilter( 'StringTrim' )
204204
->addFilter( new OSS_Filter_StripSlashes() );
@@ -209,7 +209,7 @@ public function init()
209209
->setRequired( false )
210210
->setLabel( 'Fax' )
211211
->setAttrib( 'placeholder', '+353 1 765 4321' )
212-
->setAttrib( 'class', 'span4' )
212+
->setAttrib( 'class', 'span8' )
213213
->addFilter( 'StringTrim' )
214214
->addFilter( new OSS_Filter_StripSlashes() );
215215
$this->addElement( $nocfax );
@@ -218,7 +218,7 @@ public function init()
218218
$nocemail->addValidator('emailAddress' )
219219
->addValidator( 'stringLength', false, array( 0, 40 ) )
220220
->setRequired( false )
221-
->setAttrib( 'class', 'span6' )
221+
->setAttrib( 'class', 'span8' )
222222
->setAttrib( 'placeholder', '[email protected]' )
223223
->setLabel( 'E-Mail' );
224224
$this->addElement( $nocemail );
@@ -228,16 +228,16 @@ public function init()
228228
->setRegisterInArrayValidator( true )
229229
->setLabel( 'Hours' )
230230
->setRequired( false )
231-
->setAttrib( 'class', 'chzn-select span2' );
231+
->setAttrib( 'class', 'chzn-select span8' );
232232
$this->addElement( $nochours );
233-
234-
233+
234+
235235
$nocwww = $this->createElement( 'text', 'nocwww' );
236236
$nocwww->addValidator( 'stringLength', false, array( 0, 255 ) )
237237
->setRequired( false )
238238
->setLabel( 'Website' )
239239
->setAttrib( 'placeholder', 'http://www.noc.example.com/' )
240-
->setAttrib( 'class', 'span6' )
240+
->setAttrib( 'class', 'span10' )
241241
->addFilter( 'StringTrim' )
242242
->addFilter( new OSS_Filter_StripSlashes() );
243243
$this->addElement( $nocwww );
@@ -253,7 +253,7 @@ public function init()
253253
}
254254

255255

256-
256+
257257
/**
258258
* Create a SELECT / dropdown element of all customer names indexed by their id.
259259
*
@@ -263,16 +263,16 @@ public function init()
263263
public static function getPopulatedSelect( $name = 'custid' )
264264
{
265265
$cust = new Zend_Form_Element_Select( $name );
266-
266+
267267
$maxId = self::populateSelectFromDatabase( $cust, '\\Entities\\Customer', 'id', 'name', 'name', 'ASC' );
268-
268+
269269
$cust->setRegisterInArrayValidator( true )
270270
->setRequired( true )
271271
->setLabel( _( 'Customer' ) )
272272
->setAttrib( 'class', 'span2 chzn-select' )
273273
->addValidator( 'between', false, array( 1, $maxId ) )
274274
->setErrorMessages( array( _( 'Please select a customer' ) ) );
275-
275+
276276
return $cust;
277277
}
278278

@@ -335,4 +335,3 @@ public function setMultiIXP( $multiIXP, $isEdit )
335335
}
336336

337337
}
338-

library/IXP/Form/Interface/Physical.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function init()
4141
$switch = IXP_Form_Switch::getPopulatedSelect( 'switchid' )
4242
->setAttrib( 'class', 'chzn-select span8' );
4343
$this->addElement( $switch );
44-
44+
4545
$switchPorts = $this->createElement( 'select', 'switchportid' );
4646
$switchPorts->setRequired( true )
4747
->setRegisterInArrayValidator( false )
@@ -50,14 +50,14 @@ public function init()
5050
->addValidator( 'greaterThan', false, array( 'min' => 1 ) )
5151
->setErrorMessages( array( 'Please select a switch port' ) );
5252
$this->addElement( $switchPorts );
53-
53+
5454
$virtualInterface = $this->createElement( 'hidden', 'virtualinterfaceid' );
5555
$this->addElement( $virtualInterface );
5656

5757
$status = $this->createElement( 'select', 'status' );
5858
$status->setMultiOptions( \Entities\PhysicalInterface::$STATES )
5959
->setRegisterInArrayValidator( true )
60-
->setAttrib( 'class', 'chzn-select span4' )
60+
->setAttrib( 'class', 'chzn-select span8' )
6161
->setLabel( 'Status' )
6262
->setErrorMessages( array( 'Please set the status' ) );
6363
$this->addElement( $status );
@@ -66,7 +66,7 @@ public function init()
6666
$speed = $this->createElement( 'select', 'speed' );
6767
$speed->setMultiOptions( \Entities\PhysicalInterface::$SPEED )
6868
->setRegisterInArrayValidator( true )
69-
->setAttrib( 'class', 'chzn-select span3' )
69+
->setAttrib( 'class', 'chzn-select span8' )
7070
->setLabel( 'Speed' )
7171
->setErrorMessages( array( 'Please set the speed' ) );
7272
$this->addElement( $speed );
@@ -75,7 +75,7 @@ public function init()
7575
$duplex = $this->createElement( 'select', 'duplex' );
7676
$duplex->setMultiOptions( \Entities\PhysicalInterface::$DUPLEX )
7777
->setRegisterInArrayValidator( true )
78-
->setAttrib( 'class', 'chzn-select span3' )
78+
->setAttrib( 'class', 'chzn-select span8' )
7979
->setLabel( 'Duplex' )
8080
->setErrorMessages( array( 'Please set the duplex' ) );
8181
$this->addElement( $duplex );
@@ -84,7 +84,7 @@ public function init()
8484
$monitorindex = $this->createElement( 'text', 'monitorindex' );
8585
$monitorindex->addValidator( 'int' )
8686
->setLabel( 'Monitor Index' )
87-
->setAttrib( 'class', 'span3' )
87+
->setAttrib( 'class', 'span8' )
8888
->addFilter( 'StringTrim' )
8989
->addFilter( new OSS_Filter_StripSlashes() );
9090
$this->addElement( $monitorindex );
@@ -97,13 +97,13 @@ public function init()
9797
->setAttrib( 'cols', 60 )
9898
->setAttrib( 'rows', 5 );
9999
$this->addElement( $notes );
100-
100+
101101
$this->addElement( self::createSubmitElement( 'submit', _( 'Add' ) ) );
102102
$this->addElement( $this->createCancelElement() );
103-
103+
104104
$preselectSwitchPort = $this->createElement( 'hidden', 'preselectSwitchPort' );
105105
$this->addElement( $preselectSwitchPort );
106-
106+
107107
$preselectPhysicalInterface = $this->createElement( 'hidden', 'preselectPhysicalInterface' );
108108
$this->addElement( $preselectPhysicalInterface );
109109
}
@@ -123,7 +123,7 @@ public function enableFanoutPort( $modeEnabled )
123123
$fanout->setLabel( 'Associate a fanout port' )
124124
->setCheckedValue( '1' );
125125
$this->addElement( $fanout );
126-
126+
127127
$switcher = IXP_Form_Switch::getPopulatedSelect( 'fn_switchid' );
128128
$switcher->setRequired( false )
129129
->setAttrib( 'class', 'chzn-select' )
@@ -151,7 +151,7 @@ public function enableFanoutPort( $modeEnabled )
151151

152152
$preselectSwitchPort = $this->createElement( 'hidden', 'fn_preselectSwitchPort' );
153153
$this->addElement( $preselectSwitchPort );
154-
154+
155155
$preselectPhysicalInterface = $this->createElement( 'hidden', 'fn_preselectPhysicalInterface' );
156156
$this->addElement( $preselectPhysicalInterface );
157157

library/IXP/Form/Interface/Virtual.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ class IXP_Form_Interface_Virtual extends IXP_Form
3737
public function init()
3838
{
3939
$this->setDecorators( [ [ 'ViewScript', [ 'viewScript' => 'virtual-interface/forms/virtual-interface.phtml' ] ] ] );
40-
40+
4141
$this->addElement( IXP_Form_Customer::getPopulatedSelect( 'custid' ) );
42-
$this->getElement( 'custid' )->setAttrib( 'class', 'chzn-select span4' );
43-
42+
$this->getElement( 'custid' )->setAttrib( 'class', 'chzn-select span8' );
43+
4444
$name = $this->createElement( 'text', 'name' );
4545
$name->addValidator( 'stringLength', false, array( 0, 255 ) )
4646
->setRequired( false )
@@ -84,13 +84,12 @@ public function init()
8484
[ 'custid', 'name', 'description', 'channelgroup', 'mtu', 'trunk' ],
8585
'virtualInterfaceDisplayGroup'
8686
);
87-
87+
8888
$this->getDisplayGroup( 'virtualInterfaceDisplayGroup' )->setLegend( 'Customer Connection Details' );
8989

90-
90+
9191
$this->addElement( self::createSubmitElement( 'submit', _( 'Add' ) ) );
9292
$this->addElement( $this->createCancelElement() );
9393
}
9494

9595
}
96-

0 commit comments

Comments
 (0)