commit 610a0f9b4b54a398fb9dda1aa9a33720f445ba0d
parent 90b298d8ad39b2d374e9842c80fe27483c49323f
Author: Jan Dankert <develop@jandankert.de>
Date: Wed, 15 May 2019 21:17:42 +0200
Varianten-Name als Eigenschaft editierbar.
Diffstat:
6 files changed, 183 insertions(+), 222 deletions(-)
diff --git a/modules/cms-core/action/ModelAction.class.php b/modules/cms-core/action/ModelAction.class.php
@@ -1,186 +1,136 @@
-<?php
-
-namespace cms\action;
-
-use cms\model\Model;
-
-
-
-use Session;
-use \Html;
-
-// OpenRat Content Management System
-// Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-
-/**
- * Action-Klasse zum Bearbeiten eines Projetmodells
- * @author $Author$
- * @version $Revision$
- * @package openrat.actions
- */
-class ModelAction extends Action
-{
- public $security = Action::SECURITY_USER;
-
- var $defaultSubAction = 'listing';
- var $model;
-
-
- function __construct()
- {
- parent::__construct();
-
- }
-
-
- public function init()
- {
- $this->model = new Model( $this->getRequestId() );
- $this->model->load();
- }
-
-
-
- public function propView()
- {
- $this->setTemplateVar('name' ,$this->model->name );
- $this->setTemplateVar('is_default',$this->model->isDefault );
- }
-
-
-
- /**
- * Speichern der Sprache
- */
- public function propPost()
- {
- if ( $this->hasRequestVar('name') ) {
- $this->model->name = $this->getRequestVar('name');
- $this->model->save();
- }
-
- if ( $this->hasRequestVar('is_default') )
- $this->model->setDefault();
-
- $this->addNotice('model',$this->model->name,'DONE',OR_NOTICE_OK);
- }
-
-
- /**
- * Entfernen der Variante.<br>
- * Es wird ein Best�tigungsdialog angezeigt.
- */
- function removeView()
- {
- $this->model->load();
-
- $this->setTemplateVar( 'name',$this->model->name );
- }
-
-
- /**
- * Löschen des Models.
- */
- function removePost()
- {
- if ( $this->hasRequestVar('confirm') )
- {
- $this->model->delete();
- $this->addNotice('model',$this->model->name,'DONE',OR_NOTICE_OK);
- }
- else
- {
- $this->addNotice('model',$this->model->name,'NOTHING_DONE',OR_NOTICE_WARN);
- }
- }
-
-
-
- // Speichern eines Modells
- function editPost()
- {
- if ( $this->getRequestVar('name') != '' )
- {
- $this->model->name = $this->getRequestVar('name');
- $this->model->save();
- $this->addNotice('model',$this->model->name,'SAVED','ok');
- }
- else
- {
- $this->addNotice('model',$this->model->name,'NOT_SAVED','error');
- }
-
- // Baum aktualisieren
-// $this->setTemplateVar('tree_refresh',true);
- }
-
-
- function setdefaultPost()
- {
- if ( !$this->userIsAdmin() ) exit();
-
- $this->model->setDefault();
-
- $this->addNotice('model',$this->model->name,'DONE',OR_NOTICE_OK);
- }
-
-
- /**
- * Bearbeiten der Variante.
- * Ermitteln aller Eigenschaften der Variante.
- */
- function editView()
- {
- $this->model->load();
-
- $this->setTemplateVars( $this->model->getProperties() );
- }
-
-
-
- /**
- * Liefert die Struktur zu diesem Ordner:
- * - Mit den übergeordneten Ordnern und
- * - den in diesem Ordner enthaltenen Objekten
- *
- * Beispiel:
- * <pre>
- * - A
- * - B
- * - C (dieser Ordner)
- * - Unterordner
- * - Seite
- * - Seite
- * - Datei
- * </pre>
- */
- public function structureView()
- {
- $structure = array();
- $modellistChildren = array();
-
- $structure[0] = array('id'=>'0','name'=>lang('MODELS'),'type'=>'modellist','level'=>1,'children'=>&$modellistChildren);
-
- $modellistChildren[ $this->model->modelid ] = array('id'=>$this->model->modelid,'name'=>$this->model->name,'type'=>'model','self'=>true);
-
-
- //Html::debug($structure);
-
- $this->setTemplateVar('outline',$structure);
- }
+<?php
+
+namespace cms\action;
+
+use cms\model\Model;
+
+
+
+use Session;
+use \Html;
+
+// OpenRat Content Management System
+// Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+/**
+ * Action-Klasse zum Bearbeiten eines Projetmodells
+ * @author $Author$
+ * @version $Revision$
+ * @package openrat.actions
+ */
+class ModelAction extends Action
+{
+ public $security = Action::SECURITY_USER;
+
+ /**
+ * @var Model
+ */
+ private $model;
+
+
+ function __construct()
+ {
+ parent::__construct();
+
+ }
+
+
+ public function init()
+ {
+ $this->model = new Model( $this->getRequestId() );
+ $this->model->load();
+ }
+
+
+
+ public function propView()
+ {
+ $this->setTemplateVar('name' ,$this->model->name );
+ $this->setTemplateVar('is_default',$this->model->isDefault );
+ }
+
+
+
+ /**
+ * Speichern der Sprache
+ */
+ public function propPost()
+ {
+ if ( $this->hasRequestVar('name') ) {
+ $this->model->name = $this->getRequestVar('name');
+ $this->model->save();
+ }
+
+ if ( $this->hasRequestVar('is_default') )
+ $this->model->setDefault();
+
+ $this->addNotice('model',$this->model->name,'DONE',OR_NOTICE_OK);
+ }
+
+
+ /**
+ * Entfernen der Variante.<br>
+ * Es wird ein Best�tigungsdialog angezeigt.
+ */
+ function removeView()
+ {
+ $this->model->load();
+
+ $this->setTemplateVar( 'name',$this->model->name );
+ }
+
+
+ /**
+ * Löschen des Models.
+ */
+ function removePost()
+ {
+ if ( $this->hasRequestVar('confirm') )
+ {
+ $this->model->delete();
+ $this->addNotice('model',$this->model->name,'DONE',OR_NOTICE_OK);
+ }
+ else
+ {
+ $this->addNotice('model',$this->model->name,'NOTHING_DONE',OR_NOTICE_WARN);
+ }
+ }
+
+
+
+ function setdefaultPost()
+ {
+ if ( !$this->userIsAdmin() ) exit();
+
+ $this->model->setDefault();
+
+ $this->addNotice('model',$this->model->name,'DONE',OR_NOTICE_OK);
+ }
+
+
+ /**
+ * Bearbeiten der Variante.
+ * Ermitteln aller Eigenschaften der Variante.
+ */
+ public function infoView()
+ {
+ $this->model->load();
+
+ $this->setTemplateVars( $this->model->getProperties() );
+ }
}
\ No newline at end of file
diff --git a/modules/cms-ui/themes/default/html/views/model/edit.php b/modules/cms-ui/themes/default/html/views/model/edit.php
@@ -1,17 +0,0 @@
-
-
-
-
- <form name="" target="_self" data-target="view" action="./" data-method="edit" data-action="model" data-id="<?php echo OR_ID ?>" method="post" enctype="application/x-www-form-urlencoded" class="or-form model" data-async="" data-autosave=""><input type="hidden" name="<?php echo REQ_PARAM_EMBED ?>" value="1" /><input type="hidden" name="<?php echo REQ_PARAM_TOKEN ?>" value="<?php echo token() ?>" /><input type="hidden" name="<?php echo REQ_PARAM_ACTION ?>" value="model" /><input type="hidden" name="<?php echo REQ_PARAM_SUBACTION ?>" value="edit" /><input type="hidden" name="<?php echo REQ_PARAM_ID ?>" value="<?php echo OR_ID ?>" />
- <div class="line">
- <div class="label">
- <span><?php echo nl2br(encodeHtml(htmlentities(lang('GLOBAL_NAME')))); ?></span>
-
- </div>
- <div class="input">
- <div class="inputholder"><input id="<?php echo REQUEST_ID ?>_name" name="<?php if ('') echo ''.'_' ?>name<?php if ('') echo '_disabled' ?>" type="text" maxlength="50" class="" value="<?php echo Text::encodeHtml(@$name) ?>" /><?php if ('') { ?><input type="hidden" name="name" value="<?php $name ?>"/><?php } ?></div>
-
- </div>
- </div>
- <div class="or-form-actionbar"><input type="submit" class="or-form-btn or-form-btn--primary" value="OK" /></div></form>
- -
\ No newline at end of file
diff --git a/modules/cms-ui/themes/default/html/views/model/edit.tpl.src.xml b/modules/cms-ui/themes/default/html/views/model/edit.tpl.src.xml
@@ -1,14 +0,0 @@
-<output xmlns="http://www.openrat.de/template" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.openrat.de/template ../../../../../../template-engine/components/template.xsd">
- <header views="remove"></header>
- <form method="post">
- <part class="line">
- <part class="label">
- <text text="GLOBAL_NAME"></text>
- </part>
- <part class="input">
- <input name="name" maxlength="50"></input>
- </part>
- </part>
- </form>
-</output>-
\ No newline at end of file
diff --git a/modules/cms-ui/themes/default/html/views/model/info.php b/modules/cms-ui/themes/default/html/views/model/info.php
@@ -0,0 +1,22 @@
+
+
+ <form name="" target="_self" data-target="view" action="./" data-method="info" data-action="model" data-id="<?php echo OR_ID ?>" method="POST" enctype="application/x-www-form-urlencoded" class="or-form model" data-async="" data-autosave=""><input type="hidden" name="<?php echo REQ_PARAM_EMBED ?>" value="1" /><input type="hidden" name="<?php echo REQ_PARAM_TOKEN ?>" value="<?php echo token() ?>" /><input type="hidden" name="<?php echo REQ_PARAM_ACTION ?>" value="model" /><input type="hidden" name="<?php echo REQ_PARAM_SUBACTION ?>" value="info" /><input type="hidden" name="<?php echo REQ_PARAM_ID ?>" value="<?php echo OR_ID ?>" />
+ <span class="headline"><?php echo nl2br(encodeHtml(htmlentities($name))); ?></span>
+
+ <div class="line">
+ <div class="label">
+ <span><?php echo nl2br(encodeHtml(htmlentities(lang('GLOBAL_NAME')))); ?></span>
+
+ </div>
+ <div class="input clickable">
+ <span><?php echo nl2br(encodeHtml(htmlentities($name))); ?></span>
+
+ <a class="or-link-btn" target="_self" data-type="edit" data-action="model" data-method="prop" data-id="<?php echo OR_ID ?>" data-extra="[]" href="<?php echo Html::url('model','prop','',array()) ?>">
+ <span><?php echo nl2br(encodeHtml(htmlentities(lang(''.'edit'.'')))); ?></span>
+
+ </a>
+
+ </div>
+ </div>
+ <div class="or-form-actionbar"></div></form>
+ +
\ No newline at end of file
diff --git a/modules/cms-ui/themes/default/html/views/model/info.tpl.src.xml b/modules/cms-ui/themes/default/html/views/model/info.tpl.src.xml
@@ -0,0 +1,20 @@
+<output xmlns="http://www.openrat.de/template" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.openrat.de/template ../../../../../../template-engine/components/template.xsd">
+ <form readonly="true" cancel="false">
+
+ <text class="headline" var="name"/>
+
+ <part class="line">
+ <part class="label">
+ <text text="GLOBAL_NAME"></text>
+ </part>
+ <part class="input clickable">
+ <text var="name"/>
+ <link class="or-link-btn" action="model" subaction="prop" type="edit">
+ <text key="edit"/>
+ </link>
+ </part>
+ </part>
+
+ </form>
+</output>+
\ No newline at end of file
diff --git a/modules/cms-ui/themes/default/html/views/model/prop.php b/modules/cms-ui/themes/default/html/views/model/prop.php
@@ -1,13 +1,13 @@
- <form name="" target="_self" data-target="view" action="./" data-method="prop" data-action="model" data-id="<?php echo OR_ID ?>" method="post" enctype="application/x-www-form-urlencoded" class="model" data-async="" data-autosave=""><input type="submit" class="invisible" /><input type="hidden" name="<?php echo REQ_PARAM_EMBED ?>" value="1" /><input type="hidden" name="<?php echo REQ_PARAM_TOKEN ?>" value="<?php echo token() ?>" /><input type="hidden" name="<?php echo REQ_PARAM_ACTION ?>" value="model" /><input type="hidden" name="<?php echo REQ_PARAM_SUBACTION ?>" value="prop" /><input type="hidden" name="<?php echo REQ_PARAM_ID ?>" value="<?php echo OR_ID ?>" />
+ <form name="" target="_self" data-target="view" action="./" data-method="prop" data-action="model" data-id="<?php echo OR_ID ?>" method="post" enctype="application/x-www-form-urlencoded" class="or-form model" data-async="" data-autosave=""><input type="hidden" name="<?php echo REQ_PARAM_EMBED ?>" value="1" /><input type="hidden" name="<?php echo REQ_PARAM_TOKEN ?>" value="<?php echo token() ?>" /><input type="hidden" name="<?php echo REQ_PARAM_ACTION ?>" value="model" /><input type="hidden" name="<?php echo REQ_PARAM_SUBACTION ?>" value="prop" /><input type="hidden" name="<?php echo REQ_PARAM_ID ?>" value="<?php echo OR_ID ?>" />
<div class="line">
<div class="label">
- <span class="text"><?php echo nl2br(encodeHtml(htmlentities(lang('GLOBAL_NAME')))); ?></span>
+ <span><?php echo nl2br(encodeHtml(htmlentities(lang('GLOBAL_NAME')))); ?></span>
</div>
<div class="input">
- <div class="inputholder"><input id="<?php echo REQUEST_ID ?>_name" name="name<?php if ('') echo '_disabled' ?>" autofocus="autofocus" type="text" maxlength="50" class="text" value="<?php echo Text::encodeHtml(@$name) ?>" /><?php if ('') { ?><input type="hidden" name="name" value="<?php $name ?>"/><?php } ?></div>
+ <div class="inputholder"><input id="<?php echo REQUEST_ID ?>_name" name="<?php if ('') echo ''.'_' ?>name<?php if ('') echo '_disabled' ?>" autofocus="autofocus" type="text" maxlength="50" class="" value="<?php echo Text::encodeHtml(@$name) ?>" /><?php if ('') { ?><input type="hidden" name="name" value="<?php $name ?>"/><?php } ?></div>
</div>
</div>
@@ -33,5 +33,5 @@
</label>
</div>
</div>
- <div class="bottom"><div class="command "><input type="submit" class="submit ok" value="OK" /></div></div></form>
+ <div class="or-form-actionbar"><input type="button" class="or-form-btn or-form-btn--secondary or-form-btn--cancel" value="<?php echo lang("CANCEL") ?>" /><input type="submit" class="or-form-btn or-form-btn--primary" value="OK" /></div></form>
\ No newline at end of file