00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 require_once("./content/classes/Pages/class.ilPCParagraph.php");
00025 require_once("./content/classes/Pages/class.ilPageContentGUI.php");
00026 require_once("./content/classes/Pages/class.ilWysiwygUtil.php");
00027
00038 class ilPCParagraphGUI extends ilPageContentGUI
00039 {
00040
00045 function ilPCParagraphGUI(&$a_pg_obj, &$a_content_obj, $a_hier_id)
00046 {
00047 parent::ilPageContentGUI($a_pg_obj, $a_content_obj, $a_hier_id);
00048 }
00049
00050
00054 function &executeCommand()
00055 {
00056
00057 $next_class = $this->ctrl->getNextClass($this);
00058
00059
00060 $cmd = $this->ctrl->getCmd();
00061
00062 switch($next_class)
00063 {
00064 default:
00065 $ret =& $this->$cmd();
00066 break;
00067 }
00068
00069 return $ret;
00070 }
00071
00075 function edit()
00076 {
00077 global $ilUser, $ilias;
00078
00079
00080 $this->setTabs();
00081
00082 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.paragraph_edit.html", "content");
00083
00084
00085 $this->tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_edit_par"));
00086 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00087 $this->tpl->setVariable("REF_ID", $_GET["ref_id"]);
00088
00089 $this->tpl->setVariable("EDITOR_URL", ILIAS_HTTP_PATH."/content/htmlarea/");
00090 $this->tpl->setVariable("JS_HTMLAREA", ILIAS_HTTP_PATH."/content/htmlarea/htmlarea.js");
00091 $this->tpl->setVariable("JS_HANDLETAGS", ILIAS_HTTP_PATH."/content/js/handletags.js");
00092 $this->ctrl->setParameter($this, "ptype", "footnote");
00093 $this->tpl->setVariable("POPUP_TARGET_FOOTNOTE",
00094 $this->ctrl->getLinkTarget($this, "popup"));
00095 $this->ctrl->setParameter($this, "ptype", "xtl");
00096 $this->tpl->setVariable("POPUP_TARGET_XTL",
00097 $this->ctrl->getLinkTarget($this, "popup"));
00098
00099 $this->tpl->setVariable("TXT_STR", $this->lng->txt("cont_text_str"));
00100 $this->tpl->setVariable("TXT_EMP", $this->lng->txt("cont_text_emp"));
00101 $this->tpl->setVariable("TXT_COM", $this->lng->txt("cont_text_com"));
00102 $this->tpl->setVariable("TXT_FN", $this->lng->txt("cont_text_fn"));
00103 $this->tpl->setVariable("TXT_QUOT", $this->lng->txt("cont_text_quot"));
00104 $this->tpl->setVariable("TXT_CODE", $this->lng->txt("cont_text_code"));
00105 $this->tpl->setVariable("TXT_ILN", $this->lng->txt("cont_text_iln"));
00106 $this->tpl->setVariable("TXT_XLN", $this->lng->txt("cont_text_xln"));
00107
00108 if ($this->pg_obj->getParentType() == "gdf" ||
00109 $this->pg_obj->getParentType() == "lm" ||
00110 $this->pg_obj->getParentType() == "dbk")
00111 {
00112 $this->tpl->setVariable("TXT_FORMATERROR",$this->lng->txt("cont_format_error"));
00113
00114 $this->tpl->setVariable("LOCATION_STYLESHEET_HTMLAREA",
00115 ilUtil::getStyleSheetLocation());
00116
00117 if ($this->pg_obj->getParentType() != "gdf")
00118 {
00119 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET_HTMLAREA",
00120 ilObjStyleSheet::getContentStylePath(
00121 ilObjContentObject::_lookupStyleSheetId($this->pg_obj->getParentId())));
00122 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
00123 ilObjStyleSheet::getContentStylePath(
00124 ilObjContentObject::_lookupStyleSheetId($this->pg_obj->getParentId())));
00125 }
00126 else
00127 {
00128 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET_HTMLAREA",
00129 ilObjStyleSheet::getContentStylePath(0));
00130 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
00131 ilObjStyleSheet::getContentStylePath(0));
00132 }
00133
00134 if (!ilPageEditorGUI::_doJSEditing())
00135 {
00136 $this->tpl->setCurrentBlock("bb_ilink_button");
00137 $this->tpl->setVariable("BB_LINK_ILINK",
00138 $this->ctrl->getLinkTargetByClass("ilInternalLinkGUI", "showLinkHelp"));
00139 $this->tpl->setVariable("BB_TXT_ILINK", "[".$this->lng->txt("cont_internal_link")."]");
00140 $this->tpl->setCurrentBlock("bb_buttons");
00141 $this->tpl->parseCurrentBlock();
00142 }
00143 else
00144 {
00145 $this->tpl->setVariable("LINK_ILINK",
00146 $this->ctrl->getLinkTargetByClass("ilInternalLinkGUI", "showLinkHelp"));
00147 $this->tpl->setVariable("TXT_ILINK", "[".$this->lng->txt("cont_internal_link")."]");
00148 }
00149
00150 $this->tpl->setVariable("REMOVELINK",$this->lng->txt("cont_removeiln"));
00151
00152 $this->tpl->touchBlock("internal_link_active1");
00153 $this->tpl->touchBlock("internal_link_active2");
00154 }
00155 else
00156 {
00157 $this->tpl->setVariable("LOCATION_STYLESHEET_HTMLAREA",
00158 ilUtil::getStyleSheetLocation());
00159 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET_HTMLAREA",
00160 ilObjStyleSheet::getContentStylePath(0));
00161 if (!ilPageEditorGUI::_doJSEditing())
00162 {
00163 $this->tpl->touchBlock("bb_buttons");
00164 }
00165 }
00166
00167 $this->displayValidationError();
00168
00169
00170 if (key($_POST["cmd"]) == "update")
00171 {
00172 $s_lang = $_POST["par_language"];
00173 $s_char = $_POST["par_characteristic"];
00174 }
00175 else
00176 {
00177 $s_lang = $this->content_obj->getLanguage();
00178 $s_char = $this->content_obj->getCharacteristic();
00179 }
00180 $this->tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("language"));
00181 require_once("classes/class.ilMetaData.php");
00182 $lang = ilMetaData::getLanguages();
00183 $select_lang = ilUtil::formSelect ($s_lang,"par_language",$lang,false,true);
00184 $this->tpl->setVariable("SELECT_LANGUAGE", $select_lang);
00185 $char = array("" => $this->lng->txt("none"),
00186 "Headline1" => $this->lng->txt("cont_Headline1"),
00187 "Headline2" => $this->lng->txt("cont_Headline2"),
00188 "Headline3" => $this->lng->txt("cont_Headline3"),
00189 "Example" => $this->lng->txt("cont_Example"),
00190 "Citation" => $this->lng->txt("cont_Citation"),
00191 "Mnemonic" => $this->lng->txt("cont_Mnemonic"),
00192 "Additional" => $this->lng->txt("cont_Additional"),
00193 "List" => $this->lng->txt("cont_List"),
00194 "Remark" => $this->lng->txt("cont_Remark"),
00195
00196 "TableContent" => $this->lng->txt("cont_TableContent")
00197 );
00198 $this->tpl->setVariable("TXT_CHARACTERISTIC", $this->lng->txt("cont_characteristic"));
00199 $select_char = ilUtil::formSelect ($s_char,
00200 "par_characteristic",$char,false,true);
00201 $this->tpl->setVariable("SELECT_CHARACTERISTIC", $select_char);
00202
00203 if (key($_POST["cmd"]) == "update")
00204 {
00205 $s_text = ilUtil::stripSlashes($_POST["par_content"], false);
00206 }
00207 else
00208 {
00209 $s_text = $this->content_obj->xml2output($this->content_obj->getText());
00210 }
00211 $this->tpl->setVariable("PAR_TA_NAME", "par_content");
00212
00213 if (ilPageEditorGUI::_doJSEditing())
00214 {
00215
00216
00217 $s_text = str_replace("&","&", $s_text);
00218
00219 $this->tpl->setVariable("PAR_TA_CONTENT", $s_text);
00220 $this->tpl->touchBlock("initwysiwygeditor");
00221 }
00222 else
00223 {
00224 $this->tpl->setVariable("PAR_TA_CONTENT", $s_text);
00225 }
00226
00227 $this->tpl->parseCurrentBlock();
00228
00229
00230 $this->tpl->setCurrentBlock("commands");
00231 $this->tpl->setVariable("BTN_NAME", "update");
00232 $this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
00233 $this->tpl->setVariable("BTN_CANCEL", "cancelUpdate");
00234 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
00235 $this->tpl->parseCurrentBlock();
00236
00237 }
00238
00239
00243 function insert()
00244 {
00245 global $ilUser;
00246
00247
00248 $this->setTabs();
00249
00250
00251 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.paragraph_edit.html", "content");
00252 $this->tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_insert_par"));
00253 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00254 $this->tpl->setVariable("REF_ID", $_GET["ref_id"]);
00255
00256 $this->tpl->setVariable("EDITOR_URL", ILIAS_HTTP_PATH."/content/htmlarea/");
00257 $this->tpl->setVariable("JS_HTMLAREA", ILIAS_HTTP_PATH."/content/htmlarea/htmlarea.js");
00258 $this->tpl->setVariable("JS_HANDLETAGS", ILIAS_HTTP_PATH."/content/js/handletags.js");
00259 $this->ctrl->setParameter($this, "ptype", "footnote");
00260 $this->tpl->setVariable("POPUP_TARGET_FOOTNOTE",
00261 $this->ctrl->getLinkTarget($this, "popup"));
00262 $this->ctrl->setParameter($this, "ptype", "xtl");
00263 $this->tpl->setVariable("POPUP_TARGET_XTL",
00264 $this->ctrl->getLinkTarget($this, "popup"));
00265
00266 $this->tpl->setVariable("TXT_STR", $this->lng->txt("cont_text_str"));
00267 $this->tpl->setVariable("TXT_EMP", $this->lng->txt("cont_text_emp"));
00268 $this->tpl->setVariable("TXT_COM", $this->lng->txt("cont_text_com"));
00269 $this->tpl->setVariable("TXT_FN", $this->lng->txt("cont_text_fn"));
00270 $this->tpl->setVariable("TXT_QUOT", $this->lng->txt("cont_text_quot"));
00271 $this->tpl->setVariable("TXT_CODE", $this->lng->txt("cont_text_code"));
00272 $this->tpl->setVariable("TXT_ILN", $this->lng->txt("cont_text_iln"));
00273 $this->tpl->setVariable("TXT_XLN", $this->lng->txt("cont_text_xln"));
00274
00275 if ($this->pg_obj->getParentType() == "gdf" ||
00276 $this->pg_obj->getParentType() == "lm" ||
00277 $this->pg_obj->getParentType() == "dbk")
00278 {
00279 $this->tpl->setVariable("TXT_FORMATERROR",$this->lng->txt("cont_format_error"));
00280
00281 if ($this->pg_obj->getParentType() != "gdf")
00282 {
00283 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET_HTMLAREA",
00284 ilObjStyleSheet::getContentStylePath(
00285 ilObjContentObject::_lookupStyleSheetId($this->pg_obj->getParentId())));
00286 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
00287 ilObjStyleSheet::getContentStylePath(
00288 ilObjContentObject::_lookupStyleSheetId($this->pg_obj->getParentId())));
00289 }
00290 else
00291 {
00292 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET_HTMLAREA",
00293 ilObjStyleSheet::getContentStylePath(0));
00294 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
00295 ilObjStyleSheet::getContentStylePath(0));
00296 }
00297
00298 $this->tpl->setVariable("LOCATION_STYLESHEET_HTMLAREA",
00299 ilUtil::getStyleSheetLocation());
00300
00301 if (!ilPageEditorGUI::_doJSEditing())
00302 {
00303 $this->tpl->setCurrentBlock("bb_ilink_button");
00304 $this->tpl->setVariable("BB_LINK_ILINK",
00305 $this->ctrl->getLinkTargetByClass("ilInternalLinkGUI", "showLinkHelp"));
00306 $this->tpl->setVariable("BB_TXT_ILINK", "[".$this->lng->txt("cont_internal_link")."]");
00307 $this->tpl->parseCurrentBlock();
00308 $this->tpl->setCurrentBlock("bb_buttons");
00309 $this->tpl->parseCurrentBlock();
00310 }
00311 else
00312 {
00313 $this->tpl->setVariable("LINK_ILINK",
00314 $this->ctrl->getLinkTargetByClass("ilInternalLinkGUI", "showLinkHelp"));
00315 $this->tpl->setVariable("TXT_ILINK", "[".$this->lng->txt("cont_internal_link")."]");
00316 }
00317
00318 $this->tpl->touchBlock("internal_link_active1");
00319 $this->tpl->touchBlock("internal_link_active2");
00320 }
00321 else
00322 {
00323 $this->tpl->setVariable("LOCATION_STYLESHEET_HTMLAREA",
00324 ilUtil::getStyleSheetLocation());
00325 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET_HTMLAREA",
00326 ilObjStyleSheet::getContentStylePath(0));
00327 if (!ilPageEditorGUI::_doJSEditing())
00328 {
00329 $this->tpl->touchBlock("bb_buttons");
00330 }
00331 }
00332
00333 $this->displayValidationError();
00334
00335
00336 $this->tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("language"));
00337 require_once("classes/class.ilMetaData.php");
00338 $lang = ilMetaData::getLanguages();
00339
00340
00341
00342 if (key($_POST["cmd"]) == "create_par")
00343 {
00344 $s_lang = $_POST["par_language"];
00345 $s_char = $_POST["par_characteristic"];
00346 }
00347 else
00348 {
00349 if ($_SESSION["il_text_lang_".$_GET["ref_id"]] != "")
00350 {
00351 $s_lang = $_SESSION["il_text_lang_".$_GET["ref_id"]];
00352 }
00353 else
00354 {
00355 $s_lang = $ilUser->getLanguage();
00356 }
00357
00358
00359 $cont_obj =& $this->pg_obj->getContentObject($this->getHierId());
00360 if (is_object($cont_obj))
00361 {
00362 if ($cont_obj->getType() == "li" ||
00363 ($cont_obj->getType() == "par" && $cont_obj->getCharacteristic() == "List"))
00364 {
00365 $s_char = "List";
00366 }
00367
00368 if ($cont_obj->getType() == "td" ||
00369 ($cont_obj->getType() == "par" && $cont_obj->getCharacteristic() == "TableContent"))
00370 {
00371 $s_char = "TableContent";
00372 }
00373
00374 }
00375 }
00376
00377 require_once("classes/class.ilMetaData.php");
00378 $lang = ilMetaData::getLanguages();
00379 $select_lang = ilUtil::formSelect ($s_lang,"par_language",$lang,false,true);
00380 $this->tpl->setVariable("SELECT_LANGUAGE", $select_lang);
00381 $char = array("" => $this->lng->txt("none"),
00382 "Headline1" => $this->lng->txt("cont_Headline1"),
00383 "Headline2" => $this->lng->txt("cont_Headline2"),
00384 "Headline3" => $this->lng->txt("cont_Headline3"),
00385 "Example" => $this->lng->txt("cont_Example"),
00386 "Citation" => $this->lng->txt("cont_Citation"),
00387 "Mnemonic" => $this->lng->txt("cont_Mnemonic"),
00388 "Additional" => $this->lng->txt("cont_Additional"),
00389 "List" => $this->lng->txt("cont_List"),
00390 "Remark" => $this->lng->txt("cont_Remark"),
00391
00392 "TableContent" => $this->lng->txt("cont_TableContent")
00393 );
00394 $this->tpl->setVariable("TXT_CHARACTERISTIC", $this->lng->txt("cont_characteristic"));
00395 $select_char = ilUtil::formSelect ($s_char,
00396 "par_characteristic",$char,false,true);
00397 $this->tpl->setVariable("SELECT_CHARACTERISTIC", $select_char);
00398
00399
00400
00401
00402
00403 $this->tpl->setVariable("PAR_TA_NAME", "par_content");
00404 if (key($_POST["cmd"]) == "create_par")
00405 {
00406 $this->tpl->setVariable("PAR_TA_CONTENT",
00407 ilUtil::stripSlashes($_POST["par_content"], false));
00408 }
00409 else
00410 {
00411 $this->tpl->setVariable("PAR_TA_CONTENT", "");
00412 }
00413 $this->tpl->parseCurrentBlock();
00414
00415 if (ilPageEditorGUI::_doJSEditing())
00416 {
00417 $this->tpl->touchBlock("initwysiwygeditor");
00418 }
00419
00420
00421 $this->tpl->setCurrentBlock("commands");
00422 $this->tpl->setVariable("BTN_NAME", "create_par");
00423 $this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
00424 $this->tpl->setVariable("BTN_CANCEL", "cancelCreate");
00425 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
00426 $this->tpl->parseCurrentBlock();
00427
00428 }
00429
00430
00431
00435 function update()
00436 {
00437 global $ilBench;
00438
00439 $ilBench->start("Editor","Paragraph_update");
00440
00441 $this->content_obj->setLanguage($_POST["par_language"]);
00442 $this->content_obj->setCharacteristic($_POST["par_characteristic"]);
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452 $this->updated = $this->content_obj->setText(
00453 $this->content_obj->input2xml($_POST["par_content"],
00454 $_POST["usedwsiwygeditor"]));
00455
00456 if ($this->updated !== true)
00457 {
00458 $ilBench->stop("Editor","Paragraph_update");
00459 $this->edit();
00460 return;
00461 }
00462
00463 $this->updated = $this->pg_obj->update();
00464
00465
00466 $ilBench->stop("Editor","Paragraph_update");
00467
00468 if ($this->updated === true)
00469 {
00470 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
00471 }
00472 else
00473 {
00474 $this->edit();
00475 }
00476 }
00477
00478
00482 function create()
00483 {
00484
00485 $this->content_obj =& new ilPCParagraph($this->dom);
00486 $this->content_obj->create($this->pg_obj, $this->hier_id);
00487 $this->content_obj->setLanguage($_POST["par_language"]);
00488 $_SESSION["il_text_lang_".$_GET["ref_id"]] = $_POST["par_language"];
00489 $this->content_obj->setCharacteristic($_POST["par_characteristic"]);
00490
00491 $this->updated = $this->content_obj->setText(
00492 $this->content_obj->input2xml($_POST["par_content"],
00493 $_POST["usedwsiwygeditor"]));
00494
00495 if ($this->updated !== true)
00496 {
00497 $this->insert();
00498 return;
00499 }
00500 $this->updated = $this->pg_obj->update();
00501
00502 if ($this->updated === true)
00503 {
00504 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
00505 }
00506 else
00507 {
00508 $this->insert();
00509 }
00510 }
00511
00515 function popup()
00516 {
00517 include_once "./content/classes/Pages/class.ilWysiwygUtil.php";
00518 $popup = new ilWysiwygUtil();
00519 $popup->show($_GET["ptype"]);
00520 exit;
00521 }
00522
00526 function setTabs()
00527 {
00528 global $ilTabs;
00529
00530
00531 #include_once("classes/class.ilTabsGUI.php");
00532 #$tabs_gui =& new ilTabsGUI();
00533 $this->getTabs($ilTabs);
00534 #$this->tpl->setVariable("TABS", $tabs_gui->getHTML());
00535 }
00536
00542 function getTabs(&$tabs_gui)
00543 {
00544
00545
00546
00547
00548
00549
00550 }
00551
00552
00553 }
00554 ?>