Commit 2f837271 authored by Patrick Barroca's avatar Patrick Barroca 😠

hotline #71154 : inspector gadget styled

parent 25d46292
......@@ -85,7 +85,8 @@ class Class_Loan_Pnb extends Storm_Model_Abstract {
protected
$_table_name = 'loan_pnb',
$_loader_class = 'Class_Loan_PnbLoader';
$_loader_class = 'Class_Loan_PnbLoader',
$_belongs_to = ['user' => ['model' => 'Class_Users']];
public function getAlbum() {
......
......@@ -44,7 +44,10 @@ class ZendAfi_Controller_Plugin_InspectorGadget extends Zend_Controller_Plugin_A
Class_WebService_MappedSoapClient::setLogger($this);
$sl = Class_ScriptLoader::getInstance();
$sl->addOPACPluginScript('form_to_tabs/form_to_tabs.js');
$sl
->addOPACPluginScript('form_to_tabs/form_to_tabs.js')
->addOPACStyleSheet('inspector-gadget/style.css')
;
Class_Admin_Skin::current()
->renderButtonCssOn($sl)
->renderJQueryCssOn($sl)
......@@ -166,10 +169,16 @@ class ZendAfi_Controller_Plugin_InspectorGadget extends Zend_Controller_Plugin_A
if(!$label)
return '';
$datas['content'] = $this->_view->tag('div', $datas['content'],
['class' => 'inspector-gadget']);
$button = (new Class_Entity)
->setText($label)
->setImage(Class_Admin_Skin::current()->renderActionIconOn('loupe', $this->_view))
->setAttribs(['onclick' => 'opacDialogFromData('. $this->_view->escape(json_encode($datas)) .');$(\'.ig-tabs\').tabs({activate: function(event, ui) {if (ui.newPanel.attr(\'id\') == \'ig-tab-items\') ui.newPanel.accordion();}});']);
->setAttribs(['onclick' => 'opacDialogFromData('. $this->_view->escape(json_encode($datas)) .');'
. '$(\'.ig-tabs\').tabs({activate: function(event, ui) {if (ui.newPanel.hasClass(\'ig-accordion\')) ui.newPanel.accordion();},
create: function(event, ui) { if (ui.panel.hasClass(\'ig-accordion\')) ui.panel.accordion();}});'
]);
return $this->_view->Admin_Button($button);
}
......
......@@ -57,6 +57,9 @@ class ZendAfi_View_Helper_Album_Loans extends ZendAfi_View_Helper_BaseHelper {
. $this->_tag('td',
str_replace(['"', '\\'], '', json_encode($loan->callGetterByAttributeName($field), JSON_PRETTY_PRINT))));
return $this->_tag('table', implode('', $lines));
$user = $loan->getUser();
return $this->_tag('h3', $user ? ($user->getNomComplet() . ' (' . $user->getLogin() . ')') : $this->_('Inconnu'))
. $this->_tag('div', $this->_tag('table', implode('', $lines)));
}
}
\ No newline at end of file
......@@ -69,8 +69,7 @@ class ZendAfi_View_Helper_Notice_Dilicom extends ZendAfi_View_Helper_BaseHelper
foreach ($fields as $field => $label)
$lines[] = $this->_tag('tr',
$this->_tag('th', $label,
['scope' => 'row',
'style' => 'text-align:right;min-width:12em'])
['scope' => 'row'])
. $this->_tag('td',
str_replace(['"', '\\'], '', json_encode($this->_album->callGetterByAttributeName($field), JSON_PRETTY_PRINT))));
......@@ -91,47 +90,40 @@ class ZendAfi_View_Helper_Notice_Dilicom extends ZendAfi_View_Helper_BaseHelper
return $this->_tag('ul',
$this->_tag('li', $this->_tag('a', $this->_('Commandes'),
['href' => '#ig-tab-orders']))
. $this->_tag('li', $this->_tag('a', $this->_('Prêts'),
. $this->_tag('li', $this->_tag('a', $this->_('Prêts en cours'),
['href' => '#ig-tab-loans'])));
}
protected function _renderOrders() {
$id = 'ig-tab-orders';
if(!$items = $this->_album->getItems())
return $this->_renderTabContent($id,
$this->_tag('p',
$this->_('Cet album n\'a pas de commande')));
$html = [];
foreach($items as $item)
$html []= $this->view->Album_UsageConstraints($item->getUsageConstraints());
return $this->_renderTabContent($id,
implode($html));
return $this->_withItemsDo(
function($item) {
$constraints = $item->getUsageConstraints();
return $this->_tag('h3', $constraints->getLoanOrderLineId())
. $this->_tag('div',
$this->view->Album_UsageConstraints($constraints));
},
['id' => 'ig-tab-orders',
'class' => 'ig-accordion']);
}
protected function _renderTabContent($id, $content) {
return $this->_tag('div',
$content,
['id' => $id]);
protected function _withItemsDo($closure, $attribs) {
$content = ($items = $this->_album->getItems())
? implode(array_map($closure, $items))
: $this->_tag('p', $this->_('Cet album n\'a pas de commande'));
return $this->_tag('div', $content, $attribs);
}
protected function _renderLoans() {
$id = 'ig-tab-loans';
if(!$items = $this->_album->getItems())
return $this->_renderTabContent($id,
$this->_tag('p',
$this->_('Cet album n\'a pas de commande')));
$html = [];
foreach($items as $item)
$html []= $this->view->Album_Loans($item);
return $this->_renderTabContent($id,
implode($html));
return $this->_withItemsDo(
function($item) {
return $this->view->Album_Loans($item);
},
['id' => 'ig-tab-loans',
'class' => 'ig-accordion']);
}
......
......@@ -65,8 +65,7 @@ class ZendAfi_View_Helper_Notice_Unimarc extends Zend_View_Helper_HtmlElement {
foreach ($fields as $field => $label)
$lines[] = $this->_tag('tr',
$this->_tag('th', $label,
['scope' => 'row',
'style' => 'text-align:right;min-width:12em'])
['scope' => 'row'])
. $this->_tag('td',
str_replace(['"', '\\'], '', json_encode($notice->callGetterByAttributeName($field), JSON_PRETTY_PRINT))));
......@@ -92,8 +91,7 @@ class ZendAfi_View_Helper_Notice_Unimarc extends Zend_View_Helper_HtmlElement {
$button = (new Class_Entity)
->setText($this->_('Télécharger'))
->setImage(Class_Admin_Skin::current()->renderActionIconOn('down', $this->view))
->setAttribs(['style' => 'float:right;',
'onclick' => 'document.location.href=\'' . $download_url .'\'']);
->setAttribs(['onclick' => 'document.location.href=\'' . $download_url .'\'']);
return $this->view->Admin_Button($button);
}
......@@ -126,7 +124,7 @@ class ZendAfi_View_Helper_Notice_Unimarc extends Zend_View_Helper_HtmlElement {
return $this->_tag('div', $html,
['id' => 'ig-tab-items',
'style' => 'height:100%']);
'class' => 'ig-accordion']);
}
......@@ -218,19 +216,16 @@ class ZendAfi_View_Helper_Notice_UnimarcZone {
public function renderField($name, $value, $first=false) {
$style = 'vertical-align:top;';
return $this->view
->tag('tr',
$this->_tag('td', $first ? $this->_label : '',
['style' => $style . 'font-weight:bolder;'])
$this->_tag('td', $first ? $this->_label : '')
. $this->_tag('td',
$first
? $this->_fields['indicateur1']
. $this->_fields['indicateur2']
: '',
['style' => $style])
. $this->_tag('td', $name, ['style' => $style . 'color:green;'])
. $this->_tag('td', $value, ['style' => $style])
: '')
. $this->_tag('td', $name)
. $this->_tag('td', $value)
);
}
......
.inspector-gadget th {
text-align:right;
min-width:12em;
}
.inspector-gadget div > dl > dt {
text-transform: uppercase;
}
.inspector-gadget dl > *,
.inspector-gadget th,
.inspector-gadget td {
vertical-align:top;
}
.inspector-gadget dl > * {
display:inline-block;
margin: 0;
padding: 0;
}
.inspector-gadget dl > dd {
text-align: left;
width: 65%;
margin-left: 1em;
}
.inspector-gadget dl > dt {
text-align: right;
width: 30%;
}
.inspector-gadget #ig-tab-zones tr > td:first-of-type,
.inspector-gadget dt {
font-weight:bolder;
}
.inspector-gadget #ig-tab-zones tr > td:nth-of-type(3) {
color:green;
}
.inspector-gadget #ig-tab-zones button {
float:right;
}
.inspector-gadget .ig-accordion {
height: 100%;
}
\ No newline at end of file
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