This commit is contained in:
Nicolas Le Goff
2012-01-19 16:22:06 +01:00
77 changed files with 1436 additions and 1101 deletions

View File

@@ -44,9 +44,9 @@ doctrine_dev:
#Metadata cache : is used to cache entity class metadatas #Metadata cache : is used to cache entity class metadatas
#If No cache is provided all cache are setted to default_cache which is an array cache type #If No cache is provided all cache are setted to default_cache which is an array cache type
cache: cache:
query: array query: array_cache
result: array result: array_cache
metadata: array metadata: array_cache
# Assign a service to log doctrine queries # Assign a service to log doctrine queries
log: query_logger log: query_logger
@@ -59,9 +59,9 @@ doctrine_test:
dbal: test_connexion dbal: test_connexion
orm: orm:
cache: cache:
query: array query: array_cache
result: array result: array_cache
metadata: array metadata: array_cache
log: query_logger log: query_logger
# Doctrine production service options # Doctrine production service options
@@ -72,9 +72,9 @@ doctrine_prod:
dbal: main_connexion dbal: main_connexion
orm: orm:
cache: cache:
query: apc query: apc_cache
result: apc result: apc_cache
metadata: apc metadata: apc_cache
log: query_logger log: query_logger

View File

@@ -122,11 +122,14 @@ return call_user_func(
/* @var $repository \Repositories\BasketElementRepository */ /* @var $repository \Repositories\BasketElementRepository */
if ($repository->findReceivedValidationElementsByRecord($record, $user)->count() > 0) $ValidationByRecord = $repository->findReceivedValidationElementsByRecord($record, $user);
$ReceptionByRecord = $repository->findReceivedElementsByRecord($record, $user);
if ($ValidationByRecord && $ValidationByRecord->count() > 0)
{ {
$watermark = false; $watermark = false;
} }
elseif ($repository->findReceivedElementsByRecord($record, $user)->count() > 0) elseif ($ReceptionByRecord && $ReceptionByRecord->count() > 0)
{ {
$watermark = false; $watermark = false;
} }

View File

@@ -79,7 +79,7 @@ class Story implements ControllerProviderInterface
$metadatas[] = array( $metadatas[] = array(
'meta_struct_id' => $meta->get_id() 'meta_struct_id' => $meta->get_id()
, 'meta_id' => null , 'meta_id' => null
, 'value' => array($value) , 'value' => $value
); );
} }

View File

@@ -102,17 +102,12 @@ class Tooltip implements ControllerProviderInterface
$record = new \record_adapter($sbas_id, $record_id, $number); $record = new \record_adapter($sbas_id, $record_id, $number);
$search_engine = null; $search_engine = null;
$option = new \searchEngine_options();
$options_serial = $app['request']->get('options_serial');
if ($options_serial) if (($search_engine_options = unserialize($app['request']->get('options_serial'))) !== false)
{
if (($search_engine_options = $option->unserialize($app['request']->get('options_serial'))) !== false)
{ {
$search_engine = new \searchEngine_adapter($app['appbox']->get_registry()); $search_engine = new \searchEngine_adapter($app['appbox']->get_registry());
$search_engine->set_options($search_engine_options); $search_engine->set_options($search_engine_options);
} }
}
/* @var $twig \Twig_Environment */ /* @var $twig \Twig_Environment */
$twig = $app['Core']->getTwig(); $twig = $app['Core']->getTwig();

View File

@@ -19,8 +19,6 @@ use Silex\Application;
use Silex\ControllerProviderInterface; use Silex\ControllerProviderInterface;
use Silex\ControllerCollection; use Silex\ControllerCollection;
date_default_timezone_set('Europe/Berlin');
/** /**
* *
* @package * @package
@@ -80,7 +78,7 @@ class Installer implements ControllerProviderInterface
$twig = new \Twig_Environment($loader); $twig = new \Twig_Environment($loader);
$html = $twig->render( $html = $twig->render(
'/setup/index.twig' '/setup/index.html.twig'
, array_merge($constraints_coll, array( , array_merge($constraints_coll, array(
'locale' => Session_Handler::get_locale() 'locale' => Session_Handler::get_locale()
, 'available_locales' => $app['Core']::getAvailableLanguages() , 'available_locales' => $app['Core']::getAvailableLanguages()
@@ -112,7 +110,7 @@ class Installer implements ControllerProviderInterface
} }
$html = $twig->render( $html = $twig->render(
'/setup/step2.twig' '/setup/step2.html.twig'
, array( , array(
'locale' => \Session_Handler::get_locale() 'locale' => \Session_Handler::get_locale()
, 'available_locales' => $app['Core']::getAvailableLanguages() , 'available_locales' => $app['Core']::getAvailableLanguages()
@@ -135,6 +133,9 @@ class Installer implements ControllerProviderInterface
\phrasea::use_i18n(\Session_Handler::get_locale()); \phrasea::use_i18n(\Session_Handler::get_locale());
$request = $app['request']; $request = $app['request'];
$setupRegistry = new \Setup_Registry();
$setupRegistry->set('GV_ServerName', $servername);
$conn = $connbas = null; $conn = $connbas = null;
$hostname = $request->get('ab_hostname'); $hostname = $request->get('ab_hostname');
@@ -147,7 +148,7 @@ class Installer implements ControllerProviderInterface
try try
{ {
$conn = new \connection_pdo('appbox', $hostname, $port, $user_ab, $password, $appbox_name); $conn = new \connection_pdo('appbox', $hostname, $port, $user_ab, $password, $appbox_name, array(), $setupRegistry);
} }
catch (\Exception $e) catch (\Exception $e)
{ {
@@ -158,13 +159,14 @@ class Installer implements ControllerProviderInterface
{ {
if ($databox_name) if ($databox_name)
{ {
$connbas = new \connection_pdo('databox', $hostname, $port, $user_ab, $password, $databox_name); $connbas = new \connection_pdo('databox', $hostname, $port, $user_ab, $password, $databox_name, array(), $setupRegistry);
} }
} }
catch (\Exception $e) catch (\Exception $e)
{ {
return $app->redirect('/setup/installer/step2/?error=' . _('Databox is unreachable')); return $app->redirect('/setup/installer/step2/?error=' . _('Databox is unreachable'));
} }
\setup::rollback($conn, $connbas); \setup::rollback($conn, $connbas);
try try
@@ -208,6 +210,7 @@ class Installer implements ControllerProviderInterface
// Create SchemaTool // Create SchemaTool
$tool = new \Doctrine\ORM\Tools\SchemaTool($em); $tool = new \Doctrine\ORM\Tools\SchemaTool($em);
// Create schema // Create schema
$tool->dropSchema($metadatas);
$tool->createSchema($metadatas); $tool->createSchema($metadatas);
} }
} }

View File

@@ -41,7 +41,7 @@ class Upgrader implements ControllerProviderInterface
$twig = $app['Core']->getTwig(); $twig = $app['Core']->getTwig();
$html = $twig->render( $html = $twig->render(
'/setup/upgrader.twig' '/setup/upgrader.html.twig'
, array( , array(
'locale' => \Session_Handler::get_locale() 'locale' => \Session_Handler::get_locale()
, 'upgrade_status' => $upgrade_status , 'upgrade_status' => $upgrade_status

View File

@@ -178,6 +178,7 @@ class Core extends \Pimple
{ {
ini_set('display_errors', 'on'); ini_set('display_errors', 'on');
error_reporting(E_ALL); error_reporting(E_ALL);
// \Symfony\Component\HttpKernel\Debug\ErrorHandler::register();
} }
else else
{ {

View File

@@ -29,7 +29,7 @@ class Application implements Specification
*/ */
public function getConfigurationFilePath() public function getConfigurationFilePath()
{ {
return __DIR__ . '/../../../../../config'; return realpath(__DIR__ . '/../../../../../config');
} }
/** /**
@@ -97,7 +97,7 @@ class Application implements Specification
*/ */
public function getServiceFile() public function getServiceFile()
{ {
return new \SplFileObject(__DIR__ . '/../../../../../config/services.yml'); return new \SplFileObject(realpath(__DIR__ . '/../../../../../config/services.yml'));
} }
/** /**
@@ -107,7 +107,7 @@ class Application implements Specification
*/ */
public function getConnexionFile() public function getConnexionFile()
{ {
return new \SplFileObject(__DIR__ . '/../../../../../config/connexions.yml'); return new \SplFileObject(realpath(__DIR__ . '/../../../../../config/connexions.yml'));
} }
} }

View File

