Use path() method to genrate url in view && clean JS code

Fix terms of use paths
This commit is contained in:
Nicolas Le Goff
2013-03-27 18:31:56 +01:00
committed by Romain Neutron
parent 10f8569dde
commit 099dfc311d
13 changed files with 658 additions and 682 deletions

View File

@@ -1,13 +1,13 @@
{% extends 'account/base.html.twig' %}
{% extends "account/base.html.twig" %}
{% block title %}
{% trans 'Granted bases' %}
{% trans "Granted bases" %}
{% endblock %}
{% set selected = "access" %}
{% block content %}
<form name="updatingDemand" id="updatingDemand" action="/account/" method="post">
<form name="updatingDemand" id="updatingDemand" action="{{ path("submit_update_account") }}" method="post">
<table style="table-layout: fixed; width:100%">
<tr>
<td style="width: 180px; text-align: right">&nbsp;</td>
@@ -15,21 +15,21 @@
<td style="width: 180px;">&nbsp;</td>
</tr>
{% for sbasId, baseInsc in inscriptions %}
{% if baseInsc['CollsRegistered'] or baseInsc['CollsRefuse'] or baseInsc['CollsWait'] or baseInsc['CollsIntime'] or baseInsc['CollsOuttime'] or baseInsc['CollsNonactif'] or baseInsc['CollsCGU'] or baseInsc['Colls'] %}
{% if baseInsc["CollsRegistered"] or baseInsc["CollsRefuse"] or baseInsc["CollsWait"] or baseInsc["CollsIntime"] or baseInsc["CollsOuttime"] or baseInsc["CollsNonactif"] or baseInsc["CollsCGU"] or baseInsc["Colls"] %}
<tr>
<td colspan="3" style="text-align: center;"><h3>{{ sbasId | sbas_names(app) }}</h3></td>
</tr>
{% endif %}
{% if baseInsc['CollsRegistered'] is not none %}
{% for base in baseInsc['CollsRegistered']%}
{% if baseInsc["CollsRegistered"] is not none %}
{% for base in baseInsc["CollsRegistered"]%}
{% for collId, isTrue in base %}
{% set base_id = sbasId |base_from_coll(collId, app) %}
<tr>
<td colspan="3" style="text-align:center;">
{% trans 'login::register: acces authorise sur la collection ' %}{{ sbasId |sbas_names(app) }}
{% if isTrue | trim != '' %}
<a class="inscriptlink" href="/prod/TOU/?to_display[]={{sbasId}}">{% trans 'login::register::CGU: lire les CGU' %}</a>
{% trans "login::register: acces authorise sur la collection " %}{{ sbasId |sbas_names(app) }}
{% if isTrue | trim != "" %}
<a class="inscriptlink" href="{{ path('get_tou', {'to_display[]' : sbasId}) }}">{% trans "login::register::CGU: lire les CGU" %}</a>
{% endif %}
</td>
</tr>
@@ -41,14 +41,14 @@
</tr>
{% endif %}
{% if baseInsc['CollsRefuse'] %}
{% for collId, isTrue in baseInsc['CollsRefuse'] %}
{% if baseInsc["CollsRefuse"] %}
{% for collId, isTrue in baseInsc["CollsRefuse"] %}
{% set base_id = sbasId |base_from_coll(collId, app) %}
<tr>
<td colspan="3" style="text-align: center;">
<span style="color: red;">{% trans 'login::register: acces refuse sur la collection ' %}{{ sbasId |sbas_names(app) }}</span>
{% if isTrue | trim != '' %}
<a class="inscriptlink" href="/prod/TOU/?to_display[]={{sbasId}}">{% trans 'login::register::CGU: lire les CGU' %}</a>
<span style="color: red;">{% trans "login::register: acces refuse sur la collection " %}{{ sbasId |sbas_names(app) }}</span>
{% if isTrue | trim != "" %}
<a class="inscriptlink" href="{{ path('get_tou', {'to_display[]' : sbasId}) }}">{% trans "login::register::CGU: lire les CGU" %}</a>
{% endif %}
</td>
</tr>
@@ -59,14 +59,14 @@
</tr>
{% endif %}
{% if baseInsc['CollsWait'] %}
{% for collId, isTrue in baseInsc['CollsWait'] %}
{% if baseInsc["CollsWait"] %}
{% for collId, isTrue in baseInsc["CollsWait"] %}
{% set base_id = sbasId |base_from_coll(collId, app) %}
<tr>
<td colspan="3" style="text-align: center;">
<span style="color: orange;">{% trans 'login::register: en attente d\'acces sur' %} {{ sbasId |sbas_names(app) }}</span>
{% if isTrue | trim != '' %}
<a class="inscriptlink" href="/prod/TOU/?to_display[]={{sbasId}}">{% trans 'login::register::CGU: lire les CGU' %}</a>
<span style="color: orange;">{% trans "login::register: en attente d\'acces sur" %} {{ sbasId |sbas_names(app) }}</span>
{% if isTrue | trim != "" %}
<a class="inscriptlink" href="{{ path('get_tou', {'to_display[]' : sbasId}) }}">{% trans "login::register::CGU: lire les CGU" %}</a>
{% endif %}
</td>
</tr>
@@ -74,14 +74,14 @@
<tr style="height: 5px;"><td></td></tr>
{% endif %}
{% if baseInsc['CollsIntime'] %}
{% for collId, isTrue in baseInsc['CollsIntime'] %}
{% if baseInsc["CollsIntime"] %}
{% for collId, isTrue in baseInsc["CollsIntime"] %}
{% set base_id = sbasId |base_from_coll(collId, app) %}
<tr>
<td colspan="3" style="text-align: center;">
<span>{% trans 'login::register: acces temporaire sur' %} {{ sbasId |sbas_names(app) }}</span>
{% if isTrue |trim != '' %}
<a class="inscriptlink" href="/prod/TOU/?to_display[]={{sbasId}}">{% trans 'login::register::CGU: lire les CGU' %}</a>
<span>{% trans "login::register: acces temporaire sur" %} {{ sbasId |sbas_names(app) }}</span>
{% if isTrue |trim != "" %}
<a class="inscriptlink" href="{{ path('get_tou', {'to_display[]' : sbasId}) }}">{% trans "login::register::CGU: lire les CGU" %}</a>
{% endif %}
</td>
</tr>
@@ -89,14 +89,14 @@
<tr style="height: 5px;"><td></td></tr>
{% endif %}
{% if baseInsc['CollsOuttime'] %}
{% for collId, isTrue in baseInsc['CollsOuttime'] %}
{% if baseInsc["CollsOuttime"] %}
{% for collId, isTrue in baseInsc["CollsOuttime"] %}
{% set base_id = sbasId |base_from_coll(collId, app) %}
<tr>
<td colspan="3" style="text-align: center;">
<span style="color:red;">{% trans 'login::register: acces temporaire termine sur ' %}{{ sbasId |sbas_names(app) }}</span>
{% if isTrue |trim != '' %}
<a class="inscriptlink" href="/prod/TOU/?to_display[]={{sbasId}}">{% trans 'login::register::CGU: lire les CGU' %}</a>
<span style="color:red;">{% trans "login::register: acces temporaire termine sur " %}{{ sbasId |sbas_names(app) }}</span>
{% if isTrue |trim != "" %}
<a class="inscriptlink" href="{{ path('get_tou', {'to_display[]' : sbasId}) }}">{% trans "login::register::CGU: lire les CGU" %}</a>
{% endif %}
</td>
</tr>
@@ -104,14 +104,14 @@
<tr style="height: 5px;"><td></td></tr>
{% endif %}
{% if baseInsc['CollsNonactif'] %}
{% for collId, isTrue in baseInsc['CollsNonactif'] %}
{% if baseInsc["CollsNonactif"] %}
{% for collId, isTrue in baseInsc["CollsNonactif"] %}
{% set base_id = sbasId |base_from_coll(collId, app) %}
<tr>
<td colspan="3" style="text-align: center;">
<span style="color:red;">{% trans 'login::register: acces supendu sur' %} {{ sbasId |sbas_names(app) }}</span>
{% if isTrue |trim != '' %}
<a class="inscriptlink" href="/prod/TOU/?to_display[]={{sbasId}}">{% trans 'login::register::CGU: lire les CGU' %}</a>
<span style="color:red;">{% trans "login::register: acces supendu sur" %} {{ sbasId |sbas_names(app) }}</span>
{% if isTrue |trim != "" %}
<a class="inscriptlink" href="{{ path('get_tou', {'to_display[]' : sbasId}) }}">{% trans "login::register::CGU: lire les CGU" %}</a>
{% endif %}
</td>
</tr>
@@ -119,48 +119,48 @@
<tr style="height: 5px;"><td></td></tr>
{% endif %}
{% if (baseInsc['CollsCGU'] or baseInsc['Colls']) and baseInsc['inscript'] %}
{% if baseInsc['Colls'] %}
{% if baseInsc['CGU'] %}
{% if (baseInsc["CollsCGU"] or baseInsc["Colls"]) and baseInsc["inscript"] %}
{% if baseInsc["Colls"] %}
{% if baseInsc["CGU"] %}
<tr>
<td colspan="3" style="text-align: center;">{% trans 'login::register: L\'acces aux bases ci-dessous implique l\'acceptation des Conditions Generales d\'Utilisation (CGU) suivantes' %}</td>
<td colspan="3" style="text-align: center;">{% trans "login::register: L\'acces aux bases ci-dessous implique l\'acceptation des Conditions Generales d\'Utilisation (CGU) suivantes" %}</td>
</tr>
<tr>
<td colspan="3" style="text-align: center;"><div style="width: 90%; height: 120px; text-align: left; overflow: auto;">{{ baseInsc['CGU'] }}</div></td>
<td colspan="3" style="text-align: center;"><div style="width: 90%; height: 120px; text-align: left; overflow: auto;">{{ baseInsc["CGU"] }}</div></td>
</tr>
{% endif %}
{% for collId, collName in baseInsc['Colls'] %}
{% for collId, collName in baseInsc["Colls"] %}
{% set base_id = sbasId |base_from_coll(collId, app) %}
<tr>
<td style="text-align: right;">{{ collName }}</td>
<td></td>
<td class="TD_R" style="width: 200px;">
<input style="width: 15px;" class="checkbox" type="checkbox" name="demand[]" value="{{ base_id }}" />
<span>{% trans 'login::register: Faire une demande d\'acces' %}</span>
<span>{% trans "login::register: Faire une demande d\'acces" %}</span>
</td>
</tr>
{% endfor %}
{% endif %}
{% if baseInsc['CollsCGU'] %}
{% for collId, collDesc in baseInsc['CollsCGU'] %}
{% if baseInsc["CollsCGU"] %}
{% for collId, collDesc in baseInsc["CollsCGU"] %}
{% set base_id = sbasId |base_from_coll(collId, app) %}
<tr>
<td colspan="3" style="text-align: center;"><hr style="width: 80%"/></td>
</tr>
<tr>
<td colspan="3" style="text-align: center;">{% trans 'login::register: L\'acces aux bases ci-dessous implique l\'acceptation des Conditions Generales d\'Utilisation (CGU) suivantes' %}</td>
<td colspan="3" style="text-align: center;">{% trans "login::register: L\'acces aux bases ci-dessous implique l\'acceptation des Conditions Generales d\'Utilisation (CGU) suivantes" %}</td>
</tr>
<tr>
<td colspan="3" style="text-align: center;">
<div style="width: 90%; height: 120px; text-align: left; overflow: auto;">{{ collDesc['CGU'] }}</div>
<div style="width: 90%; height: 120px; text-align: left; overflow: auto;">{{ collDesc["CGU"] }}</div>
</td>
</tr>
<tr>
<td style="text-align: right;">{{ collDesc['name'] }}</td>
<td style="text-align: right;">{{ collDesc["name"] }}</td>
<td></td>
<td class="TD_R" style="width: 200px;">
<input style="width: 15px;" class="checkbox" type="checkbox" name="demand[]" value="{{ base_id }}" />
<span>{% trans 'login::register: Faire une demande d\'acces' %}</span>
<span>{% trans "login::register: Faire une demande d\'acces" %}</span>
</td>
</tr>
{% endfor %}
@@ -169,7 +169,7 @@
{% endfor %}
</table>
<div class="form-actions">
<input type="submit" class="btn btn-primary" value="{% trans 'boutton::valider' %}">
<input type="submit" class="btn btn-info" value="{% trans "boutton::valider" %}">
</div>
</form>
{% endblock %}

View File

@@ -1,4 +1,4 @@
{% extends 'account/base.html.twig' %}
{% extends "account/base.html.twig" %}
{% import "login/common/macros.html.twig" as auth_macro %}
@@ -9,221 +9,224 @@
<script type="text/javascript" src="/include/minify/f=/skins/geonames/geonames.js"></script>
<script type="text/javascript">
initialize_geoname_field($('#form_geonameid'));
initialize_geoname_field($("#form_geonameid"));
</script>
{% endblock %}
{% block title %}
{% trans 'login:: Mon compte' %}
{% trans "login:: Mon compte" %}
{% endblock %}
{% block content %}
<div class="row-fluid">
<div class="span12" id="phr-account">
{% if notice | trim != '' %}
<div class="notice alert alert-error">{{ notice }}</div>
<div class="span12">
{% if notice | trim != "" %}
<div class="alert alert-error">{{ notice }}</div>
{% endif %}
{{ auth_macro.flashes() }}
<form name="account" id="account" class="form-horizontal" action="/account/" method="post">
<legend>{% trans 'Informations personnelles' %}</legend>
<div class="control-group">
<div class="controls">
<p><a href="/account/reset-password/" target="_self">{% trans 'admin::compte-utilisateur changer mon mot de passe' %}</a></p>
</div>
</div>
<form name="account" id="account" class="form-horizontal" action="{{ path("submit_update_account") }}" method="post">
<div class="row-fluid">
<div class="span12 well well-small" id="phr-account">
<legend>{% trans "Informations personnelles" %}</legend>
<div class="control-group">
<label class="form_label control-label" for="form_login">{% trans 'admin::compte-utilisateur identifiant' %}</label>
<label class="form_label control-label" for="form_login"><strong>{% trans "admin::compte-utilisateur identifiant" %}</strong></label>
<div class="controls">
<p>{{ app['authentication'].getUser().get_login() }}</p>
<span class="control-span">{{ app["authentication"].getUser().get_login() }}</span>
<p class="form_alert help-block"></p>
</div>
</div>
<div class="control-group">
<label class="form_label control-label" for="form_gender">{% trans 'admin::compte-utilisateur sexe' %}</label>
<label class="form_label control-label" for="form_gender"><strong>{% trans "admin::compte-utilisateur sexe" %}</strong></label>
<div class="controls">
<select class="input-xlarge">
<option {% if app['authentication'].getUser().get_gender() == "0" %}selected{% endif %} value="0" >
{% trans 'admin::compte-utilisateur:sexe: mademoiselle' %}
<option {% if app["authentication"].getUser().get_gender() == "0" %}selected{% endif %} value="0" >
{% trans "admin::compte-utilisateur:sexe: mademoiselle" %}
</option>
<option {% if app['authentication'].getUser().get_gender() == "1" %}selected{% endif %} value="1" >
{% trans 'admin::compte-utilisateur:sexe: madame' %}
<option {% if app["authentication"].getUser().get_gender() == "1" %}selected{% endif %} value="1" >
{% trans "admin::compte-utilisateur:sexe: madame" %}
</option>
<option {% if app['authentication'].getUser().get_gender() == "2" %}selected{% endif %} value="2" >
{% trans 'admin::compte-utilisateur:sexe: monsieur' %}
<option {% if app["authentication"].getUser().get_gender() == "2" %}selected{% endif %} value="2" >
{% trans "admin::compte-utilisateur:sexe: monsieur" %}
</option>
</select>
<p class="form_alert help-block"></p>
</div>
</div>
<div class="control-group">
<label class="form_label control-label" for="form_lastname">{% trans 'admin::compte-utilisateur nom' %}</label>
<label class="form_label control-label" for="form_lastname"><strong>{% trans "admin::compte-utilisateur nom" %}</strong></label>
<div class="controls">
<input class="input_element input-xlarge" type="text" name="form_lastname" id="form_lastname" value="{{ app['authentication'].getUser().get_lastname() }}" />
<input class="input_element input-xlarge" type="text" name="form_lastname" id="form_lastname" value="{{ app["authentication"].getUser().get_lastname() }}" />
<p class="form_alert help-block"></p>
</div>
</div>
<div class="control-group">
<label class="form_label control-label" for="form_firstname">{% trans 'admin::compte-utilisateur prenom' %}</label>
<label class="form_label control-label" for="form_firstname"><strong>{% trans "admin::compte-utilisateur prenom" %}</strong></label>
<div class="controls">
<input class="input_element input-xlarge" type="text" name="form_firstname" id="form_firstname" value="{{ app['authentication'].getUser().get_firstname() }}" />
<input class="input_element input-xlarge" type="text" name="form_firstname" id="form_firstname" value="{{ app["authentication"].getUser().get_firstname() }}" />
<p class="form_alert help-block"></p>
</div>
</div>
<div class="control-group">
<label class="form_label control-label" for="form_firstname">{% trans 'admin::compte-utilisateur email' %}</label>
<label class="form_label control-label" for="form_firstname"><strong>{% trans "admin::compte-utilisateur email" %}</strong></label>
<div class="controls">
<p>{{ app['authentication'].getUser().get_email() }} <a href="/account/reset-email/" target="_self">{% trans 'login:: Changer mon adresse email' %}</a></p>
<span class="control-span">{{ app["authentication"].getUser().get_email() }} <a href="{{ path("account_reset_email") }}" target="_self">{% trans "login:: Changer mon adresse email" %}</a></span>
<p class="form_alert help-block"></p>
</div>
</div>
<div class="control-group">
<label class="form_label control-label" for="form_address">{% trans 'admin::compte-utilisateur adresse' %}</label>
<label class="control-label"><strong>{% trans "Password" %}</strong></label>
<div class="controls">
<input class="input_element input-xlarge" type="text" name="form_address" id="form_address" value="{{ app['authentication'].getUser().get_address() }}" />
<span class="control-span"><a href="{{ path("reset_password") }}" target="_self">{% trans "admin::compte-utilisateur changer mon mot de passe" %}</a></span>
</div>
</div>
<div class="control-group">
<label class="form_label control-label" for="form_address"><strong>{% trans "admin::compte-utilisateur adresse" %}</strong></label>
<div class="controls">
<input class="input_element input-xlarge" type="text" name="form_address" id="form_address" value="{{ app["authentication"].getUser().get_address() }}" />
<p class="form_alert help-block"></p>
</div>
</div>
<div class="control-group">
<label class="form_label control-label" for="form_zip">{% trans 'admin::compte-utilisateur code postal' %}</label>
<label class="form_label control-label" for="form_zip"><strong>{% trans "admin::compte-utilisateur code postal" %}</strong></label>
<div class="controls">
<input class="input_element input-xlarge" type="text" name="form_zip" id="form_zip" value="{{ app['authentication'].getUser().get_zipcode() }}" />
<input class="input_element input-xlarge" type="text" name="form_zip" id="form_zip" value="{{ app["authentication"].getUser().get_zipcode() }}" />
<p class="form_alert help-block"></p>
</div>
</div>
<div class="control-group">
<label class="form_label control-label" for="form_city">{% trans 'admin::compte-utilisateur ville' %}</label>
<label class="form_label control-label" for="form_city"><strong>{% trans "admin::compte-utilisateur ville" %}</strong></label>
<div class="controls">
<input class="input_element input-xlarge geoname_field" type="text" name="form_geonameid" id="form_geonameid" geonameid="{{ app['authentication'].getUser().get_geonameid() }}" value="{{ app['geonames'].name_from_id(app['authentication'].getUser().get_geonameid()) }}" />
<input class="input_element input-xlarge geoname_field" type="text" name="form_geonameid" id="form_geonameid" geonameid="{{ app["authentication"].getUser().get_geonameid() }}" value="{{ app["geonames"].name_from_id(app["authentication"].getUser().get_geonameid()) }}" />
<p class="form_alert help-block"></p>
</div>
</div>
<div class="control-group">
<label class="form_label control-label"></label>
<label class="form_label control-label" for="form_function"><strong>{% trans "admin::compte-utilisateur poste" %}</strong></label>
<div class="controls">
<div id="test_city" style="position: absolute; width: 200px; max-height: 200px; overflow-y: auto; z-index: 99999;"></div>
<input class="input_element input-xlarge" type="text" name="form_function" id="form_function" value="{{ app["authentication"].getUser().get_position() }}" />
<p class="form_alert help-block"></p>
</div>
</div>
<div class="control-group">
<label class="form_label control-label" for="form_function">{% trans 'admin::compte-utilisateur poste' %}</label>
<label class="form_label control-label" for="form_company"><strong>{% trans "admin::compte-utilisateur societe" %}</strong></label>
<div class="controls">
<input class="input_element input-xlarge" type="text" name="form_function" id="form_function" value="{{ app['authentication'].getUser().get_position() }}" />
<input class="input_element input-xlarge" type="text" name="form_company" id="form_company" value="{{ app["authentication"].getUser().get_company() }}" />
<p class="form_alert help-block"></p>
</div>
</div>
<div class="control-group">
<label class="form_label control-label" for="form_company">{% trans 'admin::compte-utilisateur societe' %}</label>
<label class="form_label control-label" for="form_activity"><strong>{% trans "admin::compte-utilisateur activite" %}</strong></label>
<div class="controls">
<input class="input_element input-xlarge" type="text" name="form_company" id="form_company" value="{{ app['authentication'].getUser().get_company() }}" />
<input class="input_element input-xlarge" type="text" name="form_activity" id="form_activity" value="{{ app["authentication"].getUser().get_job() }}" />
<p class="form_alert help-block"></p>
</div>
</div>
<div class="control-group">
<label class="form_label control-label" for="form_activity">{% trans 'admin::compte-utilisateur activite' %}</label>
<label class="form_label control-label" for="form_phone"><strong>{% trans "admin::compte-utilisateur telephone" %}</strong></label>
<div class="controls">
<input class="input_element input-xlarge" type="text" name="form_activity" id="form_activity" value="{{ app['authentication'].getUser().get_job() }}" />
<input class="input_element input-xlarge" type="text" name="form_phone" id="form_phone" value="{{ app["authentication"].getUser().get_tel() }}" />
<p class="form_alert help-block"></p>
</div>
</div>
<div class="control-group">
<label class="form_label control-label" for="form_phone">{% trans 'admin::compte-utilisateur telephone' %}</label>
<label class="form_label control-label" for="form_fax"><strong>{% trans "admin::compte-utilisateur fax" %}</strong></label>
<div class="controls">
<input class="input_element input-xlarge" type="text" name="form_phone" id="form_phone" value="{{ app['authentication'].getUser().get_tel() }}" />
<p class="form_alert help-block"></p>
</div>
</div>
<div class="control-group">
<label class="form_label control-label" for="form_fax">{% trans 'admin::compte-utilisateur fax' %}</label>
<div class="controls">
<input class="input_element input-xlarge" type="text" name="form_fax" id="form_fax" value="{{ app['authentication'].getUser().get_fax() }}" />
<input class="input_element input-xlarge" type="text" name="form_fax" id="form_fax" value="{{ app["authentication"].getUser().get_fax() }}" />
<p class="form_alert help-block"></p>
</div>
</div>
<legend>{% trans 'Notification par email' %}</legend>
<legend>{% trans "Notification par email" %}</legend>
{% for notification_group, nots in notifications%}
<p style="font-weight: bold;">{{ notification_group }}</p>
{% for notification in nots %}
<div class="control-group">
<label class="form_label control-label"></label>
<span class="pull-left"><strong>{{ notification_group }}</strong></span>
<div class="controls">
<label class="checkbox" for="notif_{{ notification['id'] }}">
<input type="checkbox" id="notif_{{ notification['id'] }}" name="notifications[{{ notification['id'] }}]" {% if not app['authentication'].getUser().getPrefs('notification_' ~ notification['id']) == '0' %}checked{% endif %} value="1"/>
{{ notification['description'] }}
<ul class="unstyled well">
{% for notification in nots %}
<li>
<label class="checkbox" for="notif_{{ notification["id"] }}">
<input type="checkbox" id="notif_{{ notification["id"] }}" name="notifications[{{ notification["id"] }}]" {% if not app["authentication"].getUser().getPrefs("notification_" ~ notification["id"]) == "0" %}checked{% endif %} value="1"/>
{{ notification["description"] }}
</label>
<p class="form_alert help-block"></p>
</li>
{% endfor %}
</ul>
</div>
</div>
{% endfor %}
<legend>{% trans "FTP" %}</legend>
<div class="control-group">
<div class="controls">
<label class="form_label checkbox" for="form_activeFTP">{% trans "admin::compte-utilisateur:ftp: Activer le compte FTP" %}
<input class="input_element input-xlarge" type="checkbox" name="form_activeFTP" id="form_activeFTP" {% if app["authentication"].getUser().get_activeftp() %}checked{% endif %} onchange="if(this.checked){$('#ftpinfos').slideDown();}else{$('#ftpinfos').slideUp();}" />
</label>
<p class="form_alert help-block"></p>
</div>
</div>
{% endfor %}
{% endfor %}
<legend>{% trans 'FTP' %}</legend>
<div id="ftpinfos" style="display:{% if app["authentication"].getUser().get_activeftp() %}block{% else %}none{% endif %}">
<div class="control-group">
<label class="form_label control-label" for="form_activeFTP">{% trans 'admin::compte-utilisateur:ftp: Activer le compte FTP' %}</label>
<label class="form_label control-label" for="form_addrFTP"><strong>{% trans "phraseanet:: adresse" %}</strong></label>
<div class="controls">
<input class="input_element input-xlarge" type="checkbox" name="form_activeFTP" id="form_activeFTP" {% if app['authentication'].getUser().get_activeftp() %}checked{% endif %} onchange="if(this.checked){$('#ftpinfos').slideDown();}else{$('#ftpinfos').slideUp();}" />
<p class="form_alert help-block"></p>
</div>
</div>
<div id="ftpinfos" style="display: {% if app['authentication'].getUser().get_activeftp() %}block{% else %}none{% endif %}">
<div class="control-group">
<label class="form_label control-label" for="form_addrFTP">{% trans 'phraseanet:: adresse' %}</label>
<div class="controls">
<input class="input_element input-xlarge" type="text" name="form_addrFTP" id="form_addrFTP" value="{{ app['authentication'].getUser().get_ftp_address() }}" />
<input class="input_element input-xlarge" type="text" name="form_addrFTP" id="form_addrFTP" value="{{ app["authentication"].getUser().get_ftp_address() }}" />
<p class="form_alert help-block"></p>
</div>
</div>
<div class="control-group">
<label class="form_label control-label" for="form_loginFTP">{% trans 'admin::compte-utilisateur identifiant' %}</label>
<label class="form_label control-label" for="form_loginFTP"><strong>{% trans "admin::compte-utilisateur identifiant" %}</strong></label>
<div class="controls">
<input class="input_element input-xlarge" type="text" name="form_loginFTP" id="form_loginFTP" value="{{ app['authentication'].getUser().get_ftp_login() }}" />
<input class="input_element input-xlarge" type="text" name="form_loginFTP" id="form_loginFTP" value="{{ app["authentication"].getUser().get_ftp_login() }}" />
<p class="form_alert help-block"></p>
</div>
</div>
<div class="control-group">
<label class="form_label control-label" for="form_pwdFTP">{% trans 'admin::compte-utilisateur mot de passe' %}</label>
<label class="form_label control-label" for="form_pwdFTP"><strong>{% trans "admin::compte-utilisateur mot de passe" %}</strong></label>
<div class="controls">
<input class="input_element input-xlarge" type="text" name="form_pwdFTP" id="form_pwdFTP" value="{{ app['authentication'].getUser().get_ftp_password() }}" />
<input class="input_element input-xlarge" type="text" name="form_pwdFTP" id="form_pwdFTP" value="{{ app["authentication"].getUser().get_ftp_password() }}" />
<p class="form_alert help-block"></p>
</div>
</div>
<div class="control-group">
<label class="form_label control-label" for="form_destFTP">{% trans 'admin::compte-utilisateur:ftp: repertoire de destination ftp' %}</label>
<label class="form_label control-label" for="form_destFTP"><strong>{% trans "admin::compte-utilisateur:ftp: repertoire de destination ftp" %}</strong></label>
<div class="controls">
<input class="input_element input-xlarge" type="text" name="form_destFTP" id="form_destFTP" value="{{ app['authentication'].getUser().get_ftp_dir() }}" />
<input class="input_element input-xlarge" type="text" name="form_destFTP" id="form_destFTP" value="{{ app["authentication"].getUser().get_ftp_dir() }}" />
<p class="form_alert help-block"></p>
</div>
</div>
<div class="control-group">
<label class="form_label control-label" for="form_prefixFTPfolder">{% trans 'admin::compte-utilisateur:ftp: prefixe des noms de dossier ftp' %}</label>
<label class="form_label control-label" for="form_prefixFTPfolder"><strong>{% trans "admin::compte-utilisateur:ftp: prefixe des noms de dossier ftp" %}</strong></label>
<div class="controls">
<input class="input_element input-xlarge" type="text" name="form_prefixFTPfolder" id="form_prefixFTPfolder" value="{{ app['authentication'].getUser().get_ftp_dir_prefix() }}" />
<input class="input_element input-xlarge" type="text" name="form_prefixFTPfolder" id="form_prefixFTPfolder" value="{{ app["authentication"].getUser().get_ftp_dir_prefix() }}" />
<p class="form_alert help-block"></p>
</div>
</div>
<div class="control-group">
<label class="form_label control-label" for="form_passifFTP">{% trans 'admin::compte-utilisateur:ftp: Utiliser le mode passif' %}</label>
<div class="controls">
<input class="input_element input-xlarge" type="checkbox" name="form_passifFTP" id="form_passifFTP" {% if app['authentication'].getUser().get_ftp_passif() == "1" %}checked{% endif %} />
<label class="form_label checkbox" for="form_passifFTP">
{% trans "admin::compte-utilisateur:ftp: Utiliser le mode passif" %}
<input class="input_element input-xlarge" type="checkbox" name="form_passifFTP" id="form_passifFTP" {% if app["authentication"].getUser().get_ftp_passif() == "1" %}checked{% endif %} />
</label>
<p class="form_alert help-block"></p>
</div>
</div>
<div class="control-group">
<label class="form_label control-label" for="form_retryFTP">{% trans 'admin::compte-utilisateur:ftp: Nombre d\'essais max' %}</label>
<label class="form_label control-label" for="form_retryFTP"><strong>{% trans "admin::compte-utilisateur:ftp: Nombre d\'essais max" %}</strong></label>
<div class="controls">
<input class="input_element input-xlarge" type="text" name="form_retryFTP" id="form_retryFTP" value="5" />
<p class="form_alert help-block"></p>
</div>
</div>
</div>
<div class="form-actions" style="background-color: transparent;">
<input type="submit" class="btn btn-primary" value="{% trans 'boutton::valider' %}">
</div>
<div class="form-actions">
<input type="submit" class="btn btn-info btn-" value="{% trans "boutton::valider" %}">
</div>
</div>
</form>
</div>

