Beispiel #1
0
 public function timeline($request, $match)
 {
     $prj = $request->project;
     $model_filter = @$match[2];
     $all_model_filters = self::getAvailableModelFilters();
     if (!array_key_exists($model_filter, $all_model_filters)) {
         $model_filter = 'all';
     }
     $title = (string) $prj . ' ' . $all_model_filters[$model_filter];
     $pag = new IDF_Timeline_Paginator(new IDF_Timeline());
     $pag->class = 'recent-issues';
     $pag->item_extra_props = array('request' => $request);
     $pag->summary = __('This table shows the project updates.');
     $classes = self::determineModelClasses($request, $model_filter);
     $sql = sprintf('model_class IN (%s)', implode(', ', $classes));
     $pag->forced_where = new Pluf_SQL('project=%s AND ' . $sql, array($prj->id));
     $pag->sort_order = array('creation_dtime', 'ASC');
     $pag->sort_reverse_order = array('creation_dtime');
     $pag->action = array('IDF_Views_Project::timeline', array($prj->shortname, $model_filter));
     $list_display = array('creation_dtime' => __('Age'), 'id' => __('Change'));
     $pag->configure($list_display, array(), array('creation_dtime'));
     $pag->items_per_page = 20;
     $pag->no_results_text = __('No changes were found.');
     $pag->setFromRequest($request);
     if (!$request->user->isAnonymous() and $prj->isRestricted()) {
         $feedurl = Pluf_HTTP_URL_urlForView('idf_project_timeline_feed_auth', array($prj->shortname, $model_filter, IDF_Precondition::genFeedToken($prj, $request->user)));
     } else {
         $feedurl = Pluf_HTTP_URL_urlForView('idf_project_timeline_feed', array($prj->shortname, $model_filter));
     }
     return Pluf_Shortcuts_RenderToResponse('idf/project/timeline.html', array('page_title' => $title, 'feedurl' => $feedurl, 'timeline' => $pag, 'model_filter' => $model_filter, 'all_model_filters' => $all_model_filters), $request);
 }
Beispiel #2
0
 public function timeline($request, $match)
 {
     $prj = $request->project;
     $title = sprintf(__('%s Updates'), (string) $prj);
     $team = $prj->getMembershipData();
     $pag = new IDF_Timeline_Paginator(new IDF_Timeline());
     $pag->class = 'recent-issues';
     $pag->item_extra_props = array('request' => $request);
     $pag->summary = __('This table shows the project updates.');
     // Need to check the rights
     $rights = array();
     if (true === IDF_Precondition::accessSource($request)) {
         $rights[] = '\'IDF_Commit\'';
         IDF_Scm::syncTimeline($request->project);
     }
     if (true === IDF_Precondition::accessIssues($request)) {
         $rights[] = '\'IDF_Issue\'';
         $rights[] = '\'IDF_IssueComment\'';
     }
     if (true === IDF_Precondition::accessDownloads($request)) {
         $rights[] = '\'IDF_Upload\'';
     }
     if (true === IDF_Precondition::accessWiki($request)) {
         $rights[] = '\'IDF_WikiPage\'';
         $rights[] = '\'IDF_WikiRevision\'';
     }
     if (true === IDF_Precondition::accessReview($request)) {
         $rights[] = '\'IDF_Review_Comment\'';
         $rights[] = '\'IDF_Review_Patch\'';
     }
     if (count($rights) == 0) {
         $rights[] = '\'IDF_Dummy\'';
     }
     $sql = sprintf('model_class IN (%s)', implode(', ', $rights));
     $pag->forced_where = new Pluf_SQL('project=%s AND ' . $sql, array($prj->id));
     $pag->sort_order = array('creation_dtime', 'ASC');
     $pag->sort_reverse_order = array('creation_dtime');
     $pag->action = array('IDF_Views_Project::timeline', array($prj->shortname));
     $list_display = array('creation_dtime' => __('Age'), 'id' => __('Change'));
     $pag->configure($list_display, array(), array('creation_dtime'));
     $pag->items_per_page = 20;
     $pag->no_results_text = __('No changes were found.');
     $pag->setFromRequest($request);
     $downloads = array();
     if ($request->rights['hasDownloadsAccess']) {
         $tags = IDF_Views_Download::getDownloadTags($prj);
         // the first tag is the featured, the last is the deprecated.
         $downloads = $tags[0]->get_idf_upload_list();
     }
     $pages = array();
     if ($request->rights['hasWikiAccess']) {
         $tags = IDF_Views_Wiki::getWikiTags($prj);
         $pages = $tags[0]->get_idf_wikipage_list();
     }
     if (!$request->user->isAnonymous() and $prj->isRestricted()) {
         $feedurl = Pluf_HTTP_URL_urlForView('idf_project_timeline_feed_auth', array($prj->shortname, IDF_Precondition::genFeedToken($prj, $request->user)));
     } else {
         $feedurl = Pluf_HTTP_URL_urlForView('idf_project_timeline_feed', array($prj->shortname));
     }
     return Pluf_Shortcuts_RenderToResponse('idf/project/timeline.html', array('page_title' => $title, 'feedurl' => $feedurl, 'timeline' => $pag, 'team' => $team, 'downloads' => $downloads), $request);
 }