Remove status bit name, use only labels

This commit is contained in:
Romain Neutron
2013-06-13 10:17:09 +02:00
parent a7c4739797
commit 1a13d02c2a
8 changed files with 92 additions and 45 deletions

View File

@@ -18,7 +18,7 @@ namespace Alchemy\Phrasea\Core;
*/
class Version
{
protected static $number = '3.8.0.a8';
protected static $number = '3.8.0.a9';
protected static $name = 'Carnosaurus';
public static function getNumber()

View File

@@ -11,8 +11,6 @@
use Alchemy\Phrasea\Application;
use MediaAlchemyst\Specification\Image as ImageSpecification;
use MediaAlchemyst\Alchemyst;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\File\Exception\FileException;
@@ -85,7 +83,6 @@ class databox_status
if ($bit < 4 && $bit > 31)
continue;
$this->status[$bit]["name"] = (string) ($sb);
$this->status[$bit]["labeloff"] = (string) $sb['labelOff'];
$this->status[$bit]["labelon"] = (string) $sb['labelOn'];
@@ -312,11 +309,6 @@ class databox_status
$sbit = $statbits->appendChild($doc->createElement("bit"));
if ($n = $sbit->appendChild($doc->createAttribute("n"))) {
$n->value = $bit;
$sbit->appendChild($doc->createTextNode($properties['name']));
}
if ($labOn = $sbit->appendChild($doc->createAttribute("labelOn"))) {
$labOn->value = $properties['labelon'];
}
@@ -336,11 +328,10 @@ class databox_status
$databox->saveStructure($doc);
self::$_status[$sbas_id]->status[$bit]["name"] = $properties['name'];
self::$_status[$sbas_id]->status[$bit]["labelon"] = $properties['labelon'];
self::$_status[$sbas_id]->status[$bit]["labeloff"] = $properties['labeloff'];
self::$_status[$sbas_id]->status[$bit]["searchable"] = ! ! $properties['searchable'];
self::$_status[$sbas_id]->status[$bit]["printable"] = ! ! $properties['printable'];
self::$_status[$sbas_id]->status[$bit]["searchable"] = (Boolean) $properties['searchable'];
self::$_status[$sbas_id]->status[$bit]["printable"] = (Boolean) $properties['printable'];
if ( ! isset(self::$_status[$sbas_id]->status[$bit]['img_on'])) {
self::$_status[$sbas_id]->status[$bit]['img_on'] = null;

View File

@@ -0,0 +1,74 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2012 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
class patch_3809 implements patchInterface
{
/** @var string */
private $release = '3.8.0.a9';
/** @var array */
private $concern = array(base::DATA_BOX);
/**
* {@inheritdoc}
*/
public function get_release()
{
return $this->release;
}
/**
* {@inheritdoc}
*/
public function require_all_upgrades()
{
return true;
}
/**
* {@inheritdoc}
*/
public function concern()
{
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function apply(base $databox, Application $app)
{
$sxe = $databox->get_sxml_structure();
if ($sxe !== false) {
foreach ($sxe->statbits->bit as $sb) {
$bit = (int) ($sb["n"]);
if ($bit < 4 && $bit > 31) {
continue;
}
$name = (string) $sb;
$labelOff = (string) $sb['labelOff'];
$labelOn = (string) $sb['labelOn'];
$this->status[$bit]["labeloff"] = $labelOff ? : 'no-' . $name;
$this->status[$bit]["labelon"] = $labelOn ? : 'ok-' . $name;
}
}
$dom = new \DOMDocument();
$dom->loadXML($sxe->asXML());
$databox->saveStructure($dom);
}
}

View File

@@ -430,17 +430,11 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$status .= '<img style="margin:1px;' . $style1 . '" ' .
'class="STAT_' . $this->base_id . '_'
. $this->record_id . '_' . $n . '_1" ' .
'src="' . $source1 . '" title="' .
(isset($statbit["labelon"]) ?
$statbit["labelon"] :
$statbit["lib"]) . '"/>';
'src="' . $source1 . '" title="' . $statbit["labelon"] . '"/>';
$status .= '<img style="margin:1px;' . $style0 . '" ' .
'class="STAT_' . $this->base_id . '_'
. $this->record_id . '_' . $n . '_0" ' .
'src="' . $source0 . '" title="' .
(isset($statbit["labeloff"]) ?
$statbit["labeloff"] :
("non-" . $statbit["lib"])) . '"/>';
'src="' . $source0 . '" title="' . $statbit["labeloff"] . '"/>';
}
}

View File

@@ -7,11 +7,9 @@
<table class="table table-striped table-condensed">
<thead>
<th>{% trans 'status:: numero de bit' %}</th>
<th colspan='2'></th>
<th style="width:30px;">{% trans 'status:: numero de bit' %}</th>
<th style="width:60px;" colspan='2'></th>
<th>{% trans 'status:: nom' %}</th>
<th>{% trans 'status:: icone A' %}</th>
<th>{% trans 'status:: icone B' %}</th>
<th>{% trans 'status:: cherchable par tous' %}</th>
<th>{% trans 'status:: Affichable pour tous' %}</th>
</thead>
@@ -42,17 +40,23 @@
{% if attribute(status, bit) is defined %}
{% set statusbit = attribute(status, bit) %}
<td>{{ statusbit['name'] }}</td>
<td>{% if statusbit['img_off'] %}<img title='{{ statusbit['labeloff'] }}' src='{{ statusbit['img_off'] }}' />{% endif %}</td>
<td>{% if statusbit['img_on'] %}<img title='{{ statusbit['labelon'] }}' src='{{ statusbit['img_on'] }}' />{% endif %}</td>
<td>
{% if statusbit['img_off'] %}
<img title='{{ statusbit['labeloff'] }}' src='{{ statusbit['img_off'] }}' />
{% endif %}
{{ statusbit['labeloff'] }}
/
{% if statusbit['img_on'] %}
<img title='{{ statusbit['labelon'] }}' src='{{ statusbit['img_on'] }}' />
{% endif %}
{{ statusbit['labelon'] }}
</td>
<td>{{ statusbit['searchable'] is defined and statusbit['searchable'] == '1' ? 'oui'| trans : 'non'| trans }}</td>
<td>{{ statusbit['printable'] is defined and statusbit['printable'] == '1' ? 'oui'| trans : 'non'| trans }}</td>
{% else %}
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
{% endif %}
</tr>
{% endfor %}

View File

@@ -9,12 +9,6 @@
<form id="fileupload" class="form-horizontal" enctype="multipart/form-data" method="post" action="{{ path('database_submit_statusbit', { 'databox_id' : app['request'].get('databox_id'), 'bit' : app['request'].get('bit') }) }}">
<fieldset>
<div class="span5 well-small">
<label for="name">
{% trans'admin::status: nom du status : '%}
<input id="name" name="name" class="input-xlarge" type="text" value="{{ status['name']|default('') }}">
</label>
</div>
<div class="span5 well">
<span class="label">{% trans'admin::status: case A'%}</span>
<div class="control-group">

View File

@@ -67,11 +67,6 @@
<table class="status-tab">
<tbody>
{% for bit, status in availableCollections['databox'].get_statusbits() %}
<tr>
<td colspan="2">
<h6>{{ status['name']|title }}</h6>
</td>
</tr>
<tr>
<td class="status-tab-left">
{% if status['img_off'] is not empty %}

View File

@@ -72,11 +72,6 @@
<table class="status-tab">
<tbody>
{% for bit, status in availableCollections['databox'].get_statusbits() %}
<tr>
<td colspan="2">
<h6>{{ status['name']|title }}</h6>
</td>
</tr>
<tr>
<td class="status-tab-left">
{% if status['img_off'] is not empty %}