r63850 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63849‎ | r63850 | r63851 >
Date:00:25, 17 March 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
* Added regular story view and put existing data into the edit form of Special:Story
* Added forgotten db field
Modified paths:
  • /trunk/extensions/Storyboard/specials/Story/Story_body.php (modified) (history)
  • /trunk/extensions/Storyboard/storyboard.sql (modified) (history)
  • /trunk/extensions/Storyboard/tags/Storysubmission/Storysubmission_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Storyboard/storyboard.sql
@@ -7,6 +7,7 @@
88 story_author_location VARCHAR(255) NOT NULL,
99 story_author_occupation VARCHAR(255) NOT NULL,
1010 story_author_image VARCHAR(255) NULL, -- TODO: find out if this is an acceptible way to refer to an image
 11+ story_author_contact VARCHAR(255) NOT NULL -- TODO: confirm with erik this is a mandatory field
1112 story_hit_count INT(8) unsigned NOT NULL default '0',
1213 story_title VARCHAR(255) NOT NULL,
1314 story_text MEDIUMBLOB NOT NULL,
Index: trunk/extensions/Storyboard/tags/Storysubmission/Storysubmission_body.php
@@ -160,6 +160,7 @@
161161 'story_author_name' => $wgRequest->getText( 'name' ),
162162 'story_author_location' => $wgRequest->getText( 'location' ),
163163 'story_author_occupation' => $wgRequest->getText( 'occupation' ),
 164+ 'story_author_contact' => $wgRequest->getText( 'storyboard-contact' ),
164165 'story_title' => $wgRequest->getText( 'storytitle' ),
165166 'story_text' => $wgRequest->getText( 'storytext' ),
166167 'story_created' => $dbw->timestamp( time() ),
Index: trunk/extensions/Storyboard/specials/Story/Story_body.php
@@ -60,7 +60,12 @@
6161 'storyboard',
6262 array(
6363 'story_id',
 64+ 'story_author_id',
6465 'story_author_name',
 66+ 'story_author_location',
 67+ 'story_author_occupation',
 68+ 'story_author_contact',
 69+ 'story_author_image',
6570 'story_title',
6671 'story_text',
6772 'story_created',
@@ -90,13 +95,27 @@
9196 * Ouputs the story in regular display mode.
9297 *
9398 * @param $story
 99+ *
 100+ * TODO: Improve layout, add social sharing stuff, add story meta data and show edit stuff for people with stroyreview permission.
94101 */
95102 private function showStory( $story ) {
96 - global $wgOut;
 103+ global $wgOut, $egStoryboardScriptPath;
97104
 105+ $wgOut->addStyle( $egStoryboardScriptPath . '/storyboard.css' );
98106
 107+ $imageSrc = 'http://upload.wikimedia.org/wikipedia/mediawiki/9/99/SemanticMaps.png'; // TODO: get cropped image here
99108
100 - $wgOut->addHTML( '' ); // TODO: add output
 109+ $title = htmlspecialchars( $story->story_title );
 110+ $text = htmlspecialchars( $story->story_text );
 111+
 112+ $wgOut->addHTML( <<<EOT
 113+ <div class="story">
 114+ <img src="$imageSrc" class="story-image">
 115+ <div class="story-title">$title</div><br />
 116+ $text
 117+ </div>
 118+EOT
 119+ );
101120 }
102121
103122 /**
@@ -126,33 +145,31 @@
127146 $formBody = "<table width='$width'>";
128147
129148 $defaultName = '';
130 - if ( $wgUser->isLoggedIn() ) {
131 - $defaultName = $wgUser->getRealName() !== '' ? $wgUser->getRealName() : $wgUser->getName();
132 - }
 149+
133150 $formBody .= '<tr>' .
134151 Html::element( 'td', array( 'width' => '100%' ), wfMsg( 'storyboard-yourname' ) ) .
135152 '<td>' .
136 - Html::input( 'name', $defaultName, 'text', array( 'size' => $fieldSize )
 153+ Html::input( 'name', $story->story_author_name, 'text', array( 'size' => $fieldSize )
137154 ) . '</td></tr>';
138155
139156 $formBody .= '<tr>' .
140157 Html::element( 'td', array( 'width' => '100%' ), wfMsg( 'storyboard-location' ) ) .
141 - '<td>' . Html::input( 'location', '', 'text', array( 'size' => $fieldSize )
 158+ '<td>' . Html::input( 'location', $story->story_author_location, 'text', array( 'size' => $fieldSize )
142159 ) . '</td></tr>';
143160
144161 $formBody .= '<tr>' .
145162 Html::element( 'td', array( 'width' => '100%' ), wfMsg( 'storyboard-occupation' ) ) .
146 - '<td>' . Html::input( 'occupation', '', 'text', array( 'size' => $fieldSize )
 163+ '<td>' . Html::input( 'occupation', $story->story_author_occupation, 'text', array( 'size' => $fieldSize )
147164 ) . '</td></tr>';
148165
149166 $formBody .= '<tr>' .
150167 Html::element( 'td', array( 'width' => '100%' ), wfMsg( 'storyboard-contact' ) ) .
151 - '<td>' . Html::input( 'contact', '', 'text', array( 'size' => $fieldSize )
 168+ '<td>' . Html::input( 'contact', $story->story_author_contact, 'text', array( 'size' => $fieldSize )
152169 ) . '</td></tr>';
153170
154171 $formBody .= '<tr>' .
155172 Html::element( 'td', array( 'width' => '100%' ), wfMsg( 'storyboard-storytitle' ) ) .
156 - '<td>' . Html::input( 'storytitle', '', 'text', array( 'size' => $fieldSize )
 173+ '<td>' . Html::input( 'storytitle', $story->story_title, 'text', array( 'size' => $fieldSize )
157174 ) . '</td></tr>';
158175
159176 $formBody .= '<tr><td colspan="2">' .
@@ -171,13 +188,9 @@
172189 'rows' => 7,
173190 'onkeyup' => "stbValidateStory( this, $minLen, $maxLen, 'storysubmission-charlimitinfo', 'storysubmission-button' )",
174191 ),
175 - null
 192+ $story->story_text
176193 ) .
177194 '</td></tr>';
178 -
179 - $formBody .= '<tr><td colspan="2"><input type="checkbox" id="storyboard-agreement" />&nbsp;' .
180 - htmlspecialchars( wfMsg( 'storyboard-agreement' ) ) .
181 - '</td></tr>';
182195
183196 $formBody .= '<tr><td colspan="2">' .
184197 Html::input( '', wfMsg( 'htmlform-submit' ), 'submit', array( 'id' => 'storysubmission-button' ) ) .
@@ -194,7 +207,6 @@
195208 'name' => 'storyform',
196209 'method' => 'post',
197210 'action' => $submissionUrl,
198 - 'onsubmit' => 'return stbValidateSubmission( "storyboard-agreement" );'
199211 ),
200212 $formBody
201213 );

Follow-up revisions

RevisionCommit summaryAuthorDate
r63851Follow up to r63850...jeroendedauw00:52, 17 March 2010

Status & tagging log