From 241766ceb7d8260809d4f658dbc2e26f667ec422 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Tue, 28 Feb 2012 13:09:48 +0100 Subject: [PATCH 001/159] Fix tests --- lib/unitTest/Alchemy/Phrasea/Controller/Prod/BridgeTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/unitTest/Alchemy/Phrasea/Controller/Prod/BridgeTest.php b/lib/unitTest/Alchemy/Phrasea/Controller/Prod/BridgeTest.php index 60766c80da..e3107d17bd 100644 --- a/lib/unitTest/Alchemy/Phrasea/Controller/Prod/BridgeTest.php +++ b/lib/unitTest/Alchemy/Phrasea/Controller/Prod/BridgeTest.php @@ -165,6 +165,7 @@ class BridgeApplication extends PhraseanetWebTestCaseAuthenticatedAbstract public function testLogoutDeconnected() { + $this->client->followRedirects(); $url = sprintf('/bridge/adapter/%d/logout/', self::$account->get_id()); $crawler = $this->client->request('GET', $url); $pageContent = $this->client->getResponse()->getContent(); From 2b9e86cb209636327e20a5a83fffee167a446b20 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Tue, 28 Feb 2012 14:28:06 +0100 Subject: [PATCH 002/159] Fix loader --- www/prod/page0.js | 1 - 1 file changed, 1 deletion(-) diff --git a/www/prod/page0.js b/www/prod/page0.js index 57b01602af..257d51de21 100644 --- a/www/prod/page0.js +++ b/www/prod/page0.js @@ -1149,7 +1149,6 @@ $(document).ready(function(){ initAnswerForm(); initLook(); - afterSearch(); setTimeout("sessionactive();", 30000); From 9ebebaa22d051d2df6474f8e255ddcb8dcbaaff3 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Tue, 28 Feb 2012 14:52:13 +0100 Subject: [PATCH 003/159] Fix namesapce --- lib/Alchemy/Phrasea/Out/Module/PDF.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/Alchemy/Phrasea/Out/Module/PDF.php b/lib/Alchemy/Phrasea/Out/Module/PDF.php index 823ca22c45..6d92f7e829 100644 --- a/lib/Alchemy/Phrasea/Out/Module/PDF.php +++ b/lib/Alchemy/Phrasea/Out/Module/PDF.php @@ -184,8 +184,10 @@ class PDF $fimg = $subdef->get_pathfile(); if (!$user->ACL()->has_right_on_base($rec->get_base_id(), "nowatermark") - && $subdef->get_type() == media_subdef::TYPE_IMAGE) - $fimg = recordutils_image::watermark($rec->get_base_id(), $rec->get_record_id()); + && $subdef->get_type() == \media_subdef::TYPE_IMAGE) + { + $fimg = \recordutils_image::watermark($rec->get_base_id(), $rec->get_record_id()); + } $wimg = $himg = $ImgSize; if ($subdef->get_height() > 0 && $subdef->get_width() > 0) @@ -479,8 +481,8 @@ class PDF $f = $subdef->get_pathfile(); if (!$user->ACL()->has_right_on_base($rec->get_base_id(), "nowatermark") - && $subdef->get_type() == media_subdef::TYPE_IMAGE) - $f = recordutils_image::watermark($rec->get_base_id(), $rec->get_record_id()); + && $subdef->get_type() == \media_subdef::TYPE_IMAGE) + $f = \recordutils_image::watermark($rec->get_base_id(), $rec->get_record_id()); $wimg = $himg = 150; // preview dans un carre de 150 mm if ($subdef->get_width() > 0 && $subdef->get_height() > 0) From b91fe2456f8d6e3cc7c4865da0c5c47f71c58d39 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Tue, 28 Feb 2012 15:08:39 +0100 Subject: [PATCH 004/159] Fix VocabId --- www/prod/jquery.edit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/prod/jquery.edit.js b/www/prod/jquery.edit.js index 4153da43ad..5e6dec466d 100644 --- a/www/prod/jquery.edit.js +++ b/www/prod/jquery.edit.js @@ -417,7 +417,7 @@ function updateCurrentMval(meta_struct_id, HighlightValue, vocabularyId) + (a[key].n != n ? " hetero " : "") + "'>" + '
' + extra - + '' + + '' + word + "" + ' ' From 150ab811cd9c1c824825be4e0364ffe356e08388 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Tue, 28 Feb 2012 15:13:43 +0100 Subject: [PATCH 005/159] Removed ORM table drop proposal --- lib/classes/base.class.php | 122 ++++++++++++++++++++----------------- 1 file changed, 65 insertions(+), 57 deletions(-) diff --git a/lib/classes/base.class.php b/lib/classes/base.class.php index b5f476b619..cd2cb38946 100644 --- a/lib/classes/base.class.php +++ b/lib/classes/base.class.php @@ -60,11 +60,12 @@ abstract class base implements cache_cacheableInterface /** * */ + const APPLICATION_BOX = 'APPLICATION_BOX'; /** * */ - const DATA_BOX = 'DATA_BOX'; + const DATA_BOX = 'DATA_BOX'; /** * @@ -78,7 +79,6 @@ abstract class base implements cache_cacheableInterface public function get_schema() { if ($this->schema) - return $this->schema; $this->load_schema(); @@ -178,7 +178,7 @@ abstract class base implements cache_cacheableInterface public function get_data_from_cache($option = null) { - if($this->get_base_type() == self::DATA_BOX) + if ($this->get_base_type() == self::DATA_BOX) { \cache_databox::refresh($this->id); } @@ -232,7 +232,6 @@ abstract class base implements cache_cacheableInterface { if ($this->version) - return $this->version; $version = '0.0.0'; @@ -245,9 +244,9 @@ abstract class base implements cache_cacheableInterface if ($sql !== '') { - $stmt = $this->get_connection()->prepare($sql); + $stmt = $this->get_connection()->prepare($sql); $stmt->execute(); - $row = $stmt->fetch(PDO::FETCH_ASSOC); + $row = $stmt->fetch(PDO::FETCH_ASSOC); $stmt->closeCursor(); if ($row) $version = $row['version']; @@ -261,10 +260,8 @@ abstract class base implements cache_cacheableInterface public function upgradeavailable() { if ($this->get_version()) - return version_compare(\Alchemy\Phrasea\Core\Version::getNumber(), $this->get_version(), '>'); else - return true; } @@ -281,13 +278,25 @@ abstract class base implements cache_cacheableInterface $upgrader->add_steps(count($allTables) + 1); - $sql = "SHOW TABLE STATUS"; + $sql = "SHOW TABLE STATUS"; $stmt = $this->get_connection()->prepare($sql); $stmt->execute(); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); + $ORMTables = array( + 'BasketElements', + 'Baskets', + 'StoryWZ', + 'UsrListOwners', + 'UsrLists', + 'UsrListsContent', + 'ValidationDatas', + 'ValidationParticipants', + 'ValidationSessions', + ); + foreach ($rs as $row) { $tname = $row["Name"]; @@ -296,7 +305,7 @@ abstract class base implements cache_cacheableInterface { $upgrader->set_current_message(sprintf(_('Updating table %s'), $tname)); - $engine = strtolower(trim($allTables[$tname]->engine)); + $engine = strtolower(trim($allTables[$tname]->engine)); $ref_engine = strtolower($row['Engine']); if ($engine != $ref_engine && in_array($engine, array('innodb', 'myisam'))) @@ -311,22 +320,22 @@ abstract class base implements cache_cacheableInterface catch (Exception $e) { $recommends[] = array( - 'message' => sprintf(_('Erreur lors de la tentative ; errreur : %s'), $e->getMessage()), - 'sql' => $sql + 'message' => sprintf(_('Erreur lors de la tentative ; errreur : %s'), $e->getMessage()), + 'sql' => $sql ); } } - $ret = self::upgradeTable($allTables[$tname]); + $ret = self::upgradeTable($allTables[$tname]); $recommends = array_merge($recommends, $ret); unset($allTables[$tname]); $upgrader->add_steps_complete(1); } - else + elseif (!in_array($tname, $ORMTables)) { $recommends[] = array( - 'message' => 'Une table pourrait etre supprime', - 'sql' => 'DROP TABLE ' . $this->dbname . '.`' . $tname . '`;' + 'message' => 'Une table pourrait etre supprime', + 'sql' => 'DROP TABLE ' . $this->dbname . '.`' . $tname . '`;' ); } } @@ -390,7 +399,6 @@ abstract class base implements cache_cacheableInterface protected function load_schema() { if ($this->schema) - return $this; $structure = simplexml_load_file(__DIR__ . "/../../lib/conf.d/bases_structure.xml"); @@ -434,7 +442,7 @@ abstract class base implements cache_cacheableInterface */ protected function createTable(SimpleXMLElement $table) { - $field_stmt = $defaults_stmt = array(); + $field_stmt = $defaults_stmt = array(); $create_stmt = "CREATE TABLE `" . $table['name'] . "` ("; @@ -451,8 +459,8 @@ abstract class base implements cache_cacheableInterface $character_set = ''; if (in_array(strtolower((string) $field->type), array('text', 'longtext', 'mediumtext', 'tinytext')) - || substr(strtolower((string) $field->type), 0, 7) == 'varchar' - || in_array(substr(strtolower((string) $field->type), 0, 4), array('char', 'enum'))) + || substr(strtolower((string) $field->type), 0, 7) == 'varchar' + || in_array(substr(strtolower((string) $field->type), 0, 4), array('char', 'enum'))) { $collation = trim((string) $field->collation) != '' ? trim((string) $field->collation) : 'utf8_unicode_ci'; @@ -463,8 +471,8 @@ abstract class base implements cache_cacheableInterface } $field_stmt[] = " `" . $field->name . "` " . $field->type . " " - . $field->extra . " " . $character_set . " " - . $is_default . " " . $isnull . ""; + . $field->extra . " " . $character_set . " " + . $is_default . " " . $isnull . ""; } @@ -482,7 +490,7 @@ abstract class base implements cache_cacheableInterface $primary_fields[] = "`" . $field . "`"; } - $field_stmt[] = 'PRIMARY KEY (' . implode(',', $primary_fields) . ')'; + $field_stmt[] = 'PRIMARY KEY (' . implode(',', $primary_fields) . ')'; break; case "UNIQUE": $unique_fields = array(); @@ -511,32 +519,32 @@ abstract class base implements cache_cacheableInterface { foreach ($table->defaults->default as $default) { - $k = $v = $params = $dates_values = array(); + $k = $v = $params = $dates_values = array(); $nonce = random::generatePassword(16); foreach ($default->data as $data) { - $k = trim($data['key']); + $k = trim($data['key']); if ($k === 'usr_password') $data = User_Adapter::salt_password($data, $nonce); if ($k === 'nonce') $data = $nonce; - $v = trim(str_replace(array("\r\n", "\r", "\n", "\t"), '', $data)); + $v = trim(str_replace(array("\r\n", "\r", "\n", "\t"), '', $data)); if (trim(mb_strtolower($v)) == 'now()') $dates_values [$k] = 'NOW()'; else - $params[$k] = (trim(mb_strtolower($v)) == 'null' ? null : $v); + $params[$k] = (trim(mb_strtolower($v)) == 'null' ? null : $v); } $separator = ((count($params) > 0 && count($dates_values) > 0) ? ', ' : ''); $defaults_stmt[] = array( - 'sql' => - 'INSERT INTO `' . $table['name'] . '` (' . implode(', ', array_keys($params)) - . $separator . implode(', ', array_keys($dates_values)) . ') + 'sql' => + 'INSERT INTO `' . $table['name'] . '` (' . implode(', ', array_keys($params)) + . $separator . implode(', ', array_keys($dates_values)) . ') VALUES (:' . implode(', :', array_keys($params)) - . $separator . implode(', ', array_values($dates_values)) . ') ' - , 'params' => $params + . $separator . implode(', ', array_values($dates_values)) . ') ' + , 'params' => $params ); } } @@ -562,8 +570,8 @@ abstract class base implements cache_cacheableInterface catch (Exception $e) { $recommends[] = array( - 'message' => sprintf(_('Erreur lors de la tentative ; errreur : %s'), $e->getMessage()), - 'sql' => $def['sql'] + 'message' => sprintf(_('Erreur lors de la tentative ; errreur : %s'), $e->getMessage()), + 'sql' => $def['sql'] ); } } @@ -574,7 +582,7 @@ abstract class base implements cache_cacheableInterface protected function upgradeTable(SimpleXMLElement $table) { $correct_table = array('fields' => array(), 'indexes' => array(), 'collation' => array()); - $alter = $alter_pre = $return = array(); + $alter = $alter_pre = $return = array(); $registry = registry::get_instance(); @@ -589,8 +597,8 @@ abstract class base implements cache_cacheableInterface $collation = trim((string) $field->collation) != '' ? trim((string) $field->collation) : 'utf8_unicode_ci'; if (in_array(strtolower((string) $field->type), array('text', 'longtext', 'mediumtext', 'tinytext')) - || substr(strtolower((string) $field->type), 0, 7) == 'varchar' - || in_array(substr(strtolower((string) $field->type), 0, 4), array('char', 'enum'))) + || substr(strtolower((string) $field->type), 0, 7) == 'varchar' + || in_array(substr(strtolower((string) $field->type), 0, 4), array('char', 'enum'))) { $code = array_pop(array_reverse(explode('_', $collation))); @@ -618,7 +626,7 @@ abstract class base implements cache_cacheableInterface foreach ($table->indexes->index as $index) { $i_name = (string) $index->name; - $expr = array(); + $expr = array(); foreach ($index->fields->field as $field) $expr[] = '`' . trim((string) $field) . '`'; @@ -630,25 +638,25 @@ abstract class base implements cache_cacheableInterface $correct_table['indexes']['PRIMARY'] = 'PRIMARY KEY (' . $expr . ')'; break; case "UNIQUE": - $correct_table['indexes'][$i_name] = 'UNIQUE KEY `' . $i_name . '` (' . $expr . ')'; + $correct_table['indexes'][$i_name] = 'UNIQUE KEY `' . $i_name . '` (' . $expr . ')'; break; case "INDEX": - $correct_table['indexes'][$i_name] = 'KEY `' . $i_name . '` (' . $expr . ')'; + $correct_table['indexes'][$i_name] = 'KEY `' . $i_name . '` (' . $expr . ')'; break; } } } - $sql = "SHOW FULL FIELDS FROM `" . $table['name'] . "`"; + $sql = "SHOW FULL FIELDS FROM `" . $table['name'] . "`"; $stmt = $this->get_connection()->prepare($sql); $stmt->execute(); - $rs2 = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rs2 = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); foreach ($rs2 as $row2) { - $f_name = $row2['Field']; + $f_name = $row2['Field']; $expr_found = trim($row2['Type']); $_extra = $row2['Extra']; @@ -727,8 +735,8 @@ abstract class base implements cache_cacheableInterface else { $return[] = array( - 'message' => 'Un champ pourrait etre supprime', - 'sql' => "ALTER TABLE " . $this->dbname . ".`" . $table['name'] . "` DROP `$f_name`;" + 'message' => 'Un champ pourrait etre supprime', + 'sql' => "ALTER TABLE " . $this->dbname . ".`" . $table['name'] . "` DROP `$f_name`;" ); } } @@ -739,16 +747,16 @@ abstract class base implements cache_cacheableInterface } $tIndex = array(); - $sql = "SHOW INDEXES FROM `" . $table['name'] . "`"; + $sql = "SHOW INDEXES FROM `" . $table['name'] . "`"; $stmt = $this->get_connection()->prepare($sql); $stmt->execute(); - $rs2 = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rs2 = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); foreach ($rs2 as $row2) { if (!isset($tIndex[$row2['Key_name']])) - $tIndex[$row2['Key_name']] = array('unique' => ((int) ($row2['Non_unique']) == 0), 'columns' => array()); + $tIndex[$row2['Key_name']] = array('unique' => ((int) ($row2['Non_unique']) == 0), 'columns' => array()); $tIndex[$row2['Key_name']]['columns'][(int) ($row2['Seq_in_index'])] = $row2['Column_name']; } @@ -786,8 +794,8 @@ abstract class base implements cache_cacheableInterface else { $return[] = array( - 'message' => 'Un index pourrait etre supprime', - 'sql' => 'ALTER TABLE ' . $this->dbname . '.`' . $table['name'] . '` DROP ' . $full_name_index . ';' + 'message' => 'Un index pourrait etre supprime', + 'sql' => 'ALTER TABLE ' . $this->dbname . '.`' . $table['name'] . '` DROP ' . $full_name_index . ';' ); } } @@ -806,8 +814,8 @@ abstract class base implements cache_cacheableInterface catch (Exception $e) { $return[] = array( - 'message' => sprintf(_('Erreur lors de la tentative ; errreur : %s'), $e->getMessage()), - 'sql' => $a + 'message' => sprintf(_('Erreur lors de la tentative ; errreur : %s'), $e->getMessage()), + 'sql' => $a ); } } @@ -823,8 +831,8 @@ abstract class base implements cache_cacheableInterface catch (Exception $e) { $return[] = array( - 'message' => sprintf(_('Erreur lors de la tentative ; errreur : %s'), $e->getMessage()), - 'sql' => $a + 'message' => sprintf(_('Erreur lors de la tentative ; errreur : %s'), $e->getMessage()), + 'sql' => $a ); } } @@ -882,8 +890,8 @@ abstract class base implements cache_cacheableInterface } $upgrader->add_steps_complete(1) - ->add_steps(count($list_patches)) - ->set_current_message(sprintf(_('Applying patches on %s'), $this->get_dbname())); + ->add_steps(count($list_patches)) + ->set_current_message(sprintf(_('Applying patches on %s'), $this->get_dbname())); ksort($list_patches); $success = true; From daf4fe2a03fce1aa63bda28af952ba9d0bf09641 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Tue, 28 Feb 2012 15:28:56 +0100 Subject: [PATCH 006/159] Removed ORM table drop proposal --- www/client/homeinterpubbask.php | 584 ++++++++++++++++---------------- 1 file changed, 292 insertions(+), 292 deletions(-) diff --git a/www/client/homeinterpubbask.php b/www/client/homeinterpubbask.php index a2c6f276dc..02df8a87a8 100644 --- a/www/client/homeinterpubbask.php +++ b/www/client/homeinterpubbask.php @@ -15,295 +15,295 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -$Core = \bootstrap::getCore(); -$appbox = appbox::get_instance($Core); -$session = $appbox->get_session(); - -$th_size = $user->getPrefs('images_size'); - -$user = $Core->getAuthenticatedUser(); - -$RN = array("\r\n", "\n", "\r"); - -$conn = $appbox->get_connection(); - -$sql = 'SELECT s.public, s.pub_restrict,c.sselcont_id, c.base_id, sb.*, c.record_id, s.ssel_id, s.name, s.descript, c.ord, ' . - 'DATE_FORMAT(s.pub_date,"' . _('phraseanet::technique::datetime') . '") AS pub_date, ' . - 'DATE_FORMAT(s.updater,"' . _('phraseanet::technique::date') . '") AS updater, ' . - 's.updater as dateC1, s.pub_date as dateC2,' . - ' n.id, u.usr_nom, u.usr_prenom, u.usr_login, u.usr_mail ' . - ', bu.mask_and ' . - ', bu.mask_xor ' . - 'FROM (sselcont c, ssel s, usr u, bas b, sbas sb) ' . - 'LEFT JOIN sselnew n ' . - 'ON (n.ssel_id = s.ssel_id AND n.usr_id = :usr_id) ' . - ' LEFT JOIN basusr bu ON (bu.base_id = b.base_id AND bu.usr_id = :usr_id_bis)' . - 'WHERE s.ssel_id = c.ssel_id AND s.public="1" ' . - 'AND (s.pub_restrict="0" ' . - 'OR (s.pub_restrict="1" AND c.base_id IN ' . - ' (SELECT base_id FROM basusr WHERE usr_id = :usr_id_sub AND actif = "1")))' . - ' AND u.usr_id = s.usr_id AND temporaryType=0 ' . - ' AND b.sbas_id = sb.sbas_id' . - ' AND b.base_id = c.base_id' . - ' ORDER BY s.pub_date DESC, c.ord ASC'; - -$sqlMe = 'SELECT usr_login, usr_password FROM usr WHERE usr_id = :usr_id'; - -$stmt = $conn->prepare($sqlMe); -$stmt->execute(array(':usr_id' => $session->get_usr_id())); -$rawMe = $stmt->fetch(PDO::FETCH_ASSOC); -$stmt->closeCursor(); - -$info_usr = null; - -if ($rawMe) -{ - $info_usr = $rawMe; -} - -$core = \bootstrap::getCore(); -$twig = $core->getTwig(); - -$stmt = $conn->prepare($sql); -$usr_id = $session->get_usr_id(); -$stmt->execute(array(':usr_id' => $usr_id, ':usr_id_bis' => $usr_id, ':usr_id_sub' => $usr_id)); -$rs = $stmt->fetchAll(PDO::FETCH_ASSOC); -$stmt->closeCursor(); - -$sselid = null; -$o = 0; -$out = ''; - -$feed = ''; -$feed .= '
' . - '

