function execute() { global $wgRequest, $wgOut, $wgUser, $mvSitting_name, $mvgIP; #init html output var: $html = ''; # Get request data from, e.g. $title_str = $wgRequest->getVal('title'); //get Mv_Title to normalize the sitting name: $this->sitting_name = $wgRequest->getVal('sitting_name') == '' ? '' : MV_Title::normalizeTitle($wgRequest->getVal('sitting_name')); // data about the sitting $this->sitting_start_time = $wgRequest->getVal('sitting_start_time'); $this->sitting_end_time = $wgRequest->getVal('sitting_end_time'); $this->sitting_session_number = $wgRequest->getVal('sitting_session_number'); $this->wpEditToken = $wgRequest->getVal('wpEditToken'); $this->sitting_desc = $wgRequest->getVal('sitting_desc'); //grab the desc from the wiki page if not in the POST req if ($this->sitting_desc == '') { $desTitle = Title::makeTitle(MV_NS_SITTING, $this->sitting_name); //grab the article text: $curRevision = Revision::newFromTitle($desTitle); if ($curRevision) { $this->stream_desc = $curRevision->getText(); } } if ($this->sitting_name == '') { //default page request $parts = split('/', $title_str); if (count($parts) >= 2) { //means we can use part 1 as a sitting name: $this->sitting_name = $parts[1]; } } else { if ($this->mode == 'add') { //output add_ status to html $html .= $this->add_sitting(); } else { //possible edit } } //if edit check for sitting name: if ($this->mode == 'edit' && $this->sitting_name == '') { $html .= wfMsg('edit_sitting_missing'); $wgOut->addHTML($html); return; } $this->check_permissions(); if (count($this->_allowedSittingTypeArray) == 0) { //break out user lacks permissions to add anything $html .= wfMsg('add_sitting_permission'); $wgOut->addHTML($html); return; } //output the add sitting form $spectitle = Title::makeTitle(NS_SPECIAL, 'Mv_Add_sitting'); $docutitle = Title::newFromText(wfMsg('mv_add_sitting'), NS_HELP); if ($this->mode == 'edit') { $mvSittingTitle = Title::makeTitle(MV_NS_SITTING, $this->sitting_name); if ($mvSittingTitle->exists()) { $sk = $wgUser->getSkin(); $sittingLink = $sk->makeLinkObj($mvSittingTitle, $this->sitting_name); $html .= wfMsg('mv_edit_sitting_docu', $sittingLink); } } else { $html .= wfMsg('mv_add_sitting_docu', $docutitle->getFullURL()) . "\n"; } $html .= '<form name="add_sitting" action="' . $spectitle->escapeLocalURL() . '" method="post" enctype="multipart/form-data">'; $html .= '<fieldset><legend>' . wfMsg('mv_add_sitting') . '</legend>' . "\n" . '<input type="hidden" name="title" value="' . $spectitle->getPrefixedText() . '"/>'; $html .= '<table width="600" border="0">'; $html .= '"<tr><td width="600">TO DO</td></tr>"'; $html .= '"<tr><td>1. Pretty Javascript calender for session date</td></tr>"'; $html .= '"<tr><td>2. Name - Derived from bungeni perhaps</td></tr>"'; $html .= '"<tr><td>3. Session Number - again Derived from bungeni perhaps</td></tr>"'; $html .= '<tr>'; $html .= '<td width="140">'; $html .= '<i>' . wfMsg('mv_label_sitting_name') . "</i>:"; $html .= '</td><td>'; $html .= '<input type="text" name="sitting_name" value="" size="30" maxlength="1024"><br />' . "\n"; $html .= '</td>'; $html .= '</tr>' . "\n"; $html .= '<td width="140">'; $html .= '<i>' . wfMsg('mv_label_sitting_date') . "</i>:"; $html .= '</td><td>'; $html .= '<input type="text" name="sitting_date" value="" size="30" maxlength="1024"><br />' . "\n"; $html .= '</td>'; $html .= '</tr>' . "\n"; $html .= '<td width="140">'; $html .= '<i>' . wfMsg('mv_label_sitting_session_number') . "</i>:"; $html .= '</td><td>'; $html .= '<input type="text" name="sitting_session_number" value="" size="30" maxlength="1024"><br />' . "\n"; $html .= '</td>'; $html .= '</tr>' . "\n"; $html .= '<td width="140">'; $html .= '<i>' . wfMsg('mv_label_sitting_start_time') . "</i>:"; $html .= '</td><td>'; $html .= '<input type="text" name="sitting_start_time" value="" size="30" maxlength="1024"><br />' . "\n"; $html .= '</td>'; $html .= '</tr>' . "\n"; $html .= '<td width="140">'; $html .= '<i>' . wfMsg('mv_label_sitting_end_time') . "</i>:"; $html .= '</td><td>'; $html .= '<input type="text" name="sitting_end_time" value="" size="30" maxlength="1024"><br />' . "\n"; $html .= '</td>'; $html .= '</tr>' . "\n"; $html .= '<tr><td valign="top"><i>' . wfMsg('mv_label_sitting_desc') . '</i>:</td><td>'; //add an edit token (for the stream description) if ($wgUser->isLoggedIn()) { $token = htmlspecialchars($wgUser->editToken()); } else { $token = EDIT_TOKEN_SUFFIX; } $html .= "\n<input type='hidden' value=\"{$token}\"{$docutitle} name=\"wpEditToken\" />\n"; //output the text area: $html .= '<textarea tabindex="1" accesskey="," name="sitting_desc" id="stream_desc" rows=6 cols=5>' . $this->sitting_desc . '</textarea>' . "\n"; $html .= '<br /><input type="submit" value="' . wfMsg('mv_add_sitting_submit') . "\"/>\n</form>"; $html .= '</td></tr></table>'; $html .= '</fieldset>'; # Output menu items # @@todo link with language file $wgOut->addHTML($html); //output the stream files list (if in edit mode) //if($this->mode=='edit') //$this->list_streams(); }
function execute() { global $wgRequest, $wgOut, $wgUser, $mvStream_name, $mvgIP; #init html output var: $html = ''; # Get request data from, e.g. $title_str = $wgRequest->getVal('title'); //get Mv_Title to normalize the stream name: $this->stream_name = $wgRequest->getVal('stream_name') == '' ? '' : MV_Title::normalizeTitle($wgRequest->getVal('stream_name')); $this->stream_type = $wgRequest->getVal('stream_type'); $this->wpEditToken = $wgRequest->getVal('wpEditToken'); $this->stream_desc = $wgRequest->getVal('stream_desc'); $this->sitting_id = $wgRequest->getVal('sitting_id'); $sit = new MV_Sitting(array('id' => $this->sitting_id)); $sit->db_load_sitting(); //grab the desc from the wiki page if not in the POST req if ($this->stream_desc == '') { $desTitle = Title::makeTitle(MV_NS_STREAM, $this->stream_name); //grab the article text: $curRevision = Revision::newFromTitle($desTitle); if ($curRevision) { $this->stream_desc = $curRevision->getText(); } } if ($this->stream_name == '') { //default page request $parts = split('/', $title_str); if (count($parts) >= 2) { //means we can use part 1 as a stream name: $this->stream_name = $parts[1]; } } else { if ($this->mode == 'add') { //output add_ status to html //$html.= if ($this->add_stream()) { $streamTitle = Title::newFromText($this->stream_name, MV_NS_STREAM); $wgOut->redirect($streamTitle->getLocalURL("action=edit")); return; } else { $html = "Error adding stream. Please Nofity Administrator"; $wgOut->addHTML($html); return; } } else { //possible edit } } //if edit check for stream name: if ($this->mode == 'edit' && $this->stream_name == '') { $html .= wfMsg('edit_stream_missing'); $wgOut->addHTML($html); return; } $this->check_permissions(); if (count($this->_allowedStreamTypeArray) == 0) { //break out user lacks permissions to add anything $html .= wfMsg('add_stream_permission'); $wgOut->addHTML($html); return; } //output the stream form //output the add stream form $spectitle = Title::makeTitle(NS_SPECIAL, 'Mv_Add_stream'); $docutitle = Title::newFromText(wfMsg('mv_add_stream'), NS_HELP); if ($this->mode == 'edit') { $mvStreamTitle = Title::makeTitle(MV_NS_STREAM, $this->stream_name); if ($mvStreamTitle->exists()) { $sk = $wgUser->getSkin(); $streamLink = $sk->makeLinkObj($mvStreamTitle, $this->stream_name); $html .= wfMsg('mv_edit_strea_docu', $streamLink); } } else { //$html.= wfMsg('mv_add_stream_docu', $docutitle->getFullURL()) ."\n"; $title2 = Title::makeTitle(MV_NS_SITTING, $sit->name); $skin2 = new Linker(); $sittingLink = $skin2->makeKnownLinkObj($title2, $sit->name); $html .= 'Add a stream to Sitting ' . $sittingLink; } $html .= '<form name="add_stream" action="' . $spectitle->escapeLocalURL() . '" method="post" enctype="multipart/form-data">'; $html .= '<fieldset><legend>' . wfMsg('mv_add_stream') . '</legend>' . "\n" . '<input type="hidden" name="title" value="' . $spectitle->getPrefixedText() . '"/>' . '<input type="hidden" name="sitting_id" value="' . $wgRequest->getVal('sitting_id') . '"/>'; $html .= '<table width="600" border="0">'; $html .= '<tr><td width="140">Sitting Id</td><td>' . $wgRequest->getVal('sitting_id') . '</tr><tr>'; $html .= '<td>'; //output the stream type pulldown $html .= '<i>' . wfMsg('mv_label_stream_name') . "</i>:"; $html .= '</td><td>'; $html .= '<input type="text" name="stream_name" value="' . htmlspecialchars(MV_Title::getStreamNameText($this->stream_name)) . '" size="30" maxlength="1024"><br />' . "\n"; $html .= '</td>'; $html .= '<td><tr><td><i>' . wfMsg('mv_label_stream_type') . '</i></td><td>'; $html .= '<select name="stream_type">' . '<option value="">Select Stream Type</option>' . "\n"; foreach ($this->_allowedStreamTypeArray as $type => $na) { $sel = $type == $this->stream_type ? 'selected' : ''; $html .= '<option value="' . $type . '" ' . $sel . '>' . wfMsg('mv_' . $type) . '</option>' . "\n"; } $html .= '</select></tr>' . "\n"; $html .= '<tr><td valign="top"><i>' . wfMsg('mv_label_stream_desc') . '</i>:</td><td>'; //add an edit token (for the stream description) if ($wgUser->isLoggedIn()) { $token = htmlspecialchars($wgUser->editToken()); } else { $token = EDIT_TOKEN_SUFFIX; } $html .= "\n<input type='hidden' value=\"{$token}\"{$docutitle} name=\"wpEditToken\" />\n"; //output the text area: $html .= '<textarea tabindex="1" accesskey="," name="stream_desc" id="stream_desc" rows=6 cols=5>' . $this->stream_desc . '</textarea>' . "\n"; $html .= '<br /><input type="submit" value="' . wfMsg('mv_add_stream_submit') . "\"/>\n</form>"; $html .= '</td></tr></table>'; $html .= '</fieldset>'; # Output menu items # @@todo link with language file $wgOut->addHTML($html); //output the stream files list (if in edit mode) if ($this->mode == 'edit') { $this->list_stream_files(); } }