33 protected \ILIAS\COPage\InternalGUIService
$gui;
36 protected \ILIAS\DI\UIServices
$ui;
37 protected \ilLanguage
$lng;
42 protected \ilDBInterface
$db;
49 $this->
ui = $DIC->ui();
50 $this->
lng = $DIC->language();
52 $this->
user = $DIC->user();
53 $this->
ctrl = $DIC->ctrl();
54 $this->db =
$DIC->database();
55 $this->component_factory =
$DIC[
"component.factory"];
56 $this->gui =
$DIC->copage()->internal()->gui();
59 $this->ui_wrapper =
new Server\UIWrapper($this->
ui, $this->
lng);
60 $this->pc_definition =
$DIC
73 switch ($query[
"action"]) {
77 case "component.edit.form":
80 throw new Exception(
"Unknown action " . $query[
"action"]);
107 count($this->
user->getPCClipboardContent()) > 0;
110 if ($this->pc_id !==
"") {
111 $type = $this->page_gui->getPageObject()->getContentObjectForPcId($this->pc_id)->getType();
112 $def = $this->pc_definition->getPCDefinitionByType($type);
113 $o->initialComponent = $def[
"name"];
116 $o->initialComponent =
"";
117 $o->initialPCId =
"";
120 return new Server\Response($o);
125 $f = $this->
ui->factory();
126 $dd =
$f->dropdown()->standard([
127 $f->link()->standard(
"label",
"#")
129 if ($aria_label !==
"") {
130 $dd = $dd->withAriaLabel($aria_label);
132 $r = $this->
ui->renderer();
133 $dd_html = preg_replace(
'/\s*id="[^"]*"/',
'', $r->render($dd));
134 $r->renderAsync($dd);
140 $config = new \stdClass();
141 $config->user = $this->
user->getLogin();
142 $config->content_css =
145 "./components/ILIAS/COPage/css/tiny_extra.css";
146 $config->text_formats = \ilPCParagraphGUI::_getTextCharacteristics($this->page_gui->getStyleId());
147 $config->text_block_formats = [];
148 foreach ([
"text_block",
"heading1",
"heading2",
"heading3"] as $type) {
149 $dummy_pc = new \ilPCParagraphGUI($this->page_gui->getPageObject(),
null,
"");
150 $dummy_pc->setStyleId($this->page_gui->getStyleId());
151 $dummy_pc->getCharacteristicsOfCurrentStyle([$type]);
152 foreach ($dummy_pc->getCharacteristics() as $char => $txt) {
153 $config->text_block_formats[$char] = $txt;
156 $config->editPlaceholders = $this->page_gui->getPageConfig()->getEnablePCType(
"PlaceHolder");
157 $config->activatedProtection =
170 $config = $this->page_gui->getPageConfig();
171 foreach ($config->getEnabledTopPCTypes() as $def) {
172 $commands[$def[
"pc_type"]] =
$lng->
txt(
"cont_ed_insert_" . $def[
"pc_type"]);
176 if (count($this->page_gui->getPageObject()->getContentTemplates()) > 0) {
177 $commands[
"templ"] =
$lng->
txt(
"cont_ed_insert_templ");
181 foreach ($this->component_factory->getActivePluginsInSlot(
"pgcp") as
$plugin) {
182 if (
$plugin->isValidParentType($this->page_gui->getPageObject()->getParentType())) {
183 $commands[
"plug_" .
$plugin->getPluginName()] =
197 $tpl = new \ilTemplate(
"tpl.page_edit_help.html",
true,
true,
"components/ILIAS/COPage/Editor");
198 $tpl->setCurrentBlock(
"help");
199 $tpl->setVariable(
"TXT_ADD_EL",
$lng->
txt(
"cont_add_elements"));
200 $tpl->setVariable(
"PLUS", $this->gui->symbol()->glyph(
"add")->render());
201 $tpl->setVariable(
"DRAG_ARROW", $this->gui->symbol()->glyph(
"next")->render());
202 $tpl->setVariable(
"TXT_DRAG",
$lng->
txt(
"cont_drag_and_drop_elements"));
203 $tpl->setVariable(
"TXT_EDIT",
$lng->
txt(
"cont_click_edit"));
204 $tpl->setVariable(
"TXT_SEL",
$lng->
txt(
"cont_shift_click_to_select"));
205 $tpl->parseCurrentBlock();
217 $tpl = new \ilTemplate(
"tpl.page_edit_help.html",
true,
true,
"components/ILIAS/COPage/Editor");
218 $tpl->setCurrentBlock(
"multi-help");
219 $tpl->setVariable(
"TXT_SEL",
$lng->
txt(
"cont_click_multi_select"));
220 $tpl->parseCurrentBlock();
231 $tpl = new \ilTemplate(
"tpl.top_actions.html",
true,
true,
"components/ILIAS/COPage/Editor");
234 $tpl->setVariable(
"DROPDOWN",
$ui->renderer()->renderAsync($dd));
236 if ($this->page_gui->getPageObject()->getEffectiveEditLockTime() > 0) {
237 $mess = $this->page_gui->getBlockingInfoMessage();
238 $tpl->setVariable(
"MESSAGE", $mess);
239 $b =
$ui->factory()->button()->standard(
240 $lng->
txt(
"cont_finish_editing"),
244 $b =
$ui->factory()->button()->standard(
245 $lng->
txt(
"cont_finish_editing"),
250 $tpl->setVariable(
"QUIT_BUTTON",
$ui->renderer()->renderAsync(
$b));
252 $html = $this->ui_wrapper->getRenderedViewControl(
254 [
"Page",
"switch.single",
$lng->
txt(
"cont_edit_comp")],
255 [
"Page",
"switch.multi",
$lng->
txt(
"cont_edit_multi")]
258 $tpl->setVariable(
"SWITCH", $html);
268 $config = $this->page_gui->getPageConfig();
269 $page = $this->page_gui->getPageObject();
274 $sel_media_mode = (
$user->
getPref(
"ilPageEditor_MediaMode") !=
"disable");
275 $sel_html_mode = (
$user->
getPref(
"ilPageEditor_HTMLMode") !=
"disable");
279 if ($config->getEnableActivation()) {
280 $captions = $this->page_gui->getActivationCaptions();
282 if ($page->getActive()) {
283 $items[] =
$ui->factory()->link()->standard(
284 $captions[
"deactivatePage"],
288 $items[] =
$ui->factory()->link()->standard(
289 $captions[
"activatePage"],
296 if ($config->getUseAttachedContent()) {
297 $items[] =
$ui->factory()->link()->standard(
298 $lng->
txt(
"cont_initial_attached_content"),
311 if ($sel_media_mode) {
313 $items[] =
$ui->factory()->link()->standard(
314 $lng->
txt(
"cont_deactivate_media"),
319 $items[] =
$ui->factory()->link()->standard(
320 $lng->
txt(
"cont_activate_media"),
327 if (!$config->getPreventHTMLUnmasking()) {
328 if ($sel_html_mode) {
330 $items[] =
$ui->factory()->link()->standard(
331 $lng->
txt(
"cont_deactivate_html"),
336 $items[] =
$ui->factory()->link()->standard(
337 $lng->
txt(
"cont_activate_html"),
344 $lm_set = new \ilSetting(
"lm");
345 if ($this->page_gui->getEnableEditing() && $this->user->getId() !=
ANONYMOUS_USER_ID) {
347 if (
$lm_set->get(
"page_history", 1)) {
348 $items[] =
$ui->factory()->link()->standard(
354 if ($config->getEnableScheduledActivation()) {
355 $items[] =
$ui->factory()->link()->standard(
362 $items[] =
$ui->factory()->link()->standard(
367 if ($this->page_gui->getEnabledNews()) {
368 $items[] =
$ui->factory()->link()->standard(
375 if ($this->page_gui->use_meta_data) {
376 if (($md_link = $this->page_gui->getMetaDataLink()) !==
"") {
377 $items[] =
$ui->factory()->link()->standard(
382 $mdgui = new \ilObjectMetaDataGUI(
383 $this->page_gui->meta_data_rep_obj,
384 $this->page_gui->meta_data_type,
385 $this->page_gui->meta_data_sub_obj_id
387 $mdtab = $mdgui->getTab();
389 $items[] =
$ui->factory()->link()->standard(
398 foreach ($this->page_gui->getAdditionalPageActions() as $item) {
402 return $ui->factory()->dropdown()->standard($items);
410 $config = $this->page_gui->getPageConfig();
411 $page = $this->page_gui->getPageObject();
420 if ($config->getMultiLangSupport()) {
421 $ot = (
new TranslationsRepository(
423 ))->getFor($page->getParentId());
425 if ($ot->getContentTranslationActivated()) {
428 if ($page->getLanguage() !=
"-") {
429 $l = $ot->getBaseLanguage();
430 $items[] =
$ui->factory()->link()->standard(
431 $lng->
txt(
"cont_edit_language_version") .
": " .
437 foreach ($ot->getLanguages() as $al => $lang) {
438 if ($page->getLanguage() != $al &&
439 $al != $ot->getBaseLanguage()) {
441 $items[] =
$ui->factory()->link()->standard(
442 $lng->
txt(
"cont_edit_language_version") .
": " .
459 $config = $this->page_gui->getPageConfig();
460 $page = $this->page_gui->getPageObject();
465 if ($config->getMultiLangSupport()) {
466 $ot = (
new TranslationsRepository(
468 ))->getFor($page->getParentId());
470 if ($ot->getContentTranslationActivated()) {
473 $ml_gui = new \ilPageMultiLangGUI(
474 $page->getParentType(),
477 $info = $ml_gui->getMultiLangInfo($page->getLanguage());
478 $info =
$ui->renderer()->renderAsync(
$ui->factory()->messageBox()->info(
$info));
494 "all" =>
"select_all",
495 "none" =>
"cont_select_none",
498 "activate" =>
"cont_ed_enable",
499 "characteristic" =>
"cont_assign_characteristic"
503 return $this->ui_wrapper->getRenderedButtonGroups($groups);
513 $html = $this->ui_wrapper->getRenderedInfoBox(
$lng->
txt(
"cont_sel_el_use_paste"));
523 $html = $this->ui_wrapper->getRenderedFailureBox();
530 $html = $this->ui_wrapper->getRenderedModalFailureBox();
539 $tpl = new \ilTemplate(
"tpl.format_selection.html",
true,
true,
"components/ILIAS/COPage/Editor");
540 $tpl->setVariable(
"TXT_PAR",
$lng->
txt(
"cont_choose_characteristic_text"));
541 $tpl->setVariable(
"TXT_SECTION",
$lng->
txt(
"cont_choose_characteristic_section"));
542 $tpl->setVariable(
"TXT_MEDIA",
$lng->
txt(
"cont_media"));
545 $tpl->setVariable(
"PAR_SELECTOR",
$ui->renderer()->renderAsync($par_sel->getStyleSelector(
" ",
"format",
"format.paragraph",
"format")));
548 $tpl->setVariable(
"SEC_SELECTOR",
$ui->renderer()->renderAsync($sec_sel->getStyleSelector(
" ",
"format",
"format.section",
"format")));
551 $tpl->setVariable(
"MEDIA_SELECTOR",
$ui->renderer()->renderAsync($med_sel->getStyleSelector(
" ",
"format",
"format.media",
"format")));
555 $this->ui_wrapper->getRenderedButton(
563 $this->ui_wrapper->getRenderedButton(
578 return $this->page_gui->getPageObject()->getPCModel();
583 $pc_edit = $this->pc_definition->getPCEditorInstanceByName($query[
"cname"]);
585 if (!is_null($pc_edit)) {
586 $form = $pc_edit->getEditComponentForm(
588 $this->page_gui->getPageObject()->getParentType(),
590 $this->page_gui->getStyleId(),
594 $o = new \stdClass();
595 $o->editForm = $form;
596 return new Server\Response($o);
605 $config = $this->page_gui->getPageConfig();
606 foreach ($this->pc_definition->getPCDefinitions() as $def) {
607 $pc_edit = $this->pc_definition->getPCEditorInstanceByName($def[
"name"]);
608 if ($config->getEnablePCType($def[
"name"])) {
609 if (!is_null($pc_edit)) {
610 $ui[$def[
"name"]] = $pc_edit->getEditorElements(
612 $this->page_gui->getPageObject()->getParentType(),
614 $this->page_gui->getStyleId()
625 foreach ($this->pc_definition->getPCDefinitions() as $def) {
626 $pcdef[
"types"][$def[
"name"]] = $def[
"pc_type"];
627 $pcdef[
"names"][$def[
"pc_type"]] = $def[
"name"];
628 $pcdef[
"txt"][$def[
"pc_type"]] = $this->
lng->txt(
"cont_" .
"pc_" . $def[
"pc_type"]);
636 $modal =
$ui->factory()->modal()->roundtrip(
'#title#',
$ui->factory()->legacy()->content(
'#content#'))
637 ->withActionButtons([
638 $ui->factory()->button()->standard(
'#button_title#',
'#'),
640 $modalt[
"signal"] = $modal->getShowSignal()->getId();
641 $modalt[
"closeSignal"] = $modal->getCloseSignal()->getId();
642 $modalt[
"template"] =
$ui->renderer()->renderAsync($modal);
654 $confirmation =
$ui->factory()->messageBox()->confirmation(
"#text#");
656 return $ui->renderer()->renderAsync($confirmation);
664 $aset = new \ilSetting(
"adve");
665 return (
int) $aset->get(
"autosave");
getComponentsEditorUI()
Get components ui elements.
getComponentsDefinitions()
__construct(\ilPageObjectGUI $page_gui, string $pc_id="")
getDropdownTemplate(string $aria_label="")
getAutoSaveInterval()
Get auto save interval.
ilComponentFactory $component_factory
getErrorMessage()
Confirmation screen for cut/paste step.
ILIAS COPage InternalGUIService $gui
componentEditFormResponse(array $query)
getMultiLangActions()
Add multi-language actions to menu.
ilPageObjectGUI $page_gui
getPasteMessage()
Confirmation screen for cut/paste step.
getConfirmationTemplate()
Get confirmation template.
getPageEditHelp()
Get page help (general)
ILIAS COPage PC PCDefinition $pc_definition
Server UIWrapper $ui_wrapper
getPCModel()
Get page component model.
getMultiEditHelp()
Get page help (multi editing)
getLinkTarget(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
@inheritDoc
getLinkTargetByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
loadLanguageModule(string $a_module)
Load language module.
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...
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
const SEC_PROTECT_PROTECTED
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static getStyleSheetLocation(string $mode="output", string $a_css_name="")
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.