32 protected \ILIAS\COPage\InternalGUIService
$gui;
35 protected \ILIAS\DI\UIServices
$ui;
36 protected \ilLanguage
$lng;
47 $this->
ui = $DIC->ui();
48 $this->
lng = $DIC->language();
50 $this->
user = $DIC->user();
51 $this->
ctrl = $DIC->ctrl();
52 $this->component_factory = $DIC[
"component.factory"];
53 $this->gui = $DIC->copage()->internal()->gui();
56 $this->ui_wrapper =
new Server\UIWrapper($this->
ui, $this->
lng);
57 $this->pc_definition = $DIC
70 switch ($query[
"action"]) {
74 case "component.edit.form":
77 throw new Exception(
"Unknown action " . $query[
"action"]);
83 $f = $this->
ui->factory();
84 $dd =
$f->dropdown()->standard([
85 $f->link()->standard(
"label",
"#")
87 $r = $this->
ui->renderer();
89 $o->dropdown =
$r->render($dd);
106 $o->backUrl = $ctrl->getLinkTarget($this->page_gui,
"edit");
108 count($this->
user->getPCClipboardContent()) > 0;
111 if ($this->pc_id !==
"") {
112 $type = $this->page_gui->getPageObject()->getContentObjectForPcId($this->pc_id)->getType();
113 $def = $this->pc_definition->getPCDefinitionByType($type);
114 $o->initialComponent = $def[
"name"];
117 $o->initialComponent =
"";
118 $o->initialPCId =
"";
121 return new Server\Response($o);
126 $config = new \stdClass();
127 $config->user = $this->
user->getLogin();
128 $config->content_css =
131 "./Services/COPage/css/tiny_extra.css";
132 $config->text_formats = \ilPCParagraphGUI::_getTextCharacteristics($this->page_gui->getStyleId());
133 $config->text_block_formats = [];
134 foreach ([
"text_block",
"heading1",
"heading2",
"heading3"] as $type) {
135 $dummy_pc = new \ilPCParagraphGUI($this->page_gui->getPageObject(), null,
"");
136 $dummy_pc->setStyleId($this->page_gui->getStyleId());
137 $dummy_pc->getCharacteristicsOfCurrentStyle([$type]);
138 foreach ($dummy_pc->getCharacteristics() as $char =>
$txt) {
139 $config->text_block_formats[$char] =
$txt;
142 $config->editPlaceholders = $this->page_gui->getPageConfig()->getEnablePCType(
"PlaceHolder");
143 $config->activatedProtection =
156 $config = $this->page_gui->getPageConfig();
157 foreach ($config->getEnabledTopPCTypes() as $def) {
158 $commands[$def[
"pc_type"]] = $lng->
txt(
"cont_ed_insert_" . $def[
"pc_type"]);
162 if (count($this->page_gui->getPageObject()->getContentTemplates()) > 0) {
163 $commands[
"templ"] = $lng->txt(
"cont_ed_insert_templ");
167 foreach ($this->component_factory->getActivePluginsInSlot(
"pgcp") as
$plugin) {
168 if (
$plugin->isValidParentType($this->page_gui->getPageObject()->getParentType())) {
169 $commands[
"plug_" .
$plugin->getPluginName()] =
183 $tpl = new \ilTemplate(
"tpl.page_edit_help.html",
true,
true,
"Services/COPage/Editor");
184 $tpl->setCurrentBlock(
"help");
185 $tpl->setVariable(
"TXT_ADD_EL", $lng->txt(
"cont_add_elements"));
186 $tpl->setVariable(
"PLUS", $this->gui->symbol()->glyph(
"add")->render());
187 $tpl->setVariable(
"DRAG_ARROW", $this->gui->symbol()->glyph(
"next")->render());
188 $tpl->setVariable(
"TXT_DRAG", $lng->txt(
"cont_drag_and_drop_elements"));
189 $tpl->setVariable(
"TXT_EDIT", $lng->txt(
"cont_click_edit"));
190 $tpl->setVariable(
"TXT_SEL", $lng->txt(
"cont_shift_click_to_select"));
191 $tpl->parseCurrentBlock();
203 $tpl = new \ilTemplate(
"tpl.page_edit_help.html",
true,
true,
"Services/COPage/Editor");
204 $tpl->setCurrentBlock(
"multi-help");
205 $tpl->setVariable(
"TXT_SEL", $lng->txt(
"cont_click_multi_select"));
206 $tpl->parseCurrentBlock();
217 $tpl = new \ilTemplate(
"tpl.top_actions.html",
true,
true,
"Services/COPage/Editor");
220 $tpl->setVariable(
"DROPDOWN", $ui->renderer()->renderAsync($dd));
222 if ($this->page_gui->getPageObject()->getEffectiveEditLockTime() > 0) {
223 $mess = $this->page_gui->getBlockingInfoMessage();
224 $tpl->setVariable(
"MESSAGE", $mess);
225 $b = $ui->factory()->button()->standard(
226 $lng->txt(
"cont_finish_editing"),
227 $ctrl->getLinkTarget($this->page_gui,
"releasePageLock")
230 $b = $ui->factory()->button()->standard(
231 $lng->txt(
"cont_finish_editing"),
232 $ctrl->getLinkTarget($this->page_gui,
"finishEditing")
236 $tpl->setVariable(
"QUIT_BUTTON", $ui->renderer()->renderAsync(
$b));
238 $html = $this->ui_wrapper->getRenderedViewControl(
240 [
"Page",
"switch.single", $lng->txt(
"cont_edit_comp")],
241 [
"Page",
"switch.multi", $lng->txt(
"cont_edit_multi")]
244 $tpl->setVariable(
"SWITCH", $html);
254 $config = $this->page_gui->getPageConfig();
255 $page = $this->page_gui->getPageObject();
260 $sel_media_mode = ($user->getPref(
"ilPageEditor_MediaMode") !=
"disable");
261 $sel_html_mode = ($user->getPref(
"ilPageEditor_HTMLMode") !=
"disable");
265 if ($config->getEnableActivation()) {
266 $captions = $this->page_gui->getActivationCaptions();
268 if ($page->getActive()) {
269 $items[] = $ui->factory()->link()->standard(
270 $captions[
"deactivatePage"],
271 $ctrl->getLinkTarget($this->page_gui,
"deactivatePage")
274 $items[] = $ui->factory()->link()->standard(
275 $captions[
"activatePage"],
276 $ctrl->getLinkTarget($this->page_gui,
"activatePage")
282 if ($config->getUseAttachedContent()) {
283 $items[] = $ui->factory()->link()->standard(
284 $lng->txt(
"cont_initial_attached_content"),
285 $ctrl->getLinkTarget($this->page_gui,
"initialOpenedContent")
297 if ($sel_media_mode) {
298 $ctrl->setParameter($this->page_gui,
"media_mode",
"disable");
299 $items[] = $ui->factory()->link()->standard(
300 $lng->txt(
"cont_deactivate_media"),
301 $ctrl->getLinkTarget($this->page_gui,
"setEditMode")
304 $ctrl->setParameter($this->page_gui,
"media_mode",
"enable");
305 $items[] = $ui->factory()->link()->standard(
306 $lng->txt(
"cont_activate_media"),
307 $ctrl->getLinkTarget($this->page_gui,
"setEditMode")
310 $ctrl->setParameter($this,
"media_mode",
"");
313 if (!$config->getPreventHTMLUnmasking()) {
314 if ($sel_html_mode) {
315 $ctrl->setParameter($this->page_gui,
"html_mode",
"disable");
316 $items[] = $ui->factory()->link()->standard(
317 $lng->txt(
"cont_deactivate_html"),
318 $ctrl->getLinkTarget($this->page_gui,
"setEditMode")
321 $ctrl->setParameter($this->page_gui,
"html_mode",
"enable");
322 $items[] = $ui->factory()->link()->standard(
323 $lng->txt(
"cont_activate_html"),
324 $ctrl->getLinkTarget($this->page_gui,
"setEditMode")
328 $ctrl->setParameter($this->page_gui,
"html_mode",
"");
330 $lm_set = new \ilSetting(
"lm");
333 if (
$lm_set->get(
"page_history", 1)) {
334 $items[] = $ui->factory()->link()->standard(
335 $lng->txt(
"history"),
336 $ctrl->getLinkTarget($this->page_gui,
"history")
340 if ($config->getEnableScheduledActivation()) {
341 $items[] = $ui->factory()->link()->standard(
342 $lng->txt(
"cont_activation"),
343 $ctrl->getLinkTarget($this->page_gui,
"editActivation")
348 $items[] = $ui->factory()->link()->standard(
349 $lng->txt(
"clipboard"),
350 $ctrl->getLinkTargetByClass([get_class($this->page_gui),
"ilEditClipboardGUI"],
"view")
353 if ($this->page_gui->getEnabledNews()) {
354 $items[] = $ui->factory()->link()->standard(
356 $ctrl->getLinkTargetByClass([get_class($this->page_gui),
"ilnewsitemgui"],
"editNews")
360 if (($md_link = $this->page_gui->getMetaDataLink()) !==
"") {
361 $items[] = $ui->factory()->link()->standard(
362 $lng->txt(
"meta_data"),
368 if ($this->page_gui->use_meta_data) {
369 $mdgui = new \ilObjectMetaDataGUI(
370 $this->page_gui->meta_data_rep_obj,
371 $this->page_gui->meta_data_type,
372 $this->page_gui->meta_data_sub_obj_id
374 $mdtab = $mdgui->getTab();
376 $items[] = $ui->factory()->link()->standard(
377 $lng->txt(
"meta_data"),
384 if ($this->page_gui->getEnabledNews()) {
385 $items[] = $ui->factory()->link()->standard(
387 $ctrl->getLinkTargetByClass([get_class($this->page_gui), \ilNewsItemGUI::class],
"editNews")
393 foreach ($this->page_gui->getAdditionalPageActions() as $item) {
397 return $ui->factory()->dropdown()->standard($items);
405 $config = $this->page_gui->getPageConfig();
406 $page = $this->page_gui->getPageObject();
415 if ($config->getMultiLangSupport()) {
418 if ($ot->getContentActivated()) {
419 $lng->loadLanguageModule(
"meta");
421 if ($page->getLanguage() !=
"-") {
422 $l = $ot->getMasterLanguage();
423 $items[] = $ui->factory()->link()->standard(
424 $lng->txt(
"cont_edit_language_version") .
": " .
425 $lng->txt(
"meta_l_" . $l),
426 $ctrl->getLinkTarget($this->page_gui,
"editMasterLanguage")
430 foreach ($ot->getLanguages() as $al =>
$lang) {
431 if ($page->getLanguage() != $al &&
432 $al != $ot->getMasterLanguage()) {
433 $ctrl->setParameter($this->page_gui,
"totransl", $al);
434 $items[] = $ui->factory()->link()->standard(
435 $lng->txt(
"cont_edit_language_version") .
": " .
436 $lng->txt(
"meta_l_" . $al),
437 $ctrl->getLinkTarget($this->page_gui,
"switchToLanguage")
439 $ctrl->setParameter($this->page_gui,
"totransl",
"");
452 $config = $this->page_gui->getPageConfig();
453 $page = $this->page_gui->getPageObject();
458 if ($config->getMultiLangSupport()) {
461 if ($ot->getContentActivated()) {
462 $lng->loadLanguageModule(
"meta");
464 $ml_gui = new \ilPageMultiLangGUI(
465 $page->getParentType(),
468 $info = $ml_gui->getMultiLangInfo($page->getLanguage());
469 $info = $ui->renderer()->renderAsync($ui->factory()->messageBox()->info($info));
485 "all" =>
"select_all",
486 "none" =>
"cont_select_none",
489 "activate" =>
"cont_ed_enable",
490 "characteristic" =>
"cont_assign_characteristic" 494 return $this->ui_wrapper->getRenderedButtonGroups($groups);
504 $html = $this->ui_wrapper->getRenderedInfoBox($lng->txt(
"cont_sel_el_use_paste"));
514 $html = $this->ui_wrapper->getRenderedFailureBox();
521 $html = $this->ui_wrapper->getRenderedModalFailureBox();
530 $tpl = new \ilTemplate(
"tpl.format_selection.html",
true,
true,
"Services/COPage/Editor");
531 $tpl->setVariable(
"TXT_PAR", $lng->txt(
"cont_choose_characteristic_text"));
532 $tpl->setVariable(
"TXT_SECTION", $lng->txt(
"cont_choose_characteristic_section"));
533 $tpl->setVariable(
"TXT_MEDIA", $lng->txt(
"cont_media"));
536 $tpl->setVariable(
"PAR_SELECTOR", $ui->renderer()->renderAsync($par_sel->getStyleSelector(
"",
"format",
"format.paragraph",
"format")));
539 $tpl->setVariable(
"SEC_SELECTOR", $ui->renderer()->renderAsync($sec_sel->getStyleSelector(
"",
"format",
"format.section",
"format")));
542 $tpl->setVariable(
"MEDIA_SELECTOR", $ui->renderer()->renderAsync($med_sel->getStyleSelector(
"",
"format",
"format.media",
"format")));
546 $this->ui_wrapper->getRenderedButton(
554 $this->ui_wrapper->getRenderedButton(
569 return $this->page_gui->getPageObject()->getPCModel();
574 $pc_edit = $this->pc_definition->getPCEditorInstanceByName($query[
"cname"]);
576 if (!is_null($pc_edit)) {
577 $form = $pc_edit->getEditComponentForm(
579 $this->page_gui->getPageObject()->getParentType(),
585 $o = new \stdClass();
586 $o->editForm = $form;
587 return new Server\Response($o);
596 $config = $this->page_gui->getPageConfig();
597 foreach ($this->pc_definition->getPCDefinitions() as $def) {
598 $pc_edit = $this->pc_definition->getPCEditorInstanceByName($def[
"name"]);
599 if ($config->getEnablePCType($def[
"name"])) {
600 if (!is_null($pc_edit)) {
601 $ui[$def[
"name"]] = $pc_edit->getEditorElements(
603 $this->page_gui->getPageObject()->getParentType(),
616 foreach ($this->pc_definition->getPCDefinitions() as $def) {
617 $pcdef[
"types"][$def[
"name"]] = $def[
"pc_type"];
618 $pcdef[
"names"][$def[
"pc_type"]] = $def[
"name"];
619 $pcdef[
"txt"][$def[
"pc_type"]] = $this->
lng->txt(
"cont_" .
"pc_" . $def[
"pc_type"]);
627 $modal = $ui->factory()->modal()->roundtrip(
'#title#', $ui->factory()->legacy(
'#content#'))
628 ->withActionButtons([
629 $ui->factory()->button()->standard(
'#button_title#',
'#'),
631 $modalt[
"signal"] = $modal->getShowSignal()->getId();
632 $modalt[
"template"] = $ui->renderer()->renderAsync($modal);
644 $confirmation = $ui->factory()->messageBox()->confirmation(
"#text#");
646 return $ui->renderer()->renderAsync($confirmation);
654 $aset = new \ilSetting(
"adve");
655 return (
int) $aset->get(
"autosave");
getPasteMessage()
Confirmation screen for cut/paste step.
const SEC_PROTECT_PROTECTED
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
Class ChatMainBarProvider .
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getMultiLangActions()
Add multi-language actions to menu.
ILIAS COPage InternalGUIService $gui
ILIAS COPage PC PCDefinition $pc_definition
loadLanguageModule(string $a_module)
Load language module.
ilComponentFactory $component_factory
getPageEditHelp()
Get page help (general)
static getStyleSheetLocation(string $mode="output", string $a_css_name="", string $a_css_location="")
get full style sheet file name (path inclusive) of current user
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getComponentsEditorUI()
Get components ui elements.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilPageObjectGUI $page_gui
getConfirmationTemplate()
Get confirmation template.
static getInstance(int $obj_id)
getMultiEditHelp()
Get page help (multi editing)
componentEditFormResponse(array $query)
getComponentsDefinitions()
getPCModel()
Get page component model.
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
getAutoSaveInterval()
Get auto save interval.
Server UIWrapper $ui_wrapper
getErrorMessage()
Confirmation screen for cut/paste step.
__construct(\ilPageObjectGUI $page_gui, string $pc_id="")