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  bab765dee838245e08d3e78dc18b895c0155baeb (commit)
       via  a172f52216ed575f894774b4d44f868562ad6dfa (commit)
       via  8035d9926a5bace71083a401e5e516ee8acf46c2 (commit)
      from  60da818afd9745794550fae39458b1fe8d8c4700 (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=bab765dee838245e08d3e78dc18b895c0155baeb

commit bab765dee838245e08d3e78dc18b895c0155baeb
Author: Franck Villaume <[email protected]>
Date:   Sun Mar 20 21:21:18 2016 +0100

    fix widget home tagcloud: use config flag correctly

diff --git a/src/common/widget/Widget_HomeTagCloud.class.php 
b/src/common/widget/Widget_HomeTagCloud.class.php
index 09d32ca..d4f8913 100644
--- a/src/common/widget/Widget_HomeTagCloud.class.php
+++ b/src/common/widget/Widget_HomeTagCloud.class.php
@@ -23,11 +23,20 @@ require_once $gfcommon.'include/tag_cloud.php';
 class Widget_HomeTagCloud extends Widget {
        function __construct() {
                $this->Widget('hometagcloud');
+               if (forge_get_config('use_project_tags')) {
+                       $this->content['title'] = _('Tag Cloud');
+               }
        }
+
        function getTitle() {
-               return _('Tag Cloud');
+               return $this->content['title'];
        }
+
        function getContent() {
                return tag_cloud();
        }
+
+       function isAvailable() {
+               return isset($this->content['title']);
+       }
 }

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

commit a172f52216ed575f894774b4d44f868562ad6dfa
Author: Franck Villaume <[email protected]>
Date:   Sun Mar 20 18:35:31 2016 +0100

    Add widgt Forge Homepage: Latest News

diff --git a/src/common/widget/Widget.class.php 
b/src/common/widget/Widget.class.php
index b5dbce3..3896bd2 100644
--- a/src/common/widget/Widget.class.php
+++ b/src/common/widget/Widget.class.php
@@ -55,6 +55,7 @@ require_once 
$gfcommon.'widget/Widget_ProjectLatestCommits.class.php';
 //require_once 'common/widget/Widget_ProjectSvnStats.class.php';
 require_once $gfcommon.'widget/Widget_MyMonitoredDocuments.class.php';
 
+require_once $gfcommon.'widget/Widget_HomeLatestNews.class.php';
 require_once $gfcommon.'widget/Widget_HomeTagCloud.class.php';
 require_once $gfcommon.'widget/Widget_HomeVersion.class.php';
 
@@ -175,6 +176,9 @@ require_once 
$gfcommon.'widget/Widget_HomeVersion.class.php';
        static  function & getInstance($widget_name) {
                $o = null;
                switch($widget_name) {
+                       case 'homelatestnews':
+                               $o = new Widget_HomeLatestNews();
+                               break;
                        case 'hometagcloud':
                                $o = new Widget_HomeTagCloud();
                                break;
@@ -315,7 +319,7 @@ require_once 
$gfcommon.'widget/Widget_HomeVersion.class.php';
                                                );
                                break;
                        case WidgetLayoutManager::OWNER_TYPE_HOME:
-                               $widgets = array('hometagcloud', 'homeversion');
+                               $widgets = array('hometagcloud', 'homeversion', 
'homelatestnews');
                                break;
                        default:
                                $widgets = array();
diff --git a/src/common/widget/Widget_HomeLatestNews.class.php 
b/src/common/widget/Widget_HomeLatestNews.class.php
new file mode 100644
index 0000000..f4cadb9
--- /dev/null
+++ b/src/common/widget/Widget_HomeLatestNews.class.php
@@ -0,0 +1,32 @@
+<?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_HomeLatestNews extends Widget {
+       function __construct() {
+               $this->Widget('homelatestnews');
+       }
+       function getTitle() {
+               return _('Latest News');
+       }
+       function getContent() {
+               return news_show_latest(forge_get_config('news_group'), 5, 
true, false, false, 5);
+       }
+}

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

commit 8035d9926a5bace71083a401e5e516ee8acf46c2
Author: Franck Villaume <[email protected]>
Date:   Sun Mar 20 18:24:29 2016 +0100

    plugin blocks: support forge homepage

diff --git a/src/plugins/blocks/common/blocksPlugin.class.php 
b/src/plugins/blocks/common/blocksPlugin.class.php
index 763d031..3b3b458 100644
--- a/src/plugins/blocks/common/blocksPlugin.class.php
+++ b/src/plugins/blocks/common/blocksPlugin.class.php
@@ -4,7 +4,7 @@
  * Copyright (C) 2006 Alain Peyrat, Alcatel-Lucent
  * Copyright (C) 2010 Alain Peyrat <[email protected]>
  * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
- * Copyright 2014, Franck Villaume - TrivialDev
+ * Copyright 2014,2016, Franck Villaume - TrivialDev
  *
  * This file is part of FusionForge.
  *
@@ -147,59 +147,33 @@ control over it to the project's administrator.");
        function widget_instance($params) {
                require_once 'common/widget/WidgetLayoutManager.class.php';
 
-               $user = UserManager::instance()->getCurrentUser();
-
-               // MY
-//             if ($params['widget'] == 'plugin_hudson_my_jobs') {
-//                     require_once('hudson_Widget_MyMonitoredJobs.class.php');
-//                     $params['instance'] = new 
hudson_Widget_MyMonitoredJobs($this);
-//             }
-//             if ($params['widget'] == 'plugin_hudson_my_joblastbuilds') {
-//                     require_once('hudson_Widget_JobLastBuilds.class.php');
-//                     $params['instance'] = new 
hudson_Widget_JobLastBuilds(WidgetLayoutManager::OWNER_TYPE_USER, 
$user->getId());
-//             }
-//             if ($params['widget'] == 'plugin_hudson_my_jobtestresults') {
-//                     require_once('hudson_Widget_JobTestResults.class.php');
-//                     $params['instance'] = new 
hudson_Widget_JobTestResults(WidgetLayoutManager::OWNER_TYPE_USER, 
$user->getId());
-//             }
-//             if ($params['widget'] == 'plugin_hudson_my_jobtesttrend') {
-//                     require_once('hudson_Widget_JobTestTrend.class.php');
-//                     $params['instance'] = new 
hudson_Widget_JobTestTrend(WidgetLayoutManager::OWNER_TYPE_USER, 
$user->getId());
-//             }
-//             if ($params['widget'] == 'plugin_hudson_my_jobbuildhistory') {
-//                     require_once('hudson_Widget_JobBuildHistory.class.php');
-//                     $params['instance'] = new 
hudson_Widget_JobBuildHistory(WidgetLayoutManager::OWNER_TYPE_USER, 
$user->getId());
-//             }
-//             if ($params['widget'] == 'plugin_hudson_my_joblastartifacts') {
-//                     
require_once('hudson_Widget_JobLastArtifacts.class.php');
-//                     $params['instance'] = new 
hudson_Widget_JobLastArtifacts(WidgetLayoutManager::OWNER_TYPE_USER, 
$user->getId());
-//             }
-
                // PROJECT
                if ($params['widget'] == 'plugin_blocks_project_summary') {
                        require_once 'blocks_Widget_ProjectSummary.class.php';
                        $params['instance'] = new 
blocks_Widget_ProjectSummary(WidgetLayoutManager::OWNER_TYPE_GROUP, 
$GLOBALS['group_id']);
                }
-       }
-       function widgets($params) {
-               $group = group_get_object($GLOBALS['group_id']);
-               if ( !$group || !$group->usesPlugin ( $this->name ) ) {
-                       return false;
+               // FORGE HOMEPAGE
+               if ($params['widget'] == 'plugin_blocks_home_summary') {
+                       require_once 'blocks_Widget_HomeSummary.class.php';
+                       $params['instance'] = new 
blocks_Widget_HomeSummary(WidgetLayoutManager::OWNER_TYPE_HOME, 0);
                }
 
-               require_once 'common/widget/WidgetLayoutManager.class.php';
-//             if ($params['owner_type'] == 
WidgetLayoutManager::OWNER_TYPE_USER) {
-//                     $params['codendi_widgets'][] = 'plugin_hudson_my_jobs';
-//                     $params['codendi_widgets'][] = 
'plugin_hudson_my_joblastbuilds';
-//                     $params['codendi_widgets'][] = 
'plugin_hudson_my_jobtestresults';
-//                     $params['codendi_widgets'][] = 
'plugin_hudson_my_jobtesttrend';
-//                     $params['codendi_widgets'][] = 
'plugin_hudson_my_jobbuildhistory';
-//                     $params['codendi_widgets'][] = 
'plugin_hudson_my_joblastartifacts';
-//             }
+
+       }
+       function widgets($params) {
                if ($params['owner_type'] == 
WidgetLayoutManager::OWNER_TYPE_GROUP) {
-                       $params['codendi_widgets'][] = 
'plugin_blocks_project_summary';
+                       $group = group_get_object($GLOBALS['group_id']);
+                       if ( !$group || !$group->usesPlugin ( $this->name ) ) {
+                               return false;
+                       }
+                       require_once 
'common/widget/WidgetLayoutManager.class.php';
+                       $params['fusionforge_widgets'][] = 
'plugin_blocks_project_summary';
+                       return true;
+               } else if ($params['owner_type'] == 
WidgetLayoutManager::OWNER_TYPE_HOME) {
+                       $params['fusionforge_widgets'][] = 
'plugin_blocks_home_summary';
+                       return true;
                }
-               return true;
+               return false;
        }
 }
 
diff --git a/src/plugins/blocks/common/blocks_Widget_HomeSummary.class.php 
b/src/plugins/blocks/common/blocks_Widget_HomeSummary.class.php
new file mode 100644
index 0000000..269525d
--- /dev/null
+++ b/src/plugins/blocks/common/blocks_Widget_HomeSummary.class.php
@@ -0,0 +1,138 @@
+<?php
+/**
+ * Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights 
reserved
+ * Copyright 2016, Franck Villaume - TrivialDev
+ *
+ * This file is a part of Codendi.
+ *
+ * Codendi 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.
+ *
+ * Codendi 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 Codendi. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+require_once 'common/include/HTTPRequest.class.php';
+
+class blocks_Widget_HomeSummary extends Widget {
+       var $title = '';
+       var $content = '';
+
+       function blocks_Widget_HomeSummary($owner_type, $owner_id) {
+               $request =& HTTPRequest::instance();
+               if ($owner_type == WidgetLayoutManager::OWNER_TYPE_HOME) {
+                       $this->widget_id = 'plugin_blocks_home_summary';
+                       $this->group_id = $owner_id;
+               }
+               $this->Widget($this->widget_id);
+               $this->setOwner($owner_id, $owner_type);
+
+       }
+
+       function getTitle() {
+               return ($this->title ? $this->title : _('Summary Page block of 
text'));
+       }
+
+       function getDescription() {
+               return _("Add a free block on the forge homepage to allow 
giving information.");
+       }
+
+       function isUnique() {
+               return false;
+       }
+       function hasPreferences() {
+               return true;
+       }
+       private function getPartialPreferencesForm($title, $content) {
+               $prefs  = '<table>';
+               $prefs .= '<tr><td>'._('Title')._(':').'</td>';
+               $prefs .= '<td><input type="text" class="textfield_medium" 
name="title" value="'. htmlspecialchars($title) .'" /></td></tr>';
+               $prefs .= '<tr><td>'._('Content')._(':').'</td>';
+
+               $params['body'] = $content;
+               $params['width'] = "500";
+               $params['height'] = "250";
+               $params['group'] = $this->group_id;
+               $params['toolbar'] = 'FusionForge-Basic';
+               $params['content'] = '<textarea name="body"  rows="10" 
cols="55">'.$content.'</textarea>';
+               plugin_hook_by_reference("text_editor", $params);
+               $prefs .= '<td>'.$params['content'].'</td></tr>';
+               $prefs .= '</table>';
+               return $prefs;
+       }
+
+       function getPreferences() {
+               return $this->getPartialPreferencesForm($this->getTitle(), 
$this->getContent());
+       }
+
+       function getInstallPreferences() {
+               return $this->getPartialPreferencesForm(_("Enter title of 
block"), '');
+       }
+       function updatePreferences(&$request) {
+               $done = false;
+               $vContentId = new Valid_UInt('content_id');
+               $vContentId->required();
+               if ($request->valid($vContentId)) {
+                       $vTitle = new Valid_String('title');
+                       if($request->valid($vTitle)) {
+                               $title = 
htmlspecialchars($request->get('title'));
+                       } else {
+                               $title = '';
+                       }
+
+                       $vContent = new Valid_Text('body');
+                       $vContent->required();
+                       if($request->valid($vContent)) {
+                               $content = $request->get('body');
+                               if (getStringFromRequest('_body_content_type') 
== 'html') {
+                                       $content = 
TextSanitizer::purify($content);
+                               } else {
+                                       $content = htmlspecialchars($content);
+                               }
+                       } else {
+                               $content = '';
+                       }
+
+                       if ($content) {
+                               $sql = "UPDATE plugin_blocks SET title=$1, 
content=$2 WHERE group_id =$3 AND id = $4";
+                               $res = 
db_query_params($sql,array($title,$content,$this->group_id,(int)$request->get('content_id')));
+                               $done = true;
+                       }
+               }
+               return $done;
+       }
+
+       function loadContent($id) {
+               $this->title = 
plugin_get_object('blocks')->getTitleBlock('summary_block'.$id);
+               $this->content = 
plugin_get_object('blocks')->getContentBlock('summary_block'.$id);
+               $this->content_id = $id;
+       }
+
+       function create(&$request) {
+               $title = getStringFromRequest('title');
+               $content = getStringFromRequest('body');
+               $res = db_query_params('INSERT INTO plugin_blocks (group_id, 
name, status, title, content)
+                       VALUES ($1, $2, 1, $3, $4)',
+                       array($this->owner_id, 'summary_block?', $title, 
$content));
+               $content_id = db_insertid($res, 'plugin_blocks', 'id');
+               $res = db_query_params('UPDATE plugin_blocks SET name=$1 WHERE 
id=$2',
+                       array('summary_block'.$content_id, $content_id));
+               return $content_id;
+       }
+
+       function getContent() {
+               return $this->content;
+       }
+
+       function destroy($id) {
+               $sql = 'DELETE FROM plugin_blocks WHERE id = $1 AND group_id = 
$2';
+               db_query_params($sql,array($id,$this->group_id));
+       }
+}
diff --git a/src/www/widgets/widget.php b/src/www/widgets/widget.php
index 6002c14..5128667 100644
--- a/src/www/widgets/widget.php
+++ b/src/www/widgets/widget.php
@@ -1,6 +1,7 @@
 <?php
 /**
  * http://fusionforge.org
+ * Copyright 2016, Franck Villaume - TrivialDev
  *
  * This file is part of FusionForge. FusionForge is free software;
  * you can redistribute it and/or modify it under the terms of the
@@ -39,22 +40,27 @@ if ($request->valid($vOwner)) {
        $owner_type = substr($owner, 0, 1);
        switch($owner_type) {
                case WidgetLayoutManager::OWNER_TYPE_USER:
-               $owner_id = user_getid();
-               $redirect = '/my/';
-               $good = true;
-               break;
-               case WidgetLayoutManager::OWNER_TYPE_GROUP:
-               $pm = ProjectManager::instance();
-               if ($project = $pm->getProject($owner_id)) {
-                       $group_id = $owner_id;
-                       $_REQUEST['group_id'] = $_GET['group_id'] = $group_id;
-                       $request->params['group_id'] = $group_id; //bad!
-                       $redirect = '/projects/'. $project->getUnixName();
+                       $owner_id = user_getid();
+                       $redirect = '/my/';
                        $good = true;
-               }
-               break;
+                       break;
+               case WidgetLayoutManager::OWNER_TYPE_GROUP:
+                       $pm = ProjectManager::instance();
+                       if ($project = $pm->getProject($owner_id)) {
+                               $group_id = $owner_id;
+                               $_REQUEST['group_id'] = $_GET['group_id'] = 
$group_id;
+                               $request->params['group_id'] = $group_id; //bad!
+                               $redirect = '/projects/'. 
$project->getUnixName();
+                               $good = true;
+                       }
+                       break;
+               case WidgetLayoutManager::OWNER_TYPE_HOME:
+                       if (forge_check_global_perm('forge_admin')) {
+                               $good = true;
+                       }
+                       break;
                default:
-               break;
+                       break;
        }
        if ($good) {
                if ($request->exist('name')) {

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

Summary of changes:
 src/common/widget/Widget.class.php                 |  6 +-
 ...d.class.php => Widget_HomeLatestNews.class.php} |  9 ++-
 src/common/widget/Widget_HomeTagCloud.class.php    | 11 +++-
 src/plugins/blocks/common/blocksPlugin.class.php   | 64 +++++++---------------
 ...ass.php => blocks_Widget_HomeSummary.class.php} | 36 ++++++------
 src/www/widgets/widget.php                         | 34 +++++++-----
 6 files changed, 76 insertions(+), 84 deletions(-)
 copy src/common/widget/{Widget_HomeTagCloud.class.php => 
Widget_HomeLatestNews.class.php} (81%)
 copy src/plugins/blocks/common/{blocks_Widget_ProjectSummary.class.php => 
blocks_Widget_HomeSummary.class.php} (84%)


hooks/post-receive
-- 
FusionForge

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

Reply via email to