@@ -234,11 +234,20 @@ class Edit extends RecordHelper
continue; continue;
} }
$values = array();
foreach ($field->get_values() as $value)
{
$values[$value->getId()] = array(
'meta_id' => $value->getId(),
'value' => $value->getValue()
);
}
$_lst[$indice]['fields'][$meta_struct_id] = array( $_lst[$indice]['fields'][$meta_struct_id] = array(
'dirty' => false, 'dirty' => false,
'meta_id' => $field->get_meta_id(), // 'meta_id' => $field->get_meta_id(),
'meta_struct_id' => $meta_struct_id, 'meta_struct_id' => $meta_struct_id,
'value' => $field->get_value() 'values' => $values
); );
} }
@@ -515,16 +524,26 @@ class Edit extends RecordHelper
$record->set_metadatas($rec['metadatas']); $record->set_metadatas($rec['metadatas']);
} }
if ($write_edit_el instanceof \Acmedatabox_field) /**
*todo : this should not work
*/
if ($write_edit_el instanceof \databox_field)
{ {
$fields = $record->get_caption()->get_fields(array($write_edit_el->get_name())); $fields = $record->get_caption()->get_fields(array($write_edit_el->get_name()));
$field = array_pop($fields); $field = array_pop($fields);
$meta_id = null;
if($field && !$field->is_multi())
{
$meta_id = array_pop($field->get_values())->getId();
}
$metas = array( $metas = array(
array( array(
'meta_struct_id' => $write_edit_el->get_id() 'meta_struct_id' => $write_edit_el->get_id()
, 'meta_id' => ($field ? $field->get_meta_id() : null) , 'meta_id' => $meta_id
, 'value' => array($date_obj->format('Y-m-d h:i:s')) , 'value' => $date_obj->format('Y-m-d h:i:s')
) )
); );

View File

@@ -543,7 +543,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
$users = $this->users; $users = $this->users;
$user = \User_adapter::getInstance(array_pop($users), appbox::get_instance()); $user = \User_adapter::getInstance(array_pop($users), \appbox::get_instance());
if ($user->is_template()) if ($user->is_template())
{ {

View File

@@ -39,16 +39,9 @@ class Manage extends \Alchemy\Phrasea\Helper\Helper
*/ */
protected $usr_id; protected $usr_id;
public function __construct(Symfony\Component\HttpFoundation\Request $request) public function export()
{
$this->request = $request;
return $this;
}
public function export(Symfony\Component\HttpFoundation\Request $request)
{ {
$request = $this->request;
$appbox = appbox::get_instance(); $appbox = appbox::get_instance();
$session = $appbox->get_session(); $session = $appbox->get_session();
@@ -84,8 +77,9 @@ class Manage extends \Alchemy\Phrasea\Helper\Helper
return $this->results->get_results(); return $this->results->get_results();
} }
public function search(Symfony\Component\HttpFoundation\Request $request) public function search()
{ {
$request = $this->request;
$appbox = \appbox::get_instance(); $appbox = \appbox::get_instance();
$offset_start = (int) $this->request->get('offset_start'); $offset_start = (int) $this->request->get('offset_start');

View File

@@ -317,7 +317,7 @@ class PDF
$this->pdf->Write(5, $field->get_name() . " : "); $this->pdf->Write(5, $field->get_name() . " : ");
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12); $this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
$this->pdf->Write(5, $field->get_value(true)); $this->pdf->Write(5, $field->get_serialized_values());
$this->pdf->Write(6, "\n"); $this->pdf->Write(6, "\n");
$nf++; $nf++;
@@ -512,7 +512,7 @@ class PDF
$t = str_replace( $t = str_replace(
array("<", ">", "&") array("<", ">", "&")
, array("<", ">", "&") , array("<", ">", "&")
, $field->get_value(true) , $field->get_serialized_values()
); );
$this->pdf->Write(5, $t); $this->pdf->Write(5, $t);

View File

@@ -298,8 +298,7 @@ class ACL implements cache_cacheableInterface
, 'nowatermark', 'order_master' , 'nowatermark', 'order_master'
); );
$bas_to_acces = array(); $bas_to_acces = $masks_to_give = $rights_to_give = array();
$rights_to_give = array();
/** /**
* map masks (and+xor) of template to masks to apply to user on base * map masks (and+xor) of template to masks to apply to user on base
@@ -355,11 +354,22 @@ class ACL implements cache_cacheableInterface
$m[$k] .= $sbmap[$ax][$k]; $m[$k] .= $sbmap[$ax][$k];
} }
} }
$this->set_masks_on_base($base_id, $m['aa'], $m['ao'], $m['xa'], $m['xo']);
$masks_to_give[$base_id] = array(
'aa' => $m['aa']
, 'ao' => $m['ao']
, 'xa' => $m['xa']
, 'xo' => $m['xo']
);
} }
$this->give_access_to_base($bas_to_acces); $this->give_access_to_base($bas_to_acces);
foreach ($masks_to_give as $base_id => $mask)
{
$this->set_masks_on_base($base_id, $mask['aa'], $mask['ao'], $mask['xa'], $mask['xo']);
}
foreach ($rights_to_give as $base_id => $rights) foreach ($rights_to_give as $base_id => $rights)
{ {
$this->update_rights_to_base($base_id, $rights); $this->update_rights_to_base($base_id, $rights);
@@ -629,14 +639,23 @@ class ACL implements cache_cacheableInterface
$this->load_rights_bas(); $this->load_rights_bas();
$ret = array(); $ret = array();
foreach ($this->_rights_bas as $base_id => $datas) foreach($this->appbox->get_databoxes() as $databox)
{ {
$continue = false; if ($sbas_ids && !in_array($databox->get_sbas_id(), $sbas_ids))
if ($sbas_ids && !in_array(phrasea::sbasFromBas($base_id), $sbas_ids))
{ {
continue; continue;
} }
foreach ($databox->get_collections() as $collection)
{
$continue = false;
if(!array_key_exists($collection->get_base_id(), $this->_rights_bas))
continue;
$base_id = $collection->get_base_id();
$datas = $this->_rights_bas[$base_id];
foreach ($rights as $right) foreach ($rights as $right)
{ {
if (!$this->has_right_on_base($base_id, $right)) if (!$this->has_right_on_base($base_id, $right))
@@ -657,6 +676,7 @@ class ACL implements cache_cacheableInterface
} }
} }
}
return $ret; return $ret;
} }

View File

@@ -1080,7 +1080,10 @@ class API_V1_adapter extends API_V1_Abstract
$ret = array(); $ret = array();
foreach ($caption->get_fields() as $field) foreach ($caption->get_fields() as $field)
{ {
$ret[$field->get_meta_id()] = $this->list_record_caption_field($field); foreach($field->get_values as $value)
{
$ret[$value->getId()] = $this->list_record_caption_field($value);
}
} }
return $ret; return $ret;
@@ -1092,17 +1095,17 @@ class API_V1_adapter extends API_V1_Abstract
* @param caption_field $field * @param caption_field $field
* @return array * @return array
*/ */
protected function list_record_caption_field(caption_field $field) protected function list_record_caption_field(caption_Field_Value $value, caption_field $field)
{ {
/** /**
* @todo ajouter une option pour avoir les values serialisées * @todo ajouter une option pour avoir les values serialisées
* dans un cas multi * dans un cas multi
*/ */
return array( return array(
'meta_id' => $field->get_meta_id() 'meta_id' => $value->getId()
, 'meta_structure_id' => $field->get_meta_struct_id() , 'meta_structure_id' => $field->get_meta_struct_id()
, 'name' => $field->get_name() , 'name' => $field->get_name()
, 'value' => $field->get_value() , 'value' => $value->getValue()
); );
} }

View File

@@ -9,8 +9,12 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
$new_include_path = __DIR__ . "/../../../../vendor/" . PATH_SEPARATOR . get_include_path(); $include_path = realpath(__DIR__ . '/../../../../vendor/');
set_include_path($new_include_path); if(strpos(get_include_path(), $include_path) === false)
{
$new_include_path = $include_path . PATH_SEPARATOR . get_include_path();
set_include_path($new_include_path);
}
/** /**
* *

View File

@@ -9,8 +9,13 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
$new_include_path = __DIR__ . "/../../../vendor/" . PATH_SEPARATOR . get_include_path();
set_include_path($new_include_path); $include_path = realpath(__DIR__ . '/../../../vendor/');
if(strpos(get_include_path(), $include_path) === false)
{
$new_include_path = $include_path . PATH_SEPARATOR . get_include_path();
set_include_path($new_include_path);
}
use \Symfony\Component\HttpFoundation\Request; use \Symfony\Component\HttpFoundation\Request;

View File

@@ -9,8 +9,12 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
$new_include_path = __DIR__ . '/../../../vendor/gdata/' . PATH_SEPARATOR . get_include_path(); $include_path = realpath(__DIR__ . '/../../../vendor/gdata/');
set_include_path($new_include_path); if(strpos(get_include_path(), $include_path) === false)
{
$new_include_path = $include_path . PATH_SEPARATOR . get_include_path();
set_include_path($new_include_path);
}
require_once('Zend/Loader.php'); require_once('Zend/Loader.php');
Zend_Loader::loadClass('Zend_Gdata_YouTube'); Zend_Loader::loadClass('Zend_Gdata_YouTube');

View File

@@ -235,7 +235,7 @@ abstract class Feed_XML_Abstract
$title_field = $content->get_record()->get_caption()->get_dc_field(databox_Field_DCESAbstract::Title); $title_field = $content->get_record()->get_caption()->get_dc_field(databox_Field_DCESAbstract::Title);
if ($title_field) if ($title_field)
{ {
$str_title = $title_field->get_value(true, ' '); $str_title = $title_field->get_serialized_values(' ');
$title = $this->addTag($document, $group, 'media:title', $str_title); $title = $this->addTag($document, $group, 'media:title', $str_title);
$title->setAttribute('type', 'plain'); $title->setAttribute('type', 'plain');
} }
@@ -243,7 +243,7 @@ abstract class Feed_XML_Abstract
$desc_field = $content->get_record()->get_caption()->get_dc_field(databox_Field_DCESAbstract::Description); $desc_field = $content->get_record()->get_caption()->get_dc_field(databox_Field_DCESAbstract::Description);
if ($desc_field) if ($desc_field)
{ {
$str_desc = $desc_field->get_value(true, ' '); $str_desc = $desc_field->get_serialized_values(' ');
$desc = $this->addTag($document, $group, 'media:description', $str_desc); $desc = $this->addTag($document, $group, 'media:description', $str_desc);
$desc->setAttribute('type', 'plain'); $desc->setAttribute('type', 'plain');
} }
@@ -251,7 +251,7 @@ abstract class Feed_XML_Abstract
$contrib_field = $content->get_record()->get_caption()->get_dc_field(databox_Field_DCESAbstract::Contributor); $contrib_field = $content->get_record()->get_caption()->get_dc_field(databox_Field_DCESAbstract::Contributor);
if ($contrib_field) if ($contrib_field)
{ {
$str_contrib = $contrib_field->get_value(true, ' '); $str_contrib = $contrib_field->get_serialized_values(' ');
$contrib = $this->addTag($document, $group, 'media:credit', $str_contrib); $contrib = $this->addTag($document, $group, 'media:credit', $str_contrib);
$contrib->setAttribute('role', 'contributor'); $contrib->setAttribute('role', 'contributor');
$contrib->setAttribute('scheme', 'urn:ebu'); $contrib->setAttribute('scheme', 'urn:ebu');
@@ -260,7 +260,7 @@ abstract class Feed_XML_Abstract
$director_field = $content->get_record()->get_caption()->get_dc_field(databox_Field_DCESAbstract::Creator); $director_field = $content->get_record()->get_caption()->get_dc_field(databox_Field_DCESAbstract::Creator);
if ($director_field) if ($director_field)
{ {
$str_director = $director_field->get_value(true, ' '); $str_director = $director_field->get_serialized_values(' ');
$director = $this->addTag($document, $group, 'media:credit', $str_director); $director = $this->addTag($document, $group, 'media:credit', $str_director);
$director->setAttribute('role', 'director'); $director->setAttribute('role', 'director');
$director->setAttribute('scheme', 'urn:ebu'); $director->setAttribute('scheme', 'urn:ebu');
@@ -269,7 +269,7 @@ abstract class Feed_XML_Abstract
$publisher_field = $content->get_record()->get_caption()->get_dc_field(databox_Field_DCESAbstract::Publisher); $publisher_field = $content->get_record()->get_caption()->get_dc_field(databox_Field_DCESAbstract::Publisher);
if ($publisher_field) if ($publisher_field)
{ {
$str_publisher = $publisher_field->get_value(true, ' '); $str_publisher = $publisher_field->get_serialized_values(' ');
$publisher = $this->addTag($document, $group, 'media:credit', $str_publisher); $publisher = $this->addTag($document, $group, 'media:credit', $str_publisher);
$publisher->setAttribute('role', 'publisher'); $publisher->setAttribute('role', 'publisher');
$publisher->setAttribute('scheme', 'urn:ebu'); $publisher->setAttribute('scheme', 'urn:ebu');
@@ -278,14 +278,14 @@ abstract class Feed_XML_Abstract
$rights_field = $content->get_record()->get_caption()->get_dc_field(databox_Field_DCESAbstract::Rights); $rights_field = $content->get_record()->get_caption()->get_dc_field(databox_Field_DCESAbstract::Rights);
if ($rights_field) if ($rights_field)
{ {
$str_rights = $rights_field->get_value(true, ' '); $str_rights = $rights_field->get_serialized_values(' ');
$rights = $this->addTag($document, $group, 'media:copyright', $str_rights); $rights = $this->addTag($document, $group, 'media:copyright', $str_rights);
} }
$keyword_field = $content->get_record()->get_caption()->get_dc_field(databox_Field_DCESAbstract::Subject); $keyword_field = $content->get_record()->get_caption()->get_dc_field(databox_Field_DCESAbstract::Subject);
if ($keyword_field) if ($keyword_field)
{ {
$str_keywords = $keyword_field->get_value(true, ', '); $str_keywords = $keyword_field->get_serialized_values(', ');
$keywords = $this->addTag($document, $group, 'media:keywords', $str_keywords); $keywords = $this->addTag($document, $group, 'media:keywords', $str_keywords);
} }

View File

@@ -381,7 +381,7 @@ class Feed_XML_Cooliris extends Feed_XML_Abstract implements Feed_XML_Interface
$title_field = $content->get_record()->get_caption()->get_dc_field(databox_Field_DCESAbstract::Title); $title_field = $content->get_record()->get_caption()->get_dc_field(databox_Field_DCESAbstract::Title);
if ($title_field) if ($title_field)
{ {
$str_title = $title_field->get_value(true, ' '); $str_title = $title_field->get_serialized_values(' ');
} }
else else
{ {
@@ -394,7 +394,7 @@ class Feed_XML_Cooliris extends Feed_XML_Abstract implements Feed_XML_Interface
$desc_field = $content->get_record()->get_caption()->get_dc_field(databox_Field_DCESAbstract::Description); $desc_field = $content->get_record()->get_caption()->get_dc_field(databox_Field_DCESAbstract::Description);
if ($desc_field) if ($desc_field)
{ {
$str_desc = $desc_field->get_value(true, ' '); $str_desc = $desc_field->get_serialized_values(' ');
} }
else else
{ {

View File

@@ -299,7 +299,7 @@ class appbox extends base
public function forceUpgrade(Setup_Upgrade &$upgrader) public function forceUpgrade(Setup_Upgrade &$upgrader)
{ {
$upgrader->add_steps(7 + count($this->get_databoxes())); $upgrader->add_steps(8 + count($this->get_databoxes()));
$registry = $this->get_registry(); $registry = $this->get_registry();
@@ -313,6 +313,21 @@ class appbox extends base
} }
$upgrader->add_steps_complete(1); $upgrader->add_steps_complete(1);
$upgrader->set_current_message(_('Creating new tables'));
$core = bootstrap::getCore();
$em = $core->getEntityManager();
//create schema
if($em->getConnection()->getDatabasePlatform()->supportsAlterTable())
{
$tool = new \Doctrine\ORM\Tools\SchemaTool($em);
$metas = $em->getMetadataFactory()->getAllMetadata();
$tool->updateSchema($metas, true);
}
$upgrader->add_steps_complete(1);
/** /**
* Step 2 * Step 2
*/ */

View File

@@ -0,0 +1,236 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class caption_Field_Value
{
/**
*
* @var int
*/
protected $id;
/**
*
* @var string
*/
protected $value;
/**
*
* @var databox_field
*/
protected $databox_field;
/**
*
* @var record_adapter
*/
protected $record;
/**
*
* @param databox_field $databox_field
* @param record_adapter $record
* @param type $id
* @return \caption_Field_Value
*/
public function __construct(databox_field $databox_field, record_adapter $record, $id)
{
$this->id = (int) $id;
$this->databox_field = $databox_field;
$this->record = $record;
$connbas = $databox_field->get_databox()->get_connection();
$sql = 'SELECT record_id, value FROM metadatas WHERE id = :id';
$stmt = $connbas->prepare($sql);
$stmt->execute(array(':id' => $id));
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
$this->value = $row ? $row['value'] : null;
return $this;
}
public function getId() {
return $this->id;
}
public function getValue() {
return $this->value;
}
public function getDatabox_field() {
return $this->databox_field;
}
public function getRecord() {
return $this->record;
}
public function delete()
{
$connbas = $this->databox_field->get_connection();
$sql = 'DELETE FROM metadatas WHERE id = :id';
$stmt = $connbas->prepare($sql);
$stmt->execute(array(':id' => $this->id));
$stmt->closeCursor();
$this->delete_data_from_cache();
$sbas_id = $this->record->get_sbas_id();
$this->record->get_caption()->delete_data_from_cache();
try
{
$registry = registry::get_instance();
$sphinx_rt = sphinxrt::get_instance($registry);
$sbas_params = phrasea::sbas_params();
if (isset($sbas_params[$sbas_id]))
{
$params = $sbas_params[$sbas_id];
$sbas_crc = crc32(str_replace(array('.', '%'), '_', sprintf('%s_%s_%s_%s', $params['host'], $params['port'], $params['user'], $params['dbname'])));
$sphinx_rt->delete(array("metadatas" . $sbas_crc, "metadatas" . $sbas_crc . "_stemmed_fr", "metadatas" . $sbas_crc . "_stemmed_en"), "metas_realtime" . $sbas_crc, $this->id);
$sphinx_rt->delete(array("documents" . $sbas_crc, "documents" . $sbas_crc . "_stemmed_fr", "documents" . $sbas_crc . "_stemmed_en"), "docs_realtime" . $sbas_crc, $this->record->get_record_id());
}
}
catch (Exception $e)
{
unset($e);
}
return $this;
}
public function set_value($value)
{
$sbas_id = $this->databox_field->get_databox()->get_sbas_id();
$connbas = $this->databox_field->get_connection();
$params = array(
':meta_id' => $this->id
, ':value' => $value
);
$sql_up = 'UPDATE metadatas SET value = :value WHERE id = :meta_id';
$stmt_up = $connbas->prepare($sql_up);
$stmt_up->execute($params);
$stmt_up->closeCursor();
try
{
$registry = registry::get_instance();
$sphinx_rt = sphinxrt::get_instance($registry);
$sbas_params = phrasea::sbas_params();
if (isset($sbas_params[$sbas_id]))
{
$params = $sbas_params[$sbas_id];
$sbas_crc = crc32(str_replace(array('.', '%'), '_', sprintf('%s_%s_%s_%s', $params['host'], $params['port'], $params['user'], $params['dbname'])));
$sphinx_rt->delete(array("metadatas" . $sbas_crc, "metadatas" . $sbas_crc . "_stemmed_fr", "metadatas" . $sbas_crc . "_stemmed_en"), "", $this->id);
$sphinx_rt->delete(array("documents" . $sbas_crc, "documents" . $sbas_crc . "_stemmed_fr", "documents" . $sbas_crc . "_stemmed_en"), "", $this->record->get_record_id());
}
}
catch (Exception $e)
{
}
$this->update_cache_value($value);
return $this;
}
/**
*
* @param array $value
* @return caption_field
*/
public function update_cache_value($value)
{
// $this->delete_data_from_cache();
$this->record->get_caption()->delete_data_from_cache();
$sbas_id = $this->databox_field->get_databox()->get_sbas_id();
try
{
$registry = registry::get_instance();
$sbas_params = phrasea::sbas_params();
if (isset($sbas_params[$sbas_id]))
{
$params = $sbas_params[$sbas_id];
$sbas_crc = crc32(str_replace(array('.', '%'), '_', sprintf('%s_%s_%s_%s', $params['host'], $params['port'], $params['user'], $params['dbname'])));
$sphinx_rt = sphinxrt::get_instance($registry);
$sphinx_rt->replace_in_metas(
"metas_realtime" . $sbas_crc, $this->id, $this->databox_field->get_id(), $this->record->get_record_id(), $sbas_id, phrasea::collFromBas($this->record->get_base_id()), ($this->record->is_grouping() ? '1' : '0'), $this->record->get_type(), $value, $this->record->get_creation_date()
);
$all_datas = array();
foreach ($this->record->get_caption()->get_fields() as $field)
{
if (!$field->is_indexable())
continue;
$all_datas[] = $field->get_serialized_values();
}
$all_datas = implode(' ', $all_datas);
$sphinx_rt->replace_in_documents(
"docs_realtime" . $sbas_crc, //$this->id,
$this->record->get_record_id(), $all_datas, $sbas_id, phrasea::collFromBas($this->record->get_base_id()), ($this->record->is_grouping() ? '1' : '0'), $this->record->get_type(), $this->record->get_creation_date()
);
}
}
catch (Exception $e)
{
unset($e);
}
return $this;
}
public static function create(databox_field &$databox_field, record_Interface $record, $value)
{
$sbas_id = $databox_field->get_databox()->get_sbas_id();
$connbas = $databox_field->get_connection();
$sql_ins = 'INSERT INTO metadatas (id, record_id, meta_struct_id, value)
VALUES
(null, :record_id, :field, :value)';
$stmt_ins = $connbas->prepare($sql_ins);
$stmt_ins->execute(
array(
':record_id' => $record->get_record_id(),
':field' => $databox_field->get_id(),
':value' => $value
)
);
$stmt_ins->closeCursor();
$meta_id = $connbas->lastInsertId();
$caption_field_value = new self($databox_field, $record, $meta_id);
$caption_field_value->update_cache_value($value);
// $record->get_caption()->delete_data_from_cache();
return $caption_field_value;
}
}

View File

@@ -15,7 +15,7 @@
* @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
*/ */
class caption_field implements cache_cacheableInterface class caption_field //implements cache_cacheableInterface
{ {
/** /**
@@ -28,13 +28,13 @@ class caption_field implements cache_cacheableInterface
* *
* @var string * @var string
*/ */
protected $value; protected $values;
/** // /**
* // *
* @var int // * @var int
*/ // */
protected $id; // protected $id;
/** /**
* *
@@ -49,45 +49,53 @@ class caption_field implements cache_cacheableInterface
* @param int $id * @param int $id
* @return caption_field * @return caption_field
*/ */
public function __construct(databox_field &$databox_field, record_Interface $record, $id) public function __construct(databox_field &$databox_field, record_Interface $record)
{ {
$this->record = $record; $this->record = $record;
$this->id = (int) $id; // $this->id = (int) $id;
$this->databox_field = $databox_field;
$row = false; $this->values = array();
try
{
try
{
$row = $this->get_data_from_cache();
}
catch (Exception $e)
{
$connbas = $databox_field->get_connection(); $connbas = $databox_field->get_connection();
$sql = 'SELECT record_id, value FROM metadatas WHERE id = :id'; $sql = 'SELECT id FROM metadatas
$stmt = $connbas->prepare($sql); WHERE record_id = :record_id
$stmt->execute(array(':id' => $id)); AND meta_struct_id = :meta_struct_id';
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
$this->set_data_to_cache($row);
unset($e);
}
}
catch (Exception $e)
{
unset($e);
}
if (!$row)
throw new Exception('Unknown metadata');
$this->databox_field = $databox_field; $params = array(
$this->value = $row['value']; ':record_id' => $record->get_record_id()
, ':meta_struct_id' => $databox_field->get_id()
);
$stmt = $connbas->prepare($sql);
$stmt->execute($params);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
if (!$databox_field->is_multi() && count($rs) > 1)
{
/**
* TRIGG CORRECTION;
*/
}
foreach ($rs as $row)
{
$this->values[$row['id']] = new caption_Field_Value($databox_field, $record, $row['id']);
}
return $this; return $this;
} }
/**
*
* @return record_adapter
*/
public function get_record()
{
return $this->record;
}
public function is_required() public function is_required()
{ {
return $this->databox_field->is_required(); return $this->databox_field->is_required();
@@ -103,110 +111,110 @@ class caption_field implements cache_cacheableInterface
return $this->databox_field->is_readonly(); return $this->databox_field->is_readonly();
} }
/** // /**
* // *
* @return caption_field // * @return caption_field
*/ // */
public function delete() // public function delete()
// {
// $connbas = $this->databox_field->get_connection();
//
// $sql = 'DELETE FROM metadatas WHERE id = :id';
// $stmt = $connbas->prepare($sql);
// $stmt->execute(array(':id' => $this->id));
// $stmt->closeCursor();
// $this->delete_data_from_cache();
//
// $sbas_id = $this->record->get_sbas_id();
// $this->record->get_caption()->delete_data_from_cache();
//
// try
// {
// $registry = registry::get_instance();
// $sphinx_rt = sphinxrt::get_instance($registry);
//
// $sbas_params = phrasea::sbas_params();
//
// if (isset($sbas_params[$sbas_id]))
// {
// $params = $sbas_params[$sbas_id];
// $sbas_crc = crc32(str_replace(array('.', '%'), '_', sprintf('%s_%s_%s_%s', $params['host'], $params['port'], $params['user'], $params['dbname'])));
// $sphinx_rt->delete(array("metadatas" . $sbas_crc, "metadatas" . $sbas_crc . "_stemmed_fr", "metadatas" . $sbas_crc . "_stemmed_en"), "metas_realtime" . $sbas_crc, $this->id);
// $sphinx_rt->delete(array("documents" . $sbas_crc, "documents" . $sbas_crc . "_stemmed_fr", "documents" . $sbas_crc . "_stemmed_en"), "docs_realtime" . $sbas_crc, $this->record->get_record_id());
// }
// }
// catch (Exception $e)
// {
// unset($e);
// }
//
// return $this;
// }
//
// /**
// * Part of the cache_cacheableInterface
// *
// * @param string $option
// * @return string
// */
// public function get_cache_key($option = null)
// {
// return 'captionfield_' . $this->record->get_serialize_key()
// . $this->id . ($option ? '_' . $option : '');
// }
//
// /**
// * Part of the cache_cacheableInterface
// *
// * @param string $option
// * @return mixed
// */
// public function get_data_from_cache($option = null)
// {
// $databox = databox::get_instance($this->record->get_sbas_id());
//
// return $databox->get_data_from_cache($this->get_cache_key($option));
// }
//
// /**
// * Part of the cache_cacheableInterface
// *
// * @param mixed $value
// * @param string $option
// * @param int $duration
// * @return caption_field
// */
// public function set_data_to_cache($value, $option = null, $duration = 0)
// {
// $databox = databox::get_instance($this->record->get_sbas_id());
// $databox->set_data_to_cache($value, $this->get_cache_key($option), $duration);
//
// return $this;
// }
//
// /**
// * Part of the cache_cacheableInterface
// *
// * @param string $option
// * @return caption_field
// */
// public function delete_data_from_cache($option = null)
// {
// $databox = databox::get_instance($this->record->get_sbas_id());
// $databox->delete_data_from_cache($this->get_cache_key($option));
//
// return $this;
// }
//
// /**
// *
// * @param array $value
// * @param databox_field $databox_field
// * @return string
// */
protected static function serialize_value(Array $values, $separator)
{ {
$connbas = $this->databox_field->get_connection(); if (strlen($separator) > 1)
$sql = 'DELETE FROM metadatas WHERE id = :id';
$stmt = $connbas->prepare($sql);
$stmt->execute(array(':id' => $this->id));
$stmt->closeCursor();
$this->delete_data_from_cache();
$sbas_id = $this->record->get_sbas_id();
$this->record->get_caption()->delete_data_from_cache();
try
{
$registry = registry::get_instance();
$sphinx_rt = sphinxrt::get_instance($registry);
$sbas_params = phrasea::sbas_params();
if (isset($sbas_params[$sbas_id]))
{
$params = $sbas_params[$sbas_id];
$sbas_crc = crc32(str_replace(array('.', '%'), '_', sprintf('%s_%s_%s_%s', $params['host'], $params['port'], $params['user'], $params['dbname'])));
$sphinx_rt->delete(array("metadatas" . $sbas_crc, "metadatas" . $sbas_crc . "_stemmed_fr", "metadatas" . $sbas_crc . "_stemmed_en"), "metas_realtime" . $sbas_crc, $this->id);
$sphinx_rt->delete(array("documents" . $sbas_crc, "documents" . $sbas_crc . "_stemmed_fr", "documents" . $sbas_crc . "_stemmed_en"), "docs_realtime" . $sbas_crc, $this->record->get_record_id());
}
}
catch (Exception $e)
{
unset($e);
}
return $this;
}
/**
* Part of the cache_cacheableInterface
*
* @param string $option
* @return string
*/
public function get_cache_key($option = null)
{
return 'captionfield_' . $this->record->get_serialize_key()
. $this->id . ($option ? '_' . $option : '');
}
/**
* Part of the cache_cacheableInterface
*
* @param string $option
* @return mixed
*/
public function get_data_from_cache($option = null)
{
$databox = databox::get_instance($this->record->get_sbas_id());
return $databox->get_data_from_cache($this->get_cache_key($option));
}
/**
* Part of the cache_cacheableInterface
*
* @param mixed $value
* @param string $option
* @param int $duration
* @return caption_field
*/
public function set_data_to_cache($value, $option = null, $duration = 0)
{
$databox = databox::get_instance($this->record->get_sbas_id());
$databox->set_data_to_cache($value, $this->get_cache_key($option), $duration);
return $this;
}
/**
* Part of the cache_cacheableInterface
*
* @param string $option
* @return caption_field
*/
public function delete_data_from_cache($option = null)
{
$databox = databox::get_instance($this->record->get_sbas_id());
$databox->delete_data_from_cache($this->get_cache_key($option));
return $this;
}
/**
*
* @param array $value
* @param databox_field $databox_field
* @return string
*/
protected static function serialize_value(Array $value, $separator)
{
if(strlen($separator) > 1)
$separator = $separator[0]; $separator = $separator[0];
if (trim($separator) === '') if (trim($separator) === '')
@@ -214,97 +222,104 @@ class caption_field implements cache_cacheableInterface
else else
$separator = ' ' . $separator . ' '; $separator = ' ' . $separator . ' ';
return implode($separator, $value); $array_values = array();
}
/** foreach($values as $value)
*
* @param array $value
* @return caption_field
*/
public function set_value(Array $value)
{ {
$sbas_id = $this->databox_field->get_databox()->get_sbas_id(); $array_values[] = $value->getValue();
$connbas = $this->databox_field->get_connection();
$sql_up = 'UPDATE metadatas SET value = :value WHERE id = :meta_id';
$stmt_up = $connbas->prepare($sql_up);
$stmt_up->execute(array(':meta_id' => $this->get_meta_id(), ':value' => self::serialize_value($value, $this->databox_field->get_separator())));
$stmt_up->closeCursor();
try
{
$registry = registry::get_instance();
$sphinx_rt = sphinxrt::get_instance($registry);
$sbas_params = phrasea::sbas_params();
if (isset($sbas_params[$sbas_id]))
{
$params = $sbas_params[$sbas_id];
$sbas_crc = crc32(str_replace(array('.', '%'), '_', sprintf('%s_%s_%s_%s', $params['host'], $params['port'], $params['user'], $params['dbname'])));
$sphinx_rt->delete(array("metadatas" . $sbas_crc, "metadatas" . $sbas_crc . "_stemmed_fr", "metadatas" . $sbas_crc . "_stemmed_en"), "", $this->get_meta_id());
$sphinx_rt->delete(array("documents" . $sbas_crc, "documents" . $sbas_crc . "_stemmed_fr", "documents" . $sbas_crc . "_stemmed_en"), "", $this->record->get_record_id());
}
}
catch (Exception $e)
{
} }
$this->update_cache_value($value); return implode($separator, $array_values);
return $this;
}
/**
*
* @param array $value
* @return caption_field
*/
public function update_cache_value(Array $value)
{
$this->delete_data_from_cache();
$this->record->get_caption()->delete_data_from_cache();
$sbas_id = $this->databox_field->get_databox()->get_sbas_id();
try
{
$registry = registry::get_instance();
$sbas_params = phrasea::sbas_params();
if (isset($sbas_params[$sbas_id]))
{
$params = $sbas_params[$sbas_id];
$sbas_crc = crc32(str_replace(array('.', '%'), '_', sprintf('%s_%s_%s_%s', $params['host'], $params['port'], $params['user'], $params['dbname'])));
$sphinx_rt = sphinxrt::get_instance($registry);
$sphinx_rt->replace_in_metas(
"metas_realtime" . $sbas_crc, $this->id, $this->databox_field->get_id(), $this->record->get_record_id(), $sbas_id, phrasea::collFromBas($this->record->get_base_id()), ($this->record->is_grouping() ? '1' : '0'), $this->record->get_type(), $value, $this->record->get_creation_date()
);
$all_datas = array();
foreach ($this->record->get_caption()->get_fields() as $field)
{
if (!$field->is_indexable())
continue;
$all_datas[] = $field->get_value(true);
}
$all_datas = implode(' ', $all_datas);
$sphinx_rt->replace_in_documents(
"docs_realtime" . $sbas_crc, //$this->id,
$this->record->get_record_id(), $all_datas, $sbas_id, phrasea::collFromBas($this->record->get_base_id()), ($this->record->is_grouping() ? '1' : '0'), $this->record->get_type(), $this->record->get_creation_date()
);
}
}
catch (Exception $e)
{
unset($e);
}
return $this;
} }
//
// /**
// *
// * @param array $value
// * @return caption_field
// */
// public function set_value(Array $value)
// {
// $sbas_id = $this->databox_field->get_databox()->get_sbas_id();
// $connbas = $this->databox_field->get_connection();
//
// $sql_up = 'UPDATE metadatas SET value = :value WHERE id = :meta_id';
// $stmt_up = $connbas->prepare($sql_up);
// $stmt_up->execute(array(':meta_id' => $this->get_meta_id(), ':value' => self::serialize_value($value, $this->databox_field->get_separator())));
// $stmt_up->closeCursor();
//
// try
// {
// $registry = registry::get_instance();
// $sphinx_rt = sphinxrt::get_instance($registry);
//
// $sbas_params = phrasea::sbas_params();
//
// if (isset($sbas_params[$sbas_id]))
// {
// $params = $sbas_params[$sbas_id];
// $sbas_crc = crc32(str_replace(array('.', '%'), '_', sprintf('%s_%s_%s_%s', $params['host'], $params['port'], $params['user'], $params['dbname'])));
// $sphinx_rt->delete(array("metadatas" . $sbas_crc, "metadatas" . $sbas_crc . "_stemmed_fr", "metadatas" . $sbas_crc . "_stemmed_en"), "", $this->get_meta_id());
// $sphinx_rt->delete(array("documents" . $sbas_crc, "documents" . $sbas_crc . "_stemmed_fr", "documents" . $sbas_crc . "_stemmed_en"), "", $this->record->get_record_id());
// }
// }
// catch (Exception $e)
// {
//
// }
//
// $this->update_cache_value($value);
//
// return $this;
// }
//
// /**
// *
// * @param array $value
// * @return caption_field
// */
// public function update_cache_value(Array $value)
// {
// $this->delete_data_from_cache();
// $this->record->get_caption()->delete_data_from_cache();
// $sbas_id = $this->databox_field->get_databox()->get_sbas_id();
// try
// {
// $registry = registry::get_instance();
//
// $sbas_params = phrasea::sbas_params();
//
// if (isset($sbas_params[$sbas_id]))
// {
// $params = $sbas_params[$sbas_id];
// $sbas_crc = crc32(str_replace(array('.', '%'), '_', sprintf('%s_%s_%s_%s', $params['host'], $params['port'], $params['user'], $params['dbname'])));
//
// $sphinx_rt = sphinxrt::get_instance($registry);
// $sphinx_rt->replace_in_metas(
// "metas_realtime" . $sbas_crc, $this->id, $this->databox_field->get_id(), $this->record->get_record_id(), $sbas_id, phrasea::collFromBas($this->record->get_base_id()), ($this->record->is_grouping() ? '1' : '0'), $this->record->get_type(), $value, $this->record->get_creation_date()
// );
//
// $all_datas = array();
// foreach ($this->record->get_caption()->get_fields() as $field)
// {
// if (!$field->is_indexable())
// continue;
// $all_datas[] = $field->get_value(true);
// }
// $all_datas = implode(' ', $all_datas);
//
// $sphinx_rt->replace_in_documents(
// "docs_realtime" . $sbas_crc, //$this->id,
// $this->record->get_record_id(), $all_datas, $sbas_id, phrasea::collFromBas($this->record->get_base_id()), ($this->record->is_grouping() ? '1' : '0'), $this->record->get_type(), $this->record->get_creation_date()
// );
// }
// }
// catch (Exception $e)
// {
// unset($e);
// }
//
// return $this;
// }
/** /**
* *
@@ -312,62 +327,93 @@ class caption_field implements cache_cacheableInterface
* @param record_Interface $record * @param record_Interface $record
* @param array $value * @param array $value
* @return caption_field * @return caption_field
*/ // */
public static function create(databox_field &$databox_field, record_Interface $record, Array $value) // public static function create(databox_field &$databox_field, record_Interface $record, Array $value)
// {
//
// $sbas_id = $databox_field->get_databox()->get_sbas_id();
// $connbas = $databox_field->get_connection();
// $sql_ins = 'INSERT INTO metadatas (id, record_id, meta_struct_id, value)
// VALUES
// (null, :record_id, :field, :value)';
// $stmt_ins = $connbas->prepare($sql_ins);
// $stmt_ins->execute(
// array(
// ':record_id' => $record->get_record_id(),
// ':field' => $databox_field->get_id(),
// ':value' => self::serialize_value($value, $databox_field->get_separator())
// )
// );
// $stmt_ins->closeCursor();
// $meta_id = $connbas->lastInsertId();
//
// $caption_field = new self($databox_field, $record, $meta_id);
// $caption_field->update_cache_value($value);
//
// $record->get_caption()->delete_data_from_cache();
//
// return $caption_field;
// }
// /**
// *
// * @return string
// */
// public function get_value($as_string = false, $custom_separator = false)
// {
// if ($this->databox_field->is_multi() === true)
// {
// if ($as_string === true && $custom_separator === false)
// {
// return $this->value;
// }
// $separator = $this->databox_field->get_separator();
// $array_values = self::get_multi_values($this->value, $separator);
//
// if ($as_string === true && $custom_separator !== false)
// return self::serialize_value($array_values, $custom_separator);
// else
// return $array_values;
// }
// else
// {
// return $this->value;
// }
// }
public function get_values()
{ {
return $this->values;
$sbas_id = $databox_field->get_databox()->get_sbas_id();
$connbas = $databox_field->get_connection();
$sql_ins = 'INSERT INTO metadatas (id, record_id, meta_struct_id, value)
VALUES
(null, :record_id, :field, :value)';
$stmt_ins = $connbas->prepare($sql_ins);
$stmt_ins->execute(
array(
':record_id' => $record->get_record_id(),
':field' => $databox_field->get_id(),
':value' => self::serialize_value($value, $databox_field->get_separator())
)
);
$stmt_ins->closeCursor();
$meta_id = $connbas->lastInsertId();
$caption_field = new self($databox_field, $record, $meta_id);
$caption_field->update_cache_value($value);
$record->get_caption()->delete_data_from_cache();
return $caption_field;
} }
/** public function get_value($meta_id)
* {
* @return string return $this->values[$meta_id];
*/ }
public function get_value($as_string = false, $custom_separator = false)
public function get_serialized_values($custom_separator = false)
{ {
if ($this->databox_field->is_multi() === true) if ($this->databox_field->is_multi() === true)
{ {
if ($as_string === true && $custom_separator === false) if($custom_separator !== false)
{ $separator = $custom_separator;
return $this->value; else
}
$separator = $this->databox_field->get_separator(); $separator = $this->databox_field->get_separator();
$array_values = self::get_multi_values($this->value, $separator);
if ($as_string === true && $custom_separator !== false) return self::serialize_value($this->values, $separator);
return self::serialize_value($array_values, $custom_separator);
else
return $array_values;
} }
else else
{ {
return $this->value; foreach($this->values as $value)
{
/* @var $value Caption_Field_Value */
return $value->getValue();
} }
} }
return null;
}
/** /**
* *
* @return string * @return string
@@ -395,14 +441,14 @@ class caption_field implements cache_cacheableInterface
return $this->databox_field->is_indexable(); return $this->databox_field->is_indexable();
} }
/** // /**
* // *
* @return int // * @return int
*/ // */
public function get_meta_id() // public function get_meta_id()
{ // {
return $this->id; // return $this->id;
} // }
/** /**
* *
@@ -426,7 +472,7 @@ class caption_field implements cache_cacheableInterface
$sbas_id = $this->databox_field->get_databox()->get_sbas_id(); $sbas_id = $this->databox_field->get_databox()->get_sbas_id();
$value = $this->get_value(true); $value = $this->get_serialized_values();
$databox = databox::get_instance($sbas_id); $databox = databox::get_instance($sbas_id);
$XPATH_thesaurus = $databox->get_xpath_thesaurus(); $XPATH_thesaurus = $databox->get_xpath_thesaurus();

View File

@@ -85,7 +85,7 @@ class caption_record implements caption_interface, cache_cacheableInterface
try try
{ {
$databox_meta_struct = databox_field::get_instance($this->databox, $row['structure_id']); $databox_meta_struct = databox_field::get_instance($this->databox, $row['structure_id']);
$metadata = new caption_field($databox_meta_struct, $this->record, $row['meta_id']); $metadata = new caption_field($databox_meta_struct, $this->record);
$rec_fields[$databox_meta_struct->get_id()] = $metadata; $rec_fields[$databox_meta_struct->get_id()] = $metadata;
$dces_element = $metadata->get_databox_field()->get_dces_element(); $dces_element = $metadata->get_databox_field()->get_dces_element();

View File

@@ -18,6 +18,7 @@
class connection_pdo extends connection_abstract implements connection_interface class connection_pdo extends connection_abstract implements connection_interface
{ {
protected $registry;
/** /**
* *
* @param string $name * @param string $name
@@ -29,8 +30,9 @@ class connection_pdo extends connection_abstract implements connection_interface
* @param array $options * @param array $options
* @return connection_pdo * @return connection_pdo
*/ */
public function __construct($name, $hostname, $port, $user, $passwd, $dbname=false, $options=array()) public function __construct($name, $hostname, $port, $user, $passwd, $dbname=false, $options=array(), registryInterface $registry = null)
{ {
$this->registry = $registry ? $registry : registry::get_instance();
$this->name = $name; $this->name = $name;
if ($dbname) if ($dbname)
$dsn = 'mysql:dbname=' . $dbname . ';host=' . $hostname . ';port=' . $port . ';'; $dsn = 'mysql:dbname=' . $dbname . ';host=' . $hostname . ';port=' . $port . ';';
@@ -63,8 +65,7 @@ class connection_pdo extends connection_abstract implements connection_interface
*/ */
public function prepare($statement, $driver_options = array()) public function prepare($statement, $driver_options = array())
{ {
$registry = registry::get_instance(); if ($this->registry->get('GV_debug'))
if ($registry->get('GV_debug'))
return new connection_pdoStatementDebugger(parent::prepare($statement, $driver_options)); return new connection_pdoStatementDebugger(parent::prepare($statement, $driver_options));
else else

View File

@@ -95,9 +95,17 @@ function deleteRecord($lst, $del_children)
$ret[] = implode('_', array($oneson->get_sbas_id(), $oneson->get_record_id(), $oneson->get_base_id())); $ret[] = implode('_', array($oneson->get_sbas_id(), $oneson->get_record_id(), $oneson->get_base_id()));
} }
} }
$ret[] = implode('_', $rid);
$basket_elements = $BE_repository->findElementsByRecord($record);
foreach($basket_elements as $basket_element)
{
$em->remove($basket_element);
}
$record->delete(); $record->delete();
unset($record); unset($record);
$ret[] = implode('_', $rid);
} }
} }
catch (Exception $e) catch (Exception $e)
@@ -106,12 +114,6 @@ function deleteRecord($lst, $del_children)
} }
} }
$basket_elements = $BE_repository->findElementsByRecord($record);
foreach($basket_elements as $basket_element)
{
$em->remove($basket_element);
}
$em->flush(); $em->flush();
return p4string::jsonencode($ret); return p4string::jsonencode($ret);