' . _('publications:: dernieres publications') . '

' . - '
'; - -foreach ($rs as $row) -{ - if ($row['ssel_id'] != $sselid) - { - if ($sselid !== null) - { - - - - $item .= '
' . $out; - $item .= '
' . - ''; - - if ($itemIsOk) - $feed .= $item; - } - - $itemIsOk = false; - - $sselid = $row['ssel_id']; - $ord = $row['ord']; - $o = 0; - $out = ''; - $neverSeen = ''; - $publisher = $row['usr_prenom'] . ' ' . $row['usr_nom']; - if ($publisher == ' ') - $publisher = $row['usr_mail']; - if ($publisher == '') - $publisher = 'Unreferenced user'; - - if ($row['id'] != '') - $neverSeen = _('publications:: publication non lue'); - - $item = ''; - $item .= '
' . - '
' . - '

' . - '' . $row['name'] . - ' ' . $neverSeen . '

' . - '' . - ' ' . $row['pub_date'] . - ' '; - - if ($row['usr_mail'] != '') - $item .= ''; - - $item .= $publisher; - - if ($row['usr_mail'] != '') - $item .= ''; - - if ($row['dateC1'] != $row['dateC2']) - $item .= '
' . _('publications:: derniere mise a jour') . ' ' . $row['updater'] . '

