function get_tool_html($tool_id, $ns = '', $title_str = '')
 {
     global $wgOut, $wgUser;
     //check if we are proccessing a set:
     $tool_set = explode('|', $tool_id);
     if (count($tool_set) > 1) {
         $tool_values = array();
         foreach ($tool_set as $tool_id) {
             if (in_array($tool_id, $this->valid_tools)) {
                 $tool_values[$tool_id] = $this->get_tool_html($tool_id);
             }
         }
         return mvOutputJSON($tool_values);
     }
     $wgOut->clearHTML();
     //else process a single tool:
     switch ($tool_id) {
         case 'sequence_page':
             global $mvgIP, $wgOut, $wgParser, $wgTitle;
             // put in header preview div:
             $wgOut->addHTML('<div id="mv_seq_edit_preview"></div>');
             $article =& $this->mv_interface->article;
             $wgTitle =& $this->mv_interface->article->mTitle;
             $sk =& $wgUser->getSkin();
             // get the ajax edit
             $editPageAjax = new MV_EditPageAjax($article);
             $editPageAjax->mvd_id = 'seq';
             // fill wgOUt with edit form:
             $editPageAjax->edit();
             break;
         case 'add_clips_manual':
             $this->add_clips_manual();
             break;
         case 'clipedit':
             //the default clip view provides a "welcome / help  page"
             $wgOut->addHTML(wfMsg('mv_welcome_to_sequencer'));
             break;
         case 'cliplib':
             $this->add_embed_search();
             break;
         case 'options':
             $this->add_editor_options();
             break;
         case 'transition':
             $this->add_transitions();
             break;
         default:
             $wgOut->addHTML(wfMsg('mv_tool_missing', htmlspecialchars($tool_id)));
             break;
     }
     return $wgOut->getHTML();
 }
 function execute()
 {
     global $wgRequest, $wgOut, $wgUser, $mvStream_name, $mvgIP;
     $html = '';
     // set universal variables:
     $this->feed_format = $wgRequest->getVal('feed_format');
     $error_page = '';
     // print "RAN execute with export type: " .$this->export_type;
     switch ($this->export_type) {
         case 'stream':
             $this->stream_name = $wgRequest->getVal('stream_name');
             if ($this->stream_name == '') {
                 $error_page .= wfMsg('edit_stream_missing') . ", ";
             }
             $this->req_time = $wgRequest->getVal('t');
             switch ($this->feed_format) {
                 case 'cmml':
                     $this->get_stream_cmml();
                     break;
                 case 'srt':
                     $this->get_stream_srt();
                     break;
                 case 'roe':
                     $this->get_roe_xml();
                     break;
                 case 'json_cmml':
                     // sucks to do big XML page operations ...
                     // @@todo cache it..
                     ob_start();
                     $this->output_xml_header = false;
                     $this->get_stream_cmml();
                     $xml_page = ob_get_clean();
                     print mvOutputJSON($xml_page);
                     break;
                 case 'json_roe':
                     // returns roe stream info in json object for easy DOM injection
                     // sucks to do big XML page operations ...
                     //@@todo send cache friendly headers
                     ob_start();
                     $this->get_row_data();
                     $this->output_xml_header = false;
                     $this->get_roe_xml();
                     $xml_page = ob_get_clean();
                     print mvOutputJSON($xml_page);
                     break;
             }
             break;
         case 'category':
             $this->cat = $wgRequest->getVal('cat');
             if ($this->cat == '') {
                 $error_page .= wfMsg('mv_missing_cat');
             } else {
                 $this->get_category_feed();
             }
             break;
         case 'search':
             switch ($this->feed_format) {
                 case 'json_rss':
                 case 'json':
                     //@@todo send cache friendly headers kind of resource intensive:
                     ob_start();
                     $this->output_xml_header = false;
                     $this->get_search_feed();
                     $xml_page = ob_get_clean();
                     print mvOutputJSON($xml_page);
                     break;
                 case 'rss':
                 default:
                     $this->get_search_feed();
                     break;
             }
             break;
         case 'sequence':
             if ($this->par != '') {
                 $this->seq_title = $this->par;
                 $this->get_sequence_xml();
             }
             break;
         case 'ask':
             $this->get_ask_feed();
             break;
     }
     if ($error_page == '') {
         $wgOut->disable();
     } else {
         $wgOut->addHTML($error_page);
     }
 }