From 654caec538912e37949b1942f81b8e7d0e2b2deb Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Fri, 15 Oct 2010 18:18:51 +0200 Subject: [PATCH] Initiates pages to fix merge related possible errors. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- modules/fusionax.php | 46 ++++++++++++++++++++++++++++++++++--------- templates/fusionax/issues.tpl | 42 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 9 deletions(-) create mode 100644 templates/fusionax/issues.tpl diff --git a/modules/fusionax.php b/modules/fusionax.php index c391ad1..dfde915 100644 --- a/modules/fusionax.php +++ b/modules/fusionax.php @@ -33,22 +33,50 @@ class FusionAxModule extends PLModule { function handlers() { + if (Platal::globals()->merge->state == 'pending') { + $auth = 'admin'; + } elseif (Platal::globals()->merge->state == 'done') { + $auth = 'admin,edit_directory'; + } + return array( - 'fusionax' => $this->make_hook('index', AUTH_MDP, 'admin'), - 'fusionax/import' => $this->make_hook('import', AUTH_MDP, 'admin'), - 'fusionax/view' => $this->make_hook('view', AUTH_MDP, 'admin'), - 'fusionax/ids' => $this->make_hook('ids', AUTH_MDP, 'admin'), - 'fusionax/deceased' => $this->make_hook('deceased', AUTH_MDP, 'admin'), - 'fusionax/promo' => $this->make_hook('promo', AUTH_MDP, 'admin'), - 'fusionax/names' => $this->make_hook('names', AUTH_MDP, 'admin'), + 'fusionax' => $this->make_hook('index', AUTH_MDP, $auth), + 'fusionax/import' => $this->make_hook('import', AUTH_MDP, 'admin'), + 'fusionax/view' => $this->make_hook('view', AUTH_MDP, 'admin'), + 'fusionax/ids' => $this->make_hook('ids', AUTH_MDP, 'admin'), + 'fusionax/deceased' => $this->make_hook('deceased', AUTH_MDP, 'admin'), + 'fusionax/promo' => $this->make_hook('promo', AUTH_MDP, 'admin'), + 'fusionax/names' => $this->make_hook('names', AUTH_MDP, 'admin'), + + 'fusionax/deathdate_issues' => $this->make_hook('deathdate_issue', AUTH_MDP, 'admin,edit_directory'), + 'fusionax/promo_issues' => $this->make_hook('promo_issue', AUTH_MDP, 'admin,edit_directory'), + 'fusionax/name_issues' => $this->make_hook('name_issue', AUTH_MDP, 'admin,edit_directory'), + 'fusionax/phone_issues' => $this->make_hook('phone_issue', AUTH_MDP, 'admin,edit_directory'), + 'fusionax/education_issues' => $this->make_hook('education_issue', AUTH_MDP, 'admin,edit_directory'), + 'fusionax/address_issues' => $this->make_hook('address_issue', AUTH_MDP, 'admin,edit_directory'), + 'fusionax/job_issues' => $this->make_hook('job_issue', AUTH_MDP, 'admin,edit_directory'), ); } function handler_index(&$page) { - $page->changeTpl('fusionax/index.tpl'); - $page->assign('xorg_title', 'Polytechnique.org - Fusion des annuaires'); + if (Platal::globals()->merge->state == 'pending') { + $page->changeTpl('fusionax/index.tpl'); + } elseif (Platal::globals()->merge->state == 'done') { + $issues = XDB::rawFetchOneAssoc("SELECT COUNT(*) AS total, + SUM(FIND_IN_SET('name', issues)) DIV 1 AS name, + SUM(FIND_IN_SET('job', issues)) DIV 2 AS job, + SUM(FIND_IN_SET('address', issues)) DIV 3 AS address, + SUM(FIND_IN_SET('promo', issues)) DIV 4 AS promo, + SUM(FIND_IN_SET('deathdate', issues)) DIV 5 AS deathdate, + SUM(FIND_IN_SET('phone', issues)) DIV 6 AS phone, + SUM(FIND_IN_SET('education', issues)) DIV 7 AS education + FROM profile_merge_issues + WHERE issues IS NOT NULL OR issues != ''"); + $page->assign('issues', $issues); + $page->changeTpl('fusionax/issues.tpl'); + } } /** Import de l'annuaire de l'AX depuis l'export situé dans le home de jacou */ diff --git a/templates/fusionax/issues.tpl b/templates/fusionax/issues.tpl new file mode 100644 index 0000000..54cc91f --- /dev/null +++ b/templates/fusionax/issues.tpl @@ -0,0 +1,42 @@ +{**************************************************************************} +{* *} +{* Copyright (C) 2003-2010 Polytechnique.org *} +{* http://opensource.polytechnique.org/ *} +{* *} +{* This program is free software; you can redistribute it and/or modify *} +{* it under the terms of the GNU General Public License as published by *} +{* the Free Software Foundation; either version 2 of the License, or *} +{* (at your option) any later version. *} +{* *} +{* This program is distributed in the hope that it will be useful, *} +{* but WITHOUT ANY WARRANTY; without even the implied warranty of *} +{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *} +{* GNU General Public License for more details. *} +{* *} +{* You should have received a copy of the GNU General Public License *} +{* along with this program; if not, write to the Free Software *} +{* Foundation, Inc., *} +{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *} +{* *} +{**************************************************************************} + +

Fusion des annuaires X.org - AX

+ +{if $issues.total > 0} +

+ Il reste les problèmes suivants dus à la fusion des annuaires à corriger sur les profils : +

+ +{else} +

Il ne reste plus d'erreurs liées à la fusion des annuaires !

+{/if} + +{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} -- 2.1.4