View File

@@ -39,7 +39,7 @@ class random
$registry = registry::get_instance(); $registry = registry::get_instance();
$sql = 'SELECT * FROM tokens WHERE expire_on < :date $sql = 'SELECT * FROM tokens WHERE expire_on < :date
AND datas IS NOT NULL AND type="download"'; AND datas IS NOT NULL AND (type="download" OR type="email")';
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
$stmt->execute(array(':date' => $date)); $stmt->execute(array(':date' => $date));
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
@@ -49,6 +49,7 @@ class random
switch ($row['type']) switch ($row['type'])
{ {
case 'download': case 'download':
case 'email':
$file = $registry->get('GV_RootPath') . 'tmp/download/' . $row['value'] . '.zip'; $file = $registry->get('GV_RootPath') . 'tmp/download/' . $row['value'] . '.zip';
if (is_file($file)) if (is_file($file))
unlink($file); unlink($file);
@@ -56,7 +57,7 @@ class random
} }
} }
$sql = 'DELETE FROM tokens WHERE expire_on < :date and type="download"'; $sql = 'DELETE FROM tokens WHERE expire_on < :date and (type="download" OR type="email")';
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
$stmt->execute(array(':date' => $date)); $stmt->execute(array(':date' => $date));
$stmt->closeCursor(); $stmt->closeCursor();

