Update formatting
[lhc/web/wiklou.git] / includes / actions / EditAction.php
index 3771586..72210a9 100644 (file)
  * @author Timo Tijhof
  */
 
+/**
+ * Page edition handler
+ *
+ * This is a wrapper that will call the EditPage class, or ExternalEdit
+ * if $wgUseExternalEditor is set to true and requested by the user.
+ *
+ * @ingroup Actions
+ */
 class EditAction extends FormlessAction {
 
        public function getName() {
                return 'edit';
        }
 
-       public function onView(){
+       public function onView() {
                return null;
        }
 
-       public function show(){
+       public function show() {
                $page = $this->page;
-               $request = $this->getRequest();
                $user = $this->getUser();
-               $context = $this->getContext();
 
                if ( wfRunHooks( 'CustomEditor', array( $page, $user ) ) ) {
-                       if ( ( $page->getContent() instanceof TextContentHandler ) ) {
-                               $modelName = ContentHandler::getContentModelName( $page->getContentModel() );
-                               throw new MWException( "Can't use default editor for non-text content. ContentHandler for $modelName apparently does not provide an action handler for the edit action." );
-                       }
-
-                       if ( ExternalEdit::useExternalEngine( $context, 'edit' )
-                               && $this->getName() == 'edit' && !$request->getVal( 'section' )
-                               && !$request->getVal( 'oldid' ) )
-                       {
-                               $extedit = $handler->createExternalEdit( $context );
-                               $extedit->execute();
-                       } else {
-                               $editor = $handler->createEditPage( $page );
-                               $editor->edit();
-                       }
+                       $editor = new EditPage( $page );
+                       $editor->edit();
                }
-
        }
-
 }
 
+/**
+ * Edit submission handler
+ *
+ * This is the same as EditAction; except that it sets the session cookie.
+ *
+ * @ingroup Actions
+ */
 class SubmitAction extends EditAction {
 
        public function getName() {
                return 'submit';
        }
 
-       public function show(){
+       public function show() {
                if ( session_id() == '' ) {
                        // Send a cookie so anons get talk message notifications
                        wfSetupSession();
@@ -75,5 +73,4 @@ class SubmitAction extends EditAction {
 
                parent::show();
        }
-
 }