// Webservice controller bootstrap design

This commit is contained in:
Jerome Nadaud
2013-09-25 11:29:11 +02:00
parent 72f540ad3a
commit 2a8d251cd6
2 changed files with 62 additions and 19 deletions
@@ -24,30 +24,23 @@
*}
{extends file="helpers/form/form.tpl"}
{block name="description"}
{$smarty.block.parent}
{if $input.type == 'text' && $input.name == 'key'}
<input type="button" value="{l s='Generate! '}" class="button" onclick="gencode(32)" />
{/if}
{/block}
{block name="input"}
{if $input.type == 'resources'}
<p>{l s='Set the resource permissions for this key:'}</p>
<table border="0" cellspacing="0" cellpadding="0" class="table accesses">
<div class="alert alert-info">{l s='Set the resource permissions for this key:'}</div>
<table class="table accesses">
<thead>
<tr>
<th class="center">{l s='Resource'}</th>
<th width="30" class="center"></th>
<th width="50" class="center">{l s='View (GET)'}</th>
<th width="50" class="center">{l s='Modify (PUT)'}</th>
<th width="50" class="center">{l s='Add (POST)'}</th>
<th width="50" class="center">{l s='Delete (DELETE)'}</th>
<th width="50" class="center">{l s='Fast view (HEAD)'}</th>
<th><span class="title_box">{l s='Resource'}</span></th>
<th class="center fixed-width-xs"></th>
<th class="center fixed-width-xs"><span class="title_box">{l s='View (GET)'}</span></th>
<th class="center fixed-width-xs"><span class="title_box">{l s='Modify (PUT)'}</span></th>
<th class="center fixed-width-xs"><span class="title_box">{l s='Add (POST)'}</span></th>
<th class="center fixed-width-xs"><span class="title_box">{l s='Delete (DELETE)'}</span></th>
<th class="center fixed-width-xs"><span class="title_box">{l s='Fast view (HEAD)'}</span></th>
</tr>
</thead>
<tbody>
<tr class="all" style="vertical-align:middle">
<tr>
<th></th>
<th></th>
<th class="center"><input type="checkbox" class="all_get get " /></th>
@@ -58,8 +51,8 @@
</tr>
{foreach $ressources as $resource_name => $resource}
<tr>
<th class="center">{$resource_name}</th>
<th class="center"><input type="checkbox" class="all"/></th>
<td>{$resource_name}</td>
<td class="center"><input type="checkbox" class="all"/></td>
<td class="center"><input type="checkbox" {if isset($ressources[$resource_name]['forbidden_method']) && in_array('GET', $ressources[$resource_name]['forbidden_method'])}disabled="disabled"{/if} class="get" name="resources[{$resource_name}][GET]" {if isset($permissions[$resource_name]) && in_array('GET', $permissions[$resource_name])}checked="checked"{/if} /></td>
<td class="center"><input type="checkbox" {if isset($ressources[$resource_name]['forbidden_method']) && in_array('PUT', $ressources[$resource_name]['forbidden_method'])}disabled="disabled"{/if} class="put" name="resources[{$resource_name}][PUT]" {if isset($permissions[$resource_name]) && in_array('PUT', $permissions[$resource_name])}checked="checked"{/if}/></td>
<td class="center"><input type="checkbox" {if isset($ressources[$resource_name]['forbidden_method']) && in_array('POST', $ressources[$resource_name]['forbidden_method'])}disabled="disabled"{/if} class="post" name="resources[{$resource_name}][POST]" {if isset($permissions[$resource_name]) && in_array('POST', $permissions[$resource_name])}checked="checked"{/if}/></td>
@@ -62,6 +62,8 @@ class AdminStockManagementControllerCore extends AdminController
'orderby' => false,
'filter' => false,
'search' => false,
'class' => 'fixed-width-sm',
'align' => 'center',
'hint' => $this->l('Quantitity total for all warehouses.')
),
);
@@ -791,6 +793,54 @@ class AdminStockManagementControllerCore extends AdminController
}
}
public function renderView()
{
if (Tools::isSubmit('id'))
{
// override attributes
$this->identifier = 'id_product_attribute';
$this->display = 'list';
$this->lang = false;
$this->addRowAction('addstock');
$this->addRowAction('removestock');
$this->addRowAction('transferstock');
// get current lang id
$lang_id = (int)$this->context->language->id;
// Get product id
$product_id = (int)Tools::getValue('id');
// Load product attributes with sql override
$this->table = 'product_attribute';
$this->_select = 'a.id_product_attribute as id, a.id_product, a.reference, a.ean13, a.upc';
$this->_where = 'AND a.id_product = '.$product_id;
$this->_group = 'GROUP BY a.id_product_attribute';
// get list and force no limit clause in the request
$this->getList($this->context->language->id, null, null, 0, false);
// Render list
$helper = new HelperList();
$helper->bulk_actions = array();
$helper->toolbar_scroll = $this->toolbar_scroll;
$helper->show_toolbar = false;
$helper->actions = $this->actions;
$helper->list_skip_actions = $this->list_skip_actions;
$helper->no_link = true;
$helper->shopLinkType = '';
$helper->identifier = $this->identifier;
// Force render - no filter, form, js, sorting ...
$helper->simple_header = true;
$content = $helper->generateList($this->_list, $this->fields_list);
return parent::renderView();
}
}
/**
* method call when ajax request is made with the details row action
* @see AdminController::postProcess()