Address github annotations

This commit is contained in:
Romain Neutron
2013-05-27 23:49:39 +02:00
parent 9535ee23ea
commit 7ba46abaff
7 changed files with 95 additions and 172 deletions

View File

@@ -16,7 +16,6 @@
"gedmo/doctrine-extensions" : "~2.3.0",
"imagine/imagine" : "dev-ColorSpaces@dev",
"jms/serializer" : "~0.10",
"jms/twig-js" : "dev-master",
"mediavorus/mediavorus" : "~0.3",
"media-alchemyst/media-alchemyst" : "~0.2, >=0.2.3",
"monolog/monolog" : "~1.3.0",

50
composer.lock generated
View File

@@ -3,7 +3,7 @@
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
],
"hash": "b996280dc670585a8647ca983149a73e",
"hash": "5aeb56bf583572c3c4d4da8f930f55ed",
"packages": [
{
"name": "BadFaith/BadFaith",
@@ -939,53 +939,6 @@
],
"time": "2013-03-28 16:41:24"
},
{
"name": "jms/twig-js",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/schmittjoh/twig.js.git",
"reference": "159542ed93a61801c1502497a65efbfd97628090"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/schmittjoh/twig.js/zipball/159542ed93a61801c1502497a65efbfd97628090",
"reference": "159542ed93a61801c1502497a65efbfd97628090",
"shasum": ""
},
"require": {
"php": ">=5.3.2",
"twig/twig": ">=1.8,<2.0-dev"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-0": {
"TwigJs": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache2"
],
"authors": [
{
"name": "Johannes M. Schmitt",
"email": "schmittjoh@gmail.com",
"homepage": "https://github.com/schmittjoh",
"role": "Developer of wrapped JMSSerializerBundle"
}
],
"description": "twig.js, flexible, secure, and high-performance templating engine for Javascript",
"keywords": [
"templating"
],
"time": "2013-03-26 10:59:54"
},
{
"name": "media-alchemyst/media-alchemyst",
"version": "0.2.5",
@@ -2471,7 +2424,6 @@
"dailymotion/sdk": 20,
"data-uri/data-uri": 20,
"imagine/imagine": 20,
"jms/twig-js": 20,
"mrclay/minify": 20,
"neutron/silex-imagine-provider": 20,
"neutron/silex-badfaith-provider": 20,

View File

@@ -114,8 +114,6 @@ use Silex\Provider\WebProfilerServiceProvider;
use Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser;
use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser;
use Unoconv\UnoconvServiceProvider;
use TwigJs\Twig\TwigJsExtension;
use TwigJs\JsCompiler;
use XPDF\PdfToText;
use XPDF\XPDFServiceProvider;
@@ -500,22 +498,6 @@ class Application extends SilexApplication
return $twig;
})
);
$this['twig.js.compiler'] = $this->share(function(Application $app) {
$compiler = new JsCompiler($app['twig']);
$compiler->setFilterFunction('trans', 'i18n.t');
return $compiler;
});
$this['twig.js'] = $this->share(function(Application $app) {
$twig = clone $app['twig'];
$twig->addExtension(new TwigJsExtension());
$twig->getExtension('escaper')->setDefaultStrategy(false);
$twig->setCompiler($app['twig.js.compiler']);
return $twig;
});
}
/**

View File

@@ -11,7 +11,6 @@
namespace Alchemy\Phrasea\Controller\Admin;
use Alchemy\Phrasea\Application as PhraseaApplication;
use Alchemy\Phrasea\Metadata\TagProvider;
use Alchemy\Phrasea\Vocabulary\Controller as VocabularyController;
use Silex\Application;
@@ -114,7 +113,7 @@ class Fields implements ControllerProviderInterface
$fields[] = $field->toArray();
} catch (\Exception $e) {
$connection->rollback();
$app->abort(500, _(sprintf('Field %s could not be saved, please try again or contact an admin', $jsonField['name'])));
$app->abort(500, _(sprintf('Field %s could not be saved, please try again or contact an admin.', $jsonField['name'])));
break;
}
}
@@ -127,30 +126,22 @@ class Fields implements ControllerProviderInterface
public function getLanguage(Application $app, Request $request)
{
return $app->json(array(
'something_wrong' => _('Something wrong happened, please try again or contact an admin'),
'created_success' => _('%s field has been created with success'),
'deleted_success' => _('%s field has been deleted with success'),
'something_wrong' => _('Something wrong happened, please try again or contact an admin.'),
'created_success' => _('%s field has been created with success.'),
'deleted_success' => _('%s field has been deleted with success.'),
'are_you_sure_delete' => _('Do you really want to delete the field %s ?'),
'validation_blank' => _('Field can not be blank'),
'validation_name_exists' => _('Field name already exists'),
'validation_tag_invalid' => _('Field source is not valid'),
'field_error' => _('Field %s contains errors'),
'fields_save' => _('Your configuration has been successfuly saved'),
'validation_blank' => _('Field can not be blank.'),
'validation_name_exists' => _('Field name already exists.'),
'validation_tag_invalid' => _('Field source is not valid.'),
'field_error' => _('Field %s contains errors.'),
'fields_save' => _('Your configuration has been successfuly saved.'),
));
}
public function displayApp(Application $app, Request $request, $sbas_id)
{
$languages = array();
foreach (PhraseaApplication::getAvailableLanguages() as $code => $language) {
$data = explode('_', $code);
$languages[$data[0]] = $language;
}
return $app['twig']->render('/admin/fields/index.html.twig', array(
'sbas_id' => $sbas_id,
'languages' => $languages,
'sbas_id' => $sbas_id
));
}
@@ -178,8 +169,8 @@ class Fields implements ControllerProviderInterface
$vocabulary = VocabularyController::get($app, $type);
return $app->json(array(
'type' => $vocabulary->getType(),
'name' => $vocabulary->getName(),
'type' => $vocabulary->getType(),
'name' => $vocabulary->getName(),
));
}
@@ -232,15 +223,14 @@ class Fields implements ControllerProviderInterface
$this->updateFieldWithData($app, $field, $data);
$field->save();
} catch (\Exception $e) {
$app->abort(500, _(sprintf('Field %s could not be created, please try again or contact an admin', $data['name'])));
$app->abort(500, _(sprintf('Field %s could not be created, please try again or contact an admin.', $data['name'])));
}
return $app->json($field->toArray(), 201, array(
'location' => $app->path('admin_fields_show_field', array(
'sbas_id' => $sbas_id,
'id' => $field->get_id()
))
));
))));
}
public function listFields(Application $app, $sbas_id) {
@@ -347,7 +337,7 @@ class Fields implements ControllerProviderInterface
$class = sprintf('\databox_Field_DCES_%s', $dcesElement);
if (!class_exists($class)) {
throw new BadRequestHttpException(sprintf('DCES element %s does not exist', $dcesElement));
throw new BadRequestHttpException(sprintf('DCES element %s does not exist.', $dcesElement));
}
$field->set_dces_element(new $class());
@@ -366,7 +356,7 @@ class Fields implements ControllerProviderInterface
private function validateNameField(\databox_descriptionStructure $metaStructure, array $field)
{
if (null !== $metaStructure->get_element_by_name($field['name'])) {
throw new BadRequestHttpException(_(sprintf('Field %s already exists', $field['name'])));
throw new BadRequestHttpException(_(sprintf('Field %s already exists.', $field['name'])));
}
}
@@ -375,7 +365,7 @@ class Fields implements ControllerProviderInterface
try {
\databox_field::loadClassFromTagName($field['tag']);
} catch(\Exception_Databox_metadataDescriptionNotFound $e) {
throw new BadRequestHttpException(_(sprintf('Provided tag %s is unknown', $field['tag'])));
throw new BadRequestHttpException(_(sprintf('Provided tag %s is unknown.', $field['tag'])));
}
}
@@ -385,7 +375,7 @@ class Fields implements ControllerProviderInterface
$data = @json_decode($body, true);
if (JSON_ERROR_NONE !== json_last_error()) {
throw new BadRequestHttpException('Body must contain a valid JSON payload');
throw new BadRequestHttpException('Body must contain a valid JSON payload.');
}
return $data;

View File

@@ -21,26 +21,26 @@ class TagProvider extends ExiftoolTagProvider
$this['Phraseanet'] = $this->share(function(){
return array(
'PdfText' => new \Alchemy\Phrasea\Metadata\Tag\PdfText(),
'PdfText' => new \Alchemy\Phrasea\Metadata\Tag\PdfText(),
'TfArchivedate' => new \Alchemy\Phrasea\Metadata\Tag\TfArchivedate(),
'TfAtime' => new \Alchemy\Phrasea\Metadata\Tag\TfAtime(),
'TfBasename' =>new \Alchemy\Phrasea\Metadata\Tag\TfBasename(),
'TfBits' => new \Alchemy\Phrasea\Metadata\Tag\TfBits(),
'TfChannels' => new \Alchemy\Phrasea\Metadata\Tag\TfChannels(),
'TfCtime' => new \Alchemy\Phrasea\Metadata\Tag\TfCtime(),
'TfDirname' => new \Alchemy\Phrasea\Metadata\Tag\TfDirname(),
'TfDuration' => new \Alchemy\Phrasea\Metadata\Tag\TfDuration(),
'TfEditdate' => new \Alchemy\Phrasea\Metadata\Tag\TfEditdate(),
'TfExtension' => new \Alchemy\Phrasea\Metadata\Tag\TfExtension(),
'TfFilename' => new \Alchemy\Phrasea\Metadata\Tag\TfFilename(),
'TfFilepath' => new \Alchemy\Phrasea\Metadata\Tag\TfFilepath(),
'TfHeight' => new \Alchemy\Phrasea\Metadata\Tag\TfHeight(),
'TfMimetype' => new \Alchemy\Phrasea\Metadata\Tag\TfMimetype(),
'TfMtime' => new \Alchemy\Phrasea\Metadata\Tag\TfMtime(),
'TfQuarantine' => new \Alchemy\Phrasea\Metadata\Tag\TfQuarantine(),
'TfRecordid' => new \Alchemy\Phrasea\Metadata\Tag\TfRecordid(),
'TfSize' => new \Alchemy\Phrasea\Metadata\Tag\TfSize(),
'TfWidth' => new \Alchemy\Phrasea\Metadata\Tag\TfWidth(),
'TfAtime' => new \Alchemy\Phrasea\Metadata\Tag\TfAtime(),
'TfBasename' => new \Alchemy\Phrasea\Metadata\Tag\TfBasename(),
'TfBits' => new \Alchemy\Phrasea\Metadata\Tag\TfBits(),
'TfChannels' => new \Alchemy\Phrasea\Metadata\Tag\TfChannels(),
'TfCtime' => new \Alchemy\Phrasea\Metadata\Tag\TfCtime(),
'TfDirname' => new \Alchemy\Phrasea\Metadata\Tag\TfDirname(),
'TfDuration' => new \Alchemy\Phrasea\Metadata\Tag\TfDuration(),
'TfEditdate' => new \Alchemy\Phrasea\Metadata\Tag\TfEditdate(),
'TfExtension' => new \Alchemy\Phrasea\Metadata\Tag\TfExtension(),
'TfFilename' => new \Alchemy\Phrasea\Metadata\Tag\TfFilename(),
'TfFilepath' => new \Alchemy\Phrasea\Metadata\Tag\TfFilepath(),
'TfHeight' => new \Alchemy\Phrasea\Metadata\Tag\TfHeight(),
'TfMimetype' => new \Alchemy\Phrasea\Metadata\Tag\TfMimetype(),
'TfMtime' => new \Alchemy\Phrasea\Metadata\Tag\TfMtime(),
'TfQuarantine' => new \Alchemy\Phrasea\Metadata\Tag\TfQuarantine(),
'TfRecordid' => new \Alchemy\Phrasea\Metadata\Tag\TfRecordid(),
'TfSize' => new \Alchemy\Phrasea\Metadata\Tag\TfSize(),
'TfWidth' => new \Alchemy\Phrasea\Metadata\Tag\TfWidth(),
);
});
}
@@ -58,101 +58,101 @@ class TagProvider extends ExiftoolTagProvider
$table = parent::getLookupTable();
$table['phraseanet'] = array(
'pdftext' => array(
'tagname' => 'PdfText',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\PdfText',
'namespace' => 'Phraseanet'),
'pdftext' => array(
'tagname' => 'PdfText',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\PdfText',
'namespace' => 'Phraseanet'),
'tfarchivedate' => array(
'tagname' => 'TfArchivedate',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfArchivedate',
'namespace' => 'Phraseanet'
),
'tfatime' => array(
'tfatime' => array(
'tagname' => 'TfAtime',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfAtime',
'namespace' => 'Phraseanet'
),
'tfbasename' => array(
'tagname' => 'TfBasename',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfBasename',
'namespace' => 'Phraseanet'
'tfbasename' => array(
'tagname' => 'TfBasename',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfBasename',
'namespace' => 'Phraseanet'
),
'tfbits' => array(
'tagname' => 'TfBits',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfBits',
'namespace' => 'Phraseanet'
'tfbits' => array(
'tagname' => 'TfBits',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfBits',
'namespace' => 'Phraseanet'
),
'tfchannels' => array(
'tfchannels' => array(
'tagname' => 'TfChannels',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfChannels',
'namespace' => 'Phraseanet'
),
'tTfCtime' => array(
'tagname' => 'TfCtime',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfCtime',
'namespace' => 'Phraseanet'
'tTfCtime' => array(
'tagname' => 'TfCtime',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfCtime',
'namespace' => 'Phraseanet'
),
'tfdirname' => array(
'tagname' => 'TfDirname',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfDirname',
'namespace' => 'Phraseanet'
'tfdirname' => array(
'tagname' => 'TfDirname',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfDirname',
'namespace' => 'Phraseanet'
),
'tfduration' => array(
'tagname' => 'TfDuration',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfDuration',
'namespace' => 'Phraseanet'
'tfduration' => array(
'tagname' => 'TfDuration',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfDuration',
'namespace' => 'Phraseanet'
),
'tfeditdate' => array(
'tagname' => 'TfEditdate',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfEditdate',
'namespace' => 'Phraseanet'
'tfeditdate' => array(
'tagname' => 'TfEditdate',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfEditdate',
'namespace' => 'Phraseanet'
),
'tfextension' => array(
'tagname' => 'TfExtension',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfExtension',
'namespace' => 'Phraseanet'
'tfextension' => array(
'tagname' => 'TfExtension',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfExtension',
'namespace' => 'Phraseanet'
),
'tffilename' => array(
'tagname' => 'TfFilename',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfFilename',
'namespace' => 'Phraseanet'
'tffilename' => array(
'tagname' => 'TfFilename',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfFilename',
'namespace' => 'Phraseanet'
),
'tffilepath' => array(
'tffilepath' => array(
'tagname' => 'TfFilepath',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfFilepath',
'namespace' => 'Phraseanet'
),
'tfheight' => array(
'tagname' => 'TfHeight',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfHeight',
'namespace' => 'Phraseanet'
'tfheight' => array(
'tagname' => 'TfHeight',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfHeight',
'namespace' => 'Phraseanet'
),
'tfmimetype' => array(
'tfmimetype' => array(
'tagname' => 'TfMimetype',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfMimetype',
'namespace' => 'Phraseanet'
),
'tfmtime' => array(
'tfmtime' => array(
'tagname' => 'TfMtime',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfMtime',
'namespace' => 'Phraseanet'
),
'tfquarantine' => array(
'tfquarantine' => array(
'tagname' => 'TfQuarantine',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfQuarantine',
'namespace' => 'Phraseanet'
),
'tfrecordid' => array(
'tfrecordid' => array(
'tagname' => 'TfRecordid',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfRecordid',
'namespace' => 'Phraseanet'
),
'tfsize' => array(
'tfsize' => array(
'tagname' => 'TfSize',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfSize',
'namespace' => 'Phraseanet'
),
'tfwidth' => array(
'tfwidth' => array(
'tagname' => 'TfWidth',
'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfWidth',
'namespace' => 'Phraseanet'

View File

@@ -39,7 +39,7 @@
<div class="row-fluid">
<div class="span12">
<div class="sidebar-add-block">
<button type="button" class="btn btn-success btn-add-field"><i class="icon-plus icon-white"></i>{% trans %}Add new field{% endtrans %}</button>
<button type="button" class="btn btn-success btn-add-field"><i class="icon-plus icon-white"></i>{% trans %}Add a new field{% endtrans %}</button>
</div>
<div class="well well-small add-field-block" style="display:none">
<h3>{% trans %}Add a new field{% endtrans %}</h3>
@@ -194,7 +194,7 @@
<td>
<label for="readonly" class="checkbox">
<input id="readonly" type="checkbox" <%= field.readonly ? "checked='checked'" : "" %> />
{% trans %}Read only{% endtrans %}
{% trans %}Read-only{% endtrans %}
</label>
</td>
</tr>
@@ -257,7 +257,7 @@
<script type="text/template" id="field_error_template">
<% if(messages.length > 0) { %>
<div class="well well-small">
<i class="icon-exclamation-sign"></i> {% trans %} Current configuration contains some errors {% endtrans %}
<i class="icon-exclamation-sign"></i> {% trans %}Current configuration contains some errors{% endtrans %}
</div>
<% } %>
</script>

View File

@@ -120,7 +120,7 @@
</tr>
</table>
<div class="edit-form">
<h4>{% trans %}Advanced field parameters{% endtrans %}</h4>
<h4>{% trans %}Advanced field parameters{% endtrans %}</h4>
<table>
<tr>
<td><label for="tbranch">{% trans %}Thesaurus branch{% endtrans %}</label></td>
@@ -168,11 +168,11 @@
</td>
</tr>
<tr>
<td><label for="separator">{% trans %}Separator{% endtrans %}</label></td>
<td><label for="separator">{% trans %}Separator{% endtrans %}</label></td>
<td><input id="separator" type="text" value="<%= field.separator %>" /></td>
</tr>
</table>
<h4>{% trans %}Display & action settings{% endtrans %}</h4>
<h4>{% trans %}Display & action settings{% endtrans %}</h4>
<table>
<tr>
<td>
@@ -194,7 +194,7 @@
<td>
<label for="readonly" class="checkbox">
<input id="readonly" type="checkbox" <%= field.readonly ? "checked='checked'" : "" %> />
{% trans %}Read only{% endtrans %}
{% trans %}Read-only{% endtrans %}
</label>
</td>
</tr>
@@ -259,7 +259,7 @@
<script type="text/template" id="field_error_template">
<% if(messages.length > 0) { %>
<div class="well well-small">
<i class="icon-exclamation-sign"></i> {% trans %} Current configuration contains some errors {% endtrans %}
<i class="icon-exclamation-sign"></i> {% trans %}Current configuration contains some errors{% endtrans %}
</div>
<% } %>
</script>