View File

@@ -140,7 +140,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface
const CACHE_GROUPING = 'grouping'; const CACHE_GROUPING = 'grouping';
const CACHE_STATUS = 'status'; const CACHE_STATUS = 'status';
protected static $_regfields; protected static $_regfields;
/** /**
@@ -784,16 +783,17 @@ class record_adapter implements record_Interface, cache_cacheableInterface
foreach ($caption->get_fields() as $field) foreach ($caption->get_fields() as $field)
{ {
if ($field->is_multi()) $values = $field->get_values();
$values = $field->get_value(); // if ($field->is_multi())
else // $values = $field->get_value();
$values = array($field->get_value()); // else
// $values = array($field->get_value());
foreach ($values as $value) foreach ($values as $value)
{ {
$elem = $dom_doc->createElement($field->get_name()); $elem = $dom_doc->createElement($field->get_name());
$elem->appendChild($dom_doc->createTextNode($value)); $elem->appendChild($dom_doc->createTextNode($value->getValue()));
$elem->setAttribute('meta_id', $field->get_meta_id()); $elem->setAttribute('meta_id', $value->getId());
$elem->setAttribute('meta_struct_id', $field->get_meta_struct_id()); $elem->setAttribute('meta_struct_id', $field->get_meta_struct_id());
$description->appendChild($elem); $description->appendChild($elem);
} }
@@ -836,14 +836,27 @@ class record_adapter implements record_Interface, cache_cacheableInterface
continue; continue;
} }
/* @var $field caption_field */
/**
* Replacing original name in multi values is non sense
*/
if (!$field->is_multi())
{
continue;
}
else
{
$value = array_pop($field->get_values());
$this->set_metadatas( $this->set_metadatas(
array( array(
'meta_struct_id' => $field->get_meta_struct_id() 'meta_struct_id' => $field->get_meta_struct_id()
, 'meta_id' => get_meta_id , 'meta_id' => $value->getId()
, 'value' => array($original_name) , 'value' => $original_name
) )
); );
} }
}
$sql = 'UPDATE record $sql = 'UPDATE record
SET originalname = :originalname WHERE record_id = :record_id'; SET originalname = :originalname WHERE record_id = :record_id';
@@ -955,9 +968,12 @@ class record_adapter implements record_Interface, cache_cacheableInterface
foreach ($desc->get_fields() as $caption_field) foreach ($desc->get_fields() as $caption_field)
{ {
/* @var $caption_field caption_field */
$meta_struct_id = $caption_field->get_meta_struct_id(); $meta_struct_id = $caption_field->get_meta_struct_id();
if (array_key_exists($meta_struct_id, $array)) if (array_key_exists($meta_struct_id, $array))
$fields[$array[$meta_struct_id]] = $caption_field->get_value(); {
$fields[$array[$meta_struct_id]] = $caption_field->get_serialized_values();
}
} }
return $fields; return $fields;
@@ -1251,29 +1267,32 @@ class record_adapter implements record_Interface, cache_cacheableInterface
} }
} }
if (!is_array($params['value'])) if (!is_scalar($params['value']))
throw new Exception(); throw new Exception('Metadata value should be scalar');
$databox_field = databox_field::get_instance($databox, $params['meta_struct_id']); $databox_field = databox_field::get_instance($databox, $params['meta_struct_id']);
$caption_field = new caption_field($databox_field, $this);
if (trim($params['meta_id']) !== '') if (trim($params['meta_id']) !== '')
{ {
$tmp_val = trim(implode('', $params['value'])); $tmp_val = trim($params['value']);
$caption_field = new caption_field($databox_field, $this, $params['meta_id']);
$caption_field_value = $caption_field->get_value($params['meta_id']);
if ($tmp_val === '') if ($tmp_val === '')
{ {
$caption_field->delete(); $caption_field_value->delete();
unset($caption_field); unset($caption_field_value);
} }
else else
{ {
$caption_field->set_value($params['value']); $caption_field_value->set_value($params['value']);
} }
} }
else else
{ {
$caption_field = caption_field::create($databox_field, $this, $params['value']); $caption_field_value = caption_Field_Value::create($databox_field, $this, $params['value']);
} }
$this->caption_record = null; $this->caption_record = null;

