public function index($request, $match) { $prj = $request->project; $title = sprintf(__('%s Code Reviews'), (string) $prj); // Paginator to paginate the pages $pag = new Pluf_Paginator(new IDF_Review()); $pag->class = 'recent-issues'; $pag->item_extra_props = array('project_m' => $prj, 'shortname' => $prj->shortname, 'current_user' => $request->user); $pag->summary = __('This table shows the latest reviews.'); $pag->action = array('IDF_Views_Review::index', array($prj->shortname)); $otags = $prj->getTagIdsByStatus('open'); if (count($otags) == 0) { $otags[] = 0; } $pag->forced_where = new Pluf_SQL('project=%s AND status IN (' . implode(', ', $otags) . ')', array($prj->id)); $pag->action = array('IDF_Views_Issue::index', array($prj->shortname)); $pag->sort_order = array('modif_dtime', 'ASC'); // will be reverted $pag->sort_reverse_order = array('modif_dtime'); $list_display = array('id' => __('Id'), array('summary', 'IDF_Views_Review_SummaryAndLabels', __('Summary')), array('status', 'IDF_Views_Issue_ShowStatus', __('Status')), array('modif_dtime', 'Pluf_Paginator_DateAgo', __('Last Updated'))); $pag->configure($list_display, array(), array('title', 'modif_dtime')); $pag->items_per_page = 25; $pag->no_results_text = __('No reviews were found.'); $pag->sort_order = array('modif_dtime', 'ASC'); $pag->setFromRequest($request); return Pluf_Shortcuts_RenderToResponse('idf/review/index.html', array('page_title' => $title, 'reviews' => $pag), $request); }
public function dashboard($request, $match, $working = true) { $otags = array(); // Note that this approach does not scale, we will need to add // a table to cache the meaning of the tags for large forges. foreach (IDF_Views::getProjects($request->user) as $project) { $otags = array_merge($otags, $project->getTagIdsByStatus('open')); } if (count($otags) == 0) { $otags[] = 0; } if ($working) { $title = __('Your Dashboard - Working Issues'); $f_sql = new Pluf_SQL('owner=%s AND status IN (' . implode(', ', $otags) . ')', array($request->user->id)); } else { $title = __('Your Dashboard - Submitted Issues'); $f_sql = new Pluf_SQL('submitter=%s AND status IN (' . implode(', ', $otags) . ')', array($request->user->id)); } // Get stats about the issues $sql = new Pluf_SQL('submitter=%s AND status IN (' . implode(', ', $otags) . ')', array($request->user->id)); $nb_submit = Pluf::factory('IDF_Issue')->getCount(array('filter' => $sql->gen())); $sql = new Pluf_SQL('owner=%s AND status IN (' . implode(', ', $otags) . ')', array($request->user->id)); $nb_owner = Pluf::factory('IDF_Issue')->getCount(array('filter' => $sql->gen())); // Paginator to paginate the issues $pag = new Pluf_Paginator(new IDF_Issue()); $pag->class = 'recent-issues'; $pag->item_extra_props = array('current_user' => $request->user); $pag->summary = __('This table shows the open issues.'); $pag->forced_where = $f_sql; $pag->action = $working ? 'idf_dashboard' : 'idf_dashboard_submit'; $pag->sort_order = array('modif_dtime', 'ASC'); // will be reverted $pag->sort_reverse_order = array('modif_dtime'); $list_display = array('id' => __('Id'), array('project', 'Pluf_Paginator_FkToString', __('Project')), array('summary', 'IDF_Views_IssueSummaryAndLabels', __('Summary')), array('status', 'IDF_Views_Issue_ShowStatus', __('Status')), array('modif_dtime', 'Pluf_Paginator_DateAgo', __('Last Updated'))); $pag->configure($list_display, array(), array('status', 'modif_dtime')); $pag->items_per_page = 10; $pag->no_results_text = $working ? __('No issues are assigned to you, yeah!') : __('All the issues you submitted are fixed, yeah!'); $pag->setFromRequest($request); return Pluf_Shortcuts_RenderToResponse('idf/user/dashboard.html', array('page_title' => $title, 'nb_submit' => $nb_submit, 'nb_owner' => $nb_owner, 'issues' => $pag), $request); }
public function users($request, $match, $not_validated = false) { $pag = new Pluf_Paginator(new Pluf_User()); $db =& Pluf::db(); $true = Pluf_DB_BooleanToDb(true, $db); if ($not_validated) { $pag->forced_where = new Pluf_SQL('first_name = \'---\' AND active!=' . $true); $title = __('Not Validated User List'); $pag->action = 'IDF_Views_Admin::usersNotValidated'; } else { $pag->forced_where = new Pluf_SQL('first_name != \'---\''); $title = __('User List'); $pag->action = 'IDF_Views_Admin::users'; } $pag->class = 'recent-issues'; $pag->summary = __('This table shows the users in the forge.'); $pag->edit_action = array('IDF_Views_Admin::userUpdate', 'id'); $pag->sort_order = array('login', 'ASC'); $list_display = array('login' => __('login'), array('last_name', 'Pluf_Paginator_ToString', __('Name')), array('staff', 'IDF_Views_Admin_bool', __('Staff')), array('administrator', 'IDF_Views_Admin_bool', __('Admin')), array('active', 'IDF_Views_Admin_bool', __('Active')), array('last_login', 'Pluf_Paginator_DateYMDHM', __('Last Login'))); $pag->extra_classes = array('', '', 'a-c', 'a-c', 'a-c', 'a-c'); $pag->configure($list_display, array('login', 'last_name', 'email'), array('login', 'last_login')); $pag->items_per_page = 50; $pag->no_results_text = __('No users were found.'); $pag->setFromRequest($request); return Pluf_Shortcuts_RenderToResponse('idf/gadmin/users/index.html', array('page_title' => $title, 'users' => $pag, 'not_validated' => $not_validated), $request); }
public function listLabel($request, $match) { $prj = $request->project; $tag = Pluf_Shortcuts_GetObjectOr404('IDF_Tag', $match[2]); $status = $match[3]; if ($tag->project != $prj->id or !in_array($status, array('open', 'closed'))) { throw new Pluf_HTTP_Error404(); } if ($status == 'open') { $title = sprintf(__('%1$s Issues with Label %2$s'), (string) $prj, (string) $tag); } else { $title = sprintf(__('%1$s Closed Issues with Label %2$s'), (string) $prj, (string) $tag); } // Get stats about the open/closed issues having this tag. $open = $prj->getIssueCountByStatus('open', $tag); $closed = $prj->getIssueCountByStatus('closed', $tag); // Paginator to paginate the issues $pag = new Pluf_Paginator(new IDF_Issue()); $pag->model_view = 'join_tags'; $pag->class = 'recent-issues'; $pag->item_extra_props = array('project_m' => $prj, 'shortname' => $prj->shortname, 'current_user' => $request->user); $pag->summary = sprintf(__('This table shows the issues with label %s.'), (string) $tag); $otags = $prj->getTagIdsByStatus($status); if (count($otags) == 0) { $otags[] = 0; } $pag->forced_where = new Pluf_SQL('project=%s AND idf_tag_id=%s AND status IN (' . implode(', ', $otags) . ')', array($prj->id, $tag->id)); $pag->action = array('IDF_Views_Issue::listLabel', array($prj->shortname, $tag->id, $status)); $pag->sort_order = array('modif_dtime', 'ASC'); // will be reverted $pag->sort_reverse_order = array('modif_dtime'); $pag->sort_link_title = true; $pag->extra_classes = array('a-c', '', 'a-c', ''); $list_display = array('id' => __('Id'), array('summary', 'IDF_Views_Issue_SummaryAndLabels', __('Summary')), array('status', 'IDF_Views_Issue_ShowStatus', __('Status')), array('modif_dtime', 'Pluf_Paginator_DateAgo', __('Last Updated'))); $pag->configure($list_display, array(), array('id', 'status', 'modif_dtime')); $pag->items_per_page = 10; $pag->no_results_text = __('No issues were found.'); $pag->setFromRequest($request); if ($open + $closed > 0) { $completion = sprintf('%01.0f%%', 100 * $closed / ((double) $open + $closed)); } else { $completion = false; } return Pluf_Shortcuts_RenderToResponse('idf/issues/by-label.html', array('project' => $prj, 'completion' => $completion, 'page_title' => $title, 'open' => $open, 'label' => $tag, 'closed' => $closed, 'issues' => $pag), $request); }
public function listLabel($request, $match) { $prj = $request->project; $tag = Pluf_Shortcuts_GetObjectOr404('IDF_Tag', $match[2]); $prj->inOr404($tag); $title = sprintf(__('%1$s Downloads with Label %2$s'), (string) $prj, (string) $tag); // Paginator to paginate the downloads $ptags = self::getDownloadTags($prj); $dtag = array_pop($ptags); // The last tag is the deprecated tag. $pag = new Pluf_Paginator(new IDF_Upload()); $pag->model_view = 'join_tags'; $pag->class = 'recent-issues'; $pag->item_extra_props = array('project_m' => $prj, 'shortname' => $prj->shortname); $pag->summary = sprintf(__('This table shows the downloads with label %s.'), (string) $tag); $pag->forced_where = new Pluf_SQL('project=%s AND idf_tag_id=%s', array($prj->id, $tag->id)); $pag->action = array('IDF_Views_Download::listLabel', array($prj->shortname, $tag->id)); $pag->edit_action = array('IDF_Views_Download::view', 'shortname', 'id'); $list_display = array('file' => __('File'), array('summary', 'IDF_Views_Download_SummaryAndLabels', __('Summary')), array('filesize', 'IDF_Views_Download_Size', __('Size')), array('creation_dtime', 'Pluf_Paginator_DateYMD', __('Uploaded'))); $pag->configure($list_display, array(), array('file', 'filesize', 'creation_dtime')); $pag->items_per_page = 10; $pag->no_results_text = __('No downloads were found.'); $pag->sort_order = array('creation_dtime', 'DESC'); $pag->setFromRequest($request); $tags = $prj->getTagCloud('downloads'); return Pluf_Shortcuts_RenderToResponse('idf/downloads/index.html', array('page_title' => $title, 'label' => $tag, 'downloads' => $pag, 'tags' => $tags, 'dlabel' => $dtag), $request); }
public function listLabel($request, $match) { $prj = $request->project; $tag = Pluf_Shortcuts_GetObjectOr404('IDF_Tag', $match[2]); $prj->inOr404($tag); $title = sprintf(__('%1$s Documentation Pages with Label %2$s'), (string) $prj, (string) $tag); // Paginator to paginate the pages $ptags = self::getWikiTags($prj); $dtag = array_pop($ptags); // The last tag is the deprecated tag. $pag = new Pluf_Paginator(new IDF_WikiPage()); $pag->model_view = 'join_tags'; $pag->class = 'recent-issues'; $pag->item_extra_props = array('project_m' => $prj, 'shortname' => $prj->shortname); $pag->summary = sprintf(__('This table shows the documentation pages with label %s.'), (string) $tag); $pag->forced_where = new Pluf_SQL('project=%s AND idf_tag_id=%s', array($prj->id, $tag->id)); $pag->action = array('IDF_Views_Wiki::listLabel', array($prj->shortname, $tag->id)); $pag->edit_action = array('IDF_Views_Wiki::view', 'shortname', 'title'); $pag->extra_classes = array('right', '', 'a-c'); $list_display = array('title' => __('Page Title'), array('summary', 'IDF_Views_Wiki_SummaryAndLabels', __('Summary')), array('modif_dtime', 'Pluf_Paginator_DateYMD', __('Updated'))); $pag->configure($list_display, array(), array('title', 'modif_dtime')); $pag->items_per_page = 25; $pag->no_results_text = __('No documentation pages were found.'); $pag->setFromRequest($request); $tags = $prj->getTagCloud('wiki'); return Pluf_Shortcuts_RenderToResponse('idf/wiki/index.html', array('page_title' => $title, 'label' => $tag, 'pages' => $pag, 'tags' => $tags, 'dlabel' => $dtag), $request); }