Adding RSS icons to make it more obvious on how to subscribe to feeds issue 32

Adding ability to download project information issue 35
This commit is contained in:
Nathan Adams 2014-04-04 23:54:03 -05:00
parent 0d6b904cd6
commit dd56d8f29f
3 changed files with 52 additions and 1 deletions

View File

@ -325,6 +325,53 @@ class IDF_Views_Project
$request);
}
public $backup_precond = array('IDF_Precondition::projectOwner');
public function backup($request, $match)
{
$prj = $request->project;
$to_json = array();
$to_json["IDF_Project"] = Pluf_Test_Fixture::prepare(Pluf::factory("IDF_Project")->getOne(array("filter" => "id=" . $prj->id)));
$to_json["IDF_Issue"] = array();
$to_json["IDF_Upload"] = array();
$to_json["IDF_Wiki_Page"] = array();
foreach(Pluf::factory("IDF_Issue")->getList(array("filter"=>"project=".$prj->id)) as $item)
{
$tmp = array();
$tmp = Pluf_Test_Fixture::dump($item, false);
$tmp = $tmp[0];
$tmp["comments"] = array();
foreach($item->get_comments_list() as $item2)
$tmp["comments"][] = Pluf_Test_Fixture::dump($item2, false)[0];
$to_json["IDF_Issue"][] = $tmp;
}
foreach(Pluf::factory("IDF_Upload")->getList(array("filter"=>"project=".$prj->id)) as $item)
{
$path = $item->getFullPath();
$file = file_get_contents($path);
$tmp = Pluf_Test_Fixture::dump($item, false);
$tmp[0]["file_encoded"] = base64_encode($file);
$to_json["IDF_Upload"][] = $tmp[0];
}
foreach(Pluf::factory("IDF_Wiki_Page")->getList(array("filter"=>"project=".$prj->id)) as $item)
{
$tmp = Pluf_Test_Fixture::dump($item, false)[0];
$tmp["WikiPageRevs"] = array();
foreach($item->get_revisions_list() as $item2)
$tmp["WikiPageRevs"][] = Pluf_Test_Fixture::dump($item2, false)[0];
$to_json["IDF_Wiki_Page"][] = $tmp;
}
$render = new Pluf_HTTP_Response(json_encode($to_json), "application/json");
$render->headers['Content-Disposition'] = 'attachment; filename="backup-' . $prj->name . '-' . date("YmdGis") . '.json"';
return $render;
}
/**
* Administrate the issue tracking of a project.
*/

View File

@ -100,4 +100,8 @@
<p>The description of the project can be improved using the <a href="{$url}">Markdown syntax</a>.</p>
{/blocktrans}
</div>
<div class="issue-submit-info">
<p><strong>Download Project</strong></p>
<p>A copy of the project can be downloaded here: <a href="{url 'IDF_Views_Project::backup', array($project.shortname)}">Download</a></p>
</div>
{/block}

View File

@ -3,7 +3,7 @@
{block tabhome} class="active"{/block}
{block subtabs}
<div id="sub-tabs">
<a href="{url 'IDF_Views_Project::home', array($project.shortname)}" class="active">{trans 'Welcome'}</a> | <strong><a href="{url 'IDF_Views_Project::timeline', array($project.shortname, 'all')}">{trans 'Latest Updates'}</a></strong>{superblock}
<a href="{url 'IDF_Views_Project::home', array($project.shortname)}" class="active">{trans 'Welcome'}</a> | <a href="{url 'IDF_Views_Project::timelineFeed', array($project.shortname, 'all')}"><img src="{media '/idf/img/feediconorig.png'}" alt="{trans 'RSS'}" /></a> <strong><a href="{url 'IDF_Views_Project::timeline', array($project.shortname, 'all')}">{trans 'Latest Updates'}</a></strong>{superblock}
</div>
{/block}
{block body}