openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 39aba013fab1a695c006319b0fdec525d4831704
parent 40d2c2654935fa145b92c87c7ee3f674bfb6a773
Author: Jan Dankert <devnull@localhost>
Date:   Wed, 12 Sep 2018 23:04:39 +0200

Bei Sprachen und Varianten: Auswahl der Standard-Vorbelegung auch über den Eigenschaften-Dialog.

Diffstat:
modules/cms-core/action/LanguageAction.class.php | 23+++++++++++------------
modules/cms-core/action/ModelAction.class.php | 24++++++++++++++++++++++++
modules/cms-ui/themes/default/html/views/language/advanced.php | 28----------------------------
modules/cms-ui/themes/default/html/views/language/advanced.tpl.src.xml | 26--------------------------
modules/cms-ui/themes/default/html/views/language/prop.php | 50++++++++++++++++++++++++++++++++++++++++++++++++++
modules/cms-ui/themes/default/html/views/language/prop.tpl.src.xml | 35+++++++++++++++++++++++++++++++++++
modules/cms-ui/themes/default/html/views/model/prop.php | 38++++++++++++++++++++++++++++++++++++++
modules/cms-ui/themes/default/html/views/model/prop.tpl.src.xml | 24++++++++++++++++++++++++
modules/cms-ui/themes/default/html/views/title/show.php | 4++--
modules/cms-ui/themes/default/html/views/title/show.tpl.src.xml | 4++--
10 files changed, 186 insertions(+), 70 deletions(-)

