Fix client

This commit is contained in:
Romain Neutron
2012-02-28 16:18:12 +01:00
parent d24aad99b3
commit a2ae5d395e
2 changed files with 88 additions and 109 deletions

View File

@@ -14,35 +14,34 @@
* @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
*/ */
/* @var $Core \Alchemy\Phrasea\Core */ /* @var $Core \Alchemy\Phrasea\Core */
require_once __DIR__ . "/../../lib/bootstrap.php"; require_once __DIR__ . "/../../lib/bootstrap.php";
$Core= \bootstrap::getCore(); $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();
$user = $Core->getAuthenticatedUser(); $user = $Core->getAuthenticatedUser();
if (!isset($parm)) if (!isset($parm))
{ {
$request = http_request::getInstance(); $request = http_request::getInstance();
$parm = $request->get_parms("mod", "bas" $parm = $request->get_parms("mod", "bas"
, "pag" , "pag"
, "qry", "search_type", "recordtype" , "qry", "search_type", "recordtype"
, "qryAdv", 'opAdv', 'status', 'datemin', 'datemax' , "qryAdv", 'opAdv', 'status', 'datemin', 'datemax'
, 'dateminfield', 'datemaxfield' , 'dateminfield', 'datemaxfield'
, 'datefield' , 'datefield'
, 'sort' , 'sort'
, 'stemme' , 'stemme'
, 'infield' , 'infield'
, "nba" , "nba"
, "regroup" // si rech par doc, regroup ,ou pizza , "regroup" // si rech par doc, regroup ,ou pizza
, "ord" , "ord"
); );
} }
$qry = ''; $qry = '';
if (trim($parm['qry']) != '') if (trim($parm['qry']) != '')
{ {
@@ -88,7 +87,7 @@ else
$mod_row = (int) ($mod[0]); $mod_row = (int) ($mod[0]);
$mod_col = (int) ($mod[1]); $mod_col = (int) ($mod[1]);
} }
$mod_xy = $mod_col * $mod_row; $mod_xy = $mod_col * $mod_row;
$tbases = array(); $tbases = array();
@@ -102,9 +101,9 @@ $options->set_bases($parm['bas'], $user->ACL());
if (!is_array($parm['infield'])) if (!is_array($parm['infield']))
$parm['infield'] = array(); $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]); unset($parm['infield'][$offset]);
} }
@@ -162,8 +161,8 @@ if ($registry->get('GV_thesaurus'))
if ($registry->get('GV_clientAutoShowProposals')) if ($registry->get('GV_clientAutoShowProposals'))
{ {
?> ?>
if("<?php echo p4string::MakeString(proposalsToHTML($qp['main']->proposals), "JS") ?>" != "<div class=\"proposals\"></div>") if("<?php echo p4string::MakeString(proposalsToHTML($qp['main']->proposals), "JS") ?>" != "<div class=\"proposals\"></div>")
chgOng(4); chgOng(4);
<?php <?php
} }
?> ?>
@@ -178,14 +177,14 @@ $history = queries::history();
echo '<script language="javascript" type="text/javascript">$("#history").empty().append("' . str_replace('"', '\"', $history) . '")</script>'; echo '<script language="javascript" type="text/javascript">$("#history").empty().append("' . str_replace('"', '\"', $history) . '")</script>';
$nbanswers = $result->get_count_available_results(); $nbanswers = $result->get_count_available_results();
$longueur = strlen($parm['qry']); $longueur = strlen($parm['qry']);
$qrys = '<div>' . _('client::answers: rapport de questions par bases') . '</div>'; $qrys = '<div>' . _('client::answers: rapport de questions par bases') . '</div>';
foreach ($qrySbas as $sbas => $qryBas) foreach ($qrySbas as $sbas => $qryBas)
$qrys .= '<div style="font-weight:bold;">' . phrasea::sbas_names($sbas) . '</div><div>' . $qryBas . '</div>'; $qrys .= '<div style="font-weight:bold;">' . phrasea::sbas_names($sbas) . '</div><div>' . $qryBas . '</div>';
$txt = "<b>" . substr($parm['qry'], 0, 36) . ($longueur > 36 ? "..." : "") . "</b>" . sprintf(_('client::answers: %d reponses'), (int) $nbanswers) . " <a style=\"float:none;display:inline-block;padding:2px 3px\" class=\"infoTips\" title=\"" . str_replace('"', "'", $qrys) . "\">&nbsp;</a>"; $txt = "<b>" . substr($parm['qry'], 0, 36) . ($longueur > 36 ? "..." : "") . "</b>" . sprintf(_('client::answers: %d reponses'), (int) $nbanswers) . " <a style=\"float:none;display:inline-block;padding:2px 3px\" class=\"infoTips\" title=\"" . str_replace('"', "'", $qrys) . "\">&nbsp;</a>";
?> ?>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
@@ -195,13 +194,13 @@ $txt = "<b>" . substr($parm['qry'], 0, 36) . ($longueur > 36 ? "..." : "") . "</
</script> </script>
<?php <?php
$npages = $result->get_total_pages(); $npages = $result->get_total_pages();
$pages = ''; $pages = '';
$ecart = 3; $ecart = 3;
$max = (2 * $ecart) + 3; $max = (2 * $ecart) + 3;
if ($npages > $max) if ($npages > $max)
{ {
for ($p = 1; $p < $npages; $p++) for ($p = 1; $p <= $npages; $p++)
{ {
if ($p == $page) if ($p == $page)
$pages .= '<span class="naviButton sel">' . ($p) . '</span>'; $pages .= '<span class="naviButton sel">' . ($p) . '</span>';
@@ -217,23 +216,23 @@ if ($npages > $max)
$pages .= '<span onclick="gotopage(' . ($p ) . ');" class="naviButton">' . ($p) . '...</span>'; $pages .= '<span onclick="gotopage(' . ($p ) . ');" class="naviButton">' . ($p) . '...</span>';
if (($p == $page) if (($p == $page)
|| ( ( $p >= ($page - $ecart) ) && ( $p <= ($page + $ecart) )) || ( ( $p >= ($page - $ecart) ) && ( $p <= ($page + $ecart) ))
|| ( ($page < ($ecart + 2)) && ($p < ($max - $ecart + 2) ) ) || ( ($page < ($ecart + 2)) && ($p < ($max - $ecart + 2) ) )
|| ( ($page >= ($npages - $ecart - 2)) && ($p >= ($npages - (2 * $ecart) - 2) ) ) || ( ($page >= ($npages - $ecart - 2)) && ($p >= ($npages - (2 * $ecart) - 2) ) )
|| ( $p == 0) || ( $p == 0)
) )
$pages .= '<span class="naviButton" style="cursor:default;"> - </span>'; $pages .= '<span class="naviButton" style="cursor:default;"> - </span>';
} }
} }
else else
{ {
for ($p = 1; $p < $npages; $p++) for ($p = 1; $p <= $npages; $p++)
{ {
if ($p == $page) if ($p == $page)
$pages .= '<span class="naviButton sel">' . ($p) . '</span>'; $pages .= '<span class="naviButton sel">' . ($p) . '</span>';
else else
$pages .= '<span onclick="gotopage(' . ($p) . ');" class="naviButton">' . ($p) . '</span>'; $pages .= '<span onclick="gotopage(' . ($p) . ');" class="naviButton">' . ($p) . '</span>';
if ($p < $npages) if ($p < $npages)
$pages .= '<span class="naviButton" style="cursor:default;"> - </span>'; $pages .= '<span class="naviButton" style="cursor:default;"> - </span>';
} }
} }
@@ -251,30 +250,29 @@ $string2.= '</div>';
if ($page != 0 && $nbanswers) if ($page != 0 && $nbanswers)
{ {
?> ?>
$("#PREV_PAGE").bind('click',function(){gotopage(<?php echo ($page - 1) ?>)}); $("#PREV_PAGE").bind('click',function(){gotopage(<?php echo ($page - 1) ?>)});
<?php <?php
} }
else else
{ {
?> ?>
$("#PREV_PAGE").unbind('click'); $("#PREV_PAGE").unbind('click');
<?php <?php
} }
if ($page != $npages - 1 && $nbanswers) if ($page != $npages - 1 && $nbanswers)
{ {
?> ?>
$("#NEXT_PAGE").bind('click',function(){gotopage(<?php echo ($page + 1) ?>)}); $("#NEXT_PAGE").bind('click',function(){gotopage(<?php echo ($page + 1) ?>)});
<?php <?php
} }
else else
{ {
?> ?>
$("#NEXT_PAGE").unbind('click'); $("#NEXT_PAGE").unbind('click');
<?php } ?> <?php } ?>
}); });
</script> </script>
<?php <?php
$layoutmode = "grid"; $layoutmode = "grid";
if ($mod_col == 1) if ($mod_col == 1)
$layoutmode = "list"; $layoutmode = "list";
@@ -316,8 +314,17 @@ if (count($result->get_datas()) > 0)
$docType = $record->get_type(); $docType = $record->get_type();
$title = $record->get_title(); $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) if ($i == 0)
@@ -345,8 +352,6 @@ if (count($result->get_datas()) > 0)
} }
?><div class="diapo w160px" style="margin-bottom:0;border-bottom:none;"> ?><div class="diapo w160px" style="margin-bottom:0;border-bottom:none;">
<div class="title"><?php echo $title ?></div><?php <div class="title"><?php echo $title ?></div><?php
$status = ''; $status = '';
$status .= '<div class="status">'; $status .= '<div class="status">';
$status .= $record->get_status_icons(); $status .= $record->get_status_icons();
@@ -354,21 +359,20 @@ if (count($result->get_datas()) > 0)
echo $status; echo $status;
$isVideo = ($docType == 'video'); $isVideo = ($docType == 'video');
$isAudio = ($docType == 'audio'); $isAudio = ($docType == 'audio');
$isImage = ($docType == 'image'); $isImage = ($docType == 'image');
$isDocument = ($docType == 'document'); $isDocument = ($docType == 'document');
$sd = $record->get_subdefs(); $sd = $record->get_subdefs();
$isImage = false; $isImage = false;
$isDocument = false; $isDocument = false;
if (!$isVideo && !$isAudio) if (!$isVideo && !$isAudio)
{ {
$isImage = true; $isImage = true;
} }
?><table cellpadding="0" cellspacing="0" style="margin: 0pt auto;"><?php ?><table cellpadding="0" cellspacing="0" style="margin: 0pt auto;"><?php
?><tr class="h160px"><?php ?><tr class="h160px"><?php
?><td class="image w160px h160px"><?php ?><td class="image w160px h160px"><?php
@@ -403,29 +407,32 @@ if (count($result->get_datas()) > 0)
$pic_roll = str_replace(array('&', '"'), array('&amp;', '&quot;'), $pic_roll); $pic_roll = str_replace(array('&', '"'), array('&amp;', '&quot;'), $pic_roll);
?><img style="<?php if ($thumbnail->get_width() > $thumbnail->get_height()) ?><img style="<?php if ($thumbnail->get_width() > $thumbnail->get_height())
{ ?>width:128px;<?php } {
?>width:128px;<?php
}
else else
{ ?>height:128px;<?php } ?>" onclick="<?php echo $onclick ?>" class=" captionTips" id="IMG<?php echo $record->get_base_id() ?>_<?php echo $record->get_record_id() ?>" src="<?php echo $thumbnail->get_url() ?>" tooltipsrc="<?php echo ($pic_roll) ?>" /> {
?>height:128px;<?php } ?>" onclick="<?php echo $onclick ?>" class=" captionTips" id="IMG<?php echo $record->get_base_id() ?>_<?php echo $record->get_record_id() ?>" src="<?php echo $thumbnail->get_url() ?>" tooltipsrc="<?php echo ($pic_roll) ?>" />
</td> </td>
</tr> </tr>
</table> </table>
</div> </div>
<div class="diapo w160px" style="border-top:none;"><?php ?><div class="buttons"><?php <div class="diapo w160px" style="border-top:none;"><?php ?><div class="buttons"><?php
$minilogos = ""; $minilogos = "";
$minilogos .= '<div class="minilogos">' . collection::getLogo($record->get_base_id()); $minilogos .= '<div class="minilogos">' . collection::getLogo($record->get_base_id());
$minilogos .= '</div>'; $minilogos .= '</div>';
$sbas_id = $record->get_sbas_id(); $sbas_id = $record->get_sbas_id();
echo $minilogos; echo $minilogos;
if ( if (
$ACL->has_right_on_base($record->get_base_id(), 'candwnldpreview') || $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(), 'candwnldhd') ||
$ACL->has_right_on_base($record->get_base_id(), 'cancmd') $ACL->has_right_on_base($record->get_base_id(), 'cancmd')
) )
{ {
?><div class="downloader" title="<?php echo _('action : exporter') ?>" onclick="evt_dwnl('<?php echo $sbas_id ?>_<?php echo $record->get_record_id() ?>');"></div><?php ?><div class="downloader" title="<?php echo _('action : exporter') ?>" onclick="evt_dwnl('<?php echo $sbas_id ?>_<?php echo $record->get_record_id() ?>');"></div><?php
} }
?> ?>
<div class="printer" title="<?php echo _('action : print') ?>" onClick="evt_print('<?php echo $sbas_id ?>_<?php echo $record->get_record_id() ?>');"></div> <div class="printer" title="<?php echo _('action : print') ?>" onClick="evt_print('<?php echo $sbas_id ?>_<?php echo $record->get_record_id() ?>');"></div>
<?php <?php
@@ -490,20 +497,20 @@ function proposalsToHTML(&$proposals)
{ {
$html = '<div class="proposals">'; $html = '<div class="proposals">';
$b = true; $b = true;
foreach ($proposals["BASES"] as $zbase) foreach ($proposals["BASES"] as $zbase)
{ {
if ((int) (count($proposals["BASES"]) > 1) && count($zbase["TERMS"]) > 0) if ((int) (count($proposals["BASES"]) > 1) && count($zbase["TERMS"]) > 0)
{ {
$style = $b ? 'style="margin-top:0px;"' : ''; $style = $b ? 'style="margin-top:0px;"' : '';
$b = false; $b = false;
$html .= "<h1 $style>" . sprintf(_('reponses::propositions pour la base %s'), htmlentities($zbase["NAME"])) . "</h1>"; $html .= "<h1 $style>" . sprintf(_('reponses::propositions pour la base %s'), htmlentities($zbase["NAME"])) . "</h1>";
} }
$t = true; $t = true;
foreach ($zbase["TERMS"] as $path => $props) foreach ($zbase["TERMS"] as $path => $props)
{ {
$style = $t ? 'style="margin-top:0px;"' : ''; $style = $t ? 'style="margin-top:0px;"' : '';
$t = false; $t = false;
$html .= "<h2 $style>" . sprintf(_('reponses::propositions pour le terme %s'), htmlentities($props["TERM"])) . "</h2>"; $html .= "<h2 $style>" . sprintf(_('reponses::propositions pour le terme %s'), htmlentities($props["TERM"])) . "</h2>";
$html .= $props["HTML"]; $html .= $props["HTML"];
} }

View File

@@ -102,6 +102,14 @@ $user = User_Adapter::getInstance($usr_id, $appbox);
<?php <?php
} }
?> ?>
<style>
#PREVIEWCURRENTCONT{
top:0;
left:0;
right:0;
bottom:0;
}
</style>
</head> </head>
<body class="PNB" style="overflow:hidden;"> <body class="PNB" style="overflow:hidden;">
<div id="container" style="position:absolute;top:0;left:0;overflow:hidden;width:100%;height:100%;"> <div id="container" style="position:absolute;top:0;left:0;overflow:hidden;width:100%;height:100%;">
@@ -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) foreach ($user->ACL()->get_granted_base(array(), array($databox->get_sbas_id())) as $coll)
{ {
if ($showbases)
{
$options .= '<optgroup label="' . $databox->get_viewname() . '">';
$allbcol = array();
$n_allbcol = 0;
if (count($databox->get_collections()) > 0)
{
$options .= '<option value="' . implode(';', $allbcol) . '">`' . $databox->get_viewname() . '`' . '</option>';
}
foreach ($databox->get_collections() as $coll)
{
$allbcol[] = $coll->get_base_id(); $allbcol[] = $coll->get_base_id();
$n_allbcol++; $n_allbcol++;
@@ -262,8 +259,6 @@ $user = User_Adapter::getInstance($usr_id, $appbox);
} }
} }
echo '<select id="basSelector" onchange="beforeAnswer();" style="width:245px;"><option value="' . implode(';', $allbases) . '">' . _('client::recherche: rechercher dans toutes les bases') . '</option>' . $options . '</select>'; echo '<select id="basSelector" onchange="beforeAnswer();" style="width:245px;"><option value="' . implode(';', $allbases) . '">' . _('client::recherche: rechercher dans toutes les bases') . '</option>' . $options . '</select>';
}
}
?> ?>
</div> </div>
<?php <?php
@@ -364,8 +359,6 @@ $user = User_Adapter::getInstance($usr_id, $appbox);
{ {
if ($registry->get('GV_view_bas_and_coll')) if ($registry->get('GV_view_bas_and_coll'))
{ {
if ($registry->get('GV_view_bas_and_coll'))
{
?> ?>
<div class="basContainer"> <div class="basContainer">
<div class="basContTitle"> <div class="basContTitle">
@@ -434,28 +427,6 @@ $user = User_Adapter::getInstance($usr_id, $appbox);
'</table>' . '</table>' .
'</div>'; '</div>';
} }
}
}
if ($sxe->description)
{
foreach ($sxe->description->children() as $f => $field)
{
if ($field['type'] == 'date' && $field['searchclient'] == '1')
{
$dateFilters .= '<div><table style="width:98%;text-align:left;" cellspacing="0" cellpadding="0"><tr><td colspan="2">' .
$f . '</td></tr>' .
'<tr><td style="width:50%;">' . _('phraseanet::time:: de') .
'</td><td style="width:50%;">' .
_('phraseanet::time:: a') .
'</td></tr>' .
'<tr><td style="width:50%;">' .
'<input type="hidden" name="dateminfield[]" value="' . $databox->get_sbas_id() . '_' . $f . '">' .
' <input db="' . $databox->get_sbas_id() . '" onchange="checkFilters();" class="datepicker" type="text" name="datemin[]"></td><td style="width:50%;">' .
'<input type="hidden" name="datemaxfield[]" value="' . $databox->get_sbas_id() . '_' . $f . '">' .
' <input db="' . $databox->get_sbas_id() . '" onchange="checkFilters();" class="datepicker" type="text" name="datemax[]"></td></tr>' .
'</table>' .
'</div>';
}
elseif ($field['type'] != 'date') elseif ($field['type'] != 'date')
{ {
$fieldsFilters .= '<option value="' . $databox->get_sbas_id() . '_' . $f . '">' . $f . '</option>'; $fieldsFilters .= '<option value="' . $databox->get_sbas_id() . '_' . $f . '">' . $f . '</option>';
@@ -481,7 +452,7 @@ $user = User_Adapter::getInstance($usr_id, $appbox);
<?php <?php
} }
?><div class="basGrp"><?php ?><div class="basGrp"><?php
foreach ($databox->get_collections() as $coll) foreach ($user->ACL()->get_granted_base(array(), array($databox->get_sbas_id())) as $coll)
{ {
$s = "checked"; $s = "checked";
echo '<div><input type="checkbox" class="checkbox basItem basItem' . $databox->get_sbas_id() . '" ' . $s . ' name="bas[]" id="basChk' . $coll->get_base_id() . '" value="' . $coll->get_base_id() . '"><label for="basChk' . $coll->get_base_id() . '">' . $coll->get_name() . '</label></div>'; echo '<div><input type="checkbox" class="checkbox basItem basItem' . $databox->get_sbas_id() . '" ' . $s . ' name="bas[]" id="basChk' . $coll->get_base_id() . '" value="' . $coll->get_base_id() . '"><label for="basChk' . $coll->get_base_id() . '">' . $coll->get_name() . '</label></div>';
@@ -497,7 +468,6 @@ $user = User_Adapter::getInstance($usr_id, $appbox);
<?php <?php
} }
}
if ($registry->get('GV_thesaurus')) if ($registry->get('GV_thesaurus'))
{ {
?> ?>
@@ -576,7 +546,7 @@ $user = User_Adapter::getInstance($usr_id, $appbox);
<div id="PREVIEWRIGHT" class="preview_col" style="width:49%;position:relative;float:right;overflow:hidden;"> <div id="PREVIEWRIGHT" class="preview_col" style="width:49%;position:relative;float:right;overflow:hidden;">
<div style="margin-right:10px;"> <div style="margin-right:10px;">
<div id="PREVIEWIMGDESC" class="preview_col_cont" style="overflow-x:hidden;overflow-y:auto;"> <div id="PREVIEWIMGDESC" class="preview_col_cont" style="overflow-x:hidden;overflow-y:auto;">
<ul style="height:30px;"> <ul style="height:30px;overflow:hidden;">
<li><a href="#PREVIEWIMGDESCINNER-BOX"><?php echo _('preview:: Description'); ?></a></li> <li><a href="#PREVIEWIMGDESCINNER-BOX"><?php echo _('preview:: Description'); ?></a></li>
<li><a href="#HISTORICOPS-BOX"><?php echo _('preview:: Historique'); ?></a></li> <li><a href="#HISTORICOPS-BOX"><?php echo _('preview:: Historique'); ?></a></li>
<li><a href="#popularity-BOX"><?php echo _('preview:: Popularite'); ?></a></li> <li><a href="#popularity-BOX"><?php echo _('preview:: Popularite'); ?></a></li>
@@ -737,8 +707,10 @@ setBaskStatus();
<?php <?php
if (trim($registry->get('GV_bitly_user')) !== '' && trim($registry->get('GV_bitly_key')) !== '') if (trim($registry->get('GV_bitly_user')) !== '' && trim($registry->get('GV_bitly_key')) !== '')
{ {
$request = new http_request();
?> ?>
<script type="text/javascript" src="http://bit.ly/javascript-api.js?version=latest&login=<?php echo $registry->get('GV_bitly_user') ?>&apiKey=<?php echo $registry->get('GV_bitly_key') ?>"></script>
<script type="text/javascript" src="http<?php echo $request->is_secure() ? 's' : '' ?>://bit.ly/javascript-api.js?version=latest&login=<?php echo $registry->get('GV_bitly_user') ?>&apiKey=<?php echo $registry->get('GV_bitly_key') ?>"></script>
<?php <?php
} }
?> ?>