Merge branch '3.8'

Conflicts:
	composer.lock
	lib/Alchemy/Phrasea/Application.php
	lib/Alchemy/Phrasea/Command/Setup/H264MappingGenerator.php
	lib/Alchemy/Phrasea/Controller/AbstractDelivery.php
	lib/Alchemy/Phrasea/Controller/Prod/DoDownload.php
	lib/Alchemy/Phrasea/Controller/Prod/Edit.php
	lib/Alchemy/Phrasea/Controller/Prod/Story.php
	lib/Alchemy/Phrasea/Controller/Prod/Upload.php
	lib/Alchemy/Phrasea/Controller/Report/Activity.php
	lib/Alchemy/Phrasea/Controller/Report/Root.php
	lib/Alchemy/Phrasea/Controller/Root/Account.php
	lib/Alchemy/Phrasea/Core/PhraseaEvents.php
	lib/Alchemy/Phrasea/Core/Version.php
	lib/classes/API/V1/adapter.php
	lib/classes/User/Adapter.php
	lib/classes/databox.php
	lib/classes/media/subdef.php
	lib/classes/module/report.php
	lib/classes/module/report/activity.php
	lib/classes/module/report/connexion.php
	lib/classes/module/report/download.php
	lib/classes/module/report/nav.php
	lib/classes/module/report/question.php
	lib/classes/module/report/sqlaction.php
	lib/classes/module/report/sqlconnexion.php
	lib/classes/module/report/sqldownload.php
	lib/classes/module/report/sqlfilter.php
	lib/classes/task/abstract.php
	locale/de_DE/LC_MESSAGES/phraseanet.mo
	locale/de_DE/LC_MESSAGES/phraseanet.po
	locale/en_GB/LC_MESSAGES/phraseanet.mo
	locale/en_GB/LC_MESSAGES/phraseanet.po
	locale/fr_FR/LC_MESSAGES/phraseanet.mo
	locale/fr_FR/LC_MESSAGES/phraseanet.po
	locale/nl_NL/LC_MESSAGES/phraseanet.mo
	locale/nl_NL/LC_MESSAGES/phraseanet.po
	locale/phraseanet.pot
	templates/web/prod/index.html.twig
	tests/Alchemy/Tests/Phrasea/Application/ApiAbstract.php
	tests/classes/api/v1/api_v1_adapterTest.php
	tests/classes/report/activityTest.php
	tests/classes/report/editTest.php
This commit is contained in:
Nicolas Le Goff
2014-12-09 13:59:29 +01:00
55 changed files with 1106 additions and 325 deletions

View File

@@ -47,7 +47,7 @@
"jms/translation-bundle" : "~1.1", "jms/translation-bundle" : "~1.1",
"justinrainbow/json-schema" : "~1.3", "justinrainbow/json-schema" : "~1.3",
"mediavorus/mediavorus" : "~0.4.0", "mediavorus/mediavorus" : "~0.4.0",
"media-alchemyst/media-alchemyst" : "~0.4.0", "media-alchemyst/media-alchemyst" : "dev-master",
"monolog/monolog" : "~1.3", "monolog/monolog" : "~1.3",
"mrclay/minify" : "~2.1.6", "mrclay/minify" : "~2.1.6",
"neutron/process-manager" : "2.0.x-dev@dev", "neutron/process-manager" : "2.0.x-dev@dev",

23
composer.lock generated
View File

@@ -1574,12 +1574,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/alchemy-fr/Imagine.git", "url": "https://github.com/alchemy-fr/Imagine.git",
"reference": "e75d9495677b40e0868836e3510667178b2bd90a" "reference": "372f36e2d76e4ca1fbdccda57c23b8483ed700b1"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/alchemy-fr/Imagine/zipball/e75d9495677b40e0868836e3510667178b2bd90a", "url": "https://api.github.com/repos/alchemy-fr/Imagine/zipball/372f36e2d76e4ca1fbdccda57c23b8483ed700b1",
"reference": "e75d9495677b40e0868836e3510667178b2bd90a", "reference": "372f36e2d76e4ca1fbdccda57c23b8483ed700b1",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1596,7 +1596,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-develop": "0.7-dev" "dev-develop": "0.6-dev"
} }
}, },
"autoload": { "autoload": {
@@ -1623,9 +1623,9 @@
"image processing" "image processing"
], ],
"support": { "support": {
"source": "https://github.com/nlegoff/Imagine/tree/flatten-layer" "source": "https://github.com/alchemy-fr/Imagine/tree/0.6.1-flatten-layer"
}, },
"time": "2014-10-08 16:23:33" "time": "2014-11-19 14:31:17"
}, },
{ {
"name": "ircmaxell/random-lib", "name": "ircmaxell/random-lib",
@@ -2020,16 +2020,16 @@
}, },
{ {
"name": "media-alchemyst/media-alchemyst", "name": "media-alchemyst/media-alchemyst",
"version": "0.4.6", "version": "dev-master",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/alchemy-fr/Media-Alchemyst.git", "url": "https://github.com/alchemy-fr/Media-Alchemyst.git",
"reference": "0145a40c01b67268a29ee3863e1ce7be4ad60ac8" "reference": "62fec183416ce6dfdf22e832f0de3c7442a23598"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/alchemy-fr/Media-Alchemyst/zipball/0145a40c01b67268a29ee3863e1ce7be4ad60ac8", "url": "https://api.github.com/repos/alchemy-fr/Media-Alchemyst/zipball/62fec183416ce6dfdf22e832f0de3c7442a23598",
"reference": "0145a40c01b67268a29ee3863e1ce7be4ad60ac8", "reference": "62fec183416ce6dfdf22e832f0de3c7442a23598",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -2089,7 +2089,7 @@
"video", "video",
"video processing" "video processing"
], ],
"time": "2014-09-10 09:44:33" "time": "2014-10-20 07:22:23"
}, },
{ {
"name": "mediavorus/mediavorus", "name": "mediavorus/mediavorus",
@@ -4967,6 +4967,7 @@
"alchemy/zippy": 20, "alchemy/zippy": 20,
"imagine/imagine": 20, "imagine/imagine": 20,
"neutron/process-manager": 20, "neutron/process-manager": 20,
"media-alchemyst/media-alchemyst": 20,
"phpexiftool/phpexiftool": 20, "phpexiftool/phpexiftool": 20,
"silex/silex": 20, "silex/silex": 20,
"silex/web-profiler": 20, "silex/web-profiler": 20,

View File

@@ -486,6 +486,7 @@ class Application extends SilexApplication
$dispatcher->addSubscriber($app['phraseanet.maintenance-subscriber']); $dispatcher->addSubscriber($app['phraseanet.maintenance-subscriber']);
$dispatcher->addSubscriber($app['phraseanet.cookie-disabler-subscriber']); $dispatcher->addSubscriber($app['phraseanet.cookie-disabler-subscriber']);
$dispatcher->addSubscriber($app['phraseanet.session-manager-subscriber']); $dispatcher->addSubscriber($app['phraseanet.session-manager-subscriber']);
<<<<<<< HEAD
$dispatcher->addSubscriber(new PhraseaInstallSubscriber($app)); $dispatcher->addSubscriber(new PhraseaInstallSubscriber($app));
$dispatcher->addSubscriber(new FeedEntrySubscriber($app)); $dispatcher->addSubscriber(new FeedEntrySubscriber($app));
$dispatcher->addSubscriber(new RegistrationSubscriber($app)); $dispatcher->addSubscriber(new RegistrationSubscriber($app));
@@ -495,6 +496,9 @@ class Application extends SilexApplication
$dispatcher->addSubscriber(new BasketSubscriber($app)); $dispatcher->addSubscriber(new BasketSubscriber($app));
$dispatcher->addSubscriber(new LazaretSubscriber($app)); $dispatcher->addSubscriber(new LazaretSubscriber($app));
$dispatcher->addSubscriber(new ValidationSubscriber($app)); $dispatcher->addSubscriber(new ValidationSubscriber($app));
=======
$dispatcher->addSubscriber($app['phraseanet.record-edit-subscriber']);
>>>>>>> 3.8
return $dispatcher; return $dispatcher;
}) })

View File

