Merged with 3.5.1

This commit is contained in:
Romain Neutron
2011-12-15 14:22:46 +01:00
30 changed files with 282 additions and 196 deletions

View File

@@ -1,10 +1,33 @@
Phraseanet - Digital Asset Management application Phraseanet 3.5 - Digital Asset Management application
================================================= =================================================
#Installation #Features :
**Nginx** Metadatas Management (include Thesaurus and DublinCore Mapping)
Search Engine (Sphinx Search Integration)
RestFull APIS (See Developer Documentation http://docs.phraseanet.com/Devel)
Bridge to Youtube/Dailymotion/Flickr
#Documentation :
http://docs.phraseanet.com
#Easy Installation
**Fetch Sources**
<pre>
git clone git://github.com/alchemy-fr/Phraseanet.git Phraseanet
cd Phraseanet
./vendors.php
</pre>
**Setup your webserver**
***Nginx***
<pre> <pre>
server { server {
listen 80; listen 80;
@@ -15,58 +38,21 @@ server {
location /web { location /web {
alias /home/grosroro/workspace/Phraseanet-Trunk/datas/web; alias /path/to/Phraseanet/datas/web;
} }
location /download { location /download {
internal; internal;
alias /home/grosroro/workspace/Phraseanet-Trunk/tmp/download; alias /path/to/Phraseanet/tmp/download;
} }
location /lazaret { location /lazaret {
internal; internal;
alias /home/grosroro/workspace/Phraseanet-Trunk/tmp/lazaret; alias /path/to/Phraseanet/tmp/lazaret;
} }
} }
</pre> </pre>
#Pimp my install
**xsendfile** Let's go !
<pre>
location /protected {
internal;
alias /home/grosroro/workspace/Phraseanet-Trunk/datas/noweb/;
}
</pre>
**MP4 pseudo stream**
<pre>
location /mp4_video {
internal;
mp4;
alias /home/grosroro/workspace/Phraseanet-Trunk/datas/noweb/;
}
location /mp4_videos {
secure_download on;
secure_download_secret S3cre3t;
secure_download_path_mode file;
if ($secure_download = "-1") {
return 403;
}
if ($secure_download = "-2") {
return 403;
}
if ($secure_download = "-3") {
return 500;
}
rewrite ^/mp4_videos(.*)/[0-9a-zA-Z]*/[0-9a-zA-Z]*$ /mp4_video$1 last;
}
</pre>
#RESTFULL APIs
See the [online developer reference] [1]
#License #License

2
config/stamp/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*
!.gitignore

2
config/topics/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*
!.gitignore

2
config/wm/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*
!.gitignore

View File

@@ -358,6 +358,16 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa
return $this->publisher; return $this->publisher;
} }
/**
*
* @param User_adapter $user
* @return boolean
*/
public function is_publisher(User_adapter $user)
{
return $user->get_id() === $this->get_publisher()->get_user()->get_id();
}
/** /**
* *
* @return DateTime * @return DateTime

View File

@@ -576,7 +576,7 @@ class Session_Handler
$sql = 'SELECT v.id as validate_id, v.usr_id, v.ssel_id $sql = 'SELECT v.id as validate_id, v.usr_id, v.ssel_id
, s.usr_id as owner, t.value , s.usr_id as owner, t.value
FROM (validate v, ssel s) FROM (validate v, ssel s)
LEFT JOIN tokens t INNER JOIN tokens t
ON (t.datas = s.ssel_id ON (t.datas = s.ssel_id
AND v.usr_id=t.usr_id AND t.type="validate") AND v.usr_id=t.usr_id AND t.type="validate")
WHERE expires_on < :expires_on WHERE expires_on < :expires_on
@@ -594,7 +594,8 @@ class Session_Handler
'ssel_id' => $row['ssel_id'], 'ssel_id' => $row['ssel_id'],
'from' => $row['owner'], 'from' => $row['owner'],
'validate_id' => $row['validate_id'], 'validate_id' => $row['validate_id'],
'url' => $registry->get('GV_ServerName') . 'lightbox/validate/'.$row['ssel_id'].'/?LOG=' . $row['value'] 'url' => $registry->get('GV_ServerName')
. 'lightbox/validate/'.$row['ssel_id'].'/?LOG=' . $row['value']
); );
$events_mngr->trigger('__VALIDATION_REMINDER__', $params); $events_mngr->trigger('__VALIDATION_REMINDER__', $params);

View File

@@ -400,6 +400,13 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
if (!trim($email)) if (!trim($email))
$email = null; $email = null;
$test_user = User_Adapter::get_usr_id_from_email($email);
if($test_user && $test_user != $this->get_id())
{
throw new Exception_InvalidArgument (sprintf(_('A user already exists with email addres %s'), $email));
}
$sql = 'UPDATE usr SET usr_mail = :new_email WHERE usr_id = :usr_id'; $sql = 'UPDATE usr SET usr_mail = :new_email WHERE usr_id = :usr_id';
$stmt = $this->appbox->get_connection()->prepare($sql); $stmt = $this->appbox->get_connection()->prepare($sql);
$stmt->execute(array(':new_email' => $email, ':usr_id' => $this->get_id())); $stmt->execute(array(':new_email' => $email, ':usr_id' => $this->get_id()));
@@ -1231,6 +1238,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
protected function load_preferences() protected function load_preferences()
{ {
if ($this->_prefs) if ($this->_prefs)
return $this; return $this;
$sql = 'SELECT prop, value FROM usr_settings WHERE usr_id= :id'; $sql = 'SELECT prop, value FROM usr_settings WHERE usr_id= :id';
$stmt = $this->appbox->get_connection()->prepare($sql); $stmt = $this->appbox->get_connection()->prepare($sql);
@@ -1556,6 +1564,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
$appbox = appbox::get_instance(); $appbox = appbox::get_instance();
$session = $appbox->get_session(); $session = $appbox->get_session();
if (!$session->is_authenticated()) if (!$session->is_authenticated())
return; return;
$ses_id = $session->get_ses_id(); $ses_id = $session->get_ses_id();
@@ -1831,6 +1840,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
public function get_nonce() public function get_nonce()
{ {
if ($this->nonce) if ($this->nonce)
return $this->nonce; return $this->nonce;
$nonce = false; $nonce = false;
@@ -1848,6 +1858,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
return $this->nonce; return $this->nonce;
} }
public function __sleep() public function __sleep()
{ {
$vars = array(); $vars = array();

View File

@@ -255,8 +255,7 @@ class mail
$mail->ConfirmReadingTo = $reading_confirm_to; $mail->ConfirmReadingTo = $reading_confirm_to;
} }
$mail->MsgHTML(strip_tags($body)); $mail->MsgHTML(strip_tags($body, '<div><br>'));
// $mail->MsgHTML(p4string::cleanTags($body));
foreach ($files as $f) foreach ($files as $f)
{ {

View File

@@ -148,7 +148,7 @@ $app->before(function($request) use ($app)
return; return;
} }
catch (Exception $e) catch (\Exception $e)
{ {
} }

View File

@@ -49,7 +49,7 @@ class module_prod
'sbas_id' => $sbas_id 'sbas_id' => $sbas_id
); );
foreach($user->ACL()->get_granted_base(array(), array($databox->get_sbas_id())) as $coll) foreach ($user->ACL()->get_granted_base(array(), array($databox->get_sbas_id())) as $coll)
{ {
$selected = ($searchSet && $selected = ($searchSet &&
isset($searchSet->bases) && isset($searchSet->bases) &&
@@ -75,12 +75,19 @@ class module_prod
else else
$dates[$id] = array('sbas' => array($sbas_id), 'fieldname' => $name); $dates[$id] = array('sbas' => array($sbas_id), 'fieldname' => $name);
} }
if (isset($fields[$name]))
{
$fields[$name]['sbas'][] = $sbas_id;
}
else else
{ {
if (isset($fields[$name])) $fields[$name] = array(
$fields[$name]['sbas'][] = $sbas_id; 'sbas' => array($sbas_id)
else , 'fieldname' => $name
$fields[$name] = array('sbas' => array($sbas_id), 'fieldname' => $name, 'id' => $id); , 'type' => $meta->get_type()
, 'id' => $id
);
} }
} }

View File

@@ -56,7 +56,7 @@ class random
} }
} }
$sql = 'DELETE FROM tokens WHERE expire_on < :date'; $sql = 'DELETE FROM tokens WHERE expire_on < :date and type="download"';
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
$stmt->execute(array(':date' => $date)); $stmt->execute(array(':date' => $date));
$stmt->closeCursor(); $stmt->closeCursor();
@@ -201,7 +201,9 @@ class random
self::cleanTokens(); self::cleanTokens();
$conn = connection::getPDOConnection(); $conn = connection::getPDOConnection();
$sql = 'SELECT * FROM tokens WHERE value = :token '; $sql = 'SELECT * FROM tokens
WHERE value = :token
AND (expire_on > NOW() OR expire_on IS NULL)';
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
$stmt->execute(array(':token' => $token)); $stmt->execute(array(':token' => $token));
$row = $stmt->fetch(PDO::FETCH_ASSOC); $row = $stmt->fetch(PDO::FETCH_ASSOC);

View File

@@ -56,7 +56,7 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract
/** /**
* *
* @var boolean * @var searchEngine_options
*/ */
protected $options = false; protected $options = false;
@@ -142,6 +142,8 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract
*/ */
public function set_options(searchEngine_options $options) public function set_options(searchEngine_options $options)
{ {
$this->options = $options;
$this->opt_search_type = (int) $options->get_search_type(); $this->opt_search_type = (int) $options->get_search_type();
$this->opt_bases = $options->get_bases(); $this->opt_bases = $options->get_bases();
$this->opt_fields = $options->get_fields(); $this->opt_fields = $options->get_fields();
@@ -394,34 +396,37 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract
$total_time = 0; $total_time = 0;
$sort = '';
if($this->options->get_sortby())
{
switch($this->options->get_sortord())
{
case searchEngine_options::SORT_MODE_ASC:
$sort = '+';
break;
case searchEngine_options::SORT_MODE_DESC:
default:
$sort = '-';
break;
}
$sort .= '0' . $this->options->get_sortby();
}
foreach ($this->queries as $sbas_id => $qry) foreach ($this->queries as $sbas_id => $qry)
{ {
if ($this->opt_search_type == 1) $this->results[$sbas_id] = phrasea_query2(
{ $session->get_ses_id()
$this->results[$sbas_id] = phrasea_query2( , $sbas_id
$session->get_ses_id() , $this->colls[$sbas_id]
, $sbas_id , $this->arrayq[$sbas_id]
, $this->colls[$sbas_id] , $registry->get('GV_sit')
, $this->arrayq[$sbas_id] , (string) $session->get_usr_id()
, $registry->get('GV_sit') , false
, (string) $session->get_usr_id() , $this->opt_search_type == 1 ? PHRASEA_MULTIDOC_REGONLY : PHRASEA_MULTIDOC_DOCONLY
, false , $sort
, PHRASEA_MULTIDOC_REGONLY );
);
}
else
{
$this->results[$sbas_id] = phrasea_query2(
$session->get_ses_id()
, $sbas_id
, $this->colls[$sbas_id]
, $this->arrayq[$sbas_id]
, $registry->get('GV_sit')
, (string) $session->get_usr_id()
, false
, PHRASEA_MULTIDOC_DOCONLY
);
}
$total_time += $this->results[$sbas_id]['time_all']; $total_time += $this->results[$sbas_id]['time_all'];
if ($this->results[$sbas_id]) if ($this->results[$sbas_id])

View File

@@ -436,7 +436,7 @@ class setup
$message = 'Directory MUST be writable'; $message = 'Directory MUST be writable';
break; break;
case 'version': case 'version':
$result = version_compare($value, '1.17.0.2', '>='); $result = version_compare($value, '1.18.0.3', '>=');
if ($result) if ($result)
$message = sprintf ('Phrasea version %s is ok', $value); $message = sprintf ('Phrasea version %s is ok', $value);
else else

View File

@@ -100,11 +100,10 @@ class supertwig
$options = array_merge($default_options, $options); $options = array_merge($default_options, $options);
$extensions = array_merge($default_extensions, $extensions); $extensions = array_merge($default_extensions, $extensions);
$this->init_twig();
try try
{ {
$this->set_options($options); $this->set_options($options);
$this->init_twig();
$this->set_extensions($extensions); $this->set_extensions($extensions);
$this->addFilter(array('round' => 'round')); $this->addFilter(array('round' => 'round'));
} }

0
lib/unitTest/testfiles/cestlafete.jpg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -15,5 +15,5 @@
* @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com * @link www.phraseanet.com
*/ */
define('GV_version', '3.5.0.0RC1'); define('GV_version', '3.6.0.0a1');
define('GV_version_name', 'Archaeopteryx'); define('GV_version_name', 'Brachiosaurus');

View File

@@ -227,55 +227,58 @@
</div> </div>
<div> <div>
<button class="field_adder"> <button class="field_adder">
{% trans 'boutton::ajouter' %} {% trans 'boutton::ajouter' %}
</button> </button>
</div> </div>
<form action="/admin/description.php" method="post" target="_self" id="form_struct"> <form action="/admin/description.php" method="post" target="_self" id="form_struct">
<input name="newfield" id="newfield" type="hidden" /> <input name="newfield" id="newfield" type="hidden" />
<table class="admintable"> <table class="admintable">
<thead> <thead>
<tr> <tr>
<th> <th>
</th> </th>
<th> <th>
{% trans 'Nom' %} {% trans 'Nom' %}
</th> </th>
<th> <th>
{% trans 'Source' %}Source {% trans 'Source' %}Source
</th> </th>
<th> <th>
<span title="{% trans 'DublinCore Element Set' %}">DCES</span> <span title="{% trans 'DublinCore Element Set' %}">DCES</span>
</th> </th>
<th> <th>
{% trans 'Multivalue' %} {% trans 'Multivalue' %}
</th> </th>
<th> <th>
{% trans 'Indexable' %} {% trans 'Indexable' %}
</th> </th>
<th> <th>
{% trans 'Lecture seule' %} {% trans 'Lecture seule' %}
</th> </th>
<th> <th>
{% trans 'Branche Thesaurus' %} {% trans 'Type' %}
</th> </th>
<th> <th>
{% trans 'Affiche dans report' %} {% trans 'Branche Thesaurus' %}
</th> </th>
<th> <th>
Regdate {% trans 'Affiche dans report' %}
</th> </th>
<th> <th>
Regname Regdate
</th> </th>
<th> <th>
Regdesc Regname
</th> </th>
<th> <th>
{% trans 'Afficher en titre' %} Regdesc
</th> </th>
</tr> <th>
</thead> {% trans 'Afficher en titre' %}
<tbody> </th>
</tr>
</thead>
<tbody>
{% for field in fields %} {% for field in fields %}
{% set disabled = '' %} {% set disabled = '' %}
{% if field.is_on_error() %} {% if field.is_on_error() %}
@@ -309,6 +312,14 @@
<img class="alert alertTips alert_not_readonly" src="/skins/icons/alert.png" title="{% trans 'Attention, la source descriptive selectionne n\'est pas en lecture seule, vous devriez decocher cette case' %}" style="display:none;" /> <img class="alert alertTips alert_not_readonly" src="/skins/icons/alert.png" title="{% trans 'Attention, la source descriptive selectionne n\'est pas en lecture seule, vous devriez decocher cette case' %}" style="display:none;" />
<img class="alert alertTips alert_is_readonly" src="/skins/icons/alert.png" title="{% trans 'Attention, la source descriptive selectionne est en lecture seule, vous devriez cocher cette case' %}" style="display:none;" /> <img class="alert alertTips alert_is_readonly" src="/skins/icons/alert.png" title="{% trans 'Attention, la source descriptive selectionne est en lecture seule, vous devriez cocher cette case' %}" style="display:none;" />
</td> </td>
<td>
<select class="metafield_{{field.get_id()}}" {{disabled}} name="type_{{field.get_id()}}">
<option value=""></option>
<option {% if field.get_type() == 'text' %}selected{% endif %} value="text">text</option>
<option {% if field.get_type() == 'number' %}selected{% endif %} value="number">number</option>
<option {% if field.get_type() == 'date' %}selected{% endif %} value="date">date</option>
</select>
</td>
<td> <td>
<input style="width:100px;" class="metafield_{{field.get_id()}}" {{disabled}} name="tbranch_{{field.get_id()}}" type="text" value="{{field.get_tbranch()}}"/> <input style="width:100px;" class="metafield_{{field.get_id()}}" {{disabled}} name="tbranch_{{field.get_id()}}" type="text" value="{{field.get_tbranch()}}"/>
</td> </td>

View File

@@ -15,7 +15,7 @@
{% set display = 'block' %} {% set display = 'block' %}
{% if right[name] != users|length and name != 'access' and right['access'] != users|length %} {% if right[name] != users|length and name != 'access' and right['access'] != users|length and type != 'sbas' %}
{% set display = 'none' %} {% set display = 'none' %}
{% endif %} {% endif %}

View File

@@ -48,7 +48,7 @@
<th>{% trans 'Titre' %}</th> <th>{% trans 'Titre' %}</th>
<th style="width:150px;">{% trans 'Date Creation' %}</th> <th style="width:150px;">{% trans 'Date Creation' %}</th>
<th style="width:220px;">{% trans 'Restriction' %}</th> <th style="width:220px;">{% trans 'Restriction' %}</th>
<th style="width:80px;">{% trans 'Visible sur la homepage' %}</th> <th style="width:80px;">{% trans 'Public' %}</th>
<th style="width:80px;"></th> <th style="width:80px;"></th>
</tr> </tr>
</thead> </thead>
@@ -72,7 +72,7 @@
</td> </td>
<td style="text-align:center;"> <td style="text-align:center;">
{% if feed.is_public() %} {% if feed.is_public() %}
<img src="/skins/icons/ok.png"/> <img src="/skins/icons/ligth-on.png" title="{% trans 'This feed is public' %}"/>
{% endif %} {% endif %}
</td> </td>
<td> <td>

View File

@@ -14,7 +14,7 @@
<div id="mainContainer" class="PNB"> <div id="mainContainer" class="PNB">
{% include 'common/menubar.twig' %} {% include 'common/menubar.twig' %}
<div class="PNB" style="top:30px;overflow-y:auto;overflow-x:auto;"> <div class="PNB" style="top:30px;overflow-y:auto;overflow-x:auto;">
<div class="PNB" id="mainContent" style="min-height:500px;min-width:900px;"> <div class="PNB" id="mainContent" style="min-width:900px;">
{% block content %}{% endblock %} {% block content %}{% endblock %}
</div> </div>
</div> </div>

View File

@@ -55,6 +55,9 @@
{% if feed.is_publisher(user) %} {% if feed.is_publisher(user) %}
<div class="feed {% if loop.index is odd%}odd{% endif %}"> <div class="feed {% if loop.index is odd%}odd{% endif %}">
<span>{{ feed.get_title() }}</span> <span>{{ feed.get_title() }}</span>
{% if feed.is_public() %}
<img src="/skins/icons/ligth-on.png" title="{% trans 'This feed is public' %}"/>
{% endif %}
<input type="hidden" value="{{ feed.get_id() }}"/> <input type="hidden" value="{{ feed.get_id() }}"/>
</div> </div>
{% endif %} {% endif %}

View File

@@ -15,7 +15,7 @@
</h1> </h1>
</td> </td>
<td style="width:60px;text-align:right;"> <td style="width:60px;text-align:right;">
{% if entry.get_feed().is_owner(user) %} {% if entry.get_feed().is_owner(user) or entry.is_publisher(user) %}
<a class="tools options feed_edit" href="/prod/feeds/entry/{{ entry.get_id() }}/edit/"> <a class="tools options feed_edit" href="/prod/feeds/entry/{{ entry.get_id() }}/edit/">
<img src="/skins/icons/file-edit.png" title="{% trans 'boutton::editer' %}"/> <img src="/skins/icons/file-edit.png" title="{% trans 'boutton::editer' %}"/>
</a> </a>
@@ -55,8 +55,8 @@
<div class="contents selectable"> <div class="contents selectable">
{% for item in entry.get_content() %} {% for item in entry.get_content() %}
{% set record = item.get_record() %} {% set record = item.get_record() %}
{% set prefix = 'PUBLI' %} {% set prefix = 'PUBLI_' ~ item.get_id() %}
{{record_format.block(record, user, session, false, null, prefix, entry.get_id(), item.get_id())}} {{record_format.block(record, user, session, false, null, prefix, entry.get_id())}}
{% endfor %} {% endfor %}
</div> </div>
</div> </div>

View File

@@ -372,18 +372,31 @@
<div> <div>
{% if registry.get('GV_sphinx') %} {% if registry.get('GV_sphinx') %}
{% trans 'Trier par ' %} {% trans 'Trier par ' %}
<select name="sort"> <select name="sort">
<option value="relevance">{% trans 'pertinence'%}</option> <option value="relevance">{% trans 'pertinence'%}</option>
<option value="created_on">{% trans 'date dajout'%}</option> <option value="created_on">{% trans 'date dajout'%}</option>
<option value="random">{% trans 'aleatoire'%}</option> <option value="random">{% trans 'aleatoire'%}</option>
</select> </select>
<select name="ord"> <select name="ord">
<option value="desc">{% trans 'descendant'%}</option> <option value="desc">{% trans 'descendant'%}</option>
<option value="asc">{% trans 'ascendant'%}</option> <option value="asc">{% trans 'ascendant'%}</option>
</select> </select>
<input type="checkbox" checked="checked" name="stemme" /> {% trans 'rechercher par stemme' %} <input type="checkbox" checked="checked" name="stemme" /> {% trans 'rechercher par stemme' %}
{% else %} {% else %}
<input type="hidden" name="ord" id="searchOrd" value="PHRASEA_ORDER_DESC" /> {% trans 'Trier par ' %}
<select name="sort">
<option value=""></option>
{% for field_id, field in search_datas['fields'] %}
{% if field['type'] == 'date' %}
<option class="field_switch field_{{field['sbas']|implode(' field_')}}" value="{{field_id}}">{{field['fieldname']}}</option>
{% endif %}
{% endfor %}
</select>
<select name="ord">
<option value="desc">{% trans 'descendant'%}</option>
<option value="asc">{% trans 'ascendant'%}</option>
</select>
<input type="hidden" name="ord" id="searchOrd" value="PHRASEA_ORDER_DESC" />
{% endif %} {% endif %}
<div class="field_filter"> <div class="field_filter">
<div> <div>
@@ -392,7 +405,9 @@
<select size="8" multiple onchange="checkFilters(true);" name="fields[]" style="vertical-align:middle;width:100%;"> <select size="8" multiple onchange="checkFilters(true);" name="fields[]" style="vertical-align:middle;width:100%;">
<option value="phraseanet--all--fields">{% trans 'rechercher dans tous les champs' %}</option> <option value="phraseanet--all--fields">{% trans 'rechercher dans tous les champs' %}</option>
{% for field_id, field in search_datas['fields'] %} {% for field_id, field in search_datas['fields'] %}
<option class="field_switch field_{{field['sbas']|implode(' field_')}}" value="{{field_id}}">{{field['fieldname']}}</option> {% if field['type'] != 'date' %}
<option class="field_switch field_{{field['sbas']|implode(' field_')}}" value="{{field_id}}">{{field['fieldname']}}</option>
{% endif %}
{% endfor %} {% endfor %}
</select> </select>
</div> </div>

View File

@@ -1,4 +1,4 @@
{% macro block(record, user, session, highlight, searchEngine, prefix, entry_id, suffix)%} {% macro block(record, user, session, highlight, searchEngine, prefix, entry_id)%}
{% import 'common/thumbnail.html' as thumbnail %} {% import 'common/thumbnail.html' as thumbnail %}
{% import 'common/doctype_icons.html' as doctype_icons %} {% import 'common/doctype_icons.html' as doctype_icons %}
{% import 'common/drop_down_options.html' as drop_down %} {% import 'common/drop_down_options.html' as drop_down %}
@@ -6,7 +6,7 @@
{% set sbas_id = record.get_base_id|sbasFromBas %} {% set sbas_id = record.get_base_id|sbasFromBas %}
{% if entry_id %} {% if entry_id %}
<div style="width:{{th_size+30}}px;" sbas="{{sbas_id}}" <div style="width:{{th_size+30}}px;" sbas="{{sbas_id}}"
id="{{ prefix|default('IMGT') }}_{{record.get_sbas_id}}_{{record.get_record_id}}_{{ suffix|default('') }}" id="{{ prefix|default('IMGT') }}_{{record.get_sbas_id}}_{{record.get_record_id}}"
class="IMGT diapo grouping type-{{record.get_type}}" class="IMGT diapo grouping type-{{record.get_type}}"
onDblClick="openPreview('FEED',{{record.get_number()}},{{entry_id}});"> onDblClick="openPreview('FEED',{{record.get_number()}},{{entry_id}});">
{% elseif record.is_grouping() %} {% elseif record.is_grouping() %}

2
tmp/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*
!.gitignore

View File

@@ -63,7 +63,6 @@ phrasea::headers();
$code = _('Propositions de modifications des tables') $code = _('Propositions de modifications des tables')
. '<blockquote>' . $code . '</blockquote>'; . '<blockquote>' . $code . '</blockquote>';
?> ?>
<pre> <pre>
<?php echo $code; ?> <?php echo $code; ?>
@@ -87,9 +86,10 @@ phrasea::headers();
{ {
if (!$parm['new_settings'] && $parm['new_dbname'] && $parm['new_data_template']) if (!$parm['new_settings'] && $parm['new_dbname'] && $parm['new_data_template'])
{ {
if (p4string::hasAccent($parm['new_dbname'])) if (p4string::hasAccent($parm['new_dbname']))
$error['new_dbname'] = 'No special chars in dbname'; {
$error[] = _('Database name can not contains special characters');
}
if (count($error) === 0) if (count($error) === 0)
{ {
@@ -99,22 +99,33 @@ phrasea::headers();
$data_template = new system_file($registry->get('GV_RootPath') . 'lib/conf.d/data_templates/' . $parm['new_data_template'] . '.xml'); $data_template = new system_file($registry->get('GV_RootPath') . 'lib/conf.d/data_templates/' . $parm['new_data_template'] . '.xml');
$connbas = new connection_pdo('databox_creation', $hostname, $port, $user, $password, $parm['new_dbname']); $connbas = new connection_pdo('databox_creation', $hostname, $port, $user, $password, $parm['new_dbname']);
$base = databox::create($appbox, $connbas, $data_template, $registry);
$base->registerAdmin($user_obj); try
$createBase = $sbas_id = $base->get_sbas_id(); {
$base = databox::create($appbox, $connbas, $data_template, $registry);
$base->registerAdmin($user_obj);
$createBase = $sbas_id = $base->get_sbas_id();
}
catch (Exception $e)
{
$error[] = $e->getMessage();
}
} }
catch (Exception $e) catch (Exception $e)
{ {
$errors = $e->getMessage(); $error[] = _('Database does not exists or can not be accessed');
} }
} }
} }
elseif ($parm['new_settings'] && $parm['new_hostname'] && $parm['new_port'] && $parm['new_user'] && $parm['new_password'] elseif ($parm['new_settings'] && $parm['new_hostname'] && $parm['new_port']
&& $parm['new_user'] && $parm['new_password']
&& $parm['new_dbname'] && $parm['new_data_template']) && $parm['new_dbname'] && $parm['new_data_template'])
{ {
if (p4string::hasAccent($parm['new_dbname'])) if (p4string::hasAccent($parm['new_dbname']))
$error['new_dbname'] = 'No special chars in dbname'; {
$error[] = _('Database name can not contains special characters');
}
if (count($error) === 0) if (count($error) === 0)
{ {
@@ -129,7 +140,7 @@ phrasea::headers();
} }
catch (Exception $e) catch (Exception $e)
{ {
$errors = $e->getMessage(); $error[] = $e->getMessage();
} }
} }
} }
@@ -140,7 +151,7 @@ phrasea::headers();
{ {
if (p4string::hasAccent($parm['new_dbname'])) if (p4string::hasAccent($parm['new_dbname']))
$error['new_dbname'] = 'No special chars in dbname'; $error[] = _('Database name can not contains special characters');
if (count($error) === 0) if (count($error) === 0)
{ {
@@ -156,7 +167,7 @@ phrasea::headers();
catch (Exception $e) catch (Exception $e)
{ {
$appbox->get_connection()->rollBack(); $appbox->get_connection()->rollBack();
$errors = $e->getMessage(); $error[] = $e->getMessage();
} }
} }
} }
@@ -165,7 +176,7 @@ phrasea::headers();
{ {
if (p4string::hasAccent($parm['new_dbname'])) if (p4string::hasAccent($parm['new_dbname']))
$error['new_dbname'] = 'No special chars in dbname'; $error[] = 'No special chars in dbname';
if (count($error) === 0) if (count($error) === 0)
{ {
@@ -174,13 +185,12 @@ phrasea::headers();
$appbox->get_connection()->beginTransaction(); $appbox->get_connection()->beginTransaction();
$base = databox::mount($appbox, $parm['new_hostname'], $parm['new_port'], $parm['new_user'], $parm['new_password'], $parm['new_dbname'], $registry); $base = databox::mount($appbox, $parm['new_hostname'], $parm['new_port'], $parm['new_user'], $parm['new_password'], $parm['new_dbname'], $registry);
$base->registerAdmin($user_obj); $base->registerAdmin($user_obj);
// $createBase = $sbas_id = $base->get_sbas_id();
$appbox->get_connection()->commit(); $appbox->get_connection()->commit();
} }
catch (Exception $e) catch (Exception $e)
{ {
$appbox->get_connection()->rollBack(); $appbox->get_connection()->rollBack();
$errors = $e->getMessage(); $error[] = $e->getMessage() . '@' . $e->getFile() . $e->getLine();
} }
} }
} }
@@ -227,7 +237,7 @@ if ($createBase || $mountBase)
$user = User_Adapter::getInstance($session->get_usr_id(), $appbox); $user = User_Adapter::getInstance($session->get_usr_id(), $appbox);
$user->ACL()->delete_data_from_cache(); $user->ACL()->delete_data_from_cache();
?> ?>
parent.reloadTree('bases:bases'); parent.reloadTree('bases:bases');
<?php <?php
if ($createBase) if ($createBase)
{ {
@@ -240,9 +250,18 @@ if ($createBase || $mountBase)
phrasea::redirect('/admin/databases.php'); phrasea::redirect('/admin/databases.php');
} }
} }
?> ?>
</script> </script>
<?php
foreach($error as $e)
{
?>
<span style="background-color:red;color:white;padding:3px"><?php echo $e; ?></span>
<?php
}
?>
<div style="position:relative;float:left;width:100%;"> <div style="position:relative;float:left;width:100%;">
<h2>Bases actuelles :</h2> <h2>Bases actuelles :</h2>
<ul> <ul>
@@ -306,20 +325,20 @@ if ($createBase || $mountBase)
</div> </div>
<div id="server_opts" style="display:none;"> <div id="server_opts" style="display:none;">
<div> <div>
<label><?php echo _('phraseanet:: hostname'); ?></label><input name="new_hostname" value="" type="text"/><span class="error"><?php echo isset($error['new_hostname']) ? $error['new_hostname'] : ''; ?></span> <label><?php echo _('phraseanet:: hostname'); ?></label><input name="new_hostname" value="" type="text"/>
</div> </div>
<div> <div>
<label><?php echo _('phraseanet:: port'); ?></label><input name="new_port" value="3306" type="text"/><span class="error"><?php echo isset($error['new_port']) ? $error['new_port'] : ''; ?></span> <label><?php echo _('phraseanet:: port'); ?></label><input name="new_port" value="3306" type="text"/>
</div> </div>
<div> <div>
<label><?php echo _('phraseanet:: user'); ?></label><input name="new_user" value="" type="text"/><span class="error"><?php echo isset($error['new_user']) ? $error['new_user'] : ''; ?></span> <label><?php echo _('phraseanet:: user'); ?></label><input name="new_user" value="" type="text"/>
</div> </div>
<div> <div>
<label><?php echo _('phraseanet:: password'); ?></label><input name="new_password" value="" type="password"/><span class="error"><?php echo isset($error['new_password']) ? $error['new_password'] : ''; ?></span> <label><?php echo _('phraseanet:: password'); ?></label><input name="new_password" value="" type="password"/>
</div> </div>
</div> </div>
<div> <div>
<label><?php echo _('phraseanet:: dbname'); ?></label><input name="new_dbname" value="" type="text"/><span class="error"><?php echo isset($error['new_dbname']) ? $error['new_dbname'] : ''; ?></span> <label><?php echo _('phraseanet:: dbname'); ?></label><input name="new_dbname" value="" type="text"/>
</div> </div>
<div> <div>
<label><?php echo _('phraseanet:: Modele de donnees'); ?></label> <label><?php echo _('phraseanet:: Modele de donnees'); ?></label>
@@ -358,20 +377,20 @@ if ($createBase || $mountBase)
</div> </div>
<div id="servermount_opts" style="display:none;"> <div id="servermount_opts" style="display:none;">
<div> <div>
<label><?php echo _('phraseanet:: hostname'); ?></label><input name="new_hostname" value="" type="text"/><span class="error"><?php echo isset($error['new_hostname']) ? $error['new_hostname'] : ''; ?></span> <label><?php echo _('phraseanet:: hostname'); ?></label><input name="new_hostname" value="" type="text"/>
</div> </div>
<div> <div>
<label><?php echo _('phraseanet:: port'); ?></label><input name="new_port" value="3306" type="text"/><span class="error"><?php echo isset($error['new_port']) ? $error['new_port'] : ''; ?></span> <label><?php echo _('phraseanet:: port'); ?></label><input name="new_port" value="3306" type="text"/>
</div> </div>
<div> <div>
<label><?php echo _('phraseanet:: user'); ?></label><input name="new_user" value="" type="text"/><span class="error"><?php echo isset($error['new_user']) ? $error['new_user'] : ''; ?></span> <label><?php echo _('phraseanet:: user'); ?></label><input name="new_user" value="" type="text"/>
</div> </div>
<div> <div>
<label><?php echo _('phraseanet:: password'); ?></label><input name="new_password" value="" type="password"/><span class="error"><?php echo isset($error['new_password']) ? $error['new_password'] : ''; ?></span> <label><?php echo _('phraseanet:: password'); ?></label><input name="new_password" value="" type="password"/>
</div> </div>
</div> </div>
<div> <div>
<label><?php echo _('phraseanet:: dbname'); ?></label><input name="new_dbname" value="" type="text"/><span class="error"><?php echo isset($error['new_dbname']) ? $error['new_dbname'] : ''; ?></span> <label><?php echo _('phraseanet:: dbname'); ?></label><input name="new_dbname" value="" type="text"/>
</div> </div>
<div> <div>
<input type="hidden" name="mount_base" value="yes"/> <input type="hidden" name="mount_base" value="yes"/>

