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 cfc06aa4470616edc5cec3269edb1744368aea22 (commit)
via a2f3070b002ee0be4cf252917196e977bcc898f7 (commit)
from 6e74e53ec4b646e74107273503cde4d66aa6c2cc (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=cfc06aa4470616edc5cec3269edb1744368aea22
commit cfc06aa4470616edc5cec3269edb1744368aea22
Author: Franck Villaume <[email protected]>
Date: Sun Nov 1 16:59:15 2015 +0100
Make the paging system part of the themable Layout, use it in userlist, pm
& tracker
diff --git a/src/common/tracker/actions/browse.php
b/src/common/tracker/actions/browse.php
index a50d332..60f998f 100644
--- a/src/common/tracker/actions/browse.php
+++ b/src/common/tracker/actions/browse.php
@@ -274,16 +274,7 @@ if ($art_cnt) {
$max = 0;
}
-if (session_loggedin()) {
- echo $HTML->openForm(array('action' =>
'/tracker/?group_id='.$group_id.'&atid='.$ath->getID().'&start='.$start,
'method' => 'post'));
- printf('<p>' . _('Displaying results %1$d‒%2$d out of %3$d total.'),
$start + 1, $max, $art_cnt);
- printf(' ' . _('Displaying %2$s results.') . "\n\t<input "
.'type="submit" name="setpaging" value="%1$s" />', _('Change'),
html_build_select_box_from_array(array(10, 25, 50, 100, 1000), 'nres', $paging,
1));
- echo "</p>\n";
- echo $HTML->closeForm();
-} else {
- printf('<p>' . _('Displaying results %1$d‒%2$d out of %3$d total.'),
$start + 1, $max, $art_cnt);
- echo "</p>\n";
-}
+echo $HTML->paging_top($start, $paging, $art_cnt, $max,
'/tracker/?group_id='.$group_id.'&atid='.$ath->getID());
/**
*
@@ -693,37 +684,8 @@ if ($art_arr && $art_cnt > 0) {
if ($start < $max) {
echo $HTML->listTableBottom();
}
- $pages = $art_cnt / $paging;
- $currentpage = intval($start / $paging);
+ echo $HTML->paging_bottom($start, $paging, $art_cnt,
'/tracker/?func=browse&group_id='.$group_id.'&atid='.$ath->getID().'&set='.
$set);
- if ($start > 0) {
- echo
util_make_link('/tracker/?func=browse&group_id='.$group_id.'&atid='.$ath->getID().'&set='.
$set.'&start='.($start-$paging),'<strong>← '._('previous').'</strong>');
- echo ' ';
- }
- if ($pages > 1) {
- $skipped_pages=false;
- for ($j=0; $j<$pages; $j++) {
- if ($pages > 20) {
- if ((($j > 4) && ($j < ($currentpage-5))) ||
(($j > ($currentpage+5)) && ($j < ($pages-5)))) {
- if (!$skipped_pages) {
- $skipped_pages=true;
- echo ".... ";
- }
- continue;
- } else {
- $skipped_pages=false;
- }
- }
- if ($j * $paging == $start) {
- echo '<strong>'.($j+1).'</strong> ';
- } else {
- echo
util_make_link('/tracker/?func=browse&group_id='.$group_id.'&atid='.$ath->getID().'&set='.
$set.'&start='.($j*$paging), '<strong>'.($j+1).'</strong>').' ';
- }
- }
- }
- if ( $art_cnt > $start + $paging) {
- echo
util_make_link('/tracker/?func=browse&group_id='.$group_id.'&atid='.$ath->getID().'&set='.
$set.'&start='.($start+$paging),'<strong>'._('next').' →</strong>');
- }
echo '<div style="display:table;width:100%">';
echo '<div style="display:table-row">';
diff --git a/src/www/admin/userlist.php b/src/www/admin/userlist.php
index b80efdf..0d53d26 100644
--- a/src/www/admin/userlist.php
+++ b/src/www/admin/userlist.php
@@ -64,7 +64,7 @@ function performAction($newStatus, $statusString, $user_id) {
$feedback = sprintf(_('User updated to %s status'), $statusString);
}
-function show_users_list($users, $filter = '', $sortorder = 'realname',
$offset, $rows, $paging, $totalUsers) {
+function show_users_list($users, $filter = '', $sortorder = 'realname',
$start, $rows, $paging, $totalUsers) {
global $HTML;
echo '<p>' ._('Status')._(': ').
util_make_link('/admin/userlist.php', _('All')). '
@@ -81,16 +81,6 @@ function show_users_list($users, $filter = '', $sortorder =
'realname', $offset,
$headers = array(
_('Login'),
_('Add date'),
- ' ',
- ' ',
- ' ',
- ' ',
- ' '
- );
-
- $headerLinks = array(
- '/admin/userlist.php?sortorder=user_name'.$filter,
- '/admin/userlist.php?sortorder=add_date'.$filter,
'',
'',
'',
@@ -98,17 +88,18 @@ function show_users_list($users, $filter = '', $sortorder =
'realname', $offset,
''
);
- echo $HTML->listTableTop($headers, $headerLinks);
-
- printf('<p>' . _('Displaying results %1$s out of %2$d total.'),$rows ?
($offset + 1).'-'.($offset + $rows) : '0', $totalUsers);
+ $headerLinks = array(
+ '/admin/userlist.php?sortorder=user_name'.$filter,
+ '/admin/userlist.php?sortorder=add_date'.$filter,
+ null,
+ null,
+ null,
+ null,
+ null
+ );
- echo $HTML->openForm(array('action' =>
'/admin/userlist.php?offset='.$offset, 'method' => 'post'));
- printf(' ' . _('Displaying %2$s results.') . "\n\t<input " .
- 'type="submit" name="setpaging" value="%1$s" />' .
- "\n</p>\n", _('Change'),
- html_build_select_box_from_array(array(
- '10', '25', '50', '100', '1000'), 'nres', $paging, 1));
- echo $HTML->closeForm();
+ echo $HTML->paging_top($start, $paging, $totalUsers, $rows,
'/admin/userlist.php?sortorder='.$sortorder.$filter);
+ echo $HTML->listTableTop($headers, $headerLinks);
foreach ($users as $key => $uid) {
$cells = array();
@@ -159,43 +150,7 @@ function show_users_list($users, $filter = '', $sortorder
= 'realname', $offset,
echo $HTML->multiTableRow(array('class' =>
$HTML->boxGetAltRowStyle($key, true)), $cells);
}
echo $HTML->listTableBottom();
-
- /*
- Show extra rows for <-- Prev / Next -->
- */
- if ($offset > 0) {
- echo
util_make_link('/admin/userlist.php?offset='.($offset-$paging),'<strong>←
'._('previous').'</strong>');
- echo ' ';
- }
- $pages = $totalUsers / $paging;
- $currentpage = intval($offset / $paging);
- if ($pages > 1) {
- $skipped_pages=false;
- for ($j=0; $j<$pages; $j++) {
- if ($pages > 20) {
- if ((($j > 4) && ($j < ($currentpage-5))) ||
(($j > ($currentpage+5)) && ($j < ($pages-5)))) {
- if (!$skipped_pages) {
- $skipped_pages=true;
- echo ".... ";
- }
- continue;
- } else {
- $skipped_pages=false;
- }
- }
- if ($j * $paging == $offset) {
- echo '<strong>'.($j+1).'</strong> ';
- } else {
- echo
util_make_link('/admin/userlist.php?offset='.($j*$paging),'<strong>'.($j+1).'</strong>').' ';
- }
- }
- }
- if ( $totalUsers > $offset + $paging) {
- echo
util_make_link('/admin/userlist.php?offset='.($offset+$paging),'<strong>'._('next').'
→</strong>');
- } else {
- echo ' ';
- }
-
+ echo $HTML->paging_bottom($start, $paging, $totalUsers,
'/admin/userlist.php?sortorder='.$sortorder.$filter);
}
@@ -224,12 +179,11 @@ $action = getStringFromRequest('action');
$user_id = getIntFromRequest('user_id');
$status = getStringFromRequest('status');
$usingplugin = getStringFromRequest('usingplugin');
-$offset = getIntFromRequest('offset');
+$start = getIntFromRequest('start');
-if ($offset < 0) {
- $offset = 0 ;
+if ($start < 0) {
+ $start = 0 ;
}
-$max_rows = getIntFromRequest('max_rows');
if ($action=='delete') {
performAction('D', "DELETED", $user_id);
@@ -245,10 +199,10 @@ $HTML->header(array('title'=>_('User List')));
if ($usingplugin) {
echo html_e('h2', array(), _('Users that use plugin').' '.$usingplugin);
$res = db_query_params('SELECT u.user_id FROM plugins p, user_plugin
up, users u WHERE p.plugin_name = $1 and up.user_id = u.user_id and p.plugin_id
= up.plugin_id and users.user_id != 100 ORDER BY users.realname LIMIT $2 OFFSET
$3',
- array($usingplugin, $paging, $offset));
- $rows = db_numrows($res);
+ array($usingplugin, $paging, $start));
$totalUsers =
FusionForge::getInstance()->getNumberOfUsersUsingAPlugin($usingplugin);
- show_users_list(util_result_column_to_array($res, 0), '', 'realname',
$offset, $rows, $paging, $totalUsers);
+ $max = ($totalUsers > ($start + $paging)) ? ($start + $paging) :
$totalUsers;
+ show_users_list(util_result_column_to_array($res, 0), '', 'realname',
$start, $max, $paging, $totalUsers);
} elseif (!$group_id) {
$user_name_search = getStringFromRequest('user_name_search');
@@ -258,8 +212,7 @@ if ($usingplugin) {
if ($user_name_search) {
$res = db_query_params('SELECT user_id FROM users WHERE
lower(user_name) LIKE $1 OR lower(lastname) LIKE $1 and users.user_id != 100
ORDER BY '.$sort_order.' LIMIT $2 OFFSET $3',
- array(strtolower("$user_name_search%"),
$paging, $offset));
- $rows = db_numrows($res);
+ array(strtolower("$user_name_search%"),
$paging, $start));
$list_id = util_result_column_to_array($res, 0);
$msg = sprintf(_('User list beginning with “%s” for all
projects'), $user_name_search);
} else {
@@ -269,8 +222,7 @@ if ($usingplugin) {
if ($status) {
$res = db_query_params('SELECT user_id FROM users WHERE status
= $1 and users.user_id != 100 ORDER BY '.$sort_order.' LIMIT $2 OFFSET $3',
- array($status, $paging, $offset));
- $rows = db_numrows($res);
+ array($status, $paging, $start));
if (isset($list_id)) {
$list_id = array_merge($list_id,
util_result_column_to_array($res, 0));
}
@@ -280,17 +232,16 @@ if ($usingplugin) {
}
if (! isset($list_id)) {
$res = db_query_params('SELECT user_id FROM users where
users.user_id != 100 ORDER BY '.$sort_order.' LIMIT $1 OFFSET $2',
- array($paging, $offset));
+ array($paging, $start));
$list_id = util_result_column_to_array($res, 0);
- $rows = db_numrows($res);
}
$filter='';
if (in_array($status,array('D','A','S','P'))) {
$filter = '&status='.$status;
}
- $totalUsers = FusionForge::getInstance()->getNumberOfUsers($filter);
-
- show_users_list($list_id, $filter, $sort_order, $offset, $rows,
$paging, $totalUsers);
+ $totalUsers = FusionForge::getInstance()->getNumberOfUsers($status);
+ $max = ($totalUsers > ($start + $paging)) ? ($start + $paging) :
$totalUsers;
+ show_users_list($list_id, $filter, $sort_order, $start, $max, $paging,
$totalUsers);
} else {
/*
Show list for one project
@@ -304,14 +255,14 @@ if ($usingplugin) {
util_ensure_value_in_set($sort_order,
array('realname','user_name','lastname','firstname','user_id','status','add_date'));
sortUserList($users, $sort_order);
- $users_paged = array_slice($users, $offset, $paging);
+ $users_paged = array_slice($users, $start, $paging);
unset($users);
foreach ($users_paged as $key => $user) {
$users_id[] = $user->getID();
}
$filter = '&group_id='.$group_id;
-
- show_users_list($users_id, $filter, $sort_order, $offset,
$rows, $paging, $totalUsers);
+ $max = ($totalUsers > ($start + $paging)) ? ($start + $paging)
: $totalUsers;
+ show_users_list($users_id, $filter, $sort_order, $start, $max,
$paging, $totalUsers);
}
else {
echo $HTML->information(_('No user in this project'));
diff --git a/src/www/include/Layout.class.php b/src/www/include/Layout.class.php
index 84d0312..f0afd4b 100644
--- a/src/www/include/Layout.class.php
+++ b/src/www/include/Layout.class.php
@@ -1516,6 +1516,80 @@ if (isset($params['group']) && $params['group']) {
$htmlcode .= html_ac(html_ap() -2);
return $htmlcode;
}
+
+ /**
+ * paging_top - Display Introduction to paging & form to set the paging
preference
+ *
+ * @param integer $start start of the list
+ * @param integer $paging number of element per page
+ * @param integer $totalElements total number of this type of
Elements in the forge
+ * @param integer $maxElements max number of Elements to
display
+ * @param string $actionUrl next / prev Url to click
+ */
+ function paging_top($start, $paging, $totalElements, $maxElements,
$actionUrl) {
+ $html_content = '';
+ $sep = '?';
+ if (strpos($actionUrl, '?')) {
+ $sep = '&';
+ }
+ if (session_loggedin()) {
+ $html_content .= $this->openForm(array('action' =>
$actionUrl.$sep.'start='.$start, 'method' => 'post'));
+ }
+ $html_content .= sprintf(_('Displaying results %1$s out of %2$d
total.'), ($start + 1).'-'.$maxElements, $totalElements);
+ if (session_loggedin()) {
+ $html_content .= sprintf(' ' . _('Displaying %1$s
results.'), html_build_select_box_from_array(array('10', '25', '50', '100',
'1000'), 'nres', $paging, 1));
+ $html_content .= html_e('input', array('type' =>
'submit', 'name' => 'setpaging', 'value' => _('Change')));
+ $html_content .= $this->closeForm();
+ }
+ return $html_content;
+ }
+
+ /**
+ * paging_bottom - Show extra rows for <-- Prev / Next --> at the
bottom of the element list
+ *
+ * @param integer $start start of the list
+ * @param integer $paging number of element per page
+ * @param integer $totalElements total number of Elements to
display
+ * @param string $actionUrl next / prev Url to click
+ */
+ function paging_bottom($start, $paging, $totalElements, $actionUrl) {
+ $html_content = '';
+ $sep = '?';
+ if (strpos($actionUrl, '?')) {
+ $sep = '&';
+ }
+ if ($start > 0) {
+ $html_content .=
util_make_link($actionUrl.$sep.'start='.($start-$paging),'<strong>←
'._('previous').'</strong>');
+ $html_content .= ' ';
+ }
+ $pages = $totalElements / $paging;
+ $currentpage = intval($start / $paging);
+ if ($pages > 1) {
+ $skipped_pages=false;
+ for ($j=0; $j<$pages; $j++) {
+ if ($pages > 20) {
+ if ((($j > 4) && ($j <
($currentpage-5))) || (($j > ($currentpage+5)) && ($j < ($pages-5)))) {
+ if (!$skipped_pages) {
+ $skipped_pages=true;
+ $html_content .=
'.... ';
+ }
+ continue;
+ } else {
+ $skipped_pages=false;
+ }
+ }
+ if ($j * $paging == $start) {
+ $html_content .=
'<strong>'.($j+1).'</strong> ';
+ } else {
+ $html_content .=
util_make_link($actionUrl.$sep.'start='.($j*$paging),'<strong>'.($j+1).'</strong>').' ';
+ }
+ }
+ }
+ if ( $totalElements > $start + $paging) {
+ $html_content .=
util_make_link($actionUrl.$sep.'start='.($start+$paging),'<strong>'._('next').'
→</strong>');
+ }
+ return $html_content;
+ }
}
// Local Variables:
diff --git a/src/www/pm/browse_task.php b/src/www/pm/browse_task.php
index 96262e8..afaaa5f 100644
--- a/src/www/pm/browse_task.php
+++ b/src/www/pm/browse_task.php
@@ -37,11 +37,10 @@ global $HTML;
$pagename = "pm_browse_custom";
-$offset = getIntFromRequest('offset');
-if ($offset < 0) {
- $offset = 0 ;
+$start = getIntFromRequest('start');
+if ($start < 0) {
+ $start = 0 ;
}
-$max_rows = getIntFromRequest('max_rows');
$ptf = new ProjectTaskFactory($pg);
if (!$ptf || !is_object($ptf)) {
@@ -75,7 +74,7 @@ if (!$paging) {
$paging = 25;
}
-$ptf->setup($offset, $_order, $paging, $set, $_assigned_to, $_status,
$_category_id, $_view, $_sort_order);
+$ptf->setup($start, $_order, $paging, $set, $_assigned_to, $_status,
$_category_id, $_view, $_sort_order);
if ($ptf->isError()) {
exit_error($ptf->getErrorMessage(), 'pm');
}
@@ -152,24 +151,9 @@ $view_box =
html_build_select_box_from_assoc($view_select_arr, '_view', $_view,
$rows = count($pt_arr);
$totalTasks = $pg->getCount($_status, $_category_id);
+$max = ($rows > ($start + $paging)) ? ($start + $paging) : $rows;
-if (session_loggedin()) {
- /* logged in users get configurable paging */
- echo $HTML->openForm(array('action' =>
'/pm/task.php?group_id='.$group_id.'&group_project_id='.$pg->getID().'&offset='.$offset,
'method' => 'post'));
-}
-
-printf('<p>' . _('Displaying results %1$s out of %2$d total.'),$rows ?
($offset + 1).'-'.($offset + $rows) : '0', $totalTasks);
-
-if (session_loggedin()) {
- printf(' ' . _('Displaying %2$s results.') . "\n\t<input " .
- 'type="submit" name="setpaging" value="%1$s" />' .
- "\n</p>\n", _('Change'),
- html_build_select_box_from_array(array(
- '10', '25', '50', '100', '1000'), 'nres', $paging, 1));
- echo $HTML->closeForm();
-} else {
- echo "</p>\n";
-}
+echo $HTML->paging_top($start, $paging, $totalTasks, $max,
'/pm/task.php?group_id='.$group_id.'&group_project_id='.$pg->getID());
/*
Show the new pop-up boxes to select assigned to and/or status
@@ -302,42 +286,10 @@ if ($rows < 1) {
}
echo $HTML->listTableBottom();
-
/*
Show extra rows for <-- Prev / Next -->
*/
- if ($offset > 0) {
- echo
util_make_link('/pm/task.php?func=browse&group_project_id='.$group_project_id.'&group_id='.$group_id.'&offset='.($offset-$paging),'<strong>←
'._('previous').'</strong>');
- echo ' ';
- }
- $pages = $totalTasks / $paging;
- $currentpage = intval($offset / $paging);
- if ($pages > 1) {
- $skipped_pages=false;
- for ($j=0; $j<$pages; $j++) {
- if ($pages > 20) {
- if ((($j > 4) && ($j < ($currentpage-5))) ||
(($j > ($currentpage+5)) && ($j < ($pages-5)))) {
- if (!$skipped_pages) {
- $skipped_pages=true;
- echo ".... ";
- }
- continue;
- } else {
- $skipped_pages=false;
- }
- }
- if ($j * $paging == $offset) {
- echo '<strong>'.($j+1).'</strong> ';
- } else {
- echo
util_make_link('/pm/task.php?func=browse&group_project_id='.$group_project_id.'&group_id='.$group_id.'&offset='.($j*$paging),'<strong>'.($j+1).'</strong>').' ';
- }
- }
- }
- if ( $totalTasks > $offset + $paging) {
- echo
util_make_link('/pm/task.php?func=browse&group_project_id='.$group_project_id.'&group_id='.$group_id.'&offset='.($offset+$paging),'<strong>'._('next').'
→</strong>');
- } else {
- echo ' ';
- }
+ echo $HTML->paging_bottom($start, $paging, $totalTasks,
'/pm/task.php?func=browse&group_project_id='.$group_project_id.'&group_id='.$group_id);
echo '<div style="display:table;width:100%">';
echo '<div style="display:table-row">';
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=a2f3070b002ee0be4cf252917196e977bcc898f7
commit a2f3070b002ee0be4cf252917196e977bcc898f7
Author: Franck Villaume <[email protected]>
Date: Sun Nov 1 16:16:35 2015 +0100
fix wrong comment. Tasks -> Artifacts
diff --git a/src/common/tracker/ArtifactFactory.class.php
b/src/common/tracker/ArtifactFactory.class.php
index 499bccd..83cf49a 100644
--- a/src/common/tracker/ArtifactFactory.class.php
+++ b/src/common/tracker/ArtifactFactory.class.php
@@ -84,7 +84,7 @@ class ArtifactFactory extends Error {
}
/**
- * setup - sets up limits and sorts before you call getTasks().
+ * setup - sets up limits and sorts before you call getArtifacts().
*
* @param int $offset The offset - number of rows to
skip.
* @param string $order_col The column to sort on.
@@ -266,7 +266,7 @@ class ArtifactFactory extends Error {
}
/**
- * setChangedFrom - sets up changed-from and last-changed before you
call getTasks().
+ * setChangedFrom - sets up changed-from and last-changed before you
call getArtifacts().
*
* @param int $changed_from The changed_from - offset
time(sec) from now
*/
-----------------------------------------------------------------------
Summary of changes:
src/common/tracker/ArtifactFactory.class.php | 4 +-
src/common/tracker/actions/browse.php | 42 +----------
src/www/admin/userlist.php | 105 +++++++--------------------
src/www/include/Layout.class.php | 74 +++++++++++++++++++
src/www/pm/browse_task.php | 62 ++--------------
5 files changed, 113 insertions(+), 174 deletions(-)
hooks/post-receive
--
FusionForge
_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits