/** * Get paragraph sequenc of current paragraph */ function getParagraphSequenceContent($a_pg_obj) { $childs = $this->par_node->parent_node()->parent_node()->child_nodes(); $seq = array(); $cur_seq = array(); $found = false; $pc_id = $this->readPCId(); $hier_id = $this->readHierId(); for ($i = 0; $i < count($childs); $i++) { $pchilds = $childs[$i]->child_nodes(); if ($pchilds[0]->node_name() == "Paragraph" && $pchilds[0]->get_attribute("Characteristic") != "Code") { $cur_seq[] = $childs[$i]; // check whether this is the sequence of the current paragraph if ($childs[$i]->get_attribute("PCID") == $pc_id && $childs[$i]->get_attribute("HierId") == $hier_id) { $found = true; } // if this is the current sequenc, get it if ($found) { $seq = $cur_seq; } } else { // non-paragraph element found -> init the current sequence $cur_seq = array(); $found = false; } } $content = ""; $ids = "###"; $id_sep = ""; foreach ($seq as $p_node) { $ids .= $id_sep . $p_node->get_attribute("HierId") . ":" . $p_node->get_attribute("PCID"); $po = $a_pg_obj->getContentObject($p_node->get_attribute("HierId"), $p_node->get_attribute("PCID")); $s_text = $po->getText(); $s_text = $po->xml2output($s_text, true, false); $char = $po->getCharacteristic(); if ($char == "") { $char = "Standard"; } $s_text = ilPCParagraphGUI::xml2outputJS($s_text, $char, $po->readPCId()); $content .= $s_text; $id_sep = ";"; } $ids .= "###"; return $ids . $content; }
/** * Init map creation/update form */ function initCharacteristicForm($a_target, $a_types) { global $ilCtrl, $lng; // edit form include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); $this->form->setTitle($this->lng->txt("cont_choose_characteristic")); if ($a_types["par"] == "par") { $select_prop = new ilSelectInputGUI($this->lng->txt("cont_choose_characteristic_text"), "char_par"); include_once "./Services/COPage/classes/class.ilPCParagraphGUI.php"; $options = ilPCParagraphGUI::_getCharacteristics($this->page_gui->getStyleId()); $select_prop->setOptions($options); $this->form->addItem($select_prop); } if ($a_types["sec"] == "sec") { $select_prop = new ilSelectInputGUI($this->lng->txt("cont_choose_characteristic_section"), "char_sec"); include_once "./Services/COPage/classes/class.ilPCSectionGUI.php"; $options = ilPCSectionGUI::_getCharacteristics($this->page_gui->getStyleId()); $select_prop->setOptions($options); $this->form->addItem($select_prop); } foreach ($a_target as $t) { $hidden = new ilHiddenInputGUI("target[]"); $hidden->setValue($t); $this->form->addItem($hidden); } $this->form->setFormAction($ilCtrl->getFormAction($this)); $this->form->addCommandButton("assignCharacteristic", $lng->txt("save")); $this->form->addCommandButton("showPage", $lng->txt("cancel")); }
/** * 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(); }
/** * Edit paragraph (Ajax mode, sends the content of the paragraph) */ function editJS() { global $ilUser, $ilias; $s_text = $this->content_obj->getText(); //echo "\n<br><br>".htmlentities($s_text); $s_text = $this->content_obj->xml2output($s_text, true, false); //echo "\n<br><br>".htmlentities($s_text); $char = $this->determineCharacteristic(false); $s_text = ilPCParagraphGUI::xml2outputJS($s_text, $char, $this->content_obj->readPCId()); //echo "\n<br><br>".htmlentities($s_text); $ids = "###" . $this->content_obj->readHierId() . ":" . $this->content_obj->readPCId() . "###" . $char . "###"; echo $ids . $s_text; exit; }
/** * Forwards Text Item Selection to GUI classes */ function insertPCText() { global $ilCtrl, $ilSetting; switch ($_POST['pctext_type']) { case '0': //Paragraph / Text // js editing? -> redirect to js page editor // if ($ilSetting->get("enable_js_edit", 1) && ilPageEditorGUI::_doJSEditing()) if (ilPageEditorGUI::_doJSEditing()) { $ret_class = $ilCtrl->getReturnClass($this); $ilCtrl->setParameterByClass($ret_class, "pl_hier_id", $this->hier_id); $ilCtrl->setParameterByClass($ret_class, "pl_pc_id", $this->pc_id); $ilCtrl->redirectByClass($ret_class, "insertJSAtPlaceholder"); } include_once "./Services/COPage/classes/class.ilPCParagraphGUI.php"; $ilCtrl->setCmdClass("ilpcparagraphgui"); $ilCtrl->setCmd("insert"); $paragraph_gui = new ilPCParagraphGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id); $paragraph_gui->setStyleId($this->getStyleId()); $paragraph_gui->setEnableInternalLinks($this->getEnableInternalLinks()); $paragraph_gui->setEnableKeywords($this->getEnableKeywords()); $paragraph_gui->setEnableAnchors($this->getEnableAnchors()); $ret = $ilCtrl->forwardCommand($paragraph_gui); break; case '1': //DataTable include_once "./Services/COPage/classes/class.ilPCDataTableGUI.php"; $ilCtrl->setCmdClass("ilpcdatatablegui"); $ilCtrl->setCmd("insert"); $dtable_gui = new ilPCDataTableGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id); $ret = $ilCtrl->forwardCommand($dtable_gui); break; case '2': //Advanced Table include_once "./Services/COPage/classes/class.ilPCTableGUI.php"; $ilCtrl->setCmdClass("ilpctablegui"); $ilCtrl->setCmd("insert"); $atable_gui = new ilPCTableGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id); $ret = $ilCtrl->forwardCommand($atable_gui); break; case '3': //Advanced List include_once "./Services/COPage/classes/class.ilPCListGUI.php"; $ilCtrl->setCmdClass("ilpclistgui"); $ilCtrl->setCmd("insert"); $list_gui = new ilPCListGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id); $ret = $ilCtrl->forwardCommand($list_gui); break; case '4': //File List include_once "./Services/COPage/classes/class.ilPCFileListGUI.php"; $ilCtrl->setCmdClass("ilpcfilelistgui"); $ilCtrl->setCmd("insert"); $file_list_gui = new ilPCFileListGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id); $file_list_gui->setStyleId($this->getStyleId()); $ret = $this->ctrl->forwardCommand($file_list_gui); break; case '5': //Tabs include_once "./Services/COPage/classes/class.ilPCTabsGUI.php"; $ilCtrl->setCmdClass("ilpctabsgui"); $ilCtrl->setCmd("insert"); $tabs_gui = new ilPCTabsGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id); $tabs_gui->setStyleId($this->getStyleId()); $ret = $this->ctrl->forwardCommand($tabs_gui); break; default: break; } }
/** * Edit data of table */ function editData() { global $lng, $ilCtrl; if (!ilPageEditorGUI::_doJSEditing()) { return $this->editDataCl(); } //var_dump($_GET); //var_dump($_POST); $this->setTabs(); $this->displayValidationError(); include_once "./Services/COPage/classes/class.ilPCParagraph.php"; $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.tabledata2.html", "Services/COPage"); $dtpl = $this->tpl; //$dtpl = new ilTemplate("tpl.tabledata.html", true, true, "Services/COPage"); $dtpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "tableAction")); // $dtpl->setVariable("BB_MENU", $this->getBBMenu("cell_0_0")); // $this->tpl->addJavascript("./Services/COPage/phpBB/3_0_5/editor.js"); // $this->tpl->addJavascript("./Services/COPage/js/page_editing.js"); $this->tpl->setVariable("WYSIWYG_ACTION", $ilCtrl->getFormAction($this, "updateJS")); // get all rows $xpc = xpath_new_context($this->dom); $path = "//PageContent[@HierId='" . $this->getHierId() . "']" . "/Table/TableRow"; $res =& xpath_eval($xpc, $path); for ($i = 0; $i < count($res->nodeset); $i++) { $xpc2 = xpath_new_context($this->dom); $path2 = "//PageContent[@HierId='" . $this->getHierId() . "']" . "/Table/TableRow[{$i}+1]/TableData"; $res2 =& xpath_eval($xpc2, $path2); // if this is the first row -> col icons if ($i == 0) { for ($j = 0; $j < count($res2->nodeset); $j++) { if ($j == 0) { $dtpl->touchBlock("empty_td"); } if ($j == 0) { if (count($res2->nodeset) == 1) { $move_type = "none"; } else { $move_type = "forward"; } } else { if ($j == count($res2->nodeset) - 1) { $move_type = "backward"; } else { $move_type = "both"; } } $dtpl->setCurrentBlock("col_icon"); $dtpl->setVariable("COL_ICON_ALT", $lng->txt("content_column")); $dtpl->setVariable("COL_ICON", ilUtil::getImagePath("col.png")); $dtpl->setVariable("COL_ONCLICK", "COL_" . $move_type); $dtpl->setVariable("NR", $j); $dtpl->parseCurrentBlock(); } $dtpl->setCurrentBlock("row"); $dtpl->parseCurrentBlock(); } for ($j = 0; $j < count($res2->nodeset); $j++) { // first col: row icons if ($j == 0) { if ($i == 0) { if (count($res->nodeset) == 1) { $move_type = "none"; } else { $move_type = "forward"; } } else { if ($i == count($res->nodeset) - 1) { $move_type = "backward"; } else { $move_type = "both"; } } $dtpl->setCurrentBlock("row_icon"); $dtpl->setVariable("ROW_ICON_ALT", $lng->txt("content_row")); $dtpl->setVariable("ROW_ICON", ilUtil::getImagePath("row.png")); $dtpl->setVariable("ROW_ONCLICK", "ROW_" . $move_type); $dtpl->setVariable("NR", $i); $dtpl->parseCurrentBlock(); } // cell if ($res2->nodeset[$j]->get_attribute("Hidden") != "Y") { $dtpl->setCurrentBlock("cell"); if (is_array($_POST["cmd"]) && key($_POST["cmd"]) == "update") { $s_text = ilUtil::stripSlashes("cell_" . $i . "_" . $j, false); } else { $s_text = ilPCParagraph::xml2output($this->content_obj->getCellText($i, $j), true, false); include_once "./Services/COPage/classes/class.ilPCParagraphGUI.php"; $s_text = ilPCParagraphGUI::xml2outputJS($s_text, "TableContent", $this->content_obj->readPCId() . "_" . $i . "_" . $j); } $dtpl->setVariable("PAR_TA_NAME", "cell[" . $i . "][" . $j . "]"); $dtpl->setVariable("PAR_TA_ID", "cell_" . $i . "_" . $j); $dtpl->setVariable("PAR_TA_CONTENT", $s_text); $cs = $res2->nodeset[$j]->get_attribute("ColSpan"); $rs = $res2->nodeset[$j]->get_attribute("RowSpan"); $dtpl->setVariable("WIDTH", "140"); $dtpl->setVariable("HEIGHT", "80"); if ($cs > 1) { $dtpl->setVariable("COLSPAN", 'colspan="' . $cs . '"'); $dtpl->setVariable("WIDTH", 140 + ($cs - 1) * 146); } if ($rs > 1) { $dtpl->setVariable("ROWSPAN", 'rowspan="' . $rs . '"'); $dtpl->setVariable("HEIGHT", 80 + ($rs - 1) * 86); } $dtpl->parseCurrentBlock(); } } $dtpl->setCurrentBlock("row"); $dtpl->parseCurrentBlock(); } // init menues $types = array("row", "col"); $moves = array("none", "backward", "both", "forward"); $commands = array("row" => array("newRowAfter" => "cont_ed_new_row_after", "newRowBefore" => "cont_ed_new_row_before", "moveRowUp" => "cont_ed_row_up", "moveRowDown" => "cont_ed_row_down", "deleteRow" => "cont_ed_delete_row"), "col" => array("newColAfter" => "cont_ed_new_col_after", "newColBefore" => "cont_ed_new_col_before", "moveColLeft" => "cont_ed_col_left", "moveColRight" => "cont_ed_col_right", "deleteCol" => "cont_ed_delete_col")); foreach ($types as $type) { foreach ($moves as $move) { foreach ($commands[$type] as $command => $lang_var) { if ($move == "none" && substr($command, 0, 4) == "move") { continue; } if ($move == "backward" && in_array($command, array("movedown", "moveright")) || $move == "forward" && in_array($command, array("moveup", "moveleft"))) { continue; } $this->tpl->setCurrentBlock("menu_item"); $this->tpl->setVariable("MENU_ITEM_TITLE", $lng->txt($lang_var)); $this->tpl->setVariable("CMD", $command); $this->tpl->setVariable("TYPE", $type); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("menu"); $this->tpl->setVariable("TYPE", $type); $this->tpl->setVariable("MOVE", $move); $this->tpl->parseCurrentBlock(); } } $this->tpl->setVariable("FORMACTION2", $ilCtrl->getFormAction($this, "tableAction")); $this->tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_table")); // js editing preparation include_once "./Services/YUI/classes/class.ilYuiUtil.php"; ilYuiUtil::initDragDrop(); ilYuiUtil::initConnection(); ilYuiUtil::initPanel(false); $GLOBALS["tpl"]->addJavascript("Services/RTE/tiny_mce_3_3_9_2/il_tiny_mce_src.js"); $GLOBALS["tpl"]->addJavaScript("./Services/COPage/js/ilcopagecallback.js"); $GLOBALS["tpl"]->addJavascript("Services/COPage/js/page_editing.js"); $GLOBALS["tpl"]->addOnloadCode("var preloader = new Image();\n\t\t\tpreloader.src = './templates/default/images/loader.gif';\n\t\t\tilCOPage.setContentCss('" . ilObjStyleSheet::getContentStylePath((int) $this->getStyleId()) . ", " . ilUtil::getStyleSheetLocation() . ", ./Services/COPage/css/tiny_extra.css');\n\t\t\tilCOPage.editTD('cell_0_0');\n\t\t\t\t"); $this->tpl->setVariable("IL_TINY_MENU", ilPageObjectGUI::getTinyMenu($this->pg_obj->getParentType(), false, $this->pg_obj->getParentType() == "wpg", false, $this->getStyleId(), false, true)); }