diff --git a/src/IDF/Commit.php b/src/IDF/Commit.php
index 6ea7f97..c23f712 100644
--- a/src/IDF/Commit.php
+++ b/src/IDF/Commit.php
@@ -13,7 +13,7 @@
# InDefero is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
+n# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
@@ -235,24 +235,22 @@ class IDF_Commit extends Pluf_Model
.Pluf_HTTP_URL_urlForView('IDF_Views_Source::commit',
array($request->project->shortname,
$this->scm_id));
- $tag = new IDF_Template_IssueComment();
- $summary = ''."\n"
- .''
- .$tag->start($this->summary, $request, false, false, false);
- if ($this->fullmessage) {
- $summary .= ' '
- .$tag->start($this->fullmessage, $request, false, false, false);
- }
$date = Pluf_Date::gmDateToGmString($this->creation_dtime);
- $summary .= '
';
- $out = '
- '.Pluf_esc($request->project->name).': '.__('Commit').' '.$this->scm_id.'
-
- '.$url.'
- '.$date.' '.$summary.'
-
-';
- return $out;
+ $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);
}
/**
diff --git a/src/IDF/Issue.php b/src/IDF/Issue.php
index 47ae074..95e16c1 100644
--- a/src/IDF/Issue.php
+++ b/src/IDF/Issue.php
@@ -199,33 +199,27 @@ class IDF_Issue extends Pluf_Model
public function feedFragment($request)
{
- $base = '
- %%title%%
-
- %%url%%
- %%date%%
-
- ';
$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'),
- Pluf_esc($request->project->name),
- $this->id, Pluf_esc($this->summary));
- // Get the first comment of this issue.
+ $request->project->name,
+ $this->id, $this->summary);
$cts = $this->get_comments_list(array('order' => 'id ASC',
'nb' => 1));
- $tag = new IDF_Template_IssueComment();
- $content = $tag->start($cts[0]->content, $request, false);
$date = Pluf_Date::gmDateToGmString($this->creation_dtime);
- return Pluf_Translation::sprintf($base,
- array('url' => $url,
- 'title' => $title,
- 'content' => $content,
- 'date' => $date));
+ $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);
}
/**
diff --git a/src/IDF/IssueComment.php b/src/IDF/IssueComment.php
index 16191f2..110f3d8 100644
--- a/src/IDF/IssueComment.php
+++ b/src/IDF/IssueComment.php
@@ -167,66 +167,33 @@ class IDF_IssueComment extends Pluf_Model
$out .= '';
}
$out .= '';
-
-
$out .= "\n".'
';
-
return Pluf_Template::markSafe($out);
}
public function feedFragment($request)
{
- $base = '
- %%title%%
-
- %%url%%
- %%date%%
-
- %%content%%
-
- ';
$issue = $this->get_issue();
$url = Pluf::f('url_base')
.Pluf_HTTP_URL_urlForView('IDF_Views_Issue::view',
array($request->project->shortname,
$issue->id));
- $url .= '#ic'.$this->id;
$title = sprintf(__('%s: Comment on issue %d - %s'),
Pluf_esc($request->project->name),
$issue->id, Pluf_esc($issue->summary));
- $submitter = $this->get_submitter();
- $tag = new IDF_Template_IssueComment();
- $content = '
'.$tag->start($this->content, $request, false).' ';
- if ($this->changedIssue()) {
- $content .= '';
- foreach ($this->changes as $w => $v) {
- $content .= '';
- switch ($w) {
- case 'su':
- $content .= __('Summary:'); break;
- case 'st':
- $content .= __('Status:'); break;
- case 'ow':
- $content .= __('Owner:'); break;
- case 'lb':
- $content .= __('Labels:'); break;
- }
- $content .= ' ';
- if ($w == 'lb') {
- $content .= Pluf_esc(implode(', ', $v));
- } else {
- $content .= Pluf_esc($v);
- }
- $content .= ' ';
- }
- $content .= '
';
- }
+ $url .= '#ic'.$this->id;
$date = Pluf_Date::gmDateToGmString($this->creation_dtime);
- return Pluf_Translation::sprintf($base,
- array('url' => $url,
- 'title' => $title,
- 'content' => $content,
- 'date' => $date));
+ $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);
}
}
diff --git a/src/IDF/Upload.php b/src/IDF/Upload.php
index 4c93293..955af97 100644
--- a/src/IDF/Upload.php
+++ b/src/IDF/Upload.php
@@ -195,28 +195,23 @@ class IDF_Upload extends Pluf_Model
public function feedFragment($request)
{
- $base = '
- %%title%%
-
- %%url%%
- %%date%%
-
- %%content%%
-
- ';
- $url = Pluf_HTTP_URL_urlForView('IDF_Views_Download::view',
- array($request->project->shortname,
- $this->id));
+ $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'),
- Pluf_esc($request->project->name),
- $this->id, Pluf_esc($this->summary));
- $content = Pluf_esc($this->summary);
+ $request->project->name,
+ $this->id, $this->summary);
$date = Pluf_Date::gmDateToGmString($this->creation_dtime);
- return Pluf_Translation::sprintf($base,
- array('url' => $url,
- 'title' => $title,
- 'content' => $content,
- 'date' => $date));
+ $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);
}
/**
diff --git a/src/IDF/Views/Project.php b/src/IDF/Views/Project.php
index fb4ee08..1cc964f 100644
--- a/src/IDF/Views/Project.php
+++ b/src/IDF/Views/Project.php
@@ -177,14 +177,21 @@ class IDF_Views_Project
$params = array(
'filter' => $sql->gen(),
'order' => 'creation_dtime DESC',
- 'nb' => 50,
+ '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) {
- $out[] = $item->feedFragment($request);
+ 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');
@@ -194,6 +201,7 @@ class IDF_Views_Project
array($prj->shortname));
$context = new Pluf_Template_Context_Request($request,
array('body' => $out,
+ 'date' => $date,
'title' => $title,
'feedurl' => $feedurl,
'viewurl' => $viewurl));
diff --git a/src/IDF/WikiPage.php b/src/IDF/WikiPage.php
index ed7d39e..cd7e771 100644
--- a/src/IDF/WikiPage.php
+++ b/src/IDF/WikiPage.php
@@ -201,29 +201,24 @@ class IDF_WikiPage extends Pluf_Model
public function feedFragment($request)
{
- $base = '
- %%title%%
-
- %%url%%
- %%date%%
-
- %%content%%
-
- ';
$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'),
- Pluf_esc($request->project->name),
- Pluf_esc($this->title), Pluf_esc($this->summary));
- $content = Pluf_esc($this->summary);
+ $request->project->name,
+ $this->title, $this->summary);
$date = Pluf_Date::gmDateToGmString($this->creation_dtime);
- return Pluf_Translation::sprintf($base,
- array('url' => $url,
- 'title' => $title,
- 'content' => $content,
- 'date' => $date));
+ $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);
}
-
}
\ No newline at end of file
diff --git a/src/IDF/WikiRevision.php b/src/IDF/WikiRevision.php
index 135a8f8..a67d6ea 100644
--- a/src/IDF/WikiRevision.php
+++ b/src/IDF/WikiRevision.php
@@ -192,33 +192,31 @@ class IDF_WikiRevision extends Pluf_Model
public function feedFragment($request)
{
- $base = '
- %%title%%
-
- %%url%%
- %%date%%
-
- %%content%%
-
- ';
$page = $this->get_wikipage();
$url = Pluf::f('url_base')
.Pluf_HTTP_URL_urlForView('IDF_Views_Wiki::view',
array($request->project->shortname,
- $page->title));
+ $page->title),
+ array('rev' => $this->id));
$title = sprintf(__('%s: Documentation page %s updated - %s'),
- Pluf_esc($request->project->name),
- Pluf_esc($page->title), Pluf_esc($page->summary));
- $content = Pluf_esc($this->summary);
+ $request->project->name,
+ $page->title, $page->summary);
$date = Pluf_Date::gmDateToGmString($this->creation_dtime);
- return Pluf_Translation::sprintf($base,
- array('url' => $url,
- 'title' => $title,
- 'content' => $content,
- 'date' => $date));
+ $context = new Pluf_Template_Context_Request(
+ $request,
+ array('url' => $url,
+ 'title' => $title,
+ 'page' => $page,
+ 'rev' => $this,
+ 'create' => false,
+ 'date' => $date)
+ );
+ $tmpl = new Pluf_Template('idf/wiki/feedfragment.xml');
+ return $tmpl->render($context);
}
+
/**
* Notification of change of a WikiPage.
*
diff --git a/src/IDF/templates/idf/downloads/feedfragment.xml b/src/IDF/templates/idf/downloads/feedfragment.xml
new file mode 100644
index 0000000..601df74
--- /dev/null
+++ b/src/IDF/templates/idf/downloads/feedfragment.xml
@@ -0,0 +1,14 @@
+
+ {$title}
+
+ {$url}
+ {$date}
+ {$file.get_submitter()}
+
+
{$file} - {$file.filesize|ssize}
+{if $file.changelog}
+
{trans 'Details'}
+{markdown $file.changelog, $request}
+{/if}
+
+
diff --git a/src/IDF/templates/idf/index.atom b/src/IDF/templates/idf/index.atom
index 14b82f5..d48b03b 100644
--- a/src/IDF/templates/idf/index.atom
+++ b/src/IDF/templates/idf/index.atom
@@ -4,5 +4,6 @@
{$feedurl}
+ {$date}
{$body}
diff --git a/src/IDF/templates/idf/issues/feedfragment.xml b/src/IDF/templates/idf/issues/feedfragment.xml
new file mode 100644
index 0000000..15fda48
--- /dev/null
+++ b/src/IDF/templates/idf/issues/feedfragment.xml
@@ -0,0 +1,21 @@
+
+ {$title} - {$issue.get_status}
+
+ {$url}
+ {$date}
+ {$author}
+
+
{issuetext $c.content, $request}
+{assign $attachments = $c.get_attachment_list()}
+{if $attachments.count() > 0}
+
+
+{foreach $attachments as $a}{$a.filename} - {$a.filesize|ssize} {/foreach}
+ {/if}
+{if $c.changes}
+{foreach $c.changes as $w => $v}
+
{if $w == 'su'}{trans 'Summary:'}{/if}{if $w == 'st'}{trans 'Status:'}{/if}{if $w == 'ow'}{trans 'Owner:'}{/if}{if $w == 'lb'}{trans 'Labels:'}{/if} {if $w == 'lb'}{assign $l = implode(', ', $v)}{$l}{else}{$v}{/if}
+{/foreach}
+{/if}
+
+
diff --git a/src/IDF/templates/idf/source/feedfragment.xml b/src/IDF/templates/idf/source/feedfragment.xml
new file mode 100644
index 0000000..91eea24
--- /dev/null
+++ b/src/IDF/templates/idf/source/feedfragment.xml
@@ -0,0 +1,11 @@
+
+ {blocktrans}{$cproject.name}: Commit {$c.scm_id}{/blocktrans}
+
+ {$author}
+ {$url}
+ {$date}
+
+{issuetext $c.summary, $request}{if $c.fullmessage}
+{issuetext $c.fullmessage, $request, true, false, true, true, true}{/if}
+
+
diff --git a/src/IDF/templates/idf/wiki/feedfragment.xml b/src/IDF/templates/idf/wiki/feedfragment.xml
new file mode 100644
index 0000000..d017437
--- /dev/null
+++ b/src/IDF/templates/idf/wiki/feedfragment.xml
@@ -0,0 +1,11 @@
+
+ {$title}
+
+ {$url}:{$rev.id}
+ {$date}
+ {$rev.get_submitter()}
+
+{if !$create}
{trans 'Changes:'} {$rev.summary}:
{/if}
+{markdown $rev.content, $request}
+
+