Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eigene Seite inkludierbar über PAGE_CONTENT_HEADER #166

Merged
merged 11 commits into from
Feb 6, 2013
21 changes: 7 additions & 14 deletions redaxo/src/addons/mediapool/pages/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,6 @@
$sp->setHref(rex_url::backendPage($sp->getFullKey(), $arg_url));
}

// ----- EXTENSION POINT
$subline = rex_extension::registerPoint('PAGE_MEDIAPOOL_MENU', $subline,
array(
'subpage' => $subpage,
)
);

echo rex_view::title(rex_i18n::msg('pool_media'), $subline);

// -------------- Messages
Expand Down Expand Up @@ -185,11 +178,11 @@ function openPage(src)
<?php

// -------------- Include Page
switch ($subpage) {
case 'upload' : $file = 'upload.php'; break;
case 'structure' : $file = 'structure.php'; break;
case 'sync' : $file = 'sync.php'; break;
default : $file = 'media.php'; break;
$pageObj = rex_be_controller::getCurrentPageObject()->getPage();
if ($pageObj->hasSubPath()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

das hier find ich noch ein wenig ungeschickt... diese subPath Geschichte ist also ein Weg den der Core erlaubt, der aber nur in Addons funktioniert die dies hier mit diesen paar Zeilen Code dann auch immer vorsehen müssen?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ich finde es ok, dass Addons das explizit vorsehen müssen. Vor allem habe ich aber auch keine bessere Idee. :D
Die Addons haben über ihre Page nun mal die Kontrolle, daher müssen sie ja irgendwas machen, damit dann die Subpage auch eingebunden wird…

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vllt vom Namen her nochn vorschlag: hasFixedSubPath oder hasOverriddenSubPath oder hasPathOverride

require $pageObj->getSubPath();
} elseif (in_array($subpage, array('upload', 'structure', 'sync'))) {
require __DIR__ . '/' . $subpage . '.php';
} else {
require __DIR__ . '/media.php';
}

require __DIR__ . '/' . $file;
2 changes: 1 addition & 1 deletion redaxo/src/addons/metainfo/functions/function_metainfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ function rex_metainfo_extensions_handler($params)

// include extensions
$curDir = __DIR__ . '/..';
if ($page == 'content' && $mode == 'meta') {
if ($page == 'content/meta') {
require_once $curDir . '/lib/handler/article_handler.php';
} elseif ($page == 'structure') {
require_once $curDir . '/lib/handler/category_handler.php';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ function rex_structure_searchbar()
$structureUrl = 'index.php?page=structure&category_id=%s&clang=%s&be_search_article_name=%s';

// ------------ globale Parameter
$mode = rex_request('mode', 'string');
$category_id = rex_request('category_id', 'int');
$article_id = rex_request('article_id', 'int');
$clang = rex_request('clang', 'int');
Expand Down Expand Up @@ -146,7 +145,7 @@ function rex_structure_searchbar()
$select_name = 'category_id';
$add_homepage = true;
$article_id_input = '';
if ($mode == 'edit' || $mode == 'meta') {
if (rex_be_controller::getCurrentPagePart(1) == 'content') {
$select_name = 'article_id';
$add_homepage = false;
$article_id_input = '
Expand All @@ -164,7 +163,6 @@ function rex_structure_searchbar()
' <div class="rex-form">
<form action="' . rex_url::currentBackendPage() . '" method="post">
<fieldset>
<input type="hidden" name="mode" value="' . $mode . '" />
<input type="hidden" name="category_id" value="' . $category_id . '" />' . $article_id_input . '
<input type="hidden" name="clang" value="' . $clang . '" />
<input type="hidden" name="ctype" value="' . $ctype . '" />
Expand Down
6 changes: 6 additions & 0 deletions redaxo/src/addons/structure/plugins/content/boot.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
$page->setRequiredPermissions('structure/hasStructurePerm');
$page->setHidden(true);
$page->setPath($this->getPath('pages/content.php'));
$subpage = new rex_be_page('edit', rex_i18n::msg('edit_mode'));
$page->addSubPage($subpage);
$subpage = new rex_be_page('meta', rex_i18n::msg('metadata'));
$page->addSubPage($subpage);
$subpage = new rex_be_page('actions', rex_i18n::msg('metafuncs'));
$page->addSubPage($subpage);
$pages[] = new rex_be_page_main('system', $page);

$page = new rex_be_page('templates', rex_i18n::msg('templates'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,14 @@ private function getSliceMenu(rex_sql $artDataSql)
$moduleName = rex_i18n::translate($artDataSql->getValue(rex::getTablePrefix() . 'module.name'));


$sliceUrl = 'index.php?page=content&amp;article_id=' . $this->article_id . '&amp;mode=edit&amp;slice_id=' . $sliceId . '&amp;clang=' . $this->clang . '&amp;ctype=' . $this->ctype . '%s#slice' . $sliceId;
$context = new rex_context(array(
'page' => rex_be_controller::getCurrentPage(),
'article_id' => $this->article_id,
'slice_id' => $sliceId,
'clang' => $this->clang,
'ctype' => $this->ctype
));
$fragment = '#slice' . $sliceId;
$listElements = array();

if (rex::getUser()->getComplexPerm('modules')->hasPerm($moduleId)
Expand All @@ -127,15 +134,15 @@ private function getSliceMenu(rex_sql $artDataSql)
// edit
$n = array();
$n['title'] = '<span class="rex-visuallyhidden">' . rex_i18n::msg('module') . ' ' . $moduleName . ' </span>' . rex_i18n::msg('edit');
$n['href'] = sprintf($sliceUrl, '&amp;function=edit');
$n['href'] = $context->getUrl(array('function' => 'edit')) . $fragment;
$n['itemClasses'] = array('rex-slice-edit');
$n['linkClasses'] = array('rex-slice-edit');
$listElements[] = $n;

// delete
$n = array();
$n['title'] = '<span class="rex-visuallyhidden">' . rex_i18n::msg('module') . ' ' . $moduleName . ' </span>' . rex_i18n::msg('delete');
$n['href'] = sprintf($sliceUrl, '&amp;function=delete&amp;save=1');
$n['href'] = $context->getUrl(array('function' => 'delete', 'save' => 1)) . $fragment;
$n['itemClasses'] = array('rex-slice-delete');
$n['linkClasses'] = array('rex-slice-delete');
$n['linkAttr'] = array('data-confirm' => rex_i18n::msg('delete') . ' ?');
Expand All @@ -147,15 +154,15 @@ private function getSliceMenu(rex_sql $artDataSql)
// moveup
$n = array();
$n['title'] = '<span class="rex-visuallyhidden">' . rex_i18n::msg('module') . ' ' . $moduleName . ' </span>' . rex_i18n::msg('move_slice_up');
$n['href'] = sprintf($sliceUrl, '&amp;upd=' . time() . '&amp;rex-api-call=content_move_slice&amp;direction=moveup');
$n['href'] = $context->getUrl(array('upd' => time(), 'rex-api-call' => 'content_move_slice', 'direction' => 'moveup')) . $fragment;
$n['itemClasses'] = array('rex-slice-move-up');
$n['linkClasses'] = array('rex-slice-move-up');
$listElements[] = $n;

// movedown
$n = array();
$n['title'] = '<span class="rex-visuallyhidden">' . rex_i18n::msg('module') . ' ' . $moduleName . ' </span>' . rex_i18n::msg('move_slice_down');
$n['href'] = sprintf($sliceUrl, '&amp;upd=' . time() . '&amp;rex-api-call=content_move_slice&amp;direction=movedown');
$n['href'] = $context->getUrl(array('upd' => time(), 'rex-api-call' => 'content_move_slice', 'direction' => 'movedown')) . $fragment;
$n['itemClasses'] = array('rex-slice-move-down');
$n['linkClasses'] = array('rex-slice-move-down');
$listElements[] = $n;
Expand Down Expand Up @@ -223,7 +230,6 @@ private function getModuleSelect($sliceId)
<legend><span>' . rex_i18n::msg('add_block') . '</span></legend>
<input type="hidden" name="page" value="content" />
<input type="hidden" name="article_id" value="' . $this->article_id . '" />
<input type="hidden" name="mode" value="' . $this->mode . '" />
<input type="hidden" name="clang" value="' . $this->clang . '" />
<input type="hidden" name="ctype" value="' . $this->ctype . '" />
<input type="hidden" name="slice_id" value="' . $sliceId . '" />
Expand Down Expand Up @@ -369,7 +375,7 @@ protected function addSlice($sliceId, $moduleIdToAdd)
<section class="rex-slice rex-slice-add">

<div class="rex-form">
<form action="' . rex_url::currentBackendPage(array('article_id' => $this->article_id, 'mode' => $this->mode, 'slice_id' => $sliceId, 'clang' => $this->clang, 'ctype' => $this->ctype)) . '#slice' . $sliceId . '" method="post" id="REX_FORM" enctype="multipart/form-data">
<form action="' . rex_url::currentBackendPage(array('article_id' => $this->article_id, 'slice_id' => $sliceId, 'clang' => $this->clang, 'ctype' => $this->ctype)) . '#slice' . $sliceId . '" method="post" id="REX_FORM" enctype="multipart/form-data">

<header class="rex-slice-header">
' . $slice_header . '
Expand Down Expand Up @@ -437,7 +443,7 @@ protected function editSlice($RE_CONTS, $RE_MODUL_IN, $RE_CTYPE, $RE_MODUL_ID)

$slice_content = '
<div class="rex-form">
<form enctype="multipart/form-data" action="' . rex_url::currentBackendPage(array('article_id' => $this->article_id, 'mode' => $this->mode, 'slice_id' => $RE_CONTS, 'ctype' => $RE_CTYPE, 'clang' => $this->clang)) . '#slice' . $RE_CONTS . '" method="post" id="REX_FORM">
<form enctype="multipart/form-data" action="' . rex_url::currentBackendPage(array('article_id' => $this->article_id, 'slice_id' => $RE_CONTS, 'ctype' => $RE_CTYPE, 'clang' => $this->clang)) . '#slice' . $RE_CONTS . '" method="post" id="REX_FORM">

<section class="rex-slice-content">
<fieldset class="rex-form-col-1">
Expand Down