[Fusionforge-commits] FusionForge branch master updated. a99ce5ea521c68b59800c27a35c4975f685c85bf

Franck VILLAUME nerville at fusionforge.org
Sun Dec 16 17:37:06 CET 2012


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  a99ce5ea521c68b59800c27a35c4975f685c85bf (commit)
       via  6b6e1c6e650a2746f7efc05195ae1f357fb81568 (commit)
       via  9d0b5c8eb3c2a54b37c14f371ce3c28f73ffce92 (commit)
       via  2f7bdb0a78f5193e90fae4d1122f2c04f490a026 (commit)
       via  0bc318b6ab272a3d05343dad25254da60f6df06a (commit)
      from  7004616e727238568962ac59cf125ff55804fbaf (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 -----------------------------------------------------------------
commit a99ce5ea521c68b59800c27a35c4975f685c85bf
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sun Dec 16 17:31:20 2012 +0100

    implement docman reporting view like FRS

diff --git a/src/common/docman/Document.class.php b/src/common/docman/Document.class.php
index 35166b2..4a7817a 100644
--- a/src/common/docman/Document.class.php
+++ b/src/common/docman/Document.class.php
@@ -981,11 +981,19 @@ class Document extends Error {
 
 
 	/**
-	 * downloadUp - +1 on download column
+	 * downloadUp - insert download stats
 	 *
 	 */
 	private function downloadUp() {
-		$this->setValueinDB('download', ++$this->data_array['download']);
+		if (session_loggedin()) {
+			$s =& session_get_user();
+			$us = $s->getID();
+		} else {
+			$us=100;
+		}
+
+		$ip = getStringFromServer('REMOTE_ADDR');
+		$res = db_query_params("INSERT INTO docman_dlstats_doc (ip_address, docid, month, day, user_id) VALUES ($1, $2, $3, $4, $5)", array($ip, $this->getID(), date('Ym'), date('d'), $us));
 	}
 
 	/**
@@ -999,8 +1007,7 @@ class Document extends Error {
 	private function setValueinDB($column, $value) {
 		switch ($column) {
 			case 'stateid':
-			case 'doc_group':
-			case 'download': {
+			case 'doc_group': {
 				$qpa = db_construct_qpa();
 				$qpa = db_construct_qpa($qpa, 'UPDATE doc_data SET ');
 				$qpa = db_construct_qpa($qpa, $column);
diff --git a/src/common/docman/views/admin.php b/src/common/docman/views/admin.php
index 95e410b..35c453a 100644
--- a/src/common/docman/views/admin.php
+++ b/src/common/docman/views/admin.php
@@ -29,7 +29,7 @@
 global $g; //group object
 global $group_id; // id of the group
 
-if ( !forge_check_perm ('docman', $group_id, 'admin')) {
+if ( !forge_check_perm('docman', $group_id, 'admin')) {
 	$return_msg= _('Document Manager Access Denied');
 	session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
 }
diff --git a/src/common/docman/views/menu.php b/src/common/docman/views/menu.php
index ae270c3..36223df 100644
--- a/src/common/docman/views/menu.php
+++ b/src/common/docman/views/menu.php
@@ -67,6 +67,9 @@ if (forge_check_perm('docman', $group_id, 'admin')) {
 	$menu_text[] = _('Admin');
 	$menu_links[] = '/docman/?group_id='.$group_id.'&view=admin';
 	$menu_attr[] = array('title' => _('Docman module administration.'), 'id' => 'adminDocmanMenu', 'class' => 'tabtitle');
+	$menu_text[] = _('Reports');
+	$menu_links[] = '/docman/?group_id='.$group_id.'&view=reporting';
+	$menu_attr[] = array('title' => _('Docman module reporting.'), 'id' => 'reportDocmanMenu', 'class' => 'tabtitle');
 }
 
 if (count($menu_text)) {
diff --git a/src/common/docman/views/reporting.php b/src/common/docman/views/reporting.php
index 810f8c9..14dff49 100644
--- a/src/common/docman/views/reporting.php
+++ b/src/common/docman/views/reporting.php
@@ -47,6 +47,7 @@
 global $HTML; // html object
 global $d_arr; // document array
 global $group_id; // id of group
+global $g; // the group object
 
 if ( !forge_check_perm('docman', $group_id, 'admin')) {
 	$return_msg= _('Document Manager Access Denied');
@@ -149,13 +150,17 @@ if (count($data) == 0) {
 		});'."\n";
 	echo '//]]></script>';
 	echo '<div id="chart1"></div>';
-	echo $HTML->listTableTop(array(_('Path'), _('File'), _('User'), _('Date')), false, true, 'Download');
+	$tabletop = array(_('Path'), _('File'), _('User'), _('Date'));
+	$classth = array('', '', '', '');
+	echo $HTML->listTableTop($tabletop, false, 'sortable_docman_listfile', 'sortable', $classth);
 	for ($i=0; $i<count($data); $i++) {
 		$date = preg_replace('/^(....)(..)(..)$/', '\1-\2-\3', $data[$i][2]);
+		$ndg = new DocumentGroup($g, $data[$i][4]);
+		$path = $ndg->getPath(true);
 		echo '<tr '. $HTML->boxGetAltRowStyle($i) .'>'.
-			'<td>PATH</td>'.
+			'<td>'.$path.'</td>'.
 			'<td>'. $data[$i][0] .'</td>'.
-			'<td><a href="/users/'.urlencode($data[$i][3]).'/">'. $data[$i][1] .'</a></td>'.
+			'<td><a class="tabtitle" title="'._('View user profile').'" href="/users/'.urlencode($data[$i][3]).'/">'. $data[$i][1] .'</a></td>'.
 			'<td class="align-center">'. $date .'</td></tr>';
 	}
 	echo $HTML->listTableBottom();
diff --git a/src/common/docman/views/views.php b/src/common/docman/views/views.php
index 69fe312..97e4a7c 100644
--- a/src/common/docman/views/views.php
+++ b/src/common/docman/views/views.php
@@ -3,6 +3,7 @@
  * FusionForge Documentation Manager
  *
  * Copyright 2010-2011, Franck Villaume - Capgemini
+ * Copyright 2012, Franck Villaume - TrivialDev
  * http://fusionforge.org
  *
  * This file is part of FusionForge. FusionForge is free software;
@@ -33,6 +34,7 @@ switch ($view) {
 	case 'editfile':
 	case 'listfile':
 	case 'listtrashfile':
+	case 'reporting':
 	case 'search': {
 		include ($gfcommon.'docman/views/'.$view.'.php');
 		break;
diff --git a/src/common/reporting/ReportPerGroupDocmanDownloads.class.php b/src/common/reporting/ReportPerGroupDocmanDownloads.class.php
index 0d52693..0ad469e 100644
--- a/src/common/reporting/ReportPerGroupDocmanDownloads.class.php
+++ b/src/common/reporting/ReportPerGroupDocmanDownloads.class.php
@@ -72,7 +72,8 @@ class ReportPerGroupDocmanDownloads extends Report {
 
 		$res = db_query_params ('SELECT docdata_vw.filename, docdata_vw.realname,
 					docman_dlstats_doc.month || lpad(docman_dlstats_doc.day::text,2,0::text),
-					docdata_vw.user_name
+					docdata_vw.user_name,
+					docdata_vw.doc_group
 					FROM docman_dlstats_doc, docdata_vw
 					WHERE docdata_vw.group_id = $1
 					AND docman_dlstats_doc.month >= $2
diff --git a/src/db/20121209-docman-stats.sql b/src/db/20121209-docman-stats.sql
index c1f15a8..59188d4 100644
--- a/src/db/20121209-docman-stats.sql
+++ b/src/db/20121209-docman-stats.sql
@@ -14,4 +14,50 @@ CREATE TABLE docman_dlstats_doctotal_agg (
 CREATE RULE docman_dlstats_doc_rule AS ON INSERT TO docman_dlstats_doc DO UPDATE docman_dlstats_doctotal_agg SET downloads = (docman_dlstats_doctotal_agg.downloads + 1) WHERE (docman_dlstats_doctotal_agg.docid = new.docid);
 
 INSERT INTO docman_dlstats_doctotal_agg (docid, downloads) SELECT doc_data.docid, doc_data.download FROM doc_data;
+DROP VIEW activity_vw;
+DROP VIEW docdata_vw;
+CREATE VIEW docdata_vw AS
+SELECT users.user_name, users.realname, users.email, d.group_id, d.docid, d.stateid, d.title, d.updatedate, d.createdate, d.created_by, d.doc_group, d.description, docman_dlstats_doctotal_agg.downloads AS download, d.filename, d.filetype, d.filesize, d.reserved, d.reserved_by, d.locked, d.locked_by, d.lockdate, doc_states.name AS state_name, doc_groups.groupname AS group_name FROM doc_data d, users, doc_groups, doc_states, docman_dlstats_doctotal_agg where d.created_by = users.user_id and doc_groups.doc_group = d.doc_group and doc_states.stateid = d.stateid and d.docid = docman_dlstats_doctotal_agg.docid;
+
+CREATE OR REPLACE VIEW activity_vw AS
+SELECT
+agl.group_id, 'trackeropen'::text AS section, agl.group_artifact_id AS ref_id,
+a.artifact_id as subref_id, a.summary as description, a.open_date AS activity_date, u.user_id, u.user_name, u.realname
+FROM artifact_group_list agl JOIN artifact a using (group_artifact_id),
+users u WHERE u.user_id=a.submitted_by
+UNION
+SELECT
+agl.group_id, 'trackerclose'::text AS section, agl.group_artifact_id AS ref_id,
+a.artifact_id as subref_id, a.summary as description, a.close_date AS activity_date, u.user_id, u.user_name, u.realname
+FROM artifact_group_list agl JOIN artifact a using (group_artifact_id), users u WHERE u.user_id=a.assigned_to
+--actually should join against
+AND a.close_date > 0
+UNION
+SELECT
+frsp.group_id, 'frsrelease'::text as section,frsp.package_id as ref_id,
+frsr.release_id as subref_id, frsr.name AS description, frsr.release_date AS activity_date,
+u.user_id, u.user_name, u.realname FROM frs_package frsp JOIN frs_release frsr USING (package_id), users u WHERE
+u.user_id=frsr.released_by
+UNION
+SELECT
+fgl.group_id, 'forumpost'::text as section,fgl.group_forum_id as ref_id, forum.msg_id
+as subref_id, forum.subject AS description, forum.post_date AS activity_date, u.user_id,
+u.user_name, u.realname FROM forum_group_list fgl JOIN forum USING (group_forum_id), users u WHERE
+u.user_id=forum.posted_by
+UNION
+SELECT group_id, 'docmannew'::text AS section, doc_group AS ref_id, docid AS subref_id,
+filename AS description, createdate AS activity_date, created_by as user_id,
+user_name, realname FROM docdata_vw
+UNION
+SELECT group_id, 'docmanupdate'::text AS section, doc_group AS ref_id, docid AS subref_id,
+filename AS description, updatedate AS activity_date, created_by as user_id,
+user_name, realname FROM docdata_vw
+UNION
+SELECT doc_groups.group_id, 'docgroupnew'::text AS section, doc_groups.parent_doc_group AS ref_id, doc_groups.doc_group AS subref_id,
+doc_groups.groupname AS description,  doc_groups.createdate AS activity_date, doc_groups.created_by as user_id,
+users.user_name, users.realname FROM doc_groups, users WHERE doc_groups.created_by = users.user_id
+UNION
+SELECT news_bytes.group_id,'news' AS section,news_bytes.id AS ref_id,news_bytes.forum_id AS subref_id,
+news_bytes.summary AS description, news_bytes.post_date AS activity_date, u.user_id, u.user_name, u.realname
+FROM news_bytes, users u WHERE u.user_id = news_bytes.submitted_by;
 ALTER TABLE doc_data DROP download;
diff --git a/src/www/docman/index.php b/src/www/docman/index.php
index 6f47715..c866171 100644
--- a/src/www/docman/index.php
+++ b/src/www/docman/index.php
@@ -35,6 +35,9 @@ require_once $gfcommon.'docman/DocumentGroupFactory.class.php';
 require_once $gfcommon.'docman/include/DocumentGroupHTML.class.php';
 require_once $gfcommon.'docman/include/utils.php';
 require_once $gfcommon.'include/TextSanitizer.class.php'; // to make the HTML input by the user safe to store
+require_once $gfcommon.'reporting/report_utils.php';
+require_once $gfcommon.'reporting/ReportPerGroupDocmanDownloads.class.php';
+require_once $gfwww.'include/html.php';
 
 /* are we using docman ? */
 if (!forge_get_config('use_docman'))

commit 6b6e1c6e650a2746f7efc05195ae1f357fb81568
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sun Dec 16 17:29:26 2012 +0100

    implement docman reporting view like FRS

diff --git a/src/common/docman/views/reporting.php b/src/common/docman/views/reporting.php
new file mode 100644
index 0000000..810f8c9
--- /dev/null
+++ b/src/common/docman/views/reporting.php
@@ -0,0 +1,165 @@
+<?php
+/**
+ * Copyright (C) 2009-2012 Alain Peyrat, Alcatel-Lucent
+ * Copyright 2012, Franck Villaume - TrivialDev
+ * http://fusionforge.org
+ *
+ * This file is 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 Licence, 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, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/**
+ * Standard Alcatel-Lucent disclaimer for contributing to open source
+ *
+ * "The program ("Contribution") has not been tested and/or
+ * validated for release as or in products, combinations with products or
+ * other commercial use. Any use of the Contribution is entirely made at
+ * the user's own responsibility and the user can not rely on any features,
+ * functionalities or performances Alcatel-Lucent has attributed to the
+ * Contribution.
+ *
+ * THE CONTRIBUTION BY ALCATEL-LUCENT IS PROVIDED AS IS, WITHOUT WARRANTY
+ * OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, COMPLIANCE,
+ * NON-INTERFERENCE AND/OR INTERWORKING WITH THE SOFTWARE TO WHICH THE
+ * CONTRIBUTION HAS BEEN MADE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * ALCATEL-LUCENT BE LIABLE FOR ANY DAMAGES OR OTHER LIABLITY, WHETHER IN
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * CONTRIBUTION OR THE USE OR OTHER DEALINGS IN THE CONTRIBUTION, WHETHER
+ * TOGETHER WITH THE SOFTWARE TO WHICH THE CONTRIBUTION RELATES OR ON A STAND
+ * ALONE BASIS."
+ */
+
+/* please do not add require here : use www/docman/index.php to add require */
+/* global variables used */
+global $HTML; // html object
+global $d_arr; // document array
+global $group_id; // id of group
+
+if ( !forge_check_perm('docman', $group_id, 'admin')) {
+	$return_msg= _('Document Manager Access Denied');
+	session_redirect('/docman/?group_id='.$group_id.'&warning_msg='.urlencode($return_msg));
+}
+
+$start = getIntFromRequest('start');
+$end = getIntFromRequest('end');
+
+$report = new Report();
+if ($report->isError()) {
+	exit_error($report->getErrorMessage(), 'docman');
+}
+
+if (!$start || !$end) $z =& $report->getMonthStartArr();
+
+if (!$start) {
+	$start = $z[0];
+}
+
+if (!$end) {
+	$end = $z[ count($z)-1 ];
+}
+if ($end < $start) list($start, $end) = array($end, $start);
+
+html_use_jqueryjqplotpluginCanvas();
+echo $HTML->getJavascripts();
+echo $HTML->getStylesheets();
+
+
+$report = new ReportPerGroupDocmanDownloads($group_id, $start, $end);
+if ($report->isError()) {
+	echo '<p class="information">'.$report->getErrorMessage().'</p>';
+} else {
+?>
+
+<form action="<?php echo util_make_url('/docman/') ?>" method="get">
+<input type="hidden" name="group_id" value="<?php echo $group_id; ?>" />
+<input type="hidden" name="view" value="reporting" />
+<table><tr>
+<td><strong><?php echo _('Start'); ?>:</strong><br />
+<?php echo report_months_box($report, 'start', $start); ?></td>
+<td><strong><?php echo _('End'); ?>:</strong><br />
+<?php echo report_months_box($report, 'end', $end); ?></td>
+<td><input type="submit" name="submit" value="<?php echo _('Refresh'); ?>" /></td>
+</tr></table>
+</form>
+
+<?php
+
+$data = $report->getData();
+
+if (count($data) == 0) {
+	echo '<p class="information">';
+	echo _('There have been no documents for this project.');
+	echo '</p>';
+} else {
+	echo '<script type="text/javascript">//<![CDATA['."\n";
+	echo 'var ticks = new Array();';
+	echo 'var values = new Array();';
+	$arr =& $report->getMonthStartArr();
+	$arr2 = array();
+	$valuesArr = array();
+	for ($i=0; $i < count($arr); $i++) {
+		if ($arr[$i] >= $start && $arr[$i] <= $end) {
+			$arr2[$i] = date(_('Y-m'), $arr[$i]);
+			$valuesArr[$i] = 0;
+		}
+	}
+	foreach ($arr2 as $key) {
+		echo 'ticks.push("'.$key.'");';
+	}
+	for ($i=0; $i < count($data); $i++) {
+		$thisdate = date(_('Y-m'), mktime(0, 0, 0, substr($data[$i][2], 4, 2), 0, substr($data[$i][2], 0, 4)));
+		$indexkey = array_search($thisdate, $arr2);
+		$valuesArr[$indexkey]++;
+	}
+	foreach ($valuesArr as $key) {
+		echo 'values.push('.$key.');';
+	}
+	echo 'var plot1;';
+	echo 'jQuery(document).ready(function(){
+			plot1 = jQuery.jqplot (\'chart1\', [values], {
+					axes: {
+						xaxis: {
+							label: "'._('Month').'",
+							renderer: jQuery.jqplot.CategoryAxisRenderer,
+							ticks: ticks,
+							pad: 0,
+						},
+						yaxis: {
+							label: "'._('Download').'",
+							padMin: 0,
+						}
+					}
+				});
+		});';
+	echo 'jQuery(window).resize(function() {
+			plot1.replot( { resetAxes: true } );
+		});'."\n";
+	echo '//]]></script>';
+	echo '<div id="chart1"></div>';
+	echo $HTML->listTableTop(array(_('Path'), _('File'), _('User'), _('Date')), false, true, 'Download');
+	for ($i=0; $i<count($data); $i++) {
+		$date = preg_replace('/^(....)(..)(..)$/', '\1-\2-\3', $data[$i][2]);
+		echo '<tr '. $HTML->boxGetAltRowStyle($i) .'>'.
+			'<td>PATH</td>'.
+			'<td>'. $data[$i][0] .'</td>'.
+			'<td><a href="/users/'.urlencode($data[$i][3]).'/">'. $data[$i][1] .'</a></td>'.
+			'<td class="align-center">'. $date .'</td></tr>';
+	}
+	echo $HTML->listTableBottom();
+}
+
+}
+ 
diff --git a/src/common/reporting/ReportPerGroupDocmanDownloads.class.php b/src/common/reporting/ReportPerGroupDocmanDownloads.class.php
new file mode 100644
index 0000000..0d52693
--- /dev/null
+++ b/src/common/reporting/ReportPerGroupDocmanDownloads.class.php
@@ -0,0 +1,106 @@
+<?php
+/**
+ * FusionForge reporting system
+ *
+ * Copyright (C) 2009 Alain Peyrat, Alcatel-Lucent
+ * Copyright 2009, Roland Mas
+ * Copyright 2012, Franck Villaume
+ * http://fusionforge.org
+ *
+ * This file is 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 Licence, 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, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/**
+ * Standard Alcatel-Lucent disclaimer for contributing to open source
+ *
+ * "The class ("Contribution") has not been tested and/or
+ * validated for release as or in products, combinations with products or
+ * other commercial use. Any use of the Contribution is entirely made at
+ * the user's own responsibility and the user can not rely on any features,
+ * functionalities or performances Alcatel-Lucent has attributed to the
+ * Contribution.
+ *
+ * THE CONTRIBUTION BY ALCATEL-LUCENT IS PROVIDED AS IS, WITHOUT WARRANTY
+ * OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, COMPLIANCE,
+ * NON-INTERFERENCE AND/OR INTERWORKING WITH THE SOFTWARE TO WHICH THE
+ * CONTRIBUTION HAS BEEN MADE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * ALCATEL-LUCENT BE LIABLE FOR ANY DAMAGES OR OTHER LIABLITY, WHETHER IN
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * CONTRIBUTION OR THE USE OR OTHER DEALINGS IN THE CONTRIBUTION, WHETHER
+ * TOGETHER WITH THE SOFTWARE TO WHICH THE CONTRIBUTION RELATES OR ON A STAND
+ * ALONE BASIS."
+ */
+
+require_once $gfcommon.'reporting/Report.class.php';
+
+class ReportPerGroupDocmanDownloads extends Report {
+
+	function __construct($group_id, $start = 0, $end = 0) {
+		$this->Report();
+
+		if (!$start) {
+			$start = mktime(0, 0, 0, date('m'), 1, date('Y'));
+		}
+		if (!$end) {
+			$end = time();
+		} else {
+			$end--;
+		}
+
+		// Convert start & end date to month .
+		$start_m = date('Ym', $start);
+		$end_m = date('Ym', $end);
+
+		if (!$group_id) {
+			$this->setError(_('No group_id set.'));
+			return false;
+		}
+
+		$res = db_query_params ('SELECT docdata_vw.filename, docdata_vw.realname,
+					docman_dlstats_doc.month || lpad(docman_dlstats_doc.day::text,2,0::text),
+					docdata_vw.user_name
+					FROM docman_dlstats_doc, docdata_vw
+					WHERE docdata_vw.group_id = $1
+					AND docman_dlstats_doc.month >= $2
+					AND docman_dlstats_doc.month <= $3
+					ORDER BY docman_dlstats_doc.month DESC,
+					docman_dlstats_doc.day DESC',
+					array ($group_id,
+					       $start_m,
+					       $end_m));
+
+		$this->start_date = $start;
+		$this->end_date = $end;
+
+		if (!$res || db_error()) {
+			$this->setError('ReportUserAct:: '.db_error());
+			return false;
+		}
+		
+		$rows = db_numrows($res);
+		$arr = array();
+		$i = 0;
+		if ($rows > 0) {
+			while ($row = db_fetch_array($res)) {
+				$arr[$i++] = $row;
+			}
+		}
+
+		$this->data =& $arr;
+		return true;
+	}
+}

