commit abb4c419148333a26365e1fc8358960c45a605c8
parent dba0107ce18f3cda44ab35f70dc4e82826db9b9e
Author: dankert <devnull@localhost>
Date: Thu, 8 Nov 2007 00:29:25 +0100
Wenn Seite direkt aufgerufen wird, dann sofort Seitenelement anzeigen.
Diffstat:
4 files changed, 91 insertions(+), 7 deletions(-)
diff --git a/actionClasses/IndexAction.class.php b/actionClasses/IndexAction.class.php
@@ -481,7 +481,7 @@ class IndexAction extends Action
if ( !$openId->checkAuthentication() )
{
- $this->addNotice('user',$openId->user,'LOGIN_OPENID_FAILED','error',array('name'=>$openId->user),array($openId->error) );
+ $this->addNotice('user',$openId->user,'LOGIN_OPENID_FAILED',OR_NOTICE_ERROR,array('name'=>$openId->user),array($openId->error) );
$this->addValidationError('openid_url','');
$this->callSubAction('showlogin');
return;
@@ -563,6 +563,8 @@ class IndexAction extends Action
if ( ! $openId->login() )
{
$this->addNotice('user',$openid_user,'LOGIN_OPENID_FAILED','error',array('name'=>$openid_user),array($openId->error) );
+// $this->addNotice('user',$openId->user,'LOGIN_OPENID_FAILED',OR_NOTICE_WARN ,array('name'=>$openId->user),array($openId->error) );
+// $this->addNotice('user',$openId->user,'LOGIN_OPENID_FAILED',OR_NOTICE_OK,array('name'=>$openId->user),array($openId->error) );
$this->addValidationError('openid_url','');
$this->callSubAction('showlogin');
return;
@@ -985,10 +987,26 @@ class IndexAction extends Action
$this->setTemplateVar( 'title',$project->name );
$object = Session::getObject();
-
+
+ $elementid = 0;
+
if ( is_object($object) )
- {
- $this->setTemplateVar( 'frame_src_main',Html::url('main',$object->getType(),$object->objectid) );
+ {
+ $type = $object->getType();
+
+ if ( $type == 'page' )
+ {
+ $page = new Page($object->objectid);
+ $page->load();
+ $elementList = $page->getWritableElements();
+ if ( count($elementList) == 1 )
+ $elementid = current(array_keys($elementList));
+ }
+
+ if ( $elementid > 0 )
+ $this->setTemplateVar( 'frame_src_main',Html::url('main','pageelement',$object->objectid,array('elementid'=>$elementid,'targetSubAction'=>'advanced')) );
+ else
+ $this->setTemplateVar( 'frame_src_main',Html::url('main',$type,$object->objectid) );
}
elseif ( is_object($project) && $project->projectid == PROJECTID_ADMIN )
{
diff --git a/objectClasses/Element.class.php b/objectClasses/Element.class.php
@@ -20,6 +20,9 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// ---------------------------------------------------------------------------
// $Log$
+// Revision 1.21 2007-11-07 23:29:05 dankert
+// Wenn Seite direkt aufgerufen wird, dann sofort Seitenelement anzeigen.
+//
// Revision 1.20 2007-10-29 22:16:19 dankert
// Korrektur Auswahl-Eigenschaften f?r Kopie-Element
//
@@ -159,7 +162,9 @@ class Element
*/
var $allLanguages;
-
+ var $readonlyElementNames = array('copy','linkinfo','info','infodate','code','dynamic');
+
+
/**
* Im Konstruktor wird die Element-Id gesetzt
* @param Integer Element-Id
@@ -550,7 +555,7 @@ class Element
function isWritable()
{
// Bei bestimmten Feldern immer false zurueckgeben
- if ( in_array($this->type,Array('copy','linkinfo','info','infodate','code','dynamic')) )
+ if ( in_array($this->type,$this->readonlyElementNames) )
return false;
return $this->writable;
diff --git a/objectClasses/Page.class.php b/objectClasses/Page.class.php
@@ -20,6 +20,9 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// ---------------------------------------------------------------------------
// $Log$
+// Revision 1.22 2007-11-07 23:29:05 dankert
+// Wenn Seite direkt aufgerufen wird, dann sofort Seitenelement anzeigen.
+//
// Revision 1.21 2007-06-13 22:01:22 dankert
// Korrektur: Dateiname Icon zum Bearbeiten.
//
@@ -661,11 +664,32 @@ class Page extends Object
*
* @access private
*/
+ function getWritableElements()
+ {
+ if ( !isset($this->template) )
+ $this->template = new Template( $this->templateid );
+
+ return $this->template->getWritableElements();
+ }
+
+
+
+ /**
+ * Erzeugen der Inhalte zu allen Elementen dieser Seite
+ * wird von generate() aufgerufen
+ *
+ * @access private
+ */
function generate_elements()
{
$this->values = array();
- foreach( $this->getElements() as $elementid=>$element )
+ if ( $this->simple )
+ $elements = $this->getWritableElements();
+ else
+ $elements = $this->getElements();
+
+ foreach( $elements as $elementid=>$element )
{
// neues Elementobjekt erzeugen
$val = new Value();
diff --git a/objectClasses/Template.class.php b/objectClasses/Template.class.php
@@ -20,6 +20,9 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// ---------------------------------------------------------------------------
// $Log$
+// Revision 1.14 2007-11-07 23:29:05 dankert
+// Wenn Seite direkt aufgerufen wird, dann sofort Seitenelement anzeigen.
+//
// Revision 1.13 2007-10-10 19:08:55 dankert
// Beim Hinzuf?gen von Vorlagen das Kopieren einer anderen Vorlage erlauben. Korrektur beim L?schen von Vorlagen.
//
@@ -293,6 +296,40 @@ class Template
/**
* Ermitteln aller Elemente zu diesem Template
+ * Es wird eine Liste mit den kompletten Elementen ermittelt und zurueckgegeben
+ * @return Array
+ */
+ function getWritableElements()
+ {
+ $list = array();
+ $db = db_connection();
+
+ $sql = new Sql( <<<SQL
+SELECT * FROM {t_element}
+ WHERE templateid={templateid}
+ AND writable=1
+ AND type NOT IN ({readonlyList})
+ ORDER BY name ASC
+SQL
+);
+ $sql->setInt ( 'templateid' ,$this->templateid );
+ $e = new Element();
+ $sql->setStringList( 'readonlyList',$e->readonlyElementNames );
+ foreach( $db->getAll( $sql->query ) as $row )
+ {
+ $e = new Element( $row['id'] );
+ $e->setDatabaseRow( $row );
+
+ $list[$e->elementid] = $e;
+ unset($e);
+ }
+ return $list;
+ }
+
+
+
+ /**
+ * Ermitteln aller Elemente zu diesem Template
* Es wird eine Liste mit den Element-Namen zur?ckgegeben
* @return Array
*/