4 require_once(
"./Services/COPage/classes/class.ilPageContent.php");
42 public static $style_selector_reset =
"margin-top:2px; margin-bottom:2px; text-indent:0px; position:static; float:none; width: auto;";
46 "str" =>
"Strong",
"emp" =>
"Emph",
"imp" =>
"Important",
47 "sup" =>
"Sup",
"sub" =>
"Sub",
49 "quot" =>
"Quotation",
"acc" =>
"Accent",
"code" =>
"Code",
"tex" =>
"Tex",
50 "fn" =>
"Footnote",
"xln" =>
"ExternalLink" 57 public function __construct($a_pg_obj, $a_content_obj, $a_hier_id = 0, $a_pc_id =
"")
61 $this->error = $DIC[
"ilErr"];
63 $lng = $DIC->language();
70 $this->pg_obj = $a_pg_obj;
72 $this->content_obj = $a_content_obj;
74 if ($a_hier_id !== 0) {
75 $this->hier_id = $a_hier_id;
76 $this->pc_id = $a_pc_id;
78 $this->dom = $a_pg_obj->getDom();
89 $this->content_obj = $a_val;
109 $this->pg_obj = $a_val;
129 $this->page_config = $a_val;
147 return self::$common_bb_buttons;
158 $this->styleid = $a_styleid;
168 return $this->styleid;
178 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
193 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
200 $chars = array_merge($chars,
$style->getCharacteristics($at,
true));
202 $new_chars = array();
203 if (is_array($chars)) {
204 foreach ($chars as $char) {
205 if ($this->chars[$char] !=
"") {
206 $new_chars[$char] = $this->chars[$char];
208 $new_chars[$char] = $char;
222 $this->chars = $a_chars;
230 return $this->chars ? $this->chars : array();
248 $this->hier_id = $a_hier_id;
259 include_once(
"./Services/COPage/classes/class.ilPageEditorSettings.php");
261 $btpl =
new ilTemplate(
"tpl.bb_menu.html",
true,
true,
"Services/COPage");
265 $btpl->setCurrentBlock(
"bb_ilink_button");
268 $this->ctrl->getLinkTargetByClass(
"ilInternalLinkGUI",
"showLinkHelp")
270 $btpl->parseCurrentBlock();
273 include_once(
"./Services/Link/classes/class.ilInternalLinkGUI.php");
274 $btpl->setCurrentBlock(
"int_link_prep");
277 array(
"ilpageeditorgui",
"ilinternallinkgui"),
285 $btpl->parseCurrentBlock();
289 $btpl->touchBlock(
"bb_kw_button");
290 $btpl->setVariable(
"TXT_KW", $this->lng->txt(
"cont_text_keyword"));
292 if ($this->pg_obj->getParentType() ==
"wpg") {
293 $btpl->setCurrentBlock(
"bb_wikilink_button2");
294 $btpl->setVariable(
"TXT_WIKI_BUTTON2",
$lng->txt(
"obj_wiki"));
295 $btpl->setVariable(
"WIKI_BUTTON2_URL",
$ilCtrl->getLinkTargetByClass(
"ilwikipagegui",
""));
296 $btpl->parseCurrentBlock();
298 $btpl->setCurrentBlock(
"bb_wikilink_button");
299 $btpl->setVariable(
"TXT_WLN2",
$lng->txt(
"wiki_wiki_page"));
300 $btpl->parseCurrentBlock();
305 foreach (self::$common_bb_buttons as
$c => $st) {
308 if (!in_array(
$c, array(
"acc",
"com",
"quot",
"code"))) {
309 $btpl->touchBlock(
"bb_" .
$c .
"_button");
310 $btpl->setVariable(
"TXT_" . strtoupper(
$c), $this->lng->txt(
"cont_text_" .
$c));
311 $lng->toJS(
"cont_text_" .
$c);
318 $btpl->touchBlock(
"bb_anc_button");
319 $btpl->setVariable(
"TXT_ANC",
$lng->txt(
"cont_anchor") .
":");
320 $lng->toJS(
"cont_anchor");
323 include_once(
"./Services/COPage/classes/class.ilPCParagraphGUI.php");
330 $btpl->setVariable(
"TXT_ILN", $this->lng->txt(
"cont_text_iln"));
331 $lng->toJS(
"cont_text_iln");
334 $btpl->setVariable(
"TXT_BB_TIP", $this->lng->txt(
"cont_bb_tip"));
335 $btpl->setVariable(
"TXT_WLN",
$lng->txt(
"wiki_wiki_page"));
336 $lng->toJS(
"wiki_wiki_page");
338 $btpl->setVariable(
"PAR_TA_NAME", $a_ta_name);
346 public function delete()
348 $updated = $this->pg_obj->deleteContent($this->hier_id);
354 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
365 if (!isset(
$_POST[
"target"])) {
366 $ilErr->raiseError($this->lng->txt(
"no_checkbox"),
$ilErr->MESSAGE);
370 if (count(
$_POST[
"target"]) > 1) {
371 $ilErr->raiseError($this->lng->txt(
"only_one_target"),
$ilErr->MESSAGE);
374 $a_hid = explode(
":",
$_POST[
"target"][0]);
378 if ($this->hier_id == substr($a_hid[0], 0, strlen($this->hier_id))) {
379 $ilErr->raiseError($this->lng->txt(
"cont_target_within_source"),
$ilErr->MESSAGE);
383 $curr_node = $this->pg_obj->getContentNode($a_hid[0], $a_hid[1]);
384 if (is_object($curr_node) && $curr_node->node_name() ==
"FileItem") {
385 $ilErr->raiseError($this->lng->txt(
"cont_operation_not_allowed"),
$ilErr->MESSAGE);
389 $first_hier_character = substr($a_hid[0], 0, 1);
390 if ($first_hier_character ==
"c" ||
391 $first_hier_character ==
"r" ||
392 $first_hier_character ==
"i") {
393 $a_hid[0] = substr($a_hid[0], 1);
397 $updated = $this->pg_obj->moveContentAfter(
400 $this->content_obj->getPcId(),
408 $this->log->debug(
"return to parent jump" . $this->hier_id);
409 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
420 if (!isset(
$_POST[
"target"])) {
421 $ilErr->raiseError($this->lng->txt(
"no_checkbox"),
$ilErr->MESSAGE);
425 if (count(
$_POST[
"target"]) > 1) {
426 $ilErr->raiseError($this->lng->txt(
"only_one_target"),
$ilErr->MESSAGE);
429 $a_hid = explode(
":",
$_POST[
"target"][0]);
432 if ($this->hier_id == substr($a_hid[0], 0, strlen($this->hier_id))) {
433 $ilErr->raiseError($this->lng->txt(
"cont_target_within_source"),
$ilErr->MESSAGE);
437 $curr_node = $this->pg_obj->getContentNode($a_hid[0], $a_hid[1]);
438 if (is_object($curr_node) && $curr_node->node_name() ==
"FileItem") {
439 $ilErr->raiseError($this->lng->txt(
"cont_operation_not_allowed"),
$ilErr->MESSAGE);
443 $first_hier_character = substr($a_hid[0], 0, 1);
444 if ($first_hier_character ==
"c" ||
445 $first_hier_character ==
"r" ||
446 $first_hier_character ==
"i") {
447 $a_hid[0] = substr($a_hid[0], 1);
451 $updated = $this->pg_obj->moveContentBefore(
454 $this->content_obj->getPcId(),
462 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
473 if ($this->pg_obj->getParentType() !=
"lm") {
474 $ilErr->raiseError(
"Split method called for wrong parent type (" .
475 $this->pg_obj->getParentType() .
")",
$ilErr->FATAL);
478 $this->pg_obj->getId(),
479 $this->pg_obj->getParentType(),
484 $this->ctrl->setParameterByClass(
"illmpageobjectgui",
"obj_id", $lm_page->getId());
485 $this->ctrl->redirectByClass(
"illmpageobjectgui",
"edit");
488 $this->ctrl->returnToParent($this,
"jump" . ($this->hier_id - 1));
498 if ($this->pg_obj->getParentType() !=
"lm") {
499 $ilErr->raiseError(
"Split method called for wrong parent type (" .
500 $this->pg_obj->getParentType() .
")",
$ilErr->FATAL);
503 $this->pg_obj->getId(),
504 $this->pg_obj->getParentType(),
510 $this->ctrl->setParameterByClass(
"illmpageobjectgui",
"obj_id", $succ_id);
511 $this->ctrl->redirectByClass(
"illmpageobjectgui",
"edit");
514 $this->ctrl->returnToParent($this,
"jump" . ($this->hier_id - 1));
522 if (is_array($this->updated)) {
523 $error_str =
"<b>Error(s):</b><br>";
524 foreach ($this->updated as
$error) {
525 $err_mess = implode($error,
" - ");
526 if (!is_int(strpos($err_mess,
":0:"))) {
527 $error_str .= htmlentities($err_mess) .
"<br />";
531 } elseif ($this->updated !=
"" && $this->updated !==
true) {
542 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
550 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
558 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
569 if ($obj->isEnabled()) {
575 $updated = $this->pg_obj->update($this->hier_id);
582 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
594 $updated = $this->pg_obj->cutContents(array($this->hier_id .
":" . $this->pc_id));
602 $this->log->debug(
"return to parent jump" . $this->hier_id);
603 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
616 $this->pg_obj->copyContents(array($this->hier_id .
":" . $this->pc_id));
618 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
632 foreach ($ts as
$t) {
633 $options[
"t:" . $t[
"id"] .
":" . $t[
"name"]] = $t[
"name"];
setContentObject($a_val)
Set content object.
__construct($a_pg_obj, $a_content_obj, $a_hier_id=0, $a_pc_id="")
Constructor public.
getCharacteristicsOfCurrentStyle($a_type)
Get characteristics of current style.
deactivate()
gui function set enabled if is not enabled and vice versa
static getInitHTML($a_url)
Get initialisation HTML to use interna link editing.
splitPage()
split page to new page at specified position
getStyle()
Get style object.
getHierId()
get hierarchical id in dom object
setPageConfig($a_val)
Set Page Config.
getTemplateOptions($a_type)
Get table templates.
getPageConfig()
Get Page Config.
cancelCreate()
cancel creating page content
cancelUpdate()
cancel update
splitPageNext()
split page to next page at specified position
static _splitPage($a_page_id, $a_pg_parent_type, $a_hier_id)
split page at hierarchical id
getContentObject()
Get content object.
setCharacteristics($a_chars)
Set Characteristics.
getBBMenu($a_ta_name="par_content")
Get the bb menu incl.
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
static getCharStyleSelector($a_par_type, $a_use_callback=true, $a_style_id=0)
Get character style selector.
static _splitPageNext($a_page_id, $a_pg_parent_type, $a_hier_id)
split page to next page at hierarchical id
moveAfter()
move content element after another element
special template class to simplify handling of ITX/PEAR
static $style_selector_reset
displayValidationError()
display validation errors
getStyleId()
Get Style Id.
moveBefore()
move content element before another element
getCharacteristics()
Get characteristics.
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static lookupSettingByParentType($a_par_type, $a_name, $a_default=false)
Lookup setting by parent type.
static _getCommonBBButtons()
Get common bb buttons.
static getLogger($a_component_id)
Get component logger.
if(strpos($jquery_path, './')===0) elseif(strpos($jquery_path, '.')===0) $mathJaxSetting
setStyleId($a_styleid)
Set Style Id.
copy()
Copy single element.
setHierId($a_hier_id)
get hierarchical id in dom object
static $common_bb_buttons