Skip to content

Commit c3299d2

Browse files
committed
47308: Failed test: Einzelne Wiki-Abgaben drucken
1 parent 51a6f43 commit c3299d2

9 files changed

Lines changed: 51 additions & 35 deletions

File tree

components/ILIAS/COPage/COPage.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,18 @@ public function getTarget(): string
110110
return "assets/js/ilIntLink.js";
111111
}
112112
};
113+
// this is just a dummy to make the html export to the same
114+
// target assets/content_style/style.css work
115+
$contribute[Component\Resource\PublicAsset::class] = static fn() => new class () implements Component\Resource\PublicAsset {
116+
public function getSource(): string
117+
{
118+
return "components/ILIAS/COPage/css/content_base.css";
119+
}
120+
public function getTarget(): string
121+
{
122+
return "assets/content_style/style.css";
123+
}
124+
};
113125

114126
}
115127
}

components/ILIAS/COPage/classes/class.ilCOPageHTMLExport.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public function exportStyles(): void
140140
} else {
141141
$this->export_collector->addDirectory(
142142
ilObjStyleSheet::getBasicImageDir(),
143-
"/basic_style/images"
143+
"/assets/basic_style/images"
144144
);
145145
$this->export_collector->addFile(
146146
"../components/ILIAS/COPage/css/content.css",
@@ -161,7 +161,7 @@ public function exportStyles(): void
161161
$this->export_collector->addContainerDirectory(
162162
$res_id->serialize(),
163163
"",
164-
"content_style"
164+
"assets/content_style"
165165
);
166166
}
167167
}
@@ -493,8 +493,12 @@ protected function initResourceTemplate(
493493
$this->global_screen->layout()->meta()->reset();
494494
$tpl = new ilGlobalTemplate($template_file, true, true, "components/ILIAS/COPage");
495495
$this->getPreparedMainTemplate($tpl);
496-
$tpl->addCss(\ilUtil::getStyleSheetLocation());
497-
$tpl->addCss(ilObjStyleSheet::getContentStylePath($this->getContentStyleId()));
496+
$this->global_screen->layout()->meta()->addCss(
497+
\ilUtil::getStyleSheetLocation()
498+
);
499+
$this->global_screen->layout()->meta()->addCss(
500+
\ilObjStyleSheet::getExportContentStylePath()
501+
);
498502
$tpl->addCss(ilObjStyleSheet::getSyntaxStylePath());
499503
return $tpl;
500504
}

components/ILIAS/Export/HTML/class.Util.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ public function exportResourceFiles(): void
152152
$target_dir = $this->target_dir;
153153
$css = $global_screen->layout()->meta()->getCss();
154154
foreach ($css->getItemsInOrderOfDelivery() as $item) {
155+
// skip dummy "assets/content_style/style.css"
156+
if (str_contains($item->getContent(), "assets/content_style")) {
157+
continue;
158+
}
155159
$this->exportResourceFile($target_dir, $item->getContent());
156160
}
157161
$js = $global_screen->layout()->meta()->getJs();

components/ILIAS/Export/Print/class.PrintProcessGUI.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,7 @@ public function renderPrintView(int $content_style_id = 0): string
157157

158158
$tpl->setBodyClass($this->body_class);
159159
$tpl->addCss(\ilUtil::getStyleSheetLocation("filesystem"));
160-
$tpl->addCss(
161-
\ilObjStyleSheet::getContentStylePath(
162-
$content_style_id,
163-
false
164-
)
165-
);
160+
$tpl->addCss(\ilObjStyleSheet::getExportContentStylePath());
166161
$tpl->addCss(\ilObjStyleSheet::getContentPrintStyle());
167162
$tpl->addCss(\ilObjStyleSheet::getSyntaxStylePath());
168163