diff --git a/modules/cms-core/action/LanguageAction.class.php b/modules/cms-core/action/LanguageAction.class.php @@ -86,18 +86,11 @@ class LanguageAction extends Action } - public function propView() - { - $this->nextSubAction('advanced'); - } - /** * Speichern der Sprache */ - function advancedPost() + function propPost() { - global $conf; - if ( $this->hasRequestVar('name') ) { $this->language->name = $this->getRequestVar('name' ); @@ -105,13 +98,18 @@ class LanguageAction extends Action } else { - $countryList = $conf['countries']; + $countryList = config()['countries']; $iso = $this->getRequestVar('isocode'); $this->language->name = $countryList[$iso]; $this->language->isoCode = strtolower( $iso ); } + + if ( $this->hasRequestVar('is_default') ) + $this->language->setDefault(); $this->language->save(); + + $this->addNotice('language',$this->language->name,'DONE',OR_NOTICE_OK); } @@ -171,10 +169,11 @@ class LanguageAction extends Action } - function advancedView() + function propView() { - $this->setTemplateVar('isocode',$this->language->isoCode); - $this->setTemplateVar('name' ,$this->language->name ); + $this->setTemplateVar('isocode' ,$this->language->isoCode ); + $this->setTemplateVar('name' ,$this->language->name ); + $this->setTemplateVar('is_default',$this->language->isDefault ); } diff --git a/modules/cms-core/action/ModelAction.class.php b/modules/cms-core/action/ModelAction.class.php @@ -51,6 +51,30 @@ class ModelAction extends Action + 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> diff --git a/modules/cms-ui/themes/default/html/views/language/advanced.php b/modules/cms-ui/themes/default/html/views/language/advanced.php @@ -1,27 +0,0 @@ - - - - - <form name="" target="_self" data-target="view" action="./" data-method="advanced" data-action="language" data-id="<?php echo OR_ID ?>" method="post" enctype="application/x-www-form-urlencoded" class="language" 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="language" /><input type="hidden" name="<?php echo REQ_PARAM_SUBACTION ?>" value="advanced" /><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> - - </div> - <div class="input"> - <div class="inputholder"><input id="<?php echo REQUEST_ID ?>_name" name="name<?php if ('') echo '_disabled' ?>" type="text" maxlength="50" class="focus" value="<?php echo Text::encodeHtml(@$name) ?>" /><?php if ('') { ?><input type="hidden" name="name" value="<?php $name ?>"/><?php } ?></div> - - </div> - </div> - <div class="line"> - <div class="label"> - <span class="text"><?php echo nl2br(encodeHtml(htmlentities(lang('LANGUAGE_ISOCODE')))); ?></span> - - </div> - <div class="input"> - <div class="inputholder"><input id="<?php echo REQUEST_ID ?>_isocode" name="isocode<?php if ('') echo '_disabled' ?>" type="text" maxlength="256" class="text" value="<?php echo Text::encodeHtml(@$isocode) ?>" /><?php if ('') { ?><input type="hidden" name="isocode" value="<?php $isocode ?>"/><?php } ?></div> - - </div> - </div> - <div class="bottom"><div class="command "><input type="submit" class="submit ok" value="OK" /></div></div></form> - - \ No newline at end of file diff --git a/modules/cms-ui/themes/default/html/views/language/advanced.tpl.src.xml b/modules/cms-ui/themes/default/html/views/language/advanced.tpl.src.xml @@ -1,25 +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 back="true"></header> - <form method="post"> - - <part class="line"> - <part class="label"> - <text text="GLOBAL_NAME"></text> - </part> - <part class="input"> - <input name="name" class="focus" maxlength="50"></input> - </part> - </part> - - - <part class="line"> - <part class="label"> - <text text="LANGUAGE_ISOCODE"></text> - </part> - <part class="input"> - <input name="isocode"></input> - </part> - </part> - </form> -</output>- \ No newline at end of file diff --git a/modules/cms-ui/themes/default/html/views/language/prop.php b/modules/cms-ui/themes/default/html/views/language/prop.php @@ -0,0 +1,49 @@ + + + + + <form name="" target="_self" data-target="view" action="./" data-method="prop" data-action="language" data-id="<?php echo OR_ID ?>" method="post" enctype="application/x-www-form-urlencoded" class="language" 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="language" /><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> + + </div> + <div class="input"> + <div class="inputholder"><input id="<?php echo REQUEST_ID ?>_name" name="name<?php if ('') echo '_disabled' ?>" type="text" maxlength="50" class="focus" value="<?php echo Text::encodeHtml(@$name) ?>" /><?php if ('') { ?><input type="hidden" name="name" value="<?php $name ?>"/><?php } ?></div> + + </div> + </div> + <div class="line"> + <div class="label"> + <span class="text"><?php echo nl2br(encodeHtml(htmlentities(lang('LANGUAGE_ISOCODE')))); ?></span> + + </div> + <div class="input"> + <div class="inputholder"><input id="<?php echo REQUEST_ID ?>_isocode" name="isocode<?php if ('') echo '_disabled' ?>" type="text" maxlength="256" class="text" value="<?php echo Text::encodeHtml(@$isocode) ?>" /><?php if ('') { ?><input type="hidden" name="isocode" value="<?php $isocode ?>"/><?php } ?></div> + + </div> + </div> + <div class="line"> + <div class="label"> + </div> + <div class="input"> + <?php { $tmpname = 'is_default';$default = '';$readonly = $is_default;$required = ''; + if ( isset($$tmpname) ) + $checked = $$tmpname; + else + $checked = $default; + + ?><input class="checkbox" type="checkbox" id="<?php echo REQUEST_ID ?>_<?php echo $tmpname ?>" name="<?php echo $tmpname ?>" <?php if ($readonly) echo ' disabled="disabled"' ?> value="1"<?php if( $checked ) echo ' checked="checked"' ?><?php if( $required ) echo ' required="required"' ?> /><?php + + if ( $readonly && $checked ) + { + ?><input type="hidden" name="<?php echo $tmpname ?>" value="1" /><?php + } + } ?> + + <label for="<?php echo REQUEST_ID ?>_is_default" class="label"><?php echo lang('GLOBAL_is_default') ?> + </label> + </div> + </div> + <div class="bottom"><div class="command "><input type="submit" class="submit ok" value="OK" /></div></div></form> + + \ No newline at end of file diff --git a/modules/cms-ui/themes/default/html/views/language/prop.tpl.src.xml b/modules/cms-ui/themes/default/html/views/language/prop.tpl.src.xml @@ -0,0 +1,34 @@ +<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 back="true"></header> + <form method="post"> + + <part class="line"> + <part class="label"> + <text text="GLOBAL_NAME"></text> + </part> + <part class="input"> + <input name="name" class="focus" maxlength="50"></input> + </part> + </part> + + + <part class="line"> + <part class="label"> + <text text="LANGUAGE_ISOCODE"></text> + </part> + <part class="input"> + <input name="isocode"></input> + </part> + </part> + + <part class="line"> + <part class="label"> + </part> + <part class="input"> + <checkbox name="is_default" readonly="var:is_default"></checkbox> + <label key="GLOBAL_is_default" for="is_default" /> + </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 @@ -0,0 +1,37 @@ + + + <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 ?>" /> + <div class="line"> + <div class="label"> + <span class="text"><?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> + </div> + <div class="line"> + <div class="label"> + </div> + <div class="input"> + <?php { $tmpname = 'is_default';$default = '';$readonly = $is_default;$required = ''; + if ( isset($$tmpname) ) + $checked = $$tmpname; + else + $checked = $default; + + ?><input class="checkbox" type="checkbox" id="<?php echo REQUEST_ID ?>_<?php echo $tmpname ?>" name="<?php echo $tmpname ?>" <?php if ($readonly) echo ' disabled="disabled"' ?> value="1"<?php if( $checked ) echo ' checked="checked"' ?><?php if( $required ) echo ' required="required"' ?> /><?php + + if ( $readonly && $checked ) + { + ?><input type="hidden" name="<?php echo $tmpname ?>" value="1" /><?php + } + } ?> + + <label for="<?php echo REQUEST_ID ?>_is_default" class="label"><?php echo lang('GLOBAL_is_default') ?> + </label> + </div> + </div> + <div class="bottom"><div class="command "><input type="submit" class="submit ok" value="OK" /></div></div></form> + + \ No newline at end of file diff --git a/modules/cms-ui/themes/default/html/views/model/prop.tpl.src.xml b/modules/cms-ui/themes/default/html/views/model/prop.tpl.src.xml @@ -0,0 +1,23 @@ +<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 method="post"> + + <part class="line"> + <part class="label"> + <text text="GLOBAL_NAME"></text> + </part> + <part class="input"> + <input name="name" focus="true" maxlength="50"></input> + </part> + </part> + + <part class="line"> + <part class="label"> + </part> + <part class="input"> + <checkbox name="is_default" readonly="var:is_default"></checkbox> + <label key="GLOBAL_is_default" for="is_default" /> + </part> + </part> + </form> +</output>+ \ No newline at end of file diff --git a/modules/cms-ui/themes/default/html/views/title/show.php b/modules/cms-ui/themes/default/html/views/title/show.php @@ -155,7 +155,7 @@ <div class="arrow-down"> </div> <div class="dropdown"> - <div class="entry clickable filtered on-action-link on-action-folder on-action-page on-action-template on-action-element on-action-file"> + <div class="entry clickable filtered on-action-link on-action-folder on-action-page on-action-template on-action-element on-action-file on-action-language on-action-model"> <a title="<?php echo lang('menu_prop_desc') ?>" target="_self" data-type="dialog" data-action="" data-method="prop" data-id="<?php echo OR_ID ?>" data-extra="{'dialogAction':null,'dialogMethod':'prop'}" href="<?php echo Html::url('','prop','',array('dialogAction'=>'','dialogMethod'=>'prop')) ?>"> <img class="image-icon image-icon--method" title="" src="./modules/cms-ui/themes/default/images/icon/method/prop.svg" /> @@ -222,7 +222,7 @@ </a> </div> - <div class="entry clickable filtered on-action-language on-action-element"> + <div class="entry clickable filtered on-action-element"> <a title="<?php echo lang('menu_advanced_desc') ?>" target="_self" data-type="dialog" data-action="" data-method="advanced" data-id="<?php echo OR_ID ?>" data-extra="{'dialogAction':null,'dialogMethod':'advanced'}" href="<?php echo Html::url('','advanced','',array('dialogAction'=>'','dialogMethod'=>'advanced')) ?>"> <img class="image-icon image-icon--method" title="" src="./modules/cms-ui/themes/default/images/icon/method/advanced.svg" /> diff --git a/modules/cms-ui/themes/default/html/views/title/show.tpl.src.xml b/modules/cms-ui/themes/default/html/views/title/show.tpl.src.xml @@ -134,7 +134,7 @@ <part class="arrow-down"/> <part class="dropdown"> <part - class="entry clickable filtered on-action-link on-action-folder on-action-page on-action-template on-action-element on-action-file"> + class="entry clickable filtered on-action-link on-action-folder on-action-page on-action-template on-action-element on-action-file on-action-language on-action-model"> <link type="dialog" title="message:menu_prop_desc" subaction="prop"> <image method="prop" align="left"></image> <text key="menu_prop"></text> @@ -192,7 +192,7 @@ </link> </part> - <part class="entry clickable filtered on-action-language on-action-element"> + <part class="entry clickable filtered on-action-element"> <link type="dialog" title="message:menu_advanced_desc" subaction="advanced"> <image method="advanced" align="left"></image>