From 31735c40489be6d23369ded6c725abc21283bd99 Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Sat, 26 Mar 2016 17:08:31 -0500 Subject: [PATCH] Issue 147: Add repository type to forge management project list --- indefero/src/IDF/Project.php | 10 ++++++---- indefero/src/IDF/Views/Admin.php | 14 ++++++++++---- pluf/src/Pluf/Paginator.php | 2 +- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/indefero/src/IDF/Project.php b/indefero/src/IDF/Project.php index 7ec5c94..f2545a6 100644 --- a/indefero/src/IDF/Project.php +++ b/indefero/src/IDF/Project.php @@ -140,11 +140,13 @@ class IDF_Project extends Pluf_Model $thisTable = $this->_con->pfx.'idf_projects'; $this->_a['views'] = array( 'repo_size' => [ - 'join' => "INNER JOIN $confTable ON $thisTable.id = $confTable.project", - 'select' => $this->getSelect() . ', CAST(vdesc as UNSIGNED) as vdesc', - 'where' => 'vkey = "repository_size"', + 'join' => "INNER JOIN $confTable s ON $thisTable.id = s.project " . + "INNER JOIN $confTable t ON $thisTable.id = t.project ", + 'select' => $this->getSelect() . ', CAST(s.vdesc as UNSIGNED) as size, t.vdesc as scm', + 'where' => 's.vkey = "repository_size" AND t.vkey = "scm"', 'props' => array( - 'vdesc' => 'vdesc', + 'size' => 'size', + 'scm' => 'scm' ), ], 'join_activities_and_tags' => diff --git a/indefero/src/IDF/Views/Admin.php b/indefero/src/IDF/Views/Admin.php index bccfbe6..8ddeafe 100644 --- a/indefero/src/IDF/Views/Admin.php +++ b/indefero/src/IDF/Views/Admin.php @@ -85,12 +85,13 @@ class IDF_Views_Admin $list_display = array( 'shortname' => __('Short Name'), 'name' => __('Name'), - 'vdesc' => ["vdesc", "IDF_Views_Admin_projectSize2", __('Repository Size')], + 'scm' => ["scm", "IDF_Views_Admin_projectSCM", __('Type')], + 'size' => ["size", "IDF_Views_Admin_projectSize2", __('Repository Size')] ); $pag->configure($list_display, array('shortname', 'shortname'), - array('shortname', 'name', 'vdesc' )); - $pag->extra_classes = array('', '', 'right'); + array('shortname', 'name', 'scm', 'size' )); + $pag->extra_classes = array('', '', '', 'right'); $pag->items_per_page = 25; $pag->no_results_text = __('No projects were found.'); $pag->setFromRequest($request); @@ -663,7 +664,12 @@ function IDF_Views_Admin_projectSize($field, $project) function IDF_Views_Admin_projectSize2($field, $project) { - return Pluf_Utils::prettySize($project->vdesc); + return Pluf_Utils::prettySize($project->size); +} + +function IDF_Views_Admin_projectSCM($field, $project) +{ + return $project->getConf()->getVal("scm"); } /** diff --git a/pluf/src/Pluf/Paginator.php b/pluf/src/Pluf/Paginator.php index c6c8902..6975596 100644 --- a/pluf/src/Pluf/Paginator.php +++ b/pluf/src/Pluf/Paginator.php @@ -289,7 +289,7 @@ class Pluf_Paginator } } } - //print_r($this->list_display); + if (is_array($search_fields)) { $this->search_fields = $search_fields; }