This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  8d1061af3112abf1033fa46d303839ed8ec6f0ee (commit)
       via  2d1b89a36b14d729307a482e257704fb9479a462 (commit)
       via  4925b71aaec9d206f590fd8c31815906c8b8e279 (commit)
      from  0cf05874e0f0842e631921f7a545abbd52c72a3a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=8d1061af3112abf1033fa46d303839ed8ec6f0ee

commit 8d1061af3112abf1033fa46d303839ed8ec6f0ee
Author: Franck Villaume <[email protected]>
Date:   Sat Apr 30 17:32:32 2016 +0200

    new Widget for Forge Home Page: Display detailed activities for most active 
projects of the week

diff --git a/src/common/widget/Widget.class.php 
b/src/common/widget/Widget.class.php
index df0e79b..a5511f3 100644
--- a/src/common/widget/Widget.class.php
+++ b/src/common/widget/Widget.class.php
@@ -52,6 +52,7 @@ require_once 
$gfcommon.'widget/Widget_ProjectLatestCommits.class.php';
 //require_once('common/widget/Widget_ProjectWikiPage.class.php');
 require_once 'common/widget/Widget_ProjectScmStats.class.php';
 
+require_once 
$gfcommon.'widget/Widget_HomeDetailActivityMostActiveProjectWeek.class.php';
 require_once $gfcommon.'widget/Widget_HomeLatestNews.class.php';
 require_once $gfcommon.'widget/Widget_HomeStats.class.php';
 require_once $gfcommon.'widget/Widget_HomeTagCloud.class.php';
@@ -185,6 +186,9 @@ require_once 
$gfcommon.'widget/Widget_HomeVersion.class.php';
                        case 'homeversion':
                                $o = new Widget_HomeVersion();
                                break;
+                       case 'homedetailactivitymostactiveprojectweek';
+                               $o = new 
Widget_HomeDetailActivityMostActiveProjectWeek();
+                               break;
                        case 'mysurveys':
                                $o = new Widget_MySurveys();
                                break;
@@ -309,7 +313,7 @@ require_once 
$gfcommon.'widget/Widget_HomeVersion.class.php';
                                                );
                                break;
                        case WidgetLayoutManager::OWNER_TYPE_HOME:
-                               $widgets = array('hometagcloud', 'homeversion', 
'homelatestnews', 'homestats');
+                               $widgets = array('hometagcloud', 'homeversion', 
'homelatestnews', 'homestats', 'homedetailactivitymostactiveprojectweek');
                                break;
                        default:
                                $widgets = array();