'; - - $item .= '
'; - - - if (trim(str_replace($RN, '', $row['descript'])) != '') - { - $row['descript'] = str_replace($RN, '
', $row['descript']); - $item .= '' . $row['descript']; - } - $item .= '
'; - } - - - - - - $ord = $row['ord']; - $statOk = true; - if ($row['public'] == 1 && $row['pub_restrict'] == 1) - { - $statOk = false; - - try - { - $connsbas = connection::getPDOConnection($row['sbas_id']); - - $sql = 'SELECT record_id FROM record WHERE ((status ^ ' . $row['mask_xor'] . ') & ' . $row['mask_and'] . ')=0 - AND record_id = :record_id'; - $stmt = $connsbas->prepare($sql); - $stmt->execute(array(':record_id' => $row['record_id'])); - $statOk = ($stmt->rowCount() > 0); - $stmt->closeCursor(); - } - catch (Exception $e) - { - - } - } - - - $layoutmode = $user->getPrefs('view'); - - if ($statOk) - { - $record = new record_adapter($row["sbas_id"], $row["record_id"]); - $sbas_id = phrasea::sbasFromBas($row['base_id']); - - $captionXML = $record->get_xml(); - - $thumbnail = $record->get_thumbnail(); - - $title = $record->get_title(); - $exifinfos = $record->get_technical_infos(); - $caption = $twig->render('common/caption.html', array('view' => 'internal_publi', 'record' => $record)); - - $o++; - $itemIsOk = true; - $bottom = 0; - $right = 10; - $left = 0; - $top = 10; - - - if (trim($preview) != '') - $preview = "
 "; - - $docType = $record->get_type(); - $isVideo = ($docType == 'video'); - $isAudio = ($docType == 'audio'); - $isImage = ($docType == 'image'); - $isDocument = ($docType == 'document'); - - $duration = ''; - - if (!$isVideo && !$isAudio) - $isImage = true; - - if ($isVideo) - { - $duration = $record->get_formated_duration(); - if ($duration != '') - $duration = '
