r59670 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59669‎ | r59670 | r59671 >
Date:18:30, 2 December 2009
Author:dantman
Status:deferred
Tags:
Comment:
Updates to FormEditPage
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormEditPage.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_FormEditTab.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_FormUtils.inc (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_GlobalFunctions.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_Utils.inc (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_Utils.inc
@@ -107,7 +107,7 @@
108108 * Accepts an optional Parser instance, or uses $wgOut if omitted.
109109 */
110110 static function addJavascriptAndCSS($parser = NULL) {
111 - global $wgOut, $sfgScriptPath, $sfgYUIBase, $smwgScriptPath, $wgScriptPath, $wgFCKEditorDir, $wgJsMimeType;
 111+ global $wgOut, $sfgScriptPath, $sfgYUIBase, $smwgScriptPath, $wgScriptPath, $wgFCKEditorDir, $wgJsMimeType, $sfgUseFormEditPage;
112112
113113 $links = array(
114114 array(
@@ -149,21 +149,21 @@
150150 }
151151
152152
153 - $scripts = array(
154 - "{$sfgYUIBase}yahoo/yahoo-min.js",
155 - "{$sfgYUIBase}dom/dom-min.js",
156 - "{$sfgYUIBase}event/event-min.js",
157 - "{$sfgYUIBase}get/get-min.js",
158 - "{$sfgYUIBase}connection/connection-min.js",
159 - "{$sfgYUIBase}json/json-min.js",
160 - "{$sfgYUIBase}datasource/datasource-min.js",
161 - "{$sfgYUIBase}autocomplete/autocomplete-min.js",
162 - "$sfgScriptPath/libs/SF_yui_autocompletion.js",
163 - "$sfgScriptPath/libs/SF_ajax_form_preview.js",
164 - "$sfgScriptPath/libs/floatbox.js",
165 - "$smwgScriptPath/skins/SMW_tooltip.js",
166 - "$smwgScriptPath/skins/SMW_sorttable.js",
167 - );
 153+ $scripts = array();
 154+ $scripts[] = "{$sfgYUIBase}yahoo/yahoo-min.js";
 155+ $scripts[] = "{$sfgYUIBase}dom/dom-min.js";
 156+ $scripts[] = "{$sfgYUIBase}event/event-min.js";
 157+ $scripts[] = "{$sfgYUIBase}get/get-min.js";
 158+ $scripts[] = "{$sfgYUIBase}connection/connection-min.js";
 159+ $scripts[] = "{$sfgYUIBase}json/json-min.js";
 160+ $scripts[] = "{$sfgYUIBase}datasource/datasource-min.js";
 161+ $scripts[] = "{$sfgYUIBase}autocomplete/autocomplete-min.js";
 162+ $scripts[] = "$sfgScriptPath/libs/SF_yui_autocompletion.js";
 163+ if ( !$sfgUseFormEditPage )
 164+ $scripts[] = "$sfgScriptPath/libs/SF_ajax_form_preview.js";
 165+ $scripts[] = "$sfgScriptPath/libs/floatbox.js";
 166+ $scripts[] = "$smwgScriptPath/skins/SMW_tooltip.js";
 167+ $scripts[] = "$smwgScriptPath/skins/SMW_sorttable.js";
168168 if ($wgFCKEditorDir)
169169 $scripts[] = "$wgScriptPath/$wgFCKEditorDir/fckeditor.js";
170170 foreach( $scripts as $js ) {
Index: trunk/extensions/SemanticForms/includes/SF_FormEditPage.php
@@ -6,7 +6,7 @@
77 * @author Yaron Koren
88 */
99
10 -class FormEditPage extends EditPage {
 10+class SFFormEditPage extends EditPage {
1111
1212 protected $form, $form_name;
1313
@@ -19,6 +19,10 @@
2020 $this->form = Title::makeTitleSafe(SF_NS_FORM, $form_name);
2121 $this->form_name = $form_name;
2222 }
 23+
 24+ protected function isSectionEditSupported() {
 25+ return false; // sections and forms don't mix
 26+ }
2327
2428 function setHeaders() {
2529 parent::setHeaders();
@@ -33,13 +37,12 @@
3438 if ($this->textbox1 != null)
3539 parent::displayPreviewArea($previewOutput);
3640 }
37 -
38 - protected function showTextbox1( $classes ) {
39 - if( $this->isConflict ) {
40 - // Fallback to normal mode when showing an editconflict
41 - parent::showTextbox1();
42 - return;
43 - }
 41+
 42+ protected function importContentFormData( &$request ) {
 43+ // @todo This is where $request to save&preview page text should go
 44+ }
 45+
 46+ protected function showContentForm() {
4447 global $sfgIP;
4548 $target_title = $this->mArticle->getTitle();
4649 $target_name = SFLinkUtils::titleString($target_title);
@@ -48,7 +51,7 @@
4952 } else {
5053 SFAddData::printAddForm($this->form_name, $target_name, array(), $this->textbox1);
5154 }
52 -
 55+ // @todo This needs a proper form builder
5356 }
5457
5558 function showFooter() {
Index: trunk/extensions/SemanticForms/includes/SF_FormUtils.inc
@@ -529,7 +529,7 @@
530530 $disabled_text = ($is_disabled) ? "disabled" : "";
531531 if ($label == null)
532532 $label = wfMsg('savearticle');
533 - $temp = array(
 533+ $temp = $attr + array(
534534 'id' => 'wpSave',
535535 'name' => 'wpSave',
536536 'type' => 'submit',
@@ -538,7 +538,7 @@
539539 'accesskey' => wfMsg('accesskey-save'),
540540 'title' => wfMsg('tooltip-save'),
541541 $disabled_text => '',
542 - ) + $attr;
 542+ );
543543 return self::buttonHTML($temp);
544544 }
545545
@@ -549,7 +549,7 @@
550550 $disabled_text = ($is_disabled) ? "disabled" : "";
551551 if ($label == null)
552552 $label = wfMsg('showpreview');
553 - $temp = array(
 553+ $temp = $attr + array(
554554 'id' => 'wpPreview',
555555 'name' => 'wpPreview',
556556 'type' => 'submit',
@@ -558,7 +558,7 @@
559559 'accesskey' => wfMsg('accesskey-preview'),
560560 'title' => wfMsg('tooltip-preview'),
561561 $disabled_text => '',
562 - ) + $attr;
 562+ );
563563 return self::buttonHTML($temp);
564564 }
565565
@@ -569,7 +569,7 @@
570570 $disabled_text = ($is_disabled) ? "disabled" : "";
571571 if ($label == null)
572572 $label = wfMsg('showdiff');
573 - $temp = array(
 573+ $temp = $attr + array(
574574 'id' => 'wpDiff',
575575 'name' => 'wpDiff',
576576 'type' => 'submit',
@@ -578,7 +578,7 @@
579579 'accesskey' => wfMsg('accesskey-diff'),
580580 'title' => wfMsg('tooltip-diff'),
581581 $disabled_text => '',
582 - ) + $attr;
 582+ );
583583 return self::buttonHTML($temp);
584584 }
585585
@@ -616,14 +616,14 @@
617617 $disabled_text = ($is_disabled) ? "disabled" : "";
618618 if ($label == null)
619619 $label = wfMsg('runquery');
620 - return self::buttonHTML(array(
 620+ return self::buttonHTML($attr + array(
621621 'id' => 'wpRunQuery',
622622 'name' => 'wpRunQuery',
623623 'type' => 'submit',
624624 'tabindex' => $sfgTabIndex,
625625 'value' => $label,
626626 'title' => $label,
627 - ) + $attr);
 627+ ));
628628 }
629629
630630 // Much of this function is based on MediaWiki's EditPage::showEditForm()
Index: trunk/extensions/SemanticForms/includes/SF_GlobalFunctions.php
@@ -88,6 +88,7 @@
8989 $wgAutoloadClasses['SFFormInputs'] = $sfgIP . '/includes/SF_FormInputs.inc';
9090 $wgAutoloadClasses['SFFormUtils'] = $sfgIP . '/includes/SF_FormUtils.inc';
9191 $wgAutoloadClasses['SFFormEditTab'] = $sfgIP . '/includes/SF_FormEditTab.php';
 92+$wgAutoloadClasses['SFFormEditPage'] = $sfgIP . '/includes/SF_FormEditPage.php';
9293 $wgAutoloadClasses['SFUtils'] = $sfgIP . '/includes/SF_Utils.inc';
9394 $wgAutoloadClasses['SFLinkUtils'] = $sfgIP . '/includes/SF_LinkUtils.inc';
9495 $wgAutoloadClasses['SFParserFunctions'] = $sfgIP . '/includes/SF_ParserFunctions.php';
Index: trunk/extensions/SemanticForms/includes/SF_FormEditTab.php
@@ -142,7 +142,7 @@
143143 if( $sfgUseFormEditPage ) {
144144 # Experimental new feature extending from the internal
145145 # EditPage class
146 - $editor = new FormEditPage( $article, $form_name );
 146+ $editor = new SFFormEditPage( $article, $form_name );
147147 $editor->submit();
148148 return false;
149149 }

Status & tagging log