https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112551
Revision: 112551
Author: jeroendedauw
Date: 2012-02-28 00:34:42 +0000 (Tue, 28 Feb 2012)
Log Message:
-----------
fix fatal and do not show summary field when creating new course or org
Modified Paths:
--------------
trunk/extensions/EducationProgram/actions/EPDeleteAction.php
trunk/extensions/EducationProgram/actions/EPEditAction.php
trunk/extensions/EducationProgram/includes/EPFailForm.php
trunk/extensions/EducationProgram/includes/EPLogFormatter.php
Modified: trunk/extensions/EducationProgram/actions/EPDeleteAction.php
===================================================================
--- trunk/extensions/EducationProgram/actions/EPDeleteAction.php
2012-02-28 00:26:16 UTC (rev 112550)
+++ trunk/extensions/EducationProgram/actions/EPDeleteAction.php
2012-02-28 00:34:42 UTC (rev 112551)
@@ -58,7 +58,7 @@
$success = $this->doDelete( $object );
if ( $success ) {
- $title = SpecialPage::getTitleFor(
$this->table->getListPage() );
+ $title = SpecialPage::getTitleFor(
$this->page->getListPage() );
$query = array( 'deleted' =>
$this->getTitle()->getText() ); // TODO: handle
}
else {
Modified: trunk/extensions/EducationProgram/actions/EPEditAction.php
===================================================================
--- trunk/extensions/EducationProgram/actions/EPEditAction.php 2012-02-28
00:26:16 UTC (rev 112550)
+++ trunk/extensions/EducationProgram/actions/EPEditAction.php 2012-02-28
00:34:42 UTC (rev 112551)
@@ -237,7 +237,8 @@
$form->setSubmitCallback( array( $this, 'handleSubmission' ) );
$form->setSubmitText( wfMsg( 'educationprogram-org-submit' ) );
$form->setSubmitTooltip( 'ep-form-save' );
-
+ $form->setShowSummary( !$this->isNew() );
+
$action = $this->isNew() ? 'add' : 'edit';
$form->setWrapperLegend( $this->msg( strtolower(
$this->getName() ) . '-' . $action . '-legend' ) );
@@ -355,7 +356,7 @@
return Title::newFromText(
$this->getRequest()->getText( 'wpreturnto' ) );
}
elseif ( !$addedItem && $this->isNew() ) {
- return SpecialPage::getTitleFor(
$this->table->getListPage() );
+ return SpecialPage::getTitleFor(
$this->page->getListPage() );
}
elseif ( $this->item !== false ) {
return $this->item->getTitle();
Modified: trunk/extensions/EducationProgram/includes/EPFailForm.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPFailForm.php 2012-02-28
00:26:16 UTC (rev 112550)
+++ trunk/extensions/EducationProgram/includes/EPFailForm.php 2012-02-28
00:34:42 UTC (rev 112551)
@@ -14,6 +14,20 @@
class EPFailForm extends HTMLForm {
/**
+ * The query for the action URL.
+ * @since 0.1
+ * @var array
+ */
+ protected $query = array();
+
+ /**
+ * Should the summary field be shown or not?
+ * @since 0.1
+ * @var boolean
+ */
+ protected $showSummary = true;
+
+ /**
* Wrap the form innards in an actual <form> element
* @param $html String HTML contents to wrap.
* @return String wrapped HTML.
@@ -42,38 +56,61 @@
return Html::rawElement( 'form', $attribs, $html );
}
- protected $query = array();
+ /**
+ * Sets the query for the action URL.
+ *
+ * @since 0.1
+ *
+ * @param array $query
+ */
public function setQuery( array $query ) {
$this->query = $query;
}
+
+ /**
+ * Sets if the summary field be shown or not.
+ *
+ * @since 0.1
+ *
+ * @param boolean $showSummary
+ */
+ public function setShowSummary( $showSummary ) {
+ $this->showSummary = $showSummary;
+ }
+ /**
+ * (non-PHPdoc)
+ * @see HTMLForm::getBody()
+ */
function getBody() {
$html = $this->displaySection( $this->mFieldTree );
$html .= '<br />';
- $html .= Html::element(
- 'label',
- array( 'for' => 'wpSummary' ),
- wfMsg( 'ep-form-summary' )
- ) . ' ';
+ if ( $this->showSummary ) {
+ $html .= Html::element(
+ 'label',
+ array( 'for' => 'wpSummary' ),
+ wfMsg( 'ep-form-summary' )
+ ) . ' ';
+
+ $attrs = array(
+ 'id' => 'wpSummary',
+ 'name' => 'wpSummary',
+ 'size' => 60,
+ 'maxlength' => 250,
+ 'spellcheck' => true
+ );
+
+ $attrs = array_merge( $attrs,
Linker::tooltipAndAccesskeyAttribs( 'ep-summary' ) );
- $attrs = array(
- 'id' => 'wpSummary',
- 'name' => 'wpSummary',
- 'size' => 60,
- 'maxlength' => 250,
- 'spellcheck' => true
- );
+ $html .= Html::element(
+ 'input',
+ $attrs
+ ) . '<br />';
+ }
- $attrs = array_merge( $attrs,
Linker::tooltipAndAccesskeyAttribs( 'ep-summary' ) );
-
- $html .= Html::element(
- 'input',
- $attrs
- ) . '<br />';
-
$attrs = Linker::tooltipAndAccesskeyAttribs( 'ep-minor' );
$html .= Xml::checkLabel(
Modified: trunk/extensions/EducationProgram/includes/EPLogFormatter.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPLogFormatter.php
2012-02-28 00:26:16 UTC (rev 112550)
+++ trunk/extensions/EducationProgram/includes/EPLogFormatter.php
2012-02-28 00:34:42 UTC (rev 112551)
@@ -24,7 +24,7 @@
*/
protected function makePageLink( Title $title = null, $parameters =
array() ) {
if ( !$title instanceof Title ) {
- throw new MWException( "Expected title, got null" );
+ throw new MWException( 'Expected title, got null' );
}
$text = explode( '/', $title->getText(), 2 );
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs