conversion php > twig for login/account pages

This commit is contained in:
Ysolyne Gresille
2012-07-10 16:40:00 +02:00
parent e170016801
commit 02e0a4d9b4
6 changed files with 640 additions and 655 deletions

View File

@@ -594,6 +594,8 @@ class Session_Handler
}
$rs[$k]['session_id'] = (int) $rs[$k]['session_id'];
$rs[$k]['ip_infos'] = $infos;
$rs[$k]['created_on'] = new \DateTime($row['created_on']);;
$rs[$k]['lastaccess'] = new \DateTime($row['lastaccess']);
}
return $rs;

View File

@@ -12,5 +12,5 @@
{% endfor %}
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/login/home.css,skins/login/css/main.css" />
<link rel="stylesheet" type="text/css" href="/login/home.css,/skins/login/css/main.css" />
<script type="text/javascript" language="javascript" src="/include/minify/f=include/jslibs/jquery-1.7.1.js,include/jslibs/jquery.cookie.js,login/home.js"></script>

View File

@@ -0,0 +1,579 @@
<html lang="{{ session.get_I18n() }}">
<head>
<title>{{ registry.get('GV_homeTitle') }} {% trans 'login:: Mon compte'%}</title>
<link rel="stylesheet" type="text/css" href="/include/minify/f=login/home.css,/login/geonames.css,/skins/html5/bootstrap/css/bootstrap.min.css,/skins/html5/bootstrap/css/bootstrap-responsive.min.css,/skins/login/css/main.css"/>
<link rel="stylesheet" type="text/css" href="/skins/login/css/main.css"/>
<script type="text/javascript" language="javascript" src="/include/minify/f=include/jslibs/jquery-1.7.1.js"></script>
<script type="text/javascript" language="javascript" src="/include/jslibs/jquery-ui-1.8.17/js/jquery-ui-1.8.17.custom.min.js"></script>
<script type="text/javascript" src="/login/geonames.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var trans = {
'confirm_delete' : "<?php echo _('etes vous sur de vouloir supprimer cette application'); ?>"
,'yes' : "<?php echo _('oui'); ?>"
,'no' : "<?php echo _('non'); ?>"
}
$( "#tab-account-cat").tabs({
ajaxOptions: {
error: function( xhr, status, index, anchor ) {
$( anchor.hash ).html("<?php echo _('Erreur lors du chargement') ?>");
}
}
});
initialize_geoname_field($('#form_geonameid'));
$("#generate_access").live("click", function(){
var app_id = $(this).attr("value");
var usr_id = $(this).closest("div").attr("id");
var opts = {
type:"POST",
url : '/api/oauthv2/applications/'+ app_id +'/generate_access_token/',
dataType: 'json',
data : {
usr_id : usr_id
},
success : function(data){
if(data.ok)
$("#my_access_token").empty().append(data.token);
}
}
jQuery.ajax(opts);
});
var $url_callback_event = function(event) {
if ( event.type == "mouseover" ) {
$(this).find(".modifier_callback").show();
} else {
$(this).find(".modifier_callback").hide();
}
};
var $event = function(event){
if ( event.type == "mouseover" ) {
$(this).find(".delete_app").show();
} else {
$(this).find(".delete_app").hide();
}
};
$(".url_callback").live("mouseover mouseout", $url_callback_event);
$(".app-list li").live("mouseover mouseout", $event);
$(".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 : "/api/oauthv2/applications/oauth_callback",
dataType: 'json',
data :{app_id : app_id, callback : callback},
success : function(data){
if(data.success == true)
$(".url_callback_input").empty().append(callback);
else
$(".url_callback_input").empty().append(cur_value);
$this.hide();
$(".url_callback").live("mouseover mouseout", $url_callback_event);
}
}
$.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 : '/api/oauthv2/applications/' + appId + '/grant_password/',
dataType: 'json',
data : {
grant : grant
},
success : function(data){
}
}
$.ajax(opts);
});
$(".app-btn").live("click", function(){
if (!$(this).hasClass("authorize"))
{
var revoke = 1;
var button_class = "authorize";
var old_class ="revoke";
var string = "<?php echo _('Authoriser l\'access'); ?>";
}
if ($(this).hasClass("authorize"))
{
var revoke = 0;
var button_class = "revoke";
var old_class ="authorize";
var string = "<?php echo _('Revoquer l\'access'); ?>";
}
var acc_id = $(this).attr("value");
var current = $(this);
var opts = {
type:"POST",
url : '/api/oauthv2/applications/revoke_access/',
dataType: 'json',
data : {
account_id : acc_id,
revoke : revoke
},
success : function(data){
if(data.ok)
{
div = current.closest("div");
current.removeClass(old_class).addClass(button_class);
current.attr("value", acc_id);
current.empty().append(string);
}
}
}
$.ajax(opts);
});
$("#app_dev, #app_dev_new, #app_dev_create, a.dev_back").live("click", function(e){
e.preventDefault();
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").die().live("click", function(){
var id = $(this).closest("li").attr('id').split("_");;
var app_id = id[1];
var $this= $(this);
$("body").append("<div id='confirm_delete'><p>"+trans.confirm_delete+" ? </p></div>")
$("#confirm_delete").dialog({
resizable: false,
autoOpen :true,
title: "",
draggable: false,
width:340,
modal: true,
buttons: [{
id: "ybutton",
text: trans.yes,
click: function() {
var opts = {
type:"DELETE",
url : '/api/oauthv2/applications/'+ app_id,
dataType: 'json',
data : {},
success : function(data){
if(data.success == true)
{
$this.closest("li").remove();
$("#confirm_delete").dialog("close");
}
}
}
$.ajax(opts);
}
},
{
id: "nbutton",
text: trans.no,
click: function() {
$( this ).dialog( "close" );
}
}],
close : function() {
$( this ).remove();
}
});
});
});
</script>
<style type="text/css">
.tab-content{
height: auto;
}
</style>
</head>
<body>
<div style="width: 950px; margin-left: auto; margin-right: auto;">
<div style="margin-top: 70px; height: 35px;">
<table style="width: 100%;">
<tr style="height: 35px;">
<td style="width: 580px;"><span class="title-name">{{ registry.get('GV_homeTitle') }}</span><span class="title-desc">{% trans 'login:: Mon compte' %}</span></td>
<td style="color: #b1b1b1; text-align: right;">
</td>
</tr>
</table>
</div>
<div class="tab-pane">
<div id="id-main" class="tab-content" style="display: block; text-align: center; overflow-y: auto; overflow-x: hidden;">
<div id="tab-account-cat">
<ul>
<li><a href="#tab-account-info">{% trans 'Informations' %}</a></li>
<li><a href="#tab-account-access">{% trans 'Acces' %}</a></li>
<li><a href="#tab-account-session">{% trans 'Sessions' %}</a></li>
<li><a href="/api/oauthv2/applications" title="tab-account-app">{% trans 'Applications' %}</a></li>
<li><a href="/api/oauthv2/applications/dev" title="tab-account-dev">{% trans 'Developpeur' %}</a></li>
</ul>
<!-- START TAB ACCESS -->
<div id="tab-account-info">
<table>
<tr valign="top">
<td style="width: 98%">
{% if notice != '' %}
<div class="notice">{{ notice }}</div>
{% endif %}
<form name="account" id="account" action="/login/account.php" method="post">
<table style="margin: 20px auto;">
<tr>
<td></td>
<td><a href="/login/reset-password.php" class="link" target="_self">{% trans 'admin::compte-utilisateur changer mon mot de passe' %}</a></td>
<td></td>
</tr>
<tr>
<td colspan="3"></td>
</tr>
<tr>
<td class="form_label"><label for="form_login">{% trans 'admin::compte-utilisateur identifiant' %}</label></td>
<td class="form_input">{{ user.get_login() }}</td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"><label for="form_gender">{% trans 'admin::compte-utilisateur sexe' %}</label></td>
<td class="form_input">
<select class="input_element" name="form_gender" id="form_gender" >
<option {% if user.get_gender() == "0" %}selected{% endif %} value="0" >
{% trans 'admin::compte-utilisateur:sexe: mademoiselle' %}
</option>
<option {% if user.get_gender() == "1" %}selected{% endif %} value="1" >
{% trans 'admin::compte-utilisateur:sexe: madame' %}
</option>
<option {% if user.get_gender() == "2" %}selected{% endif %} value="2" >
{% trans 'admin::compte-utilisateur:sexe: monsieur' %}
</option>
</select>
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"><label for="form_lastname">{% trans 'admin::compte-utilisateur nom' %}</label></td>
<td class="form_input">
<input class="input_element" type="text" name="form_lastname" id="form_lastname" value="{{ user.get_lastname() }}" >
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"><label for="form_firstname">{% trans 'admin::compte-utilisateur prenom' %}</label></td>
<td class="form_input">
<input class="input_element" type="text" name="form_firstname" id="form_firstname" value="{{ user.get_firstname() }}" >
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td colspan="3">
</tr>
<tr>
<td class="form_label"><label for="">{% trans 'admin::compte-utilisateur email' %}</label></td>
<td class="form_input" colspan="2">
{{ user.get_email() }} <a class="link" href="/login/reset-email.php" target="_self">{% trans 'login:: Changer mon adresse email' %}</a>
</td>
</tr>
<tr>
<td colspan="3"></td>
</tr>
<tr>
<td colspan="3">{% trans 'Notification par email' %}</td>
</tr>
{% for notification_group, nots in notifications%}
<tr>
<td style="font-weight: bold;" colspan="3">{{ notification_group }}</td>
</tr>
{% for notification in nots %}
<tr>
<td class="form_label" colspan="2"><label for="notif_{{ notification['id'] }}">{{ notification['description'] }}</label></td>
<td class="form_input">
<input type="checkbox" id="notif_{{ notification['id'] }}" name="notifications[{{ notification['id'] }}]" {% if not user.getPrefs('notification_' ~ notification['id']) == '0' %}checked{% endif %} value="1"/>
</td>
</tr>
{% endfor %}
{% endfor %}
<tr>
<td colspan="3"></td>
</tr>
<tr>
<td class="form_label"><label for="form_address">{% trans 'admin::compte-utilisateur adresse' %}</label></td>
<td class="form_input">
<input class="input_element" type="text" name="form_address" id="form_address" value="{{ user.get_address() }}"/>
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"><label for="form_zip">{% trans 'admin::compte-utilisateur code postal' %}</label></td>
<td class="form_input">
<input class="input_element" type="text" name="form_zip" id="form_zip" value="{{ user.get_zipcode() }}"/>
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"><label for="form_city">{% trans 'admin::compte-utilisateur ville' %}</label></td>
<td class="form_input">
<input id="form_geonameid" type="text" geonameid="{{ user.get_geonameid() }}" value="{{ geonames.name_from_id(user.get_geonameid()) }}" class="input_element geoname_field" name="form_geonameid">
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"></td>
<td class="form_input"><div id="test_city" style="position: absolute; width: 200px; max-height: 200px; overflow-y: auto; z-index: 99999;"></div></td>
<td class="form_alert"></td>
</tr>
<tr>
<td colspan="3">
</tr>
<tr>
<td class="form_label"><label for="form_function">{% trans 'admin::compte-utilisateur poste' %}</label></td>
<td class="form_input">
<input class="input_element" type="text" name="form_function" id="form_function" value="{{ user.get_position() }}"/>
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"><label for="form_company">{% trans 'admin::compte-utilisateur societe' %}</label></td>
<td class="form_input">
<input class="input_element" type="text" name="form_company" id="form_company" value="{{ user.get_company() }}"/>
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"><label for="form_activity">{% trans 'admin::compte-utilisateur activite' %}</label></td>
<td class="form_input">
<input class="input_element" type="text" name="form_activity" id="form_activity" value="{{ user.get_job() }}"/>
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"><label for="form_phone">{% trans 'admin::compte-utilisateur telephone' %}</label></td>
<td class="form_input">
<input class="input_element" type="text" name="form_phone" id="form_phone" value="{{ user.get_tel() }}"/>
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"><label for="form_fax">{% trans 'admin::compte-utilisateur fax' %}</label></td>
<td class="form_input">
<input class="input_element" type="text" name="form_fax" id="form_fax" value="{{ user.get_fax() }}"/>
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td colspan="3">
</tr>
<tr>
<td class="form_label"><label for="form_activeFTP">{% trans 'admin::compte-utilisateur:ftp: Activer le compte FTP' %}</label></td>
<td class="form_input">
<input onchange="if(this.checked){$('#ftpinfos').slideDown();}else{$('#ftpinfos').slideUp();}" style="" type="checkbox" class="checkbox" {% if user.get_activeftp() %}checked{% endif %} name="form_activeFTP" id="form_activeFTP">
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td colspan="3">
<div id="ftpinfos" style="display: {% if user.get_activeftp() %}block{% else %}none{% endif %}">
<table>
<tr>
<td class="form_label"><label for="form_addrFTP">{% trans 'phraseanet:: adresse' %}</label></td>
<td class="form_input">
<input class="input_element" type="text" name="form_addrFTP" id="form_addrFTP" value="<?php echo $user->get_ftp_address() ?>"/>
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"><label for="form_loginFTP">{% trans 'admin::compte-utilisateur identifiant' %}</label></td>
<td class="form_input">
<input class="input_element" type="text" name="form_loginFTP" id="form_loginFTP" value="<?php echo $user->get_ftp_login() ?>"/>
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"><label for="form_pwdFTP">{% trans 'admin::compte-utilisateur mot de passe' %}</label></td>
<td class="form_input">
<input class="input_element" type="password" name="form_pwdFTP" id="form_pwdFTP" value="<?php echo $user->get_ftp_password() ?>"/>
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"><label for="form_destFTP">{% trans 'admin::compte-utilisateur:ftp: repertoire de destination ftp' %}</label></td>
<td class="form_input">
<input class="input_element" type="text" name="form_destFTP" id="form_destFTP" value="<?php echo $user->get_ftp_dir() ?>"/>
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"><label for="form_prefixFTPfolder">{% trans 'admin::compte-utilisateur:ftp: prefixe des noms de dossier ftp' %}</label></td>
<td class="form_input">
<input class="input_element" type="text" name="form_prefixFTPfolder" id="form_prefixFTPfolder" value="<?php echo $user->get_ftp_dir_prefix() ?>"/>
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"><label for="form_passifFTP">{% trans 'admin::compte-utilisateur:ftp: Utiliser le mode passif' %}</label></td>
<td class="form_input">
<input type="checkbox" {% if user.get_ftp_passif() == "1" %}checked{% endif %} name="form_passifFTP" id="form_passifFTP"/>
</td>
<td class="form_alert"></td>
</tr>
<tr style="display: none;">
<td class="form_label"><label for="form_retryFTP">{% trans 'admin::compte-utilisateur:ftp: Nombre d\'essais max' %}</label></td>
<td class="form_input">
<input class="input_element" type="text" name="form_retryFTP" id="form_retryFTP" value="5"/>
</td>
<td class="form_alert"></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
<div style="text-align: center; margin: 5px 0;">
<input type="submit" class="btn btn-info" value="{% trans 'boutton::valider' %}">
</div>
</form>
</td>
</tr>
</table>
</div>
<!-- END TAB ACCOUNT -->
<!-- START TAB ACCESS -->
<div id="tab-account-access">
<form name="updatingDemand" id="updatingDemand" action="/login/account.php" method="post">
{{ demandes['tab'] |raw }}
<input type="submit" class="btn btn-info" value="{% trans 'boutton::valider' %}"/>
</form>
</div>
<!-- END TAB ACCESS -->
<!-- START TAB SESSION -->
<div id="tab-account-session">
<table style="width: 80%; margin: 0 auto;">
<thead>
<tr>
<th colspan="7" style="text-align: left;">
{% trans 'Mes sessions' %}
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
</td>
<td>
{% trans 'Date de connexion' %}
</td>
<td>
{% trans 'Dernier access' %}
</td>
<td>
{% trans 'IP' %}
</td>
<td>
{% trans 'Browser' %}
</td>
<td>
{% trans 'ecran' %}
</td>
<td>
{% trans 'Session persistante' %}
</td>
</tr>
{% for row in session.get_my_sessions() %}
<tr>
<td>
{% if session.get_ses_id() != row['session_id'] %}
<img src="/skins/icons/delete.png"/>
{% endif %}
</td>
<td>
{{ row['created_on'] |getDate }}
</td>
<td>
{{ row['lastaccess'] |getDate }}
</td>
<td>
{{ row['ip'] }}
{{ row['ip_infos'] }}
</td>
<td>
{{ row['browser'] }} {{ row['browser_version'] }}
</td>
<td>
{{ row['screen'] }}
</td>
<td>
{% if row['token'] %}oui{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<!-- END TAB SESSION -->
<!-- START TAB APPLICATION -->
<div id="tab-account-app"></div>
<!-- END TAB SESSION -->
<!-- START TAB APPLICATION -->
<div id="tab-account-dev"></div>
<!-- END TAB SESSION -->
</div>
</div>
<div style="text-align: right; position: relative; margin: 18px 10px 0 0; font-size: 10px; font-weight: normal;"><span>&copy; Copyright Alchemy 2005-{{ "now"|date("Y") }}</span></div>
</div>
</div>
</body>
</html>

View File

@@ -81,6 +81,7 @@ if ($request->has_post_datas()) {
}
}
}
if (count(array_diff($accountFields, array_keys($request->get_post_datas()))) == 0) {
$defaultDatas = 0;
@@ -123,6 +124,7 @@ if ($request->has_post_datas()) {
}
}
}
if ($request->has_post_datas()) {
$evt_mngr = eventsmanager_broker::getInstance($appbox, $Core);
$notifications = $evt_mngr->list_notifications_available($appbox->get_session()->get_usr_id());
@@ -144,650 +146,42 @@ if ($request->has_post_datas()) {
$user->setPrefs('notification_' . $k, $v);
}
}
$geonames = new geonames();
$user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox);
$notice = '';
if ( ! is_null($parm['notice'])) {
switch ($parm['notice']) {
case 'password-update-ok':
$notice = _('login::notification: Mise a jour du mot de passe avec succes');
break;
case 'account-update-ok':
$notice = _('login::notification: Changements enregistres');
break;
case 'account-update-bad':
$notice = _('forms::erreurs lors de l\'enregistrement des modifications');
break;
case 'demand-ok':
$notice = _('login::notification: Vos demandes ont ete prises en compte');
break;
}
}
$demandes = giveMeBaseUsr($usr_id, $lng);
$evt_mngr = eventsmanager_broker::getInstance($appbox, $Core);
$notifications = $evt_mngr->list_notifications_available($appbox->get_session()->get_usr_id());
$parameters = array(
'geonames' => $geonames,
'user' => $user,
'notice' => $notice,
'demandes' => $demandes,
'evt_mngr' => $evt_mngr,
'notifications' => $notifications,
);
$Core['Twig']->display('user/account.html.twig', $parameters);
return;
?>
<html lang="<?php echo $appbox->get_session()->get_I18n(); ?>">
<head>
<title><?php echo $appbox->get_registry()->get('GV_homeTitle') ?> <?php echo _('login:: Mon compte') ?></title>
<link rel="stylesheet" type="text/css" href="/include/minify/f=login/home.css,login/geonames.css,skins/html5/bootstrap/css/bootstrap.min.css,skins/html5/bootstrap/css/bootstrap-responsive.min.css,skins/login/css/main.css"/>
<link rel="stylesheet" type="text/css" href="/skins/login/css/main.css"/>
<script type="text/javascript" language="javascript" src="/include/minify/f=include/jslibs/jquery-1.7.1.js"></script>
<script type="text/javascript" language="javascript" src="/include/jslibs/jquery-ui-1.8.17/js/jquery-ui-1.8.17.custom.min.js"></script>
<script type="text/javascript" src="/login/geonames.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var trans = {
'confirm_delete' : "<?php echo _("etes vous sur de vouloir supprimer cette application"); ?>"
,'yes' : "<?php echo _("oui"); ?>"
,'no' : "<?php echo _("non"); ?>"
}
$( "#tab-account-cat").tabs({
ajaxOptions: {
error: function( xhr, status, index, anchor ) {
$( anchor.hash ).html("<?php echo _('Erreur lors du chargement') ?>");
}
}
});
initialize_geoname_field($('#form_geonameid'));
$("#generate_access").live("click", function(){
var app_id = $(this).attr("value");
var usr_id = $(this).closest("div").attr("id");
var opts = {
type:"POST",
url : '/api/oauthv2/applications/'+ app_id +'/generate_access_token/',
dataType: 'json',
data : {
usr_id : usr_id
},
success : function(data){
if(data.ok)
$("#my_access_token").empty().append(data.token);
}
}
jQuery.ajax(opts);
});
var $url_callback_event = function(event) {
if ( event.type == "mouseover" ) {
$(this).find(".modifier_callback").show();
} else {
$(this).find(".modifier_callback").hide();
}
};
var $event = function(event){
if ( event.type == "mouseover" ) {
$(this).find(".delete_app").show();
} else {
$(this).find(".delete_app").hide();
}
};
$(".url_callback").live("mouseover mouseout", $url_callback_event);
$(".app-list li").live("mouseover mouseout", $event);
$(".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 : "/api/oauthv2/applications/oauth_callback",
dataType: 'json',
data :{app_id : app_id, callback : callback},
success : function(data){
if(data.success == true)
$(".url_callback_input").empty().append(callback);
else
$(".url_callback_input").empty().append(cur_value);
$this.hide();
$(".url_callback").live("mouseover mouseout", $url_callback_event);
}
}
$.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 : '/api/oauthv2/applications/' + appId + '/grant_password/',
dataType: 'json',
data : {
grant : grant
},
success : function(data){
}
}
$.ajax(opts);
});
$(".app-btn").live("click", function(){
if (!$(this).hasClass("authorize"))
{
var revoke = 1;
var button_class = "authorize";
var old_class ="revoke";
var string = "<?php echo _('Authoriser l\'access'); ?>";
}
if ($(this).hasClass("authorize"))
{
var revoke = 0;
var button_class = "revoke";
var old_class ="authorize";
var string = "<?php echo _('Revoquer l\'access'); ?>";
}
var acc_id = $(this).attr("value");
var current = $(this);
var opts = {
type:"POST",
url : '/api/oauthv2/applications/revoke_access/',
dataType: 'json',
data : {
account_id : acc_id,
revoke : revoke
},
success : function(data){
if(data.ok)
{
div = current.closest("div");
current.removeClass(old_class).addClass(button_class);
current.attr("value", acc_id);
current.empty().append(string);
}
}
}
$.ajax(opts);
});
$("#app_dev, #app_dev_new, #app_dev_create, a.dev_back").live("click", function(e){
e.preventDefault();
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").die().live("click", function(){
var id = $(this).closest("li").attr('id').split("_");;
var app_id = id[1];
var $this= $(this);
$("body").append("<div id='confirm_delete'><p>"+trans.confirm_delete+" ? </p></div>")
$("#confirm_delete").dialog({
resizable: false,
autoOpen :true,
title: "",
draggable: false,
width:340,
modal: true,
buttons: [{
id: "ybutton",
text: trans.yes,
click: function() {
var opts = {
type:"DELETE",
url : '/api/oauthv2/applications/'+ app_id,
dataType: 'json',
data : {},
success : function(data){
if(data.success == true)
{
$this.closest("li").remove();
$("#confirm_delete").dialog("close");
}
}
}
$.ajax(opts);
}
},
{
id: "nbutton",
text: trans.no,
click: function() {
$( this ).dialog( "close" );
}
}],
close : function() {
$( this ).remove();
}
});
});
});
</script>
<style type="text/css">
.tab-content{
height:auto;
}
</style>
</head>
<body>
<div style="width:950px;margin-left:auto;margin-right:auto;">
<div style="margin-top:70px;height:35px;">
<table style="width:100%;">
<tr style="height:35px;">
<td style="width:580px;"><span class="title-name"><?php echo $appbox->get_registry()->get('GV_homeTitle') ?></span><span class="title-desc"><?php echo _('login:: Mon compte') ?></span></td>
<td style="color:#b1b1b1;text-align:right;">
</td>
</tr>
</table>
</div>
<div class="tab-pane">
<div id="id-main" class="tab-content" style="display:block;text-align:center;overflow-y:auto;overflow-x:hidden;">
<div id="tab-account-cat">
<ul>
<li><a href="#tab-account-info"><?php echo _('Informations'); ?></a></li>
<li><a href="#tab-account-access"><?php echo _('Acces'); ?></a></li>
<li><a href="#tab-account-session"><?php echo _('Sessions'); ?></a></li>
<li><a href="/api/oauthv2/applications" title="tab-account-app"><?php echo _('Applications'); ?></a></li>
<li><a href="/api/oauthv2/applications/dev" title="tab-account-dev"><?php echo _('Developpeur'); ?></a></li>
</ul>
<div id="tab-account-info">
<table>
<tr valign="top">
<td style="width:98%">
<?php
$notice = '';
if ( ! is_null($parm['notice'])) {
switch ($parm['notice']) {
case 'password-update-ok':
$notice = _('login::notification: Mise a jour du mot de passe avec succes');
break;
case 'account-update-ok':
$notice = _('login::notification: Changements enregistres');
break;
case 'account-update-bad':
$notice = _('forms::erreurs lors de l\'enregistrement des modifications');
break;
case 'demand-ok':
$notice = _('login::notification: Vos demandes ont ete prises en compte');
break;
}
}
if ($notice != '') {
?>
<div class="notice"><?php echo $notice ?></div>
<?php
}
?>
<form name="account" id="account" action="/login/account.php" method="post">
<table style="margin:20px auto;">
<tr>
<td></td>
<td><a href="/login/reset-password.php" class="link" target="_self"><?php echo _('admin::compte-utilisateur changer mon mot de passe'); ?></a></td>
<td></td>
</tr>
<tr>
<td colspan="3"></td>
</tr>
<tr>
<td class="form_label"><label for="form_login"><?php echo _('admin::compte-utilisateur identifiant'); ?></label></td>
<td class="form_input"><?php echo $user->get_login() ?></td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"><label for="form_gender"><?php echo _('admin::compte-utilisateur sexe') ?></label></td>
<td class="form_input">
<select class="input_element" name="form_gender" id="form_gender" >
<option <?php echo ($user->get_gender() == "0" ? "selected" : "") ?> value="0" ><?php echo _('admin::compte-utilisateur:sexe: mademoiselle'); ?></option>
<option <?php echo ($user->get_gender() == "1" ? "selected" : "") ?> value="1" ><?php echo _('admin::compte-utilisateur:sexe: madame'); ?></option>
<option <?php echo ($user->get_gender() == "2" ? "selected" : "") ?> value="2" ><?php echo _('admin::compte-utilisateur:sexe: monsieur'); ?></option>
</select>
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"><label for="form_lastname"><?php echo _('admin::compte-utilisateur nom'); ?></label></td>
<td class="form_input">
<input class="input_element" type="text" name="form_lastname" id="form_lastname" value="<?php echo $user->get_lastname() ?>" >
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"><label for="form_firstname"><?php echo _('admin::compte-utilisateur prenom'); ?></label></td>
<td class="form_input">
<input class="input_element" type="text" name="form_firstname" id="form_firstname" value="<?php echo $user->get_firstname() ?>" >
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td colspan="3">
</tr>
<tr>
<td class="form_label"><label for=""><?php echo _('admin::compte-utilisateur email') ?></label></td>
<td class="form_input" colspan="2">
<?php echo $user->get_email() ?> <a class="link" href="/login/reset-email.php" target="_self"><?php echo _('login:: Changer mon adresse email') ?></a>
</td>
</tr>
<tr>
<td colspan="3"></td>
</tr>
<tr>
<td colspan="3"><?php echo _('Email notification') ?></td>
</tr>
<?php
$evt_mngr = eventsmanager_broker::getInstance($appbox, $Core);
$notifications = $evt_mngr->list_notifications_available($appbox->get_session()->get_usr_id());
foreach ($notifications as $notification_group => $nots) {
?>
<tr>
<td style="font-weight:bold;" colspan="3"><?php echo $notification_group; ?></td>
</tr>
<?php
foreach ($nots as $notification) {
?>
<tr>
<td class="form_label" colspan="2"><label for="notif_<?php echo $notification['id'] ?>"><?php echo $notification['description'] ?></label></td>
<td class="form_input">
<input type="checkbox" id="notif_<?php echo $notification['id'] ?>" name="notifications[<?php echo $notification['id'] ?>]" <?php echo $user->getPrefs('notification_' . $notification['id']) == '0' ? '' : 'checked'; ?> value="1"/>
</td>
</tr>
<?php
}
}
?>
<tr>
<td colspan="3"></td>
</tr>
<tr>
<td class="form_label"><label for="form_address"><?php echo _('admin::compte-utilisateur adresse') ?></label></td>
<td class="form_input">
<input class="input_element" type="text" name="form_address" id="form_address" value="<?php echo $user->get_address() ?>"/>
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"><label for="form_zip"><?php echo _('admin::compte-utilisateur code postal') ?></label></td>
<td class="form_input">
<input class="input_element" type="text" name="form_zip", id="form_zip" value="<?php echo $user->get_zipcode() ?>"/>
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"><label for="form_city"><?php echo _('admin::compte-utilisateur ville') ?></label></td>
<td class="form_input">
<input id="form_geonameid" type="text" geonameid="<?php echo $user->get_geonameid() ?>" value="<?php echo $geonames->name_from_id($user->get_geonameid()) ?>" class="input_element geoname_field" name="form_geonameid">
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"></td>
<td class="form_input"><div id="test_city" style="position:absolute;width:200px;max-height:200px;overflow-y:auto;z-index:99999;"></div></td>
<td class="form_alert"></td>
</tr>
<tr>
<td colspan="3">
</tr>
<tr>
<td class="form_label"><label for="form_function"><?php echo _('admin::compte-utilisateur poste') ?></label></td>
<td class="form_input">
<input class="input_element" type="text" name="form_function" id="form_function" value="<?php echo $user->get_position() ?>"/>
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"><label for="form_company"><?php echo _('admin::compte-utilisateur societe') ?></label></td>
<td class="form_input">
<input class="input_element" type="text" name="form_company" id="form_company" value="<?php echo $user->get_company() ?>"/>
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"><label for="form_activity"><?php echo _('admin::compte-utilisateur activite') ?></label></td>
<td class="form_input">
<input class="input_element" type="text" name="form_activity" id="form_activity" value="<?php echo $user->get_job() ?>"/>
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"><label for="form_phone"><?php echo _('admin::compte-utilisateur telephone') ?></label></td>
<td class="form_input">
<input class="input_element" type="text" name="form_phone" id="form_phone" value="<?php echo $user->get_tel() ?>"/>
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"><label for="form_fax"><?php echo _('admin::compte-utilisateur fax') ?></label></td>
<td class="form_input">
<input class="input_element" type="text" name="form_fax" id="form_fax" value="<?php echo $user->get_fax() ?>"/>
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td colspan="3">
</tr>
<tr>
<td class="form_label"><label for="form_activeFTP"><?php echo _('admin::compte-utilisateur:ftp: Activer le compte FTP'); ?></label></td>
<td class="form_input">
<input onchange="if(this.checked){$('#ftpinfos').slideDown();}else{$('#ftpinfos').slideUp();}" style="" type="checkbox" class="checkbox" <?php echo ($user->get_activeftp() ? "checked" : "") ?> name="form_activeFTP" id="form_activeFTP">
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td colspan="3">
<div id="ftpinfos" style="display:<?php echo ($user->get_activeftp() ? "block" : "none") ?>;">
<table>
<tr>
<td class="form_label"><label for="form_addrFTP"><?php echo _('phraseanet:: adresse') ?></label></td>
<td class="form_input">
<input class="input_element" type="text" name="form_addrFTP" id="form_addrFTP" value="<?php echo $user->get_ftp_address() ?>"/>
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"><label for="form_loginFTP"><?php echo _('admin::compte-utilisateur identifiant') ?></label></td>
<td class="form_input">
<input class="input_element" type="text" name="form_loginFTP" id="form_loginFTP" value="<?php echo $user->get_ftp_login() ?>"/>
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"><label for="form_pwdFTP"><?php echo _('admin::compte-utilisateur mot de passe') ?></label></td>
<td class="form_input">
<input class="input_element" type="password" name="form_pwdFTP" id="form_pwdFTP" value="<?php echo $user->get_ftp_password() ?>"/>
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"><label for="form_destFTP"><?php echo _('admin::compte-utilisateur:ftp: repertoire de destination ftp') ?></label></td>
<td class="form_input">
<input class="input_element" type="text" name="form_destFTP" id="form_destFTP" value="<?php echo $user->get_ftp_dir() ?>"/>
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"><label for="form_prefixFTPfolder"><?php echo _('admin::compte-utilisateur:ftp: prefixe des noms de dossier ftp') ?></label></td>
<td class="form_input">
<input class="input_element" type="text" name="form_prefixFTPfolder" id="form_prefixFTPfolder" value="<?php echo $user->get_ftp_dir_prefix() ?>"/>
</td>
<td class="form_alert"></td>
</tr>
<tr>
<td class="form_label"><label for="form_passifFTP"><?php echo _('admin::compte-utilisateur:ftp: Utiliser le mode passif') ?></label></td>
<td class="form_input">
<input type="checkbox" <?php echo ($user->get_ftp_passif() == "1" ? "checked" : "") ?> name="form_passifFTP" id="form_passifFTP"/>
</td>
<td class="form_alert"></td>
</tr>
<tr style="display:none;">
<td class="form_label"><label for="form_retryFTP"><?php echo _('admin::compte-utilisateur:ftp: Nombre d\'essais max') ?></label></td>
<td class="form_input">
<input class="input_element" type="text" name="form_retryFTP" id="form_retryFTP" value="5"/>
</td>
<td class="form_alert"></td>
</tr>
<tr style="display:none;">
<td class="form_label"><label for="form_defaultdataFTP"><?php echo _('admin::compte-utilisateur:ftp: Donnees envoyees automatiquement par ftp') ?></label></td>
<td class="form_input">
<input class="checkbox" type="checkbox" <?php echo ((($user->get_defaultftpdatas() >> 2) & 1) == 1 ? "checked" : "") ?> name="form_defaultdataFTP[]" value="document" id="form_defaultSendDocument"><label for="form_defaultSendDocument"><?php echo _('phraseanet:: original'); ?></label>
<input class="checkbox" type="checkbox" <?php echo ((($user->get_defaultftpdatas() >> 1) & 1) == 1 ? "checked" : "") ?> name="form_defaultdataFTP[]" value="preview" id="form_defaultSendPreview"><label for="form_defaultSendPreview"><?php echo _('phraseanet:: preview'); ?></label>
<input class="checkbox" type="checkbox" <?php echo (($user->get_defaultftpdatas() & 1) == 1 ? "checked" : "") ?> name="form_defaultdataFTP[]" value="caption" id="form_defaultSendCaption"><label for="form_defaultSendCaption"><?php echo _('phraseanet:: imagette'); ?></label>
</td>
<td class="form_alert"></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
<div style="text-align:center;margin:5px 0;">
<input type="submit" value="<?php echo _('boutton::valider'); ?>">
</div>
</form>
</td>
</tr>
</table>
</div>
<!-- END TAB ACCOUNT -->
<!-- START TAB ACCESS -->
<div id="tab-account-access">
<form name="updatingDemand" id="updatingDemand" action="/login/account.php" method="post">
<?php
$demandes = giveMeBaseUsr($usr_id, $lng);
echo $demandes['tab'];
?>
<input type="submit" value="<?php echo _('boutton::valider'); ?>"/>
</form>
</div>
<!-- END TAB ACCESS -->
<!-- START TAB SESSION -->
<div id="tab-account-session">
<table style="width:80%;margin:0 auto;">
<thead>
<tr>
<th colspan="7" style="text-align:left;">
<?php echo _('My sessions') ?>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
</td>
<td>
<?php echo _('Date of connection') ?>
</td>
<td>
<?php echo _('Last access') ?>
</td>
<td>
<?php echo _('IP adress') ?>
</td>
<td>
<?php echo _('Browser') ?>
</td>
<td>
<?php echo _('Screen') ?>
</td>
<td>
<?php echo _('Persistent session') ?>
</td>
</tr>
<?php
foreach ($appbox->get_session()->get_my_sessions() as $row) {
?>
<tr>
<td>
<?php
if ($appbox->get_session()->get_ses_id() != $row['session_id']) {
?>
<img src="/skins/icons/delete.png"/>
<?php
}
?>
</td>
<td>
<?php echo phraseadate::getDate(new DateTime($row['created_on'])) ?>
</td>
<td>
<?php echo phraseadate::getDate(new DateTime($row['lastaccess'])) ?>
</td>
<td>
<?php echo $row['ip'] ?>
<?php echo $row['ip_infos'] ?>
</td>
<td>
<?php
echo $row['browser'];
echo ' ' . $row['browser_version']
?>
</td>
<td>
<?php echo $row['screen'] ?>
</td>
<td>
<?php echo $row['token'] ? 'oui' : '' ?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<!-- END TAB SESSION -->
<!-- START TAB APPLICATION -->
<div id="tab-account-app">
</div>
<div id="tab-account-dev">
</div>
</div>
</div>
<div style="text-align:right;position:relative;margin:18px 10px 0 0;font-size:10px;font-weight:normal;"><span>&copy; Copyright Alchemy 2005-<?php echo date('Y') ?></span></div>
</div>
</div>
</body>
</html>

View File

@@ -20,12 +20,18 @@ label {
color: #ffffff;
}
/******* NAVBAR ***************************************************************/
#tab-account-cat .ui-tabs-nav li a {
#tab-account-cat ul {
list-style: none;
}
#tab-account-cat ul li {
display: inline;
}
#tab-account-cat ul li a {
color: #0088cc;
text-decoration: none;
font-size: 13px;
}
#tab-account-cat .ui-tabs-nav li a:hover {
#tab-account-cat ul li a:hover {
background-color: #0088cc;
color: #ffffff;
}

View File

@@ -53,14 +53,18 @@ label {
/******* NAVBAR ***************************************************************/
#tab-account-cat {
.ui-tabs-nav li {
a {
.color(@blue);
text-decoration: none;
font-size: 13px;
&:hover {
.bg(@blue);
.color(@white);
ul {
list-style: none;
li {
display: inline;
a {
.color(@blue);
text-decoration: none;
font-size: 13px;
&:hover {
.bg(@blue);
.color(@white);
}
}
}
}