diff --git 
a/src/common/widget/Widget_HomeDetailActivityMostActiveProjectWeek.class.php 
b/src/common/widget/Widget_HomeDetailActivityMostActiveProjectWeek.class.php
new file mode 100644
index 0000000..426caa4
--- /dev/null
+++ b/src/common/widget/Widget_HomeDetailActivityMostActiveProjectWeek.class.php
@@ -0,0 +1,253 @@
+<?php
+/**
+ * Copyright 2016, Franck Villaume - TrivialDev
+ * This file is a part of Fusionforge.
+ *
+ * Fusionforge 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.
+ *
+ * Fusionforge 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 Fusionforge. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+require_once 'Widget.class.php';
+
+class Widget_HomeDetailActivityMostActiveProjectWeek extends Widget {
+
+       var $cached_perms = array();
+
+       function __construct() {
+               $this->Widget('homedetailactivitymostactiveprojectweek');
+               if (forge_get_config('use_activity')) {
+                       $this->content['title'] = _('Detailed Activity for the 
10 Most Active Projects this Week');
+               }
+       }
+
+       function getContent() {
+               global $HTML;
+               $stats = new Stats();
+               $result = $stats->getMostActiveStats('week', 0);
+               $return = '';
+               $count = 1;
+               $selected_groups = array();
+               while (($row = db_fetch_array($result)) && ($count <= 10)) {
+                       $group = group_get_object($row['group_id']);
+                       if (forge_check_perm('project_read', $row['group_id']) 
&& $group->usesActivity()) {
+                               $selected_groups[] = $row['group_id'];
+                               $count++;
+                       }
+               }
+               $activities = array();
+               $begin = (time()-(7*86400));
+               $end = time();
+               $res = db_query_params('SELECT * FROM activity_vw WHERE 
activity_date BETWEEN $1 AND $2
+                                       AND group_id = ANY ($3) ORDER BY 
activity_date DESC',
+                               array($begin, $end, 
db_int_array_to_any_clause($selected_groups)));
+               if ($res && db_numrows($res) > 0) {
+                       while ($arr = db_fetch_array($res)) {
+                               $activities[] = $arr;
+                       }
+               }
+               foreach ($selected_groups as $group_id) {
+                       // If plugins wants to add activities.
+                       $hookParams['group'] = $group_id;
+                       $hookParams['results'] = &$activities;
+                       $hookParams['begin'] = $begin;
+                       $hookParams['end'] = $end;
+                       plugin_hook('activity', $hookParams);
+               }
+               if (count($activities) > 0) {
+                       $date_format = _('%Y-%m-%d');
+                       $date_format_js = _('yy-mm-dd');
+                       usort($activities, 
'Widget_HomeDetailActivityMostActiveProjectWeek::date_compare');
+                       $displayTableTop = 0;
+                       $last_day = 0;
+                       $j = 0;
+                       foreach ($activities as $activity) {
+                               $docmanerror = 0;
+                               if (!$this->check_perm_for_activity($activity)) 
{
+                                       continue;
+                               }
+                               if (!$displayTableTop) {
+                                       $theader = array();
+                                       $theader[] = _('Time');
+                                       $theader[] = _('Project');
+                                       $theader[] = _('Activity');
+                                       $theader[] = _('By');
+
+                                       echo $HTML->listTableTop($theader);
+                                       $displayTableTop = 1;
+                               }
+                               switch (@$activity['section']) {
+                                       case 'scm': {
+                                               $icon = 
html_image('ic/cvs16b.png','','',array('alt'=>_('Source Code')));
+                                               $url = 
util_make_link('/scm/'.$activity['ref_id'].$activity['subref_id'],_('scm 
commit')._(': ').$activity['description']);
+                                               break;
+                                       }
+                                       case 'trackeropen': {
+                                               $icon = 
html_image('ic/tracker20g.png','','',array('alt'=>_('Trackers')));
+                                               $url = 
util_make_link('/tracker/?func=detail&atid='.$activity['ref_id'].'&aid='.$activity['subref_id'].'&group_id='.$activity['group_id'],_('Tracker
 Item').' [#'.$activity['subref_id'].'] '.$activity['description'].' 
'._('Opened'));
+                                               break;
+                                       }
+                                       case 'trackerclose': {
+                                               $icon = 
html_image('ic/tracker20g.png','','',array('alt'=>_('Trackers')));
+                                               $url = 
util_make_link('/tracker/?func=detail&atid='.$activity['ref_id'].'&aid='.$activity['subref_id'].'&group_id='.$activity['group_id'],_('Tracker
 Item').' [#'.$activity['subref_id'].'] '.$activity['description'].' 
'._('Closed'));
+                                               break;
+                                       }
+                                       case 'frsrelease': {
+                                               $icon = 
html_image('ic/cvs16b.png','','',array('alt'=>_('Files')));
+                                               $url = 
util_make_link('/frs/?release_id='.$activity['subref_id'].'&group_id='.$activity['group_id'],_('FRS
 Release').' '.$activity['description']);
+                                               break;
+                                       }
+                                       case 'forumpost': {
+                                               $icon = 
html_image('ic/forum20g.png','','',array('alt'=>_('Forum')));
+                                               $url = 
util_make_link('/forum/message.php?msg_id='.$activity['subref_id'].'&group_id='.$activity['group_id'],_('Forum
 Post').' '.$activity['description']);
+                                               break;
+                                       }
+                                       case 'news': {
+                                               $icon = 
html_image('ic/write16w.png','','',array('alt'=>_('News')));
+                                               $url = 
util_make_link('/forum/forum.php?forum_id='.$activity['subref_id'],_('News').' 
'.$activity['description']);
+                                               break;
+                                       }
+                                       case 'taskopen': {
+                                               $icon = 
html_image('ic/taskman20w.png','','',array('alt'=>_('Tasks')));
+                                               $url = 
util_make_link('/pm/task.php?func=detailtask&project_task_id='.$activity['subref_id'].'&group_id='.$activity['group_id'].'&group_project_id='.$activity['ref_id'],_('Tasks').'
 '.$activity['description']);
+                                               break;
+                                       }
+                                       case 'taskclose': {
+                                               $icon = 
html_image('ic/taskman20w.png','','',array('alt'=>_('Tasks')));
+                                               $url = 
util_make_link('/pm/task.php?func=detailtask&project_task_id='.$activity['subref_id'].'&group_id='.$activity['group_id'].'&group_project_id='.$activity['ref_id'],_('Tasks').'
 '.$activity['description']);
+                                               break;
+                                       }
+
+                                       case 'taskdelete': {
+                                               $icon = 
html_image('ic/taskman20w.png','','',array('alt'=>_('Tasks')));
+                                               $url = 
util_make_link('/pm/task.php?func=detailtask&project_task_id='.$activity['subref_id'].'&group_id='.$activity['group_id'].'&group_project_id='.$activity['ref_id'],_('Tasks').'
 '.$activity['description']);
+                                               break;
+                                       }
+                                       case 'docmannew':
+                                       case 'docmanupdate': {
+                                               $document = 
document_get_object($activity['subref_id'], $activity['group_id']);
+                                               $stateid = 
$document->getStateID();
+                                               if ($stateid != 1 && 
!forge_check_perm('docman', $activity['group_id'], 'approve')) {
+                                                       $docmanerror = 1;
+                                               }
+                                               $dg = 
documentgroup_get_object($activity['ref_id'], $activity['group_id']);
+                                               if (!$dg || $dg->isError() || 
!$dg->getPath(true, false)) {
+                                                       $docmanerror = 1;
+                                               }
+                                               $icon = 
html_image('ic/docman16b.png', '', '', array('alt'=>_('Documents')));
+                                               $url = 
util_make_link('docman/?group_id='.$activity['group_id'].'&view=listfile&dirid='.$activity['ref_id'],_('Document').'
 '.$activity['description']);
+                                               break;
+                                       }
+                                       case 'docgroupnew': {
+                                               $dg = 
documentgroup_get_object($activity['subref_id'], $activity['group_id']);
+                                               if (!$dg || $dg->isError() || 
!$dg->getPath(true, false)) {
+                                                       $docmanerror = 1;
+                                               }
+                                               $icon = 
html_image('ic/cfolder15.png', '', '', array("alt"=>_('Directory')));
+                                               $url = 
util_make_link('docman/?group_id='.$activity['group_id'].'&view=listfile&dirid='.$activity['subref_id'],_('Directory').'
 '.$activity['description']);
+                                               break;
+                                       }
+                                       default: {
+                                               $icon = 
isset($activity['icon']) ? $activity['icon'] : '';
+                                               $url = '<a 
href="'.$activity['link'].'">'.$activity['title'].'</a>';
+                                       }
+                               }
+                               if ($docmanerror) {
+                                       continue;
+                               }
+                               if ($last_day != strftime($date_format, 
$activity['activity_date'])) {
+                                       echo '<tr class="tableheading"><td 
colspan="4">'.strftime($date_format, $activity['activity_date']).'</td></tr>';
+                                       $last_day=strftime($date_format, 
$activity['activity_date']);
+                               }
+                               $cells = array();
+                               $cells[][] = 
date('H:i:s',$activity['activity_date']);
+                               $group_object = 
group_get_object($activity['group_id']);
+
+                               $cells[][] = 
util_make_link_g($group_object->getUnixName(), $activity['group_id'], 
$group_object->getPublicName());
+                               $cells[][] = $icon .' '.$url;
+                               if (isset($activity['user_name']) && 
$activity['user_name']) {
+                                       $cells[][] = 
util_display_user($activity['user_name'], 
$activity['user_id'],$activity['realname']);
+                               } else {
+                                       $cells[][] = $activity['realname'];
+                               }
+                               echo $HTML->multiTableRow(array('class' => 
$HTML->boxGetAltRowStyle($j++, true)), $cells);
+                       }
+                       if ($displayTableTop) {
+                               echo $HTML->listTableBottom($theader);
+                       }
+               } else {
+                       echo $HTML->information(_('No activity during the last 
week'));
+               }
+               return $return;
+       }
+
+       function getTitle() {
+               return $this->content['title'];
+       }
+
+       function isAvailable() {
+               return isset($this->content['title']);
+       }
+
+       function date_compare($a, $b) {
+               if ($a['activity_date'] == $b['activity_date']) {
+                       return 0;
+               }
+               return ($a['activity_date'] > $b['activity_date']) ? -1 : 1;
+       }
+
+       function check_perm_for_activity($arr) {
+               $s = $arr['section'];
+               $ref = $arr['ref_id'];
+               $group_id = $arr['group_id'];
+
+               if (!isset($this->cached_perms[$s][$ref])) {
+                       switch ($s) {
+                               case 'scm': {
+                                       $this->cached_perms[$s][$ref] = 
forge_check_perm('scm', $group_id, 'read');
+                                       break;
+                               }
+                               case 'trackeropen':
+                               case 'trackerclose': {
+                                       $this->cached_perms[$s][$ref] = 
forge_check_perm('tracker', $ref, 'read');
+                                       break;
+                               }
+                               case 'frsrelease': {
+                                       $this->cached_perms[$s][$ref] = 
forge_check_perm('frs', $ref, 'read');
+                                       break;
+                               }
+                               case 'forumpost':
+                               case 'news': {
+                                       $this->cached_perms[$s][$ref] = 
forge_check_perm('forum', $ref, 'read');
+                                       break;
+                               }
+                               case 'taskopen':
+                               case 'taskclose':
+                               case 'taskdelete': {
+                                       $this->cached_perms[$s][$ref] = 
forge_check_perm('pm', $ref, 'read');
+                                       break;
+                               }
+                               case 'docmannew':
+                               case 'docmanupdate':
+                               case 'docgroupnew': {
+                                       $this->cached_perms[$s][$ref] = 
forge_check_perm('docman', $group_id, 'read');
+                                       break;
+                               }
+                               default: {
+                                       // Must be a bug somewhere, we're 
supposed to handle all types
+                                       $this->cached_perms[$s][$ref] = false;
+                               }
+                       }
+               }
+               return $this->cached_perms[$s][$ref];
+       }
+}

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=2d1b89a36b14d729307a482e257704fb9479a462

commit 2d1b89a36b14d729307a482e257704fb9479a462
Author: Franck Villaume <[email protected]>
Date:   Sat Apr 30 17:31:15 2016 +0200

    activity: fix wrong param. add more condition to validate test

diff --git a/src/www/activity/index.php b/src/www/activity/index.php
index dad9e34..f0f4656 100644
--- a/src/www/activity/index.php
+++ b/src/www/activity/index.php
@@ -360,7 +360,7 @@ echo $HTML->closeForm();
                                                $docmanerror = 1;
                                        }
                                        $dg = 
documentgroup_get_object($arr['ref_id'], $arr['group_id']);
-                                       if (!$dg->getPath(true, false)) {
+                                       if (!$dg || $dg->isError() || 
!$dg->getPath(true, false)) {
                                                $docmanerror = 1;
                                        }
                                        $icon = html_image('ic/docman16b.png', 
'', '', array('alt'=>_('Documents')));
@@ -368,7 +368,7 @@ echo $HTML->closeForm();
                                        break;
                                }
                                case 'docgroupnew': {
-                                       $dg = 
documentgroup_get_object($arr['ref_id'], $arr['group_id']);
+                                       $dg = 
documentgroup_get_object($arr['subref_id'], $arr['group_id']);
                                        if (!$dg || $dg->isError() || 
!$dg->getPath(true, false)) {
                                                $docmanerror = 1;
                                        }

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=4925b71aaec9d206f590fd8c31815906c8b8e279

commit 4925b71aaec9d206f590fd8c31815906c8b8e279
Author: Franck Villaume <[email protected]>
Date:   Thu Apr 28 18:31:05 2016 +0200

    stats_projects-backfill.php: fix require_once

diff --git a/src/cronjobs/db/stats_projects-backfill.php 
b/src/cronjobs/db/stats_projects-backfill.php
index a345179..83b9b7f 100755
--- a/src/cronjobs/db/stats_projects-backfill.php
+++ b/src/cronjobs/db/stats_projects-backfill.php
@@ -21,7 +21,7 @@
 
 require dirname(__FILE__).'/../../common/include/env.inc.php';
 require_once $gfcommon.'include/pre.php';
-require_once 'cronjobs/stats_projects.inc';
+require_once 'cronjobs/db/stats_projects.inc';
 
 $i=0;
 

-----------------------------------------------------------------------

Summary of changes:
 src/common/widget/Widget.class.php                 |   6 +-
 ...meDetailActivityMostActiveProjectWeek.class.php | 253 +++++++++++++++++++++
 src/cronjobs/db/stats_projects-backfill.php        |   2 +-
 src/www/activity/index.php                         |   4 +-
 4 files changed, 261 insertions(+), 4 deletions(-)
 create mode 100644 
src/common/widget/Widget_HomeDetailActivityMostActiveProjectWeek.class.php


hooks/post-receive
-- 
FusionForge

_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits

Reply via email to