add /developers/ route

This commit is contained in:
Nicolas Le Goff
2012-07-13 16:52:15 +02:00
committed by Ysolyne Gresille
parent 07795e873e
commit 6cb75ecec5
20 changed files with 1635 additions and 935 deletions

View File

@@ -45,6 +45,8 @@ rewrite ^/prod/notifications/.*$ /prod/router.php last;
rewrite ^/robots.txt$ /index.php last;
rewrite ^/feeds/.*$ /index.php last;
rewrite ^/account/.*$ /index.php last;
rewrite ^/developers/.*$ /index.php last;
rewrite ^/lightbox/.*$ /lightbox/index.php last;
rewrite ^/api/v1/.*$ /api/v1/index.php last;

View File

@@ -203,206 +203,6 @@ return call_user_func(function() {
return;
});
/* ****************************************************************
* MANAGEMENT APPS
*
*
*/
/**
* list of all authorized apps by logged user
*/
$route = '/applications';
$app->get($route, function() use ($app) {
$apps = \API_OAuth2_Application::load_app_by_user($app['appbox'], $app['Core']->getAuthenticatedUser());
return $app['response']('api/auth/applications.twig', array("apps" => $apps, 'user' => $app['Core']->getAuthenticatedUser()));
});
/**
* list of apps created by user
*/
$route = "/applications/dev";
$app->get($route, function() use ($app) {
$rs = \API_OAuth2_Application::load_dev_app_by_user($app['appbox'], $app['Core']->getAuthenticatedUser());
return $app['response']('api/auth/application_dev.twig', array("apps" => $rs));
});
/**
* display a new app form
*/
$route = "/applications/dev/new";
$app->get($route, function() use ($app) {
$var = array("violations" => null, 'form' => null, 'request' => $app['request']);
return $app['response']('api/auth/application_dev_new.twig', $var);
});
$route = "/applications/dev/create";
$app->post($route, function() use ($app) {
$submit = false;
if ($app['request']->get("type") == "desktop") {
$post = new \API_OAuth2_Form_DevAppDesktop($app['request']);
} else {
$post = new \API_OAuth2_Form_DevAppInternet($app['request']);
}
$violations = $app['validator']->validate($post);
if ($violations->count() == 0)
$submit = true;
$request = $app['request'];
if ($submit) {
$application = \API_OAuth2_Application::create($app['appbox'], $app['Core']->getAuthenticatedUser(), $post->getName());
$application->set_description($post->getDescription())
->set_redirect_uri($post->getSchemeCallback() . $post->getCallback())
->set_type($post->getType())
->set_website($post->getSchemeWebsite() . $post->getWebsite());
return $app->redirect("/api/oauthv2/applications/dev/" . $application->get_id() . "/show");
}
$var = array(
"violations" => $violations,
"form" => $post
);
return $app['response']('api/auth/application_dev_new.twig', $var);
});
/**
* show details of app identified by its id
*/
$route = "/applications/dev/{id}/show";
$app->get($route, function($id) use ($app) {
$client = new \API_OAuth2_Application($app['appbox'], $id);
$token = $client->get_user_account($app['Core']->getAuthenticatedUser())->get_token()->get_value();
$var = array("app" => $client, "user" => $app['Core']->getAuthenticatedUser(), "token" => $token);
return $app['response']('api/auth/application_dev_show.twig', $var);
})->assert('id', '\d+');
/**
* revoke access from a user to the app
* identified by account id
*/
$route = "/applications/revoke_access/";
$app->post($route, function() use ($app) {
$result = array("ok" => false);
try {
$account = new \API_OAuth2_Account($app['appbox'], $app['request']->get('account_id'));
$account->set_revoked((bool) $app['request']->get('revoke'));
$result['ok'] = true;
} catch (\Exception $e) {
}
$Serializer = $app['Core']['Serializer'];
return new Response(
$Serializer->serialize($result, 'json')
, 200
, array("content-type" => "application/json")
);
});
/**
* revoke access from a user to the app
* identified by account id
*/
$route = "/applications/{appId}/grant_password/";
$app->post($route, function($appId) use ($app) {
$result = array("ok" => false);
try {
$client = new \API_OAuth2_Application($app['appbox'], $appId);
$client->set_grant_password((bool) $app['request']->get('grant'));
$result['ok'] = true;
} catch (\Exception $e) {
}
$Serializer = $app['Core']['Serializer'];
return new Response(
$Serializer->serialize($result, 'json')
, 200
, array("content-type" => "application/json")
);
});
$route = "/applications/{id}/generate_access_token/";
$app->post($route, function($id) use ($app) {
$result = array("ok" => false);
try {
$client = new \API_OAuth2_Application($app['appbox'], $id);
$account = $client->get_user_account($app['Core']->getAuthenticatedUser());
$token = $account->get_token();
if ($token instanceof API_OAuth2_Token)
$token->renew();
else
$token = \API_OAuth2_Token::create($app['appbox'], $account);
$result = array(
"ok" => true
, 'token' => $token->get_value()
);
} catch (\Exception $e) {
}
$Serializer = $app['Core']['Serializer'];
return new Response(
$Serializer->serialize($result, 'json')
, 200
, array("content-type" => "application/json")
);
})->assert('id', '\d+');
$route = "/applications/oauth_callback";
$app->post($route, function() use ($app) {
$app_id = $app['request']->request->get("app_id");
$app_callback = $app["request"]->request->get("callback");
$result = array("success" => false);
try {
$client = new \API_OAuth2_Application($app['appbox'], $app_id);
$client->set_redirect_uri($app_callback);
$result['success'] = true;
} catch (\Exception $e) {
}
$Serializer = $app['Core']['Serializer'];
return new Response(
$Serializer->serialize($result, 'json')
, 200
, array("content-type" => "application/json")
);
});
$route = "/applications/{id}";
$app->delete($route, function($id) use ($app) {
$result = array("success" => false);
try {
$client = new \API_OAuth2_Application($app['appbox'], $id);
$client->delete();
$result['success'] = true;
} catch (\Exception $e) {
}
$Serializer = $app['Core']['Serializer'];
return new Response(
$Serializer->serialize($result, 'json')
, 200
, array("content-type" => "application/json")
);
})->assert('id', '\d+');
/**
* *******************************************************************
*

View File

@@ -13,6 +13,7 @@ namespace Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Controller\Root as Controller;
use Silex\Application as SilexApp;
use Silex\Provider\ValidatorServiceProvider;
use Symfony\Component\HttpFoundation\Response;
/**
@@ -25,12 +26,10 @@ return call_user_func(function() {
$app['Core'] = \bootstrap::getCore();
$app->register(new ValidatorServiceProvider());
$app->before(function () use ($app) {
// redirect the user to the setup screen
// if Phraseanet in not set up
if ( ! \setup::is_installed()) {
return $app->redirect("/setup/");
}
$app['Core']['Firewall']->requireSetup($app);
});
$app->get('/', function(SilexApp $app) {
@@ -60,6 +59,7 @@ return call_user_func(function() {
$app->mount('/feeds/', new Controller\RSSFeeds());
$app->mount('/account/', new Controller\Account());
$app->mount('/developers/', new Controller\Developers());
return $app;
}

View File

@@ -15,6 +15,7 @@ use Silex\Application;
use Silex\ControllerProviderInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;
/**
*
@@ -28,8 +29,6 @@ class Account implements ControllerProviderInterface
{
$controllers = $app['controllers_factory'];
require_once $app['Core']['Registry']->get('GV_RootPath') . 'lib/classes/deprecated/inscript.api.php';
$controllers->before(function() use ($app) {
$app['Core']['Firewall']->requireAuthentication($app);
});
@@ -95,9 +94,156 @@ class Account implements ControllerProviderInterface
$controllers->post('/', $this->call('updateAccount'))
->bind('update_account');
/**
* Give account access
*
* name : account_access
*
* description : Display form to create a new account
*
* method : GET
*
* parameters : none
*
* return : HTML Response
*/
$controllers->get('/access/', $this->call('accountAccess'))
->bind('account_access');
/**
* Give account open sessions
*
* name : account_sessions
*
* description : Display form to create a new account
*
* method : GET
*
* parameters : none
*
* return : HTML Response
*/
$controllers->get('/security/sessions/', $this->call('accountSessionsAccess'))
->bind('account_sessions');
/**
* Give authorized applications that can access user informations
*
* name : account_auth_apps
*
* description : Display form to create a new account
*
* method : GET
*
* parameters : none
*
* return : HTML Response
*/
$controllers->get('/security/applications/', $this->call('accountAuthorizedApps'))
->bind('account_auth_apps');
/**
* Grant access to an authorized app
*
* name : grant_app_access
*
* description : Display form to create a new account
*
* method : GET
*
* parameters : none
*
* return : HTML Response
*/
$controllers->get('/security/application/{application_id}/grant/', $this->call('grantAccess'))
->assert('application_id', '\d+')
->bind('grant_app_access');
return $controllers;
}
/**
* Display authorized applications that can access user informations
*
* @param Application $app A Silex application where the controller is mounted on
* @param Request $request The current request
*
* @return Response
*/
public function grantAccess(Application $app, Request $request, $application_id)
{
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
$app->abort(400, _('Bad request format, only JSON is allowed'));
}
$appbox = \appbox::get_instance($app['Core']);
$error = false;
try {
$account = \API_OAuth2_Account::load_with_user(
$appbox
, new \API_OAuth2_Application($appbox, $application_id)
, $app['Core']->getAuthenticatedUser()
);
} catch (\Exception_NotFound $e) {
$error = true;
}
$account->set_revoked((bool) $request->get('revoke'), false);
return new JsonResponse(array('success' => ! $error));
}
/**
* Display authorized applications that can access user informations
*
* @param Application $app A Silex application where the controller is mounted on
* @param Request $request The current request
*
* @return Response
*/
public function accountAuthorizedApps(Application $app, Request $request)
{
$user = $app['Core']->getAuthenticatedUser();
return $app['Core']['Twig']->render('account/authorized_apps.html.twig', array(
"apps" => \API_OAuth2_Application::load_app_by_user(\appbox::get_instance($app['Core']), $user),
'user' => $user
));
}
/**
* Display account session accesss
*
* @param Application $app A Silex application where the controller is mounted on
* @param Request $request The current request
*
* @return Response
*/
public function accountSessionsAccess(Application $app, Request $request)
{
return new Response($app['Core']['Twig']->render('account/sessions.html.twig'));
}
/**
* Display account base access
*
* @param Application $app A Silex application where the controller is mounted on
* @param Request $request The current request
*
* @return Response
*/
public function accountAccess(Application $app, Request $request)
{
require_once $app['Core']['Registry']->get('GV_RootPath') . 'lib/classes/deprecated/inscript.api.php';
$user = $app['Core']->getAuthenticatedUser();
return new Response($app['Core']['Twig']->render('account/access.html.twig', array(
'inscriptions' => giveMeBases($user->get_id())
)));
}
/**
* Display account form
*
@@ -127,11 +273,10 @@ class Account implements ControllerProviderInterface
break;
}
return new Response($app['Core']['Twig']->render('user/account.html.twig', array(
return new Response($app['Core']['Twig']->render('account/account.html.twig', array(
'geonames' => new \geonames(),
'user' => $user,
'notice' => $notice,
'inscriptions' => giveMeBases($user->get_id()),
'evt_mngr' => $evtMngr,
'notifications' => $evtMngr->list_notifications_available($user->get_id()),
)));

View File

@@ -0,0 +1,416 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2012 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Controller\Root;
use Silex\Application;
use Silex\ControllerProviderInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class Developers implements ControllerProviderInterface
{
public function connect(Application $app)
{
$controllers = $app['controllers_factory'];
$controllers->before(function() use ($app) {
$app['Core']['Firewall']->requireAuthentication($app);
});
/**
* List of apps created by the user
*
* name : list_dev_apps
*
* description : Display form to create a new account
*
* method : GET
*
* parameters : none
*
* return : HTML Response
*/
$controllers->get('/applications/', $this->call('listApps'))
->bind('list_dev_apps');
/**
* Get the form to create a new application
*
* name : form_dev_app
*
* description : Display form to create a new account
*
* method : GET
*
* parameters : none
*
* return : HTML Response
*/
$controllers->get('/application/new/', $this->call('displayFormApp'))
->bind('form_dev_app');
/**
* Create a new app
*
* name : create_dev_app
*
* description : Display form to create a new account
*
* method : POST
*
* parameters : none
*
* return : HTML Response
*/
$controllers->post('/application/', $this->call('newApp'))
->bind('create_dev_app');
/**
* Get application information
*
* name : get_dev_app
*
* description : Display form to create a new account
*
* method : GET
*
* parameters : none
*
* return : HTML Response
*/
$controllers->get('/application/{id}/', $this->call('getApp'))
->assert('id', '\d+')
->bind('get_dev_app');
/**
* Delete application
*
* name : delete_dev_app
*
* description : Delete selected application
*
* method : GET
*
* parameters : none
*
* return : HTML Response
*/
$controllers->delete('/application/{id}/', $this->call('deleteApp'))
->assert('id', '\d+')
->bind('delete_dev_app');
/**
* Authorize application to use a grant password type, which allow end user to
* authenticate himself with their credentials (login/password)
*
* name : grant_password_auth
*
* description : Display form to create a new account
*
* method : POST
*
* parameters : none
*
* return : HTML Response
*/
$controllers->post('/application/{id}/authorize_grant_password/', $this->call('authorizeGrantpassword'))
->assert('id', '\d+')
->bind('grant_password_auth');
/**
* Renew access token
*
* name : renew_access_token
*
* description : Regenerate an access token for the current app linked to the authenticated user
*
* method : POST
*
* parameters : none
*
* return : HTML Response
*/
$controllers->post('/application/{id}/access_token/', $this->call('renewAccessToken'))
->assert('id', '\d+')
->bind('renew_access_token');
/**
* Renew access token
*
* name : renew_app_callback
*
* description : Regenerate an access token for the current app linked to the authenticated user
*
* method : POST
*
* parameters : none
*
* return : HTML Response
*/
$controllers->post('/application/{id}/callback/', $this->call('renewAppCallback'))
->assert('id', '\d+')
->bind('renew_app_callback');
return $controllers;
}
/**
* Delete application
*
* @param Application $app A Silex application where the controller is mounted on
* @param Request $request The current request
* @param integer $id The application id
*
* @return Response
*/
public function deleteApp(Application $app, Request $request, $id)
{
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
$app->abort(400, _('Bad request format, only JSON is allowed'));
}
$error = false;
try {
$clientApp = new \API_OAuth2_Application(\appbox::get_instance($app['Core']), $id);
$clientApp->delete();
} catch (\Exception_NotFound $e) {
$error = true;
}
return new JsonResponse(array('success' => ! $error));
}
/**
* Change application callback
*
* @param Application $app A Silex application where the controller is mounted on
* @param Request $request The current request
* @param integer $id The application id
*
* @return Response
*/
public function renewAppCallback(Application $app, Request $request, $id)
{
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
$app->abort(400, _('Bad request format, only JSON is allowed'));
}
$error = false;
try {
$clientApp = new \API_OAuth2_Application(\appbox::get_instance($app['Core']), $id);
if ($callback = $request->get("callback")) {
$clientApp->set_redirect_uri($callback);
} else {
$error = true;
}
} catch (\Exception_NotFound $e) {
$error = true;
}
return new JsonResponse(array('success' => ! $error));
}
/**
* Authorize application to use a grant password type
*
* @param Application $app A Silex application where the controller is mounted on
* @param Request $request The current request
* @param integer $id The application id
*
* @return Response
*/
public function renewAccessToken(Application $app, Request $request, $id)
{
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
$app->abort(400, _('Bad request format, only JSON is allowed'));
}
$appbox = \appbox::get_instance($app['Core']);
$error = false;
$accessToken = null;
try {
$clientApp = new \API_OAuth2_Application($appbox, $id);
$account = $clientApp->get_user_account($app['Core']->getAuthenticatedUser());
$token = $account->get_token();
if ($token instanceof \API_OAuth2_Token) {
$token->renew();
} else {
$token = \API_OAuth2_Token::create($appbox, $account);
}
$accessToken = $token->get_value();
} catch (\Exception $e) {
$error = true;
}
return new JsonResponse(array('success' => ! $error, 'token' => $accessToken));
}
/**
* Authorize application to use a grant password type
*
* @param Application $app A Silex application where the controller is mounted on
* @param Request $request The current request
* @param integer $id The application id
*
* @return Response
*/
public function authorizeGrantpassword(Application $app, Request $request, $id)
{
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
$app->abort(400, _('Bad request format, only JSON is allowed'));
}
$error = false;
try {
$clientApp = new \API_OAuth2_Application(\appbox::get_instance($app['Core']), $id);
} catch (\Exception_NotFound $e) {
$error = true;
}
$clientApp->set_grant_password((bool) $request->get('grant', false));
return new JsonResponse(array('success' => ! $error));
}
/**
* Create a new developer applications
*
* @param Application $app A Silex application where the controller is mounted on
* @param Request $request The current request
*
* @return Response
*/
public function newApp(Application $app, Request $request)
{
$error = false;
if ($request->get("type") == "desktop") {
$form = new \API_OAuth2_Form_DevAppDesktop($app['request']);
} else {
$form = new \API_OAuth2_Form_DevAppInternet($app['request']);
}
$violations = $app['validator']->validate($form);
if ($violations->count() == 0) {
$error = true;
}
if ($error) {
$application = \API_OAuth2_Application::create(\appbox::get_instance($app['Core']), $app['Core']->getAuthenticatedUser(), $form->getName());
$application
->set_description($form->getDescription())
->set_redirect_uri($form->getSchemeCallback() . $form->getCallback())
->set_type($form->getType())
->set_website($form->getSchemeWebsite() . $form->getWebsite());
return $app->redirect(sprintf('/developers/application/%d/', $application->get_id()));
}
$var = array(
"violations" => $violations,
"form" => $form
);
return $app['Core']['Twig']->render('/developers/application.html.twig', $var);
}
/**
* List of apps created by the user
*
* @param Application $app A Silex application where the controller is mounted on
* @param Request $request The current request
*
* @return Response
*/
public function listApps(Application $app, Request $request)
{
return $app['Core']['Twig']->render('developers/applications.html.twig', array(
"apps" => \API_OAuth2_Application::load_dev_app_by_user(
\appbox::get_instance($app['Core']), $app['Core']->getAuthenticatedUser()
)));
}
/**
* Display form application
*
* @param Application $app A Silex application where the controller is mounted on
* @param Request $request The current request
*
* @return Response
*/
public function displayFormApp(Application $app, Request $request)
{
return $app['Core']['Twig']->render('developers/application_form.html.twig', array(
"violations" => null,
'form' => null,
'request' => $request
));
}
/**
* Get application information
*
* @param Application $app A Silex application where the controller is mounted on
* @param Request $request The current request
* @param integer $id The application id
*
* @return Response
*/
public function getApp(Application $app, Request $request, $id)
{
$user = $app['Core']->getAuthenticatedUser();
try {
$client = new \API_OAuth2_Application(\appbox::get_instance($app['Core']), $id);
} catch (\Exception_NotFound $e) {
$app->abort(404);
}
$token = $client->get_user_account($user)->get_token()->get_value();
return $app['Core']['Twig']->render('developers/application.html.twig', array(
"app" => $client,
"user" => $user,
"token" => $token
));
}
/**
* Prefix the method to call with the controller class name
*
* @param string $method The method to call
* @return string
*/
private function call($method)
{
return sprintf('%s::%s', __CLASS__, $method);
}
}