@@ -12,6 +12,7 @@
namespace Alchemy\Phrasea\Application; namespace Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Application as PhraseaApplication; use Alchemy\Phrasea\Application as PhraseaApplication;
use Alchemy\Phrasea\Controller\Datafiles;
use Alchemy\Phrasea\Core\Event\Subscriber\ApiCorsSubscriber; use Alchemy\Phrasea\Core\Event\Subscriber\ApiCorsSubscriber;
use Alchemy\Phrasea\Core\PhraseaEvents; use Alchemy\Phrasea\Core\PhraseaEvents;
use Alchemy\Phrasea\Controller\Api\Oauth2; use Alchemy\Phrasea\Controller\Api\Oauth2;
@@ -107,6 +108,7 @@ return call_user_func(function ($environment = PhraseaApplication::ENV_PROD) {
}); });
$app->mount('/api/oauthv2', new Oauth2()); $app->mount('/api/oauthv2', new Oauth2());
$app->mount('/datafiles/', new Datafiles());
$app->mount('/api/v1', new V1()); $app->mount('/api/v1', new V1());
$app['dispatcher'] = $app->share($app->extend('dispatcher', function ($dispatcher, PhraseaApplication $app) { $app['dispatcher'] = $app->share($app->extend('dispatcher', function ($dispatcher, PhraseaApplication $app) {

View File

@@ -52,8 +52,8 @@ class H264MappingGenerator extends Command
$conf = [ $conf = [
'enabled' => $enabled, 'enabled' => $enabled,
'type' => $type, 'type' => $type,
'mapping' => array_replace_recursive($mode->getMapping(), $currentMapping), 'mapping' => $mode->getMapping(),
]; );
if ($input->getOption('write')) { if ($input->getOption('write')) {
$output->write("Writing configuration ..."); $output->write("Writing configuration ...");
@@ -77,7 +77,11 @@ class H264MappingGenerator extends Command
$ret = []; $ret = [];
foreach ($paths as $path) { foreach ($paths as $path) {
$ret[$path] = $this->pathsToConf($path); $sanitizedPath = rtrim($path, '/');
if (array_key_exists($sanitizedPath, $ret)) {
continue;
}
$ret[$sanitizedPath] = $this->pathsToConf($sanitizedPath);
} }
return $ret; return $ret;

View File

@@ -21,7 +21,10 @@ abstract class AbstractDelivery implements ControllerProviderInterface
public function deliverContent(Request $request, \record_adapter $record, $subdef, $watermark, $stamp, Application $app) public function deliverContent(Request $request, \record_adapter $record, $subdef, $watermark, $stamp, Application $app)
{ {
$file = $record->get_subdef($subdef); $file = $record->get_subdef($subdef);
<<<<<<< HEAD
=======
>>>>>>> 3.8
$pathOut = $file->get_pathfile(); $pathOut = $file->get_pathfile();
if ($watermark === true && $file->get_type() === \media_subdef::TYPE_IMAGE) { if ($watermark === true && $file->get_type() === \media_subdef::TYPE_IMAGE) {
@@ -30,6 +33,7 @@ abstract class AbstractDelivery implements ControllerProviderInterface
$pathOut = \recordutils_image::stamp($app, $file); $pathOut = \recordutils_image::stamp($app, $file);
} }
<<<<<<< HEAD
$log_id = null; $log_id = null;
try { try {
$logger = $app['phraseanet.logger']($record->get_databox()); $logger = $app['phraseanet.logger']($record->get_databox());
@@ -46,27 +50,20 @@ abstract class AbstractDelivery implements ControllerProviderInterface
} }
=======
>>>>>>> 3.8
$disposition = $request->query->get('download') ? DeliverDataInterface::DISPOSITION_ATTACHMENT : DeliverDataInterface::DISPOSITION_INLINE; $disposition = $request->query->get('download') ? DeliverDataInterface::DISPOSITION_ATTACHMENT : DeliverDataInterface::DISPOSITION_INLINE;
$response = $app['phraseanet.file-serve']->deliverFile($pathOut, $file->get_file(), $disposition, $file->get_mime()); $response = $app['phraseanet.file-serve']->deliverFile($pathOut, $file->get_file(), $disposition, $file->get_mime());
$response->setPrivate();
/* @var $response \Symfony\Component\HttpFoundation\Response */ if (in_array($subdef, array('document', 'preview'))) {
if ($file->getEtag()) { $response->setPrivate();
$response->setEtag($file->getEtag()); $this->logView($app, $record, $request);
$response->setLastModified($file->get_modification_date()); } elseif ($subdef !== 'thumbnail') {
}
if (false === $record->is_grouping() && $subdef !== 'document') {
try { try {
if ($file->getDataboxSubdef()->get_class() == \databox_subdef::CLASS_THUMBNAIL) { if ($file->getDataboxSubdef()->get_class() != \databox_subdef::CLASS_THUMBNAIL) {
// default expiration is 5 days $response->setPrivate();
$expiration = 60 * 60 * 24 * 5; $this->logView($app, $record, $request);
$response->setExpires(new \DateTime(sprintf('+%d seconds', $expiration)));
$response->setMaxAge($expiration);
$response->setSharedMaxAge($expiration);
$response->setPublic();
} }
} catch (\Exception $e) { } catch (\Exception $e) {
@@ -77,4 +74,15 @@ abstract class AbstractDelivery implements ControllerProviderInterface
return $response; return $response;
} }
private function logView(Application $app, \record_adapter $record, Request $request)
{
try {
$logger = $app['phraseanet.logger']($record->get_databox());
$log_id = $logger->get_id();
$record->log_view($log_id, $request->headers->get('referer', 'NO REFERRER'), $app['phraseanet.configuration']['main']['key']);
} catch (\Exception $e) {
}
}
} }

View File

@@ -60,10 +60,18 @@ class DoDownload implements ControllerProviderInterface
*/ */
public function prepareDownload(Application $app, Request $request, Token $token) public function prepareDownload(Application $app, Request $request, Token $token)
{ {
<<<<<<< HEAD
if (false === $list = @unserialize($token->getData())) { if (false === $list = @unserialize($token->getData())) {
$app->abort(500, 'Invalid datas'); $app->abort(500, 'Invalid datas');
} }
if (!is_array($list)) { if (!is_array($list)) {
=======
$datas = $app['tokens']->helloToken($token);
if (false === $list = @unserialize((string) $datas['datas'])) {
>>>>>>> 3.8
$app->abort(500, 'Invalid datas'); $app->abort(500, 'Invalid datas');
} }
@@ -180,12 +188,21 @@ class DoDownload implements ControllerProviderInterface
$app['session']->save(); $app['session']->save();
ignore_user_abort(true); ignore_user_abort(true);
<<<<<<< HEAD
\set_export::build_zip( \set_export::build_zip(
$app, $app,
$token, $token,
$list, $list,
sprintf($app['tmp.download.path'].'/%s.zip', $token->getValue()) // Dest file sprintf($app['tmp.download.path'].'/%s.zip', $token->getValue()) // Dest file
); );
=======
if ($list['count'] > 1) {
\set_export::build_zip($app, $token, $list, sprintf($app['root.path'] . '/tmp/download/%s.zip', $datas['value']));
} else {
$list['complete'] = true;
$app['tokens']->updateToken($token, serialize($list));
}
>>>>>>> 3.8
return $app->json([ return $app->json([
'success' => true, 'success' => true,

View File

@@ -11,6 +11,8 @@
namespace Alchemy\Phrasea\Controller\Prod; namespace Alchemy\Phrasea\Controller\Prod;
use Alchemy\Phrasea\Core\Event\RecordEdit;
use Alchemy\Phrasea\Core\PhraseaEvents;
use Alchemy\Phrasea\Vocabulary\Controller as VocabularyController; use Alchemy\Phrasea\Vocabulary\Controller as VocabularyController;
use Alchemy\Phrasea\Controller\RecordsRequest; use Alchemy\Phrasea\Controller\RecordsRequest;
use Alchemy\Phrasea\Metadata\Tag\TfEditdate; use Alchemy\Phrasea\Metadata\Tag\TfEditdate;
@@ -309,18 +311,11 @@ class Edit implements ControllerProviderInterface
return $app->json(['message' => '', 'error' => false]); return $app->json(['message' => '', 'error' => false]);
} }
$app['dispatcher']->dispatch(PhraseaEvents::RECORD_EDIT, new RecordEdit($records));
$databoxes = $records->databoxes(); $databoxes = $records->databoxes();
$databox = array_pop($databoxes); $databox = array_pop($databoxes);
$meta_struct = $databox->get_meta_structure();
$write_edit_el = false;
$date_obj = new \DateTime();
foreach ($meta_struct->get_elements() as $meta_struct_el) {
if ($meta_struct_el->get_tag() instanceof TfEditdate) {
$write_edit_el = $meta_struct_el;
}
}
$elements = $records->toArray(); $elements = $records->toArray();
foreach ($request->request->get('mds') as $rec) { foreach ($request->request->get('mds') as $rec) {
@@ -349,6 +344,7 @@ class Edit implements ControllerProviderInterface
$record->set_metadatas($rec['metadatas']); $record->set_metadatas($rec['metadatas']);
} }
<<<<<<< HEAD
/** /**
* todo : this should not work * todo : this should not work
*/ */
@@ -374,6 +370,8 @@ class Edit implements ControllerProviderInterface
$record->set_metadatas($metas, true); $record->set_metadatas($metas, true);
} }
=======
>>>>>>> 3.8
$newstat = $record->get_status(); $newstat = $record->get_status();
$statbits = ltrim($statbits, 'x'); $statbits = ltrim($statbits, 'x');
if (!in_array($statbits, ['', 'null'])) { if (!in_array($statbits, ['', 'null'])) {

View File

@@ -439,6 +439,6 @@ class Lazaret implements ControllerProviderInterface
$lazaretThumbFileName = $app['tmp.lazaret.path'].'/'.$lazaretFile->getThumbFilename(); $lazaretThumbFileName = $app['tmp.lazaret.path'].'/'.$lazaretFile->getThumbFilename();
return $app['phraseanet.file-serve']->deliverFile($lazaretThumbFileName, $lazaretFile->getOriginalName(), DeliverDataInterface::DISPOSITION_INLINE, 'image/jpeg', 3600); return $app['phraseanet.file-serve']->deliverFile($lazaretThumbFileName, $lazaretFile->getOriginalName(), DeliverDataInterface::DISPOSITION_INLINE, 'image/jpeg');
} }
} }

View File

@@ -13,7 +13,12 @@ namespace Alchemy\Phrasea\Controller\Prod;
use Alchemy\Phrasea\Controller\Exception as ControllerException; use Alchemy\Phrasea\Controller\Exception as ControllerException;
use Alchemy\Phrasea\Controller\RecordsRequest; use Alchemy\Phrasea\Controller\RecordsRequest;
<<<<<<< HEAD
use Alchemy\Phrasea\Model\Entities\StoryWZ; use Alchemy\Phrasea\Model\Entities\StoryWZ;
=======
use Alchemy\Phrasea\Core\Event\RecordEdit;
use Alchemy\Phrasea\Core\PhraseaEvents;
>>>>>>> 3.8
use Silex\Application; use Silex\Application;
use Silex\ControllerProviderInterface; use Silex\ControllerProviderInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
@@ -132,7 +137,13 @@ class Story implements ControllerProviderInterface
$n++; $n++;
} }
<<<<<<< HEAD
$data = [ $data = [
=======
$app['dispatcher']->dispatch(PhraseaEvents::RECORD_EDIT, new RecordEdit($Story));
$data = array(
>>>>>>> 3.8
'success' => true 'success' => true
, 'message' => $app->trans('%quantity% records added', ['%quantity%' => $n]) , 'message' => $app->trans('%quantity% records added', ['%quantity%' => $n])
]; ];
@@ -159,6 +170,9 @@ class Story implements ControllerProviderInterface
, 'message' => $app->trans('Record removed from story') , 'message' => $app->trans('Record removed from story')
]; ];
$app['dispatcher']->dispatch(PhraseaEvents::RECORD_EDIT, new RecordEdit($Story));
if ($request->getRequestFormat() == 'json') { if ($request->getRequestFormat() == 'json') {
return $app->json($data); return $app->json($data);
} else { } else {
@@ -221,7 +235,13 @@ class Story implements ControllerProviderInterface
$stmt->closeCursor(); $stmt->closeCursor();
<<<<<<< HEAD
$ret = ['success' => true, 'message' => $app->trans('Story updated')]; $ret = ['success' => true, 'message' => $app->trans('Story updated')];
=======
$app['dispatcher']->dispatch(PhraseaEvents::RECORD_EDIT, new RecordEdit($story));
$ret = array('success' => true, 'message' => _('Story updated'));
>>>>>>> 3.8
} catch (ControllerException $e) { } catch (ControllerException $e) {
$ret = ['success' => false, 'message' => $e->getMessage()]; $ret = ['success' => false, 'message' => $e->getMessage()];
} catch (\Exception $e) { } catch (\Exception $e) {

View File

@@ -13,7 +13,11 @@ namespace Alchemy\Phrasea\Controller\Prod;
use Alchemy\Phrasea\Border\File; use Alchemy\Phrasea\Border\File;
use Alchemy\Phrasea\Border\Attribute\Status; use Alchemy\Phrasea\Border\Attribute\Status;
<<<<<<< HEAD
use Alchemy\Phrasea\Core\Event\LazaretEvent; use Alchemy\Phrasea\Core\Event\LazaretEvent;
=======
use Alchemy\Phrasea\Core\Event\RecordEdit;
>>>>>>> 3.8
use Alchemy\Phrasea\Core\PhraseaEvents; use Alchemy\Phrasea\Core\PhraseaEvents;
use DataURI\Parser; use DataURI\Parser;
use DataURI\Exception\Exception as DataUriException; use DataURI\Exception\Exception as DataUriException;
@@ -209,6 +213,8 @@ class Upload implements ControllerProviderInterface
$message = $app->trans('The record was successfully created'); $message = $app->trans('The record was successfully created');
$app['phraseanet.SE']->addRecord($elementCreated); $app['phraseanet.SE']->addRecord($elementCreated);
$app['dispatcher']->dispatch(PhraseaEvents::RECORD_UPLOAD, new RecordEdit($elementCreated));
// try to create thumbnail from data URI // try to create thumbnail from data URI
if ('' !== $b64Image = $request->request->get('b64_image', '')) { if ('' !== $b64Image = $request->request->get('b64_image', '')) {
try { try {

View File

@@ -343,12 +343,21 @@ class Activity implements ControllerProviderInterface
*/ */
public function doReportSiteActiviyPerDays(Application $app, Request $request) public function doReportSiteActiviyPerDays(Application $app, Request $request)
{ {
<<<<<<< HEAD
$conf = [ $conf = [
'ddate' => [$app->trans('report:: jour'), 0, 0, 0, 0], 'ddate' => [$app->trans('report:: jour'), 0, 0, 0, 0],
'total' => [$app->trans('report:: total des telechargements'), 0, 0, 0, 0], 'total' => [$app->trans('report:: total des telechargements'), 0, 0, 0, 0],
'preview' => [$app->trans('report:: preview'), 0, 0, 0, 0], 'preview' => [$app->trans('report:: preview'), 0, 0, 0, 0],
'document' => [$app->trans('report:: document original'), 0, 0, 0, 0] 'document' => [$app->trans('report:: document original'), 0, 0, 0, 0]
]; ];
=======
$conf = array(
'ddate' => array(_('report:: jour'), 0, 0, 0, 0),
'total' => array(_('report:: total des telechargements'), 0, 0, 0, 0),
'preview' => array(_('report:: preview'), 0, 0, 0, 0),
'document' => array(_('report:: document'), 0, 0, 0, 0)
);
>>>>>>> 3.8
$activity = new \module_report_activity( $activity = new \module_report_activity(
$app, $app,

View File

@@ -302,6 +302,10 @@ class Root implements ControllerProviderInterface
*/ */
public function doReportDownloads(Application $app, Request $request) public function doReportDownloads(Application $app, Request $request)
{ {
// no_// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
$download = new \module_report_download( $download = new \module_report_download(
$app, $app,
$request->request->get('dmin'), $request->request->get('dmin'),
@@ -310,9 +314,18 @@ class Root implements ControllerProviderInterface
$request->request->get('collection') $request->request->get('collection')
); );
<<<<<<< HEAD
$conf_pref = []; $conf_pref = [];
=======
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
$conf_pref = array();
>>>>>>> 3.8
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
foreach (\module_report::getPreff($app, $request->request->get('sbasid')) as $field) { foreach (\module_report::getPreff($app, $request->request->get('sbasid')) as $field) {
<<<<<<< HEAD
$conf_pref[strtolower($field)] = [$field, 0, 0, 0, 0]; $conf_pref[strtolower($field)] = [$field, 0, 0, 0, 0];
} }
@@ -328,24 +341,64 @@ class Root implements ControllerProviderInterface
'pays' => [$app->trans('report:: pays'), 1, 1, 1, 1], 'pays' => [$app->trans('report:: pays'), 1, 1, 1, 1],
'societe' => [$app->trans('report:: societe'), 1, 1, 1, 1] 'societe' => [$app->trans('report:: societe'), 1, 1, 1, 1]
], $conf_pref); ], $conf_pref);
=======
// $conf_pref[strtolower($field)] = array($field, 0, 0, 0, 0);
$conf_pref[$field] = array($field, 0, 0, 0, 0);
}
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
$conf = array_merge(array(
'user' => array(_('report:: utilisateurs'), 1, 1, 1, 1),
'ddate' => array(_('report:: date'), 1, 0, 1, 1),
'record_id' => array(_('report:: record id'), 1, 1, 1, 1),
'final' => array(_('phrseanet:: sous definition'), 1, 0, 1, 1),
'coll_id' => array(_('report:: collections'), 1, 0, 1, 1),
'comment' => array(_('report:: commentaire'), 1, 0, 0, 0),
'fonction' => array(_('report:: fonction'), 1, 1, 1, 1),
'activite' => array(_('report:: activite'), 1, 1, 1, 1),
'pays' => array(_('report:: pays'), 1, 1, 1, 1),
'societe' => array(_('report:: societe'), 1, 1, 1, 1)
), $conf_pref);
>>>>>>> 3.8
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
if ($request->request->get('printcsv') == 'on') { if ($request->request->get('printcsv') == 'on') {
$download->setHasLimit(false); $download->setHasLimit(false);
$download->setPrettyString(false); $download->setPrettyString(false);
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
$this->doReport($app, $request, $download, $conf); $this->doReport($app, $request, $download, $conf);
return $this->getCSVResponse($app, $download, 'download'); $r = $this->getCSVResponse($app, $download, 'download');
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s) %s\n\n", __FILE__, __LINE__, var_export($r, true)), FILE_APPEND);
return $r;
} }
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
$report = $this->doReport($app, $request, $download, $conf); $report = $this->doReport($app, $request, $download, $conf);
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
if ($report instanceof Response) { if ($report instanceof Response) {
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
return $report; return $report;
} }
<<<<<<< HEAD
return $app->json([ return $app->json([
'rs' => $app['twig']->render('report/ajax_data_content.html.twig', [ 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', [
=======
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
return $app->json(array(
'rs' => $app['twig']->render('report/ajax_data_content.html.twig', array(
>>>>>>> 3.8
'result' => isset($report['report']) ? $report['report'] : $report, 'result' => isset($report['report']) ? $report['report'] : $report,
'is_infouser' => false, 'is_infouser' => false,
'is_nav' => false, 'is_nav' => false,
@@ -383,7 +436,12 @@ class Root implements ControllerProviderInterface
$conf_pref = []; $conf_pref = [];
foreach (\module_report::getPreff($app, $request->request->get('sbasid')) as $field) { foreach (\module_report::getPreff($app, $request->request->get('sbasid')) as $field) {
<<<<<<< HEAD
$conf_pref[strtolower($field)] = [$field, 0, 0, 0, 0]; $conf_pref[strtolower($field)] = [$field, 0, 0, 0, 0];
=======
// $conf_pref[strtolower($field)] = array($field, 0, 0, 0, 0);
$conf_pref[$field] = array($field, 0, 0, 0, 0);
>>>>>>> 3.8
} }
$conf = array_merge([ $conf = array_merge([
@@ -401,7 +459,11 @@ class Root implements ControllerProviderInterface
$this->doReport($app, $request, $document, $conf, 'record_id'); $this->doReport($app, $request, $document, $conf, 'record_id');
return $this->getCSVResponse($app, $document, 'documents'); $r = $this->getCSVResponse($app, $document, 'documents');
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s) %s\n\n", __FILE__, __LINE__, var_export($r, true)), FILE_APPEND);
return $r;
} }
$report = $this->doReport($app, $request, $document, $conf, 'record_id'); $report = $this->doReport($app, $request, $document, $conf, 'record_id');
@@ -509,6 +571,7 @@ class Root implements ControllerProviderInterface
$response = new CSVFileResponse($filename, function () use ($app, $result) { $response = new CSVFileResponse($filename, function () use ($app, $result) {
$app['csv.exporter']->export('php://output', $result); $app['csv.exporter']->export('php://output', $result);
}); });
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
return $response; return $response;
} }
@@ -548,6 +611,7 @@ class Root implements ControllerProviderInterface
unset($conf['ip']); unset($conf['ip']);
} }
} }
//save initial conf //save initial conf
$base_conf = $conf; $base_conf = $conf;
//format conf according user preferences //format conf according user preferences
@@ -612,13 +676,20 @@ class Root implements ControllerProviderInterface
$filter->addFilter('record_id', '=', $request->request->get('word', '')); $filter->addFilter('record_id', '=', $request->request->get('word', ''));
} }
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
//set filters to current report //set filters to current report
$report->setFilter($filter->getTabFilter()); $report->setFilter($filter->getTabFilter());
$report->setActiveColumn($filter->getActiveColumn()); $report->setActiveColumn($filter->getActiveColumn());
$report->setPostingFilter($filter->getPostingFilter()); $report->setPostingFilter($filter->getPostingFilter());
// display a new arraywhere results are group // display a new arraywhere results are group
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
if ('' !== $groupby = $request->request->get('groupby', '')) { if ('' !== $groupby = $request->request->get('groupby', '')) {
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
$report->setConfig(false); $report->setConfig(false);
$groupby = current(explode(' ', $groupby)); $groupby = current(explode(' ', $groupby));
@@ -630,8 +701,15 @@ class Root implements ControllerProviderInterface
$groupField = isset($conf[strtolower($groupby)]['title']) ? $conf[strtolower($groupby)]['title'] : ''; $groupField = isset($conf[strtolower($groupby)]['title']) ? $conf[strtolower($groupby)]['title'] : '';
} }
<<<<<<< HEAD
return $app->json([ return $app->json([
'rs' => $app['twig']->render('report/ajax_data_content.html.twig', [ 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', [
=======
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
return $app->json(array(
'rs' => $app['twig']->render('report/ajax_data_content.html.twig', array(
>>>>>>> 3.8
'result' => isset($reportArray['report']) ? $reportArray['report'] : $reportArray, 'result' => isset($reportArray['report']) ? $reportArray['report'] : $reportArray,
'is_infouser' => false, 'is_infouser' => false,
'is_nav' => false, 'is_nav' => false,
@@ -644,6 +722,8 @@ class Root implements ControllerProviderInterface
]); ]);
} }
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
//set Limit //set Limit
if ($report->getEnableLimit() if ($report->getEnableLimit()
&& ('' !== $page = $request->request->get('page', '')) && ('' !== $page = $request->request->get('page', ''))
@@ -653,6 +733,8 @@ class Root implements ControllerProviderInterface
$report->setLimit(false, false); $report->setLimit(false, false);
} }
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
//time to build our report //time to build our report
if (false === $what) { if (false === $what) {
$reportArray = $report->buildReport($conf); $reportArray = $report->buildReport($conf);
@@ -660,6 +742,8 @@ class Root implements ControllerProviderInterface
$reportArray = $report->buildReport($conf, $what, $request->request->get('tbl', false)); $reportArray = $report->buildReport($conf, $what, $request->request->get('tbl', false));
} }
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
return $reportArray; return $reportArray;
} }
@@ -681,19 +765,33 @@ class Root implements ControllerProviderInterface
foreach (array_keys($report->getDisplay()) as $k) { foreach (array_keys($report->getDisplay()) as $k) {
$headers[$k] = $k; $headers[$k] = $k;
} }
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s) %s \n\n", __FILE__, __LINE__, var_export($headers, true)), FILE_APPEND);
// set headers as first row // set headers as first row
$result = $report->getResult(); $result = $report->getResult();
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s) %s \n\n", __FILE__, __LINE__, var_export($result[0], true)), FILE_APPEND);
array_unshift($result, $headers); array_unshift($result, $headers);
$collection = new CallbackCollection($result, function ($row) use ($report) { $collection = new CallbackCollection($result, function ($row) use ($headers) {
// restrict fields to the displayed ones // restrict fields to the displayed ones
return array_map('strip_tags', array_intersect_key($row, $report->getDisplay())); // return array_map("strip_tags", array_intersect_key($row, $report->getDisplay()));
$ret = array();
foreach($headers as $f) {
$ret[$f] = array_key_exists($f, $row) ? strip_tags($row[$f]) : '';
}
return $ret;
}); });
$filename = sprintf('report_export_%s_%s.csv', $type, date('Ymd')); $filename = sprintf('report_export_%s_%s.csv', $type, date('Ymd'));
$response = new CSVFileResponse($filename, function () use ($app, $collection) {
$cb = function () use ($app, $collection) {
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s) %s\n\n", __FILE__, __LINE__, var_export($collection, true)), FILE_APPEND);
$app['csv.exporter']->export('php://output', $collection); $app['csv.exporter']->export('php://output', $collection);
}); };
$response = new CSVFileResponse($filename, $cb);
return $response; return $response;
} }

View File

@@ -139,8 +139,14 @@ class Account implements ControllerProviderInterface
return $app->redirectPath('account_reset_email'); return $app->redirectPath('account_reset_email');
} }
<<<<<<< HEAD
$token = $app['manipulator.token']->createResetEmailToken($app['authentication']->getUser(), $email); $token = $app['manipulator.token']->createResetEmailToken($app['authentication']->getUser(), $email);
$url = $app->url('account_reset_email', ['token' => $token->getValue()]); $url = $app->url('account_reset_email', ['token' => $token->getValue()]);
=======
$date = new \DateTime('1 day');
$token = $app['tokens']->getUrlToken(\random::TYPE_EMAIL, $app['authentication']->getUser()->get_id(), $date, $email);
$url = $app->url('account_reset_email', array('token' => $token));
>>>>>>> 3.8
try { try {
$receiver = Receiver::fromUser($app['authentication']->getUser()); $receiver = Receiver::fromUser($app['authentication']->getUser());

View File

@@ -820,9 +820,11 @@ class Login implements ControllerProviderInterface
$width = $height = null; $width = $height = null;
if ($app['request']->cookies->has('screen')) { if ($app['request']->cookies->has('screen')) {
$data = explode('x', $app['request']->cookies->get('screen')); $data = array_filter((explode('x', $app['request']->cookies->get('screen', ''))));
$width = $data[0]; if (count($data) === 2) {
$height = $data[1]; $width = $data[0];
$height = $data[1];
}
} }
$session->setIpAddress($app['request']->getClientIp()) $session->setIpAddress($app['request']->getClientIp())
->setScreenHeight($height) ->setScreenHeight($height)

View File

@@ -0,0 +1,52 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Core\Event;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Controller\RecordsRequest;
use Symfony\Component\EventDispatcher\Event as SfEvent;
class RecordEdit extends SfEvent
{
private $records = array();
private $collections = array();
private $databoxes = array();
public function __construct($data)
{
if ($data instanceof RecordsRequest) {
$this->records = $data->toArray();
$this->collections = $data->collections();
$this->databoxes = $data->databoxes();
} elseif ($data instanceof \record_adapter) {
$this->records[] = $data;
$this->collections[] = $data->get_collection();
$this->databoxes[] = $data->get_databox();
}
}
public function getRecords()
{
return $this->records;
}
public function getCollections()
{
return $this->collections;
}
public function getDataboxes()
{
return $this->databoxes;
}
}

View File

@@ -0,0 +1,83 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Core\Event\Subscriber;
use Alchemy\Phrasea\Core\Event\RecordEdit;
use Alchemy\Phrasea\Core\PhraseaEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Alchemy\Phrasea\Metadata\Tag\TfEditdate;
class RecordEditSubscriber implements EventSubscriberInterface
{
public function onEdit(RecordEdit $event)
{
$records = $event->getRecords();
$databoxes = $event->getDataboxes();
$databox = array_pop($databoxes);
$metaStructure = $databox->get_meta_structure();
$editDateField = false;
foreach ($metaStructure->get_elements() as $meta) {
if ($meta->get_tag() instanceof TfEditdate) {
$editDateField = $meta;
}
}
if ($editDateField instanceof \databox_field) {
foreach ($records as $record) {
$this->updateRecord($record, $editDateField);
}
}
}
private function updateRecord($record, $field)
{
if (false === $record->is_grouping()) {
foreach ($record->get_grouping_parents() as $story) {
$this->updateEditField($story, $field);
}
}
$this->updateEditField($record, $field);
}
private function updateEditField($record, $editField)
{
$fields = $record->get_caption()->get_fields(array($editField->get_name()), true);
$field = array_pop($fields);
$metaId = null;
if ($field && !$field->is_multi()) {
$values = $field->get_values();
$metaId = array_pop($values)->getId();
}
$date = new \DateTime();
$record->set_metadatas(array(
array(
'meta_struct_id' => $editField->get_id(),
'meta_id' => $metaId,
'value' => $date->format('Y-m-d H:i:s'),
)
), true);
}
public static function getSubscribedEvents()
{
return array(
PhraseaEvents::RECORD_EDIT => 'onEdit',
PhraseaEvents::RECORD_UPLOAD => 'onEdit',
);
}
}

View File

@@ -30,6 +30,7 @@ final class PhraseaEvents
const ORDER_DELIVER = 'order.deliver'; const ORDER_DELIVER = 'order.deliver';
const ORDER_DENY = 'order.deny'; const ORDER_DENY = 'order.deny';
const COLLECTION_CREATE = 'collection.create'; const COLLECTION_CREATE = 'collection.create';
<<<<<<< HEAD
const FEED_ENTRY_CREATE = 'feed-entry.create'; const FEED_ENTRY_CREATE = 'feed-entry.create';
const REGISTRATION_CREATE = 'registration.create'; const REGISTRATION_CREATE = 'registration.create';
const REGISTRATION_AUTOREGISTER = 'registration.autoregister'; const REGISTRATION_AUTOREGISTER = 'registration.autoregister';
@@ -42,4 +43,9 @@ final class PhraseaEvents
const BRIDGE_UPLOAD_FAILURE = 'bridge.upload-failure'; const BRIDGE_UPLOAD_FAILURE = 'bridge.upload-failure';
const EXPORT_MAIL_FAILURE = 'export.mail-failure'; const EXPORT_MAIL_FAILURE = 'export.mail-failure';
const EXPORT_CREATE = 'export.create'; const EXPORT_CREATE = 'export.create';
=======
const RECORD_EDIT = 'record.edit';
const RECORD_UPLOAD = 'record.upload';
>>>>>>> 3.8
} }

View File

@@ -16,6 +16,7 @@ use Alchemy\Phrasea\Core\Event\Subscriber\CookiesDisablerSubscriber;
use Alchemy\Phrasea\Core\Event\Subscriber\LogoutSubscriber; use Alchemy\Phrasea\Core\Event\Subscriber\LogoutSubscriber;
use Alchemy\Phrasea\Core\Event\Subscriber\MaintenanceSubscriber; use Alchemy\Phrasea\Core\Event\Subscriber\MaintenanceSubscriber;
use Alchemy\Phrasea\Core\Event\Subscriber\PhraseaLocaleSubscriber; use Alchemy\Phrasea\Core\Event\Subscriber\PhraseaLocaleSubscriber;
use Alchemy\Phrasea\Core\Event\Subscriber\RecordEditSubscriber;
use Alchemy\Phrasea\Core\Event\Subscriber\SessionManagerSubscriber; use Alchemy\Phrasea\Core\Event\Subscriber\SessionManagerSubscriber;
use Silex\Application; use Silex\Application;
use Silex\ServiceProviderInterface; use Silex\ServiceProviderInterface;
@@ -42,6 +43,9 @@ class PhraseaEventServiceProvider implements ServiceProviderInterface
$app['phraseanet.content-negotiation-subscriber'] = $app->share(function (Application $app) { $app['phraseanet.content-negotiation-subscriber'] = $app->share(function (Application $app) {
return new ContentNegotiationSubscriber($app); return new ContentNegotiationSubscriber($app);
}); });
$app['phraseanet.record-edit-subscriber'] = $app->share(function (Application $app) {
return new RecordEditSubscriber();
});
} }
public function boot(Application $app) public function boot(Application $app)

View File

@@ -15,6 +15,7 @@ use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
use Silex\Application; use Silex\Application;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class PhraseaAuthenticationForm extends AbstractType class PhraseaAuthenticationForm extends AbstractType
{ {
@@ -71,4 +72,15 @@ class PhraseaAuthenticationForm extends AbstractType
{ {
return null; return null;
} }
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$csrf = true;
if (isset($this->app['phraseanet.configuration']['auth-csrf-protection'])) {
$csrf = (Boolean) $this->app['phraseanet.configuration']['auth-csrf-protection'];
}
$resolver->setDefaults(array(
'csrf_protection' => $csrf,
));
}
} }

View File

@@ -27,7 +27,7 @@ interface DeliverDataInterface
* @param string|null $mimeType * @param string|null $mimeType
* @param integer $cacheDuration * @param integer $cacheDuration
*/ */
public function deliverFile($file, $filename = null, $disposition = self::DISPOSITION_INLINE, $mimeType = null, $cacheDuration = 3600); public function deliverFile($file, $filename = null, $disposition = self::DISPOSITION_INLINE, $mimeType = null, $cacheDuration = null);
/** /**
* Return a HTTP Response ready to deliver data * Return a HTTP Response ready to deliver data
@@ -38,5 +38,5 @@ interface DeliverDataInterface
* @param string $disposition * @param string $disposition
* @param integer $cacheDuration * @param integer $cacheDuration
*/ */
public function deliverData($data, $filename, $mimeType, $disposition = self::DISPOSITION_INLINE, $cacheDuration = 3600); public function deliverData($data, $filename, $mimeType, $disposition = self::DISPOSITION_INLINE, $cacheDuration = null);
} }

View File

@@ -38,12 +38,13 @@ class ServeFileResponseFactory implements DeliverDataInterface
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function deliverFile($file, $filename = '', $disposition = self::DISPOSITION_INLINE, $mimeType = null ,$cacheDuration = 0) public function deliverFile($file, $filename = '', $disposition = self::DISPOSITION_INLINE, $mimeType = null, $cacheDuration = null)
{ {
$response = new BinaryFileResponse($file); $response = new BinaryFileResponse($file);
$response->setContentDisposition($disposition, $this->sanitizeFilename($filename), $this->sanitizeFilenameFallback($filename)); $response->setContentDisposition($disposition, $this->sanitizeFilename($filename), $this->sanitizeFilenameFallback($filename));
$response->setMaxAge($cacheDuration); if (null !== $cacheDuration) {
$response->setPrivate(); $response->setMaxAge($cacheDuration);
}
if (null !== $mimeType) { if (null !== $mimeType) {
$response->headers->set('Content-Type', $mimeType); $response->headers->set('Content-Type', $mimeType);
@@ -55,7 +56,7 @@ class ServeFileResponseFactory implements DeliverDataInterface
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function deliverData($data, $filename, $mimeType, $disposition = self::DISPOSITION_INLINE, $cacheDuration = 0) public function deliverData($data, $filename, $mimeType, $disposition = self::DISPOSITION_INLINE, $cacheDuration = null)
{ {
$response = new Response($data); $response = new Response($data);
$response->headers->set('Content-Disposition', $response->headers->makeDisposition( $response->headers->set('Content-Disposition', $response->headers->makeDisposition(
@@ -64,7 +65,9 @@ class ServeFileResponseFactory implements DeliverDataInterface
$this->sanitizeFilenameFallback($filename $this->sanitizeFilenameFallback($filename
))); )));
$response->headers->set('Content-Type', $mimeType); $response->headers->set('Content-Type', $mimeType);
$response->setMaxAge($cacheDuration); if (null !== $cacheDuration) {
$response->setMaxAge($cacheDuration);
}
return $response; return $response;
} }

View File

@@ -41,6 +41,8 @@ class Nginx extends AbstractStaticMode implements StaticFileModeInterface
$output = "\n"; $output = "\n";
$output .= " location " . $this->mapping['mount-point']. " {\n"; $output .= " location " . $this->mapping['mount-point']. " {\n";
$output .= " alias ".$this->mapping['directory'].";\n"; $output .= " alias ".$this->mapping['directory'].";\n";
$output .= " types { }";
$output .= " default_type image/jpeg;";
$output .= " }\n"; $output .= " }\n";
return $output; return $output;

View File

@@ -115,7 +115,7 @@ class Firewall
{ {
$params = []; $params = [];
if (null !== $request) { if (null !== $request) {
$params['redirect'] = '..' . $request->getPathInfo(); $params['redirect'] = '..' . $request->getPathInfo().'?'.$request->getQueryString();
} }
if (!$this->app['authentication']->isAuthenticated()) { if (!$this->app['authentication']->isAuthenticated()) {
return new RedirectResponse($this->app->path('homepage', $params)); return new RedirectResponse($this->app->path('homepage', $params));

View File

@@ -682,6 +682,8 @@ class databox extends base
*/ */
public function get_meta_structure() public function get_meta_structure()
{ {
$metaStructData = array();
if ($this->meta_struct) { if ($this->meta_struct) {
return $this->meta_struct; return $this->meta_struct;
} }
@@ -703,10 +705,15 @@ class databox extends base
$this->meta_struct = new databox_descriptionStructure(); $this->meta_struct = new databox_descriptionStructure();
<<<<<<< HEAD
if ($metaStructData) { if ($metaStructData) {
foreach ($metaStructData as $row) { foreach ($metaStructData as $row) {
$this->meta_struct->add_element(databox_field::get_instance($this->app, $this, $row['id'])); $this->meta_struct->add_element(databox_field::get_instance($this->app, $this, $row['id']));
} }
=======
foreach ((array) $metaStructData as $row) {
$this->meta_struct->add_element(databox_field::get_instance($this->app, $this, $row['id']));
>>>>>>> 3.8
} }
return $this->meta_struct; return $this->meta_struct;

View File

@@ -205,8 +205,8 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
$this->height = (int) $row['height']; $this->height = (int) $row['height'];
$this->mime = $row['mime']; $this->mime = $row['mime'];
$this->file = $row['file']; $this->file = $row['file'];
$this->etag = $row['etag'] !== null ? $row['etag'] : md5(time() . $row['path'] .$row['file']);
$this->path = p4string::addEndSlash($row['path']); $this->path = p4string::addEndSlash($row['path']);
$this->etag = $row['etag'] !== null ? $row['etag'] : sha1_file($this->get_pathfile());
$this->is_substituted = ! ! $row['substit']; $this->is_substituted = ! ! $row['substit'];
$this->subdef_id = (int) $row['subdef_id']; $this->subdef_id = (int) $row['subdef_id'];
@@ -345,8 +345,8 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
public function getEtag() public function getEtag()
{ {
if ( ! $this->etag && $this->is_physically_present()) { if (!$this->etag && $this->is_physically_present()) {
$this->setEtag(md5(time() . $this->get_pathfile())); $this->setEtag(sha1_file($this->get_pathfile()));
} }
return $this->etag; return $this->etag;
@@ -364,16 +364,6 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
return $this; return $this;
} }
public function get_url()
{
$url = parent::get_url();
if (null !== $this->getEtag()) {
$url->getQuery()->set('etag', $this->getEtag());
}
return $url;
}
/** /**
* *
* @return int * @return int
@@ -763,7 +753,11 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
$this->url = Url::factory("/datafiles/" . $this->record->get_sbas_id() $this->url = Url::factory("/datafiles/" . $this->record->get_sbas_id()
. "/" . $this->record->get_record_id() . "/" . "/" . $this->record->get_record_id() . "/"
<<<<<<< HEAD
. $this->get_name() . "/"); . $this->get_name() . "/");
=======
. $this->get_name() . "/?etag=".$this->getEtag());
>>>>>>> 3.8
return; return;
} }

View File

@@ -233,7 +233,12 @@ class module_report
/** /**
* *
*/ */
<<<<<<< HEAD
protected $cor_query = []; protected $cor_query = [];
=======
protected $dateField = 'log.date';
protected $cor_query = array();
>>>>>>> 3.8
protected $isInformative; protected $isInformative;
/** /**
@@ -579,6 +584,7 @@ class module_report
return new module_report_sqlconnexion($this->app, $this); return new module_report_sqlconnexion($this->app, $this);
break; break;
case 'download' : case 'download' :
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
return new module_report_sqldownload($this->app, $this); return new module_report_sqldownload($this->app, $this);
break; break;
case 'question' : case 'question' :
@@ -778,7 +784,6 @@ class module_report
*/ */
protected function setConfigColumn($tab) protected function setConfigColumn($tab)
{ {
foreach ($tab as $column => $row) { foreach ($tab as $column => $row) {
foreach ($row as $ind => $value) { foreach ($row as $ind => $value) {
$title_text = ""; $title_text = "";
@@ -805,6 +810,18 @@ class module_report
} }
} }
public function setDateField($dateField)
{
$this->dateField = $dateField;
return $this;
}
public function getDateField()
{
return $this->dateField;
}
/** /**
* Build the final formated array which contains all the result, * Build the final formated array which contains all the result,
* we construct the html code from this array * we construct the html code from this array
@@ -817,40 +834,72 @@ class module_report
*/ */
public function buildReport($tab = false, $groupby = false, $on = false) public function buildReport($tab = false, $groupby = false, $on = false)
{ {
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
if (sizeof($this->report) > 0) { if (sizeof($this->report) > 0) {
return $this->report; return $this->report;
} }
<<<<<<< HEAD
$databox = $this->app['phraseanet.appbox']->get_databox($this->sbas_id); $databox = $this->app['phraseanet.appbox']->get_databox($this->sbas_id);
$conn = $databox->get_connection(); $conn = $databox->get_connection();
=======
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
$conn = connection::getPDOConnection($this->app, $this->sbas_id);
>>>>>>> 3.8
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
$this->buildReq($groupby, $on); $this->buildReq($groupby, $on);
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\nreq=%s\n\n", __FILE__, __LINE__, $this->req), FILE_APPEND);
try { try {
try { try {
$stmt = $conn->prepare($this->req); $stmt = $conn->prepare($this->req);
$stmt->execute($this->params); $stmt->execute($this->params);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor(); $stmt->closeCursor();
<<<<<<< HEAD
} catch (DBALException $e) { } catch (DBALException $e) {
=======
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\ncount==%s\n\n", __FILE__, __LINE__, count($rs)), FILE_APPEND);
} catch (PDOException $e) {
>>>>>>> 3.8
echo $e->getMessage(); echo $e->getMessage();
return; return;
} }
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s) %s\n\n", __FILE__, __LINE__, get_class($this)), FILE_APPEND);
//set request field //set request field
$this->setChamp($rs); $this->setChamp($rs);
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
//set display //set display
$this->setDisplay($tab, $groupby); $this->setDisplay($tab, $groupby);
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
//construct results //construct results
$this->buildResult($this->app, $rs); $this->buildResult($this->app, $rs);
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
//calculate prev and next page //calculate prev and next page
<<<<<<< HEAD
$this->calculatePages(); $this->calculatePages();
=======
$this->calculatePages($rs);
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
>>>>>>> 3.8
//do we display navigator ? //do we display navigator ?
$this->setDisplayNav(); $this->setDisplayNav();
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
//assign all variables //assign all variables
$this->setReport(); $this->setReport();
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
return $this->report; return $this->report;
} catch (\Exception $e) { } catch (\Exception $e) {
echo $e->getMessage(); echo $e->getMessage();

View File

@@ -43,7 +43,8 @@ class module_report_activity extends module_report
public function __construct(Application $app, $arg1, $arg2, $sbas_id, $collist) public function __construct(Application $app, $arg1, $arg2, $sbas_id, $collist)
{ {
parent::__construct($app, $arg1, $arg2, $sbas_id, $collist); // parent::__construct($app, $arg1, $arg2, $sbas_id, $collist);
parent::__construct($app, $arg1, $arg2, $sbas_id, "");
} }
/** /**
@@ -84,6 +85,7 @@ class module_report_activity extends module_report
return $hours; return $hours;
} }
// ==================== Site activity : Site activity =====================
/** /**
* @desc get the site activity per hours * @desc get the site activity per hours
* @return array * @return array
@@ -99,15 +101,12 @@ class module_report_activity extends module_report
$params = array_merge([], $filter['params']); $params = array_merge([], $filter['params']);
$sql = " $sql = "
SELECT tt.heures, SUM(1) AS nb SELECT CAST(DATE_FORMAT(log.date, '%k') AS UNSIGNED) AS heures, COUNT(id) AS nb
FROM (
SELECT DISTINCT(log.id), DATE_FORMAT( log.date, '%k' ) AS heures
FROM log FORCE INDEX (date_site) FROM log FORCE INDEX (date_site)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id) WHERE (" . $filter['sql'] . ") AND !ISNULL(usrid)
WHERE (" . $filter['sql'] . ") GROUP BY heures;";
) AS tt
GROUP BY tt.heures // no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $sql), FILE_APPEND);
ORDER BY tt.heures ASC";
$stmt = $sqlBuilder->getConnBas()->prepare($sql); $stmt = $sqlBuilder->getConnBas()->prepare($sql);
$stmt->execute($params); $stmt->execute($params);
@@ -142,6 +141,7 @@ class module_report_activity extends module_report
return $this->report; return $this->report;
} }
<<<<<<< HEAD
/** /**
* Get all questions by user * Get all questions by user
* *
@@ -195,7 +195,10 @@ class module_report_activity extends module_report
return $this->result; return $this->result;
} }
=======
>>>>>>> 3.8
// ================== Site activity : Top questions (le second radio ...) ================
/** /**
* get the most asked question * get the most asked question
* @param array $tab config for html table * @param array $tab config for html table
@@ -206,6 +209,7 @@ class module_report_activity extends module_report
$this->report['value'] = []; $this->report['value'] = [];
$this->report['value2'] = []; $this->report['value2'] = [];
$this->setDateField('log_search.date');
$sqlBuilder = new module_report_sql($this->app, $this); $sqlBuilder = new module_report_sql($this->app, $this);
$filter = $sqlBuilder->getFilters()->getReportFilter(); $filter = $sqlBuilder->getFilters()->getReportFilter();
$params = array_merge([], $filter['params']); $params = array_merge([], $filter['params']);
@@ -213,19 +217,18 @@ class module_report_activity extends module_report
($no_answer) ? $this->title = $this->app->trans('report:: questions sans reponses') : $this->title = $this->app->trans('report:: questions les plus posees'); ($no_answer) ? $this->title = $this->app->trans('report:: questions sans reponses') : $this->title = $this->app->trans('report:: questions les plus posees');
$sql = " $sql = "
SELECT TRIM(tt.search) AS search, SUM(1) AS nb, ROUND(avg(tt.results)) AS nb_rep SELECT TRIM(log_search.search) AS search, COUNT(log_search.id) AS nb, ROUND(avg(results)) AS nb_rep
FROM (
SELECT DISTINCT(log.id), log_search.search AS search, results
FROM (log_search) FROM (log_search)
INNER JOIN log FORCE INDEX (date_site) ON (log_search.log_id = log.id) INNER JOIN log FORCE INDEX (date_site) ON (log_search.log_id = log.id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id) WHERE (" . $filter['sql'] . ") AND !ISNULL(usrid)
WHERE (" . $filter['sql'] . ")
AND log_search.search != 'all' " . AND log_search.search != 'all' " .
($no_answer ? ' AND log_search.results = 0 ' : '') . " ($no_answer ? ' AND log_search.results = 0 ' : '') . "
) AS tt
GROUP BY tt.search GROUP BY search
ORDER BY nb DESC"; ORDER BY nb DESC";
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $sql), FILE_APPEND);
$sql .= !$no_answer ? ' LIMIT ' . $this->nb_top : ''; $sql .= !$no_answer ? ' LIMIT ' . $this->nb_top : '';
$stmt = $sqlBuilder->getConnBas()->prepare($sql); $stmt = $sqlBuilder->getConnBas()->prepare($sql);
@@ -260,12 +263,14 @@ class module_report_activity extends module_report
return $this->report; return $this->report;
} }
// =========================== not called ? =====================
/** /**
* @desc get all downloads from one specific user * @desc get all downloads from one specific user
* @param $usr user id * @param $usr user id
* @param array $config config for the html table * @param array $config config for the html table
* @return array * @return array
*/ */
/*
public function getAllDownloadByUserBase($usr, $config = false) public function getAllDownloadByUserBase($usr, $config = false)
{ {
$result = []; $result = [];
@@ -319,7 +324,9 @@ class module_report_activity extends module_report
return $this->result; return $this->result;
} }
*/
// ============================ Downloads : Daily ==========================
/** /**
* @desc get all download by base by day * @desc get all download by base by day
* @param array $tab config for html table * @param array $tab config for html table
@@ -327,29 +334,35 @@ class module_report_activity extends module_report
*/ */
public function getDownloadByBaseByDay($tab = false) public function getDownloadByBaseByDay($tab = false)
{ {
<<<<<<< HEAD
$this->title = $this->app->trans('report:: telechargements par jour'); $this->title = $this->app->trans('report:: telechargements par jour');
=======
$this->title = _('report:: telechargements par jour');
$this->setDateField('log_docs.date');
>>>>>>> 3.8
$sqlBuilder = new module_report_sql($this->app, $this); $sqlBuilder = new module_report_sql($this->app, $this);
$filter = $sqlBuilder->getFilters()->getReportFilter(); $filter = $sqlBuilder->getFilters()->getReportFilter();
$params = array_merge([], $filter['params']); $params = array_merge([], $filter['params']);
$sql = " $sql = "
SELECT tt.record_id, DATE_FORMAT(tt.the_date, GET_FORMAT(DATE, 'INTERNAL')) AS ddate, tt.final, SUM(1) AS nb SELECT tt.record_id, tt.the_date AS ddate, tt.final, SUM(1) AS nb
FROM ( FROM (
SELECT DISTINCT(log.id), log_docs.date AS the_date, log_docs.final, log_docs.record_id SELECT DISTINCT(log.id), log_docs.date AS the_date, log_docs.final, log_docs.record_id
FROM (log_docs) FROM (log_docs)
INNER JOIN record ON (record.record_id = log_docs.record_id)
INNER JOIN log FORCE INDEX (date_site) ON (log.id = log_docs.log_id) INNER JOIN log FORCE INDEX (date_site) ON (log.id = log_docs.log_id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id) WHERE (" . $filter['sql'] . ") AND !ISNULL(usrid)
WHERE (" . $filter['sql'] . ")
AND (log_docs.action = 'download' OR log_docs.action = 'mail') AND (log_docs.action = 'download' OR log_docs.action = 'mail')
AND (log_docs.final = 'preview' OR log_docs.final = 'document') AND (log_docs.final = 'preview' OR log_docs.final = 'document')
) AS tt ) AS tt
LEFT JOIN record ON (record.record_id = tt.record_id)
LEFT JOIN subdef AS s ON (s.record_id = tt.record_id) LEFT JOIN subdef AS s ON (s.record_id = tt.record_id)
WHERE s.name = tt.final WHERE s.name = tt.final
GROUP BY tt.final, ddate GROUP BY tt.final, ddate
ORDER BY tt.the_date DESC"; ORDER BY tt.the_date DESC";
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $sql), FILE_APPEND);
$stmt = $sqlBuilder->getConnBas()->prepare($sql); $stmt = $sqlBuilder->getConnBas()->prepare($sql);
$stmt->execute($params); $stmt->execute($params);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
@@ -397,13 +410,28 @@ class module_report_activity extends module_report
$this->result[$nb_row]['preview'] = '<b>' . $total['tot_prev'] . '</b>'; $this->result[$nb_row]['preview'] = '<b>' . $total['tot_prev'] . '</b>';
$this->result[$nb_row]['total'] = '<b>' . $total['tot_dl'] . '</b>'; $this->result[$nb_row]['total'] = '<b>' . $total['tot_dl'] . '</b>';
} }
<<<<<<< HEAD
$this->calculatePages(); $this->calculatePages();
=======
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, var_export($this->result, true)), FILE_APPEND);
foreach($this->result as $k=>$row) {
$_row = array();
foreach((array) $tab as $k2=>$f) {
$_row[$k2] = array_key_exists($k2, $row) ? $row[$k2] : '';
}
$this->result[$k] = $_row;
}
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, var_export($this->result, true)), FILE_APPEND);
$this->calculatePages($rs);
>>>>>>> 3.8
$this->setDisplayNav(); $this->setDisplayNav();
$this->setReport(); $this->setReport();
return $this->report; return $this->report;
} }
// ==================== Connections: Per users =====================
/** /**
* @desc get nb connexion by user , fonction ,societe etc.. * @desc get nb connexion by user , fonction ,societe etc..
* @param array $tab config for html table * @param array $tab config for html table
@@ -422,25 +450,21 @@ class module_report_activity extends module_report
$params = array_merge([], $filter['params']); $params = array_merge([], $filter['params']);
$this->req = " $this->req = "
SELECT SUM(1) AS connexion, tt.user, tt.usrid FROM ( SELECT COUNT(id) AS connexion, log.user, log.usrid
SELECT
DISTINCT(log.id),
log." . $on . " AS " . $on . ",
log.usrid
FROM log FORCE INDEX (date_site) FROM log FORCE INDEX (date_site)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
WHERE log.user != 'API' WHERE log.user != 'API'
AND (" . $filter['sql'] . ") AND (" . $filter['sql'] . ") AND !ISNULL(usrid)
) AS tt GROUP BY usrid
GROUP BY tt.usrid
ORDER BY connexion DESC "; ORDER BY connexion DESC ";
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $this->req), FILE_APPEND);
$stmt = $sqlBuilder->getConnBas()->prepare($this->req); $stmt = $sqlBuilder->getConnBas()->prepare($this->req);
$stmt->execute($params); $stmt->execute($params);
$sqlBuilder->setTotalrows($stmt->rowCount()); $sqlBuilder->setTotalrows($stmt->rowCount());
$stmt->closeCursor(); $stmt->closeCursor();
$this->enable_limit ? $this->req .= "LIMIT 0," . $this->nb_record : ""; $this->enable_limit ? $this->req .= " LIMIT 0," . $this->nb_record : "";
$stmt = $sqlBuilder->getConnBas()->prepare($this->req); $stmt = $sqlBuilder->getConnBas()->prepare($this->req);
$stmt->execute($params); $stmt->execute($params);
@@ -490,8 +514,9 @@ class module_report_activity extends module_report
return $this->report; return $this->report;
} }
// ========================= Downloads : Per users =====================
/** /**
* Get the deail of download by users * Get the detail of download by users
* *
* @param array $tab config for the html table * @param array $tab config for the html table
* @param String $on * @param String $on
@@ -505,6 +530,7 @@ class module_report_activity extends module_report
//set title //set title
$this->title = $this->app->trans('report:: Detail des telechargements'); $this->title = $this->app->trans('report:: Detail des telechargements');
$this->setDateField('log_docs.date');
$sqlBuilder = new module_report_sql($this->app, $this); $sqlBuilder = new module_report_sql($this->app, $this);
$filter = $sqlBuilder->getFilters()->getReportFilter(); $filter = $sqlBuilder->getFilters()->getReportFilter();
$params = array_merge([], $filter['params']); $params = array_merge([], $filter['params']);
@@ -515,16 +541,17 @@ class module_report_activity extends module_report
SELECT DISTINCT(log.id), TRIM(" . $on . ") AS " . $on . ", log_docs.record_id, log_docs.final, log.usrid SELECT DISTINCT(log.id), TRIM(" . $on . ") AS " . $on . ", log_docs.record_id, log_docs.final, log.usrid
FROM log_docs FROM log_docs
INNER JOIN log FORCE INDEX (date_site) ON (log.id = log_docs.log_id) INNER JOIN log FORCE INDEX (date_site) ON (log.id = log_docs.log_id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id) WHERE (" . $filter['sql'] . ") AND !ISNULL(usrid)
INNER JOIN record ON (record.record_id = log_docs.record_id)
WHERE (" . $filter['sql'] . ")
AND (log_docs.action = 'download' OR log_docs.action = 'mail') AND (log_docs.action = 'download' OR log_docs.action = 'mail')
) AS tt ) AS tt
LEFT JOIN record ON (record.record_id = tt.record_id)
LEFT JOIN subdef FORCE INDEX (unicite) ON (tt.record_id = subdef.record_id) LEFT JOIN subdef FORCE INDEX (unicite) ON (tt.record_id = subdef.record_id)
WHERE subdef.name = tt.final WHERE subdef.name = tt.final
GROUP BY " . $on . ", usrid GROUP BY " . $on . ", usrid
ORDER BY nb DESC;"; ORDER BY nb DESC;";
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $sql), FILE_APPEND);
$stmt = $sqlBuilder->getConnBas()->prepare($sql); $stmt = $sqlBuilder->getConnBas()->prepare($sql);
$stmt->execute($params); $stmt->execute($params);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
@@ -607,6 +634,18 @@ class module_report_activity extends module_report
$this->result[$nb_row]['poidprev'] = $this->result[$nb_row]['poidprev'] =
'<b>' . p4string::format_octets($total['poidprev']) . '</b>'; '<b>' . p4string::format_octets($total['poidprev']) . '</b>';
} }
foreach($this->result as $k=>$row) {
$_row = array();
foreach((array) $tab as $k2=>$f) {
$_row[$k2] = array_key_exists($k2, $row) ? $row[$k2] : '';
}
$_row['usrid'] = array_key_exists('usrid', $row) ? $row['usrid'] : '';
$this->result[$k] = $_row;
}
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s) %s\n\n", __FILE__, __LINE__, var_export($this->result, true)), FILE_APPEND);
$this->total = sizeof($this->result); $this->total = sizeof($this->result);
$this->calculatePages(); $this->calculatePages();
$this->setDisplayNav(); $this->setDisplayNav();
@@ -615,6 +654,7 @@ class module_report_activity extends module_report
return $this->report; return $this->report;
} }
// ========================== ???????????????? ===========================
public static function topTenUser(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id) public static function topTenUser(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
{ {
$databox = $app['phraseanet.appbox']->get_databox($sbas_id); $databox = $app['phraseanet.appbox']->get_databox($sbas_id);
@@ -627,12 +667,9 @@ class module_report_activity extends module_report
$params = [':site_id' => $app['conf']->get(['main', 'key'])]; $params = [':site_id' => $app['conf']->get(['main', 'key'])];
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax); $datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax, 'log_docs.date');
$params = array_merge($params, $datefilter['params']); $params = array_merge($params, $datefilter['params']);
/*
$collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
$params = array_merge($params, $collfilter['params']);
$sql = "SELECT tt.usrid, tt.user, tt.final, tt.record_id, SUM(1) AS nb, SUM(size) AS poid $sql = "SELECT tt.usrid, tt.user, tt.final, tt.record_id, SUM(1) AS nb, SUM(size) AS poid
FROM ( FROM (
SELECT DISTINCT(log.id), log.usrid, user, final, log_date.record_id SELECT DISTINCT(log.id), log.usrid, user, final, log_date.record_id
@@ -642,12 +679,27 @@ class module_report_activity extends module_report
WHERE log.site = :site_id WHERE log.site = :site_id
AND log_date.action = 'download' AND log_date.action = 'download'
AND (" . $datefilter['sql'] . ")" . AND (" . $datefilter['sql'] . ")" .
(('' !== $collfilter['sql']) ? "AND (" . $collfilter['sql'] . ")" : '') (('' !== $collfilter['sql']) ? "AND (" . $collfilter['sql'] . ")" : '')
. " . "
) AS tt ) AS tt
LEFT JOIN subdef AS s ON (s.record_id = tt.record_id) LEFT JOIN subdef AS s ON (s.record_id = tt.record_id)
WHERE s.name = tt.final WHERE s.name = tt.final
GROUP BY tt.user, tt.final"; GROUP BY tt.user, tt.final";
*/
$sql = "SELECT tt.usrid, tt.user, tt.final, tt.record_id, SUM(1) AS nb, SUM(size) AS poid\n"
. " FROM (\n"
. " SELECT DISTINCT(log.id), log.usrid, user, final, log_docs.record_id\n"
. " FROM (log_docs)\n"
. " INNER JOIN log FORCE INDEX (date_site) ON (log.id = log_docs.log_id)\n"
. " WHERE log.site = :site_id\n"
. " AND log_docs.action = 'download'\n"
. " AND (" . $datefilter['sql'] . ")\n"
. ") AS tt\n"
. "LEFT JOIN subdef AS s ON (s.record_id = tt.record_id)\n"
. "WHERE s.name = tt.final\n"
. "GROUP BY tt.user, tt.final";
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $sql), FILE_APPEND);
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
$stmt->execute($params); $stmt->execute($params);
@@ -697,8 +749,10 @@ class module_report_activity extends module_report
return $result; return $result;
} }
//============================= Dashboard =========================
public static function activity(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id) public static function activity(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
{ {
<<<<<<< HEAD
$databox = $app['phraseanet.appbox']->get_databox($sbas_id); $databox = $app['phraseanet.appbox']->get_databox($sbas_id);
$conn = $databox->get_connection(); $conn = $databox->get_connection();
$res = []; $res = [];
@@ -710,6 +764,15 @@ class module_report_activity extends module_report
$params = [':site_id' => $app['conf']->get(['main', 'key'])]; $params = [':site_id' => $app['conf']->get(['main', 'key'])];
$params = array_merge($params, $datefilter['params'], $collfilter['params']); $params = array_merge($params, $datefilter['params'], $collfilter['params']);
=======
$conn = connection::getPDOConnection($app, $sbas_id);
$res = array();
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax);
$params = array(':site_id' => $app['phraseanet.configuration']['main']['key']);
$params = array_merge($params, $datefilter['params']);
/*
>>>>>>> 3.8
$sql = " $sql = "
SELECT tt.id, HOUR(tt.heures) AS heures SELECT tt.id, HOUR(tt.heures) AS heures
FROM ( FROM (
@@ -717,9 +780,19 @@ class module_report_activity extends module_report
FROM log AS log_date FORCE INDEX (date_site) FROM log AS log_date FORCE INDEX (date_site)
INNER JOIN log_colls FORCE INDEX (couple) ON (log_date.id = log_colls.log_id) INNER JOIN log_colls FORCE INDEX (couple) ON (log_date.id = log_colls.log_id)
WHERE " . $datefilter['sql'] . "" . WHERE " . $datefilter['sql'] . "" .
(('' !== $collfilter['sql']) ? "AND (" . $collfilter['sql'] . ")" : '') (('' !== $collfilter['sql']) ? "AND (" . $collfilter['sql'] . ")" : '')
. " AND log_date.site = :site_id . " AND log_date.site = :site_id
) AS tt"; ) AS tt";
*/
$sql = "SELECT tt.id, HOUR(tt.heures) AS heures\n"
. " FROM (\n"
. " SELECT DISTINCT(log_date.id), log_date.date AS heures\n"
. " FROM log AS log_date FORCE INDEX (date_site)\n"
. " WHERE " . $datefilter['sql'] . " AND !ISNULL(usrid)"
. " AND log_date.site = :site_id\n"
. " ) AS tt";
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $sql), FILE_APPEND);
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
$stmt->execute($params); $stmt->execute($params);
@@ -744,6 +817,7 @@ class module_report_activity extends module_report
return $res; return $res;
} }
//============================= Dashboard =========================
public static function activityDay(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id) public static function activityDay(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
{ {
$databox = $app['phraseanet.appbox']->get_databox($sbas_id); $databox = $app['phraseanet.appbox']->get_databox($sbas_id);
@@ -751,11 +825,16 @@ class module_report_activity extends module_report
$result = array(); $result = array();
$res = array(); $res = array();
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax); $datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax);
$collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
<<<<<<< HEAD
$params = [':site_id' => $app['conf']->get(['main', 'key'])]; $params = [':site_id' => $app['conf']->get(['main', 'key'])];
$params = array_merge($params, $datefilter['params'], $collfilter['params']); $params = array_merge($params, $datefilter['params'], $collfilter['params']);
=======
$params = array(':site_id' => $app['phraseanet.configuration']['main']['key']);
$params = array_merge($params, $datefilter['params']);
/*
>>>>>>> 3.8
$sql = " $sql = "
SELECT tt.ddate, COUNT( DATE_FORMAT( tt.ddate, '%d' ) ) AS activity SELECT tt.ddate, COUNT( DATE_FORMAT( tt.ddate, '%d' ) ) AS activity
FROM ( FROM (
@@ -763,10 +842,22 @@ class module_report_activity extends module_report
FROM log AS log_date FORCE INDEX (date_site) INNER JOIN log_colls FORCE INDEX (couple) ON (log_date.id = log_colls.log_id) FROM log AS log_date FORCE INDEX (date_site) INNER JOIN log_colls FORCE INDEX (couple) ON (log_date.id = log_colls.log_id)
WHERE " . $datefilter['sql'] . " WHERE " . $datefilter['sql'] . "
AND log_date.site = :site_id" . AND log_date.site = :site_id" .
(('' !== $collfilter['sql']) ? (" AND (" . $collfilter['sql'] . ")") : '') (('' !== $collfilter['sql']) ? (" AND (" . $collfilter['sql'] . ")") : '')
. ") AS tt . ") AS tt
GROUP by tt.ddate GROUP by tt.ddate
ORDER BY tt.ddate ASC"; ORDER BY tt.ddate ASC";
*/
$sql = "SELECT tt.ddate, COUNT( DATE_FORMAT( tt.ddate, '%d' ) ) AS activity\n"
. " FROM (\n"
. " SELECT DISTINCT(log_date.id), DATE_FORMAT( log_date.date, '%Y-%m-%d' ) AS ddate\n"
. " FROM log AS log_date FORCE INDEX (date_site)\n"
. " WHERE " . $datefilter['sql'] . "\n"
. " AND log_date.site = :site_id AND !ISNULL(usrid)"
. ") AS tt\n"
. " GROUP by tt.ddate\n"
. " ORDER BY tt.ddate ASC";
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $sql), FILE_APPEND);
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
$stmt->execute($params); $stmt->execute($params);
@@ -785,8 +876,10 @@ class module_report_activity extends module_report
return $res; return $res;
} }
//============================= Dashboard =========================
public static function activityQuestion(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id) public static function activityQuestion(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
{ {
<<<<<<< HEAD
$databox = $app['phraseanet.appbox']->get_databox($sbas_id); $databox = $app['phraseanet.appbox']->get_databox($sbas_id);
$conn = $databox->get_connection(); $conn = $databox->get_connection();
$result = []; $result = [];
@@ -798,6 +891,15 @@ class module_report_activity extends module_report
$params = [':site_id' => $app['conf']->get(['main', 'key'])]; $params = [':site_id' => $app['conf']->get(['main', 'key'])];
$params = array_merge($params, $datefilter['params'], $collfilter['params']); $params = array_merge($params, $datefilter['params'], $collfilter['params']);
=======
$conn = connection::getPDOConnection($app, $sbas_id);
$result = array();
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax, 'log_search.date');
$params = array(':site_id' => $app['phraseanet.configuration']['main']['key']);
$params = array_merge($params, $datefilter['params']);
/*
>>>>>>> 3.8
$sql = " $sql = "
SELECT tt.usrid, tt.user, sum(1) AS nb SELECT tt.usrid, tt.user, sum(1) AS nb
FROM ( FROM (
@@ -807,10 +909,23 @@ class module_report_activity extends module_report
INNER JOIN log_colls FORCE INDEX (couple) ON (log_date.id = log_colls.log_id) INNER JOIN log_colls FORCE INDEX (couple) ON (log_date.id = log_colls.log_id)
WHERE " . $datefilter['sql'] . " WHERE " . $datefilter['sql'] . "
AND log_date.site = :site_id" . AND log_date.site = :site_id" .
(('' !== $collfilter['sql']) ? " AND (" . $collfilter['sql'] . ")" : '') (('' !== $collfilter['sql']) ? " AND (" . $collfilter['sql'] . ")" : '')
. ") AS tt . ") AS tt
GROUP BY tt.usrid GROUP BY tt.usrid
ORDER BY nb DESC"; ORDER BY nb DESC";
*/
$sql = "SELECT tt.usrid, tt.user, sum(1) AS nb\n"
. " FROM (\n"
. " SELECT DISTINCT(log_date.id), log_date.usrid, log_date.user\n"
. " FROM (`log_search`)\n"
. " INNER JOIN log AS log_date FORCE INDEX (date_site) ON (log_search.log_id = log_date.id)\n"
. " WHERE " . $datefilter['sql'] . "\n"
. " AND log_date.site = :site_id"
. ") AS tt\n"
. " GROUP BY tt.usrid\n"
. " ORDER BY nb DESC";
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $sql), FILE_APPEND);
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
$stmt->execute($params); $stmt->execute($params);
@@ -826,8 +941,10 @@ class module_report_activity extends module_report
return $result; return $result;
} }
//============================= Dashboard =========================
public static function activiteTopQuestion(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id) public static function activiteTopQuestion(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
{ {
<<<<<<< HEAD
$databox = $app['phraseanet.appbox']->get_databox($sbas_id); $databox = $app['phraseanet.appbox']->get_databox($sbas_id);
$conn = $databox->get_connection(); $conn = $databox->get_connection();
$result = []; $result = [];
@@ -839,6 +956,15 @@ class module_report_activity extends module_report
$params = [':site_id' => $app['conf']->get(['main', 'key'])]; $params = [':site_id' => $app['conf']->get(['main', 'key'])];
$params = array_merge($params, $datefilter['params'], $collfilter['params']); $params = array_merge($params, $datefilter['params'], $collfilter['params']);
=======
$conn = connection::getPDOConnection($app, $sbas_id);
$result = array();
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax, 'log_search.date');
$params = array(':site_id' => $app['phraseanet.configuration']['main']['key']);
$params = array_merge($params, $datefilter['params']);
/*
>>>>>>> 3.8
$sql = " $sql = "
SELECT TRIM(tt.search) AS question, tt.usrid, tt.user, SUM(1) AS nb SELECT TRIM(tt.search) AS question, tt.usrid, tt.user, SUM(1) AS nb
FROM ( FROM (
@@ -848,10 +974,23 @@ class module_report_activity extends module_report
INNER JOIN log_colls FORCE INDEX (couple) ON (log_date.id = log_colls.log_id) INNER JOIN log_colls FORCE INDEX (couple) ON (log_date.id = log_colls.log_id)
WHERE " . $datefilter['sql'] . " WHERE " . $datefilter['sql'] . "
AND log_date.site = :site_id" . AND log_date.site = :site_id" .
(('' !== $collfilter['sql']) ? " AND (" . $collfilter['sql'] . ")" : '') (('' !== $collfilter['sql']) ? " AND (" . $collfilter['sql'] . ")" : '')
. ") AS tt . ") AS tt
GROUP BY tt.search GROUP BY tt.search
ORDER BY nb DESC"; ORDER BY nb DESC";
*/
$sql = "SELECT TRIM(tt.search) AS question, tt.usrid, tt.user, SUM(1) AS nb\n"
. " FROM (\n"
. " SELECT DISTINCT(log_date.id), log_search.search, log_date.usrid, log_date.user\n"
. " FROM (`log_search`)\n"
. " INNER JOIN log AS log_date FORCE INDEX (date_site) ON (log_search.log_id = log_date.id)\n"
. " WHERE " . $datefilter['sql'] . "\n"
. " AND log_date.site = :site_id"
. ") AS tt\n"
. " GROUP BY tt.search\n"
. " ORDER BY nb DESC";
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $sql), FILE_APPEND);
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
$stmt->execute($params); $stmt->execute($params);
@@ -870,17 +1009,23 @@ class module_report_activity extends module_report
return $result; return $result;
} }
//============================= Dashboard =========================
public static function activiteTopTenSiteView(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id) public static function activiteTopTenSiteView(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
{ {
$databox = $app['phraseanet.appbox']->get_databox($sbas_id); $databox = $app['phraseanet.appbox']->get_databox($sbas_id);
$conn = $databox->get_connection(); $conn = $databox->get_connection();
$result = []; $result = [];
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax); $datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax);
$collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
<<<<<<< HEAD
$params = []; $params = [];
$params = array_merge($params, $datefilter['params'], $collfilter['params']); $params = array_merge($params, $datefilter['params'], $collfilter['params']);
=======
$params = array();
$params = array_merge($params, $datefilter['params']);
/*
>>>>>>> 3.8
$sql = " $sql = "
SELECT tt.referrer, SUM(1) AS nb_view SELECT tt.referrer, SUM(1) AS nb_view
FROM ( FROM (
@@ -889,10 +1034,22 @@ class module_report_activity extends module_report
INNER JOIN log AS log_date FORCE INDEX (date_site) ON (log_view.log_id = log_date.id) INNER JOIN log AS log_date FORCE INDEX (date_site) ON (log_view.log_id = log_date.id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log_date.id = log_colls.log_id) INNER JOIN log_colls FORCE INDEX (couple) ON (log_date.id = log_colls.log_id)
WHERE " . $datefilter['sql'] . "" . WHERE " . $datefilter['sql'] . "" .
(('' !== $collfilter['sql']) ? " AND (" . $collfilter['sql'] . ")" : '') (('' !== $collfilter['sql']) ? " AND (" . $collfilter['sql'] . ")" : '')
. ") AS tt . ") AS tt
GROUP BY referrer GROUP BY referrer
ORDER BY nb_view DESC "; ORDER BY nb_view DESC ";
*/
$sql = "SELECT tt.referrer, SUM(1) AS nb_view\n"
. " FROM (\n"
. " SELECT DISTINCT(log_date.id), referrer\n"
. " FROM (log_view)\n"
. " INNER JOIN log AS log_date FORCE INDEX (date_site) ON (log_view.log_id = log_date.id)\n"
. " WHERE " . $datefilter['sql']
. ") AS tt\n"
. " GROUP BY referrer\n"
. " ORDER BY nb_view DESC ";
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $sql), FILE_APPEND);
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
$stmt->execute($params); $stmt->execute($params);
@@ -914,8 +1071,10 @@ class module_report_activity extends module_report
return $result; return $result;
} }
//============================= Dashboard =========================
public static function activiteAddedDocument(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id) public static function activiteAddedDocument(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
{ {
<<<<<<< HEAD
$databox = $app['phraseanet.appbox']->get_databox($sbas_id); $databox = $app['phraseanet.appbox']->get_databox($sbas_id);
$conn = $databox->get_connection(); $conn = $databox->get_connection();
$result = []; $result = [];
@@ -925,6 +1084,15 @@ class module_report_activity extends module_report
$params = []; $params = [];
$params = array_merge($params, $datefilter['params'], $collfilter['params']); $params = array_merge($params, $datefilter['params'], $collfilter['params']);
=======
$conn = connection::getPDOConnection($app, $sbas_id);
$result = array();
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax,'log_docs.date');
$params = array();
$params = array_merge($params, $datefilter['params']);
/*
>>>>>>> 3.8
$sql = " $sql = "
SELECT tt.ddate, COUNT( DATE_FORMAT( tt.ddate, '%d' ) ) AS activity SELECT tt.ddate, COUNT( DATE_FORMAT( tt.ddate, '%d' ) ) AS activity
FROM ( FROM (
@@ -934,10 +1102,22 @@ class module_report_activity extends module_report
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id) INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
WHERE " . $datefilter['sql'] . " AND log_date.action = 'add' " . WHERE " . $datefilter['sql'] . " AND log_date.action = 'add' " .
(('' !== $collfilter['sql']) ? " AND (" . $collfilter['sql'] . ")" : '') (('' !== $collfilter['sql']) ? " AND (" . $collfilter['sql'] . ")" : '')
. " . "
) AS tt ) AS tt
GROUP BY tt.ddate GROUP BY tt.ddate
ORDER BY activity ASC "; ORDER BY activity ASC ";
*/
$sql = "SELECT tt.ddate, COUNT( DATE_FORMAT( tt.ddate, '%d' ) ) AS activity\n"
. " FROM (\n"
. " SELECT DISTINCT(log.id), DATE_FORMAT(log_docs.date, '%Y-%m-%d') AS ddate\n"
. " FROM (log_docs)\n"
. " INNER JOIN log FORCE INDEX (date_site) ON (log_docs.log_id = log.id)\n"
. " WHERE " . $datefilter['sql'] . " AND log_docs.action = 'add'"
. " ) AS tt\n"
. " GROUP BY tt.ddate\n"
. " ORDER BY activity ASC ";
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $sql), FILE_APPEND);
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
$stmt->execute($params); $stmt->execute($params);
@@ -951,8 +1131,10 @@ class module_report_activity extends module_report
return $result; return $result;
} }
//============================= Dashboard =========================
public static function activiteEditedDocument(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id) public static function activiteEditedDocument(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
{ {
<<<<<<< HEAD
$databox = $app['phraseanet.appbox']->get_databox($sbas_id); $databox = $app['phraseanet.appbox']->get_databox($sbas_id);
$conn = $databox->get_connection(); $conn = $databox->get_connection();
$result = []; $result = [];
@@ -962,6 +1144,15 @@ class module_report_activity extends module_report
$params = []; $params = [];
$params = array_merge($params, $datefilter['params'], $collfilter['params']); $params = array_merge($params, $datefilter['params'], $collfilter['params']);
=======
$conn = connection::getPDOConnection($app, $sbas_id);
$result = array();
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax, 'log_docs.date');
$params = array();
$params = array_merge($params, $datefilter['params']);
/*
>>>>>>> 3.8
$sql = " $sql = "
SELECT tt.ddate, COUNT( DATE_FORMAT( tt.ddate, '%d' ) ) AS activity SELECT tt.ddate, COUNT( DATE_FORMAT( tt.ddate, '%d' ) ) AS activity
FROM ( FROM (
@@ -970,10 +1161,22 @@ class module_report_activity extends module_report
INNER JOIN log FORCE INDEX (date_site) ON (log_date.log_id = log.id) INNER JOIN log FORCE INDEX (date_site) ON (log_date.log_id = log.id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id) INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
WHERE " . $datefilter['sql'] . " AND log_date.action = 'edit'" . WHERE " . $datefilter['sql'] . " AND log_date.action = 'edit'" .
(('' !== $collfilter['sql']) ? " AND (" . $collfilter['sql'] . ")" : '') (('' !== $collfilter['sql']) ? " AND (" . $collfilter['sql'] . ")" : '')
. ") AS tt . ") AS tt
GROUP BY tt.ddate GROUP BY tt.ddate
ORDER BY activity ASC "; ORDER BY activity ASC ";
*/
$sql = "SELECT tt.ddate, COUNT( DATE_FORMAT( tt.ddate, '%d' ) ) AS activity\n"
. " FROM (\n"
. " SELECT DISTINCT(log.id), DATE_FORMAT( log_docs.date, '%Y-%m-%d') AS ddate\n"
. " FROM (log_docs)\n"
. " INNER JOIN log FORCE INDEX (date_site) ON (log_docs.log_id = log.id)\n"
. " WHERE " . $datefilter['sql'] . " AND log_docs.action = 'edit'"
. ") AS tt\n"
. " GROUP BY tt.ddate\n"
. " ORDER BY activity ASC ";
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $sql), FILE_APPEND);
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
$stmt->execute($params); $stmt->execute($params);
@@ -988,8 +1191,10 @@ class module_report_activity extends module_report
return $result; return $result;
} }
//============================= Dashboard =========================
public static function activiteAddedTopTenUser(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id) public static function activiteAddedTopTenUser(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
{ {
<<<<<<< HEAD
$databox = $app['phraseanet.appbox']->get_databox($sbas_id); $databox = $app['phraseanet.appbox']->get_databox($sbas_id);
$conn = $databox->get_connection(); $conn = $databox->get_connection();
$result = []; $result = [];
@@ -999,6 +1204,15 @@ class module_report_activity extends module_report
$params = []; $params = [];
$params = array_merge($params, $datefilter['params'], $collfilter['params']); $params = array_merge($params, $datefilter['params'], $collfilter['params']);
=======
$conn = connection::getPDOConnection($app, $sbas_id);
$result = array();
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax, 'log_docs.date');
$params = array();
$params = array_merge($params, $datefilter['params']);
/*
>>>>>>> 3.8
$sql = " $sql = "
SELECT tt.usrid, tt.user, sum( 1 ) AS nb SELECT tt.usrid, tt.user, sum( 1 ) AS nb
FROM ( FROM (
@@ -1007,10 +1221,23 @@ class module_report_activity extends module_report
INNER JOIN log FORCE INDEX (date_site) ON (log_date.log_id = log.id) INNER JOIN log FORCE INDEX (date_site) ON (log_date.log_id = log.id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id) INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
WHERE " . $datefilter['sql'] . " AND log_date.action = 'add'" . WHERE " . $datefilter['sql'] . " AND log_date.action = 'add'" .
(('' !== $collfilter['sql']) ? " AND (" . $collfilter['sql'] . ")" : '') (('' !== $collfilter['sql']) ? " AND (" . $collfilter['sql'] . ")" : '')
. ") AS tt . ") AS tt
GROUP BY tt.usrid GROUP BY tt.usrid
ORDER BY nb ASC "; ORDER BY nb ASC ";
*/
$sql = ""
. " SELECT tt.usrid, tt.user, sum( 1 ) AS nb\n"
. " FROM (\n"
. " SELECT DISTINCT(log.id), log.usrid, log.user\n"
. " FROM (log_docs)\n"
. " INNER JOIN log FORCE INDEX (date_site) ON (log_docs.log_id = log.id)\n"
. " WHERE " . $datefilter['sql'] . " AND log_docs.action = 'add'"
. ") AS tt\n"
. " GROUP BY tt.usrid\n"
. " ORDER BY nb ASC ";
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $sql), FILE_APPEND);
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
$stmt->execute($params); $stmt->execute($params);

