diff --git a/src/IDF/Wiki/Page.php b/src/IDF/Wiki/Page.php
index cc7f5e9..0c4a35c 100644
--- a/src/IDF/Wiki/Page.php
+++ b/src/IDF/Wiki/Page.php
@@ -218,7 +218,7 @@ class IDF_Wiki_Page extends Pluf_Model
'create' => true,
'date' => $date)
);
- $tmpl = new Pluf_Template('idf/wiki/feedfragment.xml');
+ $tmpl = new Pluf_Template('idf/wiki/feedfragment-page.xml');
return $tmpl->render($context);
}
}
diff --git a/src/IDF/Wiki/PageRevision.php b/src/IDF/Wiki/PageRevision.php
index ae05d5d..12e9695 100644
--- a/src/IDF/Wiki/PageRevision.php
+++ b/src/IDF/Wiki/PageRevision.php
@@ -137,7 +137,7 @@ class IDF_Wiki_PageRevision extends Pluf_Model
function postSave($create=false)
{
- $prj = $this->get_wikipage()->get_project();
+ $page = $this->get_wikipage();
if ($create) {
// Check if more than one revision for this page. We do
@@ -148,7 +148,7 @@ class IDF_Wiki_PageRevision extends Pluf_Model
$sql = new Pluf_SQL('wikipage=%s', array($this->wikipage));
$rev = Pluf::factory('IDF_Wiki_PageRevision')->getList(array('filter'=>$sql->gen()));
if ($rev->count() > 1) {
- IDF_Timeline::insert($this, $prj, $this->get_submitter());
+ IDF_Timeline::insert($this, $page->get_project(), $this->get_submitter());
foreach ($rev as $r) {
if ($r->id != $this->id and $r->is_head) {
$r->is_head = false;
@@ -156,11 +156,11 @@ class IDF_Wiki_PageRevision extends Pluf_Model
}
}
}
- $page = $this->get_wikipage();
- $page->update(); // Will update the modification timestamp.
- IDF_Search::index($page);
}
+ IDF_Search::index($page);
+ $page->update(); // Will update the modification timestamp.
+
// remember the resource revisions used in this page revision
if ($this->is_head) {
preg_match_all('#\[\[!([A-Za-z0-9\-]+)[^\]]*\]\]#im', $this->content, $matches, PREG_PATTERN_ORDER);
@@ -183,9 +183,11 @@ class IDF_Wiki_PageRevision extends Pluf_Model
public function timelineFragment($request)
{
$page = $this->get_wikipage();
- $url = Pluf_HTTP_URL_urlForView('IDF_Views_Wiki::viewPage',
- array($request->project->shortname,
- $page->title));
+ $url = Pluf::f('url_base')
+ .Pluf_HTTP_URL_urlForView('IDF_Views_Wiki::viewPage',
+ array($request->project->shortname,
+ $page->title),
+ array('rev' => $this->id));
$out = "\n".'
'.
Pluf_esc(Pluf_Template_dateAgo($this->creation_dtime, 'without')).
' | ';
@@ -220,18 +222,12 @@ class IDF_Wiki_PageRevision extends Pluf_Model
public function feedFragment($request)
{
$page = $this->get_wikipage();
- if (!$this->is_head) {
- $url = Pluf::f('url_base')
- .Pluf_HTTP_URL_urlForView('IDF_Views_Wiki::viewPage',
- array($request->project->shortname,
- $page->title),
- array('rev' => $this->id));
- } else {
- $url = Pluf::f('url_base')
- .Pluf_HTTP_URL_urlForView('IDF_Views_Wiki::viewPage',
- array($request->project->shortname,
- $page->title));
- }
+ $url = Pluf::f('url_base')
+ .Pluf_HTTP_URL_urlForView('IDF_Views_Wiki::viewPage',
+ array($request->project->shortname,
+ $page->title),
+ array('rev' => $this->id));
+
$title = sprintf(__('%1$s: Documentation page %2$s updated - %3$s'),
$request->project->name,
$page->title, $page->summary);
@@ -245,7 +241,7 @@ class IDF_Wiki_PageRevision extends Pluf_Model
'create' => false,
'date' => $date)
);
- $tmpl = new Pluf_Template('idf/wiki/feedfragment.xml');
+ $tmpl = new Pluf_Template('idf/wiki/feedfragment-page.xml');
return $tmpl->render($context);
}
diff --git a/src/IDF/Wiki/Resource.php b/src/IDF/Wiki/Resource.php
index 3220a3c..487cf1a 100644
--- a/src/IDF/Wiki/Resource.php
+++ b/src/IDF/Wiki/Resource.php
@@ -175,7 +175,7 @@ class IDF_Wiki_Resource extends Pluf_Model
$user = $stag->start($this->get_submitter(), $request, '', false);
$out .= sprintf(__('%2$s, %3$s'), $url, Pluf_esc($this->title), Pluf_esc($this->summary)).' | ';
$out .= "\n".'
';
+'.sprintf(__('Creation of
resource %2$s, by %3$s'), $url, Pluf_esc($this->title), $user).'
';
return Pluf_Template::markSafe($out);
}
@@ -185,7 +185,7 @@ class IDF_Wiki_Resource extends Pluf_Model
.Pluf_HTTP_URL_urlForView('IDF_Views_Wiki::viewResource',
array($request->project->shortname,
$this->title));
- $title = sprintf(__('%1$s: Documentation page %2$s added - %3$s'),
+ $title = sprintf(__('%1$s: Documentation resource %2$s added - %3$s'),
$request->project->name,
$this->title, $this->summary);
$date = Pluf_Date::gmDateToGmString($this->creation_dtime);
@@ -193,12 +193,12 @@ class IDF_Wiki_Resource extends Pluf_Model
$request,
array('url' => $url,
'title' => $title,
- 'page' => $this,
+ 'resource' => $this,
'rev' => $this->get_current_revision(),
'create' => true,
'date' => $date)
- );
- $tmpl = new Pluf_Template('idf/wiki/feedfragment.xml');
+ );
+ $tmpl = new Pluf_Template('idf/wiki/feedfragment-resource.xml');
return $tmpl->render($context);
}
}
diff --git a/src/IDF/Wiki/ResourceRevision.php b/src/IDF/Wiki/ResourceRevision.php
index 0ec8fc0..ee1a3ea 100644
--- a/src/IDF/Wiki/ResourceRevision.php
+++ b/src/IDF/Wiki/ResourceRevision.php
@@ -135,6 +135,7 @@ class IDF_Wiki_ResourceRevision extends Pluf_Model
}
@unlink($this->getFilePath());
+ IDF_Timeline::remove($this);
}
function preSave($create=false)
@@ -147,10 +148,13 @@ class IDF_Wiki_ResourceRevision extends Pluf_Model
function postSave($create=false)
{
+ $resource = $this->get_wikiresource();
+
if ($create) {
$sql = new Pluf_SQL('wikiresource=%s', array($this->wikiresource));
$rev = Pluf::factory('IDF_Wiki_ResourceRevision')->getList(array('filter'=>$sql->gen()));
if ($rev->count() > 1) {
+ IDF_Timeline::insert($this, $resource->get_project(), $this->get_submitter());
foreach ($rev as $r) {
if ($r->id != $this->id and $r->is_head) {
$r->is_head = false;
@@ -158,10 +162,10 @@ class IDF_Wiki_ResourceRevision extends Pluf_Model
}
}
}
- // update the modification timestamp
- $resource = $this->get_wikiresource();
- $resource->update();
}
+
+ // update the modification timestamp
+ $resource->update();
}
function getFilePath()
@@ -285,4 +289,52 @@ class IDF_Wiki_ResourceRevision extends Pluf_Model
return '';
}
+
+
+ public function timelineFragment($request)
+ {
+ $resource = $this->get_wikiresource();
+ $url = Pluf::f('url_base')
+ .Pluf_HTTP_URL_urlForView('IDF_Views_Wiki::viewResource',
+ array($request->project->shortname,
+ $resource->title),
+ array('rev' => $this->id));
+
+ $out = "\n".''.
+ Pluf_esc(Pluf_Template_dateAgo($this->creation_dtime, 'without')).
+ ' | ';
+ $stag = new IDF_Template_ShowUser();
+ $user = $stag->start($this->get_submitter(), $request, '', false);
+ $out .= sprintf(__('%2$s, %3$s'), $url, Pluf_esc($resource->title), Pluf_esc($this->summary));
+ $out .= ' |
';
+ $out .= "\n".'';
+ return Pluf_Template::markSafe($out);
+ }
+
+ public function feedFragment($request)
+ {
+ $resource = $this->get_wikiresource();
+ $url = Pluf::f('url_base')
+ .Pluf_HTTP_URL_urlForView('IDF_Views_Wiki::viewResource',
+ array($request->project->shortname,
+ $resource->title),
+ array('rev' => $this->id));
+
+ $title = sprintf(__('%1$s: Documentation resource %2$s updated - %3$s'),
+ $request->project->name,
+ $resource->title, $resource->summary);
+ $date = Pluf_Date::gmDateToGmString($this->creation_dtime);
+ $context = new Pluf_Template_Context_Request(
+ $request,
+ array('url' => $url,
+ 'title' => $title,
+ 'resource' => $resource,
+ 'rev' => $this,
+ 'create' => false,
+ 'date' => $date)
+ );
+ $tmpl = new Pluf_Template('idf/wiki/feedfragment-resource.xml');
+ return $tmpl->render($context);
+ }
}
diff --git a/src/IDF/templates/idf/wiki/feedfragment-page.xml b/src/IDF/templates/idf/wiki/feedfragment-page.xml
new file mode 100644
index 0000000..6c0e625
--- /dev/null
+++ b/src/IDF/templates/idf/wiki/feedfragment-page.xml
@@ -0,0 +1,11 @@
+
+ {$title}
+
+ {$url}:{$rev.id}
+ {$date}
+ {$rev.get_submitter()}
+
+{if !$create}
{trans 'Changes:'} {$rev.summary}:
{/if}
+{markdown $rev.content, $request}
+
+
diff --git a/src/IDF/templates/idf/wiki/feedfragment-resource.xml b/src/IDF/templates/idf/wiki/feedfragment-resource.xml
new file mode 100644
index 0000000..2fddefb
--- /dev/null
+++ b/src/IDF/templates/idf/wiki/feedfragment-resource.xml
@@ -0,0 +1,11 @@
+
+ {$title}
+
+ {$url}:{$rev.id}
+ {$date}
+ {$rev.get_submitter()}
+
+{if !$create}
{trans 'Changes:'} {$rev.summary}
+{else}{trans 'Initial creation'}{/if}
+
+
diff --git a/src/IDF/templates/idf/wiki/feedfragment.xml b/src/IDF/templates/idf/wiki/feedfragment.xml
deleted file mode 100644
index d017437..0000000
--- a/src/IDF/templates/idf/wiki/feedfragment.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
- {$title}
-
- {$url}:{$rev.id}
- {$date}
- {$rev.get_submitter()}
-
-{if !$create}
{trans 'Changes:'} {$rev.summary}:
{/if}
-{markdown $rev.content, $request}
-
-