Merge branch '3.8'

Conflicts:
	bower.json
This commit is contained in:
Romain Neutron
2013-10-15 19:11:39 +02:00
21 changed files with 1341 additions and 1651 deletions

View File

@@ -18,7 +18,7 @@
"backbone-amd": "~1.0",
"underscore-amd": "~1.4",
"i18next": "~1.6",
"bootstrap-multiselect": "https://github.com/davidstutz/bootstrap-multiselect.git",
"bootstrap-multiselect": "https://github.com/davidstutz/bootstrap-multiselect.git#bootstrap-2-3",
"zxcvbn": "https://github.com/lowe/zxcvbn.git",
"geonames-server-jquery-plugin": "~0.2",
"swfobject": "latest",

View File

@@ -972,7 +972,7 @@ class Databox implements ControllerProviderInterface
public function getReorder(Application $app, Request $request, $databox_id)
{
return $app['twig']->render('admin/collection/reorder.html.twig', array(
'databox' => $app['phraseanet.appbox']->get_databox($databox_id),
'collections' => $app['authentication']->getUser()->ACL()->get_granted_base(array(), array($databox_id)),
));
}
@@ -986,19 +986,14 @@ class Databox implements ControllerProviderInterface
*/
public function setReorder(Application $app, Request $request, $databox_id)
{
$success = false;
try {
foreach ($request->request->get('order', array()) as $order => $data) {
$baseId = $data['id'];
$collection = \collection::get_from_base_id($app, $baseId);
$app['phraseanet.appbox']->set_collection_order($collection, $order);
unset($collection);
foreach ($request->request->get('order', array()) as $data) {
$collection = \collection::get_from_base_id($app, $data['id']);
$collection->set_ord($data['offset']);
}
$success = true;
} catch (\Exception $e) {
$success = false;
}
if ('json' === $app['request']->getRequestFormat()) {

View File

@@ -150,7 +150,7 @@ class Root implements ControllerProviderInterface
$currentPage = 1;
}
$result = $app['phraseanet.SE']->query($query, $currentPage, $perPage);
$result = $app['phraseanet.SE']->query($query, ($currentPage - 1) * $perPage, $perPage);
$userQuery = new UserQuery();
$userQuery->setUsrId($app['authentication']->getUser()->get_id());

View File

@@ -40,15 +40,14 @@ class Edit implements ControllerProviderInterface
$records = RecordsRequest::fromRequest($app, $request, RecordsRequest::FLATTEN_YES_PRESERVE_STORIES, array('canmodifrecord'));
$thesaurus = $multipleDataboxes = false;
$thesaurus = false;
$status = $ids = $elements = $suggValues =
$fields = $JSFields = array();
$databox = null;
$multipleDataboxes = count($records->databoxes()) > 1;
if (!$multipleDataboxes) {
if (1 === count($records->databoxes())) {
$databoxes = $records->databoxes();
$databox = array_pop($databoxes);

View File

@@ -85,6 +85,7 @@ class Language implements ControllerProviderInterface
$out['FeedBackName'] = _('Name');
$out['FeedBackMessage'] = _('Message');
$out['FeedBackDuration'] = _('Time for feedback (days)');
$out['FeedBackNameMandatory'] = _('Please provide a name for this selection.');
$out['send'] = _('Send');
$out['Recept'] = _('Accuse de reception');
$out['nFieldsChanged'] = _('%d fields have been updated');

View File

@@ -157,12 +157,7 @@ class Push implements ControllerProviderInterface
try {
$pusher = new RecordHelper\Push($app, $app['request']);
$push_name = $request->request->get('name');
if (trim($push_name) === '') {
$push_name = sprintf(_('Push from %s'), $app['authentication']->getUser()->get_display_name());
}
$push_name = $request->request->get('name', sprintf(_('Push from %s'), $app['authentication']->getUser()->get_display_name()));
$push_description = $request->request->get('push_description');
$receivers = $request->request->get('participants');
@@ -281,12 +276,7 @@ class Push implements ControllerProviderInterface
$repository = $app['EM']->getRepository('\Entities\Basket');
$validation_name = $request->request->get('name');
if (trim($validation_name) === '') {
$validation_name = sprintf(_('Validation from %s'), $app['authentication']->getUser()->get_display_name());
}
$validation_name = $request->request->get('name', sprintf(_('Validation from %s'), $app['authentication']->getUser()->get_display_name()));
$validation_description = $request->request->get('validation_description');
$participants = $request->request->get('participants');

View File

@@ -33,7 +33,7 @@ class SearchEngineSuggestion
{
$this->query = $query;
$this->suggestion = $suggestion;
$this->hits = (int) $hits;
$this->hits = null !== $hits ? (int) $hits : null;
}
/**
@@ -66,4 +66,16 @@ class SearchEngineSuggestion
return $this->hits;
}
/**
* Returns the suggestion as an array representation.
*
* @return array
*/
public function toArray()
{
return array(
'query' => $this->getSuggestion(),
'hits' => $this->getHits(),
);
}
}

View File

@@ -12,6 +12,7 @@
use Alchemy\Phrasea\Feed\Aggregate;
use Alchemy\Phrasea\Feed\FeedInterface;
use Alchemy\Phrasea\SearchEngine\SearchEngineOptions;
use Alchemy\Phrasea\SearchEngine\SearchEngineSuggestion;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Border\File;
use Alchemy\Phrasea\Border\Attribute\Status;
@@ -896,7 +897,7 @@ class API_V1_adapter extends API_V1_Abstract
$offsetStart = (int) ($request->get('offset_start') ? : 0);
$perPage = (int) $request->get('per_page') ? : 10;
$query = (string) $request->request->get('query');
$query = (string) $request->get('query');
$this->app['phraseanet.SE']->setOptions($options);
$this->app['phraseanet.SE']->resetCache();
@@ -929,7 +930,9 @@ class API_V1_adapter extends API_V1_Abstract
'warning' => $search_result->getWarning(),
'query_time' => $search_result->getDuration(),
'search_indexes' => $search_result->getIndexes(),
'suggestions' => $search_result->getSuggestions()->toArray(),
'suggestions' => array_map(function (SearchEngineSuggestion $suggestion) {
return $suggestion->toArray();
}, $search_result->getSuggestions()->toArray()),
'results' => array(),
'query' => $search_result->getQuery(),
);

View File

@@ -36,6 +36,7 @@ class collection implements cache_cacheableInterface
protected $databox;
protected $is_active;
protected $binary_logo;
protected $ord;
protected $app;
const PIC_LOGO = 'minilogos';
@@ -63,6 +64,7 @@ class collection implements cache_cacheableInterface
$this->available = $datas['available'];
$this->pub_wm = $datas['pub_wm'];
$this->name = $datas['name'];
$this->ord = $datas['ord'];
$this->prefs = $datas['prefs'];
$this->labels = $datas['labels'];
@@ -96,7 +98,7 @@ class collection implements cache_cacheableInterface
$conn = connection::getPDOConnection($this->app);
$sql = 'SELECT server_coll_id, sbas_id, base_id, active FROM bas
$sql = 'SELECT server_coll_id, sbas_id, base_id, active, ord FROM bas
WHERE server_coll_id = :coll_id AND sbas_id = :sbas_id';
$stmt = $conn->prepare($sql);
@@ -109,6 +111,7 @@ class collection implements cache_cacheableInterface
if ($row) {
$this->is_active = ! ! $row['active'];
$this->base_id = (int) $row['base_id'];
$this->ord = (int) $row['ord'];
}
$stmt->closeCursor();
@@ -119,6 +122,7 @@ class collection implements cache_cacheableInterface
, 'available' => $this->available
, 'pub_wm' => $this->pub_wm
, 'name' => $this->name
, 'ord' => $this->ord
, 'prefs' => $this->prefs
, 'labels' => $this->labels
);
@@ -144,6 +148,20 @@ class collection implements cache_cacheableInterface
return $this;
}
public function get_ord()
{
return $this->ord;
}
public function set_ord($ord)
{
$this->app['phraseanet.appbox']->set_collection_order($this, $ord);
$this->delete_data_from_cache();
$this->app['phraseanet.appbox']->delete_data_from_cache(appbox::CACHE_LIST_BASES);
return $this;
}
public function disable(appbox $appbox)
{
$sql = 'UPDATE bas SET active=0 WHERE base_id = :base_id';

View File

@@ -0,0 +1,90 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2012 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
use Symfony\Component\Process\ExecutableFinder;
class patch_3819 implements patchInterface
{
/** @var string */
private $release = '3.8.1';
/** @var array */
private $concern = array(base::APPLICATION_BOX);
/**
* {@inheritdoc}
*/
public function get_release()
{
return $this->release;
}
/**
* {@inheritdoc}
*/
public function require_all_upgrades()
{
return false;
}
/**
* {@inheritdoc}
*/
public function concern()
{
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function apply(base $appbox, Application $app)
{
$sql = 'SELECT base_id, ord, sbas_id
FROM `bas`
ORDER BY sbas_id, ord';
$stmt = $appbox->get_connection()->prepare($sql);
$stmt->execute();
$rs = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor();
$sbasData = array();
$sbas_id = null;
$reorder = array();
foreach ($rs as $row) {
$sbasData[$row['sbas_id']][] = array('base_id' => $row['base_id']);
if ($sbas_id !== $row['sbas_id']) {
$orders = array();
}
$sbas_id = $row['sbas_id'];
if (in_array($row['ord'], $orders, true)) {
$reorder[] = $row['sbas_id'];
}
$orders[] = $row['ord'];
}
$reorder = array_unique($reorder);
if (count($reorder) > 0) {
$sql = 'UPDATE bas SET ord = :ord WHERE base_id = :base_id';
$stmt = $appbox->get_connection()->prepare($sql);
foreach ($reorder as $sbas_id) {
$i = 1;
foreach ($sbasData[$sbas_id] as $data) {
$stmt->execute(array('base_id' => $data['base_id'], 'ord' => $i++));
}
}
$stmt->closeCursor();
}
return true;
}
}

View File

@@ -57,7 +57,6 @@ $groups = array(
, '//include/jquery.tooltip.js'
, '//include/jslibs/jquery.contextmenu_scroll.js'
, '//include/jslibs/jquery.print.js'
, '//include/jslibs/jquery.multiselect.js'
, '//include/jslibs/jquery.cluetip.js'
, '//include/jquery.nicoslider.js'
, '//skins/report/report.js'

View File

@@ -6,7 +6,7 @@
<tr>
<td valign="center" align="center">
<select size=16 name="coll-order" id="coll-order" style="width:140px;">
{% for collection in databox.get_collections() %}
{% for collection in collections %}
<option value="{{ collection.get_base_id() }}"> {{ collection.get_name() }}</option>
{% endfor %}
</select>
@@ -35,6 +35,11 @@
<script type="text/javascript">
$(document).ready(function(){
var offsets = [
{% for collection in collections %}
{% if not loop.first %},{% endif %} {{ collection.get_ord() }}
{% endfor %}
];
var select = $("#coll-order");
var upButton = $('#upbutton');
var downButton = $('#downbutton');
@@ -63,9 +68,11 @@
applyButton.bind('click', function() {
var $this = $(this);
var order = [];
// clone the array
var appliedoffsets = offsets.slice(0);
select.find('option').each(function(i, option){
order[i] = {id: $(this).val(), name: $(this).text()};
order.push({id: $(this).val(), offset: appliedoffsets.shift()});
});
$.ajax({

View File

@@ -15,25 +15,36 @@
</div>
</div>
</div>
{% set all_coll = dashboard.getAllColl() %}
<div class="form2">
<div class="form_titre">{% trans "report:: 2 - Bases" %}</div>
<div id="select_one">
{% block base_selector %}
{% set all_coll = dashboard.getAllColl() %}
<select name="popbases[]" class="multiselect" multiple="multiple" id="popbases">
<ul class="multiselect" style="max-height: 150px; overflow-y: auto; overflow-x: hidden;">
<li>
<a href="javascript:void(0);" class="select-all">
{% trans %}Select all{% endtrans %}
</a>
<a href="javascript:void(0);" class="deselect-all">
{% trans %}Deselect all{% endtrans %}
</a>
</li>
{% for the_base_coll in all_coll %}
<optgroup label="{{ the_base_coll.name_sbas }}">
<li><label data-group-id="{{ loop.index }}" class="multiselect-group"><b>{{ the_base_coll.name_sbas }}</b></label></li>
{% for a_coll in the_base_coll.sbas_collections %}
<option value="{{ a_coll.sbas_id}}_{{ a_coll.coll_id }}">{{ a_coll.name }}</option>
<li>
<a href="javascript:void(0);">
<label class="checkbox">
<input name="popbases[]" checked="checked" type="checkbox" class="coll-checkbox checkbox-{{ loop.parent.loop.index }}" value="{{ a_coll.sbas_id}}_{{ a_coll.coll_id }}">
{{ a_coll.name }}
</label>
</a>
</li>
{% endfor %}
</optgroup>
{% endfor %}
</select>
{% endblock base_selector %}
</ul>
</div>
</div>
{% endblock form_date_and_base %}

View File

@@ -924,6 +924,29 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
}
}
/**
* @dataProvider provideAvailableSearchMethods
*/
public function testRecordsSearchRouteWithQuery($method)
{
$this->setToken(self::$token);
self::$DI['app']['phraseanet.SE'] = $this->getMock('Alchemy\Phrasea\SearchEngine\SearchEngineInterface');
self::$DI['app']['phraseanet.SE']->expects($this->once())
->method('query')
->with('koala', 0, 10)
->will($this->returnValue(
$this->getMockBuilder('Alchemy\Phrasea\SearchEngine\SearchEngineResult')
->disableOriginalConstructor()
->getMock()
));
$crawler = self::$DI['client']->request($method, '/api/v1/records/search/', $this->getParameters(array('query' => 'koala')), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
}
public function provideAvailableSearchMethods()
{
return array(array('POST'), array('GET'));
}
/**
* @covers \API_V1_adapter::caption_records
*/

View File

@@ -12,7 +12,7 @@ class SearchEngineSuggestionTest extends \PhraseanetPHPUnitAbstract
public function testSetUp()
{
$words = 'plutôt cela';
$query = 'Katy Query';
$query = 'Batman';
$hits = 42;
$suggestion = new SearchEngineSuggestion($query, $words, $hits);
@@ -20,4 +20,36 @@ class SearchEngineSuggestionTest extends \PhraseanetPHPUnitAbstract
$this->assertEquals($query, $suggestion->getQuery());
$this->assertEquals($words, $suggestion->getSuggestion());
}
public function testNullHits()
{
$words = 'plutôt cela';
$query = 'Batman';
$hits = null;
$suggestion = new SearchEngineSuggestion($query, $words, $hits);
$this->assertNull($suggestion->getHits());
$this->assertEquals($query, $suggestion->getQuery());
$this->assertEquals($words, $suggestion->getSuggestion());
}
public function testToArray()
{
$words = 'plutôt cela';
$query = 'Batman';
$hits = 35;
$suggestion = new SearchEngineSuggestion($query, $words, $hits);
$this->assertEquals(array('query' => $words, 'hits' => 35), $suggestion->toArray());
}
public function testToArrayWithNullValue()
{
$words = 'plutôt cela';
$query = 'Batman';
$hits = null;
$suggestion = new SearchEngineSuggestion($query, $words, $hits);
$this->assertEquals(array('query' => $words, 'hits' => null), $suggestion->toArray());
}
}

View File

@@ -56,6 +56,7 @@
$wrapper = $slider.find(".wrapper");
$ulHeight = ul.height();
$wrapper.width($wrapperWidth);
$wrapper.height($ulHeight);
$wrapperCss= {
'overflow':'hidden',
@@ -64,6 +65,7 @@
};
$wrapper.css($wrapperCss);
ul.css('position', 'absolute');
ul.width(ulWidth);
$slider.prepend("<div class='scrollleft'></div>");
$slider.append("<div class='scrollright'></div>");
@@ -78,16 +80,20 @@
rightCss = {
'width' : $scrollWidth - ($wrapper.outerWidth(true) - $wrapper.innerWidth()),
'height' : liHeight,
'height' : liHeight + 5,
'float' : 'right',
'background-color' : o.color
'background-color' : o.color,
'cursor': 'pointer',
' user-select': 'none'
};
leftCss = {
'width' : $scrollWidth - ($wrapper.outerWidth(true) - $wrapper.innerWidth()),
'height' : liHeight,
'height' : liHeight + 5,
'float' : 'left',
'background-color' : o.color
'background-color' : o.color,
'cursor': 'pointer',
' user-select': 'none'
};
leftScroll.css(leftCss);
@@ -95,44 +101,32 @@
var rightScrollWidth = rightScroll.width();
var leftScrollWidth = leftScroll.width();
var scrollInterval = 100;
var scrollXpos = 0;
var scrollStepSpeed = 20;
var scrollStepSpeed = 40;
var speed = 8;
var repeat = null;
var shift = o.start;
//calcul position zone droite
rightScroll.bind("mousemove", function(e){
var x = e.pageX - ($(this).offset().left);
scrollXpos = Math.round((x / rightScrollWidth) * scrollStepSpeed);
});
//calcul position zone gauche
leftScroll.bind("mousemove", function(e){
var x = $(this).innerWidth() - (e.pageX - $(this).offset().left);
scrollXpos = Math.round((x / leftScrollWidth) * scrollStepSpeed);
});
//scroll a droite
rightScroll.bind("mouseenter", function(){
repeat = setInterval(function(){
rightScroll.bind("click", function(e){
var x = e.pageX - ($(this).offset().left);
scrollXpos = Math.round((x / rightScrollWidth) * scrollStepSpeed);
shift += (scrollXpos * speed);
if(shift > (ulWidth - $wrapperWidth) + 50)
{
shift = (ulWidth - $wrapperWidth) + 50;
}
ul.animate({
left: -shift
}, 1);
}, scrollInterval);
});
//scroll a gauche
leftScroll.bind("mouseenter", function(){
repeat = setInterval(function(){
leftScroll.bind("click", function(e){
var x = $(this).innerWidth() - (e.pageX - $(this).offset().left);
scrollXpos = Math.round((x / leftScrollWidth) * scrollStepSpeed);
shift -= (scrollXpos * speed);
if(shift < 0)
@@ -144,19 +138,6 @@
left: -shift
}, 1);
}, scrollInterval);
});
//on stop a droite
rightScroll.bind("mouseout", function(){
clearInterval(repeat);
scrollXpos = 0;
});
//on stop a gauche
leftScroll.bind("mouseout", function(){
clearInterval(repeat);
scrollXpos = 0;
});
}
};

View File

@@ -1,431 +0,0 @@
/*
* jQuery MultiSelect Plugin 0.6
* Copyright (c) 2010 Eric Hynds
*
* http://www.erichynds.com/jquery/jquery-multiselect-plugin-with-themeroller-support/
* Inspired by Cory S.N. LaViska's implementation, A Beautiful Site (http://abeautifulsite.net/) 2009
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
(function($){
$.fn.multiSelect = function(opts){
opts = $.extend({}, $.fn.multiSelect.defaults, opts);
return this.each(function(){
return new MultiSelect(this, opts);
});
};
// counter to dynamically generate label/option IDs if they don't exist
var multiselectID = 0;
var MultiSelect = function(select,o){
var $select = $original = $(select),
$options, $header, $labels,
html = [],
optgroups = [],
isDisabled = $select.is(':disabled'),
id = select.id || 'ui-multiselect-'+multiselectID++; // unique ID for the label & option tags
html.push('<a id="'+ id +'" class="ui-multiselect ui-widget ui-state-default ui-corner-all' + (isDisabled || o.disabled ? ' ui-state-disabled' : '') + '" style="margin-left: 10px;margin-right: 10px;height:20px;">');
html.push('<input readonly="readonly" type="text" class="" value="'+ o.allSelectedText +'" title="'+ select.title +'" /></a>');
html.push('<div class="ui-multiselect-options' + (o.shadow ? ' ui-multiselect-shadow' : '') + ' ui-widget ui-widget-content ui-corner-all" style="margin-left: 10px;margin-right: 10px;border:1px solid #212121;">');
if(o.showHeader){
html.push('<div class="ui-widget-header ui-helper-clearfix ui-corner-all ui-multiselect-header" >');
html.push('<ul class="ui-helper-reset">');
html.push('<li><a class="ui-multiselect-all" href="" style="color:#FF9000;"><span class="ui-icon ui-icon-check"></span>' + o.checkAllText + '</a></li>');
html.push('<li><a class="ui-multiselect-none" href="" style="color:#FF9000;"><span class="ui-icon ui-icon-closethick"></span>' + o.unCheckAllText + '</a></li>');
html.push('<li class="ui-multiselect-close"><a href="" class="ui-multiselect-close ui-icon ui-icon-circle-close"></a></li>');
html.push('</ul>');
html.push('</div>');
}
// build options
html.push('<ul class="ui-multiselect-checkboxes ui-helper-reset">');
/*
If this select is disabled, remove the actual disabled attribute and let themeroller's .ui-state-disabled class handle it.
This is a workaround for jQuery bug #6211 where options in webkit inherit the select's disabled property. This
won't achieve the same level of 'disabled' behavior (the checkboxes will still be present in form submission),
but it at least gives you a way to emulate the UI.
*/
if(isDisabled){
$select.removeAttr("disabled");
}
$select.find('option').each(function(i){
var $this = $(this),
title = $this.html(),
value = this.value,
inputID = this.id || "ui-multiselect-"+id+"-option-"+i,
$parent = $this.parent(),
hasOptGroup = $parent.is('optgroup'),
isDisabled = $this.is(':disabled'),
labelClasses = ['ui-corner-all'];
if(hasOptGroup){
var label = $parent.attr('label');
if($.inArray(label,optgroups) === -1){
html.push('<li class="ui-multiselect-optgroup-label"><a href="#" class="ui-multiselect-all" style="color:#FF9000;float:left;width:350px;">' + label + '</a><a href="#" style="float:right;" class="ui-multiselect-toggleclose ui-icon ui-icon-triangle-1-s"></a></li>');
optgroups.push(label);
}
}
if(value.length > 0){
if(isDisabled){
labelClasses.push('ui-state-disabled');
}
html.push('<li class="' + (isDisabled ? 'ui-multiselect-disabled' : '') +'">');
html.push('<label for="'+inputID+'" class="'+labelClasses.join(' ')+'"><input id="'+inputID+'" type="'+(o.multiple ? 'checkbox' : 'radio')+'" checked="checked" name="'+select.name+'" value="'+value+'" title="'+title+'"');
if($this.is(':selected')){
html.push(' checked="checked"');
}
if(isDisabled){
html.push(' disabled="disabled"');
}
html.push(' />'+title+'</label></li>');
}
});
html.push('</ul></div>');
// append the new control to the DOM; cache queries
$select = $select.after( html.join('') ).next('a.ui-multiselect');
$options = $select.next('div.ui-multiselect-options');
$header = $options.find('div.ui-multiselect-header');
$labels = $options.find('label').not('.ui-state-disabled');
//hide by default
$options.find('li.ui-multiselect-optgroup-label a.ui-multiselect-toggleclose').parent().nextUntil('li.ui-multiselect-optgroup-label').find('label').hide();
// calculate widths
var iconWidth = $select.find('span.ui-icon').outerWidth(), inputWidth = $original.outerWidth(), totalWidth = inputWidth+iconWidth;
if( /\d/.test(o.minWidth) && totalWidth < o.minWidth){
inputWidth = o.minWidth-iconWidth;
totalWidth = o.minWidth;
}
// set widths
$select.width(totalWidth).find('input').width(inputWidth - 6);
// build header links
if(o.showHeader){
$header.find('a').click(function(e){
var $this = $(this);
// close link
if($this.hasClass('ui-multiselect-close')){
$options.trigger('close');
// check all / uncheck all
} else {
var checkAll = $this.hasClass('ui-multiselect-all');
$options.trigger('toggleChecked', [(checkAll ? true : false)]);
checkAll ? $options.find('li.ui-multiselect-optgroup-label a.ui-multiselect-all').css("color", "#FF9000") : $options.find('li.ui-multiselect-optgroup-label a.ui-multiselect-all').css("color", "white") ;
o[ checkAll ? 'onCheckAll' : 'onUncheckAll']['call'](this);
}
e.preventDefault();
});
}
var updateSelected = function(){
var $inputs = $labels.find('input'),
$checked = $inputs.filter(':checked'),
$tot = $inputs.length,
value = '',
numChecked = $checked.length;
if(numChecked === 0){
value = o.noneSelectedText;
} else if($tot == numChecked ) {
value = o.allSelectedText;
}else {
if($.isFunction(o.selectedText)){
value = o.selectedText.call(this, numChecked, $inputs.length, $checked.get());
} else if( /\d/.test(o.selectedList) && o.selectedList > 0 && numChecked <= o.selectedList){
value = $checked.map(function(){ return this.title; }).get().join(', ');
} else {
value = o.selectedText.replace('#', numChecked).replace('#', $inputs.length);
}
}
$select.find('input').val(value);
return value;
};
// the select box events
$select.bind({
click: function(){
$options.trigger('toggle');
},
keypress: function(e){
switch(e.keyCode){
case 27: // esc
case 38: // up
$options.trigger('close');
break;
case 40: // down
case 0: // space
$options.trigger('toggle');
break;
}
},
/*mouseenter: function(){
if(!$select.hasClass('ui-state-disabled')){
$(this).addClass('ui-state-hover');
}
},
mouseleave: function(){
$(this).removeClass('ui-state-hover');
},*/
focus: function(){
if(!$select.hasClass('ui-state-disabled')){
$(this).addClass('ui-state-focus');
}
},
blur: function(){
$(this).removeClass('ui-state-focus');
}
});
// bind custom events to the options div
$options.bind({
'close': function(e, others){
others = others || false;
// hides all other options but the one clicked
if(others === true){
$('div.ui-multiselect-options')
.filter(':visible')
.fadeOut(o.fadeSpeed)
.prev('a.ui-multiselect')
.removeClass('ui-state-active')
.trigger('mouseout');
// hides the clicked options
} else {
$select.removeClass('ui-state-active').trigger('mouseout');
$options.fadeOut(o.fadeSpeed);
}
},
'open': function(e, closeOthers){
// bail if this widget is disabled
if($select.hasClass('ui-state-disabled')){
return;
}
// use position() if inside ui-widget-content, because offset() won't cut it.
var offset = $select.position(),
$container = $options.find('ul:last'),
top, width;
// calling select is active
$select.addClass('ui-state-active');
// hide all other options
if(closeOthers || typeof closeOthers === 'undefined'){
$options.trigger('close', [true]);
}
// calculate positioning
if(o.position === 'middle'){
top = ( offset.top+($select.height()/2)-($options.outerHeight()/2) );
} else if(o.position === 'top'){
top = (offset.top-$options.outerHeight());
} else {
top = (offset.top+$select.outerHeight());
}
// calculate the width of the options menu
width = $select.width()-parseInt($options.css('padding-left'),10)-parseInt($options.css('padding-right'),10);
// select the first option
$labels.filter('label:first').trigger('mouseenter').trigger('focus');
// show the options div + position it
$options.css({
position: 'absolute',
top: top+'px',
left: offset.left+'px',
width: width+'px'
}).show();
// set the scroll of the checkbox container
$container.scrollTop(0);
// set the height of the checkbox container
if(o.maxHeight){
$container.css('height', o.maxHeight);
}
o.onOpen.call($options[0]);
},
'toggle': function(){
$options.trigger( $(this).is(':hidden') ? 'open' : 'close' );
},
'traverse': function(e, start, keycode){
var $start = $(start),
moveToLast = (keycode === 38 || keycode === 37) ? true : false,
// select the first li that isn't an optgroup label / disabled
$next = $start.parent()[moveToLast ? 'prevAll' : 'nextAll']('li:not(.ui-multiselect-disabled, .ui-multiselect-optgroup-label)')[ moveToLast ? 'last' : 'first']();
// if at the first/last element
if(!$next.length){
var $container = $options.find("ul:last");
// move to the first/last
$options.find('label')[ moveToLast ? 'last' : 'first' ]().trigger('mouseover');
// set scroll position
$container.scrollTop( moveToLast ? $container.height() : 0 );
} else {
$next.find('label').trigger('mouseenter');
}
},
'toggleChecked': function(e, flag, group){
var $inputs = (group && group.length) ? group : $labels.find('input');
$inputs.not(':disabled').attr('checked', flag);
updateSelected();
}
})
.find('li.ui-multiselect-optgroup-label a.ui-multiselect-all')
.click(function(e){
// optgroup label toggle support
if(cssColorToHex($(this).css("color")) == "#ffffff")
{
$(this).css("color", "rgb(255,144,0)");
}
else
{
$(this).css("color", "rgb(255,255,255)");
}
var $checkboxes = $(this).parent().nextUntil('li.ui-multiselect-optgroup-label').find('input');
$options.trigger('toggleChecked', [ ($checkboxes.filter(':checked').length === $checkboxes.length) ? false : true, $checkboxes]);
o.onOptgroupToggle.call(this, $checkboxes.get());
e.preventDefault();
});
$options.find('li.ui-multiselect-optgroup-label a.ui-multiselect-toggleclose')
.click(function(e){
var $label = $(this).parent().nextUntil('li.ui-multiselect-optgroup-label').find('label');
// optgroup label toggle support
$label.toggle();
e.preventDefault();
});
/*************************************************************************/
function cssColorToHex(colorStr)
{
var hex = '#';
$.each(colorStr.substring(4).split(','), function(i, str){
var h = ($.trim(str.replace(')',''))*1).toString(16);
hex += (h.length == 1) ? "0" + h : h;
});
return hex;
};
/**************************************************************************/
// labels/checkbox events
$labels.bind({
/*mouseenter: function(){
$labels.removeClass('ui-state-hover');
$(this).addClass('ui-state-hover').find('input').focus();
},*/
keyup: function(e){
switch(e.keyCode){
case 27: // esc
$options.trigger('close');
break;
case 38: // up
case 40: // down
case 37: // left
case 39: // right
$options.trigger('traverse', [this, e.keyCode]);
break;
case 13: // enter
e.preventDefault();
$(this).click();
break;
}
}
})
.find('input')
.bind('click', function(e){
o.onCheck.call(this);
updateSelected();
});
// remove the original input element
$original.remove();
// apply bgiframe if available
if($.fn.bgiframe){
$options.bgiframe();
}
// open by default?
if(o.state === 'open'){
$options.trigger('open', [false]);
}
// update the number of selected elements when the page initially loads, and use that as the defaultValue. necessary for form resets when options are pre-selected.
$select.find('input')[0].defaultValue = updateSelected();
return $select;
};
// close each select when clicking on any other element/anywhere else on the page
$(document).bind('click', function(e){
var $target = $(e.target);
if(!$target.closest('div.ui-multiselect-options').length && !$target.parent().hasClass('ui-multiselect')){
$('div.ui-multiselect-options').trigger('close', [true]);
}
});
// default options
$.fn.multiSelect.defaults = {
showHeader: true,
maxHeight: 380, /* max height of the checkbox container (scroll) in pixels */
minWidth: 380, /* min width of the entire widget in pixels. setting to 'auto' will disable */
checkAllText: 'Cochez tout',
unCheckAllText: 'Décochez Tout',
noneSelectedText: 'Aucune base selectionnée',
selectedText: '# collections selectionnées',
allSelectedText : 'Toutes les bases',
selectedList: 0,
position: 'bottom', /* top|middle|bottom */
shadow: false,
fadeSpeed: 200,
disabled: false,
state: 'closed',
multiple: true,
onCheck: function(){}, /* when an individual checkbox is clicked */
onOpen: function(){}, /* when the select menu is opened */
onCheckAll: function(){}, /* when the check all link is clicked */
onUncheckAll: function(){}, /* when the uncheck all link is clicked */
onOptgroupToggle: function(){} /* when the optgroup heading is clicked */
};
})(jQuery);

View File

@@ -99,29 +99,6 @@ ul {
/** Button style */
.btn {
@glow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 7px rgba(0, 0, 0, 1);
.glow(@glow);
.border-radius(@borderRadiusSmall);
text-shadow : 0 -1px 0 rgba(0, 0, 0, 0.5);
}
.btn-success {
.gradient (@btnSuccessBackground, 0.7);
}
.btn-info {
.gradient (@btnInfoBackground, 0.7);
}
.btn-success:hover {
.gradient (@btnSuccessBackgroundHighlight, 0.7);
}
.btn-info:hover {
.gradient (@btnInfoBackgroundHighlight, 0.7);
}
.btn-flat {
filter:progid:DXImageTransform.Microsoft.Gradient(enabled='false');
-webkit-box-shadow: none;
@@ -195,6 +172,14 @@ ul {
width: 100% !important;
}
.footer a {
color: @footerLinkColor;
}
.footer a:hover {
color: @footerLinkColorHover;
}
/** Alert style */
.alert {
@@ -208,7 +193,7 @@ ul {
.alert .alert-block-close {
width:45px;
text-align: center;
font-size:36px
font-size:36px;
}
.alert table {
@@ -233,6 +218,10 @@ ul {
border-left: 1px solid darken(@successBackground, 20%);
}
.alert.alert-success .alert-block-close a {
color: @successText;
}
.alert.alert-error .alert-block-content {
border-right: 1px solid lighten(@errorBackground, 10%);
}
@@ -241,6 +230,10 @@ ul {
border-left: 1px solid darken(@errorBackground, 20%);
}
.alert.alert-error .alert-block-close a {
color: @errorText;
}
.alert.alert-info .alert-block-content {
border-right: 1px solid lighten(@infoBackground, 10%);
}
@@ -249,6 +242,10 @@ ul {
border-left: 1px solid darken(@infoBackground, 20%);
}
.alert.alert-info .alert-block-close a {
color: @infoText;
}
.alert.alert-warning .alert-block-content {
border-right: 1px solid lighten(@warningBackground, 10%);
}
@@ -257,6 +254,10 @@ ul {
border-left: 1px solid darken(@warningBackground, 20%);
}
.alert.alert-warning .alert-block-close a {
color: @warningText;
}
.alert .close {
position: static;
}

View File

@@ -81,6 +81,8 @@
// -------------------------
@linkColor: #fff;
@linkColorHover: darken(@linkColor, 15%);
@footerLinkColor: @linkColor;
@footerLinkColorHover: @linkColorHover;
// Typography
@@ -132,11 +134,11 @@
@btnPrimaryBackground: @linkColor;
@btnPrimaryBackgroundHighlight: spin(@btnPrimaryBackground, 20%);
@btnInfoBackground: #1c607f;
@btnInfoBackgroundHighlight: darken(@btnInfoBackground, 10%);
@btnInfoBackground: #3d8fa8;
@btnInfoBackgroundHighlight: #0d4461;
@btnSuccessBackground: #1ea062;
@btnSuccessBackgroundHighlight: darken(@btnSuccessBackground, 10%);
@btnSuccessBackground: #2fac74;
@btnSuccessBackgroundHighlight: #118749;
@btnWarningBackground: lighten(@orange, 15%);
@btnWarningBackgroundHighlight: @orange;

View File

@@ -155,6 +155,18 @@
var buttons = {};
buttons[language.send] = function(){
if ($.trim($('input[name="name"]', $dialog.getDomElement()).val()) === '') {
options = {
size : 'Alert',
closeButton : true,
title : language.warning
},
$dialog = p4.Dialog.Create(options, 3);
$dialog.setContent(language.FeedBackNameMandatory);
return false;
}
$dialog.Close();
$('input[name="name"]', $FeedBackForm).val($('input[name="name"]', $dialog.getDomElement()).val());

View File

@@ -19,8 +19,7 @@ var bodySize = {
};
//#############START DOCUMENT READY ######################################//
$(document).ready(function()
{
$(document).ready(function () {
//resize window
$(window).bind('resize', function () {
resize();
@@ -36,13 +35,26 @@ $(document).ready(function()
dashboardDatePicker();
//drawCharts from dashboard
drawCharts();
//init multiselect list box plugin
$(function(){
$("select.multiselect").multiSelect();
});
//
configure_dash();
bindEvents();
$("a.select-all").bind("click", function(e) {
$("ul.multiselect .coll-checkbox", $(this).closest('.form2')).attr("checked", true);
});
$("a.deselect-all").bind("click", function(e) {
$("ul.multiselect .coll-checkbox", $(this).closest('.form2')).attr("checked", false);
});
$(".multiselect-group").toggle(function() {
var $this = $(this);
var groupId = $this.data('group-id');
$(".checkbox-" + groupId, $this.closest('.form2')).attr("checked", true);
}, function() {
var $this = $(this);
var groupId = $this.data('group-id');
$(".checkbox-" + groupId, $this.closest('.form2')).attr("checked", false);
});
});
//#############END DOCUMENT READY ######################################//
@@ -50,16 +62,14 @@ $(document).ready(function()
*
* Tous les binds sur le report
*/
function bindEvents()
{
function bindEvents() {
//load all the report
$('form .formsubmiter').bind('click', function () {
submiterAction($(this));
});
//reload the content by pressing enter key, it concerns the number of result by report
$('form .entersubmiter').bind('keypress', function (event) {
if(event.keyCode == '13')
{
if (event.keyCode == '13') {
$("#DOC-input").attr("checked", "checked").trigger('click');
}
});
@@ -93,11 +103,6 @@ function bindEvents()
}).unbind("click").bind("click", function () {
showMenu();
});
//reload report function of select sbas
//$("select[name=nameDash]").unbind('change').bind('change', function(){
//$(".btn-slide").trigger("click");
//changeDash();
//});
$("#liste_dash").find("em").unbind("click").bind("click", function () {
id = $(this).attr('id').substr(3);
@@ -105,8 +110,7 @@ function bindEvents()
});
}
function reportDatePicker()
{
function reportDatePicker() {
var dates = $('.dmin, .dmax').datepicker({
defaultDate: -10,
changeMonth: true,
@@ -122,8 +126,7 @@ function reportDatePicker()
});
}
function dashboardDatePicker()
{
function dashboardDatePicker() {
$(function () {
$('.dminDash, .dmaxDash').datepicker({
defaultDate: -10,
@@ -141,8 +144,7 @@ function dashboardDatePicker()
});
}
//hide and resize content
function hideMenu()
{
function hideMenu() {
$('.hided').hide();
$(".showed").show();
$(".form").slideToggle("slow", function () {
@@ -151,8 +153,7 @@ function hideMenu()
});
}
function showMenu()
{
function showMenu() {
bodySize.y = $('#mainContainer').height();
$('.showed').hide();
$(".hided").show();
@@ -163,8 +164,7 @@ function showMenu()
});
}
function submiterAction(domSubmiter)
{
function submiterAction(domSubmiter) {
var form = domSubmiter.closest('form');
var container = domSubmiter.closest('.inside-container');
@@ -173,16 +173,13 @@ function submiterAction(domSubmiter)
data.push({name: "action", value: domSubmiter.data('action')});
//check if a base is selected, pop an alert message if not
if(!isOneBaseSelected(form))
{
if (!isOneBaseSelected(form)) {
alertBase();
}
else
{
else {
var request = form.data("request");
if(request && typeof(request.abort) == 'function')
{
if (request && typeof(request.abort) == 'function') {
request.abort();
}
@@ -194,8 +191,7 @@ function submiterAction(domSubmiter)
container.find('.content').empty();
container.find('.answers').addClass('onload');
},
success: function(data)
{
success: function (data) {
container.find('.answers').removeClass('onload');
//load data
container.find('.content').empty().append(data);
@@ -218,10 +214,8 @@ function submiterAction(domSubmiter)
}
}
function initTabs(wrapper)
{
function initTabs(wrapper) {
$tabs = wrapper.find('div.tabs').tabs({
active: 1,
create: function (event, ui) {
//define the div where the table is loaded
load = $(ui.panel).find('.load');
@@ -231,43 +225,49 @@ function initTabs(wrapper)
f_val = form.serialize(true);
//build the table
update_tab(load, form, f_val);
},
activate: function (event, ui) {
//define the div where the table is loaded
load = $(ui.newPanel).find('.load');
//define the form that contain all parameters to build the table in the loaded div
form = $(ui.newPanel).find("form");
//serialize all the form values
f_val = form.serialize(true);
//build the table
update_tab(load, form, f_val);
}
});
}
function openFirstTab()
{
function openFirstTab() {
$('.tabb:visible li').eq(0).find("a").trigger("click");
}
function openSelectedTab()
{
if(class_selected_tab == -1)
{
function openSelectedTab() {
if (class_selected_tab == -1) {
openFirstTab();
}
else if(typeof class_selected_tab == "undefined")
{
else if (typeof class_selected_tab == "undefined") {
openFirstTab();
}
else
{
else {
theclass = class_selected_tab.split(" ");
if($('.' + theclass[0] + ':visible').length > 0)
if ($('.' + theclass[0] + ':visible').length > 0) {
$('.' + theclass[0] + ':visible').find("a").trigger("click");
else
}
else {
openFirstTab();
}
}
}
function initSelectedTab()
{
if( typeof(selected_tab) == 'undefined')
function initSelectedTab() {
if (typeof(selected_tab) == 'undefined') {
selected_tab = 0;
}
}
function alertBase()
{
function alertBase() {
$('body').append("<div id='dialog'><div>");
$('#dialog').dialog({
title: language.choix_collection,
@@ -283,33 +283,31 @@ function alertBase()
});
}
function isOneBaseSelected(form)
{
if(!form.find(".ui-multiselect-checkboxes input:checked").length)
function isOneBaseSelected(form) {
if (!form.find("ul.multiselect input:checked").length) {
return false;
else
}
else {
return true;
}
}
function showOption(domInput)
{
function showOption(domInput) {
var opt = domInput.closest('div').find('.options');
domInput.closest('form').find('.options').hide();
if(domInput.get(0).checked)
if (domInput.get(0).checked) {
opt.show();
}
}
function removeChecked(domInput)
{
function removeChecked(domInput) {
domInput.closest("form").find('input:radio:visible:checked').removeAttr("checked");
}
function tableLinkAction(domLink)
{
function tableLinkAction(domLink) {
var cl = domLink.attr("id");
var arr = cl.split('_');
var w = $('#mainTabs:visible').width();
if(isDocumentLink(domLink))
{
if (isDocumentLink(domLink)) {
$.ajax({
type: "POST",
url: "/report/informations/document",
@@ -323,14 +321,12 @@ function tableLinkAction(domLink)
dmin: date.dmin,
dmax: date.dmax
}),
success: function(data)
{
success: function (data) {
modalBox(data);
}
});
}
else
{
else {
$.ajax({
type: "POST",
url: "/report/informations/user",
@@ -344,21 +340,18 @@ function tableLinkAction(domLink)
dmin: date.dmin,
dmax: date.dmax
}),
success: function(data)
{
success: function (data) {
modalBox(data);
}
});
}
}
function isDocumentLink(domLink)
{
function isDocumentLink(domLink) {
return domLink.hasClass("hasSbas");
}
function modalBox(data)
{
function modalBox(data) {
$('body').append("<div id='dialog'>" + data.rs + "</div>");
$('#dialog').dialog({
title: data.title,
@@ -370,18 +363,14 @@ function modalBox(data)
});
}
function getScrollerStartPosition(selected_tab)
{
function getScrollerStartPosition(selected_tab) {
right = 0;
if(parseInt(selected_tab) === 0)
{
if (parseInt(selected_tab) === 0) {
right = 0;
}
else
{
else {
$('.tabb:visible li').each(function (index) {
if(index == selected_tab)
{
if (index == selected_tab) {
return false;
}
right += $(this).width();
@@ -391,8 +380,7 @@ function getScrollerStartPosition(selected_tab)
}
function changeDash(sbasid)
{
function changeDash(sbasid) {
var dmin = $(".dminDash").val();
var dmax = $(".dmaxDash").val();
$.ajax({
@@ -421,10 +409,8 @@ function changeDash(sbasid)
});
}
function drawCharts()
{
if($('#mytabledaytotal').length > 0)
{
function drawCharts() {
if ($('#mytabledaytotal').length > 0) {
$('#mytabledaytotal').gvChart({
chartType: 'LineChart',
gvSettings: {
@@ -459,8 +445,7 @@ function drawCharts()
});
}
if($('#mytablehour').length > 0)
{
if ($('#mytablehour').length > 0) {
$('#mytablehour').gvChart({
chartType: 'LineChart',
gvSettings: {
@@ -499,8 +484,7 @@ function drawCharts()
});
}
if($('#mytableadded').length > 0)
{
if ($('#mytableadded').length > 0) {
$('#mytableadded').gvChart({
chartType: 'ColumnChart',
gvSettings: {
@@ -538,8 +522,7 @@ function drawCharts()
});
}
if($('#mytableedited').length > 0)
{
if ($('#mytableedited').length > 0) {
$('#mytableedited').gvChart({
chartType: 'ColumnChart',
gvSettings: {
@@ -579,8 +562,7 @@ function drawCharts()
}
//unserialize value
function unserialize(str)
{
function unserialize(str) {
var n_str = str.split("&");
var serialised = new Array();
$.each(n_str, function () {
@@ -590,8 +572,7 @@ function unserialize(str)
return serialised;
}
//pop a dialog box with who download what content
function who()
{
function who() {
$("td a.bound").unbind("click").bind('click', function () {
//get form
var form = $(this).closest(".ui-tabs-panel").find(".report_form");
@@ -610,18 +591,15 @@ function who()
//put the old in the from input
form.find("input[name=from]").val(tbl);
if(col == 'user')
{
if (col == 'user') {
form.find("input[name=user]").val(usrid);
}
else if(tbl == 'CNXB')
{
else if (tbl == 'CNXB') {
form.find("input[name=tbl]").val("infonav");
form.find("input[name=user]").val(val_a);
form.find("input[name=on]").val(col);
}
else
{
else {
form.find("input[name=user]").val(val_a);
form.find("input[name=on]").val(col);
}
@@ -641,8 +619,7 @@ function who()
});
}
//group by the element of each column
function group()
{
function group() {
$("a.groupby").unbind("click").bind("click", function () {
var form = $(this).closest(".ui-tabs-panel").find(".report_form");
var col = $(this).attr('class');
@@ -662,8 +639,7 @@ function group()
});
}
//pop & load the record box informations
function what()
{
function what() {
$(".record_id a").unbind("click").bind('click', function () {
var form = $(this).closest(".ui-tabs-panel").find(".report_form");
var rid = $(this).html();
@@ -686,8 +662,7 @@ function what()
});
}
//construct the dialog_record box
function dialog_record(form, p_message, p_title, tbl)
{
function dialog_record(form, p_message, p_title, tbl) {
//get size attribute
var h = $(document).height();
var w = $('#mainTabs:visible').width();
@@ -712,8 +687,7 @@ function dialog_record(form, p_message, p_title, tbl)
csv();
}
//construct the dialog box filters.
function alert_dialog_filter(submit, form, p_message, p_title)
{
function alert_dialog_filter(submit, form, p_message, p_title) {
var buttons = {};
p_title = p_title || "";
@@ -740,8 +714,7 @@ function alert_dialog_filter(submit, form, p_message, p_title)
});
}
//construct the configuration dialog box
function alert_dialog_conf(submit, form, p_message, p_title)
{
function alert_dialog_conf(submit, form, p_message, p_title) {
var w = $('#mainTabs:visible').width();
var buttons = {};
@@ -757,13 +730,11 @@ function alert_dialog_conf(submit, form, p_message, p_title)
});
form.find("input[name=list_column]").val(list_column);
f_val = form.serialize(true);
if(idChecked.length == 0)
{
if (idChecked.length == 0) {
alert("Vous devez cocher au minimum une case");
return false;
}
else
{
else {
update_tab(submit, form, f_val);
$(this).dialog('destroy').remove();
}
@@ -782,8 +753,7 @@ function alert_dialog_conf(submit, form, p_message, p_title)
});
}
//load the content of the filter box
function dofilter(submit, form, f_val)
{
function dofilter(submit, form, f_val) {
$("a.filter").unbind("click").bind("click", function () {
var col = $(this).attr('class');
form.find("input[name=filter_column]").val(col);
@@ -801,8 +771,7 @@ function dofilter(submit, form, f_val)
});
}
//pop & load the content of the dialog_conf window
function conf(submit, form, f_val)
{
function conf(submit, form, f_val) {
$("a.config").unbind("click").bind("click", function () {
form.find("input[name=conf]").val("on");
$.ajax({
@@ -818,8 +787,7 @@ function conf(submit, form, f_val)
});
}
//load the next page of data array
function next(submit, form, f_val, data)
{
function next(submit, form, f_val, data) {
form.find(".next").unbind('click').bind('click', function () {
form.find("input[name=page]").attr("value", data.next);
form.find("input[name=liste_filter]").attr("value", data.filter);
@@ -829,8 +797,7 @@ function next(submit, form, f_val, data)
});
}
//load the previous page of data array
function prev(submit, form, f_val, data)
{
function prev(submit, form, f_val, data) {
form.find(".prev").unbind('click').bind('click', function () {
form.find("input[name=page]").attr("value", data.prev);
form.find("input[name=liste_filter]").attr("value", data.filter);
@@ -840,8 +807,7 @@ function prev(submit, form, f_val, data)
return false;
}
//print the table when click on the print link
function print()
{
function print() {
$("a.jqprint").unbind("click").bind("click", function () {
var $table = $(this).closest(".report-table");
var $graph = $(this).closest(".graph");
@@ -854,8 +820,7 @@ function print()
});
}
function csv()
{
function csv() {
var button = $(".form_csv input[name=submit]");
button.unbind("click").bind("click", function (e) {
@@ -863,19 +828,16 @@ function csv()
var $this = $(this);
var $formm = $this.closest("form");
if($this.closest("#dialog").length > 0)
{
if ($this.closest("#dialog").length > 0) {
var $form = $("#dialog").data("dataForm");
}
else
{
else {
var $form = $this.closest(".ui-tabs-panel").find(".report_form");
}
$form.find("input[name=printcsv]").val("on");
if(button.data('ajaxRunning'))
{
if (button.data('ajaxRunning')) {
button.data('ajaxQuery').abort();
button.data('ajaxRunning', false);
}
@@ -901,14 +863,12 @@ function csv()
button.data('ajaxRunning', false);
$form.find("input[name=printcsv]").val("off");
if(typeof data.rs === "object")
{
if (typeof data.rs === "object") {
var $key = $this.closest("table").attr("class");
var $csv = data.rs[$key];
$formm.find("textarea[name=csv]").val($csv);
}
else if (data.rs === false)
{
else if (data.rs === false) {
$("body").append("<div id='dialog'>Une erreur s'est produite</div>");
$("#dialog").dialog({
close: function () {
@@ -916,8 +876,7 @@ function csv()
}
});
}
else
{
else {
$formm.find("textarea[name=csv]").val(data.rs);
}
$formm.find("input[name=doit]").trigger('click');
@@ -928,26 +887,23 @@ function csv()
}
//order the array by DESC or ASC when clicking a column
function orderArray()
{
function orderArray() {
$('.orderby').unbind("click").bind('click', function () {
var $this = $(this);
var champ = $(this).parent().attr('class');
var submit_click = $this.closest(".report-table").parent();
var form_click = submit_click.parent().find("form");
var order = 'asc';
if(form_click.find("input[name=order]").val() == "")
if (form_click.find("input[name=order]").val() == "") {
order = "asc";
}
if(form_click.find("input[name=order]").val() == "asc")
{
if (form_click.find("input[name=order]").val() == "asc") {
order = "desc";
$this.find('.asc').hide();
}
else
{
else {
order = "asc";
$this.find('.desc').hide();
}
@@ -960,77 +916,69 @@ function orderArray()
});
}
//show hide prev & next or both according to the result
function navigation(form, prev, next, display_nav)
{
if(prev == 0)
function navigation(form, prev, next, display_nav) {
if (prev == 0) {
form.find("input[name=prev]").hide();
else
}
else {
form.find("input[name=prev]").show();
}
if(next == false)
if (next == false) {
form.find("input[name=next]").hide();
else
}
else {
form.find("input[name=next]").show();
}
if(display_nav == false || ((prev == 0) && (next == false)))
if (display_nav == false || ((prev == 0) && (next == false))) {
form.hide();
}
}
//color filter'slink if a filter is active
function colorFilter(col)
{
if($.isArray(col))
{
function colorFilter(col) {
if ($.isArray(col)) {
$.each(col, function () {
$("a." + this).filter("a.filter").css("color", "#0000FF");
});
}
}
//show hide desc or asc arrow according to the order of the table
function arrow(form)
{
function arrow(form) {
var cl = form.find("input[name=champ]").val();
if(cl != "")
{
if (cl != "") {
var th = $("th." + cl + ":visible");
th.css("color", "white");
if(form.find("input[name=order]").val() == "asc")
{
if (form.find("input[name=order]").val() == "asc") {
th.find('.asc').hide();
}
else if(form.find("input[name=order]").val() == "desc")
{
else if (form.find("input[name=order]").val() == "desc") {
th.find('.desc').hide();
}
}
}
//load default page and number of result if the user seizes crazy things in this inputs
function page(form, lim, array_val)
{
function page(form, lim, array_val) {
var current_lim = form.find("input[name=limit]").val();
if(current_lim < 1 || Math.floor(current_lim).toString() != current_lim.toString())
{
if (current_lim < 1 || Math.floor(current_lim).toString() != current_lim.toString()) {
current_lim = 30;
form.find("input[name=limit]").attr("value", current_lim);
}
if(current_lim != lim)
{
if (current_lim != lim) {
form.find("input[name=page]").attr("value", "1");
}
else
{
if(array_val["page"] < 1 || Math.floor(array_val["page"]).toString() != array_val["page"].toString())
{
else {
if (array_val["page"] < 1 || Math.floor(array_val["page"]).toString() != array_val["page"].toString()) {
array_val["page"] = 1;
}
form.find("input[name=page]").attr("value", array_val["page"]);
}
}
//do a submit button to load new users conf
function go(submit, form, f_val, data)
{
function go(submit, form, f_val, data) {
$(".submiter").bind("click", function () {
form.find("input[name=liste_filter]").attr("value", data.filter);
form.find("input[name=action]").attr("value", $(this).data('action'));
@@ -1043,8 +991,7 @@ function go(submit, form, f_val, data)
//submit is the div where we want to load the updated tab
//form is the current form
//f_val is the serialized form
function update_tab(submit, form, f_val)
{
function update_tab(submit, form, f_val) {
//unserialize the form values
var array_val = unserialize(f_val);
//attribute the current page & check values
@@ -1082,8 +1029,9 @@ function update_tab(submit, form, f_val)
if ($tabs.data("ui-tabs")) {
var selected_tab = $tabs.tabs('option', 'active');
}
if( typeof(selected_tab) === 'undefined')
if (typeof(selected_tab) === 'undefined') {
selected_tab = 0;
}
class_selected_tab = $('.tabb:visible li').eq(selected_tab).attr('class');
//hide show the next and previous button according to the results
navigation(form, data.prev, data.next, data.display_nav);
@@ -1120,11 +1068,9 @@ function update_tab(submit, form, f_val)
}
function drawPlatformAndNavigatorChart(data)
{
function drawPlatformAndNavigatorChart(data) {
$.each(data, function (k, v) {
if(v.name == "tbl" && v.value == "CNXB")
{
if (v.name == "tbl" && v.value == "CNXB") {
$(".navi").each(function () {
$(this).gvChart({
chartType: 'PieChart',
@@ -1139,8 +1085,7 @@ function drawPlatformAndNavigatorChart(data)
});
});
}
else if(v.name == "tbl" && v.value == "SITEACTIVITY")
{
else if (v.name == "tbl" && v.value == "SITEACTIVITY") {
$(".tblsite").gvChart({
chartType: 'LineChart',
gvSettings: {
@@ -1160,8 +1105,7 @@ function drawPlatformAndNavigatorChart(data)
}
//resize report div
function resize()
{
function resize() {
bodySize.y = $('#mainContainer').innerHeight();
bodySize.x = $('#mainContainer').innerWidth();
@@ -1184,19 +1128,20 @@ function sessionactive(){
window.setTimeout("sessionactive();", 10000);
},
success: function (data) {
if(data)
if (data) {
manageSession(data);
}
var t = 120000;
if(data.apps && parseInt(data.apps) > 1)
if (data.apps && parseInt(data.apps) > 1) {
t = Math.round((Math.sqrt(parseInt(data.apps) - 1) * 1.3 * 120000));
}
window.setTimeout("sessionactive();", t);
return;
}
});
};
function configure_dash()
{
function configure_dash() {
$(".btn-slide").click(function () {
$("#panel").slideToggle("slow");
$(this).toggleClass("arrowUp");