View File

@@ -38,8 +38,14 @@ class module_report_connexion extends module_report
*/ */
public function __construct(Application $app, $arg1, $arg2, $sbas_id, $collist) public function __construct(Application $app, $arg1, $arg2, $sbas_id, $collist)
{ {
<<<<<<< HEAD
parent::__construct($app, $arg1, $arg2, $sbas_id, $collist); parent::__construct($app, $arg1, $arg2, $sbas_id, $collist);
$this->title = $this->app->trans('report::Connexions'); $this->title = $this->app->trans('report::Connexions');
=======
// parent::__construct($app, $arg1, $arg2, $sbas_id, $collist);
parent::__construct($app, $arg1, $arg2, $sbas_id, "");
$this->title = _('report::Connexions');
>>>>>>> 3.8
} }
/** /**
@@ -139,23 +145,34 @@ class module_report_connexion extends module_report
$conn = $databox->get_connection(); $conn = $databox->get_connection();
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax); $datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax);
$collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
<<<<<<< HEAD
$params = array_merge([ $params = array_merge([
':site_id' => $app['conf']->get(['main', 'key']) ':site_id' => $app['conf']->get(['main', 'key'])
], ],
$datefilter['params'], $datefilter['params'],
$collfilter['params'] $collfilter['params']
=======
$params = array_merge(array(
':site_id' => $app['phraseanet.configuration']['main']['key']
),
$datefilter['params']
>>>>>>> 3.8
); );
$finalfilter = $datefilter['sql'] . ' AND '; $finalfilter = $datefilter['sql'] . ' AND ';
$finalfilter .= $collfilter['sql'] . ' AND ';
$finalfilter .= 'log_date.site = :site_id'; $finalfilter .= 'log_date.site = :site_id';
/*
$sql = "SELECT COUNT(DISTINCT(log_date.id)) as nb $sql = "SELECT COUNT(DISTINCT(log_date.id)) as nb
FROM log as log_date FORCE INDEX (date_site) FROM log as log_date FORCE INDEX (date_site)
INNER JOIN log_colls FORCE INDEX (couple) ON (log_date.id = log_colls.log_id) INNER JOIN log_colls FORCE INDEX (couple) ON (log_date.id = log_colls.log_id)
WHERE " . $finalfilter; WHERE " . $finalfilter;
*/
$sql = "SELECT COUNT(DISTINCT(log_date.id)) as nb\n"
. " FROM log as log_date FORCE INDEX (date_site)\n"
. " WHERE " . $finalfilter . "\n";
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $sql), FILE_APPEND);
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
$stmt->execute($params); $stmt->execute($params);