View File

@@ -1135,10 +1135,10 @@ class system_file extends SplFileObject
foreach ($tmpval as $val) foreach ($tmpval as $val)
{ {
$ret[$meta->get_id()] = array( $ret[] = array(
'meta_struct_id' => $meta->get_id(), 'meta_struct_id' => $meta->get_id(),
'meta_id' => null, 'meta_id' => null,
'value' => array($val) 'value' => $val
); );
} }
} }
@@ -1211,16 +1211,19 @@ class system_file extends SplFileObject
$fv = array($fv); $fv = array($fv);
} }
if (isset($metadatas[$meta->get_id()]) && $meta->is_multi() === true) // if (isset($metadatas[$meta->get_id()]) && $meta->is_multi() === true)
{ // {
$fv = array_unique(array_merge($metadatas[$meta->get_id()], $fv)); // $fv = array_unique(array_merge($metadatas[$meta->get_id()], $fv));
} // }
$metadatas[$meta->get_id()] = array( foreach($fv as $value)
{
$metadatas[] = array(
'meta_struct_id' => $meta->get_id(), 'meta_struct_id' => $meta->get_id(),
'meta_id' => null, 'meta_id' => null,
'value' => $fv 'value' => $value
); );
}
unset($meta); unset($meta);
} }

View File

@@ -5335,8 +5335,8 @@
</fields> </fields>
</index> </index>
<index> <index>
<name>unique</name> <name>index_meta</name>
<type>UNIQUE</type> <type>INDEX</type>
<fields> <fields>
<field>record_id</field> <field>record_id</field>
<field>meta_struct_id</field> <field>meta_struct_id</field>

View File