commit 9d0b5c8eb3c2a54b37c14f371ce3c28f73ffce92
Merge: 2f7bdb0 7004616
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sat Dec 15 13:58:26 2012 +0100

    Merge branch 'master' into docman


commit 2f7bdb0a78f5193e90fae4d1122f2c04f490a026
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sat Dec 15 13:58:24 2012 +0100

    remove useless db column

diff --git a/src/db/20121209-docman-stats.sql b/src/db/20121209-docman-stats.sql
new file mode 100644
index 0000000..c1f15a8
--- /dev/null
+++ b/src/db/20121209-docman-stats.sql
@@ -0,0 +1,17 @@
+CREATE TABLE docman_dlstats_doc (
+	ip_address	text,
+	docid		integer REFERENCES doc_data(docid) ON UPDATE CASCADE ON DELETE CASCADE,
+	month		integer,
+	day		integer,
+	user_id		integer REFERENCES users(user_id) ON UPDATE CASCADE ON DELETE CASCADE
+);
+
+CREATE TABLE docman_dlstats_doctotal_agg (
+	docid		integer REFERENCES doc_data(docid) ON UPDATE CASCADE ON DELETE CASCADE,
+	downloads	integer
+);
+
+CREATE RULE docman_dlstats_doc_rule AS ON INSERT TO docman_dlstats_doc DO UPDATE docman_dlstats_doctotal_agg SET downloads = (docman_dlstats_doctotal_agg.downloads + 1) WHERE (docman_dlstats_doctotal_agg.docid = new.docid);
+
+INSERT INTO docman_dlstats_doctotal_agg (docid, downloads) SELECT doc_data.docid, doc_data.download FROM doc_data;
+ALTER TABLE doc_data DROP download;