View File

@@ -80,7 +80,6 @@ class module_report_dashboard_feed implements module_report_dashboard_componentI
} catch (\Exception $e) { } catch (\Exception $e) {
} }
$tmp = new self($app, $sbasid, $sbas_coll, $dmin, $dmax); $tmp = new self($app, $sbasid, $sbas_coll, $dmin, $dmax);
$app['phraseanet.appbox']->set_data_to_cache($tmp, $cache_id); $app['phraseanet.appbox']->set_data_to_cache($tmp, $cache_id);
@@ -138,6 +137,7 @@ class module_report_dashboard_feed implements module_report_dashboard_componentI
$this->report['nb_dl'] = module_report_download::getNbDl( $this->report['nb_dl'] = module_report_download::getNbDl(
$this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection $this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection
); );
//Get Number of connexions //Get Number of connexions
$this->report['nb_conn'] = module_report_connexion::getNbConn( $this->report['nb_conn'] = module_report_connexion::getNbConn(
$this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection $this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection

View File

@@ -21,7 +21,6 @@ class module_report_download extends module_report
'activite' => 'log.activite', 'activite' => 'log.activite',
'fonction' => 'log.fonction', 'fonction' => 'log.fonction',
'usrid' => 'log.usrid', 'usrid' => 'log.usrid',
'coll_id' => 'log_colls.coll_id',
'ddate' => "log_docs.date", 'ddate' => "log_docs.date",
'id' => 'log_docs.id', 'id' => 'log_docs.id',
'log_id' => 'log_docs.log_id', 'log_id' => 'log_docs.log_id',
@@ -44,8 +43,14 @@ class module_report_download extends module_report
*/ */
public function __construct(Application $app, $arg1, $arg2, $sbas_id, $collist) public function __construct(Application $app, $arg1, $arg2, $sbas_id, $collist)
{ {
<<<<<<< HEAD
parent::__construct($app, $arg1, $arg2, $sbas_id, $collist); parent::__construct($app, $arg1, $arg2, $sbas_id, $collist);
$this->title = $this->app->trans('report:: telechargements'); $this->title = $this->app->trans('report:: telechargements');
=======
// parent::__construct($app, $arg1, $arg2, $sbas_id, $collist);
parent::__construct($app, $arg1, $arg2, $sbas_id, "");
$this->title = _('report:: telechargements');
>>>>>>> 3.8
} }
/** /**
@@ -55,9 +60,12 @@ class module_report_download extends module_report
*/ */
protected function buildReq($groupby = false, $on = false) protected function buildReq($groupby = false, $on = false)
{ {
$this->setDateField('log_docs.date');
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
$sql = $this->sqlBuilder('download') $sql = $this->sqlBuilder('download')
->setOn($on)->setGroupBy($groupby)->buildSql(); ->setOn($on)->setGroupBy($groupby)->buildSql();
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
$this->req = $sql->getSql(); $this->req = $sql->getSql();
$this->params = $sql->getParams(); $this->params = $sql->getParams();
$this->total = $sql->getTotalRows(); $this->total = $sql->getTotalRows();
@@ -102,6 +110,7 @@ class module_report_download extends module_report
{ {
$i = 0; $i = 0;
$pref = parent::getPreff($app, $this->sbas_id); $pref = parent::getPreff($app, $this->sbas_id);
//// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s) %s\n\n", __FILE__, __LINE__, var_export($rs, true)), FILE_APPEND);
foreach ($rs as $row) { foreach ($rs as $row) {
if ($this->enable_limit && ($i > $this->nb_record)) if ($this->enable_limit && ($i > $this->nb_record))
@@ -112,23 +121,28 @@ class module_report_download extends module_report
} }
if (array_key_exists('record_id', $row)) { if (array_key_exists('record_id', $row)) {
//// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s) %s\n\n", __FILE__, __LINE__, $row['record_id']), FILE_APPEND);
try { try {
$record = new \record_adapter($app, $this->sbas_id, $row['record_id']); $record = new \record_adapter($app, $this->sbas_id, $row['record_id']);
$caption = $record->get_caption();
foreach ($pref as $field) {
//// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s) %s\n\n", __FILE__, __LINE__, $field), FILE_APPEND);
try {
$this->result[$i][$field] = $caption
->get_field($field)
->get_serialized_values();
} catch (\Exception $e) {
$this->result[$i][$field] = '';
}
}
} catch (\Exception_Record_AdapterNotFound $e) { } catch (\Exception_Record_AdapterNotFound $e) {
continue; foreach ($pref as $field) {
}
foreach ($pref as $field) {
try {
$this->result[$i][$field] = $record->get_caption()
->get_field($field)
->get_serialized_values();
} catch (\Exception $e) {
$this->result[$i][$field] = ''; $this->result[$i][$field] = '';
} }
} }
} }
$i ++; $i ++;
//// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
} }
} }
@@ -175,15 +189,20 @@ class module_report_download extends module_report
$databox = $app['phraseanet.appbox']->get_databox($sbas_id); $databox = $app['phraseanet.appbox']->get_databox($sbas_id);
$conn = $databox->get_connection(); $conn = $databox->get_connection();
<<<<<<< HEAD
$params = [':site_id' => $app['conf']->get(['main', 'key'])]; $params = [':site_id' => $app['conf']->get(['main', 'key'])];
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax); $datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax);
$collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id); $collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
$params = array_merge($params, $datefilter['params'], $collfilter['params']); $params = array_merge($params, $datefilter['params'], $collfilter['params']);
=======
$params = array(':site_id' => $app['phraseanet.configuration']['main']['key']);
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax, 'log_docs.date');
$params = array_merge($params, $datefilter['params']);
>>>>>>> 3.8
$finalfilter = $datefilter['sql'] . ' AND '; $finalfilter = $datefilter['sql'] . ' AND ';
$finalfilter .= $collfilter['sql'] . ' AND ';
$finalfilter .= 'log.site = :site_id'; $finalfilter .= 'log.site = :site_id';
/*
$sql = ' $sql = '
SELECT SUM(1) AS nb SELECT SUM(1) AS nb
FROM ( FROM (
@@ -198,6 +217,18 @@ class module_report_download extends module_report
) )
) AS tt ) AS tt
'; ';
*/
$sql = "SELECT SUM(1) AS nb\n"
. " FROM (\n"
. " SELECT DISTINCT(log.id)\n"
. " FROM log FORCE INDEX (date_site)"
. " INNER JOIN log_docs"
. " WHERE " . $finalfilter . "\n"
. " AND ( log_docs.action = 'download' OR log_docs.action = 'mail' )\n"
. " ) AS tt";
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $sql), FILE_APPEND);
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
$stmt->execute($params); $stmt->execute($params);
$row = $stmt->fetch(PDO::FETCH_ASSOC); $row = $stmt->fetch(PDO::FETCH_ASSOC);
@@ -211,10 +242,16 @@ class module_report_download extends module_report
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id); $databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
$conn = $databox->get_connection(); $conn = $databox->get_connection();
<<<<<<< HEAD
$params = [':site_id' => $app['conf']->get(['main', 'key'])]; $params = [':site_id' => $app['conf']->get(['main', 'key'])];
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax); $datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax);
$collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id); $collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
$params = array_merge($params, $datefilter['params'], $collfilter['params']); $params = array_merge($params, $datefilter['params'], $collfilter['params']);
=======
$params = array(':site_id' => $app['phraseanet.configuration']['main']['key']);
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax, 'log_docs.date');
$params = array_merge($params, $datefilter['params']);
>>>>>>> 3.8
$finalfilter = ""; $finalfilter = "";
$array = [ $array = [
@@ -223,9 +260,8 @@ class module_report_download extends module_report
]; ];
$finalfilter .= $datefilter['sql'] . ' AND '; $finalfilter .= $datefilter['sql'] . ' AND ';
$finalfilter .= $collfilter['sql'] . ' AND ';
$finalfilter .= 'log.site = :site_id'; $finalfilter .= 'log.site = :site_id';
/*
$sql = ' $sql = '
SELECT tt.id, tt.name, SUM(1) AS nb SELECT tt.id, tt.name, SUM(1) AS nb
FROM ( FROM (
@@ -244,6 +280,20 @@ class module_report_download extends module_report
) AS tt ) AS tt
GROUP BY id, name GROUP BY id, name
'; ';
*/
$sql = "SELECT tt.id, tt.name, SUM(1) AS nb\n"
. " FROM (\n"
. " SELECT DISTINCT(log.id) AS log_id, log_docs.record_id as id, subdef.name\n"
. " FROM ( log )\n"
. " INNER JOIN log_docs ON (log.id = log_docs.log_id)\n"
. " INNER JOIN subdef ON (log_docs.record_id = subdef.record_id)\n"
. " WHERE (" . $finalfilter . ")\n"
. " AND ( log_docs.action = 'download' OR log_docs.action = 'mail' )\n"
. " AND subdef.name = log_docs.final\n"
. " ) AS tt\n"
. " GROUP BY id, name\n";
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $sql), FILE_APPEND);
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
$stmt->execute($params); $stmt->execute($params);