' . $duration . '
'; - } - if ($isAudio) - { - $duration = $record->get_formated_duration(); - if ($duration != '') - $duration = '
' . $duration . '
'; - } - - - $ratio = $thumbnail->get_width() / $thumbnail->get_height(); - - if ($ratio > 1) - { - $cw = min(((int) $th_size - 30), $thumbnail->get_width()); - $ch = $cw / $ratio; - $pv = floor(($th_size - $ch) / 2); - $ph = floor(($th_size - $cw) / 2); - $imgStyle = 'xwidth:' . $cw . 'px;xpadding:' . $pv . 'px ' . $ph . 'px;'; - } - else - { - $ch = min(((int) $th_size - 30), $thumbnail->get_height()); - $cw = $ch * $ratio; - - $pv = floor(($th_size - $ch) / 2); - $ph = floor(($th_size - $cw) / 2); - - $imgStyle = 'xheight:' . $ch . 'px;xpadding:' . $pv . 'px ' . $ph . 'px;'; - } - - - - $ident = $row["base_id"] . "_" . $row["record_id"]; - - - $out .= "
"; - - $out .= '
'; - $out .= "
"; - - $out .= $title; //$data['title']; - - $out .= "
\n"; - - $out .= '
'; - - $out .= "\n
"; - - $out .= $duration . "get_url() . "\" style=\"" . $imgStyle . "\" />"; - - $out .= "
"; - - $out .= '
'; - $out .= ''; - $out .= ''; - $out .= '\n"; - - $out .= ""; - $out .= ""; - $out .= "
'; - - $out .= "\n"; - - $out .= $preview; - - $out .= "
"; - $out .= "
"; - - - $out .= "
"; - } -} - -if (isset($item)) -{ - $item .= '
' . $out; - $item .= '
' . - '
'; - if ($itemIsOk) - $feed .= $item; -} - -echo '
' . $feed . '
'; - -$sql = 'DELETE FROM sselnew WHERE usr_id = :usr_id AND ssel_id IN (SELECT ssel_id FROM ssel WHERE public="1")'; -$stmt = $conn->prepare($sql); -$stmt->execute(array(':usr_id' => $usr_id)); -$stmt->closeCursor(); +//$Core = \bootstrap::getCore(); +//$appbox = appbox::get_instance($Core); +//$session = $appbox->get_session(); +// +//$th_size = $user->getPrefs('images_size'); +// +//$user = $Core->getAuthenticatedUser(); +// +//$RN = array("\r\n", "\n", "\r"); +// +//$conn = $appbox->get_connection(); +// +//$sql = 'SELECT s.public, s.pub_restrict,c.sselcont_id, c.base_id, sb.*, c.record_id, s.ssel_id, s.name, s.descript, c.ord, ' . +// 'DATE_FORMAT(s.pub_date,"' . _('phraseanet::technique::datetime') . '") AS pub_date, ' . +// 'DATE_FORMAT(s.updater,"' . _('phraseanet::technique::date') . '") AS updater, ' . +// 's.updater as dateC1, s.pub_date as dateC2,' . +// ' n.id, u.usr_nom, u.usr_prenom, u.usr_login, u.usr_mail ' . +// ', bu.mask_and ' . +// ', bu.mask_xor ' . +// 'FROM (sselcont c, ssel s, usr u, bas b, sbas sb) ' . +// 'LEFT JOIN sselnew n ' . +// 'ON (n.ssel_id = s.ssel_id AND n.usr_id = :usr_id) ' . +// ' LEFT JOIN basusr bu ON (bu.base_id = b.base_id AND bu.usr_id = :usr_id_bis)' . +// 'WHERE s.ssel_id = c.ssel_id AND s.public="1" ' . +// 'AND (s.pub_restrict="0" ' . +// 'OR (s.pub_restrict="1" AND c.base_id IN ' . +// ' (SELECT base_id FROM basusr WHERE usr_id = :usr_id_sub AND actif = "1")))' . +// ' AND u.usr_id = s.usr_id AND temporaryType=0 ' . +// ' AND b.sbas_id = sb.sbas_id' . +// ' AND b.base_id = c.base_id' . +// ' ORDER BY s.pub_date DESC, c.ord ASC'; +// +//$sqlMe = 'SELECT usr_login, usr_password FROM usr WHERE usr_id = :usr_id'; +// +//$stmt = $conn->prepare($sqlMe); +//$stmt->execute(array(':usr_id' => $session->get_usr_id())); +//$rawMe = $stmt->fetch(PDO::FETCH_ASSOC); +//$stmt->closeCursor(); +// +//$info_usr = null; +// +//if ($rawMe) +//{ +// $info_usr = $rawMe; +//} +// +//$core = \bootstrap::getCore(); +//$twig = $core->getTwig(); +// +//$stmt = $conn->prepare($sql); +//$usr_id = $session->get_usr_id(); +//$stmt->execute(array(':usr_id' => $usr_id, ':usr_id_bis' => $usr_id, ':usr_id_sub' => $usr_id)); +//$rs = $stmt->fetchAll(PDO::FETCH_ASSOC); +//$stmt->closeCursor(); +// +//$sselid = null; +//$o = 0; +//$out = ''; +// +//$feed = ''; +//$feed .= '
' . +// '

' . _('publications:: dernieres publications') . '

' . +// '
'; +// +//foreach ($rs as $row) +//{ +// if ($row['ssel_id'] != $sselid) +// { +// if ($sselid !== null) +// { +// +// +// +// $item .= '
' . $out; +// $item .= '
' . +// ''; +// +// if ($itemIsOk) +// $feed .= $item; +// } +// +// $itemIsOk = false; +// +// $sselid = $row['ssel_id']; +// $ord = $row['ord']; +// $o = 0; +// $out = ''; +// $neverSeen = ''; +// $publisher = $row['usr_prenom'] . ' ' . $row['usr_nom']; +// if ($publisher == ' ') +// $publisher = $row['usr_mail']; +// if ($publisher == '') +// $publisher = 'Unreferenced user'; +// +// if ($row['id'] != '') +// $neverSeen = _('publications:: publication non lue'); +// +// $item = ''; +// $item .= '
' . +// '
' . +// '

' . +// '' . $row['name'] . +// ' ' . $neverSeen . '

' . +// '' . +// ' ' . $row['pub_date'] . +// ' '; +// +// if ($row['usr_mail'] != '') +// $item .= ''; +// +// $item .= $publisher; +// +// if ($row['usr_mail'] != '') +// $item .= ''; +// +// if ($row['dateC1'] != $row['dateC2']) +// $item .= '
' . _('publications:: derniere mise a jour') . ' ' . $row['updater'] . '

'; +// +// $item .= '
'; +// +// +// if (trim(str_replace($RN, '', $row['descript'])) != '') +// { +// $row['descript'] = str_replace($RN, '
', $row['descript']); +// $item .= '' . $row['descript']; +// } +// $item .= '
'; +// } +// +// +// +// +// +// $ord = $row['ord']; +// $statOk = true; +// if ($row['public'] == 1 && $row['pub_restrict'] == 1) +// { +// $statOk = false; +// +// try +// { +// $connsbas = connection::getPDOConnection($row['sbas_id']); +// +// $sql = 'SELECT record_id FROM record WHERE ((status ^ ' . $row['mask_xor'] . ') & ' . $row['mask_and'] . ')=0 +// AND record_id = :record_id'; +// $stmt = $connsbas->prepare($sql); +// $stmt->execute(array(':record_id' => $row['record_id'])); +// $statOk = ($stmt->rowCount() > 0); +// $stmt->closeCursor(); +// } +// catch (Exception $e) +// { +// +// } +// } +// +// +// $layoutmode = $user->getPrefs('view'); +// +// if ($statOk) +// { +// $record = new record_adapter($row["sbas_id"], $row["record_id"]); +// $sbas_id = phrasea::sbasFromBas($row['base_id']); +// +// $captionXML = $record->get_xml(); +// +// $thumbnail = $record->get_thumbnail(); +// +// $title = $record->get_title(); +// $exifinfos = $record->get_technical_infos(); +// $caption = $twig->render('common/caption.html', array('view' => 'internal_publi', 'record' => $record)); +// +// $o++; +// $itemIsOk = true; +// $bottom = 0; +// $right = 10; +// $left = 0; +// $top = 10; +// +// +// if (trim($preview) != '') +// $preview = "
 "; +// +// $docType = $record->get_type(); +// $isVideo = ($docType == 'video'); +// $isAudio = ($docType == 'audio'); +// $isImage = ($docType == 'image'); +// $isDocument = ($docType == 'document'); +// +// $duration = ''; +// +// if (!$isVideo && !$isAudio) +// $isImage = true; +// +// if ($isVideo) +// { +// $duration = $record->get_formated_duration(); +// if ($duration != '') +// $duration = '
