/** * Generate a standard "line" of the body. * * It is important to note that the table has only 2 columns, so * the timelineFragment() method of each item must take that into * account. */ function bodyLine($item) { $doc = Pluf::factory($item->model_class, $item->model_id); $doc->public_dtime = $item->public_dtime; $item_day = Pluf_Template_dateFormat($item->creation_dtime, '%y-%m-%d'); $out = ''; if ($this->current_day == null or Pluf_Date::dayCompare($this->current_day, $item_day) != 0) { $day = Pluf_Template_dateFormat($item->creation_dtime); if ($item_day == Pluf_Template_timeFormat(time(), 'y-m-d')) { $day = __('Today'); } $out = '<tr><th colspan="2">' . $day . '</th></tr>' . "\n"; $this->current_day = $item_day; } return $out . $doc->timelineFragment($item->request); }
public function feedFragment($request) { $review = $this->get_patch()->get_review(); $url = Pluf_HTTP_URL_urlForView('IDF_Views_Review::view', array($request->project->shortname, $review->id)); $title = sprintf(__('%s: Updated review %d - %s'), Pluf_esc($request->project->name), $review->id, Pluf_esc($review->summary)); $url .= '#ic' . $this->id; $date = Pluf_Date::gmDateToGmString($this->creation_dtime); $context = new Pluf_Template_Context_Request($request, array('url' => $url, 'author' => $this->get_submitter(), 'title' => $title, 'c' => $this, 'review' => $review, 'date' => $date)); $tmpl = new Pluf_Template('idf/review/feedfragment.xml'); return $tmpl->render($context); }
public function timelineFeed($request, $match) { $prj = $request->project; $model_filter = @$match[2]; $model_filter = @$match[2]; $all_model_filters = self::getAvailableModelFilters(); if (!array_key_exists($model_filter, $all_model_filters)) { $model_filter = 'all'; } $title = $all_model_filters[$model_filter]; $classes = self::determineModelClasses($request, $model_filter); $sqls = sprintf('model_class IN (%s)', implode(', ', $classes)); $sql = new Pluf_SQL('project=%s AND ' . $sqls, array($prj->id)); $params = array('filter' => $sql->gen(), 'order' => 'creation_dtime DESC', 'nb' => 20); $items = Pluf::factory('IDF_Timeline')->getList($params); $set = new Pluf_Model_Set($items, array('public_dtime' => 'public_dtime')); $out = array(); foreach ($set as $item) { if ($item->id) { $out[] = $item->feedFragment($request); } } if ($items->count() > 0) { $date = Pluf_Date::gmDateToGmString($items[0]->creation_dtime); } else { $date = gmdate('c'); } $out = Pluf_Template::markSafe(implode("\n", $out)); $tmpl = new Pluf_Template('idf/index.atom'); $feedurl = Pluf::f('url_base') . Pluf::f('idf_base') . $request->query; $viewurl = Pluf_HTTP_URL_urlForView('IDF_Views_Project::timeline', array($prj->shortname)); $context = new Pluf_Template_Context_Request($request, array('body' => $out, 'date' => $date, 'title' => $title, 'feedurl' => $feedurl, 'viewurl' => $viewurl)); return new Pluf_HTTP_Response('<?xml version="1.0" encoding="utf-8"?>' . "\n" . $tmpl->render($context), 'application/atom+xml; charset=utf-8'); }
/** * Returns the feed fragment for the commit. * * @param Pluf_HTTP_Request * @return Pluf_Template_SafeString */ public function feedFragment($request) { $url = Pluf::f('url_base') . Pluf_HTTP_URL_urlForView('IDF_Views_Source::commit', array($request->project->shortname, $this->scm_id)); $date = Pluf_Date::gmDateToGmString($this->creation_dtime); $author = $this->get_author() ? $this->get_author() : $this->origauthor; $cproject = $this->get_project(); $context = new Pluf_Template_Context_Request($request, array('c' => $this, 'cproject' => $cproject, 'url' => $url, 'date' => $date, 'author' => $author)); $tmpl = new Pluf_Template('idf/source/feedfragment.xml'); return $tmpl->render($context); }
public function timelineFeed($request, $match) { $prj = $request->project; // 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\''; } $sqls = sprintf('model_class IN (%s)', implode(', ', $rights)); $sql = new Pluf_SQL('project=%s AND ' . $sqls, array($prj->id)); $params = array('filter' => $sql->gen(), 'order' => 'creation_dtime DESC', 'nb' => 20); $items = Pluf::factory('IDF_Timeline')->getList($params); $set = new Pluf_Model_Set($items, array('public_dtime' => 'public_dtime')); $out = array(); foreach ($set as $item) { if ($item->id) { $out[] = $item->feedFragment($request); } } if ($items->count() > 0) { $date = Pluf_Date::gmDateToGmString($items[0]->creation_dtime); } else { $date = gmdate('c'); } $out = Pluf_Template::markSafe(implode("\n", $out)); $tmpl = new Pluf_Template('idf/index.atom'); $title = __('Updates'); $feedurl = Pluf::f('url_base') . Pluf::f('idf_base') . $request->query; $viewurl = Pluf_HTTP_URL_urlForView('IDF_Views_Project::timeline', array($prj->shortname)); $context = new Pluf_Template_Context_Request($request, array('body' => $out, 'date' => $date, 'title' => $title, 'feedurl' => $feedurl, 'viewurl' => $viewurl)); return new Pluf_HTTP_Response('<?xml version="1.0" encoding="utf-8"?>' . "\n" . $tmpl->render($context), 'application/atom+xml; charset=utf-8'); }
public function feedFragment($request) { $url = Pluf::f('url_base') . Pluf_HTTP_URL_urlForView('IDF_Views_Issue::view', array($request->project->shortname, $this->id)); $title = sprintf(__('%s: Issue %d created - %s'), $request->project->name, $this->id, $this->summary); $cts = $this->get_comments_list(array('order' => 'id ASC', 'nb' => 1)); $date = Pluf_Date::gmDateToGmString($this->creation_dtime); $context = new Pluf_Template_Context_Request($request, array('url' => $url, 'author' => $this->get_submitter(), 'title' => $title, 'c' => $cts[0], 'issue' => $this, 'date' => $date)); $tmpl = new Pluf_Template('idf/issues/feedfragment.xml'); return $tmpl->render($context); }
public function feedFragment($request) { $url = Pluf::f('url_base') . Pluf_HTTP_URL_urlForView('IDF_Views_Download::view', array($request->project->shortname, $this->id)); $title = sprintf(__('%s: Download %d added - %s'), $request->project->name, $this->id, $this->summary); $date = Pluf_Date::gmDateToGmString($this->creation_dtime); $context = new Pluf_Template_Context_Request($request, array('url' => $url, 'title' => $title, 'file' => $this, 'date' => $date)); $tmpl = new Pluf_Template('idf/downloads/feedfragment.xml'); return $tmpl->render($context); }
public function feedFragment($request) { $url = Pluf::f('url_base') . Pluf_HTTP_URL_urlForView('IDF_Views_Wiki::view', array($request->project->shortname, $this->title)); $title = sprintf(__('%s: Documentation page %s added - %s'), $request->project->name, $this->title, $this->summary); $date = Pluf_Date::gmDateToGmString($this->creation_dtime); $context = new Pluf_Template_Context_Request($request, array('url' => $url, 'title' => $title, 'page' => $this, 'rev' => $this->get_current_revision(), 'create' => true, 'date' => $date)); $tmpl = new Pluf_Template('idf/wiki/feedfragment.xml'); return $tmpl->render($context); }
public function feedFragment($request) { $issue = $this->get_issue(); $url = Pluf::f('url_base') . Pluf_HTTP_URL_urlForView('IDF_Views_Issue::view', array($request->project->shortname, $issue->id)); $title = sprintf(__('%s: Comment on issue %d - %s'), Pluf_esc($request->project->name), $issue->id, Pluf_esc($issue->summary)); $url .= '#ic' . $this->id; $date = Pluf_Date::gmDateToGmString($this->creation_dtime); $context = new Pluf_Template_Context_Request($request, array('url' => $url, 'author' => $issue->get_submitter(), 'title' => $title, 'c' => $this, 'issue' => $issue, 'date' => $date)); $tmpl = new Pluf_Template('idf/issues/feedfragment.xml'); return $tmpl->render($context); }