View File

@@ -21,7 +21,7 @@ $session = $appbox->get_session();
$request = http_request::getInstance(); $request = http_request::getInstance();
$parm = $request->get_parms("srt", "ord", "act", "p0", // base_id $parm = $request->get_parms("srt", "ord", "act", "p0", // base_id
"str" // si act=CHGSTRUCTURE, structure en xml "str" // si act=CHGSTRUCTURE, structure en xml
); );
@@ -61,7 +61,16 @@ if (!empty($_POST))
try try
{ {
$local_parms = $httpRequest->get_parms( $local_parms = $httpRequest->get_parms(
'name_' . $id, 'thumbtitle_' . $id, 'src_' . $id, 'multi_' . $id, 'indexable_' . $id, 'readonly_' . $id, 'tbranch_' . $id, 'report_' . $id, 'dces_' . $id 'name_' . $id
, 'thumbtitle_' . $id
, 'src_' . $id
, 'multi_' . $id
, 'indexable_' . $id
, 'readonly_' . $id
, 'type_' . $id
, 'tbranch_' . $id
, 'report_' . $id
, 'dces_' . $id
); );
$field = databox_field::get_instance($databox, $id); $field = databox_field::get_instance($databox, $id);
@@ -71,6 +80,7 @@ if (!empty($_POST))
$field->set_multi($local_parms['multi_' . $id]); $field->set_multi($local_parms['multi_' . $id]);
$field->set_indexable($local_parms['indexable_' . $id]); $field->set_indexable($local_parms['indexable_' . $id]);
$field->set_readonly($local_parms['readonly_' . $id]); $field->set_readonly($local_parms['readonly_' . $id]);
$field->set_type($local_parms['type_' . $id]);
$field->set_tbranch($local_parms['tbranch_' . $id]); $field->set_tbranch($local_parms['tbranch_' . $id]);
$field->set_report($local_parms['report_' . $id]); $field->set_report($local_parms['report_' . $id]);
@@ -107,7 +117,7 @@ if (!empty($_POST))
$parms = $httpRequest->get_parms('newfield'); $parms = $httpRequest->get_parms('newfield');
if($parms['newfield']) if ($parms['newfield'])
{ {
databox_field::create($databox, $parms['newfield']); databox_field::create($databox, $parms['newfield']);
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB