4 require_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
 
    5 require_once(
"./Services/COPage/classes/class.ilPageContentGUI.php");
 
    6 require_once(
"./Services/COPage/classes/class.ilWysiwygUtil.php");
 
   40                 return array(
"Standard" => $lng->txt(
"cont_standard"),
 
   41                         "Headline1" => $lng->txt(
"cont_Headline1"),
 
   42                         "Headline2" => $lng->txt(
"cont_Headline2"),
 
   43                         "Headline3" => $lng->txt(
"cont_Headline3"),
 
   44                         "Citation" => $lng->txt(
"cont_Citation"),
 
   45                         "Mnemonic" => $lng->txt(
"cont_Mnemonic"),
 
   46                         "Example" => $lng->txt(
"cont_Example"),
 
   47                         "Additional" => $lng->txt(
"cont_Additional"),
 
   48                         "Remark" => $lng->txt(
"cont_Remark"),
 
   49                         "List" => $lng->txt(
"cont_List"),
 
   50                         "TableContent" => $lng->txt(
"cont_TableContent")
 
   62                 if ($a_style_id > 0 &&
 
   65                         include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
 
   67                         $types = array(
"text_block", 
"heading1", 
"heading2", 
"heading3");
 
   69                         foreach ($types as 
$t)
 
   71                                 $chars = array_merge($chars, $style->getCharacteristics($t));
 
   74                         foreach ($chars as $char)
 
   76                                 if ($st_chars[$char] != 
"")     
 
   78                                         $new_chars[$char] = $st_chars[$char];
 
   82                                         $new_chars[$char] = $char;
 
   98                 $next_class = $this->ctrl->getNextClass($this);
 
  101                         array(
"text_block", 
"heading1", 
"heading2", 
"heading3"));       
 
  104                 $cmd = $this->ctrl->getCmd();
 
  123                 $this->enablewikilinks = $a_enablewikilinks;
 
  133                 return $this->enablewikilinks;
 
  139         function edit($a_insert = 
false)
 
  144                 $tpl = 
new ilTemplate(
"tpl.paragraph_edit.html", 
true, 
true, 
"Services/COPage");
 
  152                         $tpl->setCurrentBlock(
"commands");
 
  153                         $tpl->setVariable(
"BTN_NAME", 
"create_par");
 
  154                         $tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
 
  155                         $tpl->setVariable(
"BTN_CANCEL", 
"cancelCreate");
 
  156                         $tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
 
  157                         $tpl->parseCurrentBlock();
 
  158                         $tpl->setCurrentBlock(
"commands2");
 
  159                         $tpl->setVariable(
"BTN_NAME", 
"create_par");
 
  160                         $tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
 
  161                         $tpl->setVariable(
"BTN_CANCEL", 
"cancelCreate");
 
  162                         $tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
 
  163                         $tpl->parseCurrentBlock();
 
  164                         $tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_insert_par"));
 
  168                         $tpl->setCurrentBlock(
"commands");
 
  169                         $tpl->setVariable(
"BTN_NAME", 
"update");
 
  170                         $tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
 
  171                         $tpl->setVariable(
"BTN_CANCEL", 
"cancelUpdate");
 
  172                         $tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
 
  173                         $tpl->parseCurrentBlock();
 
  174                         $tpl->setCurrentBlock(
"commands2");
 
  175                         $tpl->setVariable(
"BTN_NAME", 
"update");
 
  176                         $tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
 
  177                         $tpl->setVariable(
"BTN_CANCEL", 
"cancelUpdate");
 
  178                         $tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
 
  179                         $tpl->parseCurrentBlock();
 
  180                         $tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_edit_par"));
 
  187                         if (key(
$_POST[
"cmd"]) == 
"update")
 
  189                                 $s_lang = 
$_POST[
"par_language"];
 
  193                                 $s_lang = $this->content_obj->getLanguage();
 
  198                         if (key(
$_POST[
"cmd"]) == 
"create_par")
 
  200                                 $s_lang = 
$_POST[
"par_language"];
 
  206                                         $s_lang = 
$_SESSION[
"il_text_lang_".$_GET[
"ref_id"]];
 
  210                                         $s_lang = $ilUser->getLanguage();
 
  219                 $tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
 
  221                 $tpl->setVariable(
"PAR_TA_NAME", 
"par_content");
 
  223                 $this->tpl->addJavascript(
"./Services/COPage/phpBB/3_0_5/editor.js");
 
  224                 $this->tpl->addJavascript(
"./Services/COPage/js/paragraph_editing.js");
 
  229                 $tpl->setVariable(
"TXT_LANGUAGE", $this->lng->txt(
"language"));
 
  230                 $tpl->setVariable(
"TXT_ANCHOR", $this->lng->txt(
"cont_anchor"));
 
  232                 require_once(
"Services/MetaData/classes/class.ilMDLanguageItem.php");
 
  235                 $tpl->setVariable(
"SELECT_LANGUAGE", $select_lang);
 
  237                 $tpl->setVariable(
"TXT_CHARACTERISTIC", $this->lng->txt(
"cont_characteristic"));
 
  242                 if (key(
$_POST[
"cmd"]) == 
"update" || key(
$_POST[
"cmd"]) == 
"create_par")
 
  246                         $s_text = str_replace(
"{", 
"{", $s_text);
 
  247                         $s_text = str_replace(
"}", 
"}", $s_text);
 
  251                         $s_text = $this->content_obj->xml2output($this->content_obj->getText());
 
  254                 $tpl->setVariable(
"PAR_TA_CONTENT", $s_text);
 
  256                 $tpl->parseCurrentBlock();
 
  258                 $this->tpl->setContent(
$tpl->get());
 
  273                         if (key(
$_POST[
"cmd"]) == 
"update")
 
  275                                 $s_char = 
$_POST[
"par_characteristic"];
 
  279                                 $s_char = $this->content_obj->getCharacteristic();
 
  282                                         $s_char = 
"Standard";
 
  288                         if (key(
$_POST[
"cmd"]) == 
"create_par")
 
  290                                 $s_char = 
$_POST[
"par_characteristic"];
 
  294                                 $s_char = 
"Standard";
 
  297                                 $cont_obj = $this->pg_obj->getContentObject($this->
getHierId());
 
  298                                 if (is_object($cont_obj))
 
  300                                         if ($cont_obj->getType() == 
"li" ||
 
  301                                                 ($cont_obj->getType() == 
"par" && $cont_obj->getCharacteristic() == 
"List"))
 
  306                                         if ($cont_obj->getType() == 
"td" ||
 
  307                                                 ($cont_obj->getType() == 
"par" && $cont_obj->getCharacteristic() == 
"TableContent"))
 
  309                                                 $s_char = 
"TableContent";
 
  325                 $s_text = $this->content_obj->getText();
 
  327                 $s_text = $this->content_obj->xml2output($s_text, 
true, 
false);
 
  332                 $ids = 
"###".$this->content_obj->readHierId().
":".$this->content_obj->readPCId().
"###".
 
  345                 echo $this->content_obj->getParagraphSequenceContent($this->pg_obj);
 
  357                 $s_text = str_replace(array(
"<SimpleBulletList>", 
"</SimpleBulletList>"),
 
  358                         array(
"<ul class='ilc_list_u_BulletedList'>", 
"</ul>"),
 
  360                 $s_text = str_replace(array(
"<SimpleNumberedList>", 
"</SimpleNumberedList>"),
 
  361                         array(
"<ol class='ilc_list_o_NumberedList'>", 
"</ol>"), $s_text);
 
  362                 $s_text = str_replace(array(
"<SimpleListItem>", 
"</SimpleListItem>"),
 
  363                         array(
"<li class='ilc_list_item_StandardListItem'>", 
"</li>"), $s_text);
 
  364                 $s_text = str_replace(array(
"<SimpleListItem/>"),
 
  365                         array(
"<li class='ilc_list_item_StandardListItem'></li>"), $s_text);
 
  372                 include_once(
"./Services/COPage/classes/class.ilPageContentGUI.php");
 
  375                         if (!in_array($bb, array(
"code", 
"tex", 
"fn", 
"xln")))
 
  377                                 $s_text = str_replace(
"[".$bb.
"]",
 
  378                                         '<span class="ilc_text_inline_'.$cl.
'">', $s_text);
 
  379                                 $s_text = str_replace(
"[/".$bb.
"]",
 
  385                 $s_text = str_replace(array(
"[code]", 
"[/code]"),
 
  386                         array(
"<code>", 
"</code>"), $s_text);
 
  402                 $this->updated = $this->content_obj->saveJS($this->pg_obj,
 
  403                         $_POST[
"ajaxform_content"],
 
  410                                 $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, 
true);
 
  416                 $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, 
true);
 
  418                 $ilCtrl->setParameterByClass($ilCtrl->getReturnClass($this), 
"updated_pc_id_str",
 
  419                         urlencode($a_pc_id_str));
 
  420                 $ilCtrl->redirectByClass($ilCtrl->getReturnClass($this), 
"edit", 
"", 
true);
 
  428                 $this->ctrl->returnToParent($this, 
"jump".$this->hier_id);
 
  440                 if ($chars[$a_seleted_value] == 
"" && ($a_seleted_value != 
""))
 
  442                         $chars = array_merge(array($a_seleted_value => $a_seleted_value),
 
  446                 foreach ($chars as $char => $char_lang)
 
  448                         $a_tpl->setCurrentBlock(
"characteristic_cell");
 
  449                         $a_tpl->setVariable(
"CHAR_HTML",
 
  450                                 '<div class="ilc_text_block_'.$char.
'" style="margin-top:2px; margin-bottom:2px; position:static;">'.$char_lang.
"</div>");
 
  451                         $a_tpl->setVariable(
"CHAR_VALUE", $char);
 
  452                         if ($char == $a_seleted_value)
 
  454                                 $a_tpl->setVariable(
"SELECTED",
 
  455                                         ' checked="checked" ');
 
  457                         $a_tpl->parseCurrentBlock();
 
  458                         if ((($i+1) % 3) == 0)  
 
  460                                 $a_tpl->touchBlock(
"characteristic_row");
 
  464                 $a_tpl->touchBlock(
"characteristic_table");
 
  475                 $a_tpl->setVariable(
"ADV_SEL_STYLE", self::getStyleSelector($a_selected,
 
  484                 include_once(
"./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
 
  486                 $selection->setFormSelectMode(
"par_characteristic", 
"", 
false,
 
  489                 $selection->setId(
"style_selection");
 
  490                 $selection->setSelectionHeaderClass(
"ilEditSubmit ilTinyMenuDropDown");
 
  492                 $selection->setSelectedValue($a_selected);
 
  493                 $selection->setUseImages(
false);
 
  497                         $selection->setSelectCallback(
"ilCOPage.setParagraphClass");
 
  501                 $title_char = ($chars[$a_selected] != 
"")
 
  502                         ? $chars[$a_selected]
 
  504                 $selection->setListTitle($title_char);
 
  506                 if ($chars[$a_seleted] == 
"" && ($a_seleted != 
""))
 
  508                         $chars = array_merge(array($a_seleted => $a_seleted),
 
  512                 foreach ($chars as $char => $char_lang)
 
  518                                 case "Headline1": 
$t = 
"heading1"; $tag = 
"h1"; 
break;
 
  519                                 case "Headline2": 
$t = 
"heading2"; $tag = 
"h2"; 
break;
 
  520                                 case "Headline3": 
$t = 
"heading3"; $tag = 
"h3"; 
break; 
 
  522                         $html = 
'<'.$tag.
' class="ilc_'.
$t.
'_'.$char.
'" style="margin-top:2px; margin-bottom:2px; text-indent:0px; position:static;">'.$char_lang.
"</".$tag.
">";
 
  523                         $selection->addItem($char_lang, $char, 
"",
 
  524                                 "", $char, 
"", $html);
 
  526                 return $selection->getHTML();
 
  536                 include_once(
"./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
 
  538                 $selection->setFormSelectMode(
"char_characteristic", 
"", 
false,
 
  541                 $selection->setId(
"char_style_selection");
 
  542                 $selection->setSelectionHeaderClass(
"ilEditSubmit");
 
  545                 $selection->setUseImages(
false);
 
  549                         $selection->setSelectCallback(
"ilCOPage.setCharacterClass");
 
  556                 $selection->setListTitle(
" <i>A</i>");
 
  565                         "Comment" => array(
"code" => 
"com", 
"txt" => $lng->txt(
"cont_char_style_com")),
 
  566                         "Quotation" => array(
"code" => 
"quot", 
"txt" =>$lng->txt(
"cont_char_style_quot")),
 
  567                         "Accent" => array(
"code" => 
"acc", 
"txt" => $lng->txt(
"cont_char_style_acc")),
 
  568                         "Code" => array(
"code" => 
"code", 
"txt" => $lng->txt(
"cont_char_style_code"))
 
  570                 foreach ($chars as $key => $char)
 
  573                                 $a_par_type, 
"active_".$char[
"code"], 
true))
 
  579                                         case "Code": $tag = 
"code"; 
break;
 
  581                                 $html = 
'<'.$tag.
' class="ilc_'.
$t.
'_'.$key.
'" style="font-size:90%; margin-top:2px; margin-bottom:2px; position:static;">'.$char[
"txt"].
"</".$tag.
">";
 
  587                                 $html = 
'<a class="nostyle" style="display:block;" href="#" onclick="return false;">'.$html.
"</a>";
 
  588                                 $selection->addItem($char[
"txt"], $key, 
"",
 
  589                                         "", $key, 
"", $html);
 
  592                 return $selection->getHTML();
 
  600                 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
 
  602                 if ($this->pg_obj->getParentType() == 
"gdf" ||
 
  603                         $this->pg_obj->getParentType() == 
"lm" ||
 
  604                         $this->pg_obj->getParentType() == 
"dbk")
 
  606                         if ($this->pg_obj->getParentType() != 
"gdf")
 
  618                         if ($this->pg_obj->getParentType() != 
"sahs")
 
  630                 return $this->
edit(
true);
 
  640                 $ilBench->start(
"Editor",
"Paragraph_update");
 
  642                 $this->content_obj->setLanguage(
$_POST[
"par_language"]);
 
  643                 $this->content_obj->setCharacteristic(
$_POST[
"par_characteristic"]);
 
  654                 $this->updated = $this->content_obj->setText(
 
  655                         $this->content_obj->input2xml(
$_POST[
"par_content"],
 
  656                                 $_POST[
"usedwsiwygeditor"]), 
true);
 
  658                 if ($this->updated !== 
true)
 
  660                         $ilBench->stop(
"Editor",
"Paragraph_update");
 
  665                 $this->updated = $this->pg_obj->update();
 
  668                 $ilBench->stop(
"Editor",
"Paragraph_update");
 
  670                 if ($this->updated === 
true)
 
  672                         $this->ctrl->returnToParent($this, 
"jump".$this->hier_id);
 
  686                 if (
$_POST[
"ajaxform_hier_id"] != 
"")
 
  693                 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
 
  695                 $this->content_obj->setLanguage(
$_POST[
"par_language"]);
 
  697                 $this->content_obj->setCharacteristic(
$_POST[
"par_characteristic"]);
 
  699                 $this->updated = $this->content_obj->setText(
 
  700                         $this->content_obj->input2xml(
$_POST[
"par_content"],
 
  701                                 $_POST[
"usedwsiwygeditor"]), 
true);
 
  703                 if ($this->updated !== 
true)
 
  708                 $this->updated = $this->pg_obj->update();
 
  710                 if ($this->updated === 
true)
 
  712                         $this->ctrl->returnToParent($this, 
"jump".$this->hier_id);
 
  728                 $this->updated = $this->content_obj->saveJS($this->pg_obj,
 
  729                         $_POST[
"ajaxform_content"],
 
  737                                 $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, 
true);
 
  743                 $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, 
true);
 
  744                 $ilCtrl->setParameterByClass($ilCtrl->getReturnClass($this), 
"updated_pc_id_str",
 
  745                         urlencode($a_pc_id_str));
 
  746                 $ilCtrl->redirectByClass($ilCtrl->getReturnClass($this), 
"edit", 
"", 
true);
 
  756                 $a_tpl->setCurrentBlock(
"help_item");
 
  757                 $a_tpl->setVariable(
"TXT_HELP", 
"<b>".$lng->txt(
"cont_syntax_help").
"</b>");
 
  758                 $a_tpl->parseCurrentBlock();
 
  759                 $a_tpl->setCurrentBlock(
"help_item");
 
  760                 $a_tpl->setVariable(
"TXT_HELP", 
"* ".$lng->txt(
"cont_bullet_list"));
 
  761                 $a_tpl->parseCurrentBlock();
 
  762                 $a_tpl->setCurrentBlock(
"help_item");
 
  763                 $a_tpl->setVariable(
"TXT_HELP", 
"# ".$lng->txt(
"cont_numbered_list"));
 
  764                 $a_tpl->parseCurrentBlock();
 
  765                 $a_tpl->setCurrentBlock(
"help_item");
 
  766                 $a_tpl->setVariable(
"TXT_HELP", 
"=".$lng->txt(
"cont_Headline1").
"=<br />".
 
  767                         "==".$lng->txt(
"cont_Headline2").
"==<br />".
 
  768                         "===".$lng->txt(
"cont_Headline3").
"===");
 
  769                 $a_tpl->parseCurrentBlock();
 
  773                         $a_tpl->setCurrentBlock(
"help_item");
 
  774                         $a_tpl->setVariable(
"TXT_HELP", 
"[[".$lng->txt(
"cont_wiki_page_link").
"]]");
 
  775                         $a_tpl->parseCurrentBlock();
 
  778                 $a_tpl->setCurrentBlock(
"help");
 
  779                 $a_tpl->parseCurrentBlock();