Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 207 lines (162 sloc) 7.978 kb
8590a4f @LegNeato Initial upload to GitHub
LegNeato authored
1 <?php
840c35d @brandonsavage Fixes Bug 855560 - Adding the Mozilla MPL license header to all Mozilla-...
brandonsavage authored
2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8590a4f @LegNeato Initial upload to GitHub
LegNeato authored
5
49d18d7 @brandonsavage Improving configuration files for mediawiki-bugzilla to indicate how an...
brandonsavage authored
6 /**
7 * This is the configuration file for mediawiki-bugzilla. It contains important
8 * settings that should be reviewed and customized for your environment. Please
ceb37ed @cargan added posibility to configure outpu table pagination
cargan authored
9 * see the instructions on each line for details about what should be
49d18d7 @brandonsavage Improving configuration files for mediawiki-bugzilla to indicate how an...
brandonsavage authored
10 * customized and how to properly install the application.
11 *
12 * For maximum commpatibility with Mediawiki, settings modifications should be
13 * made in the mediawiki/LocalSettings.php file. See the README for
14 * instructions.
15 */
16
17 /**
18 * Application metadata and credits. Should not be changed.
19 */
8590a4f @LegNeato Initial upload to GitHub
LegNeato authored
20
21 $wgExtensionCredits['other'][] = array(
22 'name' => 'Bugzilla',
bb26504 @reedy Initial cleanup (v2)
reedy authored
23 'author' => 'Christian Legnitto',
8590a4f @LegNeato Initial upload to GitHub
LegNeato authored
24 'url' => 'https://github.com/LegNeato/mediawiki-bugzilla',
bb26504 @reedy Initial cleanup (v2)
reedy authored
25 'descriptionmsg' => 'bugzilla-desc',
8590a4f @LegNeato Initial upload to GitHub
LegNeato authored
26 );
27
1428a54 @superawesome Convert most resources to use ResourceLoader
superawesome authored
28 $wgResourceModules['ext.Bugzilla'] = array(
29 'scripts' => array( 'web/js/jquery.dataTables.js' ),
30 'styles' => array( 'web/css/demo_page.css', 'web/css/demo_table.css', 'web/css/bugzilla.css' ),
31 'messages' => array( 'bugzilla-hello-world', 'bugzilla-goodbye-world' ),
32 'dependencies' => array( 'jquery.ui.core' ),
33 'position' => 'top', // jquery.dataTables.js errors otherwise :(
34 'localBasePath' => __DIR__,
35 'remoteExtPath' => 'Bugzilla'
36 );
8590a4f @LegNeato Initial upload to GitHub
LegNeato authored
37
49d18d7 @brandonsavage Improving configuration files for mediawiki-bugzilla to indicate how an...
brandonsavage authored
38 /**
39 * Classes to be autoloaded by mediawiki. Should you add any cache options, you
40 * should include them in this list.
41 */
8590a4f @LegNeato Initial upload to GitHub
LegNeato authored
42
178dafd @brandonsavage Minor config changes to make the configuration more efficient.
brandonsavage authored
43 $cwd = dirname(__FILE__); // We don't need to do this more than once!
44
01914d4 @reedy Fix path to i18n file
reedy authored
45 $wgExtensionMessagesFiles['Bugzilla'] = "$cwd/Bugzilla.i18n.php";
bb26504 @reedy Initial cleanup (v2)
reedy authored
46
7f1d0a1 @rdalverny More generic layout for caching.
rdalverny authored
47 $wgAutoloadClasses['Bugzilla'] = $cwd . '/Bugzilla.class.php';
48 $wgAutoloadClasses['BugzillaQuery'] = $cwd . '/BugzillaQuery.class.php';
49 $wgAutoloadClasses['BugzillaOutput'] = $cwd . '/BugzillaOutput.class.php';
50 $wgAutoloadClasses['BugzillaCacheI'] = $cwd . '/cache/BugzillaCacheI.class.php';
e11d2da @brandonsavage Revert "Enabling caching by default." It changes the wrong line.
brandonsavage authored
51 $wgAutoloadClasses['BugzillaCacheDummy'] = $cwd . '/cache/BugzillaCacheDummy.class.php';
7f1d0a1 @rdalverny More generic layout for caching.
rdalverny authored
52 $wgAutoloadClasses['BugzillaCacheApc'] = $cwd . '/cache/BugzillaCacheApc.class.php';
d152ee9 @brandonsavage Adding memcache class for IT to utilize.
brandonsavage authored
53 $wgAutoloadClasses['BugzillaCacheMemcache'] = $cwd . '/cache/BugzillaCacheMemcache.class.php';
7f1d0a1 @rdalverny More generic layout for caching.
rdalverny authored
54 $wgAutoloadClasses['BugzillaCacheSql'] = $cwd . '/cache/BugzillaCacheSql.class.php';
b62c6d9 @LegNeato Big refactoring.
LegNeato authored
55
49d18d7 @brandonsavage Improving configuration files for mediawiki-bugzilla to indicate how an...
brandonsavage authored
56 /**
57 * These hooks are used by mediawiki to properly display the plugin information
58 * and properly interpret the tags used.
59 */
8590a4f @LegNeato Initial upload to GitHub
LegNeato authored
60
b62c6d9 @LegNeato Big refactoring.
LegNeato authored
61 $wgHooks['LoadExtensionSchemaUpdates'][] = 'BugzillaCreateCache';
62 $wgHooks['BeforePageDisplay'][] = 'BugzillaIncludeHTML';
63 $wgHooks['ParserFirstCallInit'][] = 'BugzillaParserInit';
8590a4f @LegNeato Initial upload to GitHub
LegNeato authored
64
b62c6d9 @LegNeato Big refactoring.
LegNeato authored
65 // Schema updates for the database cache
7f1d0a1 @rdalverny More generic layout for caching.
rdalverny authored
66 function BugzillaCreateCache($updater) {
67
68 global $wgBugzillaCacheType;
69
70 $class = Bugzilla::getCacheClass($wgBugzillaCacheType);
71 $class::setup($updater);
b62c6d9 @LegNeato Big refactoring.
LegNeato authored
72
73 // Let the other hooks keep processing
bb26504 @reedy Initial cleanup (v2)
reedy authored
74 return true;
b62c6d9 @LegNeato Big refactoring.
LegNeato authored
75 }
76
77 // Add content to page HTML
8590a4f @LegNeato Initial upload to GitHub
LegNeato authored
78 function BugzillaIncludeHTML( &$out, &$sk ) {
79
80 global $wgScriptPath;
2a50ccd @christi3k declare global wgVersion
christi3k authored
81 global $wgVersion;
5a4db4a @LegNeato Fix support for jquery tables, add the ability to specify fields,
LegNeato authored
82 global $wgBugzillaJqueryTable;
ceb37ed @cargan added posibility to configure outpu table pagination
cargan authored
83 global $wgBugzillaTable;
8590a4f @LegNeato Initial upload to GitHub
LegNeato authored
84
5a4db4a @LegNeato Fix support for jquery tables, add the ability to specify fields,
LegNeato authored
85 if( $wgBugzillaJqueryTable ) {
7c7c9a3 @christi3k Load local jquery and jqueryui only for mw versions prior to 1.17.
christi3k authored
86 if( version_compare( $wgVersion, '1.17', '<') ) {
87 // Use local jquery
88 $out->addScriptFile("$wgScriptPath/extensions/Bugzilla/web/jquery/1.6.2/jquery.min.js");
8590a4f @LegNeato Initial upload to GitHub
LegNeato authored
89
7c7c9a3 @christi3k Load local jquery and jqueryui only for mw versions prior to 1.17.
christi3k authored
90 // Use local jquery ui
91 $out->addScriptFile("$wgScriptPath/extensions/Bugzilla/web/jqueryui/1.8.14/jquery-ui.min.js");
92
93 // Add a local jquery css file
94 $out->addStyle("$wgScriptPath/extensions/Bugzilla/web/jqueryui/1.8.14/themes/base/jquery-ui.css");
95
96 // Add a local jquery UI theme css file
97 $out->addStyle("$wgScriptPath/extensions/Bugzilla/web/jqueryui/1.8.14/themes/smoothness/jquery-ui.css");
8590a4f @LegNeato Initial upload to GitHub
LegNeato authored
98
1428a54 @superawesome Convert most resources to use ResourceLoader
superawesome authored
99 // Add a local script file for the datatable
100 $out->addScriptFile("$wgScriptPath/extensions/Bugzilla/web/js/jquery.dataTables.js");
8590a4f @LegNeato Initial upload to GitHub
LegNeato authored
101
1428a54 @superawesome Convert most resources to use ResourceLoader
superawesome authored
102 // Add local datatable styles
103 $out->addStyle("$wgScriptPath/extensions/Bugzilla/web/css/demo_page.css");
104 $out->addStyle("$wgScriptPath/extensions/Bugzilla/web/css/demo_table.css");
105
106 // Add local bugzilla extension styles
107 $out->addStyle("$wgScriptPath/extensions/Bugzilla/web/css/bugzilla.css");
108
109 }
8590a4f @LegNeato Initial upload to GitHub
LegNeato authored
110
bb26504 @reedy Initial cleanup (v2)
reedy authored
111 // Add the script to do table magic
112 $out->addInlineScript('$(document).ready(function() {
113 $("table.bugzilla").dataTable({
ceb37ed @cargan added posibility to configure outpu table pagination
cargan authored
114 "bJQueryUI": true,
115 "aLengthMenu": ' . $wgBugzillaTable['lengthMenu'] . ',
116 "iDisplayLength" : ' . $wgBugzillaTable['pageSize'] . ',
fd13cf2 @edmorley Prevent jquery datatable from overriding the initial sort order
edmorley authored
117 /* Disable initial sort */
118 "aaSorting": [],
bb26504 @reedy Initial cleanup (v2)
reedy authored
119 })});'
120 );
5a4db4a @LegNeato Fix support for jquery tables, add the ability to specify fields,
LegNeato authored
121 }
122
123 // Let the user optionally override bugzilla extension styles
124 if( file_exists("$wgScriptPath/extensions/Bugzilla/web/css/custom.css") ) {
125 $out->addStyle("$wgScriptPath/extensions/Bugzilla/web/css/custom.css");
126 }
8590a4f @LegNeato Initial upload to GitHub
LegNeato authored
127
1428a54 @superawesome Convert most resources to use ResourceLoader
superawesome authored
128 $out->addModules('ext.Bugzilla');
129
8590a4f @LegNeato Initial upload to GitHub
LegNeato authored
130 // Let the other hooks keep processing
b62c6d9 @LegNeato Big refactoring.
LegNeato authored
131 return TRUE;
8590a4f @LegNeato Initial upload to GitHub
LegNeato authored
132 }
133
134 // Hook our callback function into the parser
135 function BugzillaParserInit( Parser &$parser ) {
136 global $wgBugzillaTagName;
137
138 // Register the desired tag
139 $parser->setHook( $wgBugzillaTagName, 'BugzillaRender' );
140
141 // Let the other hooks keep processing
bb26504 @reedy Initial cleanup (v2)
reedy authored
142 return true;
8590a4f @LegNeato Initial upload to GitHub
LegNeato authored
143 }
144
145 // Function to be called when our tag is found by the parser
dc54dec @LegNeato Some versions of mediawiki don't provide frame, set it to null by defaul...
LegNeato authored
146 function BugzillaRender($input, array $args, Parser $parser, $frame=null ) {
8590a4f @LegNeato Initial upload to GitHub
LegNeato authored
147 global $wgBugzillaRESTURL;
148
149 // We don't want the page to be cached
150 // TODO: Not sure if we need this
151 $parser->disableCache();
5a4db4a @LegNeato Fix support for jquery tables, add the ability to specify fields,
LegNeato authored
152
153 // TODO: Figure out to have the parser not do anything to our output
154 // mediawiki docs are wrong :-(
155 // error_log(print_r($parser->mStripState, true));
156 // $parser->mStripState->addItem( 'nowiki', 'NOWIKI', true);
157 // 'noparse' => true, 'isHTML' => true, 'markerType' => 'nowiki' );
158
f3978bc @LegNeato Make the jQuery tables look slightly better
LegNeato authored
159 $input = $parser->recursiveTagParse($input, $frame);
160
8590a4f @LegNeato Initial upload to GitHub
LegNeato authored
161 // Create a new bugzilla object
b62c6d9 @LegNeato Big refactoring.
LegNeato authored
162 $bz = Bugzilla::create($args, $input, $parser->getTitle());
8590a4f @LegNeato Initial upload to GitHub
LegNeato authored
163
b62c6d9 @LegNeato Big refactoring.
LegNeato authored
164 // Show the desired output (or an error if there was one)
8590a4f @LegNeato Initial upload to GitHub
LegNeato authored
165 return $bz->render();
166 }
167
49d18d7 @brandonsavage Improving configuration files for mediawiki-bugzilla to indicate how an...
brandonsavage authored
168 /**
169 * This configuration is the default configuration for mediawiki-bugzilla.
170 * Please feel free to customize it for your environment. Be sure to make
171 * changes in the mediawiki/LocalSettings.php file, to ensure upgrade
172 * compatibility.
173 */
174
7f1d0a1 @rdalverny More generic layout for caching.
rdalverny authored
175 // Remote API
8366fb3 @christi3k Updated bugzilla api endpoint. Fixes Issue #62 and https://bugzilla.mozi...
christi3k authored
176 $wgBugzillaRESTURL = 'https://bugzilla.mozilla.org/bzapi'; // The URL for your Bugzilla API installation
7f1d0a1 @rdalverny More generic layout for caching.
rdalverny authored
177 $wgBugzillaURL = 'https://bugzilla.mozilla.org'; // The URL for your Bugzilla installation
49d18d7 @brandonsavage Improving configuration files for mediawiki-bugzilla to indicate how an...
brandonsavage authored
178 $wgBugzillaTagName = 'bugzilla'; // The tag name for your Bugzilla installation (default: 'bugzilla')
179 $wgBugzillaMethod = 'REST'; // XML-RPC and JSON-RPC may be supported later
180
7f1d0a1 @rdalverny More generic layout for caching.
rdalverny authored
181 // Cache
182 // NOTE: $wgBugzillaUseCache has been removed. Use $wgBugzillaCacheType below only:
183 // - any valid value for using it
184 // - equivalent to previous $wgBugzillaUseCache = false; is $wgBugzillaCacheType = 'dummy';
185 $wgBugzillaCacheType = 'mysql'; // valid values are: memcache, apc, mysql, postgresql, sqlite, dummy.
186 $wgBugzillaCacheMins = 5; // Minutes to cache results (default: 5)
187
bb26504 @reedy Initial cleanup (v2)
reedy authored
188 $wgBugzillaJqueryTable = true; // Use a jQuery table for display (default: true)
49d18d7 @brandonsavage Improving configuration files for mediawiki-bugzilla to indicate how an...
brandonsavage authored
189
7f1d0a1 @rdalverny More generic layout for caching.
rdalverny authored
190 // Charts
49d18d7 @brandonsavage Improving configuration files for mediawiki-bugzilla to indicate how an...
brandonsavage authored
191 $wgBugzillaChartStorage = realpath($cwd . '/charts'); // Location to store generated bug charts
192 $wgBugzillaFontStorage = $cwd . '/pchart/fonts'; // Path to font directory for font data
193 $wgBugzillaChartUrl = $wgScriptPath . '/extensions/Bugzilla/charts'; // The URL to use to display charts
194
195 // The default fields to display
5a4db4a @LegNeato Fix support for jquery tables, add the ability to specify fields,
LegNeato authored
196 $wgBugzillaDefaultFields = array(
197 'id',
198 'summary',
199 'priority',
200 'status',
201 );
ceb37ed @cargan added posibility to configure outpu table pagination
cargan authored
202
203 $wgBugzillaTable = array(
204 'pageSize' => 10, //default pagination count
4f77040 @edmorley Bug 1117090 / issue #65 - Add "All" as a pagination option
edmorley authored
205 'lengthMenu' => '[[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]]', //default length set
ceb37ed @cargan added posibility to configure outpu table pagination
cargan authored
206 );
Something went wrong with that request. Please try again.