commit 3abebc108ed86acec59290235989d53c653067ca
parent 41b0504c5f3906b3c6b93bdbff0114a242737b76
Author: Jan Dankert <devnull@localhost>
Date: Mon, 7 Nov 2011 01:26:13 +0100
Refactoring: Verzicht auf \"write=true\" in der Action-Konfiguration. Bei HTTP-POST wird immer von einem Action-Request ausgegangen.
Diffstat:
20 files changed, 64 insertions(+), 132 deletions(-)
diff --git a/action/FileAction.class.php b/action/FileAction.class.php
@@ -95,7 +95,7 @@ class FileAction extends ObjectAction
* Abspeichern der Eigenschaften zu dieser Datei.
*
*/
- function saveprop()
+ function propAction()
{
// Eigenschaften speichern
$this->file->filename = $this->getRequestVar('filename' ,OR_FILTER_FILENAME);
@@ -114,7 +114,7 @@ class FileAction extends ObjectAction
* Anzeigen des Inhaltes, der Inhalt wird samt Header direkt
* auf die Standardausgabe geschrieben
*/
- function show()
+ function showView()
{
$this->setTemplateVar('preview_url',Html::url('file','preview',$this->file->objectid,array('target'=>'none') ) );
}
@@ -124,7 +124,7 @@ class FileAction extends ObjectAction
* Anzeigen des Inhaltes, der Inhalt wird samt Header direkt
* auf die Standardausgabe geschrieben
*/
- function preview()
+ function previewView()
{
$this->lastModified( $this->file->lastchangeDate );
@@ -296,7 +296,7 @@ class FileAction extends ObjectAction
}
- function prop()
+ function propView()
{
global $conf;
@@ -337,7 +337,7 @@ class FileAction extends ObjectAction
/**
* Anzeigen des Inhaltes
*/
- function edit()
+ function editView()
{
global $conf;
// MIME-Types aus Datei lesen
diff --git a/action/FolderAction.class.php b/action/FolderAction.class.php
@@ -411,7 +411,7 @@ class FolderAction extends ObjectAction
* Es werden alle ausgew�hlten Dateien nochmal angezeigt.
* Abh�ngig von der ausgew�hlten Aktion wird eine weitere Auswahl ben�tigt.
*/
- function edit()
+ function editView()
{
$type = $this->getRequestVar('type'); // Typ der Aktion, z.B "copy" oder "move"
@@ -937,7 +937,7 @@ class FolderAction extends ObjectAction
* Anzeige aller Objekte in diesem Ordner.
* @return unknown_type
*/
- function show()
+ function showView()
{
global $conf_php;
diff --git a/action/GroupAction.class.php b/action/GroupAction.class.php
@@ -170,7 +170,7 @@ class GroupAction extends Action
/**
* Liste aller Gruppen.
*/
- function listing()
+ function listingView()
{
$list = array();
diff --git a/action/LanguageAction.class.php b/action/LanguageAction.class.php
@@ -162,7 +162,7 @@ class LanguageAction extends Action
/**
* Speichern der Sprache
*/
- function save()
+ function editAction()
{
global $conf;
@@ -184,7 +184,7 @@ class LanguageAction extends Action
- function listing()
+ function listingView()
{
global $conf;
$countryList = $conf['countries'];
@@ -229,7 +229,7 @@ class LanguageAction extends Action
- function edit()
+ function editView()
{
global $conf;
$countryList = $conf['countries'];
diff --git a/action/LinkAction.class.php b/action/LinkAction.class.php
@@ -104,7 +104,7 @@ class LinkAction extends ObjectAction
/**
* Abspeichern der Eigenschaften
*/
- function saveprop()
+ function propAction()
{
// Wenn Name gefuellt, dann Datenbank-Update
if ( $this->getRequestVar('name') != '' )
@@ -123,7 +123,7 @@ class LinkAction extends ObjectAction
/**
* Abspeichern der Eigenschaften
*/
- function save()
+ function editAction()
{
if( $this->getRequestVar('type') != '' )
{
@@ -153,14 +153,8 @@ class LinkAction extends ObjectAction
}
- function showprop()
- {
- $this->setTemplateVars( $this->link->getProperties() );
- }
-
-
- function edit()
+ function editView()
{
$this->setTemplateVars( $this->link->getProperties() );
@@ -194,7 +188,7 @@ class LinkAction extends ObjectAction
- function prop()
+ function propView()
{
$this->setTemplateVars( $this->link->getProperties() );
$this->setTemplateVar('act_linkobjectid',$this->link->linkedObjectId);
diff --git a/action/ModelAction.class.php b/action/ModelAction.class.php
@@ -131,7 +131,7 @@ class ModelAction extends Action
// Speichern eines Modells
- function save()
+ function editAction()
{
if ( $this->getRequestVar('name') != '' )
{
@@ -159,7 +159,7 @@ class ModelAction extends Action
}
- function listing()
+ function listingView()
{
global $conf_php;
$actModel = Session::getProjectModel();
@@ -193,7 +193,7 @@ class ModelAction extends Action
* Bearbeiten der Variante.
* Ermitteln aller Eigenschaften der Variante.
*/
- function edit()
+ function editView()
{
$this->model->load();
diff --git a/action/ObjectAction.class.php b/action/ObjectAction.class.php
@@ -196,7 +196,7 @@ class ObjectAction extends Action
/**
* Alle Rechte anzeigen
*/
- function rights()
+ function rightsView()
{
// $this->actionName = 'object';
$o = Session::getObject();
diff --git a/action/PageAction.class.php b/action/PageAction.class.php
@@ -57,7 +57,7 @@ class PageAction extends ObjectAction
/**
* Alle Daten aus dem Formular speichern
*/
- function saveform()
+ function formAction()
{
$this->page->public = true;
$this->page->simple = true;
@@ -146,7 +146,7 @@ class PageAction extends ObjectAction
*
* Der Inhalt eines Elementes wird abgespeichert
*/
- function elsave()
+ function elAction()
{
$value = new Value();
$language = Session::getProjectLanguage();
@@ -317,7 +317,6 @@ class PageAction extends ObjectAction
else
{
$this->addValidationError('name');
- //$this->callSubAction('prop');
}
}
@@ -458,7 +457,7 @@ class PageAction extends ObjectAction
/**
* Alle Elemente der Seite anzeigen
*/
- function el()
+ function elView()
{
$this->page->public = true;
$this->page->simple = true;
@@ -494,7 +493,7 @@ class PageAction extends ObjectAction
/**
* Alle editierbaren Felder in einem Formular bereitstellen
*/
- function form()
+ function formView()
{
global $conf_php;
@@ -593,7 +592,7 @@ class PageAction extends ObjectAction
/**
* Seite anzeigen
*/
- function show()
+ function showView()
{
$this->setTemplateVar('preview_url',Html::url('page','preview',$this->page->objectid,array('target'=>'none') ) );
}
@@ -601,7 +600,7 @@ class PageAction extends ObjectAction
/**
* Seite anzeigen
*/
- function preview()
+ function previewView()
{
Logger::debug("preview von seite");
// Seite definieren
@@ -632,7 +631,7 @@ class PageAction extends ObjectAction
*
* Bei editierbaren Feldern wird ein Editor-Ikon vorangestellt.
*/
- function edit()
+ function editView()
{
// Editier-Icons anzeigen
$this->page->icons = true;
diff --git a/action/PageAction.ini.php b/action/PageAction.ini.php
@@ -22,20 +22,12 @@ direct=true
menu=elements
[form]
-target=saveform
-menu=elements
[pub]
menu=pub
write=true
-[saveform]
-goto=el
-
[prop]
-menu=prop
-write=true
-target=prop
editable=true
[changetemplate]
@@ -71,10 +63,3 @@ goto=rights
goto=rights
-[menu]
-menu=show,pub,el,prop,src,rights
-pub=show,pub,el,form,rights,prop,changetemplate,src
-elements=show,pub,el,form,rights,prop,changetemplate,src
-rights=show,pub,el,form,rights,prop,changetemplate,src
-src=show,pub,el,form,rights,prop,changetemplate,src
-prop=show,pub,el,form,rights,prop,changetemplate,src-
\ No newline at end of file
diff --git a/action/ProfileAction.class.php b/action/ProfileAction.class.php
@@ -230,17 +230,14 @@ class ProfileAction extends Action
if ( ! $this->user->checkPassword( $this->getRequestVar('act_password') ) )
{
$this->addValidationError('act_password');
- $this->callSubAction('pwchange');
}
elseif ( $this->getRequestVar('password1') == '' )
{
$this->addValidationError('password1');
- $this->callSubAction('pwchange');
}
elseif ( $this->getRequestVar('password1') != $this->getRequestVar('password2') )
{
$this->addValidationError('password2','PASSWORDS_DO_NOT_MATCH');
- $this->callSubAction('pwchange');
}
else
{
diff --git a/action/ProjectAction.class.php b/action/ProjectAction.class.php
@@ -43,6 +43,7 @@ class ProjectAction extends Action
function editAction()
{
+ sleep(2);
if ( $this->getRequestVar('name') != '')
{
$this->project->name = $this->getRequestVar('name' ,OR_FILTER_ALPHANUM);
@@ -121,7 +122,7 @@ class ProjectAction extends Action
* Liste aller Projekte anzeigen.
*
*/
- function listing()
+ function listingView()
{
global $conf_php;
@@ -287,7 +288,7 @@ class ProjectAction extends Action
- function info()
+ function infoView()
{
$this->setTemplateVar( 'info', $this->project->info() );
}
diff --git a/action/SearchAction.class.php b/action/SearchAction.class.php
@@ -177,7 +177,7 @@ class SearchAction extends Action
* Durchf?hren der Suche
* und Anzeige der Ergebnisse
*/
- function quicksearch()
+ function quicksearchView()
{
global $conf;
diff --git a/action/TemplateAction.class.php b/action/TemplateAction.class.php
@@ -416,7 +416,7 @@ class TemplateAction extends Action
/**
* Voransicht einer Vorlage
*/
- function show()
+ function showView()
{
$text = $this->template->src;
diff --git a/action/TitleAction.class.php b/action/TitleAction.class.php
@@ -28,7 +28,7 @@ class TitleAction extends Action
/**
* Fuellen der Variablen und Anzeigen der Titelleiste
*/
- function show()
+ function showView()
{
$this->setTemplateVar('buildinfo',OR_TITLE.' '.OR_VERSION.' - build '.config('build','build') );
@@ -92,7 +92,7 @@ class TitleAction extends Action
}
- public function history()
+ public function historyView()
{
$resultList = array();
diff --git a/action/TreeAction.class.php b/action/TreeAction.class.php
@@ -221,7 +221,7 @@ class TreeAction extends Action
/**
* Anzeigen des Baumes
*/
- public function show()
+ public function showView()
{
//if ( $this->hasRequestVar('projectid') )
$this->load();
@@ -258,7 +258,7 @@ class TreeAction extends Action
/**
* Anzeigen des Baumes fuer asynchrone Anfragen.
*/
- function loadEntry()
+ public function loadEntryView()
{
$this->tree = Session::getTree();
@@ -271,7 +271,7 @@ class TreeAction extends Action
/**
* Anzeigen des Baumes fuer asynchrone Anfragen.
*/
- function loadBranch()
+ public function loadBranchView()
{
$this->tree = Session::getTree();
@@ -314,7 +314,7 @@ class TreeAction extends Action
/**
* Projekt-Einstellungen anzeigen.
*/
- public function settings()
+ public function settingsView()
{
$this->setTemplateVar( 'languages' ,Language::getAll() );
$this->setTemplateVar( 'languageid',Session::getProjectLanguage()->languageid );
diff --git a/action/UserAction.class.php b/action/UserAction.class.php
@@ -209,7 +209,7 @@ class UserAction extends Action
- function listing()
+ function listingView()
{
$list = array();
diff --git a/action/WorkbenchAction.class.php b/action/WorkbenchAction.class.php
@@ -28,7 +28,7 @@ class WorkbenchAction extends Action
/**
* Ersetzt den Inhalt mit einer anderen Datei
*/
- public function show()
+ public function showView()
{
global $viewconfig;
$viewconfig = parse_ini_file('themes/default/layout/perspective/'.$this->perspective.'.ini.php',true);
diff --git a/dispatcher.php b/dispatcher.php
@@ -160,52 +160,23 @@ if ( is_object( $db ) )
$db->start();
}
-// Aktualisiere die aktuellen Views
-$views = Session::get('views');
+if ( !empty($REQ[REQ_PARAM_ACTION]) )
+ $action = $REQ[REQ_PARAM_ACTION];
+else
+ $action = 'login';
-if ( !is_array($views) )
-{
- $views = array( 'tree' => null,
- 'header' => array('action'=>'title','subaction'=>'show' ),
- 'content'=> array('action'=>'login','subaction'=>'login') );
-}
+Session::set('action',$action);
-// Wenn 'target' übergeben wurde und als View bekannt ist
-if ( isset($REQ[REQ_PARAM_TARGET])
- && array_key_exists($REQ[REQ_PARAM_TARGET],$views)
- && !empty($REQ[REQ_PARAM_ACTION])
- )
-{
- // Mit der aktuellen Aktion die Views aktualisieren.
- $views[$REQ[REQ_PARAM_TARGET]] = array('action'=>$REQ[REQ_PARAM_ACTION],'subaction'=>$REQ[REQ_PARAM_SUBACTION]);
-}
-// Action und Subaction aus der View-Konfiguration ermitteln.
-if ( !empty($REQ[REQ_PARAM_TARGET]) && array_key_exists($REQ[REQ_PARAM_TARGET],$views) )
-{
- $view = $REQ[REQ_PARAM_TARGET];
- $action = $views[$view]['action' ];
- $subaction = $views[$view]['subaction'];
-}
+if ( !empty( $REQ[REQ_PARAM_SUBACTION] ) )
+ $subaction = $REQ[REQ_PARAM_SUBACTION];
else
{
- if ( !empty($REQ[REQ_PARAM_ACTION]) )
- $action = $REQ[REQ_PARAM_ACTION];
- else
- $action = 'login';
-
- Session::set('action',$action);
-
- if ( !empty( $REQ[REQ_PARAM_SUBACTION] ) )
- $subaction = $REQ[REQ_PARAM_SUBACTION];
+ $sl = Session::getSubaction();
+ if ( is_array($sl) && isset($sl[$action]) )
+ $subaction = $sl[$action];
else
- {
- $sl = Session::getSubaction();
- if ( is_array($sl) && isset($sl[$action]) )
- $subaction = $sl[$action];
- else
- $subaction = '';
- }
-}
+ $subaction = '';
+}
require( OR_ACTIONCLASSES_DIR.'/Action.class.php' );
require( OR_ACTIONCLASSES_DIR.'/ObjectAction.class.php' );
@@ -252,12 +223,6 @@ if ( !isset($do->actionConfig[$subaction]) )
$subactionConfig = $do->actionConfig[$subaction];
-if ( isset($subactionConfig['clear'] ) )
-{
- foreach( explode(',',$subactionConfig['clear']) as $clearView )
- if ( isset($views[$clearView]) )
- $views[$clearView] = null;
-}
// Eine Subaktion ohne "guest=true" verlangt einen angemeldeten Benutzer.
if ( !isset($subactionConfig['guest']) || !$subactionConfig['guest'] )
@@ -298,21 +263,16 @@ if ( isset($do->actionConfig[$do->subActionName]['alias']) )
}
-$isAction = ( ( isset($sConf['write'])
- && ( $_SERVER['REQUEST_METHOD'] == 'POST'
- || $sConf['write']=='get') )
- || @$sConf['call']
- || isset($conf['action'][$actionClassName][$subaction]['direct'] ) );
+$isAction = $_SERVER['REQUEST_METHOD'] == 'POST' || (isset($sConf['write']) && $sConf['write']=='get');
+// || @$sConf['call']
+// || isset($conf['action'][$actionClassName][$subaction]['direct'] ) );
-if ( isset($do->actionConfig[$do->subActionName]['write']) )
- if ( $isAction )
- $subactionMethodName = $subaction.'Action';
- else
- $subactionMethodName = $subaction.'View';
+if ( $isAction )
+ $subactionMethodName = $subaction.'Action';
else
- $subactionMethodName = $subaction;
+ $subactionMethodName = $subaction.'View';
Logger::debug("Executing $actionClassName::$subactionMethodName");
@@ -322,11 +282,8 @@ if ( isset($do->actionConfig[$do->subActionName]['direct']) )
exit;
-Session::set('views' ,$views );
-
if ( isset($do->actionConfig[$do->subActionName]['async' ]) || $isAction )
{
- require_once( OR_SERVICECLASSES_DIR."JSON.class.".PHP_EXT );
$json = new JSON();
header('Content-Type: application/json');
echo $json->encode( $do->templateVars );
diff --git a/themes/default/include/html/form.inc.php b/themes/default/include/html/form.inc.php
@@ -38,9 +38,9 @@
<?php } ?>
<input type="hidden" name="<?php echo REQ_PARAM_TOKEN ?>" value="<?php echo token() ?>" />
-<input type="hidden" name="<?php echo REQ_PARAM_ACTION ?>" value="<?php echo $attr_action ?>" />
-<input type="hidden" name="<?php echo REQ_PARAM_SUBACTION ?>" value="<?php echo $attr_subaction ?>" />
-<input type="hidden" name="<?php echo REQ_PARAM_ID ?>" value="<?php echo $attr_id ?>" /><?php
+<input type="hidden" name="<?php echo REQ_PARAM_ACTION ?>" value="<?php echo $this->actionName ?>" />
+<input type="hidden" name="<?php echo REQ_PARAM_SUBACTION ?>" value="<?php echo $this->subActionName ?>" />
+<input type="hidden" name="<?php echo REQ_PARAM_ID ?>" value="<?php echo $this->getRequestId() ?>" /><?php
if ( $conf['interface']['url_sessionid'] )
echo '<input type="hidden" name="'.session_name().'" value="'.session_id().'" />'."\n";
?>
\ No newline at end of file
diff --git a/themes/default/js/openrat.js b/themes/default/js/openrat.js
@@ -82,11 +82,11 @@ function refreshWorkbench()
*/
function refreshHeader()
{
- $('div#header').each( function(index){
- loadView( $(this),createUrl('title','show',0 ) );
+ $('div#header').load( createUrl('title','show',0 ),function() {
+ $(this).fadeIn('slow');
+ registerHeaderEvents();
});
- registerHeaderEvents();
// Modale Dialoge
//$('form.login, form.profile').dialog( { modal:true, resizable:false, width:760, height:600, draggable: false } );
@@ -382,7 +382,7 @@ function doResponse(data,status)
$('div.window div.status div').addClass( value.status );
$('div.window div.status div').append( value.text );
$('div.window div.status div').delay(3000).fadeOut(2500);
- //alert(value.text);
+ //alert( value.text );
});
$.each(data['errors'], function(idx,value) {