From 4fe182cb63a01d26e1bbc78161b2fffeab97d045 Mon Sep 17 00:00:00 2001 From: gloas <gloas@afi-sa.fr> Date: Tue, 14 Mar 2017 17:18:39 +0100 Subject: [PATCH] improve form backurl --- library/ZendAfi/View/Helper/Fieldset.php | 31 ------------------- .../ZendAfi/View/Helper/Redmine/Header.php | 4 +-- library/ZendAfi/View/Helper/RenderForm.php | 13 ++++---- public/opac/java/form_to_tabs/form_to_tabs.js | 4 +-- 4 files changed, 10 insertions(+), 42 deletions(-) delete mode 100644 library/ZendAfi/View/Helper/Fieldset.php diff --git a/library/ZendAfi/View/Helper/Fieldset.php b/library/ZendAfi/View/Helper/Fieldset.php deleted file mode 100644 index 465e9abf109..00000000000 --- a/library/ZendAfi/View/Helper/Fieldset.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php -/** - * Copyright (c) 2012-2014, Agence Française Informatique (AFI). All rights reserved. - * - * BOKEH is free software; you can redistribute it and/or modify - * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by - * the Free Software Foundation. - * - * There are special exceptions to the terms and conditions of the AGPL as it - * is applied to this software (see README file). - * - * BOKEH 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 AFFERO GENERAL PUBLIC LICENSE for more details. - * - * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE - * along with BOKEH; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - - -class ZendAfi_View_Helper_Fieldset extends Zend_View_Helper_Fieldset { - public function fieldset($name, $content, $attribs = null) { - return - $this->view->tag('a', '', ['name' => $name, - 'style' => 'visibility: hidden; height:0; width:0']) . - parent::fieldset($name, $content, $attribs); - } -} -?> \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Redmine/Header.php b/library/ZendAfi/View/Helper/Redmine/Header.php index d658eadc597..ac61af22f15 100644 --- a/library/ZendAfi/View/Helper/Redmine/Header.php +++ b/library/ZendAfi/View/Helper/Redmine/Header.php @@ -89,7 +89,7 @@ class ZendAfi_View_Helper_Redmine_Header extends ZendAfi_View_Helper_BaseHelper return $this->view->tagAnchor($this->view->url(['module' => 'admin', 'controller' => 'users', 'action' => 'edit', - 'id' => $user->getId()], null ,true) . '#redmine', + 'id' => $user->getId()], null ,true) . '#fieldset-redmine', $label, ['title' => $this->_('sélectionner une autre bibliothèque')]); } @@ -107,7 +107,7 @@ class ZendAfi_View_Helper_Redmine_Header extends ZendAfi_View_Helper_BaseHelper 'controller' => 'bib', 'action' => 'edit', 'backUrl' => $this->view->url(), - 'id' => $library->getId()], null ,true) . '#redmine') + 'id' => $library->getId()], null ,true) . '#fieldset-redmine') ->setAttribs(['class' => 'library_redmine_account', 'title' => $title])); } diff --git a/library/ZendAfi/View/Helper/RenderForm.php b/library/ZendAfi/View/Helper/RenderForm.php index f0460e0dd09..87c2f081907 100644 --- a/library/ZendAfi/View/Helper/RenderForm.php +++ b/library/ZendAfi/View/Helper/RenderForm.php @@ -27,10 +27,6 @@ class ZendAfi_View_Helper_RenderForm extends ZendAfi_View_Helper_BaseHelper { if (!$form) return; - if(!$form->getAttrib('data-backurl') - && ($backurl = Class_Url::getParam('backUrl'))) - $form->setAttrib('data-backurl', $backurl); - if (($class = $form->getAttrib('class')) === null) $class = 'form'; @@ -176,10 +172,13 @@ class ZendAfi_View_Helper_RenderForm extends ZendAfi_View_Helper_BaseHelper { * @return string */ protected function _getBackUrl($form) { - if(!$form->getAttrib('data-backurl')) - return null; + if($form->getAttrib('data-backurl')) + return (new Class_Entity())->setUrl($form->getAttrib('data-backurl')); + + if($backurl = Class_Url::getParam('backUrl')) + return (new Class_Entity())->setUrl($backurl); - return (new Class_Entity())->setUrl($form->getAttrib('data-backurl')); + return null; } diff --git a/public/opac/java/form_to_tabs/form_to_tabs.js b/public/opac/java/form_to_tabs/form_to_tabs.js index 881cf9d4cf7..25e2d9d657d 100644 --- a/public/opac/java/form_to_tabs/form_to_tabs.js +++ b/public/opac/java/form_to_tabs/form_to_tabs.js @@ -30,7 +30,7 @@ form_fieldsets.each(function(index, element) { var fieldset = $(element); - fieldset.attr('id', 'tab'+index) + //fieldset.attr('id', 'tab'+index) var legend = fieldset.find('legend'); if(1 > legend.length) { @@ -39,7 +39,7 @@ return; } - tabs.append('<li><a href="#tab'+index+'">' + tabs.append('<li><a href="#'+fieldset.attr('id')+'">' +legend.text() +'</a></li>'); legend.remove(); -- GitLab