' . $duration . '
'; +// } +// if ($isAudio) +// { +// $duration = $record->get_formated_duration(); +// if ($duration != '') +// $duration = '
' . $duration . '
'; +// } +// +// +// $ratio = $thumbnail->get_width() / $thumbnail->get_height(); +// +// if ($ratio > 1) +// { +// $cw = min(((int) $th_size - 30), $thumbnail->get_width()); +// $ch = $cw / $ratio; +// $pv = floor(($th_size - $ch) / 2); +// $ph = floor(($th_size - $cw) / 2); +// $imgStyle = 'xwidth:' . $cw . 'px;xpadding:' . $pv . 'px ' . $ph . 'px;'; +// } +// else +// { +// $ch = min(((int) $th_size - 30), $thumbnail->get_height()); +// $cw = $ch * $ratio; +// +// $pv = floor(($th_size - $ch) / 2); +// $ph = floor(($th_size - $cw) / 2); +// +// $imgStyle = 'xheight:' . $ch . 'px;xpadding:' . $pv . 'px ' . $ph . 'px;'; +// } +// +// +// +// $ident = $row["base_id"] . "_" . $row["record_id"]; +// +// +// $out .= "
"; +// +// $out .= '
'; +// $out .= "
"; +// +// $out .= $title; //$data['title']; +// +// $out .= "
\n"; +// +// $out .= '
'; +// +// $out .= "\n
"; +// +// $out .= $duration . "get_url() . "\" style=\"" . $imgStyle . "\" />"; +// +// $out .= "
"; +// +// $out .= '
'; +// $out .= ''; +// $out .= ''; +// $out .= '\n"; +// +// $out .= ""; +// $out .= ""; +// $out .= "
'; +// +// $out .= "\n"; +// +// $out .= $preview; +// +// $out .= "
"; +// $out .= "
"; +// +// +// $out .= "
"; +// } +//} +// +//if (isset($item)) +//{ +// $item .= '
' . $out; +// $item .= '
' . +// '
'; +// if ($itemIsOk) +// $feed .= $item; +//} +// +//echo '
' . $feed . '
'; +// +//$sql = 'DELETE FROM sselnew WHERE usr_id = :usr_id AND ssel_id IN (SELECT ssel_id FROM ssel WHERE public="1")'; +//$stmt = $conn->prepare($sql); +//$stmt->execute(array(':usr_id' => $usr_id)); +//$stmt->closeCursor(); From 0cd55b289f0de7c0f3e6353e328f750b0bf76395 Mon Sep 17 00:00:00 2001 From: Nicolas Le Goff Date: Tue, 28 Feb 2012 15:31:53 +0100 Subject: [PATCH 007/159] =?UTF-8?q?fix=20#463=20Erreur=20nombre=20de=20t?= =?UTF-8?q?=C3=A9l=C3=A9chargement=20dans=20Report?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/classes/module/report/activity.class.php | 39 +++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/lib/classes/module/report/activity.class.php b/lib/classes/module/report/activity.class.php index 368b34dadb..6d6276f742 100644 --- a/lib/classes/module/report/activity.class.php +++ b/lib/classes/module/report/activity.class.php @@ -479,7 +479,7 @@ class module_report_activity extends module_report * @param string $on choose the field on what you want the result * @return array */ - public function getConnexionBase($tab = false, $on= "") + public function getConnexionBase($tab = false, $on = "") { //default group on user column if (empty($on)) @@ -577,7 +577,7 @@ class module_report_activity extends module_report * @param array $tab config for the html table * @return array */ - public function getDetailDownload($tab = false, $on="") + public function getDetailDownload($tab = false, $on = "") { empty($on) ? $on = "user" : ""; //by default always report on user @@ -639,18 +639,21 @@ class module_report_activity extends module_report { $user = $row[$on]; if (($save_user != $user) && !is_null($user)) + { $i++; + + $this->result[$i]['nbprev'] = 0; + $this->result[$i]['poidprev'] = 0; + $this->result[$i]['nbdoc'] = 0; + $this->result[$i]['poiddoc'] = 0; + } + //doc info if ($row['final'] == 'document' && !is_null($user) && !is_null($row['usrid'])) { $this->result[$i]['nbdoc'] = (!is_null($row['nb']) ? $row['nb'] : 0); - $this->result[$i]['poiddoc'] = (!is_null($row['poid']) ? - p4string::format_octets($row['poid']) : 0); - if (!isset($this->result[$i]['nbprev'])) - $this->result[$i]['nbprev'] = 0; - if (!isset($this->result[$i]['poidprev'])) - $this->result[$i]['poidprev'] = 0; + $this->result[$i]['poiddoc'] = (!is_null($row['poid']) ? $row['poid'] : 0); $this->result[$i]['user'] = empty($row[$on]) ? "" . _('report:: non-renseigne') . "" : $row[$on]; $total['nbdoc'] += $this->result[$i]['nbdoc']; @@ -658,26 +661,26 @@ class module_report_activity extends module_report $this->result[$i]['usrid'] = $row['usrid']; } //preview info - if ($row['final'] == 'preview' && + if (($row['final'] == 'preview' || $row['final'] == 'thumbnail') && !is_null($user) && !is_null($row['usrid'])) { - if (!isset($this->result[$i]['nbdoc'])) - $this->result[$i]['nbdoc'] = 0; - if (!isset($this->result[$i]['poiddoc'])) - $this->result[$i]['poiddoc'] = 0; - $this->result[$i]['nbprev'] = (!is_null($row['nb']) ? $row['nb'] : 0); - $this->result[$i]['poidprev'] = (!is_null($row['poid']) ? - p4string::format_octets($row['poid']) : 0); + + $this->result[$i]['nbprev'] += (!is_null($row['nb']) ? $row['nb'] : 0); + $this->result[$i]['poidprev'] += (!is_null($row['poid']) ? $row['poid'] : 0); + $this->result[$i]['user'] = empty($row[$on]) ? "" . _('report:: non-renseigne') . "" : $row[$on]; - $total['nbprev'] += $this->result[$i]['nbprev']; + $total['nbprev'] += (!is_null($row['nb']) ? $row['nb'] : 0); $total['poidprev'] += (!is_null($row['poid']) ? $row['poid'] : 0); $this->result[$i]['usrid'] = $row['usrid']; } $save_user = $user; } + $this->result[$i]['poiddoc'] = p4string::format_octets($this->result[$i]['poiddoc']); + $this->result[$i]['poidprev'] = p4string::format_octets($this->result[$i]['poidprev']); + $nb_row = $i + 1; $this->total = $nb_row; @@ -756,7 +759,7 @@ class module_report_activity extends module_report } catch (Exception $e) { - + } } elseif ($value == "size") From 2412c41553c8bd3e1c68e5ca2a1a5a4b73821bb0 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Tue, 28 Feb 2012 16:02:58 +0100 Subject: [PATCH 008/159] GFix client publications --- lib/Alchemy/Phrasea/Controller/Prod/Query.php | 2 - www/client/answer.php | 3 +- www/client/homeinterpubbask.php | 467 +++++++----------- www/include/js/jquery.Selection.js | 6 + 4 files changed, 182 insertions(+), 296 deletions(-) diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Query.php b/lib/Alchemy/Phrasea/Controller/Prod/Query.php index b631e76e57..c43e56f6ee 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Query.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Query.php @@ -205,11 +205,9 @@ class Query implements ControllerProviderInterface } } - $json['results'] = $twig->render($template, array( 'results' => $result, 'GV_social_tools' => $registry->get('GV_social_tools'), - 'array_selected' => explode(';', $request->get('sel')), 'highlight' => $search_engine->get_query(), 'searchEngine' => $search_engine, 'suggestions' => $prop diff --git a/www/client/answer.php b/www/client/answer.php index c7b46ed416..023bcf8434 100644 --- a/www/client/answer.php +++ b/www/client/answer.php @@ -16,8 +16,9 @@ */ /* @var $Core \Alchemy\Phrasea\Core */ -$Core = require_once __DIR__ . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; +$Core= \bootstrap::getCore(); $appbox = appbox::get_instance($Core); $session = $appbox->get_session(); $registry = $appbox->get_registry(); diff --git a/www/client/homeinterpubbask.php b/www/client/homeinterpubbask.php index 02df8a87a8..1823d78f79 100644 --- a/www/client/homeinterpubbask.php +++ b/www/client/homeinterpubbask.php @@ -1,5 +1,4 @@ get_session(); -// -//$th_size = $user->getPrefs('images_size'); -// -//$user = $Core->getAuthenticatedUser(); -// -//$RN = array("\r\n", "\n", "\r"); -// -//$conn = $appbox->get_connection(); -// -//$sql = 'SELECT s.public, s.pub_restrict,c.sselcont_id, c.base_id, sb.*, c.record_id, s.ssel_id, s.name, s.descript, c.ord, ' . -// 'DATE_FORMAT(s.pub_date,"' . _('phraseanet::technique::datetime') . '") AS pub_date, ' . -// 'DATE_FORMAT(s.updater,"' . _('phraseanet::technique::date') . '") AS updater, ' . -// 's.updater as dateC1, s.pub_date as dateC2,' . -// ' n.id, u.usr_nom, u.usr_prenom, u.usr_login, u.usr_mail ' . -// ', bu.mask_and ' . -// ', bu.mask_xor ' . -// 'FROM (sselcont c, ssel s, usr u, bas b, sbas sb) ' . -// 'LEFT JOIN sselnew n ' . -// 'ON (n.ssel_id = s.ssel_id AND n.usr_id = :usr_id) ' . -// ' LEFT JOIN basusr bu ON (bu.base_id = b.base_id AND bu.usr_id = :usr_id_bis)' . -// 'WHERE s.ssel_id = c.ssel_id AND s.public="1" ' . -// 'AND (s.pub_restrict="0" ' . -// 'OR (s.pub_restrict="1" AND c.base_id IN ' . -// ' (SELECT base_id FROM basusr WHERE usr_id = :usr_id_sub AND actif = "1")))' . -// ' AND u.usr_id = s.usr_id AND temporaryType=0 ' . -// ' AND b.sbas_id = sb.sbas_id' . -// ' AND b.base_id = c.base_id' . -// ' ORDER BY s.pub_date DESC, c.ord ASC'; -// -//$sqlMe = 'SELECT usr_login, usr_password FROM usr WHERE usr_id = :usr_id'; -// -//$stmt = $conn->prepare($sqlMe); -//$stmt->execute(array(':usr_id' => $session->get_usr_id())); -//$rawMe = $stmt->fetch(PDO::FETCH_ASSOC); -//$stmt->closeCursor(); -// -//$info_usr = null; -// -//if ($rawMe) -//{ -// $info_usr = $rawMe; -//} -// -//$core = \bootstrap::getCore(); -//$twig = $core->getTwig(); -// -//$stmt = $conn->prepare($sql); -//$usr_id = $session->get_usr_id(); -//$stmt->execute(array(':usr_id' => $usr_id, ':usr_id_bis' => $usr_id, ':usr_id_sub' => $usr_id)); -//$rs = $stmt->fetchAll(PDO::FETCH_ASSOC); -//$stmt->closeCursor(); -// -//$sselid = null; -//$o = 0; -//$out = ''; -// -//$feed = ''; -//$feed .= '
' . -// '