View File

@@ -1,102 +1,67 @@
{% extends 'account/base.html.twig' %}
{% extends "account/base.html.twig" %}
{% block title %}
{% trans 'Granted third party applications' %}
{% endblock %}
{% block head %}
<script type="text/javascript">
$(document).ready(function(){
$(".app-btn").live("click", function(){
var $this = $(this);
if (!$this.hasClass("authorize")) {
var revoke = 1;
var button_class = "authorize";
var old_class ="revoke";
var string = "{% trans 'Authoriser l\'access' %}";
} else {
var revoke = 0;
var button_class = "revoke";
var old_class ="authorize";
var string = "{% trans 'Revoquer l\'access' %}";
}
var app_id = $this.attr("value");
$.ajax({
type:"GET",
url : '/account/security/application/' + app_id + '/grant/',
dataType: 'json',
data : {
revoke : revoke
},
success : function(data){
if(data.success)
{
$this.removeClass(old_class).addClass(button_class);
$this.empty().append(string);
}
}
});
});
});
</script>
{% trans "Granted third party applications" %}
{% endblock %}
{% set selected = "applications" %}
{% block content %}
<div class="row-fluid">
<div class="row-fluid">
<div class="span6">
<div id="content-apps">
<h3>{% trans 'Vous avez autorise ces applications a acceder a votre compte' %}</h3>
<h3>{% trans "Vous avez autorise ces applications a acceder a votre compte" %}</h3>
{% if applications|length > 0 %}
<ul class='unstyled app-list'>
<ul class="unstyled app-list">
{% for application in applications %}
<li id='app_{{application.get_id}}'>
<li id="app_{{ application.get_id() }}">
<div>
{% set account = application.get_user_account(app['authentication'].getUser()) %}
{% if account.is_revoked() is empty %}
<button type='button' class='revoke app-btn btn btn-small' value='{{application.get_id()}}'>{% trans 'Revoquer l\'access' %}</button>
{% else %}
<button type='button' class='authorize app-btn btn btn-small' value='{{application.get_id()}}'>{% trans 'Authoriser l\'access' %}</button>
{% endif %}
<span class='app-row'>
<a href="{{application.get_website()}}" target="_blank">
<strong>{{application.get_name()}}</strong>
{% set account = application.get_user_account(app["authentication"].getUser()) %}
<a href="{{ path("grant_app_access", {"application_id" : application.get_id()}) }}" class="revoke app-btn btn btn-small pull-right {% if account.is_revoked() is empty %}hidden{% endif %}" value="{{application.get_id()}}">{% trans "Revoquer l\'access" %}</a>
<a href="{{ path("grant_app_access", {"application_id" : application.get_id()}) }}" class="authorize app-btn btn btn-small pull-right {% if account.is_revoked() is not empty %}hidden{% endif %}" value="{{application.get_id()}}">{% trans "Authoriser l\'access" %}</a>
<p class="app-row">
<a href="{{ application.get_website() }}" target="_blank">
<strong>{{ application.get_name() }}</strong>
</a>
{% if application.get_creator() is not none %}
<small>
{% set user_name = application.get_creator().get_display_name() %}
{% trans %}
par {{user_name}}
par {{ user_name }}
{% endtrans %}
</small>
{% endif%}
</span>
<span class='app-row'>
<font size="1"><i>{{ app['date-formatter'].getPrettyString(application.get_created_on()) }}</i></font>
</span>
<span class='app-row'>{{ application.get_description()|truncate(80, true, '...') }}</span>
</p>
<p class="app-row">
<span class="status text-error {% if account.is_revoked() is not empty %}hidden{% endif %}">{% trans "Not Allowed"%}</span>
<span class="status text-success {% if account.is_revoked() is empty %}hidden{% endif %}">{% trans "Allowed"%}</span>
</p>
<p class="app-row">{{ application.get_description()|truncate(120, true, "...") }}</p>
</div>
</li>
{%endfor%}
</ul>
{% else %}
<div>
{% trans 'Aucune application n\'a accés à vos données.' %}
{% trans "Aucune application n\'a accés à vos données." %}
</div>
{% endif %}
</div>
</div>
<div class="span6">
<h3>{% trans 'Applications' %}</h3>
<div class="well well-small">
<h3>{% trans "Third-party applications" %}</h3>
<p>
{% trans 'Naviguez et gerez les applications que vous souhaitez autoriser a acceder a vos informations Phraseanet' %}
</p>
<h3>{% trans 'Developpeurs' %}</h3>
<p>
{% trans 'Les developpeurs peuvent editer l\'enregistrement de leurs application grace a l\'onglet "developpeurs" ci-dessus' %}
{% trans "A third-party application is a product developed apart from Phraseanet and that would access Phraseanet data." %}
</p>
</div>
</div>
<div class="well well-small">
<h3>{% trans "Developpeurs" %}</h3>
<p>
{% trans "Les developpeurs peuvent editer l\'enregistrement de leurs application grace a l\'onglet 'developpeurs' ci-dessus" %}
</p>
</div>
</div>
</div>
{% endblock %}

