This repository was archived by the owner on Mar 12, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSemanticFormsInputs.php
More file actions
184 lines (159 loc) · 5.84 KB
/
SemanticFormsInputs.php
File metadata and controls
184 lines (159 loc) · 5.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<?php
/**
* Additional input types for [http://www.mediawiki.org/wiki/Extension:SemanticForms Semantic Forms].
*
* @defgroup SFI Semantic Forms Inputs
*
* @author Stephan Gambke
* @author Yaron Koren
* @author Jeroen de Dauw
* @author Sanyam Goyal
* @author Yury Katkov
*/
/**
* The main file of the Semantic Forms Inputs extension
*
* @file
* @ingroup SFI
*/
if ( !defined( 'MEDIAWIKI' ) ) {
die( 'This file is part of a MediaWiki extension, it is not a valid entry point.' );
}
if ( version_compare( $wgVersion, '1.17', 'lt' ) ) {
die( '<b>Error:</b> This version of <a href="https://www.mediawiki.org/wiki/Extension:Semantic_Forms_Inputs">Semantic Forms Inputs</a> is only compatible with MediaWiki 1.17 or above. You need to upgrade MediaWiki first.' );
}
if ( !defined( 'SF_VERSION' ) ) {
die( '<b>Error:</b> <a href="https://www.mediawiki.org/wiki/Extension:Semantic_Forms_Inputs">Semantic Forms Inputs</a> is a Semantic Forms extension. You need to install <a href="https://www.mediawiki.org/wiki/Extension:Semantic_Forms">Semantic Forms</a> first.' );
}
if ( version_compare( SF_VERSION, '2.4.2', 'lt' ) ) {
die( '<b>Error:</b> This version of <a href="https://www.mediawiki.org/wiki/Extension:Semantic_Forms_Inputs">Semantic Forms Inputs</a> is only compatible with Semantic Forms 2.4.1 or above. You need to upgrade <a href="https://www.mediawiki.org/wiki/Extension:Semantic_Forms">Semantic Forms</a> first.' );
}
define( 'SFI_VERSION', '0.9.0 alpha' );
// create and initialize settings
$sfigSettings = new SFISettings();
// register extension
$wgExtensionCredits[ 'semantic' ][] = array(
'path' => __FILE__,
'name' => 'Semantic Forms Inputs',
'author' => array( '[http://www.mediawiki.org/wiki/User:F.trott Stephan Gambke]', '...' ),
'url' => 'https://www.mediawiki.org/wiki/Extension:Semantic_Forms_Inputs',
'descriptionmsg' => 'semanticformsinputs-desc',
'version' => SFI_VERSION,
'license-name' => 'GPL-2.0+'
);
$dir = dirname( __FILE__ );
// load user settings
require_once( $dir . '/includes/SFI_Settings.php' );
$wgMessagesDirs['SemanticFormsInputs'] = __DIR__ . '/i18n';
$wgExtensionMessagesFiles['SemanticFormsInputs'] = $dir . '/SemanticFormsInputs.i18n.php';
$wgHooks['ParserFirstCallInit'][] = 'wfSFISetup';
$wgAutoloadClasses['SFIUtils'] = $dir . '/includes/SFI_Utils.php';
$wgAutoloadClasses['SFIDatePicker'] = $dir . '/includes/SFI_DatePicker.php';
$wgAutoloadClasses['SFITimePicker'] = $dir . '/includes/SFI_TimePicker.php';
$wgAutoloadClasses['SFIDateTimePicker'] = $dir . '/includes/SFI_DateTimePicker.php';
$wgAutoloadClasses['SFIMenuSelect'] = $dir . '/includes/SFI_MenuSelect.php';
$wgAutoloadClasses['SFIRegExp'] = $dir . '/includes/SFI_RegExp.php';
$wgAutoloadClasses['SFITwoListBoxes'] = $dir . '/includes/SFI_TwoListBoxes.php';
$wgAutoloadClasses['SFIDateCheck'] = $dir . '/includes/SFI_DateCheck.php';
$wgResourceModules['ext.semanticformsinputs.datepicker'] = array(
'localBasePath' => $dir,
'remoteExtPath' => 'SemanticFormsInputs',
'scripts' => 'libs/datepicker.js',
'dependencies' => array(
'jquery.ui.datepicker',
'ext.semanticforms.main'
),
);
$wgResourceModules['ext.semanticformsinputs.timepicker'] = array(
'localBasePath' => $dir,
'remoteExtPath' => 'SemanticFormsInputs',
'scripts' => 'libs/timepicker.js',
'styles' => 'skins/SFI_Timepicker.css',
'dependencies' => array(
'ext.semanticforms.main'
),
);
$wgResourceModules['ext.semanticformsinputs.datetimepicker'] = array(
'localBasePath' => $dir,
'remoteExtPath' => 'SemanticFormsInputs',
'scripts' => 'libs/datetimepicker.js',
'dependencies' => array(
'ext.semanticformsinputs.timepicker',
'ext.semanticformsinputs.datepicker'
),
);
$wgResourceModules['ext.semanticformsinputs.menuselect'] = array(
'localBasePath' => $dir,
'remoteExtPath' => 'SemanticFormsInputs',
'scripts' => 'libs/menuselect.js',
'styles' => 'skins/SFI_Menuselect.css',
'dependencies' => array(
'ext.semanticforms.main'
),
);
$wgResourceModules['ext.semanticformsinputs.regexp'] = array(
'localBasePath' => $dir,
'remoteExtPath' => 'SemanticFormsInputs',
'scripts' => 'libs/regexp.js',
'dependencies' => array(
'ext.semanticforms.main'
),
);
$wgResourceModules['ext.semanticformsinputs.twolistboxes'] = array(
'localBasePath' => $dir,
'remoteExtPath' => 'SemanticFormsInputs',
'scripts' => array(
'libs/jquery.quicksearch.js',
'libs/jquery.multi-select.js',
'libs/twolistboxes.js'
),
'styles' => 'skins/SFI_TwoListBoxes.css',
'dependencies' => 'ext.semanticforms.main'
);
$wgResourceModules[ 'ext.semanticformsinputs.datecheck' ] = array(
'localBasePath' => $dir,
'remoteExtPath' => 'SemanticFormsInputs',
'scripts' => array(
'libs/jquery.form-validator.js',
'libs/datecheck.js',
),
'styles' => 'skins/SFI_DateCheck.css',
'dependencies' => array(
'ext.semanticforms.main'
),
);
/**
* Class to encapsulate all settings
*/
class SFISettings {
// general settings
public $scriptPath;
// settings for input type datepicker
public $datePickerFirstDate;
public $datePickerLastDate;
public $datePickerDateFormat;
public $datePickerWeekStart;
public $datePickerShowWeekNumbers;
public $datePickerDisableInputField;
public $datePickerShowResetButton;
public $datePickerDisabledDaysOfWeek;
public $datePickerHighlightedDaysOfWeek;
public $datePickerDisabledDates;
public $datePickerHighlightedDates;
public $datePickerMonthNames;
public $datePickerDayNames;
}
/**
* Registers the input types with Semantic Forms.
*/
function wfSFISetup() {
global $sfgFormPrinter, $wgVersion;
$sfgFormPrinter->registerInputType( 'SFIDatePicker' );
$sfgFormPrinter->registerInputType( 'SFITimePicker' );
$sfgFormPrinter->registerInputType( 'SFIDateTimePicker' );
$sfgFormPrinter->registerInputType( 'SFIMenuSelect' );
$sfgFormPrinter->registerInputType( 'SFIRegExp' );
$sfgFormPrinter->registerInputType( 'SFITwoListBoxes' );
$sfgFormPrinter->registerInputType( 'SFIDateCheck' );
return true;
}