Fixed issue 268, atom feed corrupt.
This commit is contained in:
parent
e5934e0a3a
commit
f3cadfe013
@ -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 = '<content type="xhtml">'."\n"
|
||||
.'<div xmlns="http://www.w3.org/1999/xhtml">'
|
||||
.$tag->start($this->summary, $request, false, false, false);
|
||||
if ($this->fullmessage) {
|
||||
$summary .= '<br /><br />'
|
||||
.$tag->start($this->fullmessage, $request, false, false, false);
|
||||
}
|
||||
$date = Pluf_Date::gmDateToGmString($this->creation_dtime);
|
||||
$summary .= '</div></content>';
|
||||
$out = '<entry>
|
||||
<title>'.Pluf_esc($request->project->name).': '.__('Commit').' '.$this->scm_id.'</title>
|
||||
<link href="'.$url.'"/>
|
||||
<id>'.$url.'</id>
|
||||
<updated>'.$date.'</updated>'.$summary.'
|
||||
</entry>
|
||||
';
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -199,33 +199,27 @@ class IDF_Issue extends Pluf_Model
|
||||
|
||||
public function feedFragment($request)
|
||||
{
|
||||
$base = '<entry>
|
||||
<title>%%title%%</title>
|
||||
<link href="%%url%%"/>
|
||||
<id>%%url%%</id>
|
||||
<updated>%%date%%</updated>
|
||||
<content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">
|
||||
<pre>%%content%%</pre>
|
||||
</div></content>
|
||||
</entry>';
|
||||
$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,
|
||||
$context = new Pluf_Template_Context_Request(
|
||||
$request,
|
||||
array('url' => $url,
|
||||
'author' => $this->get_submitter(),
|
||||
'title' => $title,
|
||||
'content' => $content,
|
||||
'date' => $date));
|
||||
'c' => $cts[0],
|
||||
'issue' => $this,
|
||||
'date' => $date)
|
||||
);
|
||||
$tmpl = new Pluf_Template('idf/issues/feedfragment.xml');
|
||||
return $tmpl->render($context);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -167,66 +167,33 @@ class IDF_IssueComment extends Pluf_Model
|
||||
$out .= '</div>';
|
||||
}
|
||||
$out .= '</td></tr>';
|
||||
|
||||
|
||||
$out .= "\n".'<tr class="extra"><td colspan="2">
|
||||
<div class="helptext right">'.sprintf(__('Comment on <a href="%s" class="%s">issue %d</a>, by %s'), $url, $ic, $issue->id, $user).'</div></td></tr>';
|
||||
|
||||
return Pluf_Template::markSafe($out);
|
||||
}
|
||||
|
||||
public function feedFragment($request)
|
||||
{
|
||||
$base = '<entry>
|
||||
<title>%%title%%</title>
|
||||
<link href="%%url%%"/>
|
||||
<id>%%url%%</id>
|
||||
<updated>%%date%%</updated>
|
||||
<content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">
|
||||
%%content%%
|
||||
</div></content>
|
||||
</entry>';
|
||||
$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 = '<p><pre>'.$tag->start($this->content, $request, false).'</pre></p>';
|
||||
if ($this->changedIssue()) {
|
||||
$content .= '<p>';
|
||||
foreach ($this->changes as $w => $v) {
|
||||
$content .= '<strong>';
|
||||
switch ($w) {
|
||||
case 'su':
|
||||
$content .= __('Summary:'); break;
|
||||
case 'st':
|
||||
$content .= __('Status:'); break;
|
||||
case 'ow':
|
||||
$content .= __('Owner:'); break;
|
||||
case 'lb':
|
||||
$content .= __('Labels:'); break;
|
||||
}
|
||||
$content .= '</strong> ';
|
||||
if ($w == 'lb') {
|
||||
$content .= Pluf_esc(implode(', ', $v));
|
||||
} else {
|
||||
$content .= Pluf_esc($v);
|
||||
}
|
||||
$content .= ' ';
|
||||
}
|
||||
$content .= '</p>';
|
||||
}
|
||||
$url .= '#ic'.$this->id;
|
||||
$date = Pluf_Date::gmDateToGmString($this->creation_dtime);
|
||||
return Pluf_Translation::sprintf($base,
|
||||
$context = new Pluf_Template_Context_Request(
|
||||
$request,
|
||||
array('url' => $url,
|
||||
'author' => $issue->get_submitter(),
|
||||
'title' => $title,
|
||||
'content' => $content,
|
||||
'date' => $date));
|
||||
'c' => $this,
|
||||
'issue' => $issue,
|
||||
'date' => $date)
|
||||
);
|
||||
$tmpl = new Pluf_Template('idf/issues/feedfragment.xml');
|
||||
return $tmpl->render($context);
|
||||
}
|
||||
}
|
||||
|
@ -195,28 +195,23 @@ class IDF_Upload extends Pluf_Model
|
||||
|
||||
public function feedFragment($request)
|
||||
{
|
||||
$base = '<entry>
|
||||
<title>%%title%%</title>
|
||||
<link href="%%url%%"/>
|
||||
<id>%%url%%</id>
|
||||
<updated>%%date%%</updated>
|
||||
<content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">
|
||||
%%content%%
|
||||
</div></content>
|
||||
</entry>';
|
||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Download::view',
|
||||
$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,
|
||||
$context = new Pluf_Template_Context_Request(
|
||||
$request,
|
||||
array('url' => $url,
|
||||
'title' => $title,
|
||||
'content' => $content,
|
||||
'date' => $date));
|
||||
'file' => $this,
|
||||
'date' => $date)
|
||||
);
|
||||
$tmpl = new Pluf_Template('idf/downloads/feedfragment.xml');
|
||||
return $tmpl->render($context);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -177,15 +177,22 @@ 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) {
|
||||
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');
|
||||
@ -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));
|
||||
|
@ -201,29 +201,24 @@ class IDF_WikiPage extends Pluf_Model
|
||||
|
||||
public function feedFragment($request)
|
||||
{
|
||||
$base = '<entry>
|
||||
<title>%%title%%</title>
|
||||
<link href="%%url%%"/>
|
||||
<id>%%url%%</id>
|
||||
<updated>%%date%%</updated>
|
||||
<content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">
|
||||
%%content%%
|
||||
</div></content>
|
||||
</entry>';
|
||||
$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,
|
||||
$context = new Pluf_Template_Context_Request(
|
||||
$request,
|
||||
array('url' => $url,
|
||||
'title' => $title,
|
||||
'content' => $content,
|
||||
'date' => $date));
|
||||
'page' => $this,
|
||||
'rev' => $this->get_current_revision(),
|
||||
'create' => true,
|
||||
'date' => $date)
|
||||
);
|
||||
$tmpl = new Pluf_Template('idf/wiki/feedfragment.xml');
|
||||
return $tmpl->render($context);
|
||||
}
|
||||
|
||||
}
|
@ -192,33 +192,31 @@ class IDF_WikiRevision extends Pluf_Model
|
||||
|
||||
public function feedFragment($request)
|
||||
{
|
||||
$base = '<entry>
|
||||
<title>%%title%%</title>
|
||||
<link href="%%url%%"/>
|
||||
<id>%%url%%</id>
|
||||
<updated>%%date%%</updated>
|
||||
<content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">
|
||||
%%content%%
|
||||
</div></content>
|
||||
</entry>';
|
||||
$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,
|
||||
$context = new Pluf_Template_Context_Request(
|
||||
$request,
|
||||
array('url' => $url,
|
||||
'title' => $title,
|
||||
'content' => $content,
|
||||
'date' => $date));
|
||||
'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.
|
||||
*
|
||||
|
14
src/IDF/templates/idf/downloads/feedfragment.xml
Normal file
14
src/IDF/templates/idf/downloads/feedfragment.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<entry>
|
||||
<title>{$title}</title>
|
||||
<link href="{$url}"/>
|
||||
<id>{$url}</id>
|
||||
<updated>{$date}</updated>
|
||||
<author>{$file.get_submitter()}</author>
|
||||
<content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">
|
||||
<p>{$file} - {$file.filesize|ssize}</p>
|
||||
{if $file.changelog}
|
||||
<h2>{trans 'Details'}</h2>
|
||||
{markdown $file.changelog, $request}
|
||||
{/if}
|
||||
</div></content>
|
||||
</entry>
|
@ -4,5 +4,6 @@
|
||||
<link href="{$feedurl}" rel="self"/>
|
||||
<link href="{$viewurl}"/>
|
||||
<id>{$feedurl}</id>
|
||||
<updated>{$date}</updated>
|
||||
{$body}
|
||||
</feed>
|
||||
|
21
src/IDF/templates/idf/issues/feedfragment.xml
Normal file
21
src/IDF/templates/idf/issues/feedfragment.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<entry>
|
||||
<title>{$title} - {$issue.get_status}</title>
|
||||
<link href="{$url}"/>
|
||||
<id>{$url}</id>
|
||||
<updated>{$date}</updated>
|
||||
<author>{$author}</author>
|
||||
<content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">
|
||||
<pre>{issuetext $c.content, $request}</pre>
|
||||
{assign $attachments = $c.get_attachment_list()}
|
||||
{if $attachments.count() > 0}
|
||||
<hr align="left" class="attach" />
|
||||
<ul>
|
||||
{foreach $attachments as $a}<li><a href="{url 'IDF_Views_Issue::viewAttachment', array($project.shortname, $a.id, $a.filename)}">{$a.filename}</a> - {$a.filesize|ssize}</li>{/foreach}
|
||||
</ul>{/if}
|
||||
{if $c.changes}
|
||||
{foreach $c.changes as $w => $v}
|
||||
<strong>{if $w == 'su'}{trans 'Summary:'}{/if}{if $w == 'st'}{trans 'Status:'}{/if}{if $w == 'ow'}{trans 'Owner:'}{/if}{if $w == 'lb'}{trans 'Labels:'}{/if}</strong> {if $w == 'lb'}{assign $l = implode(', ', $v)}{$l}{else}{$v}{/if}<br />
|
||||
{/foreach}
|
||||
{/if}
|
||||
</div></content>
|
||||
</entry>
|
11
src/IDF/templates/idf/source/feedfragment.xml
Normal file
11
src/IDF/templates/idf/source/feedfragment.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<entry>
|
||||
<title>{blocktrans}{$cproject.name}: Commit {$c.scm_id}{/blocktrans}</title>
|
||||
<link href="{$url}"/>
|
||||
<author>{$author}</author>
|
||||
<id>{$url}</id>
|
||||
<updated>{$date}</updated>
|
||||
<content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">
|
||||
{issuetext $c.summary, $request}{if $c.fullmessage}<br /><br />
|
||||
{issuetext $c.fullmessage, $request, true, false, true, true, true}{/if}
|
||||
</div></content>
|
||||
</entry>
|
11
src/IDF/templates/idf/wiki/feedfragment.xml
Normal file
11
src/IDF/templates/idf/wiki/feedfragment.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<entry>
|
||||
<title>{$title}</title>
|
||||
<link href="{$url}"/>
|
||||
<id>{$url}:{$rev.id}</id>
|
||||
<updated>{$date}</updated>
|
||||
<author>{$rev.get_submitter()}</author>
|
||||
<content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">
|
||||
{if !$create}<p><strong>{trans 'Changes:'}</strong> {$rev.summary}:</p>{/if}
|
||||
{markdown $rev.content, $request}
|
||||
</div></content>
|
||||
</entry>
|
Loading…
Reference in New Issue
Block a user