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  18e52843542240a26a4db57fc29abc4f0a849fa4 (commit)
       via  bacb817bfd1c78bc4e297b9234d248024ede9670 (commit)
      from  7528b06306b8bc504d7eb91e4f36ce6eee2462af (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=18e52843542240a26a4db57fc29abc4f0a849fa4

commit 18e52843542240a26a4db57fc29abc4f0a849fa4
Author: Franck Villaume <[email protected]>
Date:   Sun May 5 21:21:58 2019 +0200

    start implement access to blog archives

diff --git a/src/common/diary/DiaryNoteFactory.class.php 
b/src/common/diary/DiaryNoteFactory.class.php
index af9922a..798902e 100644
--- a/src/common/diary/DiaryNoteFactory.class.php
+++ b/src/common/diary/DiaryNoteFactory.class.php
@@ -50,7 +50,7 @@ class DiaryNoteFactory extends FFObject {
                $this->User =& $User;
        }
 
-       function getDiaryNoteIDs($public, $limit = 0) {
+       function getDiaryNoteIDs($public = 0, $limit = 0) {
                if (is_array($this->diarynoteids)) {
                        if ($limit) {
                                return array_slice($this->diarynoteids, 0, 
$limit);
@@ -89,8 +89,23 @@ class DiaryNoteFactory extends FFObject {
                return $this->User;
        }
 
-       function getArchivesTree($public) {
+       function getArchivesTree($public = 0) {
                global $HTML;
-               return $HTML->information(_('No archive available'));
+               $qpa = false;
+               $qpa = db_construct_qpa($qpa, 'SELECT count(id), year, month 
FROM user_diary WHERE user_id = $1', array($this->User->getID()));
+               if ($public) {
+                       $qpa = db_construct_qpa($qpa, ' AND is_public = $1', 
array($public));
+               }
+               $qpa = db_construct_qpa($qpa, ' GROUP BY year, month ORDER by 
year DESC, month DESC');
+               $res = db_query_qpa($qpa);
+               if ($res && db_numrows($res)) {
+                       $liElements = array();
+                       while ($arr = db_fetch_array($res)) {
+                               $liElements[]['content'] = 
$arr[1].'/'.$arr[2].' ('.$arr[0].')';
+                       }
+                       return $HTML->html_list($liElements);
+               } else {
+                       return $HTML->information(_('No archive available'));
+               }
        }
 }
diff --git a/src/db/20190504-diary-year-month.sql 
b/src/db/20190504-diary-year-month.sql
new file mode 100644
index 0000000..242ca1f
--- /dev/null
+++ b/src/db/20190504-diary-year-month.sql
@@ -0,0 +1,5 @@
+ALTER TABLE user_diary ADD COLUMN year integer DEFAULT 0 NOT NULL;
+ALTER TABLE user_diary ADD COLUMN month integer DEFAULT 0 NOT NULL;
+
+UPDATE user_diary SET year = extract('year' from to_timestamp(date_posted));
+UPDATE user_diary SET month = extract('month' from to_timestamp(date_posted));
diff --git a/src/www/my/diary.php b/src/www/my/diary.php
index 2f6c1a5..e73db60 100644
--- a/src/www/my/diary.php
+++ b/src/www/my/diary.php
@@ -57,7 +57,7 @@ if (!session_loggedin()) {
                                                array($summary,
                                                        $details,
                                                        $is_public,
-                                                       user_getid() ,
+                                                       user_getid(),
                                                        $diary_id));
                        if ($res && db_affected_rows($res) > 0) {
                                $feedback .= _('Diary Updated');
@@ -68,13 +68,16 @@ if (!session_loggedin()) {
                        }
                } elseif (getStringFromRequest('add')) {
                        //inserting a new diary entry
-                       $res = db_query_params ('INSERT INTO user_diary 
(user_id,date_posted,summary,details,is_public) VALUES
-                                                               
($1,$2,$3,$4,$5)',
-                                                               
array(user_getid() ,
-                                                                       time() ,
+                       $currenttime = time();
+                       $res = db_query_params('INSERT INTO user_diary 
(user_id,date_posted,summary,details,is_public, year, month) VALUES
+                                                               
($1,$2,$3,$4,$5, $6, $7)',
+                                                               
array(user_getid(),
+                                                                       
$currenttime,
                                                                        
$summary,
                                                                        
$details,
-                                                                       
$is_public));
+                                                                       
$is_public,
+                                                                       
date('Y', $currenttime),
+                                                                       
date('m', $currenttime)));
                        if ($res && db_affected_rows($res) > 0) {
                                $feedback .= _('Item Added');
                                if ($is_public) {
@@ -133,7 +136,7 @@ if (!session_loggedin()) {
                                }
                        } else {
                                
form_release_key(getStringFromRequest("form_key"));
-                               $error_msg .= _('Error Adding Item: '). 
db_error();
+                               $error_msg .= _('Error Adding Item')._(': 
').db_error();
                        }
                }
 

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

commit bacb817bfd1c78bc4e297b9234d248024ede9670
Author: Franck Villaume <[email protected]>
Date:   Sun May 5 21:21:21 2019 +0200

    fix wrong var

diff --git a/src/www/developer/diary.php b/src/www/developer/diary.php
index bb297d6..ea3d255 100644
--- a/src/www/developer/diary.php
+++ b/src/www/developer/diary.php
@@ -74,7 +74,7 @@ if ($diary_user) {
                foreach ($diaryNoteFactoryObject->getDiaryNoteIDs(1, 10) as 
$diarynoteid) {
                        $cells = array();
                        $cells[][] = 
util_make_link('/developer/diary.php?diary_id='.$diarynoteid.'&diary_user='. 
$diary_user, $diaryNoteFactoryObject->getDiaryNote($diarynoteid)->getSummary());
-                       $cells[][] = 
$diaryNoteFactoryObject->getDiaryNote($diary_id)->getDatePostedOn();
+                       $cells[][] = 
$diaryNoteFactoryObject->getDiaryNote($diarynoteid)->getDatePostedOn();
                        echo $HTML->multiTableRow(array(), $cells);
                }
                echo $HTML->listTableBottom();

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

Summary of changes:
 src/common/diary/DiaryNoteFactory.class.php | 21 ++++++++++++++++++---
 src/db/20190504-diary-year-month.sql        |  5 +++++
 src/www/developer/diary.php                 |  2 +-
 src/www/my/diary.php                        | 17 ++++++++++-------
 4 files changed, 34 insertions(+), 11 deletions(-)
 create mode 100644 src/db/20190504-diary-year-month.sql


hooks/post-receive
-- 
FusionForge

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

Reply via email to