' . _('publications:: dernieres publications') . '

' . -// '
'; -// -//foreach ($rs as $row) -//{ -// if ($row['ssel_id'] != $sselid) -// { -// if ($sselid !== null) -// { -// -// -// -// $item .= '
' . $out; -// $item .= '
' . -// ''; -// -// if ($itemIsOk) -// $feed .= $item; -// } -// -// $itemIsOk = false; -// -// $sselid = $row['ssel_id']; -// $ord = $row['ord']; -// $o = 0; -// $out = ''; -// $neverSeen = ''; -// $publisher = $row['usr_prenom'] . ' ' . $row['usr_nom']; -// if ($publisher == ' ') -// $publisher = $row['usr_mail']; -// if ($publisher == '') -// $publisher = 'Unreferenced user'; -// -// if ($row['id'] != '') -// $neverSeen = _('publications:: publication non lue'); -// -// $item = ''; -// $item .= '
' . -// '
' . -// '

' . -// '' . $row['name'] . -// ' ' . $neverSeen . '

' . -// '' . -// ' ' . $row['pub_date'] . -// ' '; -// -// if ($row['usr_mail'] != '') -// $item .= ''; -// -// $item .= $publisher; -// -// if ($row['usr_mail'] != '') -// $item .= ''; -// -// if ($row['dateC1'] != $row['dateC2']) -// $item .= '
' . _('publications:: derniere mise a jour') . ' ' . $row['updater'] . '

'; -// -// $item .= '
'; -// -// -// if (trim(str_replace($RN, '', $row['descript'])) != '') -// { -// $row['descript'] = str_replace($RN, '
', $row['descript']); -// $item .= '' . $row['descript']; -// } -// $item .= '
'; -// } -// -// -// -// -// -// $ord = $row['ord']; -// $statOk = true; -// if ($row['public'] == 1 && $row['pub_restrict'] == 1) -// { -// $statOk = false; -// -// try -// { -// $connsbas = connection::getPDOConnection($row['sbas_id']); -// -// $sql = 'SELECT record_id FROM record WHERE ((status ^ ' . $row['mask_xor'] . ') & ' . $row['mask_and'] . ')=0 -// AND record_id = :record_id'; -// $stmt = $connsbas->prepare($sql); -// $stmt->execute(array(':record_id' => $row['record_id'])); -// $statOk = ($stmt->rowCount() > 0); -// $stmt->closeCursor(); -// } -// catch (Exception $e) -// { -// -// } -// } -// -// -// $layoutmode = $user->getPrefs('view'); -// -// if ($statOk) -// { -// $record = new record_adapter($row["sbas_id"], $row["record_id"]); -// $sbas_id = phrasea::sbasFromBas($row['base_id']); -// -// $captionXML = $record->get_xml(); -// -// $thumbnail = $record->get_thumbnail(); -// -// $title = $record->get_title(); -// $exifinfos = $record->get_technical_infos(); -// $caption = $twig->render('common/caption.html', array('view' => 'internal_publi', 'record' => $record)); -// -// $o++; -// $itemIsOk = true; -// $bottom = 0; -// $right = 10; -// $left = 0; -// $top = 10; -// -// -// if (trim($preview) != '') -// $preview = "
 "; -// -// $docType = $record->get_type(); -// $isVideo = ($docType == 'video'); -// $isAudio = ($docType == 'audio'); -// $isImage = ($docType == 'image'); -// $isDocument = ($docType == 'document'); -// -// $duration = ''; -// -// if (!$isVideo && !$isAudio) -// $isImage = true; -// -// if ($isVideo) -// { -// $duration = $record->get_formated_duration(); -// if ($duration != '') -// $duration = '
' . $duration . '
'; -// } -// if ($isAudio) -// { -// $duration = $record->get_formated_duration(); -// if ($duration != '') -// $duration = '
' . $duration . '
'; -// } -// -// -// $ratio = $thumbnail->get_width() / $thumbnail->get_height(); -// -// if ($ratio > 1) -// { -// $cw = min(((int) $th_size - 30), $thumbnail->get_width()); -// $ch = $cw / $ratio; -// $pv = floor(($th_size - $ch) / 2); -// $ph = floor(($th_size - $cw) / 2); -// $imgStyle = 'xwidth:' . $cw . 'px;xpadding:' . $pv . 'px ' . $ph . 'px;'; -// } -// else -// { -// $ch = min(((int) $th_size - 30), $thumbnail->get_height()); -// $cw = $ch * $ratio; -// -// $pv = floor(($th_size - $ch) / 2); -// $ph = floor(($th_size - $cw) / 2); -// -// $imgStyle = 'xheight:' . $ch . 'px;xpadding:' . $pv . 'px ' . $ph . 'px;'; -// } -// -// -// -// $ident = $row["base_id"] . "_" . $row["record_id"]; -// -// -// $out .= "
"; -// -// $out .= '
'; -// $out .= "
"; -// -// $out .= $title; //$data['title']; -// -// $out .= "
\n"; -// -// $out .= '
'; -// -// $out .= "\n
"; -// -// $out .= $duration . "get_url() . "\" style=\"" . $imgStyle . "\" />"; -// -// $out .= "
"; -// -// $out .= '
'; -// $out .= ''; -// $out .= ''; -// $out .= '\n"; -// -// $out .= ""; -// $out .= ""; -// $out .= "
'; -// -// $out .= "\n"; -// -// $out .= $preview; -// -// $out .= "
"; -// $out .= "
"; -// -// -// $out .= "
"; -// } -//} -// -//if (isset($item)) -//{ -// $item .= '
' . $out; -// $item .= '
' . -// '
'; -// if ($itemIsOk) -// $feed .= $item; -//} -// -//echo '
' . $feed . '
'; -// -//$sql = 'DELETE FROM sselnew WHERE usr_id = :usr_id AND ssel_id IN (SELECT ssel_id FROM ssel WHERE public="1")'; -//$stmt = $conn->prepare($sql); -//$stmt->execute(array(':usr_id' => $usr_id)); -//$stmt->closeCursor(); +$Core = \bootstrap::getCore(); +$appbox = appbox::get_instance($Core); + +$user = $Core->getAuthenticatedUser(); + +$feeds = \Feed_Collection::load_all($appbox, $user); + + +$th_size = $user->getPrefs('images_size'); + +$core = \bootstrap::getCore(); +$twig = $core->getTwig(); +?> +
+

