Indefero

Indefero Commit Details


Date:2011-12-20 16:26:29 (13 years 1 day ago)
Author:Thomas Keller
Branch:develop, release-1.3
Commit:5ffe66cbfbdc5f30372a9bcc3f6ca4f679bc1520
Parents: 0f4c952cbd8f9e279a2461892519dd8f93cb9389
Message:Add resource revisions to the timeline and add proper templates and rendering for resources and resource revisions (this is needed later on for the taxonomy). Directly link to individual resource / page revisions from the timeline as well.

Changes:

File differences

src/IDF/Wiki/Page.php
218218
219219
220220
221
221
222222
223223
224224
'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);
}
}
src/IDF/Wiki/PageRevision.php
137137
138138
139139
140
140
141141
142142
143143
......
148148
149149
150150
151
151
152152
153153
154154
......
156156
157157
158158
159
160
161
162159
163160
161
162
163
164164
165165
166166
......
183183
184184
185185
186
187
188
186
187
188
189
190
189191
190192
191193
......
220222
221223
222224
223
224
225
226
227
228
229
230
231
232
233
234
225
226
227
228
229
230
235231
236232
237233
......
245241
246242
247243
248
244
249245
250246
251247
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
$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;
}
}
}
$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);
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".'<tr class="log"><td><a href="'.$url.'">'.
Pluf_esc(Pluf_Template_dateAgo($this->creation_dtime, 'without')).
'</a></td><td>';
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);
'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);
}
src/IDF/Wiki/Resource.php
175175
176176
177177
178
178
179179
180180
181181
......
185185
186186
187187
188
188
189189
190190
191191
......
193193
194194
195195
196
196
197197
198198
199199
200
201
200
201
202202
203203
204204
$user = $stag->start($this->get_submitter(), $request, '', false);
$out .= sprintf(__('<a href="%1$s" title="View resource">%2$s</a>, %3$s'), $url, Pluf_esc($this->title), Pluf_esc($this->summary)).'</td>';
$out .= "\n".'<tr class="extra"><td colspan="2">
<div class="helptext right">'.sprintf(__('Creation of <a href="%1$s">page %2$s</a>, by %3$s'), $url, Pluf_esc($this->title), $user).'</div></td></tr>';
<div class="helptext right">'.sprintf(__('Creation of <a href="%1$s">resource %2$s</a>, by %3$s'), $url, Pluf_esc($this->title), $user).'</div></td></tr>';
return Pluf_Template::markSafe($out);
}
.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);
$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);
}
}
src/IDF/Wiki/ResourceRevision.php
135135
136136
137137
138
138139
139140
140141
......
147148
148149
149150
151
152
150153
151154
152155
153156
157
154158
155159
156160
......
158162
159163
160164
161
162
163
164165
166
167
168
165169
166170
167171
......
285289
286290
287291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
288340
}
@unlink($this->getFilePath());
IDF_Timeline::remove($this);
}
function preSave($create=false)
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;
}
}
}
// update the modification timestamp
$resource = $this->get_wikiresource();
$resource->update();
}
// update the modification timestamp
$resource->update();
}
function getFilePath()
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".'<tr class="log"><td><a href="'.$url.'">'.
Pluf_esc(Pluf_Template_dateAgo($this->creation_dtime, 'without')).
'</a></td><td>';
$stag = new IDF_Template_ShowUser();
$user = $stag->start($this->get_submitter(), $request, '', false);
$out .= sprintf(__('<a href="%1$s" title="View resource">%2$s</a>, %3$s'), $url, Pluf_esc($resource->title), Pluf_esc($this->summary));
$out .= '</td></tr>';
$out .= "\n".'<tr class="extra"><td colspan="2">
<div class="helptext right">'.sprintf(__('Change of <a href="%1$s">%2$s</a>, by %3$s'), $url, Pluf_esc($resource->title), $user).'</div></td></tr>';
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);
}
}
src/IDF/templates/idf/wiki/feedfragment-page.xml
1
2
3
4
5
6
7
8
9
10
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>
src/IDF/templates/idf/wiki/feedfragment-resource.xml
1
2
3
4
5
6
7
8
9
10
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>
{else}{trans 'Initial creation'}{/if}
</div></content>
</entry>
src/IDF/templates/idf/wiki/feedfragment.xml
1
2
3
4
5
6
7
8
9
10
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>

Archive Download the corresponding diff file

Page rendered in 0.10176s using 13 queries.