@@ -609,16 +609,19 @@ class ApiJsonApplication extends PhraseanetWebTestCaseAbstract
*/ */
foreach ($caption->get_fields() as $field) foreach ($caption->get_fields() as $field)
{ {
$old_datas[$field->get_meta_id()] = $field->get_value(); foreach($field->get_values() as $value)
{
$old_datas[$value->getId()] = $value->getValue();
if ($field->is_readonly() === false && $field->is_multi() === false) if ($field->is_readonly() === false && $field->is_multi() === false)
{ {
$toupdate[$field->get_meta_id()] = array( $toupdate[$value->getId()] = array(
'meta_struct_id' => $field->get_meta_struct_id(), 'meta_struct_id' => $field->get_meta_struct_id(),
'meta_id' => $field->get_meta_id(), 'meta_id' => $value->getId(),
'value' => array($field->get_value() . ' test') 'value' => array($value->getValue() . ' test')
); );
} }
} }
}
$this->evaluateMethodNotAllowedRoute($route, array('GET', 'PUT', 'DELETE')); $this->evaluateMethodNotAllowedRoute($route, array('GET', 'PUT', 'DELETE'));
$crawler = $this->client->request('POST', $route, array('metadatas' => $toupdate)); $crawler = $this->client->request('POST', $route, array('metadatas' => $toupdate));
@@ -634,11 +637,13 @@ class ApiJsonApplication extends PhraseanetWebTestCaseAbstract
foreach ($caption->get_fields() as $field) foreach ($caption->get_fields() as $field)
{ {
foreach($field->get_values() as $value)
{
if ($field->is_readonly() === false && $field->is_multi() === false) if ($field->is_readonly() === false && $field->is_multi() === false)
{ {
$saved_value = $toupdate[$field->get_meta_id()]['value'][0]; $saved_value = $toupdate[$value->getId()]['value'][0];
$this->assertEquals($field->get_value(), $saved_value); $this->assertEquals($value->getValue(), $saved_value);
}
} }
} }
$this->evaluateRecordsMetadataResponse($content); $this->evaluateRecordsMetadataResponse($content);

View File

@@ -616,16 +616,19 @@ class ApiYamlApplication extends PhraseanetWebTestCaseAbstract
*/ */
foreach ($caption->get_fields() as $field) foreach ($caption->get_fields() as $field)
{ {
$old_datas[$field->get_meta_id()] = $field->get_value(); foreach($field->get_values() as $value)
{
$old_datas[$value->getId()] = $value->getValue();
if ($field->is_readonly() === false && $field->is_multi() === false) if ($field->is_readonly() === false && $field->is_multi() === false)
{ {
$toupdate[$field->get_meta_id()] = array( $toupdate[$value->getId()] = array(
'meta_struct_id' => $field->get_meta_struct_id(), 'meta_struct_id' => $field->get_meta_struct_id(),
'meta_id' => $field->get_meta_id(), 'meta_id' => $value->getId(),
'value' => array($field->get_value() . ' test') 'value' => array($value->getValue() . ' test')
); );
} }
} }
}
$this->evaluateMethodNotAllowedRoute($route, array('GET', 'PUT', 'DELETE')); $this->evaluateMethodNotAllowedRoute($route, array('GET', 'PUT', 'DELETE'));
$crawler = $this->client->request('POST', $route, array('metadatas' => $toupdate), array(), array("HTTP_ACCEPT" => "application/yaml")); $crawler = $this->client->request('POST', $route, array('metadatas' => $toupdate), array(), array("HTTP_ACCEPT" => "application/yaml"));
@@ -641,11 +644,13 @@ class ApiYamlApplication extends PhraseanetWebTestCaseAbstract
foreach ($caption->get_fields() as $field) foreach ($caption->get_fields() as $field)
{ {
foreach($field->get_values() as $value)
{
if ($field->is_readonly() === false && $field->is_multi() === false) if ($field->is_readonly() === false && $field->is_multi() === false)
{ {
$saved_value = $toupdate[$field->get_meta_id()]['value'][0]; $saved_value = $toupdate[$value->getId()]['value'][0];
$this->assertEquals($field->get_value(), $saved_value); $this->assertEquals($value->getValue(), $saved_value);
}
} }
} }
$this->evaluateRecordsMetadataResponse($content); $this->evaluateRecordsMetadataResponse($content);

View File

@@ -32,6 +32,7 @@ class ApplicationLightboxTest extends PhraseanetWebTestCaseAuthenticatedAbstract
public function tearDown() public function tearDown()
{ {
if($this->feed instanceof Feed_Adapter)
$this->feed->delete(); $this->feed->delete();
parent::tearDown(); parent::tearDown();
} }

View File

@@ -58,11 +58,6 @@ class oauthv2_application_test extends \PhraseanetWebTestCaseAuthenticatedAbstra
self::deleteInsertedRow(appbox::get_instance(), self::$appli); self::deleteInsertedRow(appbox::get_instance(), self::$appli);
} }
public function tearDown()
{
parent::tearDown();
}
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();

View File

@@ -24,11 +24,6 @@ class ApplicationRootTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$this->client = $this->createClient(); $this->client = $this->createClient();
} }
public function tearDown()
{
parent::tearDown();
}
public function testRouteSlash() public function testRouteSlash()
{ {
$this->markTestIncomplete( $this->markTestIncomplete(

View File

@@ -24,11 +24,6 @@ class ApplicationSetupTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$this->client = $this->createClient(); $this->client = $this->createClient();
} }
public function tearDown()
{
parent::tearDown();
}
public function testRouteSlash() public function testRouteSlash()
{ {
$this->markTestIncomplete( $this->markTestIncomplete(

View File

@@ -38,11 +38,6 @@ class ControllerFieldsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->client = $this->createClient(); $this->client = $this->createClient();
} }
public function tearDown()
{
parent::tearDown();
}
/** /**
* Default route test * Default route test
*/ */

View File

@@ -28,11 +28,6 @@ class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthentica
$this->client = $this->createClient(); $this->client = $this->createClient();
} }
public function tearDown()
{
parent::tearDown();
}
public function createApplication() public function createApplication()
{ {
return require __DIR__ . '/../../../../../Alchemy/Phrasea/Application/Admin.php'; return require __DIR__ . '/../../../../../Alchemy/Phrasea/Application/Admin.php';

View File

@@ -39,11 +39,6 @@ class ControllerSubdefsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->client = $this->createClient(); $this->client = $this->createClient();
} }
public function tearDown()
{
parent::tearDown();
}
/** /**
* Default route test * Default route test
*/ */

View File

@@ -38,11 +38,6 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->client = $this->createClient(); $this->client = $this->createClient();
} }
public function tearDown()
{
parent::tearDown();
}
/** /**
* Default route test * Default route test
*/ */

View File

@@ -50,6 +50,7 @@ class BridgeApplication extends PhraseanetWebTestCaseAuthenticatedAbstract
public function tearDown() public function tearDown()
{ {
parent::tearDown(); parent::tearDown();
if(self::$api instanceof Bridge_Api)
self::$api->delete(); self::$api->delete();
if (self::$account instanceof Bridge_Account) if (self::$account instanceof Bridge_Account)
self::$account->delete(); self::$account->delete();

View File

@@ -41,11 +41,6 @@ class ControllerEditTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->client = $this->createClient(); $this->client = $this->createClient();
} }
public function tearDown()
{
parent::tearDown();
}
/** /**
* Default route test * Default route test
*/ */

View File

@@ -84,8 +84,9 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
public function tearDown() public function tearDown()
{ {
parent::tearDown(); if($this->feed instanceof Feed_Adapter)
$this->feed->delete(); $this->feed->delete();
parent::tearDown();
} }
public function createApplication() public function createApplication()

View File

@@ -39,11 +39,6 @@ class ControllerMoveCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAb
$this->client = $this->createClient(); $this->client = $this->createClient();
} }
public function tearDown()
{
parent::tearDown();
}
/** /**
* Default route test * Default route test
*/ */

View File

@@ -39,11 +39,6 @@ class ControllerPrinterTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->client = $this->createClient(); $this->client = $this->createClient();
} }
public function tearDown()
{
parent::tearDown();
}
/** /**
* Default route test * Default route test
*/ */

View File

@@ -39,11 +39,6 @@ class ControllerPushTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->client = $this->createClient(); $this->client = $this->createClient();
} }
public function tearDown()
{
parent::tearDown();
}
/** /**
* Default route test * Default route test
*/ */

View File

@@ -38,11 +38,6 @@ class ControllerRootTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->client = $this->createClient(); $this->client = $this->createClient();
} }
public function tearDown()
{
parent::tearDown();
}
/** /**
* Default route test * Default route test
*/ */

View File

@@ -40,8 +40,11 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
public function tearDown() public function tearDown()
{ {
if(self::$publisher instanceof Feed_Publisher_Adapter)
self::$publisher->delete(); self::$publisher->delete();
if(self::$entry instanceof Feed_Entry_Adapter)
self::$entry->delete(); self::$entry->delete();
if(self::$feed instanceof Feed_Adapter)
self::$feed->delete(); self::$feed->delete();
parent::tearDown(); parent::tearDown();
} }
@@ -473,7 +476,7 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
{ {
if ($p4field = $entry_item->get_record()->get_caption()->get_dc_field($field["dc_field"])) if ($p4field = $entry_item->get_record()->get_caption()->get_dc_field($field["dc_field"]))
{ {
$this->assertEquals($p4field->get_value(true, $field["separator"]), $node->nodeValue $this->assertEquals($p4field->get_serialized_values($field["separator"]), $node->nodeValue
, sprintf('Asserting good value for DC %s', $field["dc_field"])); , sprintf('Asserting good value for DC %s', $field["dc_field"]));
if (sizeof($field["media_field"]["attributes"]) > 0) if (sizeof($field["media_field"]["attributes"]) > 0)
{ {

View File

@@ -38,11 +38,6 @@ class ControllerInstallerTest extends \PhraseanetWebTestCaseAbstract
$this->client = $this->createClient(); $this->client = $this->createClient();
} }
public function tearDown()
{
parent::tearDown();
}
/** /**
* Default route test * Default route test
*/ */

View File

@@ -38,11 +38,6 @@ class ControllerUpgraderTest extends \PhraseanetWebTestCaseAbstract
$this->client = $this->createClient(); $this->client = $this->createClient();
} }
public function tearDown()
{
parent::tearDown();
}
/** /**
* Default route test * Default route test
*/ */

View File

@@ -39,11 +39,6 @@ class ControllerConnectionTestTest extends \PhraseanetWebTestCaseAbstract
$this->client = $this->createClient(); $this->client = $this->createClient();
} }
public function tearDown()
{
parent::tearDown();
}
/** /**
* Default route test * Default route test
*/ */

View File

@@ -38,11 +38,6 @@ class ControllerPathFileTestTest extends \PhraseanetWebTestCaseAbstract
$this->client = $this->createClient(); $this->client = $this->createClient();
} }
public function tearDown()
{
parent::tearDown();
}
/** /**
* Default route test * Default route test
*/ */

View File

