/** * Lookup setting by parent type */ static function lookupSettingByParentType($a_par_type, $a_name, $a_default = false) { foreach (self::$option_groups as $g => $types) { if (in_array($a_par_type, $types)) { $grp = $g; } } if ($grp != "") { return ilPageEditorSettings::lookupSetting($grp, $a_name, $a_default); } return $a_default; }
/** * Get the bb menu incl. script */ function getBBMenu($a_ta_name = "par_content") { global $lng, $ilCtrl; include_once "./Services/COPage/classes/class.ilPageEditorSettings.php"; $btpl = new ilTemplate("tpl.bb_menu.html", true, true, "Services/COPage"); // not nice, should be set by context per method //if ($this->pg_obj->getParentType() == "gdf" || // $this->pg_obj->getParentType() == "lm" || // $this->pg_obj->getParentType() == "dbk") if ($this->getPageConfig()->getEnableInternalLinks()) { $btpl->setCurrentBlock("bb_ilink_button"); $btpl->setVariable("BB_LINK_ILINK", $this->ctrl->getLinkTargetByClass("ilInternalLinkGUI", "showLinkHelp")); $btpl->parseCurrentBlock(); // add int link parts include_once "./Services/Link/classes/class.ilInternalLinkGUI.php"; $btpl->setCurrentBlock("int_link_prep"); $btpl->setVariable("INT_LINK_PREP", ilInternalLinkGUI::getInitHTML($ilCtrl->getLinkTargetByClass(array("ilpageeditorgui", "ilinternallinkgui"), "", false, true, false), true)); $btpl->parseCurrentBlock(); } if ($this->getPageConfig()->getEnableKeywords()) { $btpl->touchBlock("bb_kw_button"); $btpl->setVariable("TXT_KW", $this->lng->txt("cont_text_keyword")); } if ($this->pg_obj->getParentType() == "wpg") { $btpl->setCurrentBlock("bb_wikilink_button2"); $btpl->setVariable("TXT_WIKI_BUTTON2", $lng->txt("obj_wiki")); $btpl->setVariable("WIKI_BUTTON2_URL", $ilCtrl->getLinkTargetByClass("ilwikipagegui", "")); $btpl->parseCurrentBlock(); $btpl->setCurrentBlock("bb_wikilink_button"); $btpl->setVariable("TXT_WLN2", $lng->txt("wiki_wiki_page")); $btpl->parseCurrentBlock(); } $mathJaxSetting = new ilSetting("MathJax"); $style = $this->getStyle(); //echo URL_TO_LATEX; foreach (self::$common_bb_buttons as $c => $st) { if (ilPageEditorSettings::lookupSettingByParentType($this->pg_obj->getParentType(), "active_" . $c, true)) { if ($c != "tex" || $mathJaxSetting->get("enable") || defined("URL_TO_LATEX")) { $btpl->touchBlock("bb_" . $c . "_button"); $btpl->setVariable("TXT_" . strtoupper($c), $this->lng->txt("cont_text_" . $c)); } } } if ($this->getPageConfig()->getEnableAnchors()) { $btpl->touchBlock("bb_anc_button"); $btpl->setVariable("TXT_ANC", $lng->txt("cont_anchor") . ":"); } // footnote // $btpl->setVariable("TXT_FN", $this->lng->txt("cont_text_fn")); // $btpl->setVariable("TXT_CODE", $this->lng->txt("cont_text_code")); $btpl->setVariable("TXT_ILN", $this->lng->txt("cont_text_iln")); // $btpl->setVariable("TXT_XLN", $this->lng->txt("cont_text_xln")); // $btpl->setVariable("TXT_TEX", $this->lng->txt("cont_text_tex")); $btpl->setVariable("TXT_BB_TIP", $this->lng->txt("cont_bb_tip")); $btpl->setVariable("TXT_WLN", $lng->txt("wiki_wiki_page")); $btpl->setVariable("PAR_TA_NAME", $a_ta_name); return $btpl->get(); }
/** * Get Tiny Menu */ static function getTinyMenu($a_par_type, $a_int_links = false, $a_wiki_links = false, $a_keywords = false, $a_style_id = 0, $a_paragraph_styles = true, $a_save_return = true, $a_anchors = false, $a_save_new = true) { global $lng, $ilCtrl; $mathJaxSetting = new ilSetting("MathJax"); include_once "./Services/COPage/classes/class.ilPageEditorSettings.php"; include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php"; $btpl = new ilTemplate("tpl.tiny_menu.html", true, true, "Services/COPage"); // debug ghost element if (DEVMODE == 1) { $btpl->touchBlock("debug_ghost"); } // bullet list $btpl->touchBlock("blist_button"); ilTooltipGUI::addTooltip("il_edm_blist", $lng->txt("cont_blist"), "iltinymenu_bd"); // numbered list $btpl->touchBlock("nlist_button"); ilTooltipGUI::addTooltip("il_edm_nlist", $lng->txt("cont_nlist"), "iltinymenu_bd"); // list indent $btpl->touchBlock("list_indent"); ilTooltipGUI::addTooltip("ilIndentBut", $lng->txt("cont_list_indent"), "iltinymenu_bd"); // list outdent $btpl->touchBlock("list_outdent"); ilTooltipGUI::addTooltip("ilOutdentBut", $lng->txt("cont_list_outdent"), "iltinymenu_bd"); if ($a_int_links) { $btpl->touchBlock("bb_ilink_button"); ilTooltipGUI::addTooltip("iosEditInternalLinkTrigger", $lng->txt("cont_link_to_internal"), "iltinymenu_bd"); } ilTooltipGUI::addTooltip("il_edm_xlink", $lng->txt("cont_link_to_external"), "iltinymenu_bd"); // remove format $btpl->touchBlock("rformat_button"); ilTooltipGUI::addTooltip("il_edm_rformat", $lng->txt("cont_remove_format"), "iltinymenu_bd"); if ($a_paragraph_styles) { // new paragraph $btpl->setCurrentBlock("new_par"); $btpl->setVariable("IMG_NEWPAR", "+"); $btpl->parseCurrentBlock(); ilTooltipGUI::addTooltip("il_edm_newpar", $lng->txt("cont_insert_new_paragraph"), "iltinymenu_bd"); $btpl->setCurrentBlock("par_edit"); $btpl->setVariable("TXT_PAR_FORMAT", $lng->txt("cont_par_format")); include_once "./Services/COPage/classes/class.ilPCParagraphGUI.php"; $btpl->setVariable("STYLE_SELECTOR", ilPCParagraphGUI::getStyleSelector($a_selected, ilPCParagraphGUI::_getCharacteristics($a_style_id), true)); ilTooltipGUI::addTooltip("ilAdvSelListAnchorText_style_selection", $lng->txt("cont_paragraph_styles"), "iltinymenu_bd"); $btpl->parseCurrentBlock(); } if ($a_keywords) { $btpl->setCurrentBlock("bb_kw_button"); $btpl->setVariable("CC_KW", "kw"); $btpl->parseCurrentBlock(); ilTooltipGUI::addTooltip("il_edm_kw", $lng->txt("cont_text_keyword"), "iltinymenu_bd"); } if ($a_wiki_links) { $btpl->setCurrentBlock("bb_wikilink_button2"); $btpl->setVariable("TXT_WIKI_BUTTON2", $lng->txt("obj_wiki")); $btpl->setVariable("WIKI_BUTTON2_URL", $ilCtrl->getLinkTargetByClass("ilwikipagegui", "")); $btpl->parseCurrentBlock(); $btpl->setCurrentBlock("bb_wikilink_button"); $btpl->setVariable("TXT_WLN2", $lng->txt("obj_wiki")); $btpl->parseCurrentBlock(); ilTooltipGUI::addTooltip("il_edm_wlink", $lng->txt("cont_link_to_wiki"), "iltinymenu_bd"); } $aset = new ilSetting("adve"); include_once "./Services/COPage/classes/class.ilPageContentGUI.php"; foreach (ilPageContentGUI::_getCommonBBButtons() as $c => $st) { // these are handled via drop down now... if (in_array($c, array("com", "quot", "acc", "code"))) { continue; } if (ilPageEditorSettings::lookupSettingByParentType($a_par_type, "active_" . $c, true)) { $cc_code = $c; if ($aset->get("use_physical")) { $cc_code = str_replace(array("str", "emp", "imp"), array("B", "I", "U"), $cc_code); } if ($c != "tex" || $mathJaxSetting->get("enable") || defined("URL_TO_LATEX")) { $btpl->setCurrentBlock("bb_" . $c . "_button"); $btpl->setVariable("CC_" . strtoupper($c), $cc_code); $btpl->parseCurrentBlock(); ilTooltipGUI::addTooltip("il_edm_cc_" . $c, $lng->txt("cont_cc_" . $c), "iltinymenu_bd"); // $btpl->setVariable("TXT_".strtoupper($c), $this->lng->txt("cont_text_".$c)); } } } if ($mathJaxSetting->get("enable") || defined("URL_TO_LATEX")) { ilTooltipGUI::addTooltip("il_edm_tex", $lng->txt("cont_tex"), "iltinymenu_bd"); } ilTooltipGUI::addTooltip("il_edm_fn", $lng->txt("cont_fn"), "iltinymenu_bd"); include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php"; $sdd = new ilAdvancedSelectionListGUI(); $sdd->setPullRight(false); $sdd->setListTitle($lng->txt("save") . "..."); if ($a_save_return) { $btpl->setCurrentBlock("save_return"); $btpl->setVariable("TXT_SAVE_RETURN", $lng->txt("save_return")); $btpl->parseCurrentBlock(); $sdd->addItem($lng->txt("save_return"), "", "#", "", "", "", "", "", "ilCOPage.cmdSaveReturn(false); return false;"); } if ($a_save_new) { $btpl->setCurrentBlock("save_new"); $btpl->setVariable("TXT_SAVE_NEW", $lng->txt("save_new")); $btpl->parseCurrentBlock(); $sdd->addItem($lng->txt("save_new"), "", "#", "", "", "", "", "", "ilCOPage.cmdSaveReturn(true); return false;"); } $sdd->addItem($lng->txt("save"), "", "#", "", "", "", "", "", "ilCOPage.cmdSave(null); return false;"); $sdd->addItem($lng->txt("cancel"), "", "#", "", "", "", "", "", "ilCOPage.cmdCancel(); return false;"); if ($a_anchors) { $btpl->setCurrentBlock("bb_anc_button"); $btpl->setVariable("CC_ANC", "anc"); $btpl->parseCurrentBlock(); ilTooltipGUI::addTooltip("il_edm_anc", $lng->txt("cont_anchor"), "iltinymenu_bd"); } $btpl->setVariable("SAVE_DROPDOWN", $sdd->getHTML()); /* // footnote $btpl->setVariable("TXT_ILN", $this->lng->txt("cont_text_iln")); $btpl->setVariable("TXT_BB_TIP", $this->lng->txt("cont_bb_tip")); $btpl->setVariable("TXT_WLN", $lng->txt("wiki_wiki_page")); */ // $btpl->setVariable("PAR_TA_NAME", $a_ta_name); $btpl->setVariable("TXT_SAVE", $lng->txt("save")); $btpl->setVariable("TXT_CANCEL", $lng->txt("cancel")); $btpl->setVariable("TXT_CHAR_FORMAT", $lng->txt("cont_char_format")); $btpl->setVariable("TXT_LISTS", $lng->txt("cont_lists")); $btpl->setVariable("TXT_LINKS", $lng->txt("cont_links")); $btpl->setVariable("TXT_MORE_FUNCTIONS", $lng->txt("cont_more_functions")); $btpl->setVariable("TXT_SAVING", $lng->txt("cont_saving")); include_once "./Services/COPage/classes/class.ilPCParagraphGUI.php"; $btpl->setVariable("CHAR_STYLE_SELECTOR", ilPCParagraphGUI::getCharStyleSelector($a_par_type)); ilTooltipGUI::addTooltip("ilAdvSelListAnchorElement_char_style_selection", $lng->txt("cont_more_character_styles"), "iltinymenu_bd"); return $btpl->get(); }
/** * Get character style selector */ static function getCharStyleSelector($a_par_type, $a_use_callback = true) { global $lng; include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php"; $selection = new ilAdvancedSelectionListGUI(); $selection->setFormSelectMode("char_characteristic", "", false, "", "", "", "", "", "", ""); $selection->setId("char_style_selection"); $selection->setSelectionHeaderClass("ilEditSubmit"); $selection->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK); //$selection->setSelectedValue($a_selected); $selection->setUseImages(false); $selection->setOnClickMode(ilAdvancedSelectionListGUI::ON_ITEM_CLICK_NOP); if ($a_use_callback) { $selection->setSelectCallback("ilCOPage.setCharacterClass"); } //$chars = $a_chars; //$title_char = ($chars[$a_selected] != "") // ? $chars[$a_selected] // : $a_selected; $selection->setListTitle(" <i>A</i>"); /*if ($chars[$a_seleted] == "" && ($a_seleted != "")) { $chars = array_merge(array($a_seleted => $a_seleted), $chars); }*/ $chars = array("Comment" => array("code" => "com", "txt" => $lng->txt("cont_char_style_com")), "Quotation" => array("code" => "quot", "txt" => $lng->txt("cont_char_style_quot")), "Accent" => array("code" => "acc", "txt" => $lng->txt("cont_char_style_acc")), "Code" => array("code" => "code", "txt" => $lng->txt("cont_char_style_code"))); foreach ($chars as $key => $char) { if (ilPageEditorSettings::lookupSettingByParentType($a_par_type, "active_" . $char["code"], true)) { $t = "text_inline"; $tag = "span"; switch ($key) { case "Code": $tag = "code"; break; } $html = '<' . $tag . ' class="ilc_' . $t . '_' . $key . '" style="font-size:90%; margin-top:2px; margin-bottom:2px; position:static;">' . $char["txt"] . "</" . $tag . ">"; // this next line is very important for IE. The real onclick event is on the surrounding <tr> of the // advanced selection list. But it is impossible to prevent the tr-event from removing the focus // on tiny withouth the following line, that receives the click event before and stops the faulty default // bevaviour of IE, see bug report #8723 $html = '<a class="nostyle" style="display:block;" href="#" onclick="return false;">' . $html . "</a>"; $selection->addItem($char["txt"], $key, "", "", $key, "", $html); } } return $selection->getHTML(); }
/** * Save page editor settings form * */ public function savePageEditorSettingsObject() { global $tpl, $lng, $ilCtrl, $ilSetting; $this->initPageEditorForm(); if ($this->form->checkInput()) { include_once "./Services/COPage/classes/class.ilPageEditorSettings.php"; include_once "./Services/COPage/classes/class.ilPageContentGUI.php"; $buttons = ilPageContentGUI::_getCommonBBButtons(); foreach ($buttons as $b => $t) { ilPageEditorSettings::writeSetting($_GET["grp"], "active_" . $b, $this->form->getInput("active_" . $b)); } if ($_GET["grp"] == "test") { $ilSetting->set("enable_tst_page_edit", (int) $_POST["tst_page_edit"]); } elseif ($_GET["grp"] == "rep") { $ilSetting->set("enable_cat_page_edit", (int) $_POST["cat_page_edit"]); } ilUtil::sendInfo($lng->txt("msg_obj_modified"), true); } $ilCtrl->setParameter($this, "grp", $_GET["grp"]); $ilCtrl->redirect($this, "showPageEditorSettings"); }
/** * Show page editor settings subtabs */ function addPageEditorSettingsSubtabs() { global $ilCtrl, $ilTabs; $ilTabs->addSubTabTarget("adve_pe_general", $ilCtrl->getLinkTarget($this, "showGeneralPageEditorSettings"), array("showGeneralPageEditorSettings", "", "view")); include_once "./Services/COPage/classes/class.ilPageEditorSettings.php"; $grps = ilPageEditorSettings::getGroups(); foreach ($grps as $g => $types) { $ilCtrl->setParameter($this, "grp", $g); $ilTabs->addSubTabTarget("adve_grp_" . $g, $ilCtrl->getLinkTarget($this, "showPageEditorSettings"), array("showPageEditorSettings")); } $ilCtrl->setParameter($this, "grp", $_GET["grp"]); }