View File

@@ -1,8 +1,8 @@
<html lang="{{ app['locale.I18n'] }}">
<html lang="{{ app["locale.I18n"] }}">
<head>
<title>{{ app['phraseanet.registry'].get('GV_homeTitle') }} {% block title %}{% endblock %}</title>
<title>{{ app["phraseanet.registry"].get("GV_homeTitle") }} {% block title %}{% endblock %}</title>
<link rel="stylesheet" type="text/css" href="/include/minify/f=/skins/build/account.css"/>
<script type="text/javascript" language="javascript" src="/include/minify/f=/assets/jquery/jquery.js,/assets/bootstrap/js/bootstrap-modal.js"></script>
<script type="text/javascript" language="javascript" src="/include/minify/f=/assets/jquery/jquery.js,/assets/bootstrap/js/bootstrap-modal.js,/skins/account/account.js"></script>
{% block head %}{% endblock %}
</head>
@@ -13,13 +13,13 @@
{% block menu %}
<div id="main-bar" class="navbar">
<div class="navbar-inner">
<span class="brand">{{ app['phraseanet.registry'].get('GV_homeTitle') }}<span class="section-title"> {{ block('title') }}</span></span>
<span class="brand">{{ app["phraseanet.registry"].get("GV_homeTitle") }}<span class="section-title"> {{ block("title") }}</span></span>
<ul class="nav">
<li {% if selected == "informations" %}class="active"{% endif %}><a href="/account/">{% trans 'Informations' %}</a></li>
<li {% if selected == "access" %}class="active"{% endif %}><a href="/account/access/">{% trans 'Acces' %}</a></li>
<li {% if selected == "sessions" %}class="active"{% endif %}><a href="/account/security/sessions/">{% trans 'Sessions' %}</a></li>
<li {% if selected == "applications" %}class="active"{% endif %}><a href="/account/security/applications/">{% trans 'Applications' %}</a></li>
<li {% if selected == "developer" %}class="active"{% endif %}><a href="/developers/applications/">{% trans 'Developpeur' %}</a></li>
<li {% if selected == "informations" %}class="active"{% endif %}><a href="{{ path("account") }}">{% trans "Informations" %}</a></li>
<li {% if selected == "access" %}class="active"{% endif %}><a href="{{ path("account_access") }}">{% trans "Acces" %}</a></li>
<li {% if selected == "sessions" %}class="active"{% endif %}><a href="{{ path("account_sessions") }}">{% trans "Sessions" %}</a></li>
<li {% if selected == "applications" %}class="active"{% endif %}><a href="{{ path("account_auth_apps") }}">{% trans "Applications" %}</a></li>
<li {% if selected == "developer" %}class="active"{% endif %}><a href="{{ path("developers_applications") }}">{% trans "Developpeur" %}</a></li>
</ul>
</div>
</div>