View File

@@ -7,6 +7,13 @@ use Silex\Application;
class Firewall
{
public function requireSetUp(Application $app)
{
if ( ! \setup::is_installed()) {
return $app->redirect("/setup/");
}
}
public function requireAuthentication(Application $app)
{
if ($app['Core']->isAuthenticated()) {

View File

@@ -281,8 +281,9 @@ class API_OAuth2_Account
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
if ( ! $row)
if ( ! $row) {
throw new Exception_NotFound();
}
return new self($appbox, $row['api_account_id']);
}

View File

@@ -145,6 +145,11 @@ class API_OAuth2_Application
$stmt = $this->appbox->get_connection()->prepare($sql);
$stmt->execute(array(':application_id' => $this->id));
if (0 === $stmt->rowCount()) {
throw new \Exception_NotFound(sprintf('Application with id %d not found', $this->id));
}
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
$this->creator = ! $row['creator'] ? null : User_Adapter::getInstance($row['creator'], $this->appbox);

View File

@@ -0,0 +1,168 @@
{% extends 'account/base.html.twig' %}
{% block content %}
<form name="updatingDemand" id="updatingDemand" action="/account/" method="post">
<table border="0" style="table-layout: fixed; font-size: 11px;" cellspacing=0 width="100%">
<tr>
<td style="width: 180px; text-align: right">&nbsp;</td>
<td width="15px" style="width: 15px">&nbsp;</td>
<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'] %}
<tr>
<td colspan="3" style="text-align: center;"><h3>{{ sbasId | sbas_names }}</h3></td>
</tr>
{% endif %}
{% if baseInsc['CollsRegistered'] is not none %}
{% for base in baseInsc['CollsRegistered']%}
{% for collId, isTrue in base %}
{{ base_id == sbasId |base_from_coll(collId) }}
<tr>
<td colspan="3" style="text-align:center;">
{% trans 'login::register: acces authorise sur la collection ' %}{{ sbasId |sbas_names }}
{% if isTrue | trim != '' %}
<a class="inscriptlink" href="/include/cguUtils.php?action=PRINT&bas={{sbasId}}&col='{{collId}}">{% trans 'login::register::CGU: lire les CGU' %}</a>
{% endif %}
</td>
</tr>
{% endfor %}
{% endfor %}
<tr style="height: 5px;">
<td>
</td>
</tr>
{% endif %}
{% if baseInsc['CollsRefuse'] %}
{% for collId, isTrue in baseInsc['CollsRefuse'] %}
{{ base_id == sbasId |base_from_coll(collId) }}
<tr>
<td colspan="3" style="text-align: center;">
<span style="color: red;">{% trans 'login::register: acces refuse sur la collection ' %}{{ sbasId |sbas_names }}</span>
{% if isTrue | trim != '' %}
<a class="inscriptlink" href="/include/cguUtils.php?action=PRINT&bas={{sbasId}}&col='{{collId}}">{% trans 'login::register::CGU: lire les CGU' %}</a>
{% endif %}
</td>
</tr>
{% endfor %}
<tr style="height: 5px;">
<td>
</td>
</tr>
{% endif %}
{% if baseInsc['CollsWait'] %}
{% for collId, isTrue in baseInsc['CollsWait'] %}
{{ base_id == sbasId |base_from_coll(collId) }}
<tr>
<td colspan="3" style="text-align: center;">
<span style="color: orange;">{% trans 'login::register: en attente d\'acces sur' %} {{ sbasId |sbas_names }}</span>
{% if isTrue | trim != '' %}
<a class="inscriptlink" href="/include/cguUtils.php?action=PRINT&bas={{sbasId}}&col='{{collId}}">{% trans 'login::register::CGU: lire les CGU' %}</a>
{% endif %}
</td>
</tr>
{% endfor %}
<tr style="height: 5px;"><td></td></tr>
{% endif %}
{% if baseInsc['CollsIntime'] %}
{% for collId, isTrue in baseInsc['CollsIntime'] %}
{{ base_id == sbasId |base_from_coll(collId) }}
<tr>
<td colspan="3" style="text-align: center;">
<span>{% trans 'login::register: acces temporaire sur' %} {{ sbasId |sbas_names }}</span>
{% if isTrue |trim != '' %}
<a class="inscriptlink" href="/include/cguUtils.php?action=PRINT&bas={{sbasId}}&col='{{collId}}">{% trans 'login::register::CGU: lire les CGU' %}</a>
{% endif %}
</td>
</tr>
{% endfor %}
<tr style="height: 5px;"><td></td></tr>
{% endif %}
{% if baseInsc['CollsOuttime'] %}
{% for collId, isTrue in baseInsc['CollsOuttime'] %}
{{ base_id == sbasId |base_from_coll(collId) }}
<tr>
<td colspan="3" style="text-align: center;">
<span style="color:red;">{% trans 'login::register: acces temporaire termine sur ' %}{{ sbasId |sbas_names }}</span>
{% if isTrue |trim != '' %}
<a class="inscriptlink" href="/include/cguUtils.php?action=PRINT&bas={{sbasId}}&col='{{collId}}">{% trans 'login::register::CGU: lire les CGU' %}</a>
{% endif %}
</td>
</tr>
{% endfor %}
<tr style="height: 5px;"><td></td></tr>
{% endif %}
{% if baseInsc['CollsNonactif'] %}
{% for collId, isTrue in baseInsc['CollsNonactif'] %}
{{ base_id == (sbasId |base_from_coll(collId)) }}
<tr>
<td colspan="3" style="text-align: center;">
<span style="color:red;">{% trans 'login::register: acces supendu sur' %} {{ sbasId |sbas_names }}</span>
{% if isTrue |trim != '' %}
<a class="inscriptlink" href="/include/cguUtils.php?action=PRINT&bas={{sbasId}}&col='{{collId}}">{% trans 'login::register::CGU: lire les CGU' %}</a>
{% endif %}
</td>
</tr>
{% endfor %}
<tr style="height: 5px;"><td></td></tr>
{% endif %}
{% if (baseInsc['CollsCGU'] or baseInsc['Colls']) and baseInsc['inscript'] %}
{{ noDemand == false }}
{% 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>
</tr>
<tr>
<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'] %}
{{ base_id == sbasId |base_from_coll(collId) }}
<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>
</td>
</tr>
{% endfor %}
{% endif %}
{% if baseInsc['CollsCGU'] %}
{% for collId, collDesc in baseInsc['CollsCGU'] %}
{{ base_id == sbasId |base_from_coll(collId) }}
<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>
</tr>
<tr>
<td colspan="3" style="text-align: center;">
<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></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>
</td>
</tr>
{% endfor %}
{% endif %}
{% endif %}
{% endfor %}
</table>
<input type="submit" class="btn btn-info" value="{% trans 'boutton::valider' %}"/>
</form>
{% endblock %}

View File

@@ -0,0 +1,220 @@
{% extends 'account/base.html.twig' %}
{% block head %}
<script type="text/javascript" src="/login/geonames.js"></script>
<script type="text/javascript">
initialize_geoname_field($('#form_geonameid'));
</script>
{% endblock %}
{% block content %}
<table style="width: 100%">
<tr valign="top">
<td>
{% if notice | trim != '' %}
<div class="notice alert alert-error">{{ notice }}</div>
{% endif %}
<form name="account" id="account" class="form-horizontal" action="/account/" method="post">
<fieldset>
<legend>{% trans 'Informations personnelles' %}</legend>
<div class="control-group">
<div class="controls">
<p><a href="/login/reset-password.php" target="_self">{% trans 'admin::compte-utilisateur changer mon mot de passe' %}</a></p>
</div>
</div>
<div class="control-group">
<label class="form_label control-label" for="form_login">{% trans 'admin::compte-utilisateur identifiant' %}</label>
<div class="controls">
<p>{{ user.get_login() }}</p>
<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>
<div class="controls">
<select>
<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>
<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>
<div class="controls">
<input class="input_element" type="text" name="form_lastname" id="form_lastname" value="{{ user.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>
<div class="controls">
<input class="input_element" type="text" name="form_firstname" id="form_firstname" value="{{ user.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>
<div class="controls">
<p>{{ user.get_email() }} <a href="/login/reset-email.php" target="_self">{% trans 'login:: Changer mon adresse email' %}</a></p>
<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>
<div class="controls">
<input class="input_element" type="text" name="form_address" id="form_address" value="{{ user.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>
<div class="controls">
<input class="input_element" type="text" name="form_zip" id="form_zip" value="{{ user.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>
<div class="controls">
<input class="input_element geoname_field" type="text" name="form_geonameid" id="form_geonameid" geonameid="{{ user.get_geonameid() }}" value="{{ geonames.name_from_id(user.get_geonameid()) }}" />
<p class="form_alert help-block"></p>
</div>
</div>
<div class="control-group">
<label class="form_label control-label"></label>
<div class="controls">
<div id="test_city" style="position: absolute; width: 200px; max-height: 200px; overflow-y: auto; z-index: 99999;"></div>
<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>
<div class="controls">
<input class="input_element" type="text" name="form_function" id="form_function" value="{{ user.get_position() }}" />
<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>
<div class="controls">
<input class="input_element" type="text" name="form_company" id="form_company" value="{{ user.get_company() }}" />
<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>
<div class="controls">
<input class="input_element" type="text" name="form_activity" id="form_activity" value="{{ user.get_job() }}" />
<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>
<div class="controls">
<input class="input_element" type="text" name="form_phone" id="form_phone" value="{{ user.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" type="text" name="form_fax" id="form_fax" value="{{ user.get_fax() }}" />
<p class="form_alert help-block"></p>
</div>
</div>
<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>
<div class="controls">
<label class="checkbox" for="notif_{{ notification['id'] }}">
<input type="checkbox" id="notif_{{ notification['id'] }}" name="notifications[{{ notification['id'] }}]" {% if not user.getPrefs('notification_' ~ notification['id']) == '0' %}checked{% endif %} value="1"/>
{{ notification['description'] }}
</label>
<p class="form_alert help-block"></p>
</div>
</div>
{% endfor %}
{% endfor %}
<legend>{% trans 'FTP' %}</legend>
<div class="control-group">
<label class="form_label control-label" for="form_activeFTP">{% trans 'admin::compte-utilisateur:ftp: Activer le compte FTP' %}</label>
<div class="controls">
<input class="input_element" type="checkbox" name="form_activeFTP" id="form_activeFTP" {% if user.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 user.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" type="text" name="form_addrFTP" id="form_addrFTP" value="{{ user.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>
<div class="controls">
<input class="input_element" type="text" name="form_loginFTP" id="form_loginFTP" value="{{ user.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>
<div class="controls">
<input class="input_element" type="text" name="form_pwdFTP" id="form_pwdFTP" value="{{ user.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>
<div class="controls">
<input class="input_element" type="text" name="form_destFTP" id="form_destFTP" value="{{ user.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>
<div class="controls">
<input class="input_element" type="text" name="form_prefixFTPfolder" id="form_prefixFTPfolder" value="{{ user.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" type="checkbox" name="form_passifFTP" id="form_passifFTP" {% if user.get_ftp_passif() == "1" %}checked{% endif %} />
<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>
<div class="controls">
<input class="input_element" 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>
</fieldset>
</form>
</td>
</tr>
</table>
{% endblock %}

View File

@@ -0,0 +1,107 @@
{% extends 'account/base.html.twig' %}
{% 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 ($this.hasClass("authorize"))
{
var revoke = 0;
var button_class = "revoke";
var old_class ="authorize";
var string = "{% trans 'Revoquer l\'access' %}";
}
var app_id = $this.attr("value");
var opts = {
type:"POST",
url : '/security/application/' + app_id + '/grant/',
dataType: 'json',
data : {
revoke : revoke
},
success : function(data){
if(data.success)
{
div = $this.closest("div");
current.removeClass(old_class).addClass(button_class);
current.attr("value", acc_id);
current.empty().append(string);
}
}
}
$.ajax(opts);
});
});
</script>
{% endblock %}
{% block content %}
<table class='app-placement'>
<tbody>
<tr>
<td style='width:600px;'>
<div id="content-apps">
<h3>{% trans 'Vous avez autorise ces applications a acceder a votre compte' %}</h3>
{% if apps|length > 0 %}
<ul class='app-list'>
{% for app in apps %}
<li id='app_{{app.get_id}}'>
<div>
{% set account = app.get_user_account(user) %}
{% if account.is_revoked() is empty %}
<button type='button' class='revoke app-btn' value='{{app.get_id()}}'>{% trans 'Revoquer l\'access' %}</button>
{% else %}
<button type='button' class='authorize app-btn' value='{{app.get_id()}}'>{% trans 'Authoriser l\'access' %}</button>
{% endif %}
<span class='app-row'>
<a href="{{app.get_website()}}" target="_blank">
<strong>{{app.get_name()}}</strong>
</a>
{% if user is not none %}
{% set user_name = app.get_creator().get_display_name() %}
{% trans %}
par {{user_name}}
{% endtrans %}
{% endif%}
</span>
<span class='app-row'>
<font size="1"><i>{{app.get_created_on()|prettyDate}}</i></font>
</span>
<span class='app-row'>{{app.get_description() }}</span>
</div>
</li>
{%endfor%}
</ul>
{% else %}
<div>
{% trans 'Aucune application n\'a accés à vos données.' %}
</div>
{% endif %}
</div>
</td>
<td style="vertical-align:top;">
<div class="side-section" style="margin:10px;text-align:left;">
<h3>{% trans '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' %}
</p>
</div>
</td>
</tr>
</tbody>
</table>
{% endblock %}

View File

@@ -0,0 +1,44 @@
<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>
{% block head %}{% endblock %}
</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="height: auto;display: block; overflow-y: auto; overflow-x: hidden;">
<ul class='account-menu'>
<li><a href="/account/">{% trans 'Informations' %}</a></li>
<li><a href="/account/access/">{% trans 'Acces' %}</a></li>
<li><a href="/account/security/sessions/">{% trans 'Sessions' %}</a></li>
<li><a href="/account/security/applications/">{% trans 'Applications' %}</a></li>
<li><a href="/developers/applications/">{% trans 'Developpeur' %}</a></li>
</ul>
<div>
{% block content %}{% endblock %}
</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

@@ -0,0 +1,67 @@
{% extends 'account/base.html.twig' %}
{% block content %}
<div>
<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>
{% endblock %}

View File

@@ -0,0 +1,90 @@
{% extends 'account/base.html.twig' %}
{% use "developers/header.html.twig" with header as parent_header %}
{% block head %}
{{ block('parent_header') }}
{% endblock %}
{% block content %}
<h1 style='text-align:left'>{% trans 'Application' %}</h1>
<input type="hidden" value="{{app.get_id}}" name="app_id"/>
<div>
<ul class='app-list'>
<li>
<div>
<span class='app-row'><strong><a class="link" href="/developers/application/{{app.get_id}}/">{{app.get_name}}</a></strong></span>
<span class='app-row'>{{app.get_description }}</span>
</div>
</li>
</ul>
</div>
<h1 style='text-align:left'>{% trans 'settings OAuth' %}</h1>
<p style='text-align:left'>{% trans 'Les parametres oauth de votre application.' %}</p>
<table id="app-oauth-setting">
<tbody>
<tr>
<td>Client ID</td>
<td>{{app.get_client_id}}</td>
</tr>
<tr>
<td>Client Secret</td>
<td>{{app.get_client_secret}}</td>
</tr>
<tr>
<td>{% trans 'URL de callback' %}</td>
{% if app.get_type == constant('API_OAuth2_Application::DESKTOP_TYPE') %}
<td>
<span>{{app.get_redirect_uri}}</span>
</td>
{% else %}
<td class="url_callback"><span class="url_callback_input">{{app.get_redirect_uri}}</span>
<button type="button" class="save_callback" style="display:none;">save</button>
<button type="button" class="modifier_callback" style="display:none;">modifier</button>
</td>
{%endif%}
</tr>
<tr>
<td>Authorize endpoint</td>
<td>{{registry.get('GV_ServerName')}}api/oauthv2/authorize</td>
</tr>
<tr>
<td>Access endpoint</td>
<td>{{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' {{ app.is_password_granted() ? "checked='checked'" : ""}} name="grant" value='{{app.get_id()}}'></td>
</tr>
</tbody>
</table>
<h1 style='text-align:left'>{% trans 'Votre token d\'access' %}</h1>
<p style='text-align:left'> {% trans 'Les paramétres oauth de votre application.' %}</p>
<table id="app-access-token-setting">
<tbody>
<tr>
<td style='width:25%'>
{% trans 'Token' %}
</td>
<td>
<span id="my_access_token">
{% if not token is none %}
{{token|default('')}}
{% else %}
{% trans 'Le token n\'a pas encore ete genere' %}
{% endif %}
</span>
</td>
</tr>
<tr>
<td style='width:25%'></td>
<td><button id="generate_access" type="button" value="{{app.get_id}}">{% trans 'boutton::generer' %}</button></td>
</tr>
</tbody>
</table>
<div style='text-align:left'>
<a class="link" href="/developers/applications/"><button>{% trans 'boutton::retour' %}</button></a>
</div>
{% endblock %}

View File

@@ -0,0 +1,105 @@
{% extends 'account/base.html.twig' %}
{% use "developers/header.html.twig" with header as parent_header %}
{% block head %}
{{ block('parent_header') }}
{% endblock %}
{# form input macro #}
{% macro input(name, value, violations, property, type, size) %}
{% if violations is none %}
<input type="{{ type|default('text') }}" name="{{ name }}" value="{{ value|e }}" size="{{ size|default(20) }}" />
{% 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) }}" />
<div style="color:red" > {{ violation.getInvalidValue }} - {{violation.getMessage}} </div>
{% endif %}
{% endfor %}
{% if hasError == "false" %}
<input type="{{ type|default('text') }}" name="{{ name }}" value="{{ value|e }}" size="{{ size|default(20) }}" />
{% endif %}
{% endif %}
{% endmacro %}
{# form textare macro #}
{% macro textarea(name, value, violations,property, rows, cols) %}
{% if violations is none %}
<textarea name="{{ name }}" rows="{{ rows|default(4)}}" cols="{{cols|default(20)}}" >{{ value|e}}</textarea>
{% else %}
{% set hasError = "false" %}
{% for violation in violations %}
{% if violation.getPropertyPath == property and hasError == "false" %}
{% set hasError = "true" %}
<textarea name="{{ name }}" rows="{{ rows|default(4)}}" cols="{{cols|default(20)}}" >{{ violation.getInvalidValue}}</textarea>
<div style="color:red" > {{violation.getMessage}} </div>
{% endif %}
{% endfor %}
{% if hasError == "false" %}
<textarea name="{{ name }}" rows="{{ rows|default(4)}}" cols="{{cols|default(20)}}" >{{ value|e}}</textarea>
{% endif %}
{% endif %}
{% endmacro %}
{% block content %}
<form id="form_create" action="/developers/application/" method="POST">
{% if form is none %}
{% set name, description, website, callback = '', '', '', ''%}
{% set app_type = 'web'%}
{% else %}
{% set name = form.name %}
{% set description = form.description %}
{% set website = form.website %}
{% set callback = form.callback %}
{% set app_type = form.type %}
{% endif %}
<table id = "app-dev-create">
<tr>
<td><label for="name">{% trans 'Nom' %}</label></td>
<td>{{ _self.input("name", name, violations, 'name') }}</td>
</tr>
<tr>
<td><label for="description">{% trans 'Description' %}</label></td>
<td>{{ _self.textarea("description", description, 'description', violations, 5, 17) }}</td>
</tr>
<tr>
<td><label for="website">{% trans 'Site web' %}</label></td>
<td class="url-td">
<select name="scheme-website">
<option value="http://">http://</option>
<option value="https://">https://</option>
</select>
{{ _self.input("website", website, violations, 'urlwebsite') }}</td>
</tr>
<tr>
<td><label for="type">{% trans 'Type d\'application' %}</label></td>
<td>{% trans 'Application web' %}
<input type="radio" name="type" value="web" {{ app_type == "web" ? "checked='checked'" : "" }}/>
{% trans 'Application desktop' %}
<input type="radio" name="type" value="desktop" {{ app_type == "desktop" ? "checked='checked'" : "" }}/></td>
</tr>
{% if app_type == "web" %}
<tr class="callback" style="height:25px;">
<td><label for="callback">{% trans 'URL de callback' %} <br/></label></td>
<td class="url-td">
<select name="scheme-callback">
<option value="http://">http://</option>
<option value="https://">https://</option>
</select>
{{ _self.input("callback", callback, violations, 'urlcallback') }}</td>
</tr>
{% endif %}
<tr>
<td></td>
<td><button class="app_submit" type="button">{% trans 'boutton::valider' %}</button</td>
</tr>
</table>
</form>
<div style="text-align:left">
<a href="/developers/applications/"><button>{% trans 'boutton::retour' %}</button></a>
<div>
{% endblock %}

View File

@@ -0,0 +1,62 @@
{% extends 'account/base.html.twig' %}
{% use "developers/header.html.twig" with header as parent_header %}
{% block head %}
{{ block('parent_header') }}
{% endblock %}
{% block content %}
<table class='app-placement'>
<tbody>
<tr>
<td style='width:600px;'>
<div id="content-apps">
<h1>Phraseanet Developper Center</h1>
<h3>{% trans 'Mes applications' %}</h3>
{% if apps|length > 0 %}
<ul class='app-list'>
{% for app in apps %}
<li id='app_{{app.get_id()}}'>
<div>
<button class='delete_app' type='button'>{% trans 'button::supprimer'%}</button>
<span class='app-row'>
<strong>
<a class="link" href="/developers/application/{{app.get_id()}}/">
{{app.get_name()}}
</a>
</strong>
</span>
<span class='app-row'>{{app.get_description() }}</span>
<span class='app-row'>{{app.get_website()}}</span>
</div>
</li>
{%endfor%}
</ul>
{% else %}
<div>
{% trans 'Aucune application creee.' %}
</div>
{% endif %}
</div>
</td>
<td style="vertical-align:top;text-align:left;">
<div style="margin:10px;text-align:left;" class="side-section">
<div>
<a href="http://developer.phraseanet.com/" class="no_underline" target="_blank">
<button class="link_button">{% trans 'Demarrer avec l\'API Phraseanet' %}</button>
</a><br/>
{% trans 'Decouvrez la documentation' %}
</div>
<div>
<a class="no_underline" href="/developers/application/new/">
<button class="link_button">{% trans 'Creer une nouvelle applications' %}</button>
</a><br/>
{% trans 'Creez une application pour commencer a utiliser l\'API Phraseanet' %}
</div>
</div>
</td>
</tr>
</tbody>
</table>
{% endblock %}

View File

@@ -0,0 +1,177 @@
{% 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);
});
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 : "/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);
$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 : '/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();
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 : '/developers/application/'+ app_id +'/',
dataType: 'json',
data : {},
success : function(data){
if(data.success)
{
$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>
{% endblock %}

View File

@@ -1,724 +0,0 @@
<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' : "{% trans 'etes vous sur de vouloir supprimer cette application' %}"
,'yes' : "{% trans 'oui' %}"
,'no' : "{% trans 'non' %}"
}
$( "#tab-account-cat").tabs({
ajaxOptions: {
error: function( xhr, status, index, anchor ) {
$( anchor.hash ).html("{% trans '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 = "{% trans 'Authoriser l\'access' %}";
}
if ($(this).hasClass("authorize"))
{
var revoke = 0;
var button_class = "revoke";
var old_class ="authorize";
var string = "{% trans '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; 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 | trim != '' %}
<div class="notice alert alert-error">{{ notice }}</div>
{% endif %}
<form name="account" id="account" class="form-horizontal" action="/account/" method="post">
<fieldset>
<legend>{% trans 'Informations personnelles' %}</legend>
<div class="control-group">
<div class="controls">
<p><a href="/login/reset-password.php" target="_self">{% trans 'admin::compte-utilisateur changer mon mot de passe' %}</a></p>
</div>
</div>
<div class="control-group">
<label class="form_label control-label" for="form_login">{% trans 'admin::compte-utilisateur identifiant' %}</label>
<div class="controls">
<p>{{ user.get_login() }}</p>
<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>
<div class="controls">
<select>
<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>
<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>
<div class="controls">
<input class="input_element" type="text" name="form_lastname" id="form_lastname" value="{{ user.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>
<div class="controls">
<input class="input_element" type="text" name="form_firstname" id="form_firstname" value="{{ user.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>
<div class="controls">
<p>{{ user.get_email() }} <a href="/login/reset-email.php" target="_self">{% trans 'login:: Changer mon adresse email' %}</a></p>
<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>
<div class="controls">
<input class="input_element" type="text" name="form_address" id="form_address" value="{{ user.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>
<div class="controls">
<input class="input_element" type="text" name="form_zip" id="form_zip" value="{{ user.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>
<div class="controls">
<input class="input_element geoname_field" type="text" name="form_geonameid" id="form_geonameid" geonameid="{{ user.get_geonameid() }}" value="{{ geonames.name_from_id(user.get_geonameid()) }}" />
<p class="form_alert help-block"></p>
</div>
</div>
<div class="control-group">
<label class="form_label control-label"></label>
<div class="controls">
<div id="test_city" style="position: absolute; width: 200px; max-height: 200px; overflow-y: auto; z-index: 99999;"></div>
<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>
<div class="controls">
<input class="input_element" type="text" name="form_function" id="form_function" value="{{ user.get_position() }}" />
<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>
<div class="controls">
<input class="input_element" type="text" name="form_company" id="form_company" value="{{ user.get_company() }}" />
<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>
<div class="controls">
<input class="input_element" type="text" name="form_activity" id="form_activity" value="{{ user.get_job() }}" />
<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>
<div class="controls">
<input class="input_element" type="text" name="form_phone" id="form_phone" value="{{ user.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" type="text" name="form_fax" id="form_fax" value="{{ user.get_fax() }}" />
<p class="form_alert help-block"></p>
</div>
</div>
<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>
<div class="controls">
<label class="checkbox" for="notif_{{ notification['id'] }}">
<input type="checkbox" id="notif_{{ notification['id'] }}" name="notifications[{{ notification['id'] }}]" {% if not user.getPrefs('notification_' ~ notification['id']) == '0' %}checked{% endif %} value="1"/>
{{ notification['description'] }}
</label>
<p class="form_alert help-block"></p>
</div>
</div>
{% endfor %}
{% endfor %}
<legend>{% trans 'FTP' %}</legend>
<div class="control-group">
<label class="form_label control-label" for="form_activeFTP">{% trans 'admin::compte-utilisateur:ftp: Activer le compte FTP' %}</label>
<div class="controls">
<input class="input_element" type="checkbox" name="form_activeFTP" id="form_activeFTP" {% if user.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 user.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" type="text" name="form_addrFTP" id="form_addrFTP" value="{{ user.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>
<div class="controls">
<input class="input_element" type="text" name="form_loginFTP" id="form_loginFTP" value="{{ user.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>
<div class="controls">
<input class="input_element" type="text" name="form_pwdFTP" id="form_pwdFTP" value="{{ user.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>
<div class="controls">
<input class="input_element" type="text" name="form_destFTP" id="form_destFTP" value="{{ user.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>
<div class="controls">
<input class="input_element" type="text" name="form_prefixFTPfolder" id="form_prefixFTPfolder" value="{{ user.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" type="checkbox" name="form_passifFTP" id="form_passifFTP" {% if user.get_ftp_passif() == "1" %}checked{% endif %} />
<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>
<div class="controls">
<input class="input_element" 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>
</fieldset>
</form>
</td>
</tr>
</table>
</div>
<!-- END TAB ACCOUNT -->
<!-- START TAB ACCESS -->
<div id="tab-account-access">
<form name="updatingDemand" id="updatingDemand" action="/account/" method="post">
<table border="0" style="table-layout: fixed; font-size: 11px;" cellspacing=0 width="100%">
<tr>
<td style="width: 180px; text-align: right">&nbsp;</td>
<td width="15px" style="width: 15px">&nbsp;</td>
<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'] %}
<tr>
<td colspan="3" style="text-align: center;"><h3>{{ sbasId | sbas_names }}</h3></td>
</tr>
{% endif %}
{% if baseInsc['CollsRegistered'] is not none %}
{% for base in baseInsc['CollsRegistered']%}
{% for collId, isTrue in base %}
{{ base_id == sbasId |base_from_coll(collId) }}
<tr>
<td colspan="3" style="text-align:center;">
{% trans 'login::register: acces authorise sur la collection ' %}{{ sbasId |sbas_names }}
{% if isTrue | trim != '' %}
<a class="inscriptlink" href="/include/cguUtils.php?action=PRINT&bas={{sbasId}}&col='{{collId}}">{% trans 'login::register::CGU: lire les CGU' %}</a>
{% endif %}
</td>
</tr>
{% endfor %}
{% endfor %}
<tr style="height: 5px;">
<td>
</td>
</tr>
{% endif %}
{% if baseInsc['CollsRefuse'] %}
{% for collId, isTrue in baseInsc['CollsRefuse'] %}
{{ base_id == sbasId |base_from_coll(collId) }}
<tr>
<td colspan="3" style="text-align: center;">
<span style="color: red;">{% trans 'login::register: acces refuse sur la collection ' %}{{ sbasId |sbas_names }}</span>
{% if isTrue | trim != '' %}
<a class="inscriptlink" href="/include/cguUtils.php?action=PRINT&bas={{sbasId}}&col='{{collId}}">{% trans 'login::register::CGU: lire les CGU' %}</a>
{% endif %}
</td>
</tr>
{% endfor %}
<tr style="height: 5px;">
<td>
</td>
</tr>
{% endif %}
{% if baseInsc['CollsWait'] %}
{% for collId, isTrue in baseInsc['CollsWait'] %}
{{ base_id == sbasId |base_from_coll(collId) }}
<tr>
<td colspan="3" style="text-align: center;">
<span style="color: orange;">{% trans 'login::register: en attente d\'acces sur' %} {{ sbasId |sbas_names }}</span>
{% if isTrue | trim != '' %}
<a class="inscriptlink" href="/include/cguUtils.php?action=PRINT&bas={{sbasId}}&col='{{collId}}">{% trans 'login::register::CGU: lire les CGU' %}</a>
{% endif %}
</td>
</tr>
{% endfor %}
<tr style="height: 5px;"><td></td></tr>
{% endif %}
{% if baseInsc['CollsIntime'] %}
{% for collId, isTrue in baseInsc['CollsIntime'] %}
{{ base_id == sbasId |base_from_coll(collId) }}
<tr>
<td colspan="3" style="text-align: center;">
<span>{% trans 'login::register: acces temporaire sur' %} {{ sbasId |sbas_names }}</span>
{% if isTrue |trim != '' %}
<a class="inscriptlink" href="/include/cguUtils.php?action=PRINT&bas={{sbasId}}&col='{{collId}}">{% trans 'login::register::CGU: lire les CGU' %}</a>
{% endif %}
</td>
</tr>
{% endfor %}
<tr style="height: 5px;"><td></td></tr>
{% endif %}
{% if baseInsc['CollsOuttime'] %}
{% for collId, isTrue in baseInsc['CollsOuttime'] %}
{{ base_id == sbasId |base_from_coll(collId) }}
<tr>
<td colspan="3" style="text-align: center;">
<span style="color:red;">{% trans 'login::register: acces temporaire termine sur ' %}{{ sbasId |sbas_names }}</span>
{% if isTrue |trim != '' %}
<a class="inscriptlink" href="/include/cguUtils.php?action=PRINT&bas={{sbasId}}&col='{{collId}}">{% trans 'login::register::CGU: lire les CGU' %}</a>
{% endif %}
</td>
</tr>
{% endfor %}
<tr style="height: 5px;"><td></td></tr>
{% endif %}
{% if baseInsc['CollsNonactif'] %}
{% for collId, isTrue in baseInsc['CollsNonactif'] %}
{{ base_id == (sbasId |base_from_coll(collId)) }}
<tr>
<td colspan="3" style="text-align: center;">
<span style="color:red;">{% trans 'login::register: acces supendu sur' %} {{ sbasId |sbas_names }}</span>
{% if isTrue |trim != '' %}
<a class="inscriptlink" href="/include/cguUtils.php?action=PRINT&bas={{sbasId}}&col='{{collId}}">{% trans 'login::register::CGU: lire les CGU' %}</a>
{% endif %}
</td>
</tr>
{% endfor %}
<tr style="height: 5px;"><td></td></tr>
{% endif %}
{% if (baseInsc['CollsCGU'] or baseInsc['Colls']) and baseInsc['inscript'] %}
{{ noDemand == false }}
{% 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>
</tr>
<tr>
<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'] %}
{{ base_id == sbasId |base_from_coll(collId) }}
<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>
</td>
</tr>
{% endfor %}
{% endif %}
{% if baseInsc['CollsCGU'] %}
{% for collId, collDesc in baseInsc['CollsCGU'] %}
{{ base_id == sbasId |base_from_coll(collId) }}
<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>
</tr>
<tr>
<td colspan="3" style="text-align: center;">
<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></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>
</td>
</tr>
{% endfor %}
{% endif %}
{% endif %}
{% endfor %}
</table>
<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

@@ -47,6 +47,8 @@
RewriteRule ^robots.txt$ /index.php [L]
RewriteRule ^feeds/.*$ /index.php [L]
RewriteRule ^account/.*$ /index.php [L]
RewriteRule ^developers/.*$ /index.php [L]
# RewriteRule ^atom\/(cooliris)+\/?([0-9]*)\/?$ /cooliris.php?item_id=$2 [L]

View File

@@ -49,3 +49,9 @@ label {
legend + .control-group {
margin-top: 10px;
}
#id-main .account-menu li {
display: inline-block;
width:130px;
font-size:16px;
}