function get_edit_disp($titleKey, $mvd_id = 'new', $ns = MV_NS_MVD) { global $mvgIP, $wgOut, $wgScriptPath, $wgUser, $wgTitle; //print "new article title: " . $titleKey; $wgTitle = Title::newFromText($titleKey, $ns); //make a title article with global title: $Article = new Article($wgTitle); //make the ediPageajax obj $editPageAjax = new MV_EditPageAjax($Article); //add in adjust code: $editPageAjax->setAdjustHtml($this->get_adjust_disp($titleKey, $mvd_id, false)); //set ts id: $editPageAjax->mvd_id = $mvd_id; //fill wgOUt with edit form: $editPageAjax->sitting_id = $this->sitting_id; $editPageAjax->edit(); return $wgOut->getHTML(); //@@todo base edit display off of template (some how?) //special structure for editing type ht_en }
function get_edit_disp($titleKey, $mvd_id = 'new', $ns = MV_NS_MVD) { global $mvgIP, $wgOut, $wgScriptPath, $wgUser, $wgTitle, $mvMetaDataHelpers; $mvd_type = strtolower(array_shift(split(':', $titleKey))); // print "new article title: " . $titleKey; $wgTitle = Title::newFromText($titleKey, $ns); // make a title article with global title: $Article = new Article($wgTitle); // make the ediPageajax obj $editPageAjax = new MV_EditPageAjax($Article); $customPreEditHtml = $this->get_adjust_disp($titleKey, $mvd_id); // add custom data helpers if editing annotative layer: if ($mvd_type == 'anno_en') { $editPageAjax->setBasicHtml($this->get_dataHelpers($titleKey, $mvd_id)); // don't display "advanced" edit $editPageAjax->display_advanced_edit = 'none'; } // add in adjust code & hidden helpers $editPageAjax->setAdjustHtml($customPreEditHtml); // set ts id: $editPageAjax->mvd_id = $mvd_id; // fill wgOUt with edit form: $editPageAjax->edit(); return $wgOut->getHTML(); // @@todo base edit display off of template (some how?) // special structure for editing type ht_en }
function do_edit_submit() { global $mvgIP, $wgOut, $wgUser, $wgParser; $titleKey = $_POST['title']; // set up the title /article $title = Title::newFromText($titleKey, MV_NS_SEQUENCE); $article = new MV_SequencePage($title); // print "inline_seq:" . $_POST['inline_seq'] . " wpbox: " . $_REQUEST['wpTextbox1'] . "\n"; $editPageAjax = new MV_EditPageAjax($article); $editPageAjax->mvd_id = 'seq'; $textbox1 = '<' . SEQUENCE_TAG . '>' . $_POST['inline_seq'] . '</' . SEQUENCE_TAG . '>' . "\n" . $_REQUEST['wpTextbox1']; // if($wgTitle->exists()){ // print "article existing content: " . $Article->getContent(); // } if (isset($_POST['wpPreview'])) { $sk =& $wgUser->getSkin(); // $wgOut->addWikiText($_REQUEST['wpTextbox1']); // run via parser so we get categories: $parserOptions = ParserOptions::newFromUser($wgUser); $parserOptions->setEditSection(false); $parserOptions->setTidy(true); // just parse the non-seq portion: $parserOutput = $wgParser->parse($_REQUEST['wpTextbox1'], $title, $parserOptions); $wgOut->addCategoryLinks($parserOutput->getCategories()); $wgOut->addHTML($parserOutput->mText); $wgOut->addHTML($sk->getCategories()); // empty out the categories $wgOut->mCategoryLinks = array(); // add horizontal rule: $wgOut->addHTML('<hr></hr>'); // $wgOut->addWikiTextWithTitle( $curRevision->getText(), $wgTitle) ; return $wgOut->getHTML(); } if ($editPageAjax->edit($textbox1) == false) { return php2jsObj(array('status' => 'ok')); } else { // error: retrun error msg and form: return $wgOut->getHTML(); } }