Commit 920c3dd1 authored by efalcy's avatar efalcy
Browse files

dev #56107 : remove submit form when changing kiosk style properties

parent e1383284
- ticket #56107 : [EXPLO] 16/55 Retro Sprint 73 ! PB : plugin pour afficher des données métier dans un articles (intégrer une notice, une sitothèque...) avec des boutons ckEditor
\ No newline at end of file
- ticket #56107 : [EXPLO] 16/55 Retro Sprint 73 ! PB : plugin pour afficher des données métier dans un articles (intégrer une notice, une sitothèque...) avec des boutons ckEditor
......@@ -182,6 +182,20 @@ class Admin_WidgetController extends ZendAfi_Controller_Action {
}
public function updateStyleAction() {
$profil = $this->extractProfilFromUrl();
$preferences = array_merge(Class_Systeme_ModulesAccueil::getInstance()->getValeursParDefaut('KIOSQUE'),
$profil->getModuleAccueilPreferences($id_module, 'KIOSQUE'));
$viewRenderer = $this->getHelper('ViewRenderer');
$viewRenderer->setNoRender();
$this->getResponse()->setHeader('Content-Type', 'application/json; charset=utf-8');
$this->getResponse()->setBody(json_encode(['content' => $this->view->imgObjectPropertiesReader($this->_getParam('style_liste',''),$preferences, true)]));
}
public function getFormAction() {
$module = Class_Systeme_ModulesAccueil::moduleByCode($this->_getParam('code'));
$form_class = $module->getForm();
......@@ -265,4 +279,6 @@ class Admin_WidgetController extends ZendAfi_Controller_Action {
public function formProvider($widget) {
return call_user_func_array([$widget->getForm(), 'newWith'], [$widget->forForm()]);
}
}
\ No newline at end of file
......@@ -28,7 +28,7 @@ class ZendAfi_View_Helper_Admin_ImgObjectPropertiesReader
protected $_properties_path, $_defaults_path;
public function imgObjectPropertiesReader($plugin, $preferences) {
public function imgObjectPropertiesReader($plugin, $preferences, $without_div=false) {
if (!$this->_hasProperties($plugin))
return '';
......@@ -37,17 +37,20 @@ class ZendAfi_View_Helper_Admin_ImgObjectPropertiesReader
$this->view->addScriptPath(PATH_JAVA);
$html = $this->_tag('div', $this->_('Propriétés de l\'objet'))
. $this->view->render($this->_properties_path);
if ($without_div)
return $html;
$html = $this->_tag('div',
$html,
['id' => 'objet_props',
'style' => 'display: none;']);
return Class_Admin_Skin::current()
->renderActionIconOn('box_configuration',
$this->view,
['title' => $this->_("propriétés de l'objet"),
'style' => 'cursor:pointer',
'onclick' => "$(this).next().slideToggle();"]) .
$this->_tag('div',
$html,
['id' => 'objet_props',
'style' => 'display: none;']);
$html
;
}
......
......@@ -22,7 +22,7 @@
class ZendAfi_View_Helper_TagObjetsImgProperties
extends ZendAfi_View_Helper_BaseHelper {
public function tagObjetsImgProperties($styles, $preferences) {
public function tagObjetsImgProperties($styles, $preferences, $only_properties = false) {
$html = $this->getComboStyles($styles, $preferences["style_liste"]);
$html.= (isset($preferences['style_liste'])
......@@ -33,44 +33,33 @@ class ZendAfi_View_Helper_TagObjetsImgProperties
: '');
return $html;
// Bouton des proprietes
$onclick = "oProp=getId('objet_props'); if(oProp.style.display=='block') oProp.style.display='none'; else oProp.style.display='block'";
$html .= sprintf('&nbsp;<img src="' . URL_ADMIN_IMG . 'ico/copier.gif" title="%s" style="cursor:pointer" onclick="%s">',
$this->_("Propriétés de l'objet"),
$onclick);
// Valoriser les variables
$defauts = file($path . $fic_defaut);
$this->loadDefaults($defauts, $preferences);
// Inclure le html
$template = file_get_contents($path . $fic_html);
while (false !== ($pos = strpos($template, '<?php'))) {
$pos_fin = strpos($template, '?>', $pos);
$commande = "\$bloc=" . substr($template, ($pos+6), ($pos_fin-$pos-7)) . ";";
eval($commande);
$template = substr($template, 0, $pos) . $bloc . substr($template, ($pos_fin+2));
}
// Bloc final
$html .= '<div id="objet_props" style="display:none;border:1px solid #7f9db9;min-height:15px;background-color:#ffffff;padding:2px;margin-top:3px">';
$html .= sprintf('<div style="color:#3C5188;background-color:#eeeeee;padding:4px;margin-bottom:3px;">%s</div>',
$this->_("Propriétés de l'objet"));
$html .= $template;
$html .= '</div>';
return $html;
}
private function getComboStyles($styles, $valeur_select) {
$submit_script = '$("select[name=\'style_liste\']").change(function() {$("#styles_reload").val("1");var form=$(this).closest("form"); form.submit();});';
// $submit_script = '$("select[name=\'style_liste\']").change(function() {$("#styles_reload").val("1");var form=$(this).closest("form"); form.submit();});';
$script = '$("select[name=\'style_liste\']").change(function() {$("#styles_reload").val("1");
$.ajax({
url: "/stl/admin/widget/update-style/style_liste/"+$("#style_liste").val() ,
type: "GET",
dataType: "json",
success: function(data) {
var div = data["content"];
$("#objet_props").html(div);
}
});
});
';
//$(.style_liste option:selected).each( function(index,element) {$($(element)[index]).html(div)
Class_ScriptLoader::getInstance()
->addJQueryReady($submit_script);
->addJQueryReady($script);
$combo = '<select name="style_liste">';
$combo = '<select id="style_liste" name="style_liste">';
$combo = $this->addOptGroupOn($combo,
$this->translate()->_('Objets javascript'),
......
Markdown is supported
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