diff --git a/INSTALL.fr.md b/INSTALL.fr.md index f53c07dd14a862338067297d1cbb1668b1908e09..3245bc6cf583c4584bcecef509725ec6139183ff 100644 --- a/INSTALL.fr.md +++ b/INSTALL.fr.md @@ -10,9 +10,9 @@ apt-get install python-software-properties php5 php5-gd php5-imagick php5-xdebug ## Debian Wheezy-Jessie ``` -apt-get install php5 php5-gd php5-imagick php5-xdebug php-pear php5-mysql graphviz apache2 mysql-server libapache2-mod-php5 git php5-mcrypt php5-curl yaz -``` +apt-get install php5 php5-gd php5-imagick php5-xdebug php-pear php5-mysql graphviz apache2 mysql-server libapache2-mod-php5 git php5-mcrypt php5-curl yaz php5-xhprof +``` ## ArchLinux ``` yaourt -S php php-gd php-imagick xdebug php-pear apache mariadb php-apache php-xhprof graphviz git php-mcrypt binutils automake autoconf gcc make fakeroot @@ -28,11 +28,12 @@ Il est nécessaire de compiler Imagick extension à partir des sources. # Installer PHPUnit (en compte root / sudo): +Rechercher le numéro de la dernière version *phpunit-x.x.x.phar* sur [https://phar.phpunit.de](https://phar.phpunit.de) ``` cd /usr/local/bin - wget https://phar.phpunit.de/phpunit.phar - mv phpunit.phar phpunit + wget https://phar.phpunit.de/phpunit-x.x.x.phar + mv phpunit-x.x.x.phar phpunit ``` # Récupération des sources @@ -82,6 +83,8 @@ Dans /etc/php5/apache2/php.ini (ArchLinux: /etc/php/php.ini), configurer les var post_max_size = 10M upload_max_filesize = 10M error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED +extension = xhprof.so +xhprof.output_dir = /chemin/vers/bokeh/temp ``` Activez les extensions suivantes si elles ne le sont pas déjà (elles devraient l'être) : diff --git a/VERSIONS b/VERSIONS index 3c60dd37d2a567c9d935472dcf0d8610373ddf8d..cf8064def31c75c4307d037eaec0b03081ac6717 100644 --- a/VERSIONS +++ b/VERSIONS @@ -1,3 +1,18 @@ +13/11/2015 - v7.2.27 + + - ticket #31988 : Correction de la css des bandeaux d'alertes pour être compatible avec le mode responsive. + + - ticket #32233 : Correction des URL des vignettes qui sont envoyées dans les exports OAI + + - ticket #30006 : Agenda : correction du lien vers la bibliothèque qui n'affichait aucun résultat. + + - ticket #29373 : Module sitothèque : correction du groupement par catégorie + + - ticket #31424 : Correction de la sauvegarde du champ "Droits" dans l'édition d'un album de la bibliothèque numérique. + + - ticket #32189 : Amélioration du défilement des pages dans la modération des notices. + + 09/11/2015 - v7.3.26 - ticket #31316 : SIGB Nanook : Correction d'affichage du titre des périodiques dans les prêts en cours du compte lecteur diff --git a/VERSIONS_WIP/31761 b/VERSIONS_WIP/31761 new file mode 100644 index 0000000000000000000000000000000000000000..a57d065acd7be6b7ddbca4865a31c57257798fc7 --- /dev/null +++ b/VERSIONS_WIP/31761 @@ -0,0 +1 @@ + - ticket #31761 : CMS Workflow / notifications: seul les utilisateurs qui ont le droit de valider un article sont notifiés par mail de l'attente de validation \ No newline at end of file diff --git a/application/modules/admin/controllers/AlbumController.php b/application/modules/admin/controllers/AlbumController.php index 20c0e519ee7e1cfcf15968a4d43cdce14328329e..eaafb53adfbee21a3f95655c9ca75946988ddc04 100644 --- a/application/modules/admin/controllers/AlbumController.php +++ b/application/modules/admin/controllers/AlbumController.php @@ -541,14 +541,17 @@ class Admin_AlbumController extends ZendAfi_Controller_Action { return; $values = $form->getValues(); + unset($values['fichier']); unset($values['pdf']); unset($values['usage_constraints']); $droits_precision = $values['droits_precision']; unset($values['droits_precision']); - $values['droits'] = ($form->isPublicDomain()) ? - $droits_precision : $form->getPublicDomain(); + + $values['droits'] = $form->isPublicDomain() + ? $form->getPublicDomain() + : $droits_precision; $frbr_multi = $values['frbr_multi']; unset($values['frbr_multi']); diff --git a/application/modules/admin/controllers/CmsController.php b/application/modules/admin/controllers/CmsController.php index 6b08929418dee48a716211207d05318da235233d..f4bee15637ec260da98fb0ef795584b293a965ba 100644 --- a/application/modules/admin/controllers/CmsController.php +++ b/application/modules/admin/controllers/CmsController.php @@ -297,7 +297,7 @@ class Admin_CmsController extends ZendAfi_Controller_Action { $article->getStatus() == Class_Article::STATUS_VALIDATION_PENDING) || ($article->getStatus() > 5 && $article->old_status != $article->getStatus())) { - $this->_sendMailToAdmin($article); + $this->_sendMailToValidators($article); } } @@ -321,11 +321,16 @@ class Admin_CmsController extends ZendAfi_Controller_Action { protected function prepareBodyMail($article, $message) { - $message = str_replace('TITRE_ARTICLE', $article->getTitre(), $message); - $message = str_replace('URL_ARTICLE', - $this->view->absoluteUrl($article->getUrl(), null, true), - $message); - return $message; + return + str_replace(['TITRE_ARTICLE', 'URL_ARTICLE', 'AUTHOR_ARTICLE', 'SAVED_BY_ARTICLE'], + + [ + $article->getTitre(), + $this->view->absoluteUrl($article->getUrl(), null, true), + $article->getNomCompletAuteur(), + $this->identity->getNomComplet(), + ], + $message); } @@ -359,36 +364,29 @@ class Admin_CmsController extends ZendAfi_Controller_Action { } - protected function _sendMailToAdmin($article) { - $mail = new ZendAfi_Mail('utf8'); - $all_admins=Class_Users::findAllBy(['role_level' => ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL]); - $mails=[]; + protected function _getValidatorsMail($article) { + return array_unique( + Class_Permission::getWorkflow(Class_Article::STATUS_VALIDATED) + ->getUsersOnModel($article->getCategorie()) + ->collect('mail') + ->getArrayCopy()); + } - foreach ($all_admins as $admin) { - if (!$mail_admin=$admin->getMail()) - continue; - $mails[]=$mail_admin; - } - if(!$mail_address = implode(',',$mails)) + protected function _sendMailToValidators($article) { + if (!$mails = $this->_getValidatorsMail($article)) return; - $body = Class_AdminVar::getWorkflowTextMailArticlePending(); - $body = str_replace('TITRE_ARTICLE', - $article->getTitre(), - $body); - $body = str_replace('URL_ARTICLE', - $this->view->absoluteUrl($article->getUrl(), null, true), - $body); - + $mail = new ZendAfi_Mail('utf8'); $mail ->setFrom('no-reply@afi-sa.fr') - ->addTo($mail_address) - ->setSubject('[Bokeh] Validation d\'article en attente: '.$article->getTitre()) - ->setBodyText($body); + ->addTo(implode(',', $mails)) + ->setSubject($this->_('[Bokeh] Validation d\'article en attente: ') . $article->getTitre()) + ->setBodyText($this->prepareBodyMail($article, + Class_AdminVar::getWorkflowTextMailArticlePending())); if($this->_sendMail($mail)) - $this->_helper->notify('Mail de validation envoyé aux administrateurs.'); + $this->_helper->notify($this->_('Mail de validation envoyé aux validateurs.')); } diff --git a/application/modules/admin/controllers/ModoController.php b/application/modules/admin/controllers/ModoController.php index 8b7a8c8e0fc370ca24d9e3d98f687f46e8e16dd4..7e6867a2722b2dcb498f3146622e1788fa196e3a 100644 --- a/application/modules/admin/controllers/ModoController.php +++ b/application/modules/admin/controllers/ModoController.php @@ -30,7 +30,6 @@ class Admin_ModoController extends ZendAfi_Controller_Action { $this->subviewForStatus(0); $this->_request->setParam('back', 'avisnotice'); $this->_forward('index'); - } @@ -38,7 +37,9 @@ class Admin_ModoController extends ZendAfi_Controller_Action { if (!$review_id=$this->_request->getParam('id',0)) $this->_forward('index'); - $review=Class_AvisNotice::find($review_id); + if(!$review = Class_AvisNotice::find($review_id)) + return $this->_forward('index'); + $review->setFlags(Class_AvisNotice::ARCHIVED_FLAG)->save(); $this->_stayOnPage(); } @@ -52,8 +53,8 @@ class Admin_ModoController extends ZendAfi_Controller_Action { $this->_stayOnPage(); } - protected function subviewForStatus($status) { + protected function subviewForStatus($status) { $page = $this->_getParam('page',1); $nb_bib=Class_AvisNotice::countBiblioReviews($status); $nb_abo=Class_AvisNotice::countAboReviews($status); @@ -78,8 +79,8 @@ class Admin_ModoController extends ZendAfi_Controller_Action { 'nb_abo' => $nb_abo, 'nb_orphans' => $nb_orphans, 'nb_archived' => $nb_archived, - 'page' => $page -]); + 'active_tab' => $this->_getParam('active_tab', 0), + 'page' => $page]); } public function allreviewsAction() { diff --git a/application/modules/admin/views/scripts/modo/avisnotice.phtml b/application/modules/admin/views/scripts/modo/avisnotice.phtml index 31e27bb605d21c2f368cc9e019569db2063bc650..0706f160451fdc2c11d3a4276fa3755013600085 100644 --- a/application/modules/admin/views/scripts/modo/avisnotice.phtml +++ b/application/modules/admin/views/scripts/modo/avisnotice.phtml @@ -1,34 +1,50 @@ <?php - - -if ($this->display_all) { - echo '<h1>'.$this->traduire('Tous les avis de notices modérés').'</h1>'; - echo $this->tagAnchor(['action' => 'avisnotice'],"Afficher les avis non modérés"); -} -if (!$this->display_all) { - echo '<h1>'.$this->traduire('Modération des avis sur les notices').'</h1>'; - echo $this->tagAnchor(['action' => 'allreviews'],"Afficher tous les avis modérés"); -} -echo '<div id="avis-notice-liste" >'; - -echo $this->avisBloc('Avis de bibliothécaires ('.$this->nb_bib.')', $this->list_avis_bibliothecaires,$this->page,$this->nb_bib); - - -echo $this->avisBloc('Avis d\'abonnés ('. $this->nb_abo.')', $this->list_avis_utilisateurs,$this->page,$this->nb_abo); - -echo $this->avisBloc('Avis orphelins ('.$this->nb_orphans.')', $this->list_orphan_reviews,$this->page,$this->nb_orphans); - - -echo $this->avisBloc('Avis archivés ('.$this->nb_archived.')', $this->list_archived_reviews,$this->page,$this->nb_archived); - -echo '</div>'; - +if ($this->display_all) + echo $this->tag('h1', $this->_('Tous les avis de notices modérés')) . + $this->tagAnchor(['action' => 'avisnotice'], $this->_('Afficher les avis non modérés')); + +if (!$this->display_all) + echo $this->tag('h1', $this->_('Modération des avis sur les notices')) . + $this->tagAnchor(['action' => 'allreviews'], $this->_('Afficher tous les avis modérés')); + +echo $this->tag('div', + + $this->avisBloc($this->_('Avis de bibliothécaires (%s)', $this->nb_bib), + $this->list_avis_bibliothecaires, + $this->page, + $this->nb_bib, + 0) . + + $this->avisBloc($this->_('Avis d\'abonnés (%s)', $this->nb_abo), + $this->list_avis_utilisateurs, + $this->page, + $this->nb_abo, + 1) . + + $this->avisBloc($this->_('Avis orphelins (%s)', $this->nb_orphans), + $this->list_orphan_reviews, + $this->page, + $this->nb_orphans, + 2) . + + $this->avisBloc($this->_('Avis archivés (%s)', $this->nb_archived), + $this->list_archived_reviews, + $this->page, + $this->nb_archived, + 3), + + ['id' => 'avis-notice-liste']); ?> <script type='text/javascript'> - $(document).ready(function() { - $('.critique a:not(.actions a)').attr('target', '_blank'); - $('#avis-notice-liste').accordion({heightStyle:'content',collapsible:true,disabled:false}); -// $('#avis-notice-liste .ui-accordion-content').show(); - }); + $(document).ready(function() { + var activeTab = <?php echo $this->active_tab; ?>; + $('.critique a:not(.actions a)').attr('target', '_blank'); + $('#avis-notice-liste').accordion({ + heightStyle:'content', + collapsible:true, + active:activeTab, + disabled:false + }); + }); </script> diff --git a/application/modules/opac/controllers/OaiController.php b/application/modules/opac/controllers/OaiController.php index a33eef2b19f8154abcf07a88f7515f19d339470f..563fc6c2eeb1b10d641752d5db10947245d5a0c6 100644 --- a/application/modules/opac/controllers/OaiController.php +++ b/application/modules/opac/controllers/OaiController.php @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with BOKEH; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class OaiController extends Zend_Controller_Action { public function init() { @@ -35,23 +35,23 @@ class OaiController extends Zend_Controller_Action { public function requestAction() { $this->getResponse()->setHeader('Content-Type', 'text/xml;charset=utf-8'); $this->getHelper('ViewRenderer')->setNoRender(); - if (!Class_AdminVar::isOAIServerEnabled()) + if (!Class_AdminVar::isOAIServerEnabled()) return; - $verbsMapping = array('ListIdentifiers' => 'list-identifiers', - 'Identify' => 'identify', - 'ListMetadataFormats' => 'list-metadata-formats', - 'ListRecords' => 'list-records', - 'ListSets' => 'list-sets', - 'GetRecord' => 'get-record'); + $verbsMapping = ['ListIdentifiers' => 'list-identifiers', + 'Identify' => 'identify', + 'ListMetadataFormats' => 'list-metadata-formats', + 'ListRecords' => 'list-records', + 'ListSets' => 'list-sets', + 'GetRecord' => 'get-record']; if (array_key_exists($this->_getParam('verb'), $verbsMapping)) { - $this->_forward($verbsMapping[$this->_getParam('verb')], null, null, - $this->_request->getParams() + array('format' => 'xml')); + $this->_forward($verbsMapping[$this->_getParam('verb')], null, null, + $this->_request->getParams() + ['format' => 'xml']); return; } - $this->_forward('bad-verb', null, null, + $this->_forward('bad-verb', null, null, $this->_request->getParams() + array('format' => 'xml')); } @@ -64,7 +64,7 @@ class OaiController extends Zend_Controller_Action { public function listIdentifiersAction() { $this->getHelper('ViewRenderer')->setLayoutScript('empty.phtml'); - $request = new Class_WebService_OAI_Request_ListIdentifiers($this->_request->getParams(), + $request = new Class_WebService_OAI_Request_ListIdentifiers($this->_request->getParams(), $this->buildBaseUrl()); $builder = new Class_Xml_Builder(); $this->view->request = $request; @@ -88,7 +88,7 @@ class OaiController extends Zend_Controller_Action { public function listRecordsAction() { $this->getHelper('ViewRenderer')->setLayoutScript('empty.phtml'); - $request = new Class_WebService_OAI_Request_ListRecords($this->_request->getParams(), + $request = new Class_WebService_OAI_Request_ListRecords($this->_request->getParams(), $this->buildBaseUrl()); $builder = new Class_Xml_Builder(); $this->view->request = $request; @@ -113,7 +113,7 @@ class OaiController extends Zend_Controller_Action { public function identifyAction() { $this->getHelper('ViewRenderer')->setLayoutScript('empty.phtml'); $baseUrl = $this->buildBaseUrl(); - $request = new Class_WebService_OAI_Request_Identify($this->_request->getParams(), + $request = new Class_WebService_OAI_Request_Identify($this->_request->getParams(), $baseUrl); $this->view->request = $request; $this->view->builder = $builder = new Class_Xml_Builder(); @@ -121,7 +121,7 @@ class OaiController extends Zend_Controller_Action { $this->view->repositoryName = $_SERVER['SERVER_NAME'] . ' Oai repository'; $this->view->baseUrl = $baseUrl; - $this->view->earliestDatestamp = ($notice = Class_Notice::getLoader()->getEarliestNotice()) ? + $this->view->earliestDatestamp = ($notice = Class_Notice::getLoader()->getEarliestNotice()) ? substr($notice->getDateMaj(), 0, 10) : ''; $this->view->adminEmail = Class_CosmoVar::get('mail_admin'); } @@ -130,7 +130,7 @@ class OaiController extends Zend_Controller_Action { public function listMetadataFormatsAction() { $this->getHelper('ViewRenderer')->setLayoutScript('empty.phtml'); $baseUrl = $this->buildBaseUrl(); - $request = new Class_WebService_OAI_Request_ListMetadataFormats($this->_request->getParams(), + $request = new Class_WebService_OAI_Request_ListMetadataFormats($this->_request->getParams(), $baseUrl); $this->view->request = $request; $this->view->builder = $builder = new Class_Xml_Builder(); @@ -142,7 +142,7 @@ class OaiController extends Zend_Controller_Action { public function listSetsAction() { $this->getHelper('ViewRenderer')->setLayoutScript('empty.phtml'); $baseUrl = $this->buildBaseUrl(); - $request = new Class_WebService_OAI_Request_ListSets($this->_request->getParams(), + $request = new Class_WebService_OAI_Request_ListSets($this->_request->getParams(), $baseUrl); $this->view->request = $request; $builder = new Class_Xml_Builder(); @@ -163,7 +163,7 @@ class OaiController extends Zend_Controller_Action { public function getRecordAction() { $this->getHelper('ViewRenderer')->setLayoutScript('empty.phtml'); $baseUrl = $this->buildBaseUrl(); - $request = new Class_WebService_OAI_Request_GetRecord($this->_request->getParams(), + $request = new Class_WebService_OAI_Request_GetRecord($this->_request->getParams(), $baseUrl); $this->view->request = $request; $builder = new Class_Xml_Builder(); diff --git a/library/Class/AdminVar.php b/library/Class/AdminVar.php index 42d1210b6231a36eee4f22222d2ff6747b55fdc9..58c5cba8ef9b2a7d0081fa663b13e9793815b88b 100644 --- a/library/Class/AdminVar.php +++ b/library/Class/AdminVar.php @@ -193,9 +193,9 @@ class Class_AdminVarLoader extends Storm_Model_Loader { 'Les identifiants 1 à 5 sont réservés']), ['validate' => 'ZendAfi_Validate_WorkflowVar', 'after_save' => 'setWorkflowPermissions']), - 'WORKFLOW_TEXT_MAIL_ARTICLE_PENDING' => Class_AdminVar_Meta::newDefault($this->_('Contenu de l\'email de notification d\'article en attente de validation')), - 'WORKFLOW_TEXT_MAIL_ARTICLE_REFUSED' => Class_AdminVar_Meta::newDefault($this->_('Contenu de l\'email de notification de refus d\'un article à valider')), - 'WORKFLOW_TEXT_MAIL_ARTICLE_VALIDATED' => Class_AdminVar_Meta::newDefault($this->_('Contenu de l\'email de notification de validation d\'un article')), + 'WORKFLOW_TEXT_MAIL_ARTICLE_PENDING' => Class_AdminVar_Meta::newDefault($this->_('Contenu de l\'email de notification d\'article en attente de validation. Termes substitués: TITRE_ARTICLE, URL_ARTICLE, AUTHOR_ARTICLE, SAVED_BY_ARTICLE')), + 'WORKFLOW_TEXT_MAIL_ARTICLE_REFUSED' => Class_AdminVar_Meta::newDefault($this->_('Contenu de l\'email de notification de refus d\'un article à valider. Termes substitués: TITRE_ARTICLE, URL_ARTICLE, AUTHOR_ARTICLE, SAVED_BY_ARTICLE')), + 'WORKFLOW_TEXT_MAIL_ARTICLE_VALIDATED' => Class_AdminVar_Meta::newDefault($this->_('Contenu de l\'email de notification de validation d\'un article. Termes substitués: TITRE_ARTICLE, URL_ARTICLE, AUTHOR_ARTICLE, SAVED_BY_ARTICLE')), ], 'album' => ['ALBUMS_LIST_MODE' => Class_AdminVar_Meta::newOnOff($this->_('Le gestionnaire de contenu affiche les albums sous forme de liste paginée au lieu de d\'une arborescence. Cet affichage est adapté lorsque le nombre d\'albums devient trop important')), diff --git a/library/Class/Article.php b/library/Class/Article.php index 9ff6d9fb6cdf5d477d857950e0b6d60bd9c91052..12b30b0b88ad3c1c715e0ec4c22bb8d0bb9e903a 100644 --- a/library/Class/Article.php +++ b/library/Class/Article.php @@ -343,7 +343,6 @@ class ArticleLoader extends Storm_Model_Loader { $this->_display_mode = $preferences['display_mode']; $this->_custom_fields = $preferences['custom_fields']; - $select = $this ->_selectArticles() ->_publishedNow() diff --git a/library/Class/Notice.php b/library/Class/Notice.php index c82a399d48724e437d6a3fac61d742fec5f6a845..811723a36738e83bbd986f337f4915b67ea98c85 100644 --- a/library/Class/Notice.php +++ b/library/Class/Notice.php @@ -1536,8 +1536,8 @@ class Class_Notice extends Storm_Model_Abstract { $visitor->visitTypeDoc($this->getTypeDoc()); $visitor->visitNatureDoc($this->getNatureDocs()); if ($this->hasVignette()) { - $visitor->visitVignette($this->fetchUrlVignette()); - $visitor->visitImage($this->fetchUrlImage()); + $visitor->visitVignette(Class_Url::absolute($this->fetchUrlVignette())); + $visitor->visitImage(Class_Url::absolute($this->fetchUrlImage())); } $visitor->visitIsbn($this->getIsbn()); $visitor->visitEan($this->getEan()); diff --git a/library/Class/Permission.php b/library/Class/Permission.php index 000d23d912b58b68116578fb06e309c4de84f292..c4c31ea40a7ab908635093353be5c5350b879ef9 100644 --- a/library/Class/Permission.php +++ b/library/Class/Permission.php @@ -69,6 +69,12 @@ class PermissionLoader extends Storm_Model_Loader { } + public function validateArticle() { + return Class_Permission::findFirstBy(['module' => static::MODULE_ARTICLE, + 'code' => 'VALIDATED']); + } + + public function createArticleCategory() { return Class_Permission::findFirstBy(['module' => static::MODULE_ARTICLE, 'code' => 'CATEGORY']); @@ -89,6 +95,8 @@ class PermissionLoader extends Storm_Model_Loader { } + + class Class_Permission extends Storm_Model_Abstract { protected $_table_name = 'permission'; protected $_loader_class = 'PermissionLoader'; @@ -96,7 +104,11 @@ class Class_Permission extends Storm_Model_Abstract { protected $_has_many = ['group_permissions' => ['model' => 'Class_UserGroup_Permission', 'role' => 'permission', - 'dependents' => 'delete']]; + 'dependents' => 'delete'], + + 'groups' => ['through' => 'group_permissions'], + + 'users' => ['through' => 'groups']]; public function permitTo($group, $model) { @@ -107,4 +119,19 @@ class Class_Permission extends Storm_Model_Abstract { public function denyTo($group, $model) { Class_UserGroup_Permission::deny($this, $group, $model); } + + + public function getUsersOnModel($model) { + $groups = array_filter($this->getGroups(), + function ($group) use ($model) + { + return $group->hasPermissionOn($this, $model); + }); + $users = new Storm_Model_Collection(); + + foreach($groups as $group) + $users->addAll($group->getUsers()); + + return $users; + } } \ No newline at end of file diff --git a/library/ZendAfi/Controller/Action/Helper/ArticleListViewMode.php b/library/ZendAfi/Controller/Action/Helper/ArticleListViewMode.php index 4324c4d0a5d66c9a5f28060b408df994c88dbe1b..50e058377f7bcd36141871ef34deb9c9da06febd 100644 --- a/library/ZendAfi/Controller/Action/Helper/ArticleListViewMode.php +++ b/library/ZendAfi/Controller/Action/Helper/ArticleListViewMode.php @@ -132,8 +132,9 @@ class ZendAfi_Controller_Action_Helper_ArticleListViewMode extends ZendAfi_Contr return $this->_filtred_categories_ids; $categories = $this->getFilteredCategories($this->getRecursiveCategoriesForUser()); - $this->_filtred_categories_ids = array_map(function($model) { return $model->getId(); }, - $categories); + $this->_filtred_categories_ids = array_values( + array_map(function($model) { return $model->getId(); }, + $categories)); return $this->_filtred_categories_ids; } diff --git a/library/ZendAfi/Form/Album.php b/library/ZendAfi/Form/Album.php index 58152c1c955d73d1651edc11d71b5920e179dd10..ef8cc3776c74d78fe2e2f110452c13c6d9618e2c 100644 --- a/library/ZendAfi/Form/Album.php +++ b/library/ZendAfi/Form/Album.php @@ -290,9 +290,13 @@ class ZendAfi_Form_Album extends ZendAfi_Form { * @return ZendAfi_Form_Album */ public function addRightsFor($album) { - $current = (self::RIGHT_PUBLIC_DOMAIN == $album->getDroits() || $album->isNew()) ? 1: 2; - $current_precision = (self::RIGHT_PUBLIC_DOMAIN != $album->getDroits()) ? - $album->getDroits(): ''; + $current = (self::RIGHT_PUBLIC_DOMAIN == $album->getDroits() || $album->isNew()) + ? self::RIGHT_PUBLIC_DOMAIN_KEY + : self::RIGHT_OTHER_KEY; + + $current_precision = (self::RIGHT_PUBLIC_DOMAIN != $album->getDroits()) + ? $album->getDroits() + : ''; return $this ->addElement('radio', 'droits', @@ -300,12 +304,13 @@ class ZendAfi_Form_Album extends ZendAfi_Form { 'value' => $current, 'separator' => '', 'multiOptions' => [self::RIGHT_PUBLIC_DOMAIN_KEY => self::RIGHT_PUBLIC_DOMAIN, - self::RIGHT_OTHER_KEY => 'Autre, Précisez']]) + self::RIGHT_OTHER_KEY => $this->_('Autre, Précisez')]]) ->addElement('text', 'droits_precision', ['label' => '', 'value' => $current_precision, 'style' => 'width:440px;']) + ->addElement('usageConstraints', 'usage_constraints', ['label' => 'Utilisations', 'value' => $album->getUsageConstraints()]); } diff --git a/library/ZendAfi/View/Helper/Article/RenderSummary.php b/library/ZendAfi/View/Helper/Article/RenderSummary.php index 91775c9dfef2e4be62e0b1439cb5e1a7fa14d08f..e041424a97dda33f41e1378cf2cf5c80e0fa3fa6 100644 --- a/library/ZendAfi/View/Helper/Article/RenderSummary.php +++ b/library/ZendAfi/View/Helper/Article/RenderSummary.php @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class ZendAfi_View_Helper_Article_RenderSummary extends ZendAfi_View_Helper_Article_RenderAbstract { + public function article_RenderSummary($article) { return $this->renderArticle($article, 'article_full'); } diff --git a/library/ZendAfi/View/Helper/Article/RenderTitleOnlyCalendar.php b/library/ZendAfi/View/Helper/Article/RenderTitleOnlyCalendar.php index 2e96497a36a73bea532b1adb784a8c008087d98b..4f9339f16174f9fcb4eca17c825194b75625e152 100644 --- a/library/ZendAfi/View/Helper/Article/RenderTitleOnlyCalendar.php +++ b/library/ZendAfi/View/Helper/Article/RenderTitleOnlyCalendar.php @@ -19,18 +19,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class ZendAfi_View_Helper_Article_RenderTitleOnlyCalendar extends ZendAfi_View_Helper_Article_RenderAbstract{ - public function article_RenderTitleOnlyCalendar($article) { - return $this->renderContent($article); + public function article_RenderTitleOnlyCalendar($article, $id_module = null) { + return $this->renderContent($article, $id_module); } - public function renderContent($article) { + public function renderContent($article, $id_module = null) { return '<li>'. $this->view->tagEditArticle($article). $this->renderDraftStatus($article). $this->renderCalendarEventTitle($article). $this->renderCalendarEventDate($article). - $this->renderCalendarEventInfo($article). + $this->renderCalendarEventInfo($article, $id_module). '</li>'; } @@ -39,7 +39,7 @@ class ZendAfi_View_Helper_Article_RenderTitleOnlyCalendar extends ZendAfi_View_H } - public function renderCalendarEventInfo($article) { + public function renderCalendarEventInfo($article, $id_module = null) { return ''; } diff --git a/library/ZendAfi/View/Helper/Article/RenderTitleOnlyCalendarWithBib.php b/library/ZendAfi/View/Helper/Article/RenderTitleOnlyCalendarWithBib.php index 82759109a17aaf835a0d1923a252440333fe1c79..68b5ba8ffa7fadd43bbf7bf62d4e509ec3e6018d 100644 --- a/library/ZendAfi/View/Helper/Article/RenderTitleOnlyCalendarWithBib.php +++ b/library/ZendAfi/View/Helper/Article/RenderTitleOnlyCalendarWithBib.php @@ -16,19 +16,20 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with BOKEH; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class ZendAfi_View_Helper_Article_RenderTitleOnlyCalendarWithBib extends ZendAfi_View_Helper_Article_RenderTitleOnlyCalendar { - - public function article_RenderTitleOnlyCalendarWithBib($article) { - return $this->article_RenderTitleOnlyCalendar($article); + + public function article_RenderTitleOnlyCalendarWithBib($article, $id_module = null) { + return $this->article_RenderTitleOnlyCalendar($article, $id_module); } - - - public function renderCalendarEventInfo($article) { - return + + + public function renderCalendarEventInfo($article, $id_module = null) { + return $this->view->tagAnchor($this->view->url(['controller' => 'cms', 'action' => 'articleviewbydate', + 'id_module' => $id_module, 'b' => $article->getBibId()],null,true), $article->getBibLibelle(), ['target' => '_parent', diff --git a/library/ZendAfi/View/Helper/Article/RenderTitleOnlyCalendarWithCatalogue.php b/library/ZendAfi/View/Helper/Article/RenderTitleOnlyCalendarWithCatalogue.php index 9d5f11f215fbb2369897d5ca687fa4bb3f2d3cd4..cfd71ac7963a48955aa9b2b19cdc3b128c8e710c 100644 --- a/library/ZendAfi/View/Helper/Article/RenderTitleOnlyCalendarWithCatalogue.php +++ b/library/ZendAfi/View/Helper/Article/RenderTitleOnlyCalendarWithCatalogue.php @@ -16,17 +16,17 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with BOKEH; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class ZendAfi_View_Helper_Article_RenderTitleOnlyCalendarWithCatalogue extends ZendAfi_View_Helper_Article_RenderTitleOnlyCalendar { - + public function article_RenderTitleOnlyCalendarWithCatalogue($article) { return $this->article_RenderTitleOnlyCalendar($article); } - - - public function renderCalendarEventInfo($article) { - return + + + public function renderCalendarEventInfo($article, $id_module = null) { + return $this->view->tagAnchor($this->view->url(['controller' => 'cms', 'action' => 'articleviewbydate', 'cat' => $article->getIdCat()],null,true), diff --git a/library/ZendAfi/View/Helper/AvisBloc.php b/library/ZendAfi/View/Helper/AvisBloc.php index db6fa4fb26ec24fb0cd39f614ec2de720ab97a97..33a394501fa498b3ab8fc6f0c9bb609d3fa794c5 100644 --- a/library/ZendAfi/View/Helper/AvisBloc.php +++ b/library/ZendAfi/View/Helper/AvisBloc.php @@ -20,33 +20,51 @@ */ class ZendAfi_View_Helper_AvisBloc extends Zend_View_Helper_HtmlElement { + protected $_label, $_list, $_page, $_nb_items, $_index; - public function avisBloc($libelle_bloc, $avis_list,$page=0,$nb_elements=0) { - $libelle_bloc = $this->view->_($libelle_bloc); - return $this->renderHtmlAvisBloc($libelle_bloc, $avis_list,$page,$nb_elements); - } + public function avisBloc($label, $list, $page = 0, $nb_items = 0, $index = 0) { + $this->_label = $label; + $this->_list = $list; + $this->_page = $page; + $this->_nb_items = $nb_items; + $this->_index = $index; - public function renderHtmlAvisBloc($libelle, $list,$page=0 ,$nb_elements=0) { - $html = '<h2>'.$libelle.'</h2>'; - $html.= '<div>'; + return $this->renderHtmlAvisBloc(); + } - if(!count($list)) { - $empty = $this->view->_('Aucun avis ' . ($libelle ? $libelle . ' ' : '') . 'à modérer.'); - $html.='<p align="center" class="error">'.$empty.'</p>'; - } else { - $html.= $this->view->partialCycle('modo/_avis_partial.phtml', - 'avis', - $list, - ['first', - 'second']); - if ($page>0) - $html.= $this->view->Pager($nb_elements,10,$page,$this->view->url(['page' => null],null,false)); - } + protected function renderHtmlAvisBloc() { + return $this->view->tag('h2', $this->_label) + . $this->view->tag('div', $this->renderBlock()); + } - return $html.='</div>'; - } + protected function renderBlock() { + if(!count($this->_list)) + return $this->view->tag('p', + $this->view->_('Aucun avis %s à modérer.', ($this->_label ? $this->_label : '')), + ['class' => 'error']); + return $this->injectPager($this->view->partialCycle('modo/_avis_partial.phtml', + 'avis', + $this->_list, + ['first', 'second'])); + } + + + protected function injectPager($html) { + if (!0 < $this->_page) + return $html; + + $pager = $this->view->Pager($this->_nb_items, + 10, + $this->_page, + $this->view->url(['page' => null, 'active_tab' => $this->_index], + null, false)); + return $this->view->tag('span', $this->view->_('10 résultats par page'), ['style' => 'display: bloc; text-align: right;']) + . $pager + . $html + . $pager; + } } diff --git a/library/ZendAfi/View/Helper/CalendarContent.php b/library/ZendAfi/View/Helper/CalendarContent.php index 52579d1f97896dfa2dcdf830db36ed73a78f58b4..eba84b22959d0cbf7249a67e32786812ff436a0d 100644 --- a/library/ZendAfi/View/Helper/CalendarContent.php +++ b/library/ZendAfi/View/Helper/CalendarContent.php @@ -108,7 +108,6 @@ class ZendAfi_View_Helper_CalendarContent extends Zend_View_Helper_HtmlElement { } - protected function renderArticlesModeWall($articles) { $html =''; @@ -118,6 +117,7 @@ class ZendAfi_View_Helper_CalendarContent extends Zend_View_Helper_HtmlElement { return $this->view->tag('div', $html, [ 'class' => 'liste_mur']); } + protected function rendArticlesByArticleList($articles) { $html =''; @@ -140,7 +140,7 @@ class ZendAfi_View_Helper_CalendarContent extends Zend_View_Helper_HtmlElement { protected function renderTitleOnlyWithInfo($article) { return $this->param['EVENT_INFO']=='bib' - ? $this->view->article_RenderTitleOnlyCalendarWithBib($article) + ? $this->view->article_RenderTitleOnlyCalendarWithBib($article, $this->param['ID_MODULE']) : ($this->param['EVENT_INFO'] == 'cat' ? $this->view->article_RenderTitleOnlyCalendarWithCatalogue($article) : $this->view->article_RenderTitleOnlyCalendar($article)); diff --git a/library/ZendAfi/View/Helper/Pager.php b/library/ZendAfi/View/Helper/Pager.php index a91664051031aa909fa28ae86d8c8fef628d132f..f99a3385c4f3cd1f93d79ee0e4d31ba8fa079c53 100644 --- a/library/ZendAfi/View/Helper/Pager.php +++ b/library/ZendAfi/View/Helper/Pager.php @@ -48,9 +48,7 @@ class ZendAfi_View_Helper_Pager extends ZendAfi_View_Helper_BaseHelper { $deb = max(1, $page-5); $fin = min($nb_pages, $deb + 9); for($i=$deb; $i <= $fin; $i++) - $html .= $this->_renderLink(($i == $page ? '#' : $url), - $i, - $i); + $html .= $this->_renderLink(($i == $page ? '#' : $url), $i, $i); return $html; } diff --git a/library/startup.php b/library/startup.php index 271ef078424604d6a5d070f551b28ee235a7a3b2..6868f7d6bf18c2457378ccbd9db9b6a2e5a3e0e3 100644 --- a/library/startup.php +++ b/library/startup.php @@ -64,7 +64,8 @@ function defineConstant($name, $value) { function setupConstants() { defineConstant('BOKEH_MAJOR_VERSION','7.3'); - defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.26'); + + defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.27'); defineConstant('BOKEH_REMOTE_FILES', 'http://git.afi-sa.fr/afi/opacce/'); diff --git a/public/admin/css/global.css b/public/admin/css/global.css index 2b1c243e8b064a5e0c35705f279ac95e37a6947c..6c8c328d7f28e989466cb1d40ba053734cb816ea 100644 --- a/public/admin/css/global.css +++ b/public/admin/css/global.css @@ -1284,7 +1284,6 @@ div#reader { text-transform: uppercase; } - .drag_and_drop_widget li { cursor: move; line-height: 1.3em; @@ -1302,3 +1301,20 @@ div#reader { .drag_and_drop_widget li:hover { background: #eee; } + +.pager { + text-align: center; + margin-top: 5px; +} + +.pager span { + padding-left:5px; + padding-right:5px; + font-weight: bold; +} + +.pager .current a { + font-size:1.5em; + font-weight: bold; + color:#808080; +} diff --git a/public/admin/js/notification/css/jquery_notification.css b/public/admin/js/notification/css/jquery_notification.css index affcbb8bd54d2d4dc1f9d0bffe6cef00a1faa5e4..40599b7358ab9a83d04912056c93f40354ae97a4 100755 --- a/public/admin/js/notification/css/jquery_notification.css +++ b/public/admin/js/notification/css/jquery_notification.css @@ -4,7 +4,7 @@ body{ #info_message{ display: none; width: 100%; - height: 51px; + height: auto; position: absolute; top: 0; position: fixed; @@ -14,12 +14,13 @@ body{ } .center_auto{ margin: 0 auto; - width: 950px; - padding: 15px 25px; + width: 100%; + padding: 15px 2%; + text-align: center; } #info_message .message_area{ float: left; - width: 98%; + width: 90%; } #info_message .message_area span.link_ribbon{ color: #999999; @@ -45,7 +46,6 @@ body{ cursor: pointer; } .error_bg .info_more_descrption{ - -moz-box-shadow: 0 0 5px #b2495b; -webkit-box-shadow: 0 0 5px #b2495b; box-shadow: 0 0 5px #b2495b; @@ -63,8 +63,16 @@ body{ cursor: pointer; } .info_bg{ - background: url('../images/info_bg.png') 0 0 repeat-x; -} +/* gradient done with : http://colorzilla.com/gradient-editor/ */ +background: #e8fdfe; /* Old browsers */ +background: -moz-linear-gradient(top, #e8fdfe 0%, #cbf5f9 98%, #8bccd2 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#e8fdfe), color-stop(98%,#cbf5f9), color-stop(100%,#8bccd2)); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, #e8fdfe 0%,#cbf5f9 98%,#8bccd2 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, #e8fdfe 0%,#cbf5f9 98%,#8bccd2 100%); /* Opera 11.10+ */ +background: -ms-linear-gradient(top, #e8fdfe 0%,#cbf5f9 98%,#8bccd2 100%); /* IE10+ */ +background: linear-gradient(to bottom, #e8fdfe 0%,#cbf5f9 98%,#8bccd2 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e8fdfe', endColorstr='#8bccd2',GradientType=0 ); /* IE6-9 */ + } .info_bg .message_area{ font:bold 14px arial; color: #0d9a95; diff --git a/tests/application/modules/admin/controllers/AdminAvisModerationControllerTest.php b/tests/application/modules/admin/controllers/AdminAvisModerationControllerTest.php index 0c761711256fa6767758be78deaf5376e4fc3ec1..25a0cf157d6fdc1f3241a4c7c285e1f600f43711 100644 --- a/tests/application/modules/admin/controllers/AdminAvisModerationControllerTest.php +++ b/tests/application/modules/admin/controllers/AdminAvisModerationControllerTest.php @@ -331,7 +331,7 @@ class AdminAvisModerationControllerCmsWithNoAvisTest extends Admin_AbstractContr /** @test */ public function h4ShouldContainAucunAvisAModerer() { - $this->assertXPathContentContains('//p[@class="error"]', "Aucun avis à modérer"); + $this->assertXPathContentContains('//p[@class="error"]', "Aucun avis à modérer"); } } diff --git a/tests/application/modules/admin/controllers/AlbumControllerTest.php b/tests/application/modules/admin/controllers/AlbumControllerTest.php index f83269f2b6562a2fd2399ca61bc2189e340ffb61..ab1a401e08059b93f25d45c1dd9d3ca7bffb7306 100644 --- a/tests/application/modules/admin/controllers/AlbumControllerTest.php +++ b/tests/application/modules/admin/controllers/AlbumControllerTest.php @@ -1693,6 +1693,8 @@ class Admin_AlbumControllerPostEditAlbumMesBDTest extends Admin_AlbumControllerT 'dewey' => '15', 'genre' => '12', 'cote' => 'MS003', + 'droits' => '2', + 'droits_precision' => 'GNU AFERO', 'provenance' => 'Annecy', 'bibliotheques' => '1;23;7']); @@ -1788,6 +1790,12 @@ class Admin_AlbumControllerPostEditAlbumMesBDTest extends Admin_AlbumControllerT public function cacheShouldBeCleared() { $this->assertTrue($this->cache_mock->methodHasBeenCalled('clean')); } + + + /** @test */ + public function rightsShouldBeGNUAFERO() { + $this->assertEquals('GNU AFERO', $this->bd->getDroits()); + } } diff --git a/tests/application/modules/admin/controllers/CmsControllerTest.php b/tests/application/modules/admin/controllers/CmsControllerTest.php index 588f5824cd45f06192c2a4c7fd4c00e35d5a0a62..a6028e76b5d82efedd6f560fb46bdf90e0ab44e3 100644 --- a/tests/application/modules/admin/controllers/CmsControllerTest.php +++ b/tests/application/modules/admin/controllers/CmsControllerTest.php @@ -22,10 +22,19 @@ require_once 'AdminAbstractControllerTestCase.php'; abstract class CmsControllerTestCase extends Admin_AbstractControllerTestCase { - /** @var Class_Article */ - protected $concert; - protected $lieu_bonlieu, $lieu_arcadium; - protected $_admin_bib, $_laurent,$_bernard; + protected + $concert, /** @var Class_Article */ + $lieu_bonlieu, + $lieu_arcadium, + $_admin_bib, + $_laurent, + $_bernard, + $_group_testing, + $_group_admin, + $_cat_a_la_une, + $_cat_atelier; + + public function setUp() { parent::setUp(); $_SERVER['SCRIPT_NAME'] = ''; @@ -33,31 +42,39 @@ abstract class CmsControllerTestCase extends Admin_AbstractControllerTestCase { Storm_Model_Loader::defaultToVolatile(); $this->setupBib(); - $this->fixture('Class_UserGroup', ['id' => 22, - 'libelle' => 'Testing group']); + $this->_group_testing = $this->fixture('Class_UserGroup', ['id' => 22, + 'libelle' => 'Testing group']); + + + $this->_group_admin = $this->fixture('Class_UserGroup', ['id' => 24, + 'libelle' => 'Admin group']); $this->_laurent = $this->fixture('Class_Users', ['id'=>20, 'login' => 'laurent', 'mail' => 'laurent@afi-sa.fr', 'bib' => $this->annecy, 'password' => 'toto', - 'role_level' => ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL]); + 'role_level' => ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL, + 'user_groups' => [$this->_group_admin]]); $this->_admin_bib = $this->fixture('Class_Users',['id' => 10, 'login' => 'AdminBibConnected', + 'nom' => 'Super', + 'prenom' => 'Mario', 'bib' => $this->annecy, 'role' => 'admin_bib', 'mail' => 'admin@afi-sa.fr', 'password' => 'toto', 'role_level' => ZendAfi_Acl_AdminControllerRoles::ADMIN_BIB, - 'user_groups' => [Class_UserGroup::find(22)]]); + 'user_groups' => [$this->_group_testing]]); $this->_bernard = $this->fixture('Class_Users',['id' =>30, 'login' => 'bernie', 'bib' => $this->annecy, 'mail' => 'bernard@afi-sa.fr', 'password' => 'bernie', - 'role_level' => ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL]); + 'role_level' => ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL, + 'user_groups' => [$this->_group_admin]]); ZendAfi_Auth::getInstance()->logUser($this->_admin_bib); @@ -141,7 +158,12 @@ abstract class CmsControllerTestCase extends Admin_AbstractControllerTestCase { $this->root_category = $this->fixture('Class_ArticleCategorie', ['id' => 1, 'libelle' => 'Root']); - $cat_a_la_une = $this->fixture('Class_ArticleCategorie', + $this->_cat_atelier = $this->fixture('Class_ArticleCategorie', + ['id' => 33, + 'libelle' => 'Atelier', + 'parent_categorie' => $this->root_category]); + + $this->_cat_a_la_une = $this->fixture('Class_ArticleCategorie', ['id' => 23, 'libelle' => 'A la Une', 'parent_categorie' => $this->root_category]); @@ -149,9 +171,9 @@ abstract class CmsControllerTestCase extends Admin_AbstractControllerTestCase { $this->cat_evenements = $this->fixture('Class_ArticleCategorie', ['id' => 34, 'libelle' => 'Evènements', - 'parent_categorie' => $cat_a_la_une, + 'parent_categorie' => $this->_cat_a_la_une, 'sous_categories' => []]); - $cat_a_la_une->setSousCategories([$this->cat_evenements]); + $this->_cat_a_la_une->setSousCategories([$this->cat_evenements]); $this->annecy ->setArticleCategories([$this->root_category]) @@ -246,10 +268,13 @@ abstract class CmsControllerWithPermissionTestCase extends CmsControllerTestCase public function setUp() { parent::setUp(); - $group = Class_UserGroup::find(22); - $category = Class_ArticleCategorie::find(23); - Class_Permission::createArticle()->permitTo($group, $category); - Class_Permission::createArticleCategory()->permitTo($group, $category); + Class_Permission::createArticle()->permitTo($this->_group_testing, $this->_cat_a_la_une); + Class_Permission::createArticleCategory()->permitTo($this->_group_testing, $this->_cat_a_la_une); + + Class_Permission::validateArticle()->permitTo($this->_group_admin, + $this->_cat_a_la_une); + + } } @@ -1415,7 +1440,7 @@ class CmsControllerNewsAddActionWithoutWorkflowTest extends CmsControllerWithPer /** @test */ public function auteurShouldBeDisplayByDefault() { - $this->assertXPathContentContains('//td','AdminBibConnected'); + $this->assertXPathContentContains('//td','Mario Super',$this->_response->getBody()); } } @@ -1482,10 +1507,10 @@ abstract class CmsControllerWorkflowTestCase extends CmsControllerWithPermission $this->fixture('Class_AdminVar', ['id' => 'WORKFLOW', 'valeur' => '1']); $this->fixture('Class_AdminVar', ['id' => 'WORKFLOW_TEXT_MAIL_ARTICLE_VALIDATED', - 'valeur' => 'L\'article TITRE_ARTICLE a été validé. URL_ARTICLE']); + 'valeur' => 'L\'article TITRE_ARTICLE a été validé par SAVED_BY_ARTICLE. URL_ARTICLE']); $this->fixture('Class_AdminVar', ['id' => 'WORKFLOW_TEXT_MAIL_ARTICLE_PENDING', - 'valeur' => 'Un nouvel article est à valider. TITRE_ARTICLE URL_ARTICLE']); + 'valeur' => 'Un nouvel article de AUTHOR_ARTICLE est à valider. TITRE_ARTICLE URL_ARTICLE']); $this->fixture('Class_AdminVar', ['id' => 'WORKFLOW_TEXT_MAIL_ARTICLE_REFUSED', 'valeur' => 'L\'article a été refusé.']); @@ -1591,6 +1616,7 @@ class CmsControllerNewsAddActionPostWithWorkflowTest ['id' => 1, 'login' => 'l', 'password' => 'l', + 'nom' => 'Batman', 'mail' => 'l@afi-sa.fr']);; $this->fixture('Class_Article', ['id' => 18, @@ -1647,7 +1673,7 @@ class CmsControllerNewsAddActionPostWithWorkflowTest /** @test */ public function sentMailToAuthorWhenNewsIsValidatedShouldContainsDefaultBody() { $this->postArticleValidated(); - $this->assertEquals('L\'article Katsuhiro Otomo en dédicace ! a été validé. http://localhost'.BASE_URL.'/cms/articleview/id/18',quoted_printable_decode($this->mock_transport->getSentMails()[0]->getBodyText()->getContent())); + $this->assertEquals('L\'article Katsuhiro Otomo en dédicace ! a été validé par Mario Super. http://localhost'.BASE_URL.'/cms/articleview/id/18',quoted_printable_decode($this->mock_transport->getSentMails()[0]->getBodyText()->getContent())); } @@ -1673,12 +1699,45 @@ class CmsControllerNewsAddActionPostWithWorkflowTest public function newArticleSavedWithStatusAValiderShouldSendMail() { $data = $this->_basePostDatas; $data['status'] = Class_Article::STATUS_VALIDATION_PENDING; + $this->postDispatch('/admin/cms/add/id_cat/23', $data); $this->assertEquals(['laurent@afi-sa.fr', 'bernard@afi-sa.fr'],$this->mock_transport->getSentMails()[0]->getRecipients()); } + /** @test */ + public function newArticleSavedWithStatusAValiderShouldSendDeduplicatedMails() { + $data = $this->_basePostDatas; + $data['status'] = Class_Article::STATUS_VALIDATION_PENDING; + + $this->_group_testing->addUser($this->_laurent)->save(); + Class_Permission::validateArticle()->permitTo($this->_group_testing, + $this->_cat_a_la_une); + $this->postDispatch('/admin/cms/add/id_cat/23', + $data); + $this->assertEquals(['<laurent@afi-sa.fr>', '<bernard@afi-sa.fr>', '<admin@afi-sa.fr>', 'append' => true], + $this->mock_transport->getSentMails()[0]->getHeaders()['To']); + } + + + + /** @test */ + public function withoutValidationRightsNewArticleSavedWithStatusAValiderShouldNotSendMail() { + $data = $this->_basePostDatas; + $data['status'] = Class_Article::STATUS_VALIDATION_PENDING; + + Class_Permission::validateArticle()->denyTo($this->_group_admin, + $this->_cat_a_la_une); + + Class_Permission::validateArticle()->permitTo($this->_group_admin, + $this->_cat_atelier); + $this->postDispatch('/admin/cms/add/id_cat/23', + $data); + $this->assertEmpty($this->mock_transport->getSentMails()); + } + + /** @test */ public function statusBrouillonUpdatedToAValiderShouldSendMail() { Class_Article::find(18)->setStatus(Class_Article::STATUS_DRAFT)->save(); @@ -1711,7 +1770,7 @@ class CmsControllerNewsAddActionPostWithWorkflowTest /** @test */ public function sentMailToAdminWhenValidationPendingShouldContainsDefaultText() { $this->postArticleAValider(); - $this->assertEquals('Un nouvel article est à valider. Katsuhiro Otomo en dédicace ! http://localhost'.BASE_URL.'/cms/articleview/id/18',quoted_printable_decode($this->mock_transport->getSentMails()[0]->getBodyText()->getContent())); + $this->assertEquals('Un nouvel article de Batman est à valider. Katsuhiro Otomo en dédicace ! http://localhost'.BASE_URL.'/cms/articleview/id/18',quoted_printable_decode($this->mock_transport->getSentMails()[0]->getBodyText()->getContent())); } diff --git a/tests/application/modules/admin/controllers/ModoControllerTest.php b/tests/application/modules/admin/controllers/ModoControllerTest.php index 9ec78abf35d6de487a2cc02b69642d406c575d9f..6c069498d451cea1d0fa3afdbf80e2a2e2eca29d 100644 --- a/tests/application/modules/admin/controllers/ModoControllerTest.php +++ b/tests/application/modules/admin/controllers/ModoControllerTest.php @@ -21,7 +21,7 @@ require_once realpath(dirname(__FILE__)) . '/AdminAbstractControllerTestCase.php'; -class ModoControllerIndexActionTest extends Admin_AbstractControllerTestCase { +abstract class ModoControllerIndexActionTestCase extends Admin_AbstractControllerTestCase { protected $_storm_default_to_volatile = true; public function setUp() { @@ -58,9 +58,6 @@ class ModoControllerIndexActionTest extends Admin_AbstractControllerTestCase { 'avis' => 'Ce livre est vraiment bien !', 'statut' => 0]); - $this->fixture('Class_Notice', ['id' => 1032, - 'titre_principal' => 'B comme bière : la bière expliquée aux (grands) enfants']); - $this->fixture('Class_AvisNotice', ['id' => 223, 'id_notice' => 1002, 'entete' => 'Bulles', @@ -71,26 +68,51 @@ class ModoControllerIndexActionTest extends Admin_AbstractControllerTestCase { 'id_notice' => 1032, 'statut' => 1]); + $this->fixture('Class_Notice', ['id' => 1032, + 'titre_principal' => 'B comme bière : la bière expliquée aux (grands) enfants']); $this->fixture('Class_SuggestionAchat', ['id' => 92, - 'titre' => 'Kikolol', - 'auteur' => 'Moi', - 'isbn' => '', - 'description_url' => 'http://livre.com/1', - 'type_doc_id' => 1]); + 'titre' => 'Kikolol', + 'auteur' => 'Moi', + 'isbn' => '', + 'description_url' => 'http://livre.com/1', + 'type_doc_id' => 1]); $this->fixture('Class_UsersNonValid', ['id_user' => 8, - 'id' => 8, - 'login' => 'moo', - 'password' => 'moo', - 'mail' => 'moo@moo.com',]); + 'id' => 8, + 'login' => 'moo', + 'password' => 'moo', + 'mail' => 'moo@moo.com',]); $this->fixture('Class_UsersNonValid', ['id_user' => 9, - 'id' => 9, - 'login' => 'Simon', - 'password' => 'LeHerisson', - 'mail' => 'simon-le-herisson@gmail.com',]); + 'id' => 9, + 'login' => 'Simon', + 'password' => 'LeHerisson', + 'mail' => 'simon-le-herisson@gmail.com',]); + $this->generateReviews(); + } + + + protected function generateReviews() { + for($i = 110; $i <= 139; $i++) + $this->fixture('Class_AvisNotice', ['id' => $i, + 'id_notice' => 1002, + 'entete' => 'Bulles', + 'note'=> 2, + 'id_user' => null, + 'flags' => 0, + 'avis' => ' Pour faire aimer la biere aux enfants!', + 'id_notice' => 1032, + 'statut' => 1]); + } +} + + +class ModoControllerIndexActionTest extends ModoControllerIndexActionTestCase { + + public function setUp() { + parent::setUp(); $this->dispatch('admin/modo/', true); } @@ -397,9 +419,9 @@ class ModoControllerSuggestionAchatEditUnknownTest extends ModoControllerSuggest public function setUp() { parent::setUp(); Storm_Test_ObjectWrapper::onLoaderOfModel('Class_SuggestionAchat') - ->whenCalled('find') - ->with(99) - ->answers(null); + ->whenCalled('find') + ->with(99) + ->answers(null); $this->dispatch('/admin/modo/suggestion-achat-edit/id/99', true); } @@ -436,8 +458,8 @@ class ModoControllerSuggestionAchatEditHarryPotterPostTest extends ModoControlle /** @test */ public function withValidDataShouldHaveNoError() { $this->postDispatch('/admin/modo/suggestion-achat-edit/id/2', - ['titre' => 'Star Wars', 'auteur' => 'G.Lucas', 'isbn' => '', 'type_doc_id' => 2], - true); + ['titre' => 'Star Wars', 'auteur' => 'G.Lucas', 'isbn' => '', 'type_doc_id' => 2], + true); $this->assertRedirect(); } } @@ -474,9 +496,9 @@ class ModoControllerSuggestionAchatDeleteUnknownTest extends ModoControllerSugge public function setUp() { parent::setUp(); Storm_Test_ObjectWrapper::onLoaderOfModel('Class_SuggestionAchat') - ->whenCalled('find') - ->with(99) - ->answers(null); + ->whenCalled('find') + ->with(99) + ->answers(null); $this->dispatch('admin/modo/suggestion-achat-delete/id/99', true); } @@ -644,7 +666,7 @@ class ModoControllerAvisnoticeActionTest extends Admin_AbstractControllerTestCas -class ModoControllerAllReviewsActionTest extends ModoControllerIndexActionTest { +class ModoControllerAllReviewsActionTest extends ModoControllerIndexActionTestCase { public function setup() { parent::setup(); @@ -654,22 +676,25 @@ class ModoControllerAllReviewsActionTest extends ModoControllerIndexActionTest { /** @test **/ public function moderatedReviewsShouldBeDisplayed() { - $this->assertXpathContentContains('//div//h2', 'B comme bière : la bière expliquée aux (grands) enfants', $this->_response->getBody()); + $this->assertXpathContentContains('//div//h2', 'B comme bière : la bière expliquée aux (grands) enfants'); } /** @test **/ public function unmoderatedReviewsShouldNotBeDisplayed() { - $this->assertNotXpathContentContains('//div//h2', 'Para Ana', $this->_response->getBody()); + $this->assertNotXpathContentContains('//div//h2', 'Para Ana'); } -} - + /** @test */ + public function paginatorShouldBePresent() { + $this->assertXPath('//div[@class="pager"]/span/a[contains(@href, "/active_tab/1/page/3")]'); + } +} -class ModoControllerAllReviewsPageActionTest extends ModoControllerIndexActionTest { +class ModoControllerAllReviewsPageActionTest extends ModoControllerIndexActionTestCase { public function setup() { parent::setup(); @@ -691,19 +716,20 @@ class ModoControllerAllReviewsPageActionTest extends ModoControllerIndexActionTe -class ModoControllerArchivedReviewsActionTest extends ModoControllerIndexActionTest { +class ModoControllerArchivedReviewsActionTest extends ModoControllerIndexActionTestCase { public function setup() { parent::setup(); - } + /** @test **/ public function moderatedReviewsShouldBeArchived() { $this->dispatch('admin/modo/invisibleavisnotice/id/223', true); $this->assertEquals(2,Class_AvisNotice::find(223)->getFlags()); } + /** @test **/ public function moderatedReviewsShouldBeVisible() { $avis=(Class_AvisNotice::find(223)); @@ -712,9 +738,4 @@ class ModoControllerArchivedReviewsActionTest extends ModoControllerIndexActionT $this->dispatch('admin/modo/visibleavisnotice/id/223', true); $this->assertEquals(0,Class_AvisNotice::find(223)->getFlags()); } - } - - - -?> \ No newline at end of file diff --git a/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php b/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php index 4ddcb1d302c4e0d7eaf9e29fc20204e51a09c2c8..ca8787ac6558ba88d5a613204f065e77df795142 100644 --- a/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php +++ b/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php @@ -1128,8 +1128,10 @@ class NoticeAjaxControllerVideoMorceauTest extends AbstractControllerTestCase { } + /** * @group no-ci + * @group integration * @test */ public function responseShouldContainsPlayer() { diff --git a/tests/application/modules/opac/controllers/OAIControllerListRecordsTest.php b/tests/application/modules/opac/controllers/OAIControllerListRecordsTest.php index c4df0608d7e587a66e806f25b285faec2423b327..8457d2e90805847b21892928d58c647b0dd941c2 100644 --- a/tests/application/modules/opac/controllers/OAIControllerListRecordsTest.php +++ b/tests/application/modules/opac/controllers/OAIControllerListRecordsTest.php @@ -48,6 +48,8 @@ abstract class OAIControllerListRecordsInZorkSetTestCase extends AbstractControl Class_Notice::getLoader() ->newInstanceWithId(4) ->setClefAlpha('harrypotter-azkaban') + ->setUrlVignette('images/vignette.png') + ->setUrlImage('images/img.png') ->setDateMaj('2012-04-03 11:42:42'))); } } @@ -106,6 +108,14 @@ class OAIControllerListRecordsInZorkSetTest extends OAIControllerListRecordsInZo $position, $header); $this->_xpath->assertXPathContentContains($this->_response->getBody(), $path, $content); } + + + /** @test */ + public function urlVignetteShouldBeAbsolute() { + $this->_xpath->assertXPathContentContains($this->_response->getBody(), + '//oai:ListRecords/oai:record[3]/oai:metadata', + Class_Url::absolute('images/vignette.png')); + } } diff --git a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php index c984d831efc32891244d75f449f3d550c6a39c9e..6003d2c856d8580efb3871abdac46f77ec867b76 100644 --- a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php +++ b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php @@ -1671,16 +1671,29 @@ abstract class ProfilOptionsControllerProfilBoiteCalendarTestCase extends Abstra public function setup() { parent::setup(); + $bib = $this->fixture('Class_Bib', + ['id' => 2, + 'libelle' => 'Library']); + + $category = $this->fixture('Class_ArticleCategorie', + ['id' => 12, + 'libelle' => 'Fiesta à Annecy', + 'bib' => $bib]); + + $article = $this->fixture('Class_Article', + ['id' => 34, + 'titre' => 'Fête du caion', + 'contenu' => 'Fête du caion', + 'description' => 'à Annecy', + 'events_debut' => '2011-09-03', + 'events_fin' => '2011-09-03', + 'categorie' => $category, + 'bib' => $bib]); + Class_AdminVar::beVolatile(); Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Article') ->whenCalled('getArticlesByPreferences') - ->answers([Class_Article::newInstanceWithId(34, [ - 'titre' => 'Fête du caion', - 'description' => 'à Annecy', - 'events_debut' => '2011-09-03', - 'events_fin' => '2011-09-03', - 'categorie' => Class_ArticleCategorie::newInstanceWithId(1, - ['libelle' => 'Fiesta à Annecy'])])]); + ->answers([$article]); } } @@ -1694,7 +1707,8 @@ class ProfilOptionsControllerProfilBoiteCalendarWithCalendarDisplayedAndModeSimp $cfg_accueil = ['modules' => ['45' => ['division' => '1', 'type_module' => 'CALENDAR', 'preferences' => ['display_calendar' => '1', - 'mode-affichage' => 'simple']]]]; + 'mode-affichage' => 'simple', + 'display_event_info' => 'bib']]]]; $this->profil_with_calendar = Class_Profil::getCurrentProfil() ->setBrowser('opac') @@ -1771,6 +1785,12 @@ class ProfilOptionsControllerProfilBoiteCalendarWithCalendarDisplayedAndModeSimp public function boiteCalendarLiShouldContainsCalendarEventTitle() { $this->assertXPathContentContains('//li/a[@class="calendar_event_title"]', 'Fête du caion'); } + + + /** @test */ + public function linkToBibShouldBePresentcontextShouldExpectation() { + $this->assertXPathContentContains('//div[contains(@class,"calendar")]//a[contains(@class, "calendar_event_info")][contains(@href, "cms/articleviewbydate/id_module/45/b/2")]', 'Library'); + } } @@ -1792,7 +1812,7 @@ class ProfilOptionsControllerProfilBoiteCalendarWithCalendarDisplayedWithModeSim ->setLibelle('Profil Portail') ->setCfgAccueil($cfg_accueil); - $this->dispatch('/opac'); + $this->dispatch('/opac', true); } @@ -1865,8 +1885,8 @@ class ProfilOptionsControllerProfilBoiteCalendarWithCalendarDisplayedWithModeSim /** @test **/ - public function boiteCalendarLiShouldContainsCalendarEventInfoWithPortail() { - $this->assertXPathContentContains('//li/a[@class="calendar_event_info"]', 'Portail',$this->_response->getBody()); + public function boiteCalendarLiShouldContainsCalendarEventInfoWithLibrary() { + $this->assertXPathContentContains('//li/a[@class="calendar_event_info"]', 'Library'); } } diff --git a/tests/library/ZendAfi/View/Helper/Accueil/CalendarTest.php b/tests/library/ZendAfi/View/Helper/Accueil/CalendarTest.php index 762ea40ec289531a7e51baa9393e9f9af4f29d50..90fc393dc5fd3e70b19c8d89848fc8606d57fb44 100644 --- a/tests/library/ZendAfi/View/Helper/Accueil/CalendarTest.php +++ b/tests/library/ZendAfi/View/Helper/Accueil/CalendarTest.php @@ -549,7 +549,7 @@ class CalendarWithCategoryLimitAndBibPreferencesTest extends CalendarViewHelperT /** @test */ function calendarEventListShouldContainsBibCran() { $this->assertXPathContentContains($this->html, - '//a[@class="calendar_event_info"][contains(@href, "cms/articleviewbydate/b/5")]', + '//a[@class="calendar_event_info"][contains(@href, "cms/articleviewbydate/id_module/2/b/5")]', 'Cran Gevrier', $this->html); } diff --git a/tests/library/ZendAfi/View/Helper/ListeNotices/ChronoSourceTest.php b/tests/library/ZendAfi/View/Helper/ListeNotices/ChronoSourceTest.php index cae5694f2e47d92493cd3796ffc25ab416c1169c..ed191f9471460e6a32ad9c24954d3f7c3e639dda 100644 --- a/tests/library/ZendAfi/View/Helper/ListeNotices/ChronoSourceTest.php +++ b/tests/library/ZendAfi/View/Helper/ListeNotices/ChronoSourceTest.php @@ -112,13 +112,13 @@ class ZendAfi_View_Helper_ListeNotices_ChronoSourceTest extends ViewHelperTestCa /** @test */ public function firstNoticeThumbnailShouldBeHpDotPng() { - $this->assertEquals('hp.png', $this->_json->timeline->date[0]->asset->thumbnail); + $this->assertContains('hp.png', $this->_json->timeline->date[0]->asset->thumbnail); } /** @test */ public function firstNoticeMediaShouldBeHpBigDotPng() { - $this->assertEquals('hp_big.png', $this->_json->timeline->date[0]->asset->media); + $this->assertContains('hp_big.png', $this->_json->timeline->date[0]->asset->media); }