GFix client publications

This commit is contained in:
Romain Neutron
2012-02-28 16:02:58 +01:00
parent daf4fe2a03
commit 2412c41553
4 changed files with 182 additions and 296 deletions

View File

@@ -205,11 +205,9 @@ class Query implements ControllerProviderInterface
} }
} }
$json['results'] = $twig->render($template, array( $json['results'] = $twig->render($template, array(
'results' => $result, 'results' => $result,
'GV_social_tools' => $registry->get('GV_social_tools'), 'GV_social_tools' => $registry->get('GV_social_tools'),
'array_selected' => explode(';', $request->get('sel')),
'highlight' => $search_engine->get_query(), 'highlight' => $search_engine->get_query(),
'searchEngine' => $search_engine, 'searchEngine' => $search_engine,
'suggestions' => $prop 'suggestions' => $prop

View File

@@ -16,8 +16,9 @@
*/ */
/* @var $Core \Alchemy\Phrasea\Core */ /* @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); $appbox = appbox::get_instance($Core);
$session = $appbox->get_session(); $session = $appbox->get_session();
$registry = $appbox->get_registry(); $registry = $appbox->get_registry();

View File

@@ -1,5 +1,4 @@
<?php <?php
/* /*
* This file is part of Phraseanet * This file is part of Phraseanet
* *
@@ -15,295 +14,177 @@
* @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
*/ */
//$Core = \bootstrap::getCore(); $Core = \bootstrap::getCore();
//$appbox = appbox::get_instance($Core); $appbox = appbox::get_instance($Core);
//$session = $appbox->get_session();
// $user = $Core->getAuthenticatedUser();
//$th_size = $user->getPrefs('images_size');
// $feeds = \Feed_Collection::load_all($appbox, $user);
//$user = $Core->getAuthenticatedUser();
//
//$RN = array("\r\n", "\n", "\r"); $th_size = $user->getPrefs('images_size');
//
//$conn = $appbox->get_connection(); $core = \bootstrap::getCore();
// $twig = $core->getTwig();
//$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, ' . <div style="height:50px;" class="homePubTitleBox">
// 'DATE_FORMAT(s.updater,"' . _('phraseanet::technique::date') . '") AS updater, ' . <div style="float:left;width:350px;"><h1 style="font-size:20px;margin-top:15px;">
// 's.updater as dateC1, s.pub_date as dateC2,' . <h1><?php echo _('publications:: dernieres publications'); ?></h1>
// ' n.id, u.usr_nom, u.usr_prenom, u.usr_login, u.usr_mail ' . </div>
// ', bu.mask_and ' . <!-- <div style="float:right;width:160px;text-align:right;cursor:pointer;" class="subscribe_my_rss">
// ', bu.mask_xor ' . <h1 style="font-size:17px;margin-top:19px;">
// 'FROM (sselcont c, ssel s, usr u, bas b, sbas sb) ' . <?php echo _('publications:: s\'abonner aux publications'); ?>
// 'LEFT JOIN sselnew n ' . <img style="border:none;" src="/skins/icons/rss16.png" />
// 'ON (n.ssel_id = s.ssel_id AND n.usr_id = :usr_id) ' . </h1>
// ' LEFT JOIN basusr bu ON (bu.base_id = b.base_id AND bu.usr_id = :usr_id_bis)' . </div>-->
// 'WHERE s.ssel_id = c.ssel_id AND s.public="1" ' . </div>
// 'AND (s.pub_restrict="0" ' .
// 'OR (s.pub_restrict="1" AND c.base_id IN ' . <?php
// ' (SELECT base_id FROM basusr WHERE usr_id = :usr_id_sub AND actif = "1")))' . $feed = '';
// ' AND u.usr_id = s.usr_id AND temporaryType=0 ' .
// ' AND b.sbas_id = sb.sbas_id' . foreach ($feeds->get_aggregate()->get_entries(0, 5)->get_entries() as $entry)
// ' AND b.base_id = c.base_id' . {
// ' ORDER BY s.pub_date DESC, c.ord ASC'; /* @var $entry \Feed_Entry_Adapter */
//
//$sqlMe = 'SELECT usr_login, usr_password FROM usr WHERE usr_id = :usr_id'; $feed .= '<div class="boxPubli">' .
// '<div class="titlePubli">' .
//$stmt = $conn->prepare($sqlMe); '<h2 class="htitlePubli">' .
//$stmt->execute(array(':usr_id' => $session->get_usr_id())); '<a class="homePubTitle" onclick="openCompare(\'' . $entry->get_id() . '\');">'
//$rawMe = $stmt->fetch(PDO::FETCH_ASSOC); . $entry->get_title() .
//$stmt->closeCursor(); '</a> </h2>' .
// '<span class="publiInfos">' .
//$info_usr = null; ' ' . \phraseadate::getPrettyString($entry->get_created_on()) .
// ' ';
//if ($rawMe)
//{ if ($entry->get_author_email())
// $info_usr = $rawMe; $feed .= '<a class="homePubLink" href="mailto:' . $entry->get_author_email() . '">';
//}
// $feed .= $entry->get_author_name();
//$core = \bootstrap::getCore();
//$twig = $core->getTwig(); if ($entry->get_author_email())
// $feed .= '</a>';
//$stmt = $conn->prepare($sql);
//$usr_id = $session->get_usr_id(); if ($entry->get_updated_on() > $entry->get_created_on())
//$stmt->execute(array(':usr_id' => $usr_id, ':usr_id_bis' => $usr_id, ':usr_id_sub' => $usr_id)); $feed .= '<br/><span style="font-style:italic;">' . _('publications:: derniere mise a jour')
//$rs = $stmt->fetchAll(PDO::FETCH_ASSOC); . ' ' . \phraseadate::getPrettyString($entry->get_updated_on()) . '</span><br/><br/>';
//$stmt->closeCursor();
// $feed .= '</span></div><div class="descPubli"><div style="margin:10px 0 10px 20px;width:80%;">';
//$sselid = null;
//$o = 0;
//$out = ''; if (trim($entry->get_subtitle()) != '')
// {
//$feed = ''; $feed .= '' . nl2br($entry->get_subtitle());
//$feed .= '<div style="height:50px;" class="homePubTitleBox">' . }
// '<div style="float:left;width:350px;"><h1 style="font-size:20px;margin-top:15px;">' . _('publications:: dernieres publications') . '</h1></div>' . $feed .= '</div>';
// '<div style="float:right;width:160px;text-align:right;cursor:pointer;" class="subscribe_my_rss">
// <h1 style="font-size:17px;margin-top:19px;"> ' . $feed .= '<div style="width:100%;position:relative;float:left;" id="PUBLICONT' . $entry->get_id() . '">';
// _('publications:: s\'abonner aux publications') . ' ' .
// '<img style="border:none;" src="/skins/icons/rss16.png" />
// </h1>' .
// '</div></div>';
//
//foreach ($rs as $row)
//{ foreach ($entry->get_content() as $Feed_item)
// if ($row['ssel_id'] != $sselid) {
// { /* @var $Feed_item \Feed_Entry_Item */
// if ($sselid !== null) $record = $Feed_item->get_record();
// {
// $thumbnail = $record->get_thumbnail();
//
// $title = $record->get_title();
// $item .= '<div style="width:100%;position:relative;float:left;" id="PUBLICONT' . $sselid . '">' . $out; $caption = $twig->render(
// $item .= '</div>' . 'common/caption.html', array('view' => 'internal_publi', 'record' => $record)
// '</div></div>'; );
//
// if ($itemIsOk) $preview = "<div tooltipsrc='/prod/tooltip/preview/" . $record->get_sbas_id() . "/" . $record->get_record_id() . "/' class=\"previewTips\"></div>&nbsp;";
// $feed .= $item;
// } $docType = $record->get_type();
// $isVideo = ($docType == 'video');
// $itemIsOk = false; $isAudio = ($docType == 'audio');
// $isImage = ($docType == 'image');
// $sselid = $row['ssel_id'];
// $ord = $row['ord']; $duration = '';
// $o = 0;
// $out = ''; if (!$isVideo && !$isAudio)
// $neverSeen = ''; $isImage = true;
// $publisher = $row['usr_prenom'] . ' ' . $row['usr_nom'];
// if ($publisher == ' ') if ($isVideo)
// $publisher = $row['usr_mail']; {
// if ($publisher == '') $duration = $record->get_formated_duration();
// $publisher = 'Unreferenced user'; if ($duration != '')
// $duration = '<div class="duration">' . $duration . '</div>';
// if ($row['id'] != '') }
// $neverSeen = _('publications:: publication non lue'); if ($isAudio)
// {
// $item = ''; $duration = $record->get_formated_duration();
// $item .= '<div class="boxPubli">' . if ($duration != '')
// '<div class="titlePubli">' . $duration = '<div class="duration">' . $duration . '</div>';
// '<h2 class="htitlePubli">' . }
// '<a class="homePubTitle" onclick="openCompare(\'' . $sselid . '\');">' . $row['name'] .
// '</a> <span style="font-size:12px;color:red;">' . $neverSeen . '</span></h2>' .
// '<span class="publiInfos">' . $ratio = $thumbnail->get_width() / $thumbnail->get_height();
// ' ' . $row['pub_date'] .
// ' '; if ($ratio > 1)
// {
// if ($row['usr_mail'] != '') $cw = min(((int) $th_size - 30), $thumbnail->get_width());
// $item .= '<a class="homePubLink" href="mailto:' . $row['usr_mail'] . '">'; $ch = $cw / $ratio;
// $pv = floor(($th_size - $ch) / 2);
// $item .= $publisher; $ph = floor(($th_size - $cw) / 2);
// $imgStyle = 'width:' . $cw . 'px;xpadding:' . $pv . 'px ' . $ph . 'px;';
// if ($row['usr_mail'] != '') }
// $item .= '</a>'; else
// {
// if ($row['dateC1'] != $row['dateC2']) $ch = min(((int) $th_size - 30), $thumbnail->get_height());
// $item .= '<br/><span style="font-style:italic;">' . _('publications:: derniere mise a jour') . ' ' . $row['updater'] . '</span><br/><br/>'; $cw = $ch * $ratio;
//
// $item .= '</span></div><div class="descPubli"><div style="margin:10px 0 10px 20px;width:80%;">'; $pv = floor(($th_size - $ch) / 2);
// $ph = floor(($th_size - $cw) / 2);
//
// if (trim(str_replace($RN, '', $row['descript'])) != '') $imgStyle = 'height:' . $ch . 'px;xpadding:' . $pv . 'px ' . $ph . 'px;';
// { }
// $row['descript'] = str_replace($RN, '<br/>', $row['descript']);
// $item .= '' . $row['descript']; $feed .= "<div style='width:" . ($th_size + 30) . "px;' sbas=\"" . $record->get_sbas_id() . "\"
// } id='IMGT_" . $record->get_serialize_key() . "_PUB_" . $entry->get_id()
// $item .= '</div>'; . "' class='IMGT diapo'
// } onclick=\"openPreview('FEED','" . $Feed_item->get_ord() . "','" . $entry->get_id() . "');\">";
//
// $feed .= '<div>';
// $feed .= "<div class=\"title\" style=\"height:40px;\">";
//
// $feed .= $title;
// $ord = $row['ord'];
// $statOk = true; $feed .= "</div>\n";
// if ($row['public'] == 1 && $row['pub_restrict'] == 1)
// { $feed .= '</div>';
// $statOk = false;
// $feed .= "<table class=\"thumb w160px h160px\" style=\"xheight:" . (int) $th_size . "px;\" cellspacing='0' cellpadding='0' valign='middle'>\n<tr><td>";
// try
// { $feed .= $duration . "<img title=\"" . str_replace('"', '&quot;', $caption) . "\" class=\" captionTips\" src=\"" . $thumbnail->get_url() . "\" style=\"" . $imgStyle . "\" />";
// $connsbas = connection::getPDOConnection($row['sbas_id']);
// $feed .= "</td></tr></table>";
// $sql = 'SELECT record_id FROM record WHERE ((status ^ ' . $row['mask_xor'] . ') & ' . $row['mask_and'] . ')=0
// AND record_id = :record_id'; $feed .= '<div style="height: 25px;position:relative;">';
// $stmt = $connsbas->prepare($sql); $feed .= '<table class="bottom">';
// $stmt->execute(array(':record_id' => $row['record_id'])); $feed .= '<tr>';
// $statOk = ($stmt->rowCount() > 0); $feed .= '<td>';
// $stmt->closeCursor();
// } $feed .= "</td>\n";
// catch (Exception $e)
// { $feed .= "<td style='text-align:right;' valign='bottom' nowrap>\n";
//
// } $feed .= $preview;
// }
// $feed .= "</td>";
// $feed .= "</tr>";
// $layoutmode = $user->getPrefs('view'); $feed .= "</table>";
// $feed .= "</div>";
// if ($statOk)
// {
// $record = new record_adapter($row["sbas_id"], $row["record_id"]); $feed .= "</div>";
// $sbas_id = phrasea::sbasFromBas($row['base_id']); }
// $feed .= '</div>' .
// $captionXML = $record->get_xml(); '</div></div>';
// }
// $thumbnail = $record->get_thumbnail();
// echo '<div>' . $feed . '</div>';
// $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 = "<div tooltipsrc='/prod/tooltip/preview/" . phrasea::sbasFromBas($row["base_id"]) . "/" . $row["record_id"] . "/' class=\"previewTips\"></div>&nbsp;";
//
// $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 = '<div class="duration">' . $duration . '</div>';
// }
// if ($isAudio)
// {
// $duration = $record->get_formated_duration();
// if ($duration != '')
// $duration = '<div class="duration">' . $duration . '</div>';
// }
//
//
// $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 .= "<div style='width:" . ($th_size + 30) . "px;' sbas=\"" . $row['sbas_id'] . "\" id='IMGT_" . $row['base_id'] . "_" . $row['record_id'] . "_PUB_" . $sselid . "' class='IMGT diapo' onclick=\"openPreview('BASK','" . $ord . "','" . $sselid . "');\">";
//
// $out .= '<div>';
// $out .= "<div class=\"title\" style=\"height:40px;\">";
//
// $out .= $title; //$data['title'];
//
// $out .= "</div>\n";
//
// $out .= '</div>';
//
// $out .= "<table class=\"thumb w160px h160px\" style=\"xheight:" . (int) $th_size . "px;\" cellspacing='0' cellpadding='0' valign='middle'>\n<tr><td>";
//
// $out .= $duration . "<img title=\"" . str_replace('"', '&quot;', $caption) . "\" class=\" captionTips\" src=\"" . $thumbnail->get_url() . "\" style=\"" . $imgStyle . "\" />";
//
// $out .= "</td></tr></table>";
//
// $out .= '<div style="height: 25px;position:relative;">';
// $out .= '<table class="bottom">';
// $out .= '<tr>';
// $out .= '<td>';
//
// $out .= "</td>\n";
//
// $out .= "<td style='text-align:right;' valign='bottom' nowrap>\n";
//
// $out .= $preview;
//
// $out .= "</td>";
// $out .= "</tr>";
// $out .= "</table>";
// $out .= "</div>";
//
//
// $out .= "</div>";
// }
//}
//
//if (isset($item))
//{
// $item .= ' <br/><div style="width:100%;position:relative;float:left;" id="PUBLICONT' . $sselid . '">' . $out;
// $item .= '</div>' .
// '</div></div>';
// if ($itemIsOk)
// $feed .= $item;
//}
//
//echo '<div>' . $feed . '</div>';
//
//$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();

View File

@@ -218,10 +218,16 @@
return this.datas; return this.datas;
}, },
empty : function(){ empty : function(){
var $this = this;
this.datas = new Array(); this.datas = new Array();
jQuery(this.options.selector, this.$container).filter('.selected:visible').removeClass('selected'); 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; return this;
}, },
length : function(){ length : function(){