View File

@@ -48,7 +48,8 @@ class module_report_nav extends module_report
*/ */
public function __construct(Application $app, $arg1, $arg2, $sbas_id, $collist) public function __construct(Application $app, $arg1, $arg2, $sbas_id, $collist)
{ {
parent::__construct($app, $arg1, $arg2, $sbas_id, $collist); // parent::__construct($app, $arg1, $arg2, $sbas_id, $collist);
parent::__construct($app, $arg1, $arg2, $sbas_id, "");
} }
private function setTotalPourcent() private function setTotalPourcent()
@@ -60,12 +61,11 @@ class module_report_nav extends module_report
$params = array_merge([], $report_filter['params']); $params = array_merge([], $report_filter['params']);
$sql = ' $sql = '
SELECT SUM(1) AS total FROM ( SELECT COUNT(log.id) AS total
SELECT DISTINCT (log.id)
FROM log FORCE INDEX (date_site) FROM log FORCE INDEX (date_site)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id) WHERE ' . $report_filter['sql'] . ' AND nav != "" AND !ISNULL(usrid)';
WHERE ' . $report_filter['sql'] . ' AND nav != ""
) AS tt'; // no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $sql), FILE_APPEND);
$stmt = $sqlBuilder->getConnBas()->prepare($sql); $stmt = $sqlBuilder->getConnBas()->prepare($sql);
$stmt->execute($params); $stmt->execute($params);
@@ -112,16 +112,14 @@ class module_report_nav extends module_report
$params = array_merge([], $report_filter['params']); $params = array_merge([], $report_filter['params']);
$sql = ' $sql = '
SELECT tt.nav, SUM(1) AS nb, ROUND((SUM(1) / ' . $this->total_pourcent . ' * 100), 1) AS pourcent SELECT nav, SUM(1) AS nb, ROUND((SUM(1) / ' . $this->total_pourcent . ' * 100), 1) AS pourcent
FROM (
SELECT DISTINCT(log.id), nav
FROM log FORCE INDEX (date_site, nav) FROM log FORCE INDEX (date_site, nav)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id) WHERE ' . $report_filter['sql'] . ' AND nav != "" AND !ISNULL(usrid)
WHERE ' . $report_filter['sql'] . ' AND nav != "" GROUP BY nav
) AS tt
GROUP BY tt.nav
ORDER BY nb DESC'; ORDER BY nb DESC';
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $sql), FILE_APPEND);
$this->initialize(); $this->initialize();
$stmt = $sqlBuilder->getConnBas()->prepare($sql); $stmt = $sqlBuilder->getConnBas()->prepare($sql);
@@ -171,16 +169,16 @@ class module_report_nav extends module_report
$params = array_merge([], $report_filter['params']); $params = array_merge([], $report_filter['params']);
$sql = ' $sql = '
SELECT tt.os, COUNT(os) AS nb, ROUND((COUNT(os)/' . $this->total_pourcent . '*100),1) AS pourcent SELECT os, COUNT(os) AS nb, ROUND((COUNT(os)/' . $this->total_pourcent . '*100),1) AS pourcent
FROM (
SELECT DISTINCT(log.id), os
FROM log FORCE INDEX (date_site, os) FROM log FORCE INDEX (date_site, os)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id) WHERE '. $report_filter['sql'] . ' AND os != "" AND !ISNULL(usrid)
WHERE '. $report_filter['sql'] . ' AND os != ""
) AS tt GROUP BY os
GROUP BY tt.os
ORDER BY nb DESC'; ORDER BY nb DESC';
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $sql), FILE_APPEND);
$this->initialize(); $this->initialize();
$stmt = $sqlBuilder->getConnBas()->prepare($sql); $stmt = $sqlBuilder->getConnBas()->prepare($sql);
@@ -229,17 +227,17 @@ class module_report_nav extends module_report
$params = array_merge([], $report_filter['params']); $params = array_merge([], $report_filter['params']);
$sql = ' $sql = '
SELECT tt.res, COUNT(res) AS nb, ROUND((COUNT(res)/ ' . $this->total_pourcent . '*100),1) AS pourcent SELECT res, COUNT(res) AS nb, ROUND((COUNT(res)/ ' . $this->total_pourcent . '*100),1) AS pourcent
FROM (
SELECT DISTINCT(log.id), res
FROM log FORCE INDEX (date_site, res) FROM log FORCE INDEX (date_site, res)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id) WHERE '. $report_filter['sql'] . ' AND res != "" AND !ISNULL(usrid)
WHERE '. $report_filter['sql'] . ' AND res != ""
) AS tt GROUP BY res
GROUP BY tt.res
ORDER BY nb DESC ORDER BY nb DESC
LIMIT 0, 10'; LIMIT 0, 10';
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $sql), FILE_APPEND);
$this->initialize(); $this->initialize();
$stmt = $sqlBuilder->getConnBas()->prepare($sql); $stmt = $sqlBuilder->getConnBas()->prepare($sql);
@@ -291,15 +289,16 @@ class module_report_nav extends module_report
$sql = " $sql = "
SELECT tt.combo, COUNT( tt.combo ) AS nb, ROUND((COUNT(tt.combo)/" . $this->total_pourcent . "*100), 1) AS pourcent SELECT tt.combo, COUNT( tt.combo ) AS nb, ROUND((COUNT(tt.combo)/" . $this->total_pourcent . "*100), 1) AS pourcent
FROM ( FROM (
SELECT DISTINCT(log.id), CONCAT( nav, '-', os ) AS combo SELECT CONCAT( nav, '-', os ) AS combo
FROM log FORCE INDEX (date_site, os_nav) FROM log FORCE INDEX (date_site, os_nav)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id) WHERE ". $report_filter['sql'] ." AND nav != '' AND os != '' AND !ISNULL(usrid)
WHERE ". $report_filter['sql'] ." AND nav != '' AND os != ''
) AS tt ) AS tt
GROUP BY tt.combo GROUP BY tt.combo
ORDER BY nb DESC ORDER BY nb DESC
LIMIT 0 , 10"; LIMIT 0 , 10";
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $sql), FILE_APPEND);
$this->initialize(); $this->initialize();
$stmt = $sqlBuilder->getConnBas()->prepare($sql); $stmt = $sqlBuilder->getConnBas()->prepare($sql);
@@ -351,14 +350,12 @@ class module_report_nav extends module_report
$params = array_merge([], $report_filter['params']); $params = array_merge([], $report_filter['params']);
$sql = ' $sql = '
SELECT tt.appli SELECT appli
FROM (
SELECT DISTINCT(log.id), appli
FROM log FORCE INDEX (date_site, appli) FROM log FORCE INDEX (date_site, appli)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id) WHERE ' . $report_filter['sql'] . ' AND appli != \'a:0:{}\' AND !ISNULL(usrid)
WHERE ' . $report_filter['sql'] . ' AND appli != \'a:0:{}\' GROUP BY appli';
) AS tt
GROUP BY tt.appli'; // no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $sql), FILE_APPEND);
$this->initialize(); $this->initialize();
@@ -453,7 +450,13 @@ class module_report_nav extends module_report
WHERE (id = :value)'; WHERE (id = :value)';
} }
<<<<<<< HEAD
$params2 = [':value' => $val]; $params2 = [':value' => $val];
=======
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $sql), FILE_APPEND);
$params2 = array(':value' => $val);
>>>>>>> 3.8
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
$stmt->execute($params2); $stmt->execute($params2);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
@@ -547,13 +550,14 @@ class module_report_nav extends module_report
FROM ( FROM (
SELECT DISTINCT (log.id), version SELECT DISTINCT (log.id), version
FROM log FORCE INDEX (date_site, nav, version) FROM log FORCE INDEX (date_site, nav, version)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
WHERE nav = :browser WHERE nav = :browser
AND ". $report_filter['sql'] . " AND ". $report_filter['sql'] . "
) AS tt ) AS tt
GROUP BY version GROUP BY version
ORDER BY nb DESC"; ORDER BY nb DESC";
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $sql), FILE_APPEND);
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
$stmt->execute($params); $stmt->execute($params);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC);

