-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCargo.php
253 lines (234 loc) · 10.5 KB
/
Cargo.php
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
<?php
/**
* Initialization file for Cargo.
*
* @ingroup Cargo
* @author Yaron Koren
*/
if ( !defined( 'MEDIAWIKI' ) ) die();
define( 'CARGO_VERSION', '0.5' );
$wgExtensionCredits['parserhook'][] = array(
'path' => __FILE__,
'name' => 'Cargo',
'version' => CARGO_VERSION,
'author' => 'Yaron Koren',
'url' => '',
'descriptionmsg' => 'cargo-desc',
);
$dir = dirname( __FILE__ );
// Script path.
$cgScriptPath = $wgScriptPath . '/extensions/Cargo';
$wgJobClasses['cargoPopulateTable'] = 'CargoPopulateTableJob';
$wgJobClasses['cargoRecreateTables'] = 'CargoRecreateTablesJob';
$wgHooks['ParserFirstCallInit'][] = 'cargoRegisterParserFunctions';
$wgHooks['MakeGlobalVariablesScript'][] = 'CargoHooks::setGlobalJSVariables';
$wgHooks['PageContentSaveComplete'][] = 'CargoHooks::onPageContentSaveComplete';
$wgHooks['ApprovedRevsRevisionApproved'][] = 'CargoHooks::onARRevisionApproved';
$wgHooks['ApprovedRevsRevisionUnapproved'][] = 'CargoHooks::onARRevisionUnapproved';
$wgHooks['TitleMoveComplete'][] = 'CargoHooks::onTitleMoveComplete';
$wgHooks['ArticleDeleteComplete'][] = 'CargoHooks::onArticleDeleteComplete';
$wgHooks['LoadExtensionSchemaUpdates'][] = 'CargoHooks::describeDBSchema';
// 'SkinTemplateNavigation' replaced 'SkinTemplateTabs' in the Vector skin
$wgHooks['SkinTemplateTabs'][] = 'CargoRecreateDataAction::displayTab';
$wgHooks['SkinTemplateNavigation'][] = 'CargoRecreateDataAction::displayTab2';
$wgHooks['UnknownAction'][] = 'CargoRecreateDataAction::show';
$wgHooks['BaseTemplateToolbox'][] = 'CargoPageValuesAction::addLink';
$wgHooks['UnknownAction'][] = 'CargoPageValuesAction::show';
$wgHooks['SkinTemplateNavigation'][] = 'CargoHooks::addPurgeCacheTab';
$wgHooks['AdminLinks'][] = 'CargoHooks::addToAdminLinks';
$wgMessagesDirs['Cargo'] = $dir . '/i18n';
$wgExtensionMessagesFiles['Cargo'] = $dir . '/Cargo.i18n.php';
$wgExtensionMessagesFiles['CargoMagic'] = $dir . '/Cargo.i18n.magic.php';
// API modules
$wgAPIModules['cargoquery'] = 'CargoQueryAPI';
// Register classes and special pages.
$wgAutoloadClasses['CargoHooks'] = $dir . '/Cargo.hooks.php';
$wgAutoloadClasses['CargoUtils'] = $dir . '/CargoUtils.php';
$wgAutoloadClasses['CargoFieldDescription'] = $dir . '/CargoFieldDescription.php';
$wgAutoloadClasses['CargoTableSchema'] = $dir . '/CargoTableSchema.php';
$wgAutoloadClasses['CargoDeclare'] = $dir . '/parserfunctions/CargoDeclare.php';
$wgAutoloadClasses['CargoAttach'] = $dir . '/parserfunctions/CargoAttach.php';
$wgAutoloadClasses['CargoStore'] = $dir . '/parserfunctions/CargoStore.php';
$wgAutoloadClasses['CargoQuery'] = $dir . '/parserfunctions/CargoQuery.php';
$wgAutoloadClasses['CargoCompoundQuery'] = $dir . '/parserfunctions/CargoCompoundQuery.php';
$wgAutoloadClasses['CargoSQLQuery'] = $dir . '/CargoSQLQuery.php';
$wgAutoloadClasses['CargoQueryDisplayer'] = $dir . '/CargoQueryDisplayer.php';
$wgAutoloadClasses['CargoRecurringEvent'] = $dir . '/parserfunctions/CargoRecurringEvent.php';
$wgAutoloadClasses['CargoDisplayMap'] = $dir . '/parserfunctions/CargoDisplayMap.php';
$wgAutoloadClasses['CargoPopulateTableJob'] = $dir . '/CargoPopulateTableJob.php';
$wgAutoloadClasses['CargoRecreateTablesJob'] = $dir . '/CargoRecreateTablesJob.php';
$wgAutoloadClasses['CargoRecreateDataAction'] = $dir . '/CargoRecreateDataAction.php';
$wgAutoloadClasses['CargoRecreateData'] = $dir . '/specials/CargoRecreateData.php';
$wgSpecialPages['CargoTables'] = 'CargoTables';
$wgAutoloadClasses['CargoTables'] = $dir . '/specials/CargoTables.php';
$wgSpecialPages['DeleteCargoTable'] = 'CargoDeleteCargoTable';
$wgAutoloadClasses['CargoDeleteCargoTable'] = $dir . '/specials/CargoDeleteTable.php';
$wgSpecialPages['ViewData'] = 'CargoViewData';
$wgAutoloadClasses['CargoViewData'] = $dir . '/specials/CargoViewData.php';
$wgSpecialPages['CargoExport'] = 'CargoExport';
$wgAutoloadClasses['CargoExport'] = $dir . '/specials/CargoExport.php';
$wgAutoloadClasses['CargoPageValuesAction'] = $dir . '/CargoPageValuesAction.php';
$wgSpecialPages['PageValues'] = 'CargoPageValues';
$wgAutoloadClasses['CargoPageValues'] = $dir . '/specials/CargoPageValues.php';
$wgAutoloadClasses['CargoQueryAPI'] = $dir . '/CargoQueryAPI.php';
// Display formats
$wgAutoloadClasses['CargoDisplayFormat'] = $dir . '/formats/CargoDisplayFormat.php';
$wgAutoloadClasses['CargoDeferredFormat'] = $dir . '/formats/CargoDeferredFormat.php';
$wgAutoloadClasses['CargoListFormat'] = $dir . '/formats/CargoListFormat.php';
$wgAutoloadClasses['CargoULFormat'] = $dir . '/formats/CargoULFormat.php';
$wgAutoloadClasses['CargoOLFormat'] = $dir . '/formats/CargoOLFormat.php';
$wgAutoloadClasses['CargoTemplateFormat'] = $dir . '/formats/CargoTemplateFormat.php';
$wgAutoloadClasses['CargoOutlineFormat'] = $dir . '/formats/CargoOutlineFormat.php';
$wgAutoloadClasses['CargoTreeFormat'] = $dir . '/formats/CargoTreeFormat.php';
$wgAutoloadClasses['CargoEmbeddedFormat'] = $dir . '/formats/CargoEmbeddedFormat.php';
$wgAutoloadClasses['CargoCSVFormat'] = $dir . '/formats/CargoCSVFormat.php';
$wgAutoloadClasses['CargoJSONFormat'] = $dir . '/formats/CargoJSONFormat.php';
$wgAutoloadClasses['CargoTableFormat'] = $dir . '/formats/CargoTableFormat.php';
$wgAutoloadClasses['CargoDynamicTableFormat'] = $dir . '/formats/CargoDynamicTableFormat.php';
$wgAutoloadClasses['CargoMapsFormat'] = $dir . '/formats/CargoMapsFormat.php';
$wgAutoloadClasses['CargoGoogleMapsFormat'] = $dir . '/formats/CargoGoogleMapsFormat.php';
$wgAutoloadClasses['CargoOpenLayersFormat'] = $dir . '/formats/CargoOpenLayersFormat.php';
$wgAutoloadClasses['CargoCalendarFormat'] = $dir . '/formats/CargoCalendarFormat.php';
$wgAutoloadClasses['CargoTimelineFormat'] = $dir . '/formats/CargoTimelineFormat.php';
$wgAutoloadClasses['CargoCategoryFormat'] = $dir . '/formats/CargoCategoryFormat.php';
$wgAutoloadClasses['CargoBarChartFormat'] = $dir . '/formats/CargoBarChartFormat.php';
// Drilldown
$wgAutoloadClasses['CargoAppliedFilter'] = $dir . '/drilldown/CargoAppliedFilter.php';
$wgAutoloadClasses['CargoFilter'] = $dir . '/drilldown/CargoFilter.php';
$wgAutoloadClasses['CargoFilterValue'] = $dir . '/drilldown/CargoFilterValue.php';
$wgAutoloadClasses['CargoDrilldownUtils'] = $dir . '/drilldown/CargoDrilldownUtils.php';
$wgAutoloadClasses['CargoDrilldown'] = $dir . '/drilldown/CargoSpecialDrilldown.php';
$wgSpecialPages['Drilldown'] = 'CargoDrilldown';
// User rights
$wgAvailableRights[] = 'recreatecargodata';
$wgGroupPermissions['sysop']['recreatecargodata'] = true;
$wgAvailableRights[] = 'deletecargodata';
$wgGroupPermissions['sysop']['deletecargodata'] = true;
// Page properties
$wgPageProps['CargoTableName'] = "The name of the database table that holds this template's data";
$wgPageProps['CargoFields'] = 'The set of fields stored for this template';
// ResourceLoader modules
$wgResourceModules += array(
'ext.cargo.main' => array(
'styles' => 'Cargo.css',
'localBasePath' => __DIR__,
'remoteExtPath' => 'Cargo'
),
'ext.cargo.drilldown' => array(
'styles' => array(
'drilldown/resources/CargoDrilldown.css',
'drilldown/resources/CargoJQueryUIOverrides.css',
),
'scripts' => array(
'drilldown/resources/CargoDrilldown.js',
),
'dependencies' => array(
'jquery.ui.autocomplete',
'jquery.ui.button',
),
'position' => 'top',
'localBasePath' => __DIR__,
'remoteExtPath' => 'Cargo'
),
'ext.cargo.maps' => array(
'scripts' => array(
'libs/ext.cargo.maps.js',
'libs/markerclusterer.js',
),
'position' => 'top',
'localBasePath' => __DIR__,
'remoteExtPath' => 'Cargo'
),
'ext.cargo.calendar' => array(
'styles' => array(
'libs/fullcalendar.css',
'libs/ext.cargo.calendar.css',
),
'scripts' => array(
'libs/moment.js',
'libs/fullcalendar.js',
'libs/ext.cargo.calendar.js',
),
'position' => 'top',
'localBasePath' => __DIR__,
'remoteExtPath' => 'Cargo'
),
'ext.cargo.timeline' => array(
'styles' => array(
'libs/SimileTimeline/styles/timeline.css',
'libs/SimileTimeline/styles/ethers.css',
'libs/SimileTimeline/styles/events.css',
),
'scripts' => array(
'libs/ext.cargo.timeline.js',
'libs/SimileTimeline/scripts/timeline.js',
'libs/SimileTimeline/scripts/util/platform.js',
'libs/SimileTimeline/scripts/util/debug.js',
'libs/SimileTimeline/scripts/util/xmlhttp.js',
'libs/SimileTimeline/scripts/util/dom.js',
'libs/SimileTimeline/scripts/util/graphics.js',
'libs/SimileTimeline/scripts/util/date-time.js',
'libs/SimileTimeline/scripts/util/data-structure.js',
'libs/SimileTimeline/scripts/units.js',
'libs/SimileTimeline/scripts/themes.js',
'libs/SimileTimeline/scripts/ethers.js',
'libs/SimileTimeline/scripts/ether-painters.js',
'libs/SimileTimeline/scripts/labellers.js',
'libs/SimileTimeline/scripts/sources.js',
'libs/SimileTimeline/scripts/layouts.js',
'libs/SimileTimeline/scripts/painters.js',
'libs/SimileTimeline/scripts/decorators.js',
),
'position' => 'top',
'localBasePath' => __DIR__,
'remoteExtPath' => 'Cargo'
),
'ext.cargo.datatables' => array(
'styles' => array(
'libs/DataTables/css/jquery.dataTables.css',
),
'scripts' => array(
'libs/DataTables/js/jquery.dataTables.js',
'libs/ext.cargo.datatables.js',
),
'position' => 'top',
'localBasePath' => __DIR__,
'remoteExtPath' => 'Cargo'
),
'ext.cargo.nvd3' => array(
'scripts' => array(
'libs/d3.js',
'libs/nv.d3.js',
'libs/ext.cargo.nvd3.js',
),
'localBasePath' => __DIR__,
'remoteExtPath' => 'Cargo'
),
);
function cargoRegisterParserFunctions( &$parser ) {
$parser->setFunctionHook( 'cargo_declare', array( 'CargoDeclare', 'run' ) );
$parser->setFunctionHook( 'cargo_attach', array( 'CargoAttach', 'run' ) );
$parser->setFunctionHook( 'cargo_store', array( 'CargoStore', 'run' ) );
$parser->setFunctionHook( 'cargo_query', array( 'CargoQuery', 'run' ) );
$parser->setFunctionHook( 'cargo_compound_query', array( 'CargoCompoundQuery', 'run' ) );
$parser->setFunctionHook( 'recurring_event', array( 'CargoRecurringEvent', 'run' ) );
$parser->setFunctionHook( 'cargo_display_map', array( 'CargoDisplayMap', 'run' ) );
return true;
}
$wgCargoDecimalMark = '.';
$wgCargoDigitGroupingCharacter = ',';
$wgCargoRecurringEventMaxInstances = 100;
$wgCargoDBtype = null;
$wgCargoDBserver = null;
$wgCargoDBname = null;
$wgCargoDBuser = null;
$wgCargoDBpassword = null;
$wgCargoDefaultQueryLimit = 100;
$wgCargoMaxQueryLimit = 5000;
$wgCargoMapClusteringMinimum = 80;
$wgCargoDrilldownUseTabs = false;
// Set these to a positive number for cloud-style display.
$wgCargoDrilldownSmallestFontSize = -1;
$wgCargoDrilldownLargestFontSize = -1;
$wgCargoDrilldownMinValuesForComboBox = 40;
$wgCargoDrilldownNumRangesForNumbers = 5;