View File

@@ -1,7 +1,7 @@
{% extends 'account/base.html.twig' %}
{% extends "account/base.html.twig" %}
{% block title %}
{% trans 'Change my email address' %}
{% trans "Change my email address" %}
{% endblock %}
{% block head %}
@@ -20,25 +20,25 @@ $(document).ready(function() {
},
form_email_confirm : {
required:true,
equalTo:'#form_email'
equalTo:"#form_email"
}
},
messages: {
form_password : {
required : "{% trans 'forms::ce champ est requis' %}"
required : "{% trans "forms::ce champ est requis" %}"
},
form_email : {
required : "{% trans 'forms::ce champ est requis' %}",
email:"{% trans 'forms::l\'email semble invalide' %}"
required : "{% trans "forms::ce champ est requis" %}",
email:"{% trans "forms::l\'email semble invalide" %}"
},
form_email_confirm : {
required : "{% trans 'forms::ce champ est requis' %}",
equalTo : "{% trans 'forms::les emails ne correspondent pas' %}"
required : "{% trans "forms::ce champ est requis" %}",
equalTo : "{% trans "forms::les emails ne correspondent pas" %}"
}
},
errorPlacement: function(error, element) {
error.appendTo(element.closest('.controls').find('.form_alert'));
error.appendTo(element.closest(".controls").find(".form_alert"));
}
});
});
@@ -52,58 +52,58 @@ $(document).ready(function() {
{% if updateMsg is not none %}
<div class="alert alert-info">
<div>{{ updateMsg }}</div>
<a href="/account/" target="_self">{% trans 'admin::compte-utilisateur retour a mon compte'%}</a>
<a href="{{ path("account") }}" target="_self">{% trans "admin::compte-utilisateur retour a mon compte"%}</a>
</div>
{% else %}
{% if noticeMsg is not none %}
<div class="notice" style="text-align:center;margin:20px 0">
{% trans 'phraseanet::erreur : oups ! une erreur est survenue pendant l\'operation !' %}
{% trans "phraseanet::erreur : oups ! une erreur est survenue pendant l\'operation !" %}
</div>
<div class="notice" style="text-align:center;margin:20px 0">
{{ noticeMsg }}
</div>
<a href="/account/" target="_self">{% trans 'admin::compte-utilisateur retour a mon compte'%}</a>
<a href="{{ path("reset_password") }}" target="_self">{% trans "admin::compte-utilisateur retour a mon compte" %}</a>
{% endif %}
<form method="POST" action="/account/reset-email/" id="mainform" class="form-horizontal">
<form method="POST" action="{{ path("reset_email") }}" id="mainform" class="form-horizontal">
<div class="control-group">
<label class="form_label control-label" for="form_login">{% trans 'admin::compte-utilisateur identifiant' %}</label>
<label class="form_label control-label" for="form_login">{% trans "admin::compte-utilisateur identifiant" %}</label>
<div class="controls">
<p style="line-height: 30px;">{{ app['authentication'].getUser().get_login() }}</p>
<p style="line-height: 30px;">{{ app["authentication"].getUser().get_login() }}</p>
<p class="form_alert help-block"></p>
</div>
</div>
<div class="control-group">
<label class="form_label control-label" for="form_password">{% trans 'admin::compte-utilisateur mot de passe' %}</label>
<label class="form_label control-label" for="form_password">{% trans "admin::compte-utilisateur mot de passe" %}</label>
<div class="controls">
<input type="password" id="form_password" name="form_password" autocomplete="off" />
{#<p class="form_alert help-block"><?php echo isset($needed['form_password']) ? $needed['form_password'] : '' ?></p>#}
{#<p class="form_alert help-block"><?php echo isset($needed["form_password"]) ? $needed["form_password"] : "" ?></p>#}
</div>
</div>
<div class="control-group">
<label class="form_label control-label" for="form_email">{% trans 'admin::compte-utilisateur nouvelle adresse email' %}</label>
<label class="form_label control-label" for="form_email">{% trans "admin::compte-utilisateur nouvelle adresse email" %}</label>
<div class="controls">
<input type="text" id="form_email" name="form_email" />
{#<p class="form_alert help-block"><?php echo isset($needed['form_email']) ? $needed['form_email'] : '' ?></p>#}
{#<p class="form_alert help-block"><?php echo isset($needed["form_email"]) ? $needed["form_email"] : "" ?></p>#}
</div>
</div>
<div class="control-group">
<label class="form_label control-label" for="form_email_confirm">{% trans 'admin::compte-utilisateur confirmer la nouvelle adresse email' %}</label>
<label class="form_label control-label" for="form_email_confirm">{% trans "admin::compte-utilisateur confirmer la nouvelle adresse email" %}</label>
<div class="controls">
<input type="text" id="form_email_confirm" name="form_email_confirm" autocomplete="off" />
{#<p class="form_alert help-block"><?php echo isset($needed['form_email_confirm']) ? $needed['form_email_confirm'] : '' ?></p>#}
{#<p class="form_alert help-block"><?php echo isset($needed["form_email_confirm"]) ? $needed["form_email_confirm"] : "" ?></p>#}
</div>
</div>
<div class="form-actions" style="background-color: transparent;">
<input type="submit" class="btn btn-success" value="{% trans 'boutton::valider' %}" style="margin: 20px auto;" />
<input type="button" class="btn" value="{% trans 'boutton::annuler' %}" onclick="self.location.replace('/account/');" />
<input type="submit" class="btn btn-success" value="{% trans "boutton::valider" %}" style="margin: 20px auto;" />
<input type="button" class="btn" value="{% trans "boutton::annuler" %}" onclick="self.location.replace('/account/');" />
</div>
</form>
<div class="well well-small alert-info">
{% trans 'admin::compte-utilisateur: Pourquoi me demande-t-on mon mot de passe pour changer mon adresse email ?'%}
{% trans "admin::compte-utilisateur: Pourquoi me demande-t-on mon mot de passe pour changer mon adresse email ?"%}
<br />
{% trans 'admin::compte-utilisateur: Votre adresse e-mail sera utilisee lors de la perte de votre mot de passe afin de pouvoir le reinitialiser, il est important que vous soyez la seule personne a pouvoir la changer.'%}
{% trans "admin::compte-utilisateur: Votre adresse e-mail sera utilisee lors de la perte de votre mot de passe afin de pouvoir le reinitialiser, il est important que vous soyez la seule personne a pouvoir la changer."%}
</div>
{% endif %}
{% endblock %}

View File

@@ -7,7 +7,7 @@
{% set selected = "sessions" %}
{% block content %}
<div class="row-fluid">
<div class="row-fluid">
<div class="span12">
<table class="table table-striped">
<thead>
@@ -77,5 +77,5 @@
</tbody>
</table>
</div>
</div>
</div>
{% endblock %}

View File

@@ -1,13 +1,7 @@
{% extends 'account/base.html.twig' %}
{% use "developers/header.html.twig" with header as parent_header %}
{% extends "account/base.html.twig" %}
{% block title %}
{% trans 'Client application' %}
{% endblock %}
{% block head %}
{{ block('parent_header') }}
{% trans "Client application" %}
{% endblock %}
{% set selected = "" %}
@@ -15,84 +9,91 @@
{% block content %}
<div class="row-fluid">
<div class="span12">
<h1>{% trans 'Application' %}</h1>
<input type="hidden" value="{{application.get_id}}" name="app_id"/>
<h1>{% trans "Application" %}</h1>
<input type="hidden" value="{{ application.get_id() }}" name="app_id"/>
<div>
<div><strong><a class="link" href="/developers/application/{{application.get_id}}/">{{application.get_name}}</a></strong></div>
<div>{{application.get_description }}</div>
<div><strong><a class="link" href="{{ path("developers_application", {"id" : application.get_id()}) }}">{{ application.get_name() }}</a></strong></div>
<div>{{ application.get_description() }}</div>
</div>
<h1 >{% trans 'settings OAuth' %}</h1>
<p >{% trans 'Les parametres oauth de votre application.' %}</p>
<h1>{% trans "settings OAuth" %}</h1>
<p>{% trans "Les parametres oauth de votre application." %}</p>
<table id="app-oauth-setting" class="table table-condensed table-bordered">
<tbody>
<tr>
<td>Client ID</td>
<td>{{application.get_client_id()}}</td>
<td>{{ application.get_client_id() }}</td>
</tr>
<tr>
<td>Client Secret</td>
<td>{{application.get_client_secret}}</td>
<td>{{ application.get_client_secret() }}</td>
</tr>
<tr>
<td>{% trans 'URL de callback' %}</td>
{% if application.get_type == constant('API_OAuth2_Application::DESKTOP_TYPE') %}
<td>{% trans "URL de callback" %}</td>
{% if application.get_type() == constant("API_OAuth2_Application::DESKTOP_TYPE") %}
<td>
<span>{{application.get_redirect_uri}}</span>
<span>{{ application.get_redirect_uri() }}</span>
</td>
{% else %}
<td class="url_callback">
<span class="url_callback_input">{{application.get_redirect_uri}}</span>
<button type="button" class="save_callback btn btn-small btn-info" style="display:none;">
save
</button>
<span class="url_callback_input">{{ application.get_redirect_uri() }}</span>
<a href="{{ path("submit_application_callback", {"id" : application.get_id()}) }}" class="save_callback btn btn-small btn-info" style="display:none;">
{% trans "Save" %}
</a>
<button type="button" class="modifier_callback btn btn-small">
modifier
{% trans "Modify" %}
</button>
</td>
{%endif%}
</tr>
<tr>
<td>Authorize endpoint</td>
<td>{{app['phraseanet.registry'].get('GV_ServerName')}}api/oauthv2/authorize</td>
<td>{{ app["phraseanet.registry"].get("GV_ServerName") }}api/oauthv2/authorize</td>
</tr>
<tr>
<td>Access endpoint</td>
<td>{{app['phraseanet.registry'].get('GV_ServerName')}}api/oauthv2/token</td>
<td>{{ app["phraseanet.registry"].get("GV_ServerName") }}api/oauthv2/token</td>
</tr>
<tr>
<td>{% trans 'Activer le grant_type de type password pour votre application' %}</td>
<td><input class="grant-type" type='checkbox' {{ application.is_password_granted() ? "checked='checked'" : ""}} name="grant" value='{{application.get_id()}}'></td>
<td>{% trans "Activer le grant_type de type password pour votre application" %}</td>
<td>
<input class="grant-type"
type="checkbox"
{{ application.is_password_granted() ? "checked='checked'" : "" }}
name="grant"
value="{{ path("submit_developers_application_authorize_grant_password", {"id" : application.get_id()}) }}"
>
</td>
</tr>
</tbody>
</table>
<h1>{% trans 'Votre token d\'access' %}</h1>
<p> {% trans 'Les paramétres oauth de votre application.' %}</p>
<h1>{% trans "Votre token d\'access" %}</h1>
<p> {% trans "Les paramétres oauth de votre application." %}</p>
<table id="app-access-token-setting table" class="table table-condensed table-bordered">
<tbody>
<tr>
<td>
{% trans 'Token' %}
{% trans "Token" %}
</td>
<td>
<span id="my_access_token">
{% if not token is none %}
{{token|default('')}}
{{ token|default("") }}
{% else %}
{% trans 'Le token n\'a pas encore ete genere' %}
{% trans "Le token n\'a pas encore ete genere" %}
{% endif %}
</span>
<button id="generate_access" class="btn btn-small btn-info" type="button" value="{{application.get_id}}">{% trans 'boutton::generer' %}</button>
<a id="generate_access" href="{{ path("submit_developers_application_token",{ "id" : application.get_id()}) }}" class="btn btn-small btn-info">{% trans "boutton::generer" %}</a>
</td>
</tr>
</tbody>
</table>
<div>
<a class="btn btn-primary" href="/developers/applications/">{% trans 'boutton::retour' %}</a>
<a class="btn btn-primary" href="{{ path("developers_applications") }}">{% trans "boutton::retour" %}</a>
</div>
</div>
</div>

View File

@@ -1,38 +1,32 @@
{% extends 'account/base.html.twig' %}
{% use "developers/header.html.twig" with header as parent_header %}
{% extends "account/base.html.twig" %}
{% block title %}
{% trans 'new client application' %}
{% endblock %}
{% block head %}
{{ block('parent_header') }}
{% trans "new client application" %}
{% endblock %}
{% set selected = "" %}
{# form input macro #}
{% macro input(name, value, violations, property, class='', type, size) %}
{% macro input(name, value, violations, property, class="", type, size) %}
{% if violations is none %}
<input type="{{ type|default('text') }}" name="{{ name }}" value="{{ value|e }}" size="{{ size|default(20) }}" {% if class is not empty %}class="{{ class }}"{% endif %}/>
<input type="{{ type|default("text") }}" name="{{ name }}" value="{{ value|e }}" size="{{ size|default(20) }}" {% if class is not empty %}class="{{ class }}"{% endif %}/>
{% else %}
{% set hasError = "false" %}
{% for violation in violations %}
{% if violation.getPropertyPath == property and hasError == "false" %}
{% set hasError = "true" %}
<input type="{{ type|default('text') }}" name="{{ name }}" value="{{ value }}" size="{{ size|default(20) }}" {% if class is not empty %}class="{{ class }}"{% endif %}/>
<input type="{{ type|default("text") }}" name="{{ name }}" value="{{ value }}" size="{{ size|default(20) }}" {% if class is not empty %}class="{{ class }}"{% endif %}/>
<span class="help-block" style="color:red"> {{ violation.getInvalidValue }} - {{violation.getMessage}} </span>
{% endif %}
{% endfor %}
{% if hasError == "false" %}
<input type="{{ type|default('text') }}" name="{{ name }}" value="{{ value|e }}" size="{{ size|default(20) }}" {% if class is not empty %}class="{{ class }}"{% endif %}/>
<input type="{{ type|default("text") }}" name="{{ name }}" value="{{ value|e }}" size="{{ size|default(20) }}" {% if class is not empty %}class="{{ class }}"{% endif %}/>
{% endif %}
{% endif %}
{% endmacro %}
{# form textare macro #}
{% macro textarea(name, value, violations,property, rows, cols, class='') %}
{% macro textarea(name, value, violations,property, rows, cols, class="") %}
{% if violations is none %}
<textarea name="{{ name }}" rows="{{ rows|default(4)}}" cols="{{cols|default(20)}}" {% if class is not empty %}class="{{ class }}"{% endif %}>{{ value|e}}</textarea>
{% else %}
@@ -45,16 +39,16 @@
{% endif %}
{% endfor %}
{% if hasError == "false" %}
<textarea name="{{ name }}" rows="{{ rows|default(4)}}" cols="{{cols|default(20)}}" {% if class is not empty %}class="{{ class }}"{% endif %}>{{ value|default('')|e}}</textarea>
<textarea name="{{ name }}" rows="{{ rows|default(4)}}" cols="{{cols|default(20)}}" {% if class is not empty %}class="{{ class }}"{% endif %}>{{ value|default("")|e}}</textarea>
{% endif %}
{% endif %}
{% endmacro %}
{% block content %}
<form id="form_create" action="/developers/application/" method="POST" class="form-horizontal">
<form id="form_create" action="{{ path("developers_application_new") }}" method="POST" class="form-horizontal">
{% if form is none %}
{% set name, description, website, callback = '', '', '', ''%}
{% set app_type = 'web'%}
{% set name, description, website, callback = "", "", "", ""%}
{% set app_type = "web"%}
{% else %}
{% set name = form.name %}
{% set description = form.description %}
@@ -64,65 +58,65 @@
{% endif %}
<div class="control-group">
<label class="control-label" for="name"><b>{% trans 'Nom' %}</b></label>
<label class="control-label" for="name"><b>{% trans "Nom" %}</b></label>
<div class="controls">
{{ _self.input("name", name, violations, 'name', 'input-xlarge') }}
{{ _self.input("name", name, violations, "name", "input-xlarge") }}
</div>
</div>
<div class="control-group">
<label class="control-label" for="name"><b>{% trans 'Description' %}</b></label>
<label class="control-label" for="name"><b>{% trans "Description" %}</b></label>
<div class="controls">
{{ _self.textarea("description", description, violations, 'description', 5, 30, 'input-xlarge') }}
{{ _self.textarea("description", description, violations, "description", 5, 30, "input-xlarge") }}
</div>
</div>
<div class="control-group">
<label for="website" class="control-label"><b>{% trans 'Site web' %}</b></label>
<label for="website" class="control-label"><b>{% trans "Site web" %}</b></label>
<div class="controls">
<select name="scheme-website" class="input-mini">
<option value="http://">http://</option>
<option value="https://">https://</option>
</select>
{{ _self.input("website", website, violations, 'urlwebsite') }}
{{ _self.input("website", website, violations, "urlwebsite") }}
</div>
</div>
<div class="control-group">
<label class="control-label"><b>{% trans 'Type d\'application' %}</b></label>
<label class="control-label"><b>{% trans "Type d\'application" %}</b></label>
<div class="controls">
<label class="radio">
<input type="radio" name="type" value="web" {{ app_type == "web" ? "checked='checked'" : "" }}/>
{% trans 'Application web' %}
{% trans "Application web" %}
</label>
<label class="radio">
<input type="radio" name="type" value="desktop" {{ app_type == "desktop" ? "checked='checked'" : "" }}/>
{% trans 'Application desktop' %}
{% trans "Application desktop" %}
</label>
</div>
</div>
{% if app_type == "web" %}
<div class="control-group">
<label for="callback" class="control-label"><b>{% trans 'URL de callback' %}</b></label>
<label for="callback" class="control-label"><b>{% trans "URL de callback" %}</b></label>
<div class="controls">
<select name="scheme-callback" class="input-mini">
<option value="http://">http://</option>
<option value="https://">https://</option>
</select>
{{ _self.input("callback", callback, violations, 'urlcallback') }}
{{ _self.input("callback", callback, violations, "urlcallback") }}
</div>
</div>
{% endif %}
<div class="form-actions">
<button class="app_submit btn btn-info" type="submit">
{% trans 'boutton::valider' %}
<button class="btn btn-info" type="submit">
{% trans "boutton::valider" %}
</button>
<a class="btn btn-primary" href="/developers/applications/">
{% trans 'boutton::retour' %}
<a class="btn" href="{{ path("developers_applications") }}">
{% trans "boutton::retour" %}
</a>
</div>
</form>

View File

@@ -1,13 +1,7 @@
{% extends 'account/base.html.twig' %}
{% use "developers/header.html.twig" with header as parent_header %}
{% extends "account/base.html.twig" %}
{% block title %}
{% trans 'Client applications' %}
{% endblock %}
{% block head %}
{{ block('parent_header') }}
{% trans "Client applications" %}
{% endblock %}
{% set selected = "developer" %}
@@ -17,61 +11,58 @@
<div class="span7">
<div id="content-apps">
<h1>Phraseanet Developer Center</h1>
<h3>{% trans 'Mes applications' %}</h3>
<h3>{% trans "Mes applications" %}</h3>
{% if applications|length > 0 %}
<ul class='app-list unstyled'>
<ul class="app-list unstyled">
{% for application in applications %}
<li id='app_{{application.get_id()}}'>
<div>
<a href="#appModal-{{ loop.index }}" role="button" data-toggle="modal" class='btn btn-danger btn-small' type='button'>
{% trans 'button::supprimer'%}
<li id="app_{{ application.get_id() }}">
<a href="#appModal-{{ loop.index }}" role="button" data-toggle="modal" class="pull-right btn btn-danger btn-small" type="button">
{% trans "button::supprimer" %}
</a>
<!-- Modal -->
<div id="appModal-{{ loop.index }}" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">{{application.get_name()}}</h3>
<h3 id="myModalLabel">{{ application.get_name() }}</h3>
</div>
<div class="modal-body">
<p>{% trans "Are you sure you want to delete this application?" %} </p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">{% trans "No" %}</button>
<button class="delete-app btn btn-primary">{% trans "Yes" %}</button>
<a href="{{ path("delete_developers_application", {"id" : application.get_id()}) }}" class="delete-app btn btn-info">{% trans "Yes" %}</a>
</div>
</div>
<span class='app-row'>
<p class="app-row">
<strong>
<a class="link" href="/developers/application/{{application.get_id()}}/">
{{application.get_name()|title}}
<a class="link" href="{{ path("developers_application", {"id" : application.get_id}) }}">
{{ application.get_name() }}
</a>
</strong>
</span>
<span class='app-row'>{{application.get_description() }}</span>
<span class='app-row'>{{application.get_website()}}</span>
</div>
</p>
<p class="app-row">{{ application.get_description()|truncate(120, true, "...") }}</p>
</li>
{%endfor%}
</ul>
{% else %}
<div>
{% trans 'Aucune application creee.' %}
{% trans "Aucune application creee." %}
</div>
{% endif %}
</div>
</div>
<div class="span5">
<div>
<a href="http://developer.phraseanet.com/" target="_blank" class="btn btn-large">
{% trans 'Demarrer avec l\'API Phraseanet' %}
<div class="well well-small">
<p>{% trans "Decouvrez la documentation" %}</p>
<a href="http://developer.phraseanet.com/" target="_blank" class="btn btn-large text-center input-block-level">
{% trans "Demarrer avec l\'API Phraseanet" %}
</a>
<p>{% trans 'Decouvrez la documentation' %}</p>
</div>
<div>
<a href="/developers/application/new/" class="btn-info btn btn-large">
{% trans 'Creer une nouvelle applications' %}
<div class="well well-small">
<p>{% trans "Creez une application pour commencer a utiliser l\'API Phraseanet" %}</p>
<a href="{{ path("developers_application_new") }}" class="btn-info btn btn-large text-center input-block-level">
{% trans "Creer une nouvelle applications" %}
</a>
<p>{% trans 'Creez une application pour commencer a utiliser l\'API Phraseanet' %}</p>
</div>
</div>
</div>

View File

@@ -1,128 +0,0 @@
{% block header %}
<script type="text/javascript">
$(document).ready(function(){
var trans = {
'confirm_delete' : "{% trans 'etes vous sur de vouloir supprimer cette application' %}"
,'yes' : "{% trans 'oui' %}"
,'no' : "{% trans 'non' %}"
}
$("#generate_access").live("click", function(){
var app_id = $(this).attr("value");
var usr_id = $(this).closest("div").attr("id");
var opts = {
type:"POST",
url : '/developers/application/'+ app_id +'/access_token/',
dataType: 'json',
data : {
usr_id : usr_id
},
success : function(data){
if(data.success) {
$("#my_access_token").empty().append(data.token);
}
}
}
jQuery.ajax(opts);
});
$(".modifier_callback").live("click", function(){
$(this).hide();
$(".save_callback").show();
var cur_value = $(".url_callback_input").html();
$(".url_callback_input")
.empty()
.wrapInner('<input value = "'+cur_value+'" name="oauth_callback" size="50" type="text"/>');
$(".url_callback").die();
$(".save_callback").live("click", function(){
var callback = $("input[name=oauth_callback]").val();
var app_id = $("input[name=app_id]").val();
var $this = $(this);
var option = {
type:"POST",
url : "/developers/application/" + app_id + "callback/",
dataType: 'json',
data :{callback : callback},
success : function(data){
if(data.success == true)
$(".url_callback_input").empty().append(callback);
else
$(".url_callback_input").empty().append(cur_value);
}
}
$.ajax(option);
});
});
$(".app_submit").live("click", function(){
var form = $(this).closest("form");
var action = form.attr("action");
var option = {
type:"POST",
url : action,
dataType: 'html',
data : form.serializeArray(),
success : function(data){
$(".ui-tabs-panel:visible").empty().append(data);
}
}
$.ajax(option);
});
$("#form_create input[name=type]").live("click", function(){
if($(this).val() == "desktop")
$("#form_create .callback td").hide().find("input").val('');
else
$("#form_create .callback td").show();
});
$('.grant-type').live('click', function(){
var appId = $(this).val();
var grant = $(this).is(":checked") ? "1": "0";
var opts = {
type:"POST",
url : '/developers/application/' + appId + '/authorize_grant_password/',
dataType: 'json',
data : {grant : grant},
success : function(data){
}
}
$.ajax(opts);
});
$("#app_dev, #app_dev_new, #app_dev_create, a.dev_back").live("click", function(e){
e.preventDefault();
var target = $(this).attr("href");
var opts = {
type:"GET",
url : target,
dataType: 'html',
success : function(data){
$(".ui-tabs-panel:visible").empty().append(data);
}
};
$.ajax(opts);
});
$(".delete-app").bind("click", function(){
var li = $(this).closest("li");
var app_id = li.attr('id').split("_").pop();
$.ajax({
type:"DELETE",
url : '/developers/application/'+ app_id +'/',
dataType: 'json',
data : {},
success : function(data){
if(data.success) {
li.find('.modal').modal('hide');
li.remove();
}
}
});
});
});
</script>
{% endblock %}

View File

@@ -0,0 +1,125 @@
$(document).ready(function() {
// revoke third party application access
$("a.app-btn").bind("click", function(e) {
e.preventDefault();
var $this = $(this);
$.ajax({
type:"GET",
url : $this.attr("href"),
dataType: 'json',
data : {revoke : $this.hasClass("authorize") ? 1 : 0},
success : function(data) {
if(data.success) {
var li = $this.closest('li');
var hidden = $('.app-btn.hidden , .status.hidden', li);
var notHidden = $('.app-btn:not(.hidden), .status:not(.hidden)', li);
hidden.removeClass('hidden');
notHidden.addClass('hidden');
}
}
});
});
// generate new access token
$("a#generate_access").bind("click", function(e) {
e.preventDefault();
var $this = $(this);
$.ajax({
type:"POST",
url : $this.attr("href"),
dataType: 'json',
data : {
usr_id : $this.closest("div").attr("id")
},
success : function(data){
if(data.success) {
$("#my_access_token").empty().append(data.token);
}
}
});
});
//modify application callback url
$(".modifier_callback").bind("click", function() {
var modifierBtn = $(this);
var saveBtn = $("a.save_callback");
var input = $(".url_callback_input");
var inputVal = input.html();
modifierBtn.hide();
saveBtn.show();
// wrapp current calback in an input
input
.empty()
.wrapInner(''
+ '<input value = "'+inputVal+'"'
+ ' name="oauth_callback" size="50" type="text"/>'
);
$(".url_callback").die();
// save new callback
saveBtn.bind("click", function(e) {
e.preventDefault();
var callback = $("input[name=oauth_callback]").val();
$.ajax({
type:"POST",
url : saveBtn.attr("href"),
dataType: 'json',
data :{callback : callback},
success : function(data) {
if(data.success) {
input.empty().append(callback);
} else {
input.empty().append(inputVal);
}
}
});
});
});
// hide or show callback url input whether user choose a web or dektop application
$("#form_create input[name=type]").bind("click", function() {
if($(this).val() === "desktop") {
$("#form_create .callback td").hide().find("input").val('');
} else {
$("#form_create .callback td").show();
}
});
// authorize password grant type or not
$('.grant-type').bind('click', function(){
var $this = $(this);
$.ajax({
type:"POST",
url : $this.attr("value") ,
dataType: 'json',
data : {grant : $this.is(":checked") ? "1": "0"},
success : function(data){}
});
});
// delete an application
$("a.delete-app").bind("click", function(e) {
e.preventDefault();
var $this = $(this);
var li = $this.closest("li");
$.ajax({
type:"DELETE",
url : $this.attr('href'),
dataType: 'json',
data : {},
success : function(data){
if(data.success) {
li.find('.modal').modal('hide');
li.remove();
}
}
});
});
});

View File

@@ -334,18 +334,43 @@ h1, h2, h3, h4 {
color: @black;
}
.app-list {
border: 1px solid @grayDark;
background: lighten(@background, 2%);
.border-radius(@baseBorderRadius);
}
.app-list li {
padding: 10px 0;
padding: 10px;
border-top: 1px solid @grayDark;
}
.app-list li:first-child {
border-top:none;
}
.app-list li .app-row {
line-height: @fontSizeLarge * 1.25;
padding-bottm: 5px;
}
.app-list li .app-row a {
font-size: @fontSizeLarge * 1.25;
}
.text-success {
color: @green;
}
.text-error {
color: @red;
}
.control-span {
padding-top: 5px;
line-height: 20px;
}
/* Landscape phones and down */
@media (max-width: 480px) {

View File

@@ -211,7 +211,7 @@
// Wells
// -------------------------
@wellBackground: #f5f5f5;
@wellBackground: @grayDarker;
// Navbar