aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorMichaela Brückner <brueckner@data-quest.de>2023-10-17 08:33:27 +0000
committerMichaela Brückner <brueckner@data-quest.de>2023-10-17 08:33:27 +0000
commitd2e68c552c4a7ee2127cf8a4906481991c69ec2b (patch)
tree0e71ab25bb99db0a7061d4d3fa2aa05a0e55ee1f /app
parent7c3a4e24b811b4d6cc370503a7cf21cf513708b2 (diff)
Informationsseite Leichte Sprache bereitstellen, resolve Tic #3132
Merge request studip/studip!2125
Diffstat (limited to 'app')
-rw-r--r--app/controllers/siteinfo.php41
-rw-r--r--app/views/siteinfo/edit.php6
-rw-r--r--app/views/siteinfo/new.php5
3 files changed, 38 insertions, 14 deletions
diff --git a/app/controllers/siteinfo.php b/app/controllers/siteinfo.php
index 82aa8b5..86ab7e7 100644
--- a/app/controllers/siteinfo.php
+++ b/app/controllers/siteinfo.php
@@ -71,8 +71,16 @@ class SiteinfoController extends StudipController
if ($detail[2] == '') {
$detail[2] = _('unbenannt');
}
- Navigation::addItem('/footer/siteinfo/'.$detail[1].'/'.$detail[0],
- new Navigation($detail[2], $this->url_for('siteinfo/show/'.$detail[1].'/'.$detail[0])));
+
+ // check draft status and possibly hide site in navigation
+ if ($detail[3] == 1 && $GLOBALS['perm']->have_perm('root')) {
+
+ Navigation::addItem('/footer/siteinfo/'.$detail[1].'/'.$detail[0],
+ new Navigation($detail[2], $this->url_for('siteinfo/show/'.$detail[1].'/'.$detail[0])));
+ } else if ($detail[3] != 1) {
+ Navigation::addItem('/footer/siteinfo/'.$detail[1].'/'.$detail[0],
+ new Navigation($detail[2], $this->url_for('siteinfo/show/'.$detail[1].'/'.$detail[0])));
+ }
}
if ($action != 'new') {
@@ -127,6 +135,10 @@ class SiteinfoController extends StudipController
*/
public function show_action()
{
+ $draft_status = $this->si->get_detail_draft_status($this->currentdetail);
+ if ($draft_status == 1 && !$GLOBALS['perm']->have_perm('root')) {
+ throw new AccessDeniedException();
+ }
$this->output = $this->si->get_detail_content_processed($this->currentdetail);
}
@@ -148,10 +160,11 @@ class SiteinfoController extends StudipController
public function edit_action($givenrubric = null, $givendetail = null)
{
if (is_numeric($givendetail)) {
- $this->rubrics = $this->si->get_all_rubrics();
- $this->rubric_id = $this->si->rubric_for_detail($this->currentdetail);
- $this->detail_name = $this->si->get_detail_name($this->currentdetail);
- $this->content = $this->si->get_detail_content($this->currentdetail);
+ $this->rubrics = $this->si->get_all_rubrics();
+ $this->rubric_id = $this->si->rubric_for_detail($this->currentdetail);
+ $this->detail_name = $this->si->get_detail_name($this->currentdetail);
+ $this->content = $this->si->get_detail_content($this->currentdetail);
+ $this->draft_status = $this->si->get_detail_draft_status($this->currentdetail);
} else {
$this->edit_rubric = true;
$this->rubric_id = $this->currentrubric;
@@ -161,17 +174,19 @@ class SiteinfoController extends StudipController
public function save_action()
{
- $detail_name = Request::get('detail_name');
- $rubric_name = Request::get('rubric_name');
- $content = Request::get('content');
- $rubric_id = Request::int('rubric_id');
- $detail_id = Request::int('detail_id');
+ $detail_name = Request::get('detail_name');
+ $rubric_name = Request::get('rubric_name');
+ $content = Request::get('content');
+ $rubric_id = Request::int('rubric_id');
+ $detail_id = Request::int('detail_id');
+ $draft_status = Request::get('draft_status');
+
if ($rubric_id) {
if ($detail_id) {
- list($rubric, $detail) = $this->si->save('update_detail', compact('rubric_id', 'detail_name', 'content', 'detail_id'));
+ list($rubric, $detail) = $this->si->save('update_detail', compact('rubric_id', 'detail_name', 'content', 'detail_id', 'draft_status'));
} else {
if ($content) {
- list($rubric, $detail) = $this->si->save('insert_detail', compact('rubric_id', 'detail_name','content'));
+ list($rubric, $detail) = $this->si->save('insert_detail', compact('rubric_id', 'detail_name','content', 'draft_status'));
} else {
list($rubric, $detail) = $this->si->save('update_rubric', compact('rubric_id', 'rubric_name'));
}
diff --git a/app/views/siteinfo/edit.php b/app/views/siteinfo/edit.php
index 54bd8d2..00d4d6e 100644
--- a/app/views/siteinfo/edit.php
+++ b/app/views/siteinfo/edit.php
@@ -24,7 +24,6 @@ use Studip\Button, Studip\LinkButton;
<label>
<?= _('Rubrik-Zuordnung')?>
<select name="rubric_id">
-
<? foreach ($rubrics as $option): ?>
<option value="<?= htmlReady($option['rubric_id']) ?>" <? if ($currentrubric == $option['rubric_id']) echo 'selected'; ?>>
<?= htmlReady(language_filter($option['name'])) ?>
@@ -39,6 +38,11 @@ use Studip\Button, Studip\LinkButton;
</label>
<label>
+ <input type="checkbox" name="draft_status" id="draft_status" value="1" <?= $draft_status ? 'checked' : ''?>>
+ <?= _('Entwurfsmodus (nur sichtbar für root)') ?>
+ </label>
+
+ <label>
<?= _('Seiteninhalt')?>
<textarea style="height: 15em;" name="content" id="content" class="add_toolbar size-l wysiwyg"><?= wysiwygReady($content) ?></textarea>
</label>
diff --git a/app/views/siteinfo/new.php b/app/views/siteinfo/new.php
index fc59437..a2389f8 100644
--- a/app/views/siteinfo/new.php
+++ b/app/views/siteinfo/new.php
@@ -39,6 +39,11 @@ use Studip\Button, Studip\LinkButton;
</label>
<label>
+ <input type="checkbox" name="draft_status" id="draft_status" value="1" <?= $draft_status ? 'checked' : ''?>>
+ <?= _('Entwurfsmodus (nur sichtbar für root)') ?>
+ </label>
+
+ <label>
<?= _('Seiteninhalt') ?>
<textarea style="width: 90%;height: 15em;" name="content" id="content"></textarea><br>
</label>