Index: trunk/extensions/PageSchemas/PageSchemas.classes.php |
— | — | @@ -19,41 +19,10 @@ |
20 | 20 | global $wgOut; |
21 | 21 | $output = $wgOut; |
22 | 22 | } |
23 | | - $output->addModules( 'ext.semanticforms.main' ); |
24 | | - $output->addModules( 'ext.semanticforms.fancybox' ); |
25 | | - $output->addModules( 'ext.semanticforms.autogrow' ); |
26 | | - $output->addModules( 'ext.semanticforms.submit' ); |
27 | | - $output->addModules( 'ext.smw.tooltips' ); |
28 | | - $output->addModules( 'ext.smw.sorttable' ); |
| 23 | + $output->addModules( 'jquery' ); |
29 | 24 | } |
30 | | - /** |
31 | | - * Javascript files to be added regardless of the MediaWiki version |
32 | | - * (i.e., even if the ResourceLoader exists). |
33 | | - */ |
34 | | - public static function addJavascriptFiles( $parser ) { |
35 | | - global $wgOut, $wgFCKEditorDir, $wgScriptPath, $wgJsMimeType; |
| 25 | + |
36 | 26 | |
37 | | - $scripts = array(); |
38 | | - |
39 | | - wfRunHooks( 'sfAddJavascriptFiles', array( &$scripts ) ); |
40 | | - |
41 | | - // The FCKeditor extension has no defined ResourceLoader |
42 | | - // modules yet, so we have to call the scripts directly. |
43 | | - // @TODO Move this code into the FCKeditor extension. |
44 | | - if ( $wgFCKEditorDir && class_exists( 'FCKEditor' ) ) { |
45 | | - $scripts[] = "$wgScriptPath/$wgFCKEditorDir/fckeditor.js"; |
46 | | - } |
47 | | - |
48 | | - foreach ( $scripts as $js ) { |
49 | | - if ( $parser ) { |
50 | | - $script = "<script type=\"$wgJsMimeType\" src=\"$js\"></script>\n"; |
51 | | - $parser->getOutput()->addHeadItem( $script ); |
52 | | - } else { |
53 | | - $wgOut->addScriptFile( $js ); |
54 | | - } |
55 | | - } |
56 | | - } |
57 | | - |
58 | 27 | /** |
59 | 28 | * Includes the necessary Javascript and CSS files for the form |
60 | 29 | * to display and work correctly. |
— | — | @@ -65,85 +34,13 @@ |
66 | 35 | |
67 | 36 | if ( !$parser ) { |
68 | 37 | $wgOut->addMeta( 'robots', 'noindex,nofollow' ); |
69 | | - } |
| 38 | + } |
70 | 39 | |
71 | | - self::addJavascriptFiles( $parser ); |
72 | | - |
73 | 40 | // MW 1.17 + |
74 | 41 | if ( class_exists( 'ResourceLoader' ) ) { |
75 | 42 | self::loadJavascriptAndCSS( $parser ); |
76 | 43 | return; |
77 | | - } |
78 | | - global $sfgScriptPath, $smwgScriptPath, $wgScriptPath, $wgJsMimeType, $sfgUseFormEditPage; |
79 | | - global $smwgJQueryIncluded, $smwgJQUIAutoIncluded; |
80 | | - // jQuery and jQuery UI are used so often in forms, we might as |
81 | | - // well assume they'll always be used, and include them in |
82 | | - // every form |
83 | | - $smwgJQueryIncluded = true; |
84 | | - $smwgJQUIAutoIncluded = true; |
85 | | - |
86 | | - $css_files = array( |
87 | | - "$smwgScriptPath/skins/SMW_custom.css", |
88 | | - "$sfgScriptPath/skins/jquery-ui/base/jquery.ui.all.css", |
89 | | - "$sfgScriptPath/skins/SemanticForms.css", |
90 | | - "$sfgScriptPath/skins/SF_submit.css", |
91 | | - "$sfgScriptPath/skins/jquery.fancybox.css" |
92 | | - ); |
93 | | - foreach ( $css_files as $css_file ) { |
94 | | - $link = array( |
95 | | - 'rel' => 'stylesheet', |
96 | | - 'type' => 'text/css', |
97 | | - 'media' => "screen", |
98 | | - 'href' => $css_file |
99 | | - ); |
100 | | - if ( !is_null( $parser ) ) { |
101 | | - $parser->getOutput()->addHeadItem( Xml::element( 'link', $link ) ); |
102 | | - } else { |
103 | | - $wgOut->addLink( $link ); |
104 | | - } |
105 | | - } |
106 | | - |
107 | | - $scripts = array(); |
108 | | - if ( !$sfgUseFormEditPage ) |
109 | | - $scripts[] = "$sfgScriptPath/libs/SF_ajax_form_preview.js"; |
110 | | - $realFunction = array( 'SMWOutputs', 'requireHeadItem' ); |
111 | | - if ( is_callable( $realFunction ) ) { |
112 | | - SMWOutputs::requireHeadItem( SMW_HEADER_TOOLTIP ); |
113 | | - SMWOutputs::requireHeadItem( SMW_HEADER_SORTTABLE ); |
114 | | - // TODO - should this be called directly here, or is |
115 | | - // there a "smarter" (in some way) place to put it? |
116 | | - SMWOutputs::commitToOutputPage( $wgOut ); |
117 | | - } else { |
118 | | - $scripts[] = "$smwgScriptPath/skins/SMW_tooltip.js"; |
119 | | - $scripts[] = "$smwgScriptPath/skins/SMW_sorttable.js"; |
120 | | - } |
121 | | - $realFunction = array( 'OutputPage', 'includeJQuery' ); |
122 | | - if ( is_callable( $realFunction ) ) { |
123 | | - $wgOut->includeJQuery(); |
124 | | - } else { |
125 | | - $scripts[] = "$sfgScriptPath/libs/jquery-1.4.2.min.js"; |
126 | | - } |
127 | | - $scripts[] = "$sfgScriptPath/libs/jquery-ui/jquery.ui.core.min.js"; |
128 | | - $scripts[] = "$sfgScriptPath/libs/jquery-ui/jquery.ui.widget.min.js"; |
129 | | - $scripts[] = "$sfgScriptPath/libs/jquery-ui/jquery.ui.button.min.js"; |
130 | | - $scripts[] = "$sfgScriptPath/libs/jquery-ui/jquery.ui.position.min.js"; |
131 | | - $scripts[] = "$sfgScriptPath/libs/jquery-ui/jquery.ui.autocomplete.min.js"; |
132 | | - $scripts[] = "$sfgScriptPath/libs/jquery-ui/jquery.ui.mouse.min.js"; |
133 | | - $scripts[] = "$sfgScriptPath/libs/jquery-ui/jquery.ui.sortable.min.js"; |
134 | | - $scripts[] = "$sfgScriptPath/libs/jquery.fancybox.js"; |
135 | | - $scripts[] = "$sfgScriptPath/libs/SF_autogrow.js"; |
136 | | - $scripts[] = "$sfgScriptPath/libs/SF_submit.js"; |
137 | | - $scripts[] = "$sfgScriptPath/libs/SemanticForms.js"; |
138 | | - |
139 | | - global $wgOut; |
140 | | - foreach ( $scripts as $js ) { |
141 | | - if ( $parser ) { |
142 | | - $script = "<script type=\"$wgJsMimeType\" src=\"$js\"></script>\n"; |
143 | | - $parser->getOutput()->addHeadItem( $script ); |
144 | | - } else { |
145 | | - $wgOut->addScriptFile( $js ); |
146 | | - } |
147 | | - } |
| 44 | + } |
148 | 45 | } |
149 | 46 | |
150 | 47 | public static function titleString( $title ) { |
— | — | @@ -439,19 +336,26 @@ |
440 | 337 | public $fieldName =""; |
441 | 338 | public $fieldXml= null; |
442 | 339 | public $fieldLabel = ""; |
443 | | - private $list_values = false; |
| 340 | + private $list_values = false; |
| 341 | + private $delimiter=null; |
444 | 342 | function __construct( $field_xml ) { |
445 | 343 | $this->fieldXml = $field_xml; |
446 | 344 | $this->fieldName = (string)$this->fieldXml->attributes()->name; |
447 | 345 | if( ((string)$this->fieldXml->attributes()->list) == "list") { |
448 | 346 | $this->list_values = true; |
449 | 347 | } |
| 348 | + if( ((string)$this->fieldXml->attributes()->delimiter) != null || ((string)$this->fieldXml->attributes()->delimiter) != '' ){ |
| 349 | + $this->delimiter = (string)$this->fieldXml->attributes()->delimiter; |
| 350 | + } |
450 | 351 | foreach ($this->fieldXml->children() as $tag => $child ) { |
451 | 352 | if ( $tag == 'Label' ) { |
452 | 353 | $this->fieldLabel = (string)$child; |
453 | 354 | } |
454 | 355 | } |
455 | 356 | } |
| 357 | + public function getDelimiter(){ |
| 358 | + return $this->delimiter; |
| 359 | + } |
456 | 360 | function getName(){ |
457 | 361 | return $this->fieldName; |
458 | 362 | } |