View File

@@ -54,7 +54,7 @@ class module_report_push extends module_report
protected function buildReq($groupby = false, $on = false) protected function buildReq($groupby = false, $on = false)
{ {
$sqlBuilder = $this->sqlBuilder('action')->setGroupBy($groupby)->setOn($on) $sqlBuilder = $this->sqlBuilder('action')->setGroupBy($groupby)->setOn($on)
->setAction('push')->buildSql(); ->setAction('validate')->buildSql();
$this->req = $sqlBuilder->getSql(); $this->req = $sqlBuilder->getSql();
$this->params = $sqlBuilder->getParams(); $this->params = $sqlBuilder->getParams();
$this->total = $sqlBuilder->getTotalRows(); $this->total = $sqlBuilder->getTotalRows();
@@ -62,7 +62,7 @@ class module_report_push extends module_report
public function colFilter($field, $on = false) public function colFilter($field, $on = false)
{ {
$sqlBuilder = $this->sqlBuilder('action')->setAction('push'); $sqlBuilder = $this->sqlBuilder('action')->setAction('validate');
$var = $sqlBuilder->sqlDistinctValByField($field); $var = $sqlBuilder->sqlDistinctValByField($field);
$sql = $var['sql']; $sql = $var['sql'];
$params = $var['params']; $params = $var['params'];

View File

@@ -39,8 +39,14 @@ class module_report_question extends module_report
*/ */
public function __construct(Application $app, $arg1, $arg2, $sbas_id, $collist) public function __construct(Application $app, $arg1, $arg2, $sbas_id, $collist)
{ {
<<<<<<< HEAD
parent::__construct($app, $arg1, $arg2, $sbas_id, $collist); parent::__construct($app, $arg1, $arg2, $sbas_id, $collist);
$this->title = $this->app->trans('report:: question'); $this->title = $this->app->trans('report:: question');
=======
// parent::__construct($app, $arg1, $arg2, $sbas_id, $collist);
parent::__construct($app, $arg1, $arg2, $sbas_id, "");
$this->title = _('report:: question');
>>>>>>> 3.8
} }
/** /**

View File

@@ -27,7 +27,7 @@ class module_report_sqlconnexion extends module_report_sql implements module_rep
if ($this->groupby == false) { if ($this->groupby == false) {
$this->sql = " $this->sql = "
SELECT SELECT
DISTINCT(log_colls.log_id), log.id,
log.user, log.user,
log.usrid, log.usrid,
log.date as ddate, log.date as ddate,
@@ -40,8 +40,9 @@ class module_report_sqlconnexion extends module_report_sql implements module_rep
log.appli, log.appli,
log.ip log.ip
FROM log FORCE INDEX (date_site) FROM log FORCE INDEX (date_site)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id) WHERE (" . $filter['sql'] .") AND !ISNULL(log.usrid)";
WHERE (" . $filter['sql'] .")";
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $this->sql), FILE_APPEND);
$stmt = $this->connbas->prepare($this->sql); $stmt = $this->connbas->prepare($this->sql);
$stmt->execute($this->params); $stmt->execute($this->params);
@@ -59,12 +60,13 @@ class module_report_sqlconnexion extends module_report_sql implements module_rep
FROM ( FROM (
SELECT DISTINCT(log.id), TRIM(" . $this->getTransQuery($this->groupby) . ") AS " . $this->groupby . " SELECT DISTINCT(log.id), TRIM(" . $this->getTransQuery($this->groupby) . ") AS " . $this->groupby . "
FROM log FORCE INDEX (date_site) FROM log FORCE INDEX (date_site)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
WHERE (" . $filter['sql'] .") WHERE (" . $filter['sql'] .")
) AS tt ) AS tt
GROUP BY " . $this->groupby. " GROUP BY " . $this->groupby. "
ORDER BY nb DESC"; ORDER BY nb DESC";
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $this->sql), FILE_APPEND);
$stmt = $this->connbas->prepare($this->sql); $stmt = $this->connbas->prepare($this->sql);
$stmt->execute($this->params); $stmt->execute($this->params);
$this->total_row = $stmt->rowCount(); $this->total_row = $stmt->rowCount();
@@ -84,10 +86,15 @@ class module_report_sqlconnexion extends module_report_sql implements module_rep
FROM ( FROM (
SELECT DISTINCT(log.id), ' . $this->getTransQuery($field) . ' AS val SELECT DISTINCT(log.id), ' . $this->getTransQuery($field) . ' AS val
FROM log FORCE INDEX (date_site) FROM log FORCE INDEX (date_site)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
WHERE (' . $filter['sql'] . ') WHERE (' . $filter['sql'] . ')
) AS tt ORDER BY val ASC'; ) AS tt ORDER BY val ASC';
<<<<<<< HEAD
return ['sql' => $this->sql, 'params' => $this->params]; return ['sql' => $this->sql, 'params' => $this->params];
=======
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $this->sql), FILE_APPEND);
return array('sql' => $this->sql, 'params' => $this->params);
>>>>>>> 3.8
} }
} }

View File

@@ -17,6 +17,7 @@ class module_report_sqldownload extends module_report_sql implements module_repo
public function __construct(Application $app, module_report $report) public function __construct(Application $app, module_report $report)
{ {
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
parent::__construct($app, $report); parent::__construct($app, $report);
if ($report->isInformative()) { if ($report->isInformative()) {
$this->restrict = true; $this->restrict = true;
@@ -25,12 +26,19 @@ class module_report_sqldownload extends module_report_sql implements module_repo
public function buildSql() public function buildSql()
{ {
<<<<<<< HEAD
$customFieldMap = []; $customFieldMap = [];
=======
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
$customFieldMap = array();
>>>>>>> 3.8
$filter = $this->filter->getReportFilter() ? : ['params' => [], 'sql' => false]; $filter = $this->filter->getReportFilter() ? : ['params' => [], 'sql' => false];
$this->params = array_merge([], $filter['params']); $this->params = array_merge([], $filter['params']);
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
if ($this->groupby == false) { if ($this->groupby == false) {
/*
$this->sql = " $this->sql = "
SELECT DISTINCT(log.id), log.user, log.societe, log.pays, log.activite, log_colls.coll_id, SELECT DISTINCT(log.id), log.user, log.societe, log.pays, log.activite, log_colls.coll_id,
log.fonction, log.usrid, log_docs.date AS ddate, log_docs.record_id, log_docs.final, log_docs.comment log.fonction, log.usrid, log_docs.date AS ddate, log_docs.record_id, log_docs.final, log_docs.comment
@@ -38,10 +46,20 @@ class module_report_sqldownload extends module_report_sql implements module_repo
INNER JOIN log FORCE INDEX (date_site) ON (log.id = log_docs.log_id) INNER JOIN log FORCE INDEX (date_site) ON (log.id = log_docs.log_id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id) INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
WHERE (" .$filter['sql'] . ") AND (log_docs.action = 'download' OR log_docs.action = 'mail')"; WHERE (" .$filter['sql'] . ") AND (log_docs.action = 'download' OR log_docs.action = 'mail')";
*/
$this->sql = "
SELECT log.id, log.user, log.societe, log.pays, log.activite, record.coll_id,
log.fonction, log.usrid, log_docs.date AS ddate, log_docs.record_id, log_docs.final, log_docs.comment
FROM log_docs
INNER JOIN log FORCE INDEX (date_site) ON (log.id = log_docs.log_id)
LEFT JOIN record ON (record.record_id=log_docs.record_id)
LEFT JOIN subdef ON (log_docs.record_id = subdef.record_id)
WHERE (" .$filter['sql'] . ")
AND !ISNULL(usrid)
AND (log_docs.action = 'download' OR log_docs.action = 'mail')
AND (log_docs.final = 'preview' OR log_docs.final = 'document')";
if ($this->restrict) { // no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $this->sql), FILE_APPEND);
$this->sql .= ' AND (log_docs.final = "document" OR log_docs.final = "preview")';
}
} else { } else {
$name = $this->groupby; $name = $this->groupby;
$field = $this->getTransQuery($this->groupby); $field = $this->getTransQuery($this->groupby);
@@ -50,12 +68,12 @@ class module_report_sqldownload extends module_report_sql implements module_repo
$this->sql = ' $this->sql = '
SELECT ' . $name . ', SUM(1) AS telechargement, tt.comment, tt.size, tt.file, tt.mime, tt.final SELECT ' . $name . ', SUM(1) AS telechargement, tt.comment, tt.size, tt.file, tt.mime, tt.final
FROM ( FROM (
SELECT DISTINCT(log.id), TRIM( ' . $field . ' ) AS ' . $name . ', log_docs.comment, subdef.size, subdef.file, subdef.mime, log_docs.final SELECT log.id, TRIM( ' . $field . ' ) AS ' . $name . ', log_docs.comment, subdef.size, subdef.file, subdef.mime, log_docs.final
FROM log FORCE INDEX (date_site) FROM log FORCE INDEX (date_site)
INNER JOIN log_docs ON (log.id = log_docs.log_id) INNER JOIN log_docs ON (log.id = log_docs.log_id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
INNER JOIN record ON (log_docs.record_id = record.record_id) LEFT JOIN record ON (log_docs.record_id = record.record_id)
INNER JOIN subdef ON (log_docs.record_id = subdef.record_id)'; LEFT JOIN subdef ON (log_docs.record_id = subdef.record_id)';
$customFieldMap = [ $customFieldMap = [
$field => $name, $field => $name,
@@ -64,7 +82,12 @@ class module_report_sqldownload extends module_report_sql implements module_repo
'subdef.file' => 'tt.file', 'subdef.file' => 'tt.file',
'subdef.mime' => 'tt.mime', 'subdef.mime' => 'tt.mime',
'log_docs.final' => 'tt.final', 'log_docs.final' => 'tt.final',
<<<<<<< HEAD
]; ];
=======
);
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $this->sql), FILE_APPEND);
>>>>>>> 3.8
} elseif ($this->on == 'DOC') { } elseif ($this->on == 'DOC') {
$this->sql = ' $this->sql = '
@@ -73,9 +96,9 @@ class module_report_sqldownload extends module_report_sql implements module_repo
SELECT DISTINCT(log.id), TRIM(' . $field . ') AS ' . $name . ' SELECT DISTINCT(log.id), TRIM(' . $field . ') AS ' . $name . '
FROM log FORCE INDEX (date_site) FROM log FORCE INDEX (date_site)
INNER JOIN log_docs ON (log.id = log_docs.log_id) INNER JOIN log_docs ON (log.id = log_docs.log_id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id) LEFT JOIN record ON (log_docs.record_id = record.record_id)
INNER JOIN record ON (log_docs.record_id = record.record_id) LEFT JOIN subdef ON ( log_docs.record_id = subdef.record_id)';
INNER JOIN subdef ON ( log_docs.record_id = subdef.record_id)'; // no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $this->sql), FILE_APPEND);
} else { } else {
$this->sql = ' $this->sql = '
SELECT ' . $name . ', SUM(1) AS nombre SELECT ' . $name . ', SUM(1) AS nombre
@@ -83,33 +106,37 @@ class module_report_sqldownload extends module_report_sql implements module_repo
SELECT DISTINCT(log.id), TRIM( ' . $this->getTransQuery($this->groupby) . ') AS ' . $name . ' SELECT DISTINCT(log.id), TRIM( ' . $this->getTransQuery($this->groupby) . ') AS ' . $name . '
FROM log FORCE INDEX (date_site) FROM log FORCE INDEX (date_site)
INNER JOIN log_docs ON (log.id = log_docs.log_id) INNER JOIN log_docs ON (log.id = log_docs.log_id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id) LEFT JOIN record ON (log_docs.record_id = record.record_id)
INNER JOIN record ON (log_docs.record_id = record.record_id) LEFT JOIN subdef ON (record.record_id = subdef.record_id)';
INNER JOIN subdef ON (record.record_id = subdef.record_id)'; // no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $this->sql), FILE_APPEND);
} }
$this->sql .= ' WHERE (subdef.name = log_docs.final) AND ' . $filter['sql'] . ' '; $this->sql .= ' WHERE ' . $filter['sql'] . ' ';
$this->sql .= 'AND ( log_docs.action = \'download\' OR log_docs.action = \'mail\') '; $this->sql .= 'AND ( log_docs.action = \'download\' OR log_docs.action = \'mail\') ';
$this->sql .= $this->on == 'DOC' ? 'AND subdef.name = \'document\' ' : ''; $this->sql .= $this->on == 'DOC' ? 'AND subdef.name = \'document\' ' : '';
$this->sql .= ') as tt'; $this->sql .= ') as tt';
$this->sql .= ' GROUP BY ' . $name . ' ' . ($name == 'record_id' && $this->on == 'DOC' ? ', final' : ''); $this->sql .= ' GROUP BY ' . $name . ' ' . ($name == 'record_id' && $this->on == 'DOC' ? ', final' : '');
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $this->sql), FILE_APPEND);
} }
$stmt = $this->connbas->prepare($this->sql); $stmt = $this->connbas->prepare($this->sql);
$stmt->execute($this->params); $stmt->execute($this->params);
$this->total_row = $stmt->rowCount(); $this->total_row = $stmt->rowCount();
$stmt->closeCursor(); $stmt->closeCursor();
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
if (count($customFieldMap) > 0) { if (count($customFieldMap) > 0) {
$this->sql .= $this->filter->getOrderFilter($customFieldMap) ? : ''; $this->sql .= $this->filter->getOrderFilter($customFieldMap) ? : '';
} else { } else {
$this->sql .= $this->filter->getOrderFilter() ? : ''; $this->sql .= $this->filter->getOrderFilter() ? : '';
} }
if ($this->enable_limit) { if ($this->enable_limit) {
$this->sql .= $this->filter->getLimitFilter() ? : ''; $this->sql .= $this->filter->getLimitFilter() ? : '';
} }
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $this->sql), FILE_APPEND);
return $this; return $this;
} }
@@ -124,9 +151,8 @@ class module_report_sqldownload extends module_report_sql implements module_repo
SELECT DISTINCT(log.id), ' . $this->getTransQuery($field) . ' AS val SELECT DISTINCT(log.id), ' . $this->getTransQuery($field) . ' AS val
FROM log FORCE INDEX (date_site) FROM log FORCE INDEX (date_site)
INNER JOIN log_docs ON (log.id = log_docs.log_id) INNER JOIN log_docs ON (log.id = log_docs.log_id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id) LEFT JOIN record ON (log_docs.record_id = record.record_id)
INNER JOIN record ON (log_docs.record_id = record.record_id) LEFT JOIN subdef ON (log_docs.record_id = subdef.record_id)
INNER JOIN subdef ON (log_docs.record_id = subdef.record_id)
WHERE (' . $filter['sql'] . ') WHERE (' . $filter['sql'] . ')
AND (log_docs.action = "download" OR log_docs.action = "mail")' . AND (log_docs.action = "download" OR log_docs.action = "mail")' .
($this->on == 'DOC' ? ' AND subdef.name = "document"' : '') . ($this->on == 'DOC' ? ' AND subdef.name = "document"' : '') .