commit 0bc318b6ab272a3d05343dad25254da60f6df06a
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sun Dec 9 16:57:19 2012 +0100

    indent

diff --git a/src/common/docman/views/listfile.php b/src/common/docman/views/listfile.php
index a8cc216..f4af0d2 100644
--- a/src/common/docman/views/listfile.php
+++ b/src/common/docman/views/listfile.php
@@ -93,7 +93,7 @@ $d_arr_private =& $df->getDocuments();
 if ($d_arr != NULL && $d_arr_private != NULL) {
 	$d_arr = array_merge($d_arr, $d_arr_private);
 } elseif ($d_arr_private != NULL) {
-		$d_arr = $d_arr_private;
+	$d_arr = $d_arr_private;
 }
 
 $nested_groups = $dgf->getNested();

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

Summary of changes:
 src/common/docman/Document.class.php               |   15 +++-
 src/common/docman/views/admin.php                  |    2 +-
 src/common/docman/views/listfile.php               |    2 +-
 src/common/docman/views/menu.php                   |    3 +
 .../docman/views/reporting.php}                    |   87 ++++++++------------
 src/common/docman/views/views.php                  |    2 +
 ...php => ReportPerGroupDocmanDownloads.class.php} |   67 ++++++---------
 ...ta-statistics.sql => 20121209-docman-stats.sql} |   22 ++++-
 src/www/docman/index.php                           |    3 +
 9 files changed, 99 insertions(+), 104 deletions(-)
 copy src/{www/frs/reporting/downloads.php => common/docman/views/reporting.php} (70%)
 copy src/common/reporting/{ReportDownloads.class.php => ReportPerGroupDocmanDownloads.class.php} (61%)
 copy src/db/{20120714-docman-docdata-statistics.sql => 20121209-docman-stats.sql} (64%)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list