r40019 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40018‎ | r40019 | r40020 >
Date:14:27, 26 August 2008
Author:dantman
Status:old
Tags:
Comment:
Commit a little bit of code for using a subclass of EditPage.
This is disabled by default, and largely does nothing. A little bit of work has gone into it, but the EditPage class needs some more refactoring work, and we may need to rewrite part of the form printer to get this to work right.
((Also, use setRobotPolicy rather than addMeta))
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_GlobalFunctions.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_Settings.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_EditData.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/specials/SF_EditData.php
@@ -139,6 +139,6 @@
140140 $wgOut->addScript('<script type="text/javascript" src="' . $sfgScriptPath . '/libs/SF_yui_autocompletion.js"></script>' . "\n");
141141 $wgOut->addScript('<script type="text/javascript" src="' . $sfgScriptPath . '/libs/floatbox.js"></script>' . "\n");
142142 $wgOut->addScript(' <script type="text/javascript">' . "\n" . $javascript_text . '</script>' . "\n");
143 - $wgOut->addMeta('robots','noindex,nofollow');
 143+ $wgOut->setRobotPolicy( 'noindex,nofollow' );
144144 $wgOut->addHTML($text);
145145 }
Index: trunk/extensions/SemanticForms/includes/SF_GlobalFunctions.php
@@ -63,6 +63,7 @@
6464 $wgSpecialPages['UploadWindow'] = 'SFUploadWindow';
6565 $wgAutoloadClasses['SFUploadWindow'] = $sfgIP . '/specials/SF_UploadWindow.php';
6666
 67+$wgAutoloadClasses['FormEditPage'] = $sfgIP . '/includes/SF_FormEditPage.php';
6768 $wgAutoloadClasses['SFTemplateField'] = $sfgIP . '/includes/SF_TemplateField.inc';
6869 $wgAutoloadClasses['SFForm'] = $sfgIP . '/includes/SF_FormClasses.inc';
6970 $wgAutoloadClasses['SFTemplateInForm'] = $sfgIP . '/includes/SF_FormClasses.inc';
@@ -418,7 +419,7 @@
419420 * pages)
420421 */
421422 function sffEmbeddedEditForm($action, $article) {
422 - global $sfgIP;
 423+ global $sfgIP, $sfgUseFormEditPage;
423424
424425 // return "true" if the call failed (meaning, pass on handling of
425426 // the hook to others), and "false" otherwise
@@ -426,11 +427,21 @@
427428 return true;
428429 }
429430
 431+ // @todo: This looks like bad code. If we can't find a form, we should be
 432+ // showing an informative error page rather than making it look like an
 433+ // edit form page does not exist.
430434 $form_name = sffGetFormForArticle($article);
431435 if ($form_name == '') {
432436 return true;
433437 }
434438
 439+ if( $sfgUseFormEditPage ) {
 440+ # Experimental new feature extending from the internal EditPage class
 441+ $editor = new FormEditPage( $article, $form_name );
 442+ $editor->submit();
 443+ return false;
 444+ }
 445+
435446 $target_title = $article->getTitle();
436447 $target_name = sffTitleString($target_title);
437448 if ($target_title->exists()) {
Index: trunk/extensions/SemanticForms/includes/SF_Settings.php
@@ -74,3 +74,13 @@
7575 ###
7676 $sfgYUIBase = "http://yui.yahooapis.com/2.5.1/build/";
7777
 78+###
 79+# Extend the edit form from the internal EditPage class rather than using a
 80+# special page and hacking things up.
 81+#
 82+# @note This is experimental and requires updates to EditPage which I have only
 83+# added into MediaWiki 1.14a
 84+###
 85+$sfgUseFormEditPage = false;//version_compare( $wgVersion, '1.14alpha', '>=' );
 86+
 87+

Status & tagging log