components/ILIAS/LearningModule/Presentation/class.ilLMPresentationGUI.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,10 +1079,16 @@ public function getCurrentPageId(): ?int
10791079
protected function setContentStyles(): void
10801080
{
10811081
// content style
1082-
$this->content_style_gui->addCss(
1083-
$this->tpl,
1084-
$this->lm->getRefId()
1085-
);
1082+
if ($this->offlineMode()) {
1083+
$this->content_style_gui->addExportCss(
1084+
$this->tpl
1085+
);
1086+
} else {
1087+
$this->content_style_gui->addCss(
1088+
$this->tpl,
1089+
$this->lm->getRefId()
1090+
);
1091+
}
10861092
$this->tpl->addCss(ilObjStyleSheet::getSyntaxStylePath());
10871093
}
10881094

components/ILIAS/Portfolio/Page/class.ilPortfolioPageGUI.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,6 @@ public function __construct(
8181
ilObjStyleSheet::getSyntaxStylePath()
8282
);
8383
$tpl->parseCurrentBlock();
84-
85-
$tpl->setCurrentBlock("ContentStyle");
86-
$tpl->setVariable(
87-
"LOCATION_CONTENT_STYLESHEET",
88-
ilObjStyleSheet::getContentStylePath(0)
89-
);
90-
$tpl->parseCurrentBlock();
91-
9284
$this->requested_ppage = $this->port_request->getPortfolioPageId();
9385
}
9486

components/ILIAS/Style/Content/Service/class.GUIService.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,9 @@ public function addCss(ilGlobalTemplateInterface $tpl, int $ref_id, int $obj_id
7979
$eff_style_id = $this->internal->domain()->object($ref_id, $obj_id)->getEffectiveStyleId();
8080
$tpl->addCss(ilObjStyleSheet::getContentStylePath($eff_style_id));
8181
}
82+
83+
public function addExportCss(ilGlobalTemplateInterface $tpl): void
84+
{
85+
$tpl->addCss(ilObjStyleSheet::getExportContentStylePath());
86+
}
8287
}

components/ILIAS/Style/Content/classes/class.ilObjStyleSheet.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1566,7 +1566,7 @@ public function getParametersOfClass(
15661566

15671567
public static function getExportContentStylePath(): string
15681568
{
1569-
return "content_style/style.css";
1569+
return "assets/content_style/style.css";
15701570
}
15711571

15721572
/**

components/ILIAS/Style/Content/classes/class.ilObjStyleSheetGUI.php

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -495,18 +495,16 @@ public function saveObject(): void
495495

496496
// assign style to style sheet folder,
497497
// if parent is style sheet folder
498-
if ($this->requested_ref_id > 0) {
499-
$fold = ilObjectFactory::getInstanceByRefId($this->requested_ref_id);
500-
if ($fold->getType() == "stys") {
501-
$cont_style_settings = new ilContentStyleSettings();
502-
$cont_style_settings->addStyle($newObj->getId());
503-
$cont_style_settings->update();
504-
505-
ilObjStyleSheet::_writeStandard($newObj->getId(), true);
506-
$this->tpl->setOnScreenMessage("success", $this->lng->txt("object_added"), true);
507-
$this->ctrl->setParameterByClass(self::class, "obj_id", (string) $newObj->getId());
508-
$this->ctrl->redirectByClass(self::class, "");
509-
}
498+
if ($this->requested_ref_id > 0 &&
499+
ilObject::_lookupType($this->requested_ref_id, true) === "stys") {
500+
$cont_style_settings = new ilContentStyleSettings();
501+
$cont_style_settings->addStyle($newObj->getId());
502+
$cont_style_settings->update();
503+
504+
ilObjStyleSheet::_writeStandard($newObj->getId(), true);
505+
$this->tpl->setOnScreenMessage("success", $this->lng->txt("object_added"), true);
506+
$this->ctrl->setParameterByClass(self::class, "obj_id", (string) $newObj->getId());
507+
$this->ctrl->redirectByClass(self::class, "");
510508
}
511509
}
512510

0 commit comments

Comments
 (0)