View File

@@ -32,8 +32,9 @@ class module_report_sqlfilter
$this->report = $report; $this->report = $report;
} }
public static function constructDateFilter($dmin, $dmax) public static function constructDateFilter($dmin, $dmax, $dateField = 'log_date.date')
{ {
<<<<<<< HEAD
return [ return [
'sql' => ($dmin && $dmax ? ' log_date.date > :date_min AND log_date.date < :date_max ' : false) 'sql' => ($dmin && $dmax ? ' log_date.date > :date_min AND log_date.date < :date_max ' : false)
, 'params' => ($dmin && $dmax ? [':date_min' => $dmin, ':date_max' => $dmax] : []) , 'params' => ($dmin && $dmax ? [':date_min' => $dmin, ':date_max' => $dmax] : [])
@@ -59,6 +60,14 @@ class module_report_sqlfilter
return $ret; return $ret;
} }
=======
return array(
'sql' => ($dmin && $dmax ? ' '.$dateField.' > :date_min AND '.$dateField.' < :date_max ' : false)
, 'params' => ($dmin && $dmax ? array(':date_min' => $dmin, ':date_max' => $dmax) : array())
);
}
>>>>>>> 3.8
public function getCorFilter() public function getCorFilter()
{ {
return $this->cor_query; return $this->cor_query;
@@ -66,25 +75,30 @@ class module_report_sqlfilter
public function getReportFilter() public function getReportFilter()
{ {
$finalfilter = ''; $sql = '';
<<<<<<< HEAD
$params = [':log_site' => $this->app['conf']->get(['main', 'key'])]; $params = [':log_site' => $this->app['conf']->get(['main', 'key'])];
=======
$params = array(':log_site' => $this->app['phraseanet.configuration']['main']['key']);
>>>>>>> 3.8
if ($this->filter['date'] && $this->filter['date']['sql'] !== '') { if ($this->filter['date'] && $this->filter['date']['sql'] !== '') {
$finalfilter .= $this->filter['date']['sql'] . ' AND '; $sql .= $this->filter['date']['sql'] . ' AND ';
$params = array_merge($params, $this->filter['date']['params']); $params = array_merge($params, $this->filter['date']['params']);
} }
if ($this->filter['user'] && $this->filter['user']['sql'] !== '') { if ($this->filter['user'] && $this->filter['user']['sql'] !== '') {
$finalfilter .= $this->filter['user']['sql'] . ' AND '; $sql .= $this->filter['user']['sql'] . ' AND ';
$params = array_merge($params, $this->filter['user']['params']); $params = array_merge($params, $this->filter['user']['params']);
} }
if ($this->filter['collection'] && $this->filter['collection']['sql'] !== '') {
$finalfilter .= $this->filter['collection']['sql'] . ' AND ';
$params = array_merge($params, $this->filter['collection']['params']);
}
$finalfilter .= ' log.site = :log_site';
<<<<<<< HEAD
return ['sql' => $finalfilter, 'params' => $params]; return ['sql' => $finalfilter, 'params' => $params];
=======
$sql .= ' log.site = :log_site';
return array('sql' => $sql, 'params' => $params);
>>>>>>> 3.8
} }
public function getGvSitFilter() public function getGvSitFilter()
@@ -99,7 +113,12 @@ class module_report_sqlfilter
public function getUserIdFilter($id) public function getUserIdFilter($id)
{ {
<<<<<<< HEAD
return ['sql' => "log.usrid = :usr_id_filter", 'params' => [':usr_id_filter' => $id]]; return ['sql' => "log.usrid = :usr_id_filter", 'params' => [':usr_id_filter' => $id]];
=======
return array('sql' => "log.usrid = :usr_id_filter", 'params' => array(':usr_id_filter' => $id));
// return array('sql' => "log.usrid=" . (int)$id, 'params' => array());
>>>>>>> 3.8
} }
public function getDateFilter() public function getDateFilter()
@@ -112,11 +131,6 @@ class module_report_sqlfilter
return $this->filter['user']; return $this->filter['user'];
} }
public function getCollectionFilter()
{
return $this->filter['collection'];
}
public function getRecordFilter() public function getRecordFilter()
{ {
return $this->filter['record']; return $this->filter['record'];
@@ -139,15 +153,38 @@ class module_report_sqlfilter
private function dateFilter(module_report $report) private function dateFilter(module_report $report)
{ {
$this->filter['date'] = false; $this->filter['date'] = false;
/*
if ($report->getDmin() && $report->getDmax()) { if ($report->getDmin() && $report->getDmax()) {
$this->filter['date'] = [ $this->filter['date'] = [
'sql' => ' (log.date > :date_min_f AND log.date < :date_max_f) ' 'sql' => ' (log.date > :date_min_f AND log.date < :date_max_f) '
<<<<<<< HEAD
, 'params' => [ , 'params' => [
':date_min_f' => $report->getDmin() ':date_min_f' => $report->getDmin()
, ':date_max_f' => $report->getDmax() , ':date_max_f' => $report->getDmax()
] ]
]; ];
=======
, 'params' => array(
':date_min_f' => $report->getDmin()
, ':date_max_f' => $report->getDmax()
)
);
>>>>>>> 3.8
} }
*/
$sql = "";
if($report->getDmin()) {
$sql = $report->getDateField().">=" . $this->conn->quote($report->getDmin());
}
if($report->getDmax()) {
if($sql != "") {
$sql .= " AND ";
}
$sql .= $report->getDateField()."<=" . $this->conn->quote($report->getDmax());
}
$this->filter['date'] = array(
'sql' => $sql, 'params' => array()
);
return; return;
} }
@@ -189,6 +226,7 @@ class module_report_sqlfilter
return; return;
} }
<<<<<<< HEAD
private function collectionFilter(module_report $report) private function collectionFilter(module_report $report)
{ {
$this->filter['collection'] = false; $this->filter['collection'] = false;
@@ -218,6 +256,8 @@ class module_report_sqlfilter
return; return;
} }
=======
>>>>>>> 3.8
private function recordFilter(module_report $report) private function recordFilter(module_report $report)
{ {
$this->filter['record'] = false; $this->filter['record'] = false;
@@ -272,7 +312,6 @@ class module_report_sqlfilter
$this->orderFilter($report); $this->orderFilter($report);
$this->recordFilter($report); $this->recordFilter($report);
$this->userFilter($report); $this->userFilter($report);
$this->collectionFilter($report);
return; return;
} }

View File

@@ -25,11 +25,12 @@ class module_report_sqlquestion extends module_report_sql implements module_repo
$this->params = array_merge([], $filter['params']); $this->params = array_merge([], $filter['params']);
if ($this->groupby == false) { if ($this->groupby == false) {
$this->sql =" $this->sql =" SELECT log.id, log_search.date ddate, log_search.search, log.usrid, log.user, log.pays, log.societe, log.activite, log.fonction
SELECT DISTINCT(log.id), log_search.date ddate, log_search.search, log.usrid, log.user, log.pays, log.societe, log.activite, log.fonction
FROM log_search FROM log_search
INNER JOIN log FORCE INDEX (date_site) ON (log.id = log_search.log_id) INNER JOIN log FORCE INDEX (date_site) ON (log.id = log_search.log_id) AND !ISNULL(usrid)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id) WHERE (" . $filter['sql'] .")"; WHERE (" . $filter['sql'] .")";
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $this->sql), FILE_APPEND);
$stmt = $this->connbas->prepare($this->sql); $stmt = $this->connbas->prepare($this->sql);
$stmt->execute($this->params); $stmt->execute($this->params);
@@ -48,12 +49,13 @@ class module_report_sqlquestion extends module_report_sql implements module_repo
SELECT DISTINCT(log.id), TRIM(" . $this->getTransQuery($this->groupby) . ") AS " . $this->groupby . " SELECT DISTINCT(log.id), TRIM(" . $this->getTransQuery($this->groupby) . ") AS " . $this->groupby . "
FROM (`log_search`) FROM (`log_search`)
INNER JOIN log FORCE INDEX (date_site) ON (log.id = log_search.log_id) INNER JOIN log FORCE INDEX (date_site) ON (log.id = log_search.log_id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
WHERE (" . $filter['sql'] .") WHERE (" . $filter['sql'] .")
) AS tt ) AS tt
GROUP BY " . $this->groupby ." GROUP BY " . $this->groupby ."
ORDER BY nb DESC"; ORDER BY nb DESC";
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $this->sql), FILE_APPEND);
$stmt = $this->connbas->prepare($this->sql); $stmt = $this->connbas->prepare($this->sql);
$stmt->execute($this->params); $stmt->execute($this->params);
$this->total_row = $stmt->rowCount(); $this->total_row = $stmt->rowCount();
@@ -74,7 +76,6 @@ class module_report_sqlquestion extends module_report_sql implements module_repo
SELECT DISTINCT(log.id), " . $this->getTransQuery($field) . " AS val SELECT DISTINCT(log.id), " . $this->getTransQuery($field) . " AS val
FROM (`log_search`) FROM (`log_search`)
INNER JOIN log FORCE INDEX (date_site) ON (log.id = log_search.log_id) INNER JOIN log FORCE INDEX (date_site) ON (log.id = log_search.log_id)
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
WHERE (" . $filter['sql'] . ") WHERE (" . $filter['sql'] . ")
) as tt ) as tt
ORDER BY tt.val ASC"; ORDER BY tt.val ASC";