+

+
+ +
+ +get_aggregate()->get_entries(0, 5)->get_entries() as $entry) +{ + /* @var $entry \Feed_Entry_Adapter */ + + $feed .= '
' . + '
' . + '

' . + '' + . $entry->get_title() . + '

' . + '' . + ' ' . \phraseadate::getPrettyString($entry->get_created_on()) . + ' '; + + if ($entry->get_author_email()) + $feed .= ''; + + $feed .= $entry->get_author_name(); + + if ($entry->get_author_email()) + $feed .= ''; + + if ($entry->get_updated_on() > $entry->get_created_on()) + $feed .= '
' . _('publications:: derniere mise a jour') + . ' ' . \phraseadate::getPrettyString($entry->get_updated_on()) . '

'; + + $feed .= '
'; + + + if (trim($entry->get_subtitle()) != '') + { + $feed .= '' . nl2br($entry->get_subtitle()); + } + $feed .= '
'; + + $feed .= '
'; + + + + + + + foreach ($entry->get_content() as $Feed_item) + { + /* @var $Feed_item \Feed_Entry_Item */ + $record = $Feed_item->get_record(); + + $thumbnail = $record->get_thumbnail(); + + $title = $record->get_title(); + $caption = $twig->render( + 'common/caption.html', array('view' => 'internal_publi', 'record' => $record) + ); + + $preview = "
 "; + + $docType = $record->get_type(); + $isVideo = ($docType == 'video'); + $isAudio = ($docType == 'audio'); + $isImage = ($docType == 'image'); + + $duration = ''; + + if (!$isVideo && !$isAudio) + $isImage = true; + + if ($isVideo) + { + $duration = $record->get_formated_duration(); + if ($duration != '') + $duration = '
' . $duration . '
'; + } + if ($isAudio) + { + $duration = $record->get_formated_duration(); + if ($duration != '') + $duration = '
' . $duration . '
'; + } + + + $ratio = $thumbnail->get_width() / $thumbnail->get_height(); + + if ($ratio > 1) + { + $cw = min(((int) $th_size - 30), $thumbnail->get_width()); + $ch = $cw / $ratio; + $pv = floor(($th_size - $ch) / 2); + $ph = floor(($th_size - $cw) / 2); + $imgStyle = 'width:' . $cw . 'px;xpadding:' . $pv . 'px ' . $ph . 'px;'; + } + else + { + $ch = min(((int) $th_size - 30), $thumbnail->get_height()); + $cw = $ch * $ratio; + + $pv = floor(($th_size - $ch) / 2); + $ph = floor(($th_size - $cw) / 2); + + $imgStyle = 'height:' . $ch . 'px;xpadding:' . $pv . 'px ' . $ph . 'px;'; + } + + $feed .= "
get_sbas_id() . "\" + id='IMGT_" . $record->get_serialize_key() . "_PUB_" . $entry->get_id() + . "' class='IMGT diapo' + onclick=\"openPreview('FEED','" . $Feed_item->get_ord() . "','" . $entry->get_id() . "');\">"; + + $feed .= '
'; + $feed .= "
"; + + $feed .= $title; + + $feed .= "
\n"; + + $feed .= '
'; + + $feed .= "\n
"; + + $feed .= $duration . "get_url() . "\" style=\"" . $imgStyle . "\" />"; + + $feed .= "
"; + + $feed .= '
'; + $feed .= ''; + $feed .= ''; + $feed .= '\n"; + + $feed .= ""; + $feed .= ""; + $feed .= "
'; + + $feed .= "\n"; + + $feed .= $preview; + + $feed .= "
"; + $feed .= "
"; + + + $feed .= "
"; + } + $feed .= '
' . + '
'; +} + +echo '
' . $feed . '
'; + diff --git a/www/include/js/jquery.Selection.js b/www/include/js/jquery.Selection.js index e2d7dbaaca..9297746494 100644 --- a/www/include/js/jquery.Selection.js +++ b/www/include/js/jquery.Selection.js @@ -218,10 +218,16 @@ return this.datas; }, empty : function(){ + var $this = this; this.datas = new Array(); jQuery(this.options.selector, this.$container).filter('.selected:visible').removeClass('selected'); + if(typeof $this.options.selectStop === 'function') + { + $this.options.selectStop(jQuery.Event('selectStop'), $this); + } + return this; }, length : function(){ From 69fec3d36042fec8663bd0415a07fc8bc192bbff Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Tue, 28 Feb 2012 16:06:57 +0100 Subject: [PATCH 009/159] Fix page selection --- www/prod/page0.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/www/prod/page0.js b/www/prod/page0.js index 257d51de21..638927f31a 100644 --- a/www/prod/page0.js +++ b/www/prod/page0.js @@ -320,7 +320,6 @@ function resize(){ function clearAnswers(){ $('#formAnswerPage').val(''); - $('#searchForm input[name="sel"]').val(''); $('#searchForm input[name="nba"]').val(''); $('#answers, #dyn_tool').empty(); } @@ -346,6 +345,7 @@ function newSearch() { console.log('Fresh new search, cache empty'); } + p4.Results.Selection.empty() clearAnswers(); var val = $('#searchForm input[name="qry"]').val(); @@ -475,11 +475,14 @@ function initAnswerForm(){ success: function(datas){ - $('#answers').empty().append(datas.results).removeClass('loading'); $('#tool_results').empty().append(datas.infos); $('#tool_navigate').empty().append(datas.navigation); + $.each(p4.Results.Selection.get(), function(i, el){ + $('#IMGT_' + el).addClass('selected'); + }); + $('#proposals').empty().append(datas.phrasea_props); if($.trim(datas.phrasea_props) !== '') From a2ae5d395e1b50d87c827e90cdb9b4e15e1146f4 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Tue, 28 Feb 2012 16:18:12 +0100 Subject: [PATCH 010/159] Fix client --- www/client/answer.php | 143 ++++++++++++++++++++++-------------------- www/client/index.php | 54 ++++------------ 2 files changed, 88 insertions(+), 109 deletions(-) diff --git a/www/client/answer.php b/www/client/answer.php index 023bcf8434..0d14567ccc 100644 --- a/www/client/answer.php +++ b/www/client/answer.php @@ -14,35 +14,34 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ - /* @var $Core \Alchemy\Phrasea\Core */ require_once __DIR__ . "/../../lib/bootstrap.php"; -$Core= \bootstrap::getCore(); -$appbox = appbox::get_instance($Core); -$session = $appbox->get_session(); +$Core = \bootstrap::getCore(); +$appbox = appbox::get_instance($Core); +$session = $appbox->get_session(); $registry = $appbox->get_registry(); -$user = $Core->getAuthenticatedUser(); +$user = $Core->getAuthenticatedUser(); if (!isset($parm)) { $request = http_request::getInstance(); - $parm = $request->get_parms("mod", "bas" - , "pag" - , "qry", "search_type", "recordtype" - , "qryAdv", 'opAdv', 'status', 'datemin', 'datemax' - , 'dateminfield', 'datemaxfield' - , 'datefield' - , 'sort' - , 'stemme' - , 'infield' - , "nba" - , "regroup" // si rech par doc, regroup ,ou pizza - , "ord" + $parm = $request->get_parms("mod", "bas" + , "pag" + , "qry", "search_type", "recordtype" + , "qryAdv", 'opAdv', 'status', 'datemin', 'datemax' + , 'dateminfield', 'datemaxfield' + , 'datefield' + , 'sort' + , 'stemme' + , 'infield' + , "nba" + , "regroup" // si rech par doc, regroup ,ou pizza + , "ord" ); } -$qry = ''; +$qry = ''; if (trim($parm['qry']) != '') { @@ -88,7 +87,7 @@ else $mod_row = (int) ($mod[0]); $mod_col = (int) ($mod[1]); } -$mod_xy = $mod_col * $mod_row; +$mod_xy = $mod_col * $mod_row; $tbases = array(); @@ -102,9 +101,9 @@ $options->set_bases($parm['bas'], $user->ACL()); if (!is_array($parm['infield'])) $parm['infield'] = array(); -foreach($parm['infield'] as $offset=>$value) +foreach ($parm['infield'] as $offset => $value) { - if(trim($value) === '') + if (trim($value) === '') unset($parm['infield'][$offset]); } @@ -162,8 +161,8 @@ if ($registry->get('GV_thesaurus')) if ($registry->get('GV_clientAutoShowProposals')) { ?> - if("proposals), "JS") ?>" != "
") - chgOng(4); + if("proposals), "JS") ?>" != "
") + chgOng(4); @@ -178,14 +177,14 @@ $history = queries::history(); echo ''; $nbanswers = $result->get_count_available_results(); -$longueur = strlen($parm['qry']); +$longueur = strlen($parm['qry']); $qrys = '
' . _('client::answers: rapport de questions par bases') . '
'; foreach ($qrySbas as $sbas => $qryBas) $qrys .= '
' . phrasea::sbas_names($sbas) . '
' . $qryBas . '
'; -$txt = "" . substr($parm['qry'], 0, 36) . ($longueur > 36 ? "..." : "") . "" . sprintf(_('client::answers: %d reponses'), (int) $nbanswers) . "  "; +$txt = "" . substr($parm['qry'], 0, 36) . ($longueur > 36 ? "..." : "") . "" . sprintf(_('client::answers: %d reponses'), (int) $nbanswers) . "  "; ?> get_total_pages(); -$pages = ''; -$ecart = 3; -$max = (2 * $ecart) + 3; +$pages = ''; +$ecart = 3; +$max = (2 * $ecart) + 3; if ($npages > $max) { - for ($p = 1; $p < $npages; $p++) + for ($p = 1; $p <= $npages; $p++) { if ($p == $page) $pages .= '' . ($p) . ''; @@ -217,23 +216,23 @@ if ($npages > $max) $pages .= '' . ($p) . '...'; if (($p == $page) - || ( ( $p >= ($page - $ecart) ) && ( $p <= ($page + $ecart) )) - || ( ($page < ($ecart + 2)) && ($p < ($max - $ecart + 2) ) ) - || ( ($page >= ($npages - $ecart - 2)) && ($p >= ($npages - (2 * $ecart) - 2) ) ) - || ( $p == 0) + || ( ( $p >= ($page - $ecart) ) && ( $p <= ($page + $ecart) )) + || ( ($page < ($ecart + 2)) && ($p < ($max - $ecart + 2) ) ) + || ( ($page >= ($npages - $ecart - 2)) && ($p >= ($npages - (2 * $ecart) - 2) ) ) + || ( $p == 0) ) $pages .= ' - '; } } else { - for ($p = 1; $p < $npages; $p++) + for ($p = 1; $p <= $npages; $p++) { if ($p == $page) $pages .= '' . ($p) . ''; else $pages .= '' . ($p) . ''; - if ($p < $npages) + if ($p < $npages) $pages .= ' - '; } } @@ -251,30 +250,29 @@ $string2.= ''; if ($page != 0 && $nbanswers) { ?> - $("#PREV_PAGE").bind('click',function(){gotopage()}); + $("#PREV_PAGE").bind('click',function(){gotopage()}); - $("#PREV_PAGE").unbind('click'); + $("#PREV_PAGE").unbind('click'); - $("#NEXT_PAGE").bind('click',function(){gotopage()}); + $("#NEXT_PAGE").bind('click',function(){gotopage()}); - $("#NEXT_PAGE").unbind('click'); + $("#NEXT_PAGE").unbind('click'); -}); + }); get_datas()) > 0) $docType = $record->get_type(); $title = $record->get_title(); - $light_info = $twig->render('common/technical_datas.twig', array('record' => $record)); - $caption = $twig->render('common/caption.html', array('view' => 'answer', 'record' => $record)); + + try + { + $record->get_subdef('document'); + $light_info = $twig->render('common/technical_datas.twig', array('record' => $record)); + } + catch (\Exception $e) + { + $light_info = ''; + } + $caption = $twig->render('common/caption.html', array('view' => 'answer', 'record' => $record)); if ($i == 0) @@ -345,8 +352,6 @@ if (count($result->get_datas()) > 0) } ?>
'; $status .= $record->get_status_icons(); @@ -354,21 +359,20 @@ if (count($result->get_datas()) > 0) echo $status; - $isVideo = ($docType == 'video'); - $isAudio = ($docType == 'audio'); - $isImage = ($docType == 'image'); + $isVideo = ($docType == 'video'); + $isAudio = ($docType == 'audio'); + $isImage = ($docType == 'image'); $isDocument = ($docType == 'document'); $sd = $record->get_subdefs(); - $isImage = false; + $isImage = false; $isDocument = false; if (!$isVideo && !$isAudio) { $isImage = true; } - ?>
get_datas()) > 0) $pic_roll = str_replace(array('&', '"'), array('&', '"'), $pic_roll); ?> + { + ?>height:128px;" onclick="" class=" captionTips" id="IMGget_base_id() ?>_get_record_id() ?>" src="get_url() ?>" tooltipsrc="" />
' . collection::getLogo($record->get_base_id()); - $minilogos .= '
'; - $sbas_id = $record->get_sbas_id(); - echo $minilogos; + $minilogos .= '
' . collection::getLogo($record->get_base_id()); + $minilogos .= '
'; + $sbas_id = $record->get_sbas_id(); + echo $minilogos; - if ( - $ACL->has_right_on_base($record->get_base_id(), 'candwnldpreview') || - $ACL->has_right_on_base($record->get_base_id(), 'candwnldhd') || - $ACL->has_right_on_base($record->get_base_id(), 'cancmd') - ) - { + if ( + $ACL->has_right_on_base($record->get_base_id(), 'candwnldpreview') || + $ACL->has_right_on_base($record->get_base_id(), 'candwnldhd') || + $ACL->has_right_on_base($record->get_base_id(), 'cancmd') + ) + { ?>
'; - $b = true; + $b = true; foreach ($proposals["BASES"] as $zbase) { if ((int) (count($proposals["BASES"]) > 1) && count($zbase["TERMS"]) > 0) { $style = $b ? 'style="margin-top:0px;"' : ''; - $b = false; + $b = false; $html .= "

" . sprintf(_('reponses::propositions pour la base %s'), htmlentities($zbase["NAME"])) . "

"; } - $t = true; + $t = true; foreach ($zbase["TERMS"] as $path => $props) { $style = $t ? 'style="margin-top:0px;"' : ''; - $t = false; + $t = false; $html .= "

" . sprintf(_('reponses::propositions pour le terme %s'), htmlentities($props["TERM"])) . "

"; $html .= $props["HTML"]; } diff --git a/www/client/index.php b/www/client/index.php index 5dafe03272..f93357da20 100644 --- a/www/client/index.php +++ b/www/client/index.php @@ -102,6 +102,14 @@ $user = User_Adapter::getInstance($usr_id, $appbox); +
@@ -231,17 +239,6 @@ $user = User_Adapter::getInstance($usr_id, $appbox); } foreach ($user->ACL()->get_granted_base(array(), array($databox->get_sbas_id())) as $coll) { - if ($showbases) - { - $options .= ''; - $allbcol = array(); - $n_allbcol = 0; - if (count($databox->get_collections()) > 0) - { - $options .= ''; - } - foreach ($databox->get_collections() as $coll) - { $allbcol[] = $coll->get_base_id(); $n_allbcol++; @@ -262,8 +259,6 @@ $user = User_Adapter::getInstance($usr_id, $appbox); } } echo ''; - } - } ?>
get('GV_view_bas_and_coll')) { - if ($registry->get('GV_view_bas_and_coll')) - { ?>
@@ -434,28 +427,6 @@ $user = User_Adapter::getInstance($usr_id, $appbox); '
' . ''; } - } - } - if ($sxe->description) - { - foreach ($sxe->description->children() as $f => $field) - { - if ($field['type'] == 'date' && $field['searchclient'] == '1') - { - $dateFilters .= '
' . - '' . - '' . - '
' . - $f . '
' . _('phraseanet::time:: de') . - '' . - _('phraseanet::time:: a') . - '
' . - '' . - ' ' . - '' . - '
' . - '
'; - } elseif ($field['type'] != 'date') { $fieldsFilters .= ''; @@ -481,7 +452,7 @@ $user = User_Adapter::getInstance($usr_id, $appbox);
get_collections() as $coll) + foreach ($user->ACL()->get_granted_base(array(), array($databox->get_sbas_id())) as $coll) { $s = "checked"; echo '
'; @@ -497,7 +468,6 @@ $user = User_Adapter::getInstance($usr_id, $appbox); get('GV_thesaurus')) { ?> @@ -576,7 +546,7 @@ $user = User_Adapter::getInstance($usr_id, $appbox);
-