@@ -32,11 +32,6 @@ class ApplicationTest extends \PhraseanetPHPUnitAbstract
parent::setUp(); parent::setUp();
} }
public function tearDown()
{
parent::tearDown();
}
public function testGetConfigurationFilePath() public function testGetConfigurationFilePath()
{ {
$app = new Application(); $app = new Application();

View File

@@ -28,11 +28,6 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
parent::setUp(); parent::setUp();
} }
public function tearDown()
{
parent::tearDown();
}
public function testInitialization() public function testInitialization()
{ {
$spec = $this->getMock( $spec = $this->getMock(

View File

@@ -23,16 +23,6 @@ use Alchemy\Phrasea\Core\Configuration\Application;
class handlerTest extends \PhraseanetPHPUnitAbstract class handlerTest extends \PhraseanetPHPUnitAbstract
{ {
public function setUp()
{
parent::setUp();
}
public function tearDown()
{
parent::tearDown();
}
public function testGetSpec() public function testGetSpec()
{ {
$spec = $this->getMock( $spec = $this->getMock(

View File

@@ -23,16 +23,6 @@ use Alchemy\Phrasea\Core\Configuration\Parser\Yaml;
class parserTest extends \PhraseanetPHPUnitAbstract class parserTest extends \PhraseanetPHPUnitAbstract
{ {
public function setUp()
{
parent::setUp();
}
public function tearDown()
{
parent::tearDown();
}
public function testParser() public function testParser()
{ {
$parser = new Yaml(); $parser = new Yaml();

View File

@@ -22,20 +22,6 @@ use Alchemy\Phrasea\Core\Version;
class VersionTest extends \PhraseanetPHPUnitAbstract class VersionTest extends \PhraseanetPHPUnitAbstract
{ {
/**
*
* @var \Alchemy\Phrasea\Core\Configuration\Application
*/
public function setUp()
{
parent::setUp();
}
public function tearDown()
{
parent::tearDown();
}
public function testGetNumber() public function testGetNumber()
{ {
$this->assertTrue(is_string(Version::getNumber())); $this->assertTrue(is_string(Version::getNumber()));

View File

@@ -24,7 +24,7 @@ class HelperEditTest extends \PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testPropose_editing(). * @todo Implement testPropose_editing().
*/ */
public function testPropose_editing() public function testPropose_editing()
@@ -36,7 +36,7 @@ class HelperEditTest extends \PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testHas_thesaurus(). * @todo Implement testHas_thesaurus().
*/ */
public function testHas_thesaurus() public function testHas_thesaurus()
@@ -48,7 +48,7 @@ class HelperEditTest extends \PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_javascript_elements_ids(). * @todo Implement testGet_javascript_elements_ids().
*/ */
public function testGet_javascript_elements_ids() public function testGet_javascript_elements_ids()
@@ -60,7 +60,7 @@ class HelperEditTest extends \PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_javascript_elements(). * @todo Implement testGet_javascript_elements().
*/ */
public function testGet_javascript_elements() public function testGet_javascript_elements()
@@ -72,7 +72,7 @@ class HelperEditTest extends \PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_javascript_sugg_values(). * @todo Implement testGet_javascript_sugg_values().
*/ */
public function testGet_javascript_sugg_values() public function testGet_javascript_sugg_values()
@@ -84,7 +84,7 @@ class HelperEditTest extends \PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_javascript_status(). * @todo Implement testGet_javascript_status().
*/ */
public function testGet_javascript_status() public function testGet_javascript_status()
@@ -96,7 +96,7 @@ class HelperEditTest extends \PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_javascript_fields(). * @todo Implement testGet_javascript_fields().
*/ */
public function testGet_javascript_fields() public function testGet_javascript_fields()
@@ -108,7 +108,7 @@ class HelperEditTest extends \PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_status(). * @todo Implement testGet_status().
*/ */
public function testGet_status() public function testGet_status()
@@ -120,7 +120,7 @@ class HelperEditTest extends \PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_fields(). * @todo Implement testGet_fields().
*/ */
public function testGet_fields() public function testGet_fields()
@@ -132,7 +132,7 @@ class HelperEditTest extends \PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testExecute(). * @todo Implement testExecute().
*/ */
public function testExecute() public function testExecute()

View File

@@ -24,7 +24,7 @@ class HelperHelperTest extends \PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testIs_basket(). * @todo Implement testIs_basket().
*/ */
public function testIs_basket() public function testIs_basket()
@@ -36,7 +36,7 @@ class HelperHelperTest extends \PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_original_basket(). * @todo Implement testGet_original_basket().
*/ */
public function testGet_original_basket() public function testGet_original_basket()
@@ -48,7 +48,7 @@ class HelperHelperTest extends \PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testIs_single_grouping(). * @todo Implement testIs_single_grouping().
*/ */
public function testIs_single_grouping() public function testIs_single_grouping()
@@ -60,7 +60,7 @@ class HelperHelperTest extends \PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_grouping_head(). * @todo Implement testGet_grouping_head().
*/ */
public function testGet_grouping_head() public function testGet_grouping_head()
@@ -72,7 +72,7 @@ class HelperHelperTest extends \PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_elements(). * @todo Implement testGet_elements().
*/ */
public function testGet_elements() public function testGet_elements()
@@ -84,7 +84,7 @@ class HelperHelperTest extends \PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testHas_many_sbas(). * @todo Implement testHas_many_sbas().
*/ */
public function testHas_many_sbas() public function testHas_many_sbas()
@@ -96,7 +96,7 @@ class HelperHelperTest extends \PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testIs_possible(). * @todo Implement testIs_possible().
*/ */
public function testIs_possible() public function testIs_possible()
@@ -108,7 +108,7 @@ class HelperHelperTest extends \PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_count_not_actionable(). * @todo Implement testGet_count_not_actionable().
*/ */
public function testGet_count_not_actionable() public function testGet_count_not_actionable()
@@ -120,7 +120,7 @@ class HelperHelperTest extends \PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_count_actionable(). * @todo Implement testGet_count_actionable().
*/ */
public function testGet_count_actionable() public function testGet_count_actionable()
@@ -132,7 +132,7 @@ class HelperHelperTest extends \PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_count_actionable_groupings(). * @todo Implement testGet_count_actionable_groupings().
*/ */
public function testGet_count_actionable_groupings() public function testGet_count_actionable_groupings()
@@ -144,7 +144,7 @@ class HelperHelperTest extends \PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_count_element_received(). * @todo Implement testGet_count_element_received().
*/ */
public function testGet_count_element_received() public function testGet_count_element_received()
@@ -156,7 +156,7 @@ class HelperHelperTest extends \PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_sbas_id(). * @todo Implement testGet_sbas_id().
*/ */
public function testGet_sbas_id() public function testGet_sbas_id()
@@ -168,7 +168,7 @@ class HelperHelperTest extends \PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_serialize_list(). * @todo Implement testGet_serialize_list().
*/ */
public function testGet_serialize_list() public function testGet_serialize_list()
@@ -180,7 +180,7 @@ class HelperHelperTest extends \PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGrep_records(). * @todo Implement testGrep_records().
*/ */
public function testGrep_records() public function testGrep_records()

View File

@@ -24,7 +24,7 @@ class HelperMoveCollectionTest extends \PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testAvailable_destination(). * @todo Implement testAvailable_destination().
*/ */
public function testAvailable_destination() public function testAvailable_destination()
@@ -36,7 +36,7 @@ class HelperMoveCollectionTest extends \PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testPropose(). * @todo Implement testPropose().
*/ */
public function testPropose() public function testPropose()
@@ -48,7 +48,7 @@ class HelperMoveCollectionTest extends \PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testExecute(). * @todo Implement testExecute().
*/ */
public function testExecute() public function testExecute()

View File

@@ -24,7 +24,7 @@ class HelperPrinterTest extends \PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_count_preview(). * @todo Implement testGet_count_preview().
*/ */
public function testGet_count_preview() public function testGet_count_preview()
@@ -36,7 +36,7 @@ class HelperPrinterTest extends \PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_count_thumbnail(). * @todo Implement testGet_count_thumbnail().
*/ */
public function testGet_count_thumbnail() public function testGet_count_thumbnail()

View File

@@ -21,12 +21,11 @@ class HelperPushTest extends \PhraseanetPHPUnitAuthenticatedAbstract
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
$this->object = new Push(self::$core, \Symfony\Component\HttpFoundation\Request::createFromGlobals());
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testSearch(). * @todo Implement testSearch().
*/ */
public function testSearch() public function testSearch()

View File

@@ -3,9 +3,12 @@
require_once __DIR__ . '/../../../PhraseanetPHPUnitAuthenticatedAbstract.class.inc'; require_once __DIR__ . '/../../../PhraseanetPHPUnitAuthenticatedAbstract.class.inc';
require_once __DIR__ . '/../../Bridge_datas.inc'; require_once __DIR__ . '/../../Bridge_datas.inc';
$new_include_path = realpath(__DIR__ . '/../../../../vendor/gdata/') . PATH_SEPARATOR . get_include_path(); $include_path = realpath(__DIR__ . '/../../../../vendor/gdata/');
set_include_path($new_include_path); if(strpos(get_include_path(), $include_path) === false)
{
$new_include_path = $include_path . PATH_SEPARATOR . get_include_path();
set_include_path($new_include_path);
}
require_once('Zend/Loader.php'); require_once('Zend/Loader.php');
Zend_Loader::loadClass('Zend_Gdata_YouTube'); Zend_Loader::loadClass('Zend_Gdata_YouTube');

View File

@@ -3,9 +3,12 @@
require_once __DIR__ . '/../../../PhraseanetPHPUnitAuthenticatedAbstract.class.inc'; require_once __DIR__ . '/../../../PhraseanetPHPUnitAuthenticatedAbstract.class.inc';
require_once __DIR__ . '/../../Bridge_datas.inc'; require_once __DIR__ . '/../../Bridge_datas.inc';
$new_include_path = realpath(__DIR__ . '/../../../../vendor/gdata/') . PATH_SEPARATOR . get_include_path(); $include_path = realpath(__DIR__ . '/../../../../vendor/gdata/');
set_include_path($new_include_path); if(strpos(get_include_path(), $include_path) === false)
{
$new_include_path = $include_path . PATH_SEPARATOR . get_include_path();
set_include_path($new_include_path);
}
require_once('Zend/Loader.php'); require_once('Zend/Loader.php');
Zend_Loader::loadClass('Zend_Gdata_YouTube'); Zend_Loader::loadClass('Zend_Gdata_YouTube');

View File

@@ -2,8 +2,12 @@
require_once __DIR__ . '/../../bootstrap.php'; require_once __DIR__ . '/../../bootstrap.php';
$new_include_path = realpath(__DIR__ . "/../../vendor/") . PATH_SEPARATOR . get_include_path(); $include_path = realpath(__DIR__ . '/../../vendor/');
set_include_path($new_include_path); if(strpos(get_include_path(), $include_path) === false)
{
$new_include_path = $include_path . PATH_SEPARATOR . get_include_path();
set_include_path($new_include_path);
}
require_once __DIR__ . "/../../vendor/Phlickr/Api.php"; require_once __DIR__ . "/../../vendor/Phlickr/Api.php";

View File

@@ -842,10 +842,6 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
unlink(Setup_Upgrade::get_lock_file()); unlink(Setup_Upgrade::get_lock_file());
} }
$upgrader = new Setup_Upgrade($appbox);
$appbox->forceUpgrade($upgrader);
unset($upgrader);
if (null !== self::$core) if (null !== self::$core)
{ {
/* @var $em \Doctrine\ORM\EntityManager */ /* @var $em \Doctrine\ORM\EntityManager */
@@ -866,6 +862,10 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
$tool->createSchema($metas); $tool->createSchema($metas);
} }
$upgrader = new Setup_Upgrade($appbox);
$appbox->forceUpgrade($upgrader);
unset($upgrader);
self::$updated = true; self::$updated = true;
} }
@@ -898,12 +898,12 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
if (!$usr_alt1_id) if (!$usr_alt1_id)
{ {
$user = User_Adapter::create($appbox, 'test_phpunit_alt1', random::generatePassword(), 'noonealt1@example.com', false); $user = User_Adapter::create($appbox, 'test_phpunit_alt1', random::generatePassword(), 'noonealt1@example.com', false);
$usr_id = $user->get_id(); $usr_alt1_id = $user->get_id();
} }
if (!$usr_alt2_id) if (!$usr_alt2_id)
{ {
$user = User_Adapter::create($appbox, 'test_phpunit_alt2', random::generatePassword(), 'noonealt2@example.com', false); $user = User_Adapter::create($appbox, 'test_phpunit_alt2', random::generatePassword(), 'noonealt2@example.com', false);
$usr_id = $user->get_id(); $usr_alt2_id = $user->get_id();
} }
self::$user = User_Adapter::getInstance($usr_id, $appbox); self::$user = User_Adapter::getInstance($usr_id, $appbox);
@@ -1001,7 +1001,8 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
} }
if (!$collection_no_acces instanceof collection) if (!$collection_no_acces instanceof collection)
{ {
self::fail('Unable to find a second collection'); $collection_no_acces = collection::create($databox, $appbox, 'BIBOO', self::$user);
// self::fail('Unable to find a second collection');
} }
self::$collection = $coll; self::$collection = $coll;

View File

@@ -248,13 +248,17 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
//valide metas //valide metas
$metadatas = array(); $metadatas = array();
foreach (self::$record_1->get_caption()->get_fields() as $field) foreach (self::$record_1->get_caption()->get_fields() as $field)
{
$values = $field->get_values();
foreach($values as $value)
{ {
$metadatas[] = array( $metadatas[] = array(
'meta_id' => $field->get_meta_id() 'meta_id' => $value->getId()
, 'meta_struct_id' => $field->get_meta_struct_id() , 'meta_struct_id' => $field->get_meta_struct_id()
, 'value' => $field->get_value() , 'value' => $value->getValue()
); );
} }
}
$metadatas = array_shift($metadatas); $metadatas = array_shift($metadatas);
$metadatas["value"] = array("new_value"); $metadatas["value"] = array("new_value");

View File

@@ -38,7 +38,6 @@ class record_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
parent::tearDownAfterClass(); parent::tearDownAfterClass();
} }
public function testGet_creation_date() public function testGet_creation_date()
{ {
$date_obj = new DateTime(); $date_obj = new DateTime();
@@ -169,7 +168,6 @@ class record_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
} }
public function testGet_sha256() public function testGet_sha256()
{ {
$this->assertNotNull(static::$record_1->get_sha256()); $this->assertNotNull(static::$record_1->get_sha256());
@@ -257,7 +255,7 @@ class record_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
foreach (self::$record_1->get_caption()->get_fields() as $field) foreach (self::$record_1->get_caption()->get_fields() as $field)
{ {
$tagname = $field->get_name(); $tagname = $field->get_name();
$this->assertEquals($field->get_value(true), (string) $sxe->description->$tagname); $this->assertEquals($field->get_serialized_values(), (string) $sxe->description->$tagname);
} }
} }
@@ -308,18 +306,69 @@ class record_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
$current_caption = self::$record_1->get_caption(); $current_caption = self::$record_1->get_caption();
$metadatas = array();
foreach ($meta_structure_el as $meta_el) foreach ($meta_structure_el as $meta_el)
{ {
$current_fields = $current_caption->get_fields(array($meta_el->get_name())); $current_fields = $current_caption->get_fields(array($meta_el->get_name()));
$meta_id = null;
$field = null;
if (count($current_fields) > 0) if (count($current_fields) > 0)
{ {
$meta_id = $current_fields[0]->get_meta_id(); $field = array_pop($current_fields);
} }
$value = $meta_el->is_multi() ? array('un', 'jeu', 'de', 'test') : array('un jeu de test'); if($meta_el->is_multi())
{
if($field)
{
foreach($field->get_values() as $value)
{
$metadatas[] = array(
'meta_struct_id' => $meta_el->get_id()
, 'meta_id' => $value->getId()
, 'value' => ''
);
}
}
$metadatas[] = array('meta_struct_id' => $meta_el->get_id(), 'meta_id' => $meta_id, 'value' => $value); $metadatas[] = array(
'meta_struct_id' => $meta_el->get_id()
, 'meta_id' => null
, 'value' => 'un'
);
$metadatas[] = array(
'meta_struct_id' => $meta_el->get_id()
, 'meta_id' => null
, 'value' => 'jeu'
);
$metadatas[] = array(
'meta_struct_id' => $meta_el->get_id()
, 'meta_id' => null
, 'value' => 'de'
);
$metadatas[] = array(
'meta_struct_id' => $meta_el->get_id()
, 'meta_id' => null
, 'value' => 'test'
);
}
else
{
$meta_id = null;
if($field)
{
$meta_id = array_pop($field->get_values())->getId();
}
$metadatas[] = array(
'meta_struct_id' => $meta_el->get_id()
, 'meta_id' => $meta_id
, 'value' => 'un jeu de test'
);
}
} }
self::$record_1->set_metadatas($metadatas); self::$record_1->set_metadatas($metadatas);
@@ -339,11 +388,17 @@ class record_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
if ($meta_el->is_multi()) if ($meta_el->is_multi())
{ {
$this->assertEquals($multi_imploded, implode(' ' . $meta_el->get_separator() . ' ', $field->get_value(false))); $initial_values = array();
$this->assertEquals($multi_imploded, $field->get_value(true)); foreach($field->get_values() as $value)
{
$initial_values[] = $value->getValue();
}
$this->assertEquals($multi_imploded, implode(' ' . $meta_el->get_separator() . ' ', $initial_values));
$this->assertEquals($multi_imploded, $field->get_serialized_values());
} }
else else
$this->assertEquals('un jeu de test', $field->get_value()); $this->assertEquals('un jeu de test', $field->get_serialized_values());
} }
} }
@@ -512,7 +567,6 @@ class record_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
if (!$found) if (!$found)
$this->fail(); $this->fail();
} }
} }

View File

@@ -33,7 +33,7 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
*/ */
public function testSet_locale() public function testSet_locale()
{ {
@@ -43,7 +43,7 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_locale(). * @todo Implement testGet_locale().
*/ */
public function testGet_locale() public function testGet_locale()
@@ -54,7 +54,7 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testSet_sort(). * @todo Implement testSet_sort().
*/ */
public function testSet_sort() public function testSet_sort()
@@ -70,7 +70,7 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_sortby(). * @todo Implement testGet_sortby().
*/ */
public function testGet_sortby() public function testGet_sortby()
@@ -83,7 +83,7 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_sortord(). * @todo Implement testGet_sortord().
*/ */
public function testGet_sortord() public function testGet_sortord()
@@ -96,7 +96,7 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testSet_use_stemming(). * @todo Implement testSet_use_stemming().
*/ */
public function testSet_use_stemming() public function testSet_use_stemming()
@@ -110,7 +110,7 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_use_stemming(). * @todo Implement testGet_use_stemming().
*/ */
public function testGet_use_stemming() public function testGet_use_stemming()
@@ -124,7 +124,7 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testSet_search_type(). * @todo Implement testSet_search_type().
*/ */
public function testSet_search_type() public function testSet_search_type()
@@ -141,7 +141,7 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_search_type(). * @todo Implement testGet_search_type().
*/ */
public function testGet_search_type() public function testGet_search_type()
@@ -158,7 +158,7 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testSet_bases(). * @todo Implement testSet_bases().
*/ */
public function testSet_bases() public function testSet_bases()
@@ -169,7 +169,7 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_bases(). * @todo Implement testGet_bases().
*/ */
public function testGet_bases() public function testGet_bases()
@@ -180,7 +180,7 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testSet_fields(). * @todo Implement testSet_fields().
*/ */
public function testSet_fields() public function testSet_fields()
@@ -192,7 +192,7 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_fields(). * @todo Implement testGet_fields().
*/ */
public function testGet_fields() public function testGet_fields()
@@ -204,7 +204,7 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testSet_status(). * @todo Implement testSet_status().
*/ */
public function testSet_status() public function testSet_status()
@@ -216,7 +216,7 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_status(). * @todo Implement testGet_status().
*/ */
public function testGet_status() public function testGet_status()
@@ -228,7 +228,7 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testSet_record_type(). * @todo Implement testSet_record_type().
*/ */
public function testSet_record_type() public function testSet_record_type()
@@ -240,7 +240,7 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_record_type(). * @todo Implement testGet_record_type().
*/ */
public function testGet_record_type() public function testGet_record_type()
@@ -252,7 +252,7 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testSet_min_date(). * @todo Implement testSet_min_date().
*/ */
public function testSet_min_date() public function testSet_min_date()
@@ -264,7 +264,7 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_min_date(). * @todo Implement testGet_min_date().
*/ */
public function testGet_min_date() public function testGet_min_date()
@@ -276,7 +276,7 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testSet_max_date(). * @todo Implement testSet_max_date().
*/ */
public function testSet_max_date() public function testSet_max_date()
@@ -288,7 +288,7 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_max_date(). * @todo Implement testGet_max_date().
*/ */
public function testGet_max_date() public function testGet_max_date()
@@ -300,7 +300,7 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testSet_date_fields(). * @todo Implement testSet_date_fields().
*/ */
public function testSet_date_fields() public function testSet_date_fields()
@@ -312,7 +312,7 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testGet_date_fields(). * @todo Implement testGet_date_fields().
*/ */
public function testGet_date_fields() public function testGet_date_fields()
@@ -324,7 +324,7 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testSerialize(). * @todo Implement testSerialize().
*/ */
public function testSerialize() public function testSerialize()
@@ -344,7 +344,7 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
} }
/** /**
* @covers {className}::{origMethodName} *
* @todo Implement testUnserialize(). * @todo Implement testUnserialize().
*/ */
public function testUnserialize() public function testUnserialize()

View File

@@ -190,14 +190,15 @@
<form id="export_form" method="post" target="exportwindow" action="/admin/users/search/export/"> <form id="export_form" method="post" target="exportwindow" action="/admin/users/search/export/">
<input name="srt" value="{{parm['srt']}}" type="hidden" /> <input name="srt" value="{{parm['srt']}}" type="hidden" />
<input name="ord" value="{{parm.ord}}" type="hidden" /> <input name="ord" value="{{parm.ord}}" type="hidden" />
<input name="act" value="{{parm.act}}" type="hidden" />
{% for sbas_id in parm.sbas_id %} {% for sbas_id in parm.sbas_id %}
<input name="sbas_id[]" value="{{sbas_id}}" type="hidden" /> <input name="sbas_id[]" value="{{sbas_id}}" type="hidden" />
{% endfor %} {% endfor %}
{% for base_id in parm.base_id %} {% for base_id in parm.base_id %}
<input name="base_id[]" value="{{base_id}}" type="hidden" /> <input name="base_id[]" value="{{base_id}}" type="hidden" />
{% endfor %} {% endfor %}
{% if parm['usr_ids'] is defined %}
<input name="usr_ids" value="{{parm.usr_ids}}" type="hidden" /> <input name="usr_ids" value="{{parm.usr_ids}}" type="hidden" />
{% endif %}
<input name="like_value" value="{{parm.like_value}}" type="hidden" /> <input name="like_value" value="{{parm.like_value}}" type="hidden" />
<input name="like_field" value="{{parm.like_field}}" type="hidden" /> <input name="like_field" value="{{parm.like_field}}" type="hidden" />
<input name="inactives" value="{{parm.inactives}}" type="hidden" /> <input name="inactives" value="{{parm.inactives}}" type="hidden" />

View File

@@ -66,7 +66,7 @@
</div> </div>
</td> </td>
<td> <td>
<input class='required_field' type='text' name='{{name}}' value="{{ caption.get_dc_field('Subject') is not none ? caption.get_dc_field('Subject').get_value(true, ' ') : ''}}"/> <input class='required_field' type='text' name='{{name}}' value="{{ caption.get_dc_field('Subject') is not none ? caption.get_dc_field('Subject').get_serialized_values(' ') : ''}}"/>
<br /> <br />
{{ error_form.display_errors(name, constraint_errors) }} {{ error_form.display_errors(name, constraint_errors) }}
</td> </td>

View File

@@ -74,7 +74,7 @@
<label for='{{ name }}'>{% trans 'Tags' %}</label> <label for='{{ name }}'>{% trans 'Tags' %}</label>
</td> </td>
<td> <td>
<input class='required_field' type='text' style="width:150px;" name='{{ name }}' value="{{ caption.get_dc_field('Subject') is not none ? caption.get_dc_field('Subject').get_value(true, ' ') : '' }}"/> <input class='required_field' type='text' style="width:150px;" name='{{ name }}' value="{{ caption.get_dc_field('Subject') is not none ? caption.get_dc_field('Subject').get_serialized_values(' ') : '' }}"/>
<br /> <br />
{{ error_form.display_errors(name, constraint_errors) }} {{ error_form.display_errors(name, constraint_errors) }}
</td> </td>

View File

@@ -78,7 +78,7 @@
</div> </div>
</td> </td>
<td> <td>
<input class='required_field' type='text' name='{{ name }}' value="{{ caption.get_dc_field('Subject') is not none ? caption.get_dc_field('Subject').get_value(true, ' ') : ""}}"/> <input class='required_field' type='text' name='{{ name }}' value="{{ caption.get_dc_field('Subject') is not none ? caption.get_dc_field('Subject').get_serialized_values(' ') : ""}}"/>
<br /> <br />
{{ error_form.display_errors(name, constraint_errors) }} {{ error_form.display_errors(name, constraint_errors) }}
</td> </td>

View File

@@ -2,7 +2,7 @@
{# This file MUST NOT CONTAINS trans tag #} {# This file MUST NOT CONTAINS trans tag #}
{% extends '/setup/wrapper.twig' %} {% extends '/setup/wrapper.html.twig' %}
{% macro constraint_format(constraint) %} {% macro constraint_format(constraint) %}
{% if not constraint.is_ok() %} {% if not constraint.is_ok() %}

View File

@@ -1,4 +1,4 @@
{% extends '/setup/wrapper.twig' %} {% extends '/setup/wrapper.html.twig' %}
{% block extrahead %} {% block extrahead %}
<script type="text/javascript"> <script type="text/javascript">

View File

@@ -1,4 +1,4 @@
{% extends '/setup/wrapper.twig' %} {% extends '/setup/wrapper.html.twig' %}
{% block extrahead %} {% block extrahead %}
<script type="text/javascript"> <script type="text/javascript">

View File

@@ -44,7 +44,7 @@ switch ($parm['action'])
$twig = $core->getTwig(); $twig = $core->getTwig();
$search_engine = null; $search_engine = null;
if (($options = unserialize($parm['options_serial'])) !== false) if ($parm['env'] == 'RESULT' && ($options = unserialize($parm['options_serial'])) !== false)
{ {
$search_engine = new searchEngine_adapter($registry); $search_engine = new searchEngine_adapter($registry);
$search_engine->set_options($options); $search_engine->set_options($options);