Commit f9244a87 authored by Kasper Skårhøj's avatar Kasper Skårhøj
Browse files

* Added possibility of jumping directly to editing a page in the backend. You specify "alt_main.php?edit=[page id]" and you will be brought directly to the page edit module.


git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@217 709f56b5-9817-0410-a4d7-c38de5d9e867
parent 76713c92
2004-04-23 Kasper Skårhøj,,, <kasper@typo3.com>
* Added possibility of jumping directly to editing a page in the backend. You specify "alt_main.php?edit=[page id]" and you will be brought directly to the page edit module.
2004-04-22 Kasper Skårhøj,,, <kasper@typo3.com>
* Added in RTE link box: Searched *into* Content ELements of type Text and Text w/Image after anchors (<a name="...">) and lists them as well with content elements to which an anchor link can be made.
......
......@@ -122,7 +122,6 @@ TCEforms:
- Group-fields of DB-type could be made to actually SHOW the records it contains in the very same form! Possibly with Add/Delete facilities.
- See JH mail: Message-ID: <C018FF617C61AB4588D15494126A5C0F23E410@Soulman.hanno-kirchhoff.de>
- IFRAME alternative for Element Browser.
- Like in CB: Copy image/reference from a record to clipboard, then insert that file/reference in another record again (Element Browser change).
- set the width of the selector field(s)
- INPUT type:
- having a selectorbox from which a default value can be selected (which is just transferred to the input field). Of course the selectorbox can have its content added by a PHP script.
......@@ -207,6 +206,7 @@ Web>List:
File>List:
- BUG: UNIX: "RW" flag looks only on the permissions for the USER - not the group. So even if PHP via the group of a file can delete it, it is reported that it cannot.
- Adding possibility to show files recursively (more levels), filter on a file name, search file content
History/Undo:
- Must present a page/content element view, so a page with content elements can be restored as a whole
......
......@@ -524,6 +524,46 @@ class t3lib_BEfunc {
return $output;
}
/**
* Opens the page tree to the specified page id
*
* @param integer Page id.
* @param boolean If set, then other open branches are closed.
* @return void
*/
function openPageTree($pid,$clearExpansion) {
global $BE_USER;
// Get current expansion data:
if ($clearExpansion) {
$expandedPages = array();
} else {
$expandedPages = unserialize($BE_USER->uc['browseTrees']['browsePages']);
}
// Get rootline:
$rL = t3lib_BEfunc::BEgetRootLine($pid);
// First, find out what mount index to use (if more than one DB mount exists):
$mountIndex = 0;
$mountKeys = array_flip($BE_USER->returnWebmounts());
foreach($rL as $rLDat) {
if (isset($mountKeys[$rLDat['uid']])) {
$mountIndex = $mountKeys[$rLDat['uid']];
break;
}
}
// Traverse rootline and open paths:
foreach($rL as $rLDat) {
$expandedPages[$mountIndex][$rLDat['uid']] = 1;
}
// Write back:
$BE_USER->uc['browseTrees']['browsePages'] = serialize($expandedPages);
$BE_USER->writeUC();
}
/**
* Returns the path (visually) of a page $uid, fx. "/First page/Second page/Another subpage"
* Each part of the path will be limited to $titleLimit characters
......
......@@ -26,6 +26,7 @@
***************************************************************/
/**
* Main frameset of the TYPO3 backend
* Sending the GET var "alt_main.php?edit=[page id]" will load the page id in the editing module configured.
*
* $Id$
* Revised for TYPO3 3.6 2/2003 by Kasper Skaarhoj
......@@ -54,7 +55,7 @@ require ('template.php');
require_once (PATH_t3lib.'class.t3lib_loadmodules.php');
require_once (PATH_t3lib.'class.t3lib_basicfilefunc.php');
require_once ('class.alt_menu_functions.inc');
include ('sysext/lang/locallang_misc.php');
/**
......@@ -108,11 +109,15 @@ class SC_alt_main {
function generateJScode() {
global $BE_USER,$LANG;
$pt3=t3lib_div::dirname(t3lib_div::getIndpEnv('SCRIPT_NAME')).'/';
$pt3 = t3lib_div::dirname(t3lib_div::getIndpEnv('SCRIPT_NAME')).'/';
$goToModule_switch = $this->alt_menuObj->topMenu($this->loadModules->modules,0,"",4);
$fsMod = implode(chr(10),$this->alt_menuObj->fsMod);
$this->mainJScode='
// If another page module was specified, replace the default Page module with the new one
$newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
$pageModule = t3lib_BEfunc::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
$this->mainJScode = '
/**
* Function similar to PHPs rawurlencode();
*/
......@@ -225,6 +230,20 @@ class SC_alt_main {
top.topmenuFrame.location = url;
}
/**
* Loads a page id for editing in the page edit module:
*/
function loadEditId(id) { //
top.fsMod.recentIds["web"]=id;
top.fsMod.navFrameHighlightedID["web"]="pages"+id+"_0"; // For highlighting
if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) {
top.content.nav_frame.refresh_nav();
}
top.goToModule("'.$pageModule.'");
}
/**
* Returns incoming URL (to a module) unless nextLoadModuleUrl is set. If that is the case nextLoadModuleUrl is returned (and cleared)
* Used by the shortcut frame to set a "intermediate URL"
......@@ -294,7 +313,62 @@ class SC_alt_main {
// Used by Frameset Modules
var condensedMode = '.($BE_USER->uc['condensedMode']?1:0).';
var currentSubScript = "";
';
// Check editing of page:
$this->editPageHandling();
}
/**
* Checking if the "&edit" variable was sent so we can open for editing the page.
* Code based on code from "alt_shortcut.php"
*
* @return void
*/
function editPageHandling() {
global $BE_USER;
if (!t3lib_extMgm::isLoaded('cms')) return;
// EDIT page:
$editId = ereg_replace('[^[:alnum:]_]','',t3lib_div::_GET('edit'));
$theEditRec = '';
if ($editId) {
// Looking up the page to edit, checking permissions:
$where = ' AND ('.$BE_USER->getPagePermsClause(2).' OR '.$BE_USER->getPagePermsClause(16).')';
if (t3lib_div::testInt($editId)) {
$theEditRec = t3lib_BEfunc::getRecord('pages',$editId,'*',$where);
} else {
$records = t3lib_BEfunc::getRecordsByField('pages','alias',$editId,$where);
if (is_array($records)) {
reset($records);
$theEditRec = current($records);
}
}
// If the page was accessible, then let the user edit it.
if (is_array($theEditRec) && $BE_USER->isInWebMount($theEditRec['uid'])) {
// Setting JS code to open editing:
$this->mainJScode.='
// Load page to edit:
window.setTimeout("top.loadEditId('.intval($theEditRec['uid']).');",500);
';
// Checking page edit parameter:
if(!$BE_USER->getTSConfigVal('options.shortcut_onEditId_dontSetPageTree')) {
// Expanding page tree:
t3lib_BEfunc::openPageTree(intval($theEditRec['pid']),!$BE_USER->getTSConfigVal('options.shortcut_onEditId_keepExistingExpanded'));
}
} else {
$this->mainJScode.='
// Warning about page editing:
alert('.$GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->getLL('noEditPage'),$editId)).');
';
}
}
}
/**
......
......@@ -103,6 +103,7 @@ class SC_alt_shortcut {
var $editLoaded; // Flag for defining whether we are editing
var $editError; // Can contain edit error message
var $editPath; // Set to the record path of the record being edited.
var $editSC_rec; // Holds the shortcut record when editing
var $theEditRec; // Page record to be edited
var $editPage; // Page alias or id to be edited
......@@ -199,10 +200,6 @@ class SC_alt_shortcut {
function init() {
global $BACK_PATH;
// If another page module was specified, replace the default Page module with the new one
$newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
$pageModule = t3lib_BEfunc::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
$this->doc = t3lib_div::makeInstance('template');
$this->doc->backPath = $BACK_PATH;
$this->doc->form='<form action="alt_shortcut.php" name="shForm" method="post">';
......@@ -225,16 +222,6 @@ class SC_alt_shortcut {
function submitEditPage(id) { //
document.location="alt_shortcut.php?editPage="+top.rawurlencode(id);
}
function loadEditId(id) { //
top.fsMod.recentIds["web"]=id;
top.fsMod.navFrameHighlightedID["web"]="pages"+id+"_0"; // For highlighting
if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) {
top.content.nav_frame.refresh_nav();
}
top.goToModule("'.$pageModule.'");
}
');
$this->content.=$this->doc->startPage('Shortcut frame');
}
......@@ -313,7 +300,7 @@ class SC_alt_shortcut {
if (!$this->editLoaded && t3lib_extMgm::isLoaded('cms')) {
$editIdCode = '<td nowrap="nowrap">'.$LANG->getLL('shortcut_editID',1).': <input type="text" value="'.($this->editError?htmlspecialchars($this->editPage):'').'" name="editPage"'.$this->doc->formWidth(5).' onchange="submitEditPage(this.value);" />'.
($this->editError?'&nbsp;<strong><span class="typo3-red">'.htmlspecialchars($this->editError).'</span></strong>':'').
(is_array($this->theEditRec)?'&nbsp;<strong>'.$LANG->getLL('shortcut_loadEdit',1).' \''.t3lib_BEfunc::getRecordTitle('pages',$this->theEditRec,1).'\'</strong>':'').
(is_array($this->theEditRec)?'&nbsp;<strong>'.$LANG->getLL('shortcut_loadEdit',1).' \''.t3lib_BEfunc::getRecordTitle('pages',$this->theEditRec,1).'\'</strong> ('.htmlspecialchars($this->editPath).')':'').
'</td>';
} else $editIdCode='';
......@@ -333,7 +320,7 @@ class SC_alt_shortcut {
';
if ($this->theEditRec['uid']) {
$this->content.=$this->doc->wrapScriptTags('loadEditId('.$this->theEditRec['uid'].');');
$this->content.=$this->doc->wrapScriptTags('top.loadEditId('.$this->theEditRec['uid'].');');
}
}
......@@ -410,10 +397,10 @@ class SC_alt_shortcut {
// EDIT page:
$this->editPage = trim(strtolower($this->editPage));
$this->editError='';
$this->theEditRec='';
$this->editError = '';
$this->theEditRec = '';
if ($this->editPage) {
$where=' AND ('.$BE_USER->getPagePermsClause(2).' OR '.$BE_USER->getPagePermsClause(16).')';
$where = ' AND ('.$BE_USER->getPagePermsClause(2).' OR '.$BE_USER->getPagePermsClause(16).')';
if (t3lib_div::testInt($this->editPage)) {
$this->theEditRec = t3lib_BEfunc::getRecord ('pages',$this->editPage,'*',$where);
} else {
......@@ -426,17 +413,16 @@ class SC_alt_shortcut {
if (!is_array($this->theEditRec) || !$BE_USER->isInWebMount($this->theEditRec['uid'])) {
unset($this->theEditRec);
$this->editError=$LANG->getLL('shortcut_notEditable');
} elseif(!$BE_USER->getTSConfigVal('options.shortcut_onEditId_dontSetPageTree')) {
$expandedPages=unserialize($BE_USER->uc['browseTrees']['browsePages']);
if (!$BE_USER->getTSConfigVal('options.shortcut_onEditId_keepExistingExpanded')) $expandedPages=array();
$rL=t3lib_BEfunc::BEgetRootLine($this->theEditRec['pid']);
reset($rL);
while(list(,$rLDat)=each($rL)) {
$expandedPages[0][$rLDat['uid']]=1;
// debug($rLDat['uid']);
} else {
// Visual path set:
$perms_clause = $BE_USER->getPagePermsClause(1);
$this->editPath = t3lib_BEfunc::getRecordPath($this->theEditRec['pid'], $perms_clause, 30);
if(!$BE_USER->getTSConfigVal('options.shortcut_onEditId_dontSetPageTree')) {
// Expanding page tree:
t3lib_BEfunc::openPageTree($this->theEditRec['pid'],!$BE_USER->getTSConfigVal('options.shortcut_onEditId_keepExistingExpanded'));
}
$BE_USER->uc['browseTrees']['browsePages'] = serialize($expandedPages);
$BE_USER->writeUC();
}
}
}
......
......@@ -40,6 +40,7 @@ $LOCAL_LANG = Array (
'CM_newWizard' => '\'Create New\' wizard',
'CM_editPageHeader' => 'Edit page header',
'CM_db_list' => 'Web>List module',
'noEditPage' => 'You asked to edit page "%s" but you cannot edit this page. Now loading backend as usual.',
),
'dk' => Array (
'shortcut_edit' => 'Rediger',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment