Exemplo n.º 1
0
function showWikiSelect(&$out, &$lang)
{
    require_once _base_ . "/lib/lib.form.php";
    require_once _base_ . '/lib/lib.urlmanager.php';
    require_once $GLOBALS["where_framework"] . "/lib/lib.wiki.php";
    $um =& UrlManager::getInstance();
    $um->setStdQuery("sn=" . Get::cur_plat() . "&op=wiki_sel");
    //$um->setBaseUrl($_SERVER["script_name"]);
    $wiki_id = getEditorWikiId();
    $cwp = new CoreWikiPublic($wiki_id);
    $form = new Form();
    $from = importVar("from");
    $item_id = (int) importVar("item_id");
    $title = "";
    $res = "";
    //$res.=$cwp->getWikiLangFlags();
    $url = getPopupBaseUrl() . "&op=wiki_sel";
    addLinkPopupJS();
    $res .= $form->openForm("popup_form", $url, false, false, '', "onReset=\"closePopup();\"");
    $res .= $form->openElementSpace();
    $type = getPopupSelType();
    /*
    $res.=$form->getTextfield($lang->def("_PAGE_TITLE"), "title", "title", 255);
    $res.=$form->getTextfield($lang->def("_EXTENDED_TITLE"), "ext_title", "ext_title", 255);
    */
    $wiki_lang = $cwp->getWikiLanguage();
    // TODO: change getLanguage() with the current wiki language;
    // try to pass arguments in a better way, like using GET.. [?]
    $wiki_page_db = new TreeDb_WikiDb($cwp->wikiManager->getWikiPageTable(), $cwp->wikiManager->getWikiPageInfoTable(), $wiki_id, $wiki_lang);
    $treeView = new TreeView_WikiView($wiki_page_db, 'wiki_tree');
    $treeView->hideAction();
    $treeView->parsePositionData($_POST, $_POST, $_POST);
    $folder_id = $treeView->getSelectedFolderId();
    $folder_name = $treeView->getFolderPrintName($wiki_page_db->getFolderById($folder_id));
    $res .= $treeView->autoLoad();
    if ($folder_id > 0) {
        $other_param = 'onClick="insItem();"';
        $page_id =& $folder_id;
        $page_info = $cwp->wikiManager->getPageInfo($wiki_id, $wiki_lang, FALSE, $page_id);
        $res .= $form->getHidden("title", "title", $page_info["title"]);
        $res .= $form->getHidden("page_code", "page_code", $page_info["page_code"]);
    } else {
        $other_param = 'disabled="disabled"';
    }
    $res .= $form->closeElementSpace();
    $res .= $form->openButtonSpace();
    $res .= $form->getButton('apply', 'apply', $lang->def('_SAVE'), FALSE, $other_param);
    $res .= $form->getReset('undo', 'undo', $lang->def('_UNDO'));
    $res .= $form->closeButtonSpace();
    $res .= $form->closeForm();
    $out->add($res);
}
Exemplo n.º 2
0
 function wikiMap()
 {
     require_once _base_ . "/lib/lib.form.php";
     $res = "";
     $um =& UrlManager::getInstance();
     $wiki_id = $this->getWikiId();
     $page_code = $this->getPageCode();
     $wiki_lang = $this->getWikiLanguage();
     $url = $um->getUrl("op=map&page=" . $page_code);
     $form = new Form();
     $res .= $form->openForm("main_form", $url);
     $wiki_page_db = new TreeDb_WikiDb($this->wikiManager->getWikiPageTable(), $this->wikiManager->getWikiPageInfoTable(), $wiki_id, $wiki_lang);
     $treeView = new TreeView_WikiView($wiki_page_db, 'wiki_tree');
     $treeView->parsePositionData($_POST, $_POST, $_POST);
     $folder_id = $treeView->getSelectedFolderId();
     $folder_name = $treeView->getFolderPrintName($wiki_page_db->getFolderById($folder_id));
     $res .= $treeView->autoLoad();
     return $res;
 }