Index: trunk/extensions/SemanticForms/includes/forminputs/SF_ListBoxInput.php |
— | — | @@ -24,26 +24,31 @@ |
25 | 25 | public static function getHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) { |
26 | 26 | global $sfgTabIndex, $sfgFieldNum, $sfgShowOnSelect; |
27 | 27 | |
28 | | - $className = ( $is_mandatory ) ? "mandatoryField" : "createboxInput"; |
| 28 | + $className = ( $is_mandatory ) ? 'mandatoryField' : 'createboxInput'; |
29 | 29 | if ( array_key_exists( 'class', $other_args ) ) { |
30 | | - $className .= " " . $other_args['class']; |
| 30 | + $className .= ' ' . $other_args['class']; |
31 | 31 | } |
32 | 32 | $input_id = "input_$sfgFieldNum"; |
33 | 33 | // get list delimiter - default is comma |
34 | 34 | if ( array_key_exists( 'delimiter', $other_args ) ) { |
35 | 35 | $delimiter = $other_args['delimiter']; |
36 | 36 | } else { |
37 | | - $delimiter = ","; |
| 37 | + $delimiter = ','; |
38 | 38 | } |
39 | 39 | $cur_values = SFUtils::getValuesArray( $cur_value, $delimiter ); |
40 | | - $className .= " sfShowIfSelected"; |
| 40 | + $className .= ' sfShowIfSelected'; |
41 | 41 | |
42 | 42 | if ( ( $possible_values = $other_args['possible_values'] ) == null ) { |
43 | 43 | $possible_values = array(); |
44 | 44 | } |
45 | | - $optionsText = ""; |
| 45 | + $optionsText = ''; |
46 | 46 | foreach ( $possible_values as $possible_value ) { |
47 | | - if ( array_key_exists( 'value_labels', $other_args ) && is_array( $other_args['value_labels'] ) && array_key_exists( $possible_value, $other_args['value_labels'] ) ) { |
| 47 | + if ( |
| 48 | + array_key_exists( 'value_labels', $other_args ) && |
| 49 | + is_array( $other_args['value_labels'] ) && |
| 50 | + array_key_exists( $possible_value, $other_args['value_labels'] ) |
| 51 | + ) |
| 52 | + { |
48 | 53 | $optionLabel = $other_args['value_labels'][$possible_value]; |
49 | 54 | } else { |
50 | 55 | $optionLabel = $possible_value; |
— | — | @@ -88,7 +93,11 @@ |
89 | 94 | |
90 | 95 | public static function getParameters() { |
91 | 96 | $params = parent::getParameters(); |
92 | | - $params[] = array( 'name' => 'size', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_listboxsize' ) ); |
| 97 | + $params[] = array( |
| 98 | + 'name' => 'size', |
| 99 | + 'type' => 'int', |
| 100 | + 'description' => wfMsg( 'sf_forminputs_listboxsize' ) |
| 101 | + ); |
93 | 102 | return $params; |
94 | 103 | } |
95 | 104 | |
— | — | @@ -96,6 +105,12 @@ |
97 | 106 | * Returns the HTML code to be included in the output page for this input. |
98 | 107 | */ |
99 | 108 | public function getHtmlText() { |
100 | | - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs ); |
| 109 | + return self::getHTML( |
| 110 | + $this->mCurrentValue, |
| 111 | + $this->mInputName, |
| 112 | + $this->mIsMandatory, |
| 113 | + $this->mIsDisabled, |
| 114 | + $mOtherArgs |
| 115 | + ); |
101 | 116 | } |
102 | 117 | } |
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_TextInput.php |
— | — | @@ -49,17 +49,20 @@ |
50 | 50 | public static function uploadLinkHTML( $input_id, $delimiter = null, $default_filename = null ) { |
51 | 51 | $upload_window_page = SpecialPage::getPage( 'UploadWindow' ); |
52 | 52 | $query_string = "sfInputID=$input_id"; |
53 | | - if ( $delimiter != null ) |
| 53 | + if ( $delimiter != null ) { |
54 | 54 | $query_string .= "&sfDelimiter=$delimiter"; |
55 | | - if ( $default_filename != null ) |
| 55 | + } |
| 56 | + if ( $default_filename != null ) { |
56 | 57 | $query_string .= "&wpDestFile=$default_filename"; |
| 58 | + } |
57 | 59 | $upload_window_url = $upload_window_page->getTitle()->getFullURL( $query_string ); |
58 | 60 | $upload_label = wfMsg( 'upload' ); |
59 | 61 | // window needs to be bigger for MediaWiki version 1.16+ |
60 | | - if ( class_exists( 'HTMLForm' ) ) |
| 62 | + if ( class_exists( 'HTMLForm' ) ) { |
61 | 63 | $style = "width:650 height:500"; |
62 | | - else |
| 64 | + } else { |
63 | 65 | $style = ''; |
| 66 | + } |
64 | 67 | |
65 | 68 | $linkAttrs = array( |
66 | 69 | 'href' => $upload_window_url, |
— | — | @@ -80,12 +83,12 @@ |
81 | 84 | return SFTextWithAutocompleteInput::getHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ); |
82 | 85 | } |
83 | 86 | |
84 | | - $className = "createboxInput"; |
| 87 | + $className = 'createboxInput'; |
85 | 88 | if ( $is_mandatory ) { |
86 | | - $className .= " mandatoryField"; |
| 89 | + $className .= ' mandatoryField'; |
87 | 90 | } |
88 | 91 | if ( array_key_exists( 'class', $other_args ) ) { |
89 | | - $className .= " " . $other_args['class']; |
| 92 | + $className .= ' ' . $other_args['class']; |
90 | 93 | } |
91 | 94 | $input_id = "input_$sfgFieldNum"; |
92 | 95 | // Set size based on pre-set size, or field type - if field |
— | — | @@ -130,7 +133,7 @@ |
131 | 134 | if ( array_key_exists( 'delimiter', $other_args ) ) { |
132 | 135 | $delimiter = $other_args['delimiter']; |
133 | 136 | } else { |
134 | | - $delimiter = ","; |
| 137 | + $delimiter = ','; |
135 | 138 | } |
136 | 139 | } else { |
137 | 140 | $delimiter = null; |
— | — | @@ -138,25 +141,43 @@ |
139 | 142 | if ( array_key_exists( 'default filename', $other_args ) ) { |
140 | 143 | $default_filename = $other_args['default filename']; |
141 | 144 | } else { |
142 | | - $default_filename = ""; |
| 145 | + $default_filename = ''; |
143 | 146 | } |
144 | 147 | $text .= self::uploadLinkHTML( $input_id, $delimiter, $default_filename ); |
145 | 148 | } |
146 | | - $spanClass = "inputSpan"; |
| 149 | + $spanClass = 'inputSpan'; |
147 | 150 | if ( $inputType != '' ) { |
148 | 151 | $spanClass .= " {$inputType}Input"; |
149 | 152 | } |
150 | | - if ( $is_mandatory ) { $spanClass .= " mandatoryFieldSpan"; } |
| 153 | + if ( $is_mandatory ) { |
| 154 | + $spanClass .= ' mandatoryFieldSpan'; |
| 155 | + } |
151 | 156 | $text = Xml::tags( 'span', array( 'class' => $spanClass ), $text ); |
152 | 157 | return $text; |
153 | 158 | } |
154 | 159 | |
155 | 160 | public static function getParameters() { |
156 | 161 | $params = parent::getParameters(); |
157 | | - $params[] = array( 'name' => 'size', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_size' ) ); |
158 | | - $params[] = array( 'name' => 'maxlength', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_maxlength' ) ); |
159 | | - $params[] = array( 'name' => 'uploadable', 'type' => 'boolean', 'description' => wfMsg( 'sf_forminputs_uploadable' ) ); |
160 | | - $params[] = array( 'name' => 'default filename', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_defaultfilename' ) ); |
| 162 | + $params[] = array( |
| 163 | + 'name' => 'size', |
| 164 | + 'type' => 'int', |
| 165 | + 'description' => wfMsg( 'sf_forminputs_size' ) |
| 166 | + ); |
| 167 | + $params[] = array( |
| 168 | + 'name' => 'maxlength', |
| 169 | + 'type' => 'int', |
| 170 | + 'description' => wfMsg( 'sf_forminputs_maxlength' ) |
| 171 | + ); |
| 172 | + $params[] = array( |
| 173 | + 'name' => 'uploadable', |
| 174 | + 'type' => 'boolean', |
| 175 | + 'description' => wfMsg( 'sf_forminputs_uploadable' ) |
| 176 | + ); |
| 177 | + $params[] = array( |
| 178 | + 'name' => 'default filename', |
| 179 | + 'type' => 'string', |
| 180 | + 'description' => wfMsg( 'sf_forminputs_defaultfilename' ) |
| 181 | + ); |
161 | 182 | return $params; |
162 | 183 | } |
163 | 184 | |
— | — | @@ -164,6 +185,12 @@ |
165 | 186 | * Returns the HTML code to be included in the output page for this input. |
166 | 187 | */ |
167 | 188 | public function getHtmlText() { |
168 | | - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs ); |
| 189 | + return self::getHTML( |
| 190 | + $this->mCurrentValue, |
| 191 | + $this->mInputName, |
| 192 | + $this->mIsMandatory, |
| 193 | + $this->mIsDisabled, |
| 194 | + $mOtherArgs |
| 195 | + ); |
169 | 196 | } |
170 | 197 | } |
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_CategoriesInput.php |
— | — | @@ -26,21 +26,23 @@ |
27 | 27 | |
28 | 28 | public static function getHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) { |
29 | 29 | // escape if CategoryTree extension isn't included |
30 | | - if ( ! function_exists( 'efCategoryTreeParserHook' ) ) |
| 30 | + if ( !function_exists( 'efCategoryTreeParserHook' ) ) { |
31 | 31 | return null; |
| 32 | + } |
32 | 33 | |
33 | 34 | global $sfgTabIndex, $sfgFieldNum, $wgCapitalLinks; |
34 | 35 | |
35 | | - $className = ( $is_mandatory ) ? "mandatoryField" : "createboxInput"; |
36 | | - if ( array_key_exists( 'class', $other_args ) ) |
37 | | - $className .= " " . $other_args['class']; |
| 36 | + $className = ( $is_mandatory ) ? 'mandatoryField' : 'createboxInput'; |
| 37 | + if ( array_key_exists( 'class', $other_args ) ) { |
| 38 | + $className .= ' ' . $other_args['class']; |
| 39 | + } |
38 | 40 | $input_id = "input_$sfgFieldNum"; |
39 | 41 | $info_id = "info_$sfgFieldNum"; |
40 | 42 | // get list delimiter - default is comma |
41 | 43 | if ( array_key_exists( 'delimiter', $other_args ) ) { |
42 | 44 | $delimiter = $other_args['delimiter']; |
43 | 45 | } else { |
44 | | - $delimiter = ","; |
| 46 | + $delimiter = ','; |
45 | 47 | } |
46 | 48 | $cur_values = SFUtils::getValuesArray( $cur_value, $delimiter ); |
47 | 49 | if ( array_key_exists( 'top category', $other_args ) ) { |
— | — | @@ -53,12 +55,12 @@ |
54 | 56 | if ( array_key_exists( 'height', $other_args ) ) { |
55 | 57 | $height = $other_args['height']; |
56 | 58 | } else { |
57 | | - $height = "100"; |
| 59 | + $height = '100'; |
58 | 60 | } |
59 | 61 | if ( array_key_exists( 'width', $other_args ) ) { |
60 | 62 | $width = $other_args['width']; |
61 | 63 | } else { |
62 | | - $width = "500"; |
| 64 | + $width = '500'; |
63 | 65 | } |
64 | 66 | |
65 | 67 | global $wgCategoryTreeMaxDepth; |
— | — | @@ -74,7 +76,13 @@ |
75 | 77 | // Some string that will hopefully never show up in a category, |
76 | 78 | // template or field name. |
77 | 79 | $dummy_str = 'REPLACE THIS STRING!'; |
78 | | - $tree = preg_replace( '/(<a class="CategoryTreeLabel.*>)(.*)(<\/a>)/', '<input id="' . $input_id . '" tabindex="' . $sfgTabIndex . '" name="' . $input_name . '[' . $dummy_str . ']" value="$2" type="checkbox"> $1$2$3', $tree ); |
| 80 | + $tree = preg_replace( |
| 81 | + '/(<a class="CategoryTreeLabel.*>)(.*)(<\/a>)/', |
| 82 | + '<input id="' . $input_id . '" tabindex="' . $sfgTabIndex . |
| 83 | + '" name="' . $input_name . '[' . $dummy_str . |
| 84 | + ']" value="$2" type="checkbox"> $1$2$3', |
| 85 | + $tree |
| 86 | + ); |
79 | 87 | // replace values one at a time, by an incrementing index - |
80 | 88 | // inspired by http://bugs.php.net/bug.php?id=11457 |
81 | 89 | $i = 0; |
— | — | @@ -98,13 +106,20 @@ |
99 | 107 | } |
100 | 108 | |
101 | 109 | // Get rid of all the 'no subcategories' messages. |
102 | | - $tree = str_replace( '<div class="CategoryTreeChildren" style="display:block"><i class="CategoryTreeNotice">' . wfMsg( 'categorytree-no-subcategories' ) . '</i></div>', '', $tree ); |
| 110 | + $tree = str_replace( |
| 111 | + '<div class="CategoryTreeChildren" style="display:block"><i class="CategoryTreeNotice">' . |
| 112 | + wfMsg( 'categorytree-no-subcategories' ) . '</i></div>', |
| 113 | + '', |
| 114 | + $tree |
| 115 | + ); |
103 | 116 | |
104 | 117 | $text = '<div style="overflow: auto; padding: 5px; border: 1px #aaaaaa solid; max-height: ' . $height . 'px; width: ' . $width . 'px;">' . $tree . '</div>'; |
105 | 118 | |
106 | 119 | $text .= SFFormUtils::hiddenFieldHTML( $input_name . '[is_list]', 1 ); |
107 | | - $spanClass = "checkboxesSpan"; |
108 | | - if ( $is_mandatory ) { $spanClass .= " mandatoryFieldSpan"; } |
| 120 | + $spanClass = 'checkboxesSpan'; |
| 121 | + if ( $is_mandatory ) { |
| 122 | + $spanClass .= ' mandatoryFieldSpan'; |
| 123 | + } |
109 | 124 | $text = "\n" . Xml::tags( 'span', array( 'class' => $spanClass ), $text ) . "\n"; |
110 | 125 | |
111 | 126 | return $text; |
— | — | @@ -114,6 +129,12 @@ |
115 | 130 | * Returns the HTML code to be included in the output page for this input. |
116 | 131 | */ |
117 | 132 | public function getHtmlText() { |
118 | | - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs ); |
| 133 | + return self::getHTML( |
| 134 | + $this->mCurrentValue, |
| 135 | + $this->mInputName, |
| 136 | + $this->mIsMandatory, |
| 137 | + $this->mIsDisabled, |
| 138 | + $mOtherArgs |
| 139 | + ); |
119 | 140 | } |
120 | 141 | } |
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_CheckboxInput.php |
— | — | @@ -27,13 +27,14 @@ |
28 | 28 | public static function getHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) { |
29 | 29 | global $sfgTabIndex, $sfgFieldNum, $sfgShowOnSelect; |
30 | 30 | |
31 | | - $className = ( $is_mandatory ) ? "mandatoryField" : "createboxInput"; |
32 | | - if ( array_key_exists( 'class', $other_args ) ) |
33 | | - $className .= " " . $other_args['class']; |
| 31 | + $className = ( $is_mandatory ) ? 'mandatoryField' : 'createboxInput'; |
| 32 | + if ( array_key_exists( 'class', $other_args ) ) { |
| 33 | + $className .= ' ' . $other_args['class']; |
| 34 | + } |
34 | 35 | $input_id = "input_$sfgFieldNum"; |
35 | | - $disabled_text = ( $is_disabled ) ? "disabled" : ""; |
| 36 | + $disabled_text = ( $is_disabled ) ? 'disabled' : ''; |
36 | 37 | if ( array_key_exists( 'show on select', $other_args ) ) { |
37 | | - $className .= " sfShowIfCheckedCheckbox"; |
| 38 | + $className .= ' sfShowIfCheckedCheckbox'; |
38 | 39 | $div_id = key( $other_args['show on select'] ); |
39 | 40 | $sfgShowOnSelect[$input_id] = $div_id; |
40 | 41 | } |
— | — | @@ -41,7 +42,7 @@ |
42 | 43 | // Can show up here either as an array or a string, depending on |
43 | 44 | // whether it came from user input or a wiki page |
44 | 45 | if ( is_array( $cur_value ) ) { |
45 | | - $checked_str = ( array_key_exists( 'value', $cur_value ) && $cur_value['value'] == 'on' ) ? ' checked="checked"' : ""; |
| 46 | + $checked_str = ( array_key_exists( 'value', $cur_value ) && $cur_value['value'] == 'on' ) ? ' checked="checked"' : ''; |
46 | 47 | } else { |
47 | 48 | // Default to false - no need to check if it matches |
48 | 49 | // a 'false' word. |
— | — | @@ -52,10 +53,10 @@ |
53 | 54 | if ( version_compare( $wgVersion, '1.16', '<' ) ) { |
54 | 55 | wfLoadExtensionMessages( 'SemanticMediaWiki' ); |
55 | 56 | } |
56 | | - if ( in_array( $vlc, explode( ',', wfMsgForContent( 'smw_true_words' ) ), TRUE ) ) { |
| 57 | + if ( in_array( $vlc, explode( ',', wfMsgForContent( 'smw_true_words' ) ), true ) ) { |
57 | 58 | $checked_str = ' checked="checked"'; |
58 | 59 | } else { |
59 | | - $checked_str = ""; |
| 60 | + $checked_str = ''; |
60 | 61 | } |
61 | 62 | } |
62 | 63 | $text = <<<END |
— | — | @@ -82,6 +83,12 @@ |
83 | 84 | * Returns the HTML code to be included in the output page for this input. |
84 | 85 | */ |
85 | 86 | public function getHtmlText() { |
86 | | - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs ); |
| 87 | + return self::getHTML( |
| 88 | + $this->mCurrentValue, |
| 89 | + $this->mInputName, |
| 90 | + $this->mIsMandatory, |
| 91 | + $this->mIsDisabled, |
| 92 | + $mOtherArgs |
| 93 | + ); |
87 | 94 | } |
88 | 95 | } |
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_RadioButtonInput.php |
— | — | @@ -40,26 +40,27 @@ |
41 | 41 | // mandatory field and there's a current value in place (either |
42 | 42 | // through a default value or because we're editing an existing |
43 | 43 | // page). |
44 | | - if ( ! $is_mandatory || $cur_value == '' ) { |
| 44 | + if ( !$is_mandatory || $cur_value == '' ) { |
45 | 45 | array_unshift( $possible_values, '' ); |
46 | 46 | } |
47 | 47 | |
48 | 48 | // Set $cur_value to be one of the allowed options, if it isn't |
49 | 49 | // already - that makes it easier to automatically have one of |
50 | 50 | // the radiobuttons be checked at the beginning. |
51 | | - if ( ! in_array( $cur_value, $possible_values ) ) { |
52 | | - if ( in_array( '', $possible_values ) ) |
| 51 | + if ( !in_array( $cur_value, $possible_values ) ) { |
| 52 | + if ( in_array( '', $possible_values ) ) { |
53 | 53 | $cur_value = ''; |
54 | | - else |
| 54 | + } else { |
55 | 55 | $cur_value = $possible_values[0]; |
| 56 | + } |
56 | 57 | } |
57 | 58 | |
58 | 59 | $text = ''; |
59 | | - $itemClass = "radioButtonItem"; |
| 60 | + $itemClass = 'radioButtonItem'; |
60 | 61 | if ( array_key_exists( 'class', $other_args ) ) { |
61 | | - $itemClass .= " " . $other_args['class']; |
| 62 | + $itemClass .= ' ' . $other_args['class']; |
62 | 63 | } |
63 | | - $itemAttrs = array ( 'class' => $itemClass ); |
| 64 | + $itemAttrs = array( 'class' => $itemClass ); |
64 | 65 | |
65 | 66 | foreach ( $possible_values as $i => $possible_value ) { |
66 | 67 | $sfgTabIndex++; |
— | — | @@ -79,29 +80,37 @@ |
80 | 81 | if ( $is_disabled ) { |
81 | 82 | $radiobutton_attrs['disabled'] = 'disabled'; |
82 | 83 | } |
83 | | - if ( $possible_value == '' ) // blank/"None" value |
| 84 | + if ( $possible_value == '' ) { // blank/"None" value |
84 | 85 | $label = wfMsg( 'sf_formedit_none' ); |
85 | | - elseif ( array_key_exists( 'value_labels', $other_args ) && is_array( $other_args['value_labels'] ) && array_key_exists( $possible_value, $other_args['value_labels'] ) ) |
| 86 | + } elseif ( |
| 87 | + array_key_exists( 'value_labels', $other_args ) && |
| 88 | + is_array( $other_args['value_labels'] ) && |
| 89 | + array_key_exists( $possible_value, $other_args['value_labels'] ) |
| 90 | + ) |
| 91 | + { |
86 | 92 | $label = htmlspecialchars( $other_args['value_labels'][$possible_value] ); |
87 | | - else |
| 93 | + } else { |
88 | 94 | $label = $possible_value; |
| 95 | + } |
89 | 96 | |
90 | | - $text .= "\t" . Xml::openElement( 'span', $itemAttrs ) . Xml::element ( 'input', $radiobutton_attrs ) . " $label\n" . Xml::closeElement( 'span' ); |
| 97 | + $text .= "\t" . Xml::openElement( 'span', $itemAttrs ) . |
| 98 | + Xml::element( 'input', $radiobutton_attrs ) . " $label\n" . |
| 99 | + Xml::closeElement( 'span' ); |
91 | 100 | } |
92 | 101 | |
93 | | - $spanClass = "radioButtonSpan"; |
| 102 | + $spanClass = 'radioButtonSpan'; |
94 | 103 | if ( array_key_exists( 'class', $other_args ) ) { |
95 | | - $spanClass .= " " . $other_args['class']; |
| 104 | + $spanClass .= ' ' . $other_args['class']; |
96 | 105 | } |
97 | 106 | if ( $is_mandatory ) { |
98 | | - $spanClass .= " mandatoryFieldSpan"; |
| 107 | + $spanClass .= ' mandatoryFieldSpan'; |
99 | 108 | } |
100 | 109 | |
101 | 110 | $spanID = "span_$sfgFieldNum"; |
102 | 111 | |
103 | 112 | // Do the 'show on select' handling. |
104 | 113 | if ( array_key_exists( 'show on select', $other_args ) ) { |
105 | | - $spanClass .= " sfShowIfChecked"; |
| 114 | + $spanClass .= ' sfShowIfChecked'; |
106 | 115 | foreach ( $other_args['show on select'] as $div_id => $options ) { |
107 | 116 | if ( array_key_exists( $spanID, $sfgShowOnSelect ) ) { |
108 | 117 | $sfgShowOnSelect[$spanID][] = array( $options, $div_id ); |
— | — | @@ -123,6 +132,12 @@ |
124 | 133 | * Returns the HTML code to be included in the output page for this input. |
125 | 134 | */ |
126 | 135 | public function getHtmlText() { |
127 | | - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs ); |
| 136 | + return self::getHTML( |
| 137 | + $this->mCurrentValue, |
| 138 | + $this->mInputName, |
| 139 | + $this->mIsMandatory, |
| 140 | + $this->mIsDisabled, |
| 141 | + $mOtherArgs |
| 142 | + ); |
128 | 143 | } |
129 | 144 | } |
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_TextAreaWithAutocompleteInput.php |
— | — | @@ -45,10 +45,11 @@ |
46 | 46 | |
47 | 47 | list( $autocompleteSettings, $remoteDataType, $delimiter ) = SFTextWithAutocompleteInput::setAutocompleteValues( $other_args ); |
48 | 48 | |
49 | | - $className = ( $is_mandatory ) ? "autocompleteInput mandatoryField" : "autocompleteInput createboxInput"; |
50 | | - if ( array_key_exists( 'class', $other_args ) ) |
51 | | - $className .= " " . $other_args['class']; |
52 | | - $input_id = "input_" . $sfgFieldNum; |
| 49 | + $className = ( $is_mandatory ) ? 'autocompleteInput mandatoryField' : 'autocompleteInput createboxInput'; |
| 50 | + if ( array_key_exists( 'class', $other_args ) ) { |
| 51 | + $className .= ' ' . $other_args['class']; |
| 52 | + } |
| 53 | + $input_id = 'input_' . $sfgFieldNum; |
53 | 54 | |
54 | 55 | if ( array_key_exists( 'rows', $other_args ) ) { |
55 | 56 | $rows = $other_args['rows']; |
— | — | @@ -60,7 +61,7 @@ |
61 | 62 | } else { |
62 | 63 | $cols = 80; |
63 | 64 | } |
64 | | - $text = ""; |
| 65 | + $text = ''; |
65 | 66 | if ( array_key_exists( 'autogrow', $other_args ) ) { |
66 | 67 | $className .= ' autoGrow'; |
67 | 68 | } |
— | — | @@ -105,13 +106,15 @@ |
106 | 107 | if ( array_key_exists( 'default filename', $other_args ) ) { |
107 | 108 | $default_filename = $other_args['default filename']; |
108 | 109 | } else { |
109 | | - $default_filename = ""; |
| 110 | + $default_filename = ''; |
110 | 111 | } |
111 | 112 | $text .= self::uploadLinkHTML( $input_id, $delimiter, $default_filename ); |
112 | 113 | } |
113 | 114 | |
114 | | - $spanClass = "inputSpan"; |
115 | | - if ( $is_mandatory ) { $spanClass .= " mandatoryFieldSpan"; } |
| 115 | + $spanClass = 'inputSpan'; |
| 116 | + if ( $is_mandatory ) { |
| 117 | + $spanClass .= ' mandatoryFieldSpan'; |
| 118 | + } |
116 | 119 | $text = "\n" . Xml::tags( 'span', array( 'class' => $spanClass ), $text ); |
117 | 120 | |
118 | 121 | return $text; |
— | — | @@ -127,6 +130,12 @@ |
128 | 131 | * Returns the HTML code to be included in the output page for this input. |
129 | 132 | */ |
130 | 133 | public function getHtmlText() { |
131 | | - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs ); |
| 134 | + return self::getHTML( |
| 135 | + $this->mCurrentValue, |
| 136 | + $this->mInputName, |
| 137 | + $this->mIsMandatory, |
| 138 | + $this->mIsDisabled, |
| 139 | + $mOtherArgs |
| 140 | + ); |
132 | 141 | } |
133 | 142 | } |
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_DateTimeInput.php |
— | — | @@ -38,13 +38,23 @@ |
39 | 39 | // depending on whether it came from user input or a |
40 | 40 | // wiki page. |
41 | 41 | if ( is_array( $datetime ) ) { |
42 | | - if ( isset( $datetime['hour'] ) ) $hour = $datetime['hour']; |
43 | | - if ( isset( $datetime['minute'] ) ) $minute = $datetime['minute']; |
44 | | - if ( isset( $datetime['second'] ) ) $second = $datetime['second']; |
45 | | - if ( ! $sfg24HourTime ) { |
46 | | - if ( isset( $datetime['ampm24h'] ) ) $ampm24h = $datetime['ampm24h']; |
| 42 | + if ( isset( $datetime['hour'] ) ) { |
| 43 | + $hour = $datetime['hour']; |
47 | 44 | } |
48 | | - if ( isset( $datetime['timezone'] ) ) $timezone = $datetime['timezone']; |
| 45 | + if ( isset( $datetime['minute'] ) ) { |
| 46 | + $minute = $datetime['minute']; |
| 47 | + } |
| 48 | + if ( isset( $datetime['second'] ) ) { |
| 49 | + $second = $datetime['second']; |
| 50 | + } |
| 51 | + if ( !$sfg24HourTime ) { |
| 52 | + if ( isset( $datetime['ampm24h'] ) ) { |
| 53 | + $ampm24h = $datetime['ampm24h']; |
| 54 | + } |
| 55 | + } |
| 56 | + if ( isset( $datetime['timezone'] ) ) { |
| 57 | + $timezone = $datetime['timezone']; |
| 58 | + } |
49 | 59 | } else { |
50 | 60 | // TODO - this should change to use SMW's own |
51 | 61 | // date-handling class, just like |
— | — | @@ -62,16 +72,16 @@ |
63 | 73 | $actual_date = strtotime( $datetime ); |
64 | 74 | } |
65 | 75 | if ( $sfg24HourTime ) { |
66 | | - $hour = date( "G", $actual_date ); |
| 76 | + $hour = date( 'G', $actual_date ); |
67 | 77 | } else { |
68 | | - $hour = date( "g", $actual_date ); |
| 78 | + $hour = date( 'g', $actual_date ); |
69 | 79 | } |
70 | | - $minute = date( "i", $actual_date ); |
71 | | - $second = date( "s", $actual_date ); |
72 | | - if ( ! $sfg24HourTime ) { |
73 | | - $ampm24h = date( "A", $actual_date ); |
| 80 | + $minute = date( 'i', $actual_date ); |
| 81 | + $second = date( 's', $actual_date ); |
| 82 | + if ( !$sfg24HourTime ) { |
| 83 | + $ampm24h = date( 'A', $actual_date ); |
74 | 84 | } |
75 | | - $timezone = date( "T", $actual_date ); |
| 85 | + $timezone = date( 'T', $actual_date ); |
76 | 86 | // Restore back to the server's timezone. |
77 | 87 | if ( $datetime == 'now' ) { |
78 | 88 | if ( isset( $wgLocaltimezone ) ) { |
— | — | @@ -83,20 +93,20 @@ |
84 | 94 | $cur_date = getdate(); |
85 | 95 | $hour = null; |
86 | 96 | $minute = null; |
87 | | - $second = "00"; // default at least this value |
88 | | - $ampm24h = ""; |
89 | | - $timezone = ""; |
| 97 | + $second = '00'; // default at least this value |
| 98 | + $ampm24h = ''; |
| 99 | + $timezone = ''; |
90 | 100 | } |
91 | 101 | |
92 | 102 | $text = parent::getMainHTML( $datetime, $input_name, $is_mandatory, $is_disabled, $other_args ); |
93 | | - $disabled_text = ( $is_disabled ) ? "disabled" : ""; |
| 103 | + $disabled_text = ( $is_disabled ) ? 'disabled' : ''; |
94 | 104 | $text .= '  <input tabindex="' . $sfgTabIndex . '" name="' . $input_name . '[hour]" type="text" value="' . $hour . '" size="2"/ ' . $disabled_text . '>'; |
95 | 105 | $sfgTabIndex++; |
96 | 106 | $text .= ' :<input tabindex="' . $sfgTabIndex . '" name="' . $input_name . '[minute]" type="text" value="' . $minute . '" size="2"/ ' . $disabled_text . '>'; |
97 | 107 | $sfgTabIndex++; |
98 | 108 | $text .= ':<input tabindex="' . $sfgTabIndex . '" name="' . $input_name . '[second]" type="text" value="' . $second . '" size="2"/ ' . $disabled_text . '>' . "\n"; |
99 | 109 | |
100 | | - if ( ! $sfg24HourTime ) { |
| 110 | + if ( !$sfg24HourTime ) { |
101 | 111 | $sfgTabIndex++; |
102 | 112 | $text .= ' <select tabindex="' . $sfgTabIndex . '" name="' . $input_name . "[ampm24h]\" $disabled_text>\n"; |
103 | 113 | $ampm24h_options = array( '', 'AM', 'PM' ); |
— | — | @@ -118,7 +128,11 @@ |
119 | 129 | |
120 | 130 | public static function getParameters() { |
121 | 131 | $params = parent::getParameters(); |
122 | | - $params[] = array( 'name' => 'include timezone', 'type' => 'boolean', 'description' => wfMsg( 'sf_forminputs_includetimezone' ) ); |
| 132 | + $params[] = array( |
| 133 | + 'name' => 'include timezone', |
| 134 | + 'type' => 'boolean', |
| 135 | + 'description' => wfMsg( 'sf_forminputs_includetimezone' ) |
| 136 | + ); |
123 | 137 | return $params; |
124 | 138 | } |
125 | 139 | |
— | — | @@ -126,6 +140,12 @@ |
127 | 141 | * Returns the HTML code to be included in the output page for this input. |
128 | 142 | */ |
129 | 143 | public function getHtmlText() { |
130 | | - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs ); |
| 144 | + return self::getHTML( |
| 145 | + $this->mCurrentValue, |
| 146 | + $this->mInputName, |
| 147 | + $this->mIsMandatory, |
| 148 | + $this->mIsDisabled, |
| 149 | + $mOtherArgs |
| 150 | + ); |
131 | 151 | } |
132 | 152 | } |
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_DropdownInput.php |
— | — | @@ -33,13 +33,13 @@ |
34 | 34 | public static function getHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) { |
35 | 35 | global $sfgTabIndex, $sfgFieldNum, $sfgShowOnSelect; |
36 | 36 | |
37 | | - $className = ( $is_mandatory ) ? "mandatoryField" : "createboxInput"; |
| 37 | + $className = ( $is_mandatory ) ? 'mandatoryField' : 'createboxInput'; |
38 | 38 | if ( array_key_exists( 'class', $other_args ) ) { |
39 | | - $className .= " " . $other_args['class']; |
| 39 | + $className .= ' ' . $other_args['class']; |
40 | 40 | } |
41 | 41 | $input_id = "input_$sfgFieldNum"; |
42 | 42 | if ( array_key_exists( 'show on select', $other_args ) ) { |
43 | | - $className .= " sfShowIfSelected"; |
| 43 | + $className .= ' sfShowIfSelected'; |
44 | 44 | foreach ( $other_args['show on select'] as $div_id => $options ) { |
45 | 45 | if ( array_key_exists( $input_id, $sfgShowOnSelect ) ) { |
46 | 46 | $sfgShowOnSelect[$input_id][] = array( $options, $div_id ); |
— | — | @@ -48,12 +48,12 @@ |
49 | 49 | } |
50 | 50 | } |
51 | 51 | } |
52 | | - $innerDropdown = ""; |
| 52 | + $innerDropdown = ''; |
53 | 53 | // Add a blank value at the beginning, unless this is a |
54 | 54 | // mandatory field and there's a current value in place |
55 | 55 | // (either through a default value or because we're editing |
56 | 56 | // an existing page). |
57 | | - if ( ! $is_mandatory || $cur_value == '' ) { |
| 57 | + if ( !$is_mandatory || $cur_value == '' ) { |
58 | 58 | $innerDropdown .= " <option value=\"\"></option>\n"; |
59 | 59 | } |
60 | 60 | if ( ( $possible_values = $other_args['possible_values'] ) == null ) { |
— | — | @@ -73,7 +73,12 @@ |
74 | 74 | if ( $possible_value == $cur_value ) { |
75 | 75 | $optionAttrs['selected'] = "selected"; |
76 | 76 | } |
77 | | - if ( array_key_exists( 'value_labels', $other_args ) && is_array( $other_args['value_labels'] ) && array_key_exists( $possible_value, $other_args['value_labels'] ) ) { |
| 77 | + if ( |
| 78 | + array_key_exists( 'value_labels', $other_args ) && |
| 79 | + is_array( $other_args['value_labels'] ) && |
| 80 | + array_key_exists( $possible_value, $other_args['value_labels'] ) |
| 81 | + ) |
| 82 | + { |
78 | 83 | $label = $other_args['value_labels'][$possible_value]; |
79 | 84 | } else { |
80 | 85 | $label = $possible_value; |
— | — | @@ -90,8 +95,10 @@ |
91 | 96 | $selectAttrs['disabled'] = 'disabled'; |
92 | 97 | } |
93 | 98 | $text = Xml::tags( 'select', $selectAttrs, $innerDropdown ); |
94 | | - $spanClass = "inputSpan"; |
95 | | - if ( $is_mandatory ) { $spanClass .= " mandatoryFieldSpan"; } |
| 99 | + $spanClass = 'inputSpan'; |
| 100 | + if ( $is_mandatory ) { |
| 101 | + $spanClass .= ' mandatoryFieldSpan'; |
| 102 | + } |
96 | 103 | $text = Xml::tags( 'span', array( 'class' => $spanClass ), $text ); |
97 | 104 | return $text; |
98 | 105 | } |
— | — | @@ -100,6 +107,12 @@ |
101 | 108 | * Returns the HTML code to be included in the output page for this input. |
102 | 109 | */ |
103 | 110 | public function getHtmlText() { |
104 | | - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs ); |
| 111 | + return self::getHTML( |
| 112 | + $this->mCurrentValue, |
| 113 | + $this->mInputName, |
| 114 | + $this->mIsMandatory, |
| 115 | + $this->mIsDisabled, |
| 116 | + $mOtherArgs |
| 117 | + ); |
105 | 118 | } |
106 | 119 | } |
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_YearInput.php |
— | — | @@ -43,11 +43,31 @@ |
44 | 44 | |
45 | 45 | public static function getParameters() { |
46 | 46 | $params = array(); |
47 | | - $params[] = array( 'name' => 'mandatory', 'type' => 'boolean', 'description' => wfMsg( 'sf_forminputs_mandatory' ) ); |
48 | | - $params[] = array( 'name' => 'restricted', 'type' => 'boolean', 'description' => wfMsg( 'sf_forminputs_restricted' ) ); |
49 | | - $params[] = array( 'name' => 'class', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_class' ) ); |
50 | | - $params[] = array( 'name' => 'default', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_default' ) ); |
51 | | - $params[] = array( 'name' => 'size', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_size' ) ); |
| 47 | + $params[] = array( |
| 48 | + 'name' => 'mandatory', |
| 49 | + 'type' => 'boolean', |
| 50 | + 'description' => wfMsg( 'sf_forminputs_mandatory' ) |
| 51 | + ); |
| 52 | + $params[] = array( |
| 53 | + 'name' => 'restricted', |
| 54 | + 'type' => 'boolean', |
| 55 | + 'description' => wfMsg( 'sf_forminputs_restricted' ) |
| 56 | + ); |
| 57 | + $params[] = array( |
| 58 | + 'name' => 'class', |
| 59 | + 'type' => 'string', |
| 60 | + 'description' => wfMsg( 'sf_forminputs_class' ) |
| 61 | + ); |
| 62 | + $params[] = array( |
| 63 | + 'name' => 'default', |
| 64 | + 'type' => 'string', |
| 65 | + 'description' => wfMsg( 'sf_forminputs_default' ) |
| 66 | + ); |
| 67 | + $params[] = array( |
| 68 | + 'name' => 'size', |
| 69 | + 'type' => 'int', |
| 70 | + 'description' => wfMsg( 'sf_forminputs_size' ) |
| 71 | + ); |
52 | 72 | return $params; |
53 | 73 | } |
54 | 74 | |
— | — | @@ -55,6 +75,12 @@ |
56 | 76 | * Returns the HTML code to be included in the output page for this input. |
57 | 77 | */ |
58 | 78 | public function getHtmlText() { |
59 | | - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs ); |
| 79 | + return self::getHTML( |
| 80 | + $this->mCurrentValue, |
| 81 | + $this->mInputName, |
| 82 | + $this->mIsMandatory, |
| 83 | + $this->mIsDisabled, |
| 84 | + $mOtherArgs |
| 85 | + ); |
60 | 86 | } |
61 | 87 | } |
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_TextWithAutocompleteInput.php |
— | — | @@ -101,12 +101,12 @@ |
102 | 102 | $autocompleteSettings = $autocompletionSource; |
103 | 103 | $is_list = ( array_key_exists( 'is_list', $field_args ) && $field_args['is_list'] == true ); |
104 | 104 | if ( $is_list ) { |
105 | | - $autocompleteSettings .= ",list"; |
| 105 | + $autocompleteSettings .= ',list'; |
106 | 106 | if ( array_key_exists( 'delimiter', $field_args ) ) { |
107 | 107 | $delimiter = $field_args['delimiter']; |
108 | | - $autocompleteSettings .= "," . $delimiter; |
| 108 | + $autocompleteSettings .= ',' . $delimiter; |
109 | 109 | } else { |
110 | | - $delimiter = ","; |
| 110 | + $delimiter = ','; |
111 | 111 | } |
112 | 112 | } else { |
113 | 113 | $delimiter = null; |
— | — | @@ -144,17 +144,18 @@ |
145 | 145 | |
146 | 146 | list( $autocompleteSettings, $remoteDataType, $delimiter ) = self::setAutocompleteValues( $other_args ); |
147 | 147 | |
148 | | - $className = ( $is_mandatory ) ? "autocompleteInput mandatoryField" : "autocompleteInput createboxInput"; |
149 | | - if ( array_key_exists( 'class', $other_args ) ) |
150 | | - $className .= " " . $other_args['class']; |
151 | | - $input_id = "input_" . $sfgFieldNum; |
| 148 | + $className = ( $is_mandatory ) ? 'autocompleteInput mandatoryField' : 'autocompleteInput createboxInput'; |
| 149 | + if ( array_key_exists( 'class', $other_args ) ) { |
| 150 | + $className .= ' ' . $other_args['class']; |
| 151 | + } |
| 152 | + $input_id = 'input_' . $sfgFieldNum; |
152 | 153 | |
153 | 154 | if ( array_key_exists( 'size', $other_args ) ) { |
154 | 155 | $size = $other_args['size']; |
155 | 156 | } elseif ( array_key_exists( 'is_list', $other_args ) && $other_args['is_list'] ) { |
156 | | - $size = "100"; |
| 157 | + $size = '100'; |
157 | 158 | } else { |
158 | | - $size = "35"; |
| 159 | + $size = '35'; |
159 | 160 | } |
160 | 161 | |
161 | 162 | $inputAttrs = array( |
— | — | @@ -182,13 +183,15 @@ |
183 | 184 | if ( array_key_exists( 'default filename', $other_args ) ) { |
184 | 185 | $default_filename = $other_args['default filename']; |
185 | 186 | } else { |
186 | | - $default_filename = ""; |
| 187 | + $default_filename = ''; |
187 | 188 | } |
188 | 189 | $text .= self::uploadLinkHTML( $input_id, $delimiter, $default_filename ); |
189 | 190 | } |
190 | 191 | |
191 | | - $spanClass = "inputSpan"; |
192 | | - if ( $is_mandatory ) { $spanClass .= " mandatoryFieldSpan"; } |
| 192 | + $spanClass = 'inputSpan'; |
| 193 | + if ( $is_mandatory ) { |
| 194 | + $spanClass .= ' mandatoryFieldSpan'; |
| 195 | + } |
193 | 196 | $text = "\n" . Xml::tags( 'span', array( 'class' => $spanClass ), $text ); |
194 | 197 | |
195 | 198 | return $text; |
— | — | @@ -196,10 +199,26 @@ |
197 | 200 | |
198 | 201 | public static function getAutocompletionParameters() { |
199 | 202 | $params = SFEnumInput::getValuesParameters(); |
200 | | - $params[] = array( 'name' => 'values from url', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_valuesfromurl' ) ); |
201 | | - $params[] = array( 'name' => 'remote autocompletion', 'type' => 'boolean', 'description' => wfMsg( 'sf_forminputs_remoteautocompletion' ) ); |
202 | | - $params[] = array( 'name' => 'list', 'type' => 'boolean', 'description' => wfMsg( 'sf_forminputs_list' ) ); |
203 | | - $params[] = array( 'name' => 'delimiter', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_delimiter' ) ); |
| 203 | + $params[] = array( |
| 204 | + 'name' => 'values from url', |
| 205 | + 'type' => 'string', |
| 206 | + 'description' => wfMsg( 'sf_forminputs_valuesfromurl' ) |
| 207 | + ); |
| 208 | + $params[] = array( |
| 209 | + 'name' => 'remote autocompletion', |
| 210 | + 'type' => 'boolean', |
| 211 | + 'description' => wfMsg( 'sf_forminputs_remoteautocompletion' ) |
| 212 | + ); |
| 213 | + $params[] = array( |
| 214 | + 'name' => 'list', |
| 215 | + 'type' => 'boolean', |
| 216 | + 'description' => wfMsg( 'sf_forminputs_list' ) |
| 217 | + ); |
| 218 | + $params[] = array( |
| 219 | + 'name' => 'delimiter', |
| 220 | + 'type' => 'string', |
| 221 | + 'description' => wfMsg( 'sf_forminputs_delimiter' ) |
| 222 | + ); |
204 | 223 | return $params; |
205 | 224 | } |
206 | 225 | |
— | — | @@ -213,6 +232,12 @@ |
214 | 233 | * Returns the HTML code to be included in the output page for this input. |
215 | 234 | */ |
216 | 235 | public function getHtmlText() { |
217 | | - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs ); |
| 236 | + return self::getHTML( |
| 237 | + $this->mCurrentValue, |
| 238 | + $this->mInputName, |
| 239 | + $this->mIsMandatory, |
| 240 | + $this->mIsDisabled, |
| 241 | + $mOtherArgs |
| 242 | + ); |
218 | 243 | } |
219 | 244 | } |
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_FormInput.php |
— | — | @@ -36,7 +36,6 @@ |
37 | 37 | private $mJsInitFunctionData = array(); |
38 | 38 | private $mJsValidationFunctionData = array(); |
39 | 39 | |
40 | | - |
41 | 40 | /** |
42 | 41 | * Constructor for the SFFormInput class. |
43 | 42 | * |
— | — | @@ -53,13 +52,11 @@ |
54 | 53 | * An associative array of other parameters that were present in the |
55 | 54 | * input definition. |
56 | 55 | */ |
57 | | - public function __construct ( $input_number, $cur_value, $input_name, $other_args ) { |
58 | | - |
| 56 | + public function __construct( $input_number, $cur_value, $input_name, $other_args ) { |
59 | 57 | $this->mInputNumber = $input_number; |
60 | 58 | $this->mCurrentValue = $cur_value; |
61 | 59 | $this->mInputName = $input_name; |
62 | 60 | $this->mOtherArgs = $other_args; |
63 | | - |
64 | 61 | } |
65 | 62 | |
66 | 63 | /** |
— | — | @@ -92,11 +89,31 @@ |
93 | 90 | */ |
94 | 91 | public static function getParameters() { |
95 | 92 | $params = array(); |
96 | | - $params[] = array( 'name' => 'mandatory', 'type' => 'boolean', 'description' => wfMsg( 'sf_forminputs_mandatory' ) ); |
97 | | - $params[] = array( 'name' => 'restricted', 'type' => 'boolean', 'description' => wfMsg( 'sf_forminputs_restricted' ) ); |
98 | | - $params[] = array( 'name' => 'class', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_class' ) ); |
99 | | - $params[] = array( 'name' => 'property', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_property' ) ); |
100 | | - $params[] = array( 'name' => 'default', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_default' ) ); |
| 93 | + $params[] = array( |
| 94 | + 'name' => 'mandatory', |
| 95 | + 'type' => 'boolean', |
| 96 | + 'description' => wfMsg( 'sf_forminputs_mandatory' ) |
| 97 | + ); |
| 98 | + $params[] = array( |
| 99 | + 'name' => 'restricted', |
| 100 | + 'type' => 'boolean', |
| 101 | + 'description' => wfMsg( 'sf_forminputs_restricted' ) |
| 102 | + ); |
| 103 | + $params[] = array( |
| 104 | + 'name' => 'class', |
| 105 | + 'type' => 'string', |
| 106 | + 'description' => wfMsg( 'sf_forminputs_class' ) |
| 107 | + ); |
| 108 | + $params[] = array( |
| 109 | + 'name' => 'property', |
| 110 | + 'type' => 'string', |
| 111 | + 'description' => wfMsg( 'sf_forminputs_property' ) |
| 112 | + ); |
| 113 | + $params[] = array( |
| 114 | + 'name' => 'default', |
| 115 | + 'type' => 'string', |
| 116 | + 'description' => wfMsg( 'sf_forminputs_default' ) |
| 117 | + ); |
101 | 118 | return $params; |
102 | 119 | } |
103 | 120 | |
— | — | @@ -114,7 +131,7 @@ |
115 | 132 | * Returns the HTML code to be included in the output page for this input. |
116 | 133 | * |
117 | 134 | * Ideally this HTML code should provide a basic functionality even if the |
118 | | - * browser is not Javascript capable. I.e. even without Javascript the user |
| 135 | + * browser is not JavaScript capable. I.e. even without JavaScript the user |
119 | 136 | * should be able to input values. |
120 | 137 | * |
121 | 138 | * This function is not used yet. |
— | — | @@ -131,8 +148,8 @@ |
132 | 149 | return false; |
133 | 150 | } |
134 | 151 | |
135 | | - /** |
136 | | - * Returns the name and parameters for the initialization Javascript |
| 152 | + /** |
| 153 | + * Returns the name and parameters for the initialization JavaScript |
137 | 154 | * function for this input type, if any. |
138 | 155 | * |
139 | 156 | * This function is not used yet. |
— | — | @@ -142,7 +159,7 @@ |
143 | 160 | } |
144 | 161 | |
145 | 162 | /** |
146 | | - * Returns the name and parameters for the validation Javascript |
| 163 | + * Returns the name and parameters for the validation JavaScript |
147 | 164 | * functions for this input type, if any. |
148 | 165 | * |
149 | 166 | * This function is not used yet. |
— | — | @@ -207,14 +224,6 @@ |
208 | 225 | $this->mJsInitFunctionData[] = array( 'name' => $name, 'param' => $param ); |
209 | 226 | } |
210 | 227 | |
211 | | - |
212 | | - |
213 | | - |
214 | | - |
215 | | - |
216 | | - |
217 | | - |
218 | | - |
219 | 228 | /** |
220 | 229 | * Returns the set of SMW property types for which this input is |
221 | 230 | * meant to be the default one - ideally, no more than one input |
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_EnumInput.php |
— | — | @@ -25,18 +25,42 @@ |
26 | 26 | |
27 | 27 | public static function getValuesParameters() { |
28 | 28 | $params = array(); |
29 | | - $params[] = array( 'name' => 'values', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_values' ) ); |
30 | | - $params[] = array( 'name' => 'values from property', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_valuesfromproperty' ) ); |
31 | | - $params[] = array( 'name' => 'values from category', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_valuesfromcategory' ) ); |
32 | | - $params[] = array( 'name' => 'values from namespace', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_valuesfromnamespace' ) ); |
33 | | - $params[] = array( 'name' => 'values from concept', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_valuesfromconcept' ) ); |
| 29 | + $params[] = array( |
| 30 | + 'name' => 'values', |
| 31 | + 'type' => 'string', |
| 32 | + 'description' => wfMsg( 'sf_forminputs_values' ) |
| 33 | + ); |
| 34 | + $params[] = array( |
| 35 | + 'name' => 'values from property', |
| 36 | + 'type' => 'string', |
| 37 | + 'description' => wfMsg( 'sf_forminputs_valuesfromproperty' ) |
| 38 | + ); |
| 39 | + $params[] = array( |
| 40 | + 'name' => 'values from category', |
| 41 | + 'type' => 'string', |
| 42 | + 'description' => wfMsg( 'sf_forminputs_valuesfromcategory' ) |
| 43 | + ); |
| 44 | + $params[] = array( |
| 45 | + 'name' => 'values from namespace', |
| 46 | + 'type' => 'string', |
| 47 | + 'description' => wfMsg( 'sf_forminputs_valuesfromnamespace' ) |
| 48 | + ); |
| 49 | + $params[] = array( |
| 50 | + 'name' => 'values from concept', |
| 51 | + 'type' => 'string', |
| 52 | + 'description' => wfMsg( 'sf_forminputs_valuesfromconcept' ) |
| 53 | + ); |
34 | 54 | return $params; |
35 | 55 | } |
36 | 56 | |
37 | 57 | public static function getParameters() { |
38 | 58 | $params = parent::getParameters(); |
39 | 59 | $params = array_merge( $params, self::getValuesParameters() ); |
40 | | - $params[] = array( 'name' => 'show on select', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_showonselect' ) ); |
| 60 | + $params[] = array( |
| 61 | + 'name' => 'show on select', |
| 62 | + 'type' => 'string', |
| 63 | + 'description' => wfMsg( 'sf_forminputs_showonselect' ) |
| 64 | + ); |
41 | 65 | return $params; |
42 | 66 | } |
43 | 67 | } |
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_ComboBoxInput.php |
— | — | @@ -34,25 +34,25 @@ |
35 | 35 | |
36 | 36 | global $sfgTabIndex, $sfgFieldNum; |
37 | 37 | |
38 | | - $className = "sfComboBox"; |
| 38 | + $className = 'sfComboBox'; |
39 | 39 | if ( $is_mandatory ) { |
40 | | - $className .= " mandatoryField"; |
| 40 | + $className .= ' mandatoryField'; |
41 | 41 | } |
42 | 42 | if ( array_key_exists( 'class', $other_args ) ) { |
43 | | - $className .= " " . $other_args['class']; |
| 43 | + $className .= ' ' . $other_args['class']; |
44 | 44 | } |
45 | | - $disabled_text = ( $is_disabled ) ? "disabled" : ""; |
| 45 | + $disabled_text = ( $is_disabled ) ? 'disabled' : ''; |
46 | 46 | |
47 | 47 | if ( array_key_exists( 'size', $other_args ) ) { |
48 | 48 | $size = $other_args['size']; |
49 | 49 | } else { |
50 | | - $size = "35"; |
| 50 | + $size = '35'; |
51 | 51 | } |
52 | 52 | // There's no direct correspondence between the 'size=' |
53 | 53 | // attribute for text inputs and the number of pixels, but |
54 | 54 | // multiplying by 6 seems to be about right for the major |
55 | 55 | // browsers. |
56 | | - $pixel_width = $size * 6 . "px"; |
| 56 | + $pixel_width = $size * 6 . 'px'; |
57 | 57 | |
58 | 58 | list( $autocompleteFieldType, $autocompletionSource ) = |
59 | 59 | SFTextWithAutocompleteInput::getAutocompletionTypeAndSource( $other_args ); |
— | — | @@ -87,17 +87,27 @@ |
88 | 88 | } |
89 | 89 | $selectText = Xml::tags( 'select', $selectAttrs, $optionsText ); |
90 | 90 | |
91 | | - $divClass = "ui-widget"; |
92 | | - if ( $is_mandatory ) { $divClass .= " mandatory"; } |
| 91 | + $divClass = 'ui-widget'; |
| 92 | + if ( $is_mandatory ) { |
| 93 | + $divClass .= ' mandatory'; |
| 94 | + } |
93 | 95 | $text = Xml::tags( 'div', array( 'class' => $divClass ), $selectText ); |
94 | 96 | return $text; |
95 | 97 | } |
96 | 98 | |
97 | 99 | public static function getParameters() { |
98 | 100 | $params = parent::getParameters(); |
99 | | - $params[] = array( 'name' => 'size', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_size' ) ); |
| 101 | + $params[] = array( |
| 102 | + 'name' => 'size', |
| 103 | + 'type' => 'int', |
| 104 | + 'description' => wfMsg( 'sf_forminputs_size' ) |
| 105 | + ); |
100 | 106 | $params = array_merge( $params, SFEnumInput::getValuesParameters() ); |
101 | | - $params[] = array( 'name' => 'existing values only', 'type' => 'boolean', 'description' => wfMsg( 'sf_forminputs_existingvaluesonly' ) ); |
| 107 | + $params[] = array( |
| 108 | + 'name' => 'existing values only', |
| 109 | + 'type' => 'boolean', |
| 110 | + 'description' => wfMsg( 'sf_forminputs_existingvaluesonly' ) |
| 111 | + ); |
102 | 112 | return $params; |
103 | 113 | } |
104 | 114 | |
— | — | @@ -105,6 +115,12 @@ |
106 | 116 | * Returns the HTML code to be included in the output page for this input. |
107 | 117 | */ |
108 | 118 | public function getHtmlText() { |
109 | | - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs ); |
| 119 | + return self::getHTML( |
| 120 | + $this->mCurrentValue, |
| 121 | + $this->mInputName, |
| 122 | + $this->mIsMandatory, |
| 123 | + $this->mIsDisabled, |
| 124 | + $mOtherArgs |
| 125 | + ); |
110 | 126 | } |
111 | 127 | } |
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_CategoryInput.php |
— | — | @@ -26,14 +26,16 @@ |
27 | 27 | |
28 | 28 | public static function getHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) { |
29 | 29 | // escape if CategoryTree extension isn't included |
30 | | - if ( ! function_exists( 'efCategoryTreeParserHook' ) ) |
| 30 | + if ( !function_exists( 'efCategoryTreeParserHook' ) ) { |
31 | 31 | return null; |
| 32 | + } |
32 | 33 | |
33 | 34 | global $sfgTabIndex, $sfgFieldNum; |
34 | 35 | |
35 | | - $className = ( $is_mandatory ) ? "mandatoryField" : "createboxInput"; |
36 | | - if ( array_key_exists( 'class', $other_args ) ) |
37 | | - $className .= " " . $other_args['class']; |
| 36 | + $className = ( $is_mandatory ) ? 'mandatoryField' : 'createboxInput'; |
| 37 | + if ( array_key_exists( 'class', $other_args ) ) { |
| 38 | + $className .= ' ' . $other_args['class']; |
| 39 | + } |
38 | 40 | if ( array_key_exists( 'top category', $other_args ) ) { |
39 | 41 | $top_category = $other_args['top category']; |
40 | 42 | } else { |
— | — | @@ -44,12 +46,12 @@ |
45 | 47 | if ( array_key_exists( 'height', $other_args ) ) { |
46 | 48 | $height = $other_args['height']; |
47 | 49 | } else { |
48 | | - $height = "100"; |
| 50 | + $height = '100'; |
49 | 51 | } |
50 | 52 | if ( array_key_exists( 'width', $other_args ) ) { |
51 | 53 | $width = $other_args['width']; |
52 | 54 | } else { |
53 | | - $width = "500"; |
| 55 | + $width = '500'; |
54 | 56 | } |
55 | 57 | |
56 | 58 | $text = '<div style="overflow: auto; padding: 5px; border: 1px #aaaaaa solid; max-height: ' . $height . 'px; width: ' . $width . 'px;">'; |
— | — | @@ -58,12 +60,12 @@ |
59 | 61 | // mandatory field and there's a current value in place |
60 | 62 | // (either through a default value or because we're editing |
61 | 63 | // an existing page) |
62 | | - if ( ! $is_mandatory || $cur_value == '' ) { |
| 64 | + if ( !$is_mandatory || $cur_value == '' ) { |
63 | 65 | $text .= ' <input type="radio" tabindex="' . $sfgTabIndex . '" name="' . $input_name . '" value=""'; |
64 | | - if ( ! $cur_value ) { |
| 66 | + if ( !$cur_value ) { |
65 | 67 | $text .= ' checked="checked"'; |
66 | 68 | } |
67 | | - $disabled_text = ( $is_disabled ) ? "disabled" : ""; |
| 69 | + $disabled_text = ( $is_disabled ) ? 'disabled' : ''; |
68 | 70 | $text .= " $disabled_text/> <em>" . wfMsg( 'sf_formedit_none' ) . "</em>\n"; |
69 | 71 | } |
70 | 72 | |
— | — | @@ -86,7 +88,12 @@ |
87 | 89 | $cur_value = $wgContLang->ucfirst( $cur_value ); |
88 | 90 | } |
89 | 91 | |
90 | | - $tree = preg_replace( '/(<a class="CategoryTreeLabel.*>)(.*)(<\/a>)/', '<input tabindex="' . $sfgTabIndex . '" name="' . $input_name . '" value="$2" type="radio"> $1$2$3', $tree ); |
| 92 | + $tree = preg_replace( |
| 93 | + '/(<a class="CategoryTreeLabel.*>)(.*)(<\/a>)/', |
| 94 | + '<input tabindex="' . $sfgTabIndex . '" name="' . $input_name . |
| 95 | + '" value="$2" type="radio"> $1$2$3', |
| 96 | + $tree |
| 97 | + ); |
91 | 98 | $tree = str_replace( "value=\"$cur_value\"", "value=\"$cur_value\" checked=\"checked\"", $tree ); |
92 | 99 | // if it's disabled, set all to disabled |
93 | 100 | if ( $is_disabled ) { |
— | — | @@ -94,12 +101,19 @@ |
95 | 102 | } |
96 | 103 | |
97 | 104 | // Get rid of all the 'no subcategories' messages. |
98 | | - $tree = str_replace( '<div class="CategoryTreeChildren" style="display:block"><i class="CategoryTreeNotice">' . wfMsg( 'categorytree-no-subcategories' ) . '</i></div>', '', $tree ); |
| 105 | + $tree = str_replace( |
| 106 | + '<div class="CategoryTreeChildren" style="display:block"><i class="CategoryTreeNotice">' . |
| 107 | + wfMsg( 'categorytree-no-subcategories' ) . '</i></div>', |
| 108 | + '', |
| 109 | + $tree |
| 110 | + ); |
99 | 111 | |
100 | 112 | $text .= $tree . '</div>'; |
101 | 113 | |
102 | | - $spanClass = "radioButtonSpan"; |
103 | | - if ( $is_mandatory ) { $spanClass .= " mandatoryFieldSpan"; } |
| 114 | + $spanClass = 'radioButtonSpan'; |
| 115 | + if ( $is_mandatory ) { |
| 116 | + $spanClass .= ' mandatoryFieldSpan'; |
| 117 | + } |
104 | 118 | $text = Xml::tags( 'span', array( 'class' => $spanClass ), $text ); |
105 | 119 | |
106 | 120 | return $text; |
— | — | @@ -107,10 +121,26 @@ |
108 | 122 | |
109 | 123 | public static function getParameters() { |
110 | 124 | $params = parent::getParameters(); |
111 | | - $params[] = array( 'name' => 'top category', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_topcategory' ) ); |
112 | | - $params[] = array( 'name' => 'hideroot', 'type' => 'boolean', 'description' => wfMsg( 'sf_forminputs_hideroot' ) ); |
113 | | - $params[] = array( 'name' => 'height', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_height' ) ); |
114 | | - $params[] = array( 'name' => 'width', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_width' ) ); |
| 125 | + $params[] = array( |
| 126 | + 'name' => 'top category', |
| 127 | + 'type' => 'string', |
| 128 | + 'description' => wfMsg( 'sf_forminputs_topcategory' ) |
| 129 | + ); |
| 130 | + $params[] = array( |
| 131 | + 'name' => 'hideroot', |
| 132 | + 'type' => 'boolean', |
| 133 | + 'description' => wfMsg( 'sf_forminputs_hideroot' ) |
| 134 | + ); |
| 135 | + $params[] = array( |
| 136 | + 'name' => 'height', |
| 137 | + 'type' => 'int', |
| 138 | + 'description' => wfMsg( 'sf_forminputs_height' ) |
| 139 | + ); |
| 140 | + $params[] = array( |
| 141 | + 'name' => 'width', |
| 142 | + 'type' => 'int', |
| 143 | + 'description' => wfMsg( 'sf_forminputs_width' ) |
| 144 | + ); |
115 | 145 | return $params; |
116 | 146 | } |
117 | 147 | |
— | — | @@ -118,6 +148,12 @@ |
119 | 149 | * Returns the HTML code to be included in the output page for this input. |
120 | 150 | */ |
121 | 151 | public function getHtmlText() { |
122 | | - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs ); |
| 152 | + return self::getHTML( |
| 153 | + $this->mCurrentValue, |
| 154 | + $this->mInputName, |
| 155 | + $this->mIsMandatory, |
| 156 | + $this->mIsDisabled, |
| 157 | + $mOtherArgs |
| 158 | + ); |
123 | 159 | } |
124 | 160 | } |
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_DateInput.php |
— | — | @@ -27,11 +27,11 @@ |
28 | 28 | public static function monthDropdownHTML( $cur_month, $input_name, $is_disabled ) { |
29 | 29 | global $sfgTabIndex, $wgAmericanDates; |
30 | 30 | |
31 | | - $optionsText = ""; |
| 31 | + $optionsText = ''; |
32 | 32 | $month_names = SFFormUtils::getMonthNames(); |
33 | 33 | foreach ( $month_names as $i => $name ) { |
34 | 34 | // pad out month to always be two digits |
35 | | - $month_value = ( $wgAmericanDates == true ) ? $name : str_pad( $i + 1, 2, "0", STR_PAD_LEFT ); |
| 35 | + $month_value = ( $wgAmericanDates == true ) ? $name : str_pad( $i + 1, 2, '0', STR_PAD_LEFT ); |
36 | 36 | $optionAttrs = array ( 'value' => $month_value ); |
37 | 37 | if ( $name == $cur_month || ( $i + 1 ) == $cur_month ) { |
38 | 38 | $optionAttrs['selected'] = 'selected'; |
— | — | @@ -81,7 +81,9 @@ |
82 | 82 | $year = $actual_date->getYear(); |
83 | 83 | // TODO - the code to convert from negative to |
84 | 84 | // BC notation should be in SMW itself. |
85 | | - if ( $year < 0 ) { $year = ( $year * - 1 + 1 ) . " BC"; } |
| 85 | + if ( $year < 0 ) { |
| 86 | + $year = ( $year * - 1 + 1 ) . ' BC'; |
| 87 | + } |
86 | 88 | $month = $actual_date->getMonth(); |
87 | 89 | $day = $actual_date->getDay(); |
88 | 90 | } |
— | — | @@ -92,7 +94,7 @@ |
93 | 95 | $day = null; // no need for day |
94 | 96 | } |
95 | 97 | $text = ""; |
96 | | - $disabled_text = ( $is_disabled ) ? "disabled" : ""; |
| 98 | + $disabled_text = ( $is_disabled ) ? 'disabled' : ''; |
97 | 99 | $monthInput = self::monthDropdownHTML( $month, $input_name, $is_disabled ); |
98 | 100 | $dayInput = ' <input tabindex="' . $sfgTabIndex . '" class="dayInput" name="' . $input_name . '[day]" type="text" value="' . $day . '" size="2" ' . $disabled_text . '/>'; |
99 | 101 | if ( $wgAmericanDates ) { |
— | — | @@ -106,8 +108,10 @@ |
107 | 109 | |
108 | 110 | public static function getHTML( $date, $input_name, $is_mandatory, $is_disabled, $other_args ) { |
109 | 111 | $text = self::getMainHTML( $date, $input_name, $is_mandatory, $is_disabled, $other_args ); |
110 | | - $spanClass = "dateInput"; |
111 | | - if ( $is_mandatory ) { $spanClass .= " mandatoryFieldSpan"; } |
| 112 | + $spanClass = 'dateInput'; |
| 113 | + if ( $is_mandatory ) { |
| 114 | + $spanClass .= ' mandatoryFieldSpan'; |
| 115 | + } |
112 | 116 | $text = Xml::tags( 'span', array( 'class' => $spanClass ), $text ); |
113 | 117 | return $text; |
114 | 118 | } |
— | — | @@ -116,6 +120,12 @@ |
117 | 121 | * Returns the HTML code to be included in the output page for this input. |
118 | 122 | */ |
119 | 123 | public function getHtmlText() { |
120 | | - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs ); |
| 124 | + return self::getHTML( |
| 125 | + $this->mCurrentValue, |
| 126 | + $this->mInputName, |
| 127 | + $this->mIsMandatory, |
| 128 | + $this->mIsDisabled, |
| 129 | + $mOtherArgs |
| 130 | + ); |
121 | 131 | } |
122 | 132 | } |
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_TextAreaInput.php |
— | — | @@ -35,12 +35,12 @@ |
36 | 36 | public static function getHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) { |
37 | 37 | global $sfgTabIndex, $sfgFieldNum; |
38 | 38 | |
39 | | - $className = ( $is_mandatory ) ? "mandatoryField" : "createboxInput"; |
| 39 | + $className = ( $is_mandatory ) ? 'mandatoryField' : 'createboxInput'; |
40 | 40 | if ( array_key_exists( 'class', $other_args ) ) { |
41 | 41 | $className .= " " . $other_args['class']; |
42 | 42 | } |
43 | 43 | // Use a special ID for the free text field, for FCK's needs. |
44 | | - $input_id = $input_name == "free_text" ? "free_text" : "input_$sfgFieldNum"; |
| 44 | + $input_id = $input_name == 'free_text' ? 'free_text' : "input_$sfgFieldNum"; |
45 | 45 | |
46 | 46 | if ( array_key_exists( 'rows', $other_args ) ) { |
47 | 47 | $rows = $other_args['rows']; |
— | — | @@ -63,7 +63,7 @@ |
64 | 64 | if ( array_key_exists( 'cols', $other_args ) ) { |
65 | 65 | $textarea_attrs['cols'] = $other_args['cols']; |
66 | 66 | } else { |
67 | | - $textarea_attrs['style'] = "width: 100%"; |
| 67 | + $textarea_attrs['style'] = 'width: 100%'; |
68 | 68 | } |
69 | 69 | |
70 | 70 | if ( $is_disabled ) { |
— | — | @@ -88,19 +88,41 @@ |
89 | 89 | $cur_value = ''; |
90 | 90 | } |
91 | 91 | $text = Xml::element( 'textarea', $textarea_attrs, $cur_value, false ); |
92 | | - $spanClass = "inputSpan"; |
93 | | - if ( $is_mandatory ) { $spanClass .= " mandatoryFieldSpan"; } |
| 92 | + $spanClass = 'inputSpan'; |
| 93 | + if ( $is_mandatory ) { |
| 94 | + $spanClass .= ' mandatoryFieldSpan'; |
| 95 | + } |
94 | 96 | $text = Xml::tags( 'span', array( 'class' => $spanClass ), $text ); |
95 | 97 | return $text; |
96 | 98 | } |
97 | 99 | |
98 | 100 | public static function getParameters() { |
99 | 101 | $params = parent::getParameters(); |
100 | | - $params[] = array( 'name' => 'preload', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_preload' ) ); |
101 | | - $params[] = array( 'name' => 'rows', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_rows' ) ); |
102 | | - $params[] = array( 'name' => 'cols', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_cols' ) ); |
103 | | - $params[] = array( 'name' => 'maxlength', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_maxlength' ) ); |
104 | | - $params[] = array( 'name' => 'autogrow', 'type' => 'boolean', 'description' => wfMsg( 'sf_forminputs_autogrow' ) ); |
| 102 | + $params[] = array( |
| 103 | + 'name' => 'preload', |
| 104 | + 'type' => 'string', |
| 105 | + 'description' => wfMsg( 'sf_forminputs_preload' ) |
| 106 | + ); |
| 107 | + $params[] = array( |
| 108 | + 'name' => 'rows', |
| 109 | + 'type' => 'int', |
| 110 | + 'description' => wfMsg( 'sf_forminputs_rows' ) |
| 111 | + ); |
| 112 | + $params[] = array( |
| 113 | + 'name' => 'cols', |
| 114 | + 'type' => 'int', |
| 115 | + 'description' => wfMsg( 'sf_forminputs_cols' ) |
| 116 | + ); |
| 117 | + $params[] = array( |
| 118 | + 'name' => 'maxlength', |
| 119 | + 'type' => 'int', |
| 120 | + 'description' => wfMsg( 'sf_forminputs_maxlength' ) |
| 121 | + ); |
| 122 | + $params[] = array( |
| 123 | + 'name' => 'autogrow', |
| 124 | + 'type' => 'boolean', |
| 125 | + 'description' => wfMsg( 'sf_forminputs_autogrow' ) |
| 126 | + ); |
105 | 127 | return $params; |
106 | 128 | } |
107 | 129 | |
— | — | @@ -108,6 +130,12 @@ |
109 | 131 | * Returns the HTML code to be included in the output page for this input. |
110 | 132 | */ |
111 | 133 | public function getHtmlText() { |
112 | | - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs ); |
| 134 | + return self::getHTML( |
| 135 | + $this->mCurrentValue, |
| 136 | + $this->mInputName, |
| 137 | + $this->mIsMandatory, |
| 138 | + $this->mIsDisabled, |
| 139 | + $mOtherArgs |
| 140 | + ); |
113 | 141 | } |
114 | 142 | } |
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_CheckboxesInput.php |
— | — | @@ -34,29 +34,37 @@ |
35 | 35 | public static function getHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) { |
36 | 36 | global $sfgTabIndex, $sfgFieldNum, $sfgShowOnSelect; |
37 | 37 | |
38 | | - $checkbox_class = ( $is_mandatory ) ? "mandatoryField" : "createboxInput"; |
39 | | - $span_class = "checkboxSpan"; |
40 | | - if ( array_key_exists( 'class', $other_args ) ) |
41 | | - $span_class .= " " . $other_args['class']; |
| 38 | + $checkbox_class = ( $is_mandatory ) ? 'mandatoryField' : 'createboxInput'; |
| 39 | + $span_class = 'checkboxSpan'; |
| 40 | + if ( array_key_exists( 'class', $other_args ) ) { |
| 41 | + $span_class .= ' ' . $other_args['class']; |
| 42 | + } |
42 | 43 | $input_id = "input_$sfgFieldNum"; |
43 | 44 | // get list delimiter - default is comma |
44 | 45 | if ( array_key_exists( 'delimiter', $other_args ) ) { |
45 | 46 | $delimiter = $other_args['delimiter']; |
46 | 47 | } else { |
47 | | - $delimiter = ","; |
| 48 | + $delimiter = ','; |
48 | 49 | } |
49 | 50 | $cur_values = SFUtils::getValuesArray( $cur_value, $delimiter ); |
50 | 51 | |
51 | | - if ( ( $possible_values = $other_args['possible_values'] ) == null ) |
| 52 | + if ( ( $possible_values = $other_args['possible_values'] ) == null ) { |
52 | 53 | $possible_values = array(); |
53 | | - $text = ""; |
| 54 | + } |
| 55 | + $text = ''; |
54 | 56 | foreach ( $possible_values as $key => $possible_value ) { |
55 | | - $cur_input_name = $input_name . "[" . $key . "]"; |
| 57 | + $cur_input_name = $input_name . '[' . $key . ']'; |
56 | 58 | |
57 | | - if ( array_key_exists( 'value_labels', $other_args ) && is_array( $other_args['value_labels'] ) && array_key_exists( $possible_value, $other_args['value_labels'] ) ) |
| 59 | + if ( |
| 60 | + array_key_exists( 'value_labels', $other_args ) && |
| 61 | + is_array( $other_args['value_labels'] ) && |
| 62 | + array_key_exists( $possible_value, $other_args['value_labels'] ) |
| 63 | + ) |
| 64 | + { |
58 | 65 | $label = $other_args['value_labels'][$possible_value]; |
59 | | - else |
| 66 | + } else { |
60 | 67 | $label = $possible_value; |
| 68 | + } |
61 | 69 | |
62 | 70 | $checkbox_attrs = array( |
63 | 71 | 'type' => 'checkbox', |
— | — | @@ -84,13 +92,13 @@ |
85 | 93 | } |
86 | 94 | |
87 | 95 | $outerSpanID = "span_$sfgFieldNum"; |
88 | | - $outerSpanClass = "checkboxesSpan"; |
| 96 | + $outerSpanClass = 'checkboxesSpan'; |
89 | 97 | if ( $is_mandatory ) { |
90 | | - $outerSpanClass .= " mandatoryFieldSpan"; |
| 98 | + $outerSpanClass .= ' mandatoryFieldSpan'; |
91 | 99 | } |
92 | 100 | |
93 | 101 | if ( array_key_exists( 'show on select', $other_args ) ) { |
94 | | - $outerSpanClass .= " sfShowIfChecked"; |
| 102 | + $outerSpanClass .= ' sfShowIfChecked'; |
95 | 103 | foreach ( $other_args['show on select'] as $div_id => $options ) { |
96 | 104 | if ( array_key_exists( $outerSpanID, $sfgShowOnSelect ) ) { |
97 | 105 | $sfgShowOnSelect[$outerSpanID][] = array( $options, $div_id ); |
— | — | @@ -111,6 +119,12 @@ |
112 | 120 | * Returns the HTML code to be included in the output page for this input. |
113 | 121 | */ |
114 | 122 | public function getHtmlText() { |
115 | | - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs ); |
| 123 | + return self::getHTML( |
| 124 | + $this->mCurrentValue, |
| 125 | + $this->mInputName, |
| 126 | + $this->mIsMandatory, |
| 127 | + $this->mIsDisabled, |
| 128 | + $mOtherArgs |
| 129 | + ); |
116 | 130 | } |
117 | 131 | } |
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_MultiEnumInput.php |
— | — | @@ -29,7 +29,11 @@ |
30 | 30 | |
31 | 31 | public static function getParameters() { |
32 | 32 | $params = parent::getParameters(); |
33 | | - $params[] = array( 'name' => 'delimiter', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_delimiter' ) ); |
| 33 | + $params[] = array( |
| 34 | + 'name' => 'delimiter', |
| 35 | + 'type' => 'string', |
| 36 | + 'description' => wfMsg( 'sf_forminputs_delimiter' ) |
| 37 | + ); |
34 | 38 | return $params; |
35 | 39 | } |
36 | 40 | } |