View File

@@ -54,7 +54,7 @@ class module_report_validate extends module_report
protected function buildReq($groupby = false, $on = false) protected function buildReq($groupby = false, $on = false)
{ {
$sqlBuilder = $this->sqlBuilder('action')->setGroupBy($groupby)->setOn($on) $sqlBuilder = $this->sqlBuilder('action')->setGroupBy($groupby)->setOn($on)
->setAction('validate')->buildSql(); ->setAction('push')->buildSql();
$this->req = $sqlBuilder->getSql(); $this->req = $sqlBuilder->getSql();
$this->params = $sqlBuilder->getParams(); $this->params = $sqlBuilder->getParams();
$this->total = $sqlBuilder->getTotalRows(); $this->total = $sqlBuilder->getTotalRows();
@@ -62,7 +62,7 @@ class module_report_validate extends module_report
public function colFilter($field, $on = false) public function colFilter($field, $on = false)
{ {
$sqlBuilder = $this->sqlBuilder('action')->setAction('validate'); $sqlBuilder = $this->sqlBuilder('action')->setAction('push');
$var = $sqlBuilder->sqlDistinctValByField($field); $var = $sqlBuilder->sqlDistinctValByField($field);
$sql = $var['sql']; $sql = $var['sql'];
$params = $var['params']; $params = $var['params'];

View File

@@ -0,0 +1,72 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 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\Finder\Finder;
use Symfony\Component\Filesystem\Filesystem;
class patch_386alpha4a implements patchInterface
{
/** @var string */
private $release = '3.8.6-alpha.4';
/** @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 usr_id FROM usr WHERE usr_login LIKE "(#deleted_%"';
$stmt = $appbox->get_connection()->prepare($sql);
$stmt->execute();
$repo = $app['EM']->getRepository('Entities\UsrList');
$users = $stmt->fetchAll(\PDO::FETCH_ASSOC);
foreach ($users as $user) {
foreach ($repo->findUserLists(new \User_Adapter($user['usr_id'], $app)) as $list) {
$app['EM']->remove($list);
}
$app['EM']->flush();
}
$stmt->closeCursor();
return true;
}
}

View File

@@ -3817,68 +3817,6 @@
<engine>InnoDB</engine> <engine>InnoDB</engine>
</table> </table>
<table name="log_thumb">
<fields>
<field>
<name>date</name>
<type>datetime</type>
<null></null>
<extra></extra>
<default>0000-00-00 00:00:00</default>
<comment></comment>
</field>
<field>
<name>record_id</name>
<type>int(11) unsigned</type>
<null></null>
<extra></extra>
<default></default>
<comment></comment>
</field>
<field>
<name>site_id</name>
<type>varchar(256)</type>
<null></null>
<extra></extra>
<default></default>
<comment></comment>
</field>
<field>
<name>counter</name>
<type>int(11) unsigned</type>
<null></null>
<extra></extra>
<default>1</default>
<comment></comment>
</field>
</fields>
<indexes>
<index>
<name>date</name>
<type>INDEX</type>
<fields>
<field>date</field>
</fields>
</index>
<index>
<name>record_id</name>
<type>INDEX</type>
<fields>
<field>record_id</field>
</fields>
</index>
<index>
<name>site_id</name>
<type>INDEX</type>
<fields>
<field>record_id</field>
</fields>
</index>
</indexes>
<engine>InnoDB</engine>
</table>
<table name="permalinks"> <table name="permalinks">
<fields> <fields>
<field> <field>

View File

@@ -67,12 +67,9 @@
<td class="colValue" >{{ data['applications'][5] }}</td> <td class="colValue" >{{ data['applications'][5] }}</td>
</tr> </tr>
<tr> <tr>
{# module witj id 7 has been removed keep it for bc #}
<td class="colTitle" >{{ 'admin::monitor: module comparateur' | trans }}</td> <td class="colTitle" >{{ 'admin::monitor: module comparateur' | trans }}</td>
<td class="colValue" >{{ data['applications'][6] }}</td> <td class="colValue" >{{ data['applications'][6] + data['applications'][7] }}</td>
</tr>
<tr>
<td class="colTitle" >{{ 'admin::monitor: module validation' | trans }}</td>
<td class="colValue" >{{ data['applications'][7] }}</td>
</tr> </tr>
{% if data['applications'][0] != 0 %} {% if data['applications'][0] != 0 %}
<tr> <tr>

View File

@@ -338,9 +338,13 @@
<span>{{ 'Trier par' | trans }}</span> <span>{{ 'Trier par' | trans }}</span>
<select name="sort" class="input-small"> <select name="sort" class="input-small">
<option value="" {% if app['phraseanet.SE'].getDefaultSort() is empty %}selected="selected default-selection"{% endif %}>{{ "No sort"|trans }}</option> <option value="" {% if app['phraseanet.SE'].getDefaultSort() is empty %}selected="selected" class="default-selection"{% endif %}>{{ "No sort"|trans }}</option>
{% for sort in search_datas['sort'] %} {% for sort in search_datas['sort'] %}
<<<<<<< HEAD
<option value="{{ sort.fieldname }}" {% if sort.fieldname == app['phraseanet.SE'].getDefaultSort() %}selected="selected default-selection"{% endif %}>{{ sort.fieldname }}</option> <option value="{{ sort.fieldname }}" {% if sort.fieldname == app['phraseanet.SE'].getDefaultSort() %}selected="selected default-selection"{% endif %}>{{ sort.fieldname }}</option>
=======
<option value="{{ sort.fieldname }}" {% if sort.fieldname == app['phraseanet.SE'].getDefaultSort() %}selected="selected" class="default-selection"{% endif %}>{{ sort.fieldname }}</option>
>>>>>>> 3.8
{% endfor %} {% endfor %}
</select> </select>
<select name="ord" class="input-medium"> <select name="ord" class="input-medium">

View File

@@ -77,12 +77,14 @@
$(document).ready(function(){ $(document).ready(function(){
var dialog = p4.Dialog.get(1); var dialog = p4.Dialog.get(1);
$('a.self-ajax', dialog.getDomElement()).bind('click', function(){ $('a.self-ajax', dialog.getDomElement()).bind('click', function(e){
e.preventDefault();
var url = $(this).attr('href'); var url = $(this).attr('href');
dialog.load(url); dialog.load(url);
}); });
$('tr.order_row', dialog.getDomElement()).bind('click', function(e){ $('tr.order_row', dialog.getDomElement()).bind('click', function(e){
e.preventDefault();
var id = $(this).attr('id').split('_').pop(); var id = $(this).attr('id').split('_').pop();
dialog.load('/prod/order/' + id +'/'); dialog.load('/prod/order/' + id +'/');
}).addClass('clickable'); }).addClass('clickable');

View File

@@ -19,7 +19,7 @@
<div class="form_titre">{{ "report:: 2 - Bases" | trans }}</div> <div class="form_titre">{{ "report:: 2 - Bases" | trans }}</div>
<div id="select_one"> <div id="select_one">
<ul class="multiselect" style="max-height: 150px; overflow-y: auto; overflow-x: hidden;"> <ul class="multiselect" style="max-height: 150px; overflow-y: auto; overflow-x: hidden;">
<li> <li style="visibility: hidden">
<a href="javascript:void(0);" class="select-all"> <a href="javascript:void(0);" class="select-all">
{% trans %}Select all{% endtrans %} {% trans %}Select all{% endtrans %}
</a> </a>
@@ -30,7 +30,7 @@
{% for sbas_id,databox in granted_bases %} {% for sbas_id,databox in granted_bases %}
<li><label data-group-id="{{ loop.index }}" class="multiselect-group"><b>{{ databox.name }}</b></label></li> <li><label data-group-id="{{ loop.index }}" class="multiselect-group"><b>{{ databox.name }}</b></label></li>
{% for collection in databox.collections %} {% for collection in databox.collections %}
<li> <li style="visibility: hidden">
<a href="javascript:void(0);"> <a href="javascript:void(0);">
<label class="checkbox"> <label class="checkbox">
<input name="popbases[]" checked="checked" type="checkbox" class="coll-checkbox checkbox-{{ loop.parent.loop.index }}" value="{{ sbas_id }}_{{ collection.id }}"> <input name="popbases[]" checked="checked" type="checkbox" class="coll-checkbox checkbox-{{ loop.parent.loop.index }}" value="{{ sbas_id }}_{{ collection.id }}">

View File

@@ -54,7 +54,7 @@ class OverviewTest extends \PhraseanetAuthenticatedWebTestCase
$this->assertNotFoundResponse(self::$DI['client']->getResponse()); $this->assertNotFoundResponse(self::$DI['client']->getResponse());
} }
public function testEtag() public function testLastModified()
{ {
$acl = $this->getMockBuilder('ACL') $acl = $this->getMockBuilder('ACL')
->disableOriginalConstructor() ->disableOriginalConstructor()
@@ -83,7 +83,6 @@ class OverviewTest extends \PhraseanetAuthenticatedWebTestCase
$response = self::$DI['client']->getResponse(); $response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk()); $this->assertTrue($response->isOk());
$this->assertNotNull($response->getEtag());
$this->assertInstanceOf('DateTime', $response->getLastModified()); $this->assertInstanceOf('DateTime', $response->getLastModified());
$this->assertEquals(0, $response->getMaxAge()); $this->assertEquals(0, $response->getMaxAge());
$this->assertEquals(0, $response->getTtl()); $this->assertEquals(0, $response->getTtl());

View File

@@ -519,6 +519,8 @@ class AdminCollectionTest extends \PhraseanetAuthenticatedWebTestCase
*/ */
public function testPostEmptyCollectionWithHighRecordAmount() public function testPostEmptyCollectionWithHighRecordAmount()
{ {
$this->markTestSkipped('This tests lasts for 40 sec.');
$this->setAdmin(true); $this->setAdmin(true);
$collection = $this->createOneCollection(); $collection = $this->createOneCollection();

View File

@@ -37,7 +37,6 @@ class ServeFileResponseFactoryTest extends \PhraseanetWebTestCase
$response = $this->factory->deliverFile(__DIR__ . '/../../../../files/cestlafete.jpg', 'hello', 'attachment', 'application/json', 23456); $response = $this->factory->deliverFile(__DIR__ . '/../../../../files/cestlafete.jpg', 'hello', 'attachment', 'application/json', 23456);
$this->assertEquals(23456, $response->getMaxAge()); $this->assertEquals(23456, $response->getMaxAge());
$this->assertTrue($response->headers->getCacheControlDirective('private'));
} }
public function testDeliverFileWithFilename() public function testDeliverFileWithFilename()

View File

@@ -60,8 +60,6 @@ class report_activityTest extends \PhraseanetAuthenticatedTestCase
$this->activity($report, $sbasid, $colllist); $this->activity($report, $sbasid, $colllist);
$this->activityDay($report, $sbasid, $colllist); $this->activityDay($report, $sbasid, $colllist);
$this->activityQuestion($report, $sbasid, $colllist); $this->activityQuestion($report, $sbasid, $colllist);
$this->allDownloadByUserBase($report);
$this->allQuestion($report);
$this->detailDownload($report); $this->detailDownload($report);
$this->downloadByBaseByDay($report); $this->downloadByBaseByDay($report);
$this->otherTest($report); $this->otherTest($report);
@@ -82,12 +80,15 @@ class report_activityTest extends \PhraseanetAuthenticatedTestCase
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $activityHours); $this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $activityHours);
} }
<<<<<<< HEAD
public function allQuestion($report) public function allQuestion($report)
{ {
$allQuestion = $report->getAllQuestionByUser(self::$DI['user']->getId(), 'usrid'); $allQuestion = $report->getAllQuestionByUser(self::$DI['user']->getId(), 'usrid');
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $allQuestion); $this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $allQuestion);
} }
=======
>>>>>>> 3.8
public function topQuestion($report) public function topQuestion($report)
{ {
$topQuestion = $report->getTopQuestion(); $topQuestion = $report->getTopQuestion();
@@ -96,12 +97,15 @@ class report_activityTest extends \PhraseanetAuthenticatedTestCase
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $topQuestion2); $this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $topQuestion2);
} }
<<<<<<< HEAD
public function allDownloadByUserBase($report) public function allDownloadByUserBase($report)
{ {
$allDownload = $report->getAllDownloadByUserBase(self::$DI['user']->getId()); $allDownload = $report->getAllDownloadByUserBase(self::$DI['user']->getId());
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $allDownload); $this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $allDownload);
} }
=======
>>>>>>> 3.8
public function downloadByBaseByDay($report) public function downloadByBaseByDay($report)
{ {
$dlBaseDay = $report->getDownloadByBaseByDay(); $dlBaseDay = $report->getDownloadByBaseByDay();

View File

@@ -28,6 +28,7 @@ class report_editTest extends \PhraseanetAuthenticatedTestCase
public function testBuildReport() public function testBuildReport()
{ {
<<<<<<< HEAD
$conf = [ $conf = [
'user' => ["", 1, 0, 1, 1], 'user' => ["", 1, 0, 1, 1],
'date' => ["", 1, 0, 1, 1], 'date' => ["", 1, 0, 1, 1],
@@ -36,6 +37,15 @@ class report_editTest extends \PhraseanetAuthenticatedTestCase
'mime' => ["", 1, 0, 1, 1], 'mime' => ["", 1, 0, 1, 1],
'size' => ["", 1, 0, 1, 1] 'size' => ["", 1, 0, 1, 1]
]; ];
=======
$conf = array(
'user' => array("", 1, 0, 1, 1),
'date' => array("", 1, 0, 1, 1),
'record_id' => array("", 1, 1, 1, 1),
'file' => array("", 1, 0, 1, 1),
'mime' => array("", 1, 0, 1, 1),
);
>>>>>>> 3.8
foreach ($this->ret as $sbasid => $collections) { foreach ($this->ret as $sbasid => $collections) {
$this->report = new module_report_edit( $this->report = new module_report_edit(
@@ -160,7 +170,6 @@ class report_editTest extends \PhraseanetAuthenticatedTestCase
if (! $groupby) { if (! $groupby) {
foreach ($report['result'] as $row) { foreach ($report['result'] as $row) {
foreach ($conf as $key => $value) { foreach ($conf as $key => $value) {
$this->assertArrayHasKey($key, $row); $this->assertArrayHasKey($key, $row);
$condition = is_string($row[$key]) || is_int($row[$key]); $condition = is_string($row[$key]) || is_int($row[$key]);
$this->assertTrue($condition); $this->assertTrue($condition);

View File

@@ -90,18 +90,6 @@ class report_sqlFilterTest extends \PhraseanetAuthenticatedTestCase
} }
} }
public function testCollectionFilter()
{
if ($this->report->getUserId() == '') {
$this->assertFalse($this->filter->getCollectionFilter());
} elseif (count(explode(",", $this->report->getListCollId()) > 0)) {
$filter = $this->filter->getCollectionFilter();
$this->checkFilter($filter);
} else {
$this->assertFalse($this->filter->getCollectionFilter());
}
}
public function testRecordFilter() public function testRecordFilter()
{ {
if ($this->report->getUserId() == '') { if ($this->report->getUserId() == '') {

View File

@@ -761,7 +761,7 @@ $(document).ready(function () {
var parent = searchForm.parent(); var parent = searchForm.parent();
var options = { var options = {
size: 'Full', size: (bodySize.x - 120)+'x'+(bodySize.y - 120),
loading: false, loading: false,
closeCallback: function (dialog) { closeCallback: function (dialog) {

View File

@@ -823,7 +823,7 @@ body .ui-tooltip {
.ui-widget-content .ui-state-default, .ui-widget-content .ui-state-default,
.ui-widget-header .ui-state-default { .ui-widget-header .ui-state-default {
border: 1px solid #202020; border: 1px solid #202020;
background: #313131 url(images/ui-bg_flat_75_313131_40x100.png) 50% 50% repeat-x; background: #313131 url(images/ui-bg_flat_75_d2d1cf_40x100.png) 50% 50% repeat-x;
font-weight: bold; font-weight: bold;
color: #ffffff; color: #ffffff;
} }
@@ -855,7 +855,7 @@ body .ui-tooltip {
.ui-widget-content .ui-state-active, .ui-widget-content .ui-state-active,
.ui-widget-header .ui-state-active { .ui-widget-header .ui-state-active {
border: 1px solid #202020; border: 1px solid #202020;
background: #555555 url(images/ui-bg_flat_65_555555_40x100.png) 50% 50% repeat-x; background: #555555 url(images/ui-bg_flat_75_d2d1cf_40x100.png) 50% 50% repeat-x;
font-weight: bold; font-weight: bold;
color: #ff9000; color: #ff9000;
} }

View File

@@ -64,7 +64,8 @@ function bindEvents() {
$('#dminDash, #dmaxDash').datepicker({ $('#dminDash, #dmaxDash').datepicker({
changeMonth: true, changeMonth: true,
changeYear: true, changeYear: true,
dateFormat: 'dd-mm-yy', // dateFormat: 'dd-mm-yy',
dateFormat: 'yy-mm-dd',
numberOfMonths: 1, numberOfMonths: 1,
maxDate: "-0d" maxDate: "-0d"
}); });
@@ -119,7 +120,8 @@ function reportDatePicker() {
defaultDate: -10, defaultDate: -10,
changeMonth: true, changeMonth: true,
changeYear: true, changeYear: true,
dateFormat: 'dd-mm-yy', // dateFormat: 'dd-mm-yy',
dateFormat: 'yy-mm-dd',
numberOfMonths: 3, numberOfMonths: 3,
maxDate: "-0d", maxDate: "-0d",
onSelect: function (selectedDate, instance) { onSelect: function (selectedDate, instance) {
@@ -136,7 +138,8 @@ function dashboardDatePicker() {
defaultDate: -3, defaultDate: -3,
changeMonth: true, changeMonth: true,
changeYear: true, changeYear: true,
dateFormat: 'dd-mm-yy', // dateFormat: 'dd-mm-yy',
dateFormat: 'yy-mm-dd',
numberOfMonths: 3, numberOfMonths: 3,
maxDate: "-0d" maxDate: "-0d"
}); });

View File

@@ -1638,7 +1638,7 @@ function GUI(varname, idbody, skin) {
node.style.left = "50px"; node.style.left = "50px";
node.style.zIndex = 99; node.style.zIndex = 99;
node.style.visibility = "hidden"; node.style.visibility = "hidden";
node.src = "cursors/nodrop01.gif"; node.src = "/skins/icons/nodrop01.gif";
dragObj.objCursor = desk.appendChild(node); dragObj.objCursor = desk.appendChild(node);
desk.onmousemove = function (e) { desk.onmousemove = function (e) {