Improve /itemsource display
- Add Item Id - Add Item Terms
This commit is contained in:
parent
7320c5e8e8
commit
cd53585101
2 changed files with 50 additions and 3 deletions
|
@ -2,9 +2,12 @@
|
|||
|
||||
namespace Friendica\Module;
|
||||
|
||||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Model;
|
||||
use Friendica\Protocol\ActivityPub\Processor;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
|
||||
/**
|
||||
* @author Hypolite Petovan <mrpetovan@gmail.com>
|
||||
|
@ -27,20 +30,27 @@ class Itemsource extends \Friendica\BaseModule
|
|||
|
||||
$source = '';
|
||||
$item_uri = '';
|
||||
$item_id = '';
|
||||
$terms = [];
|
||||
if (!empty($guid)) {
|
||||
$item = Model\Item::selectFirst([], ['guid' => $guid]);
|
||||
$item = Model\Item::selectFirst(['id', 'guid', 'uri'], ['guid' => $guid]);
|
||||
|
||||
$conversation = Model\Conversation::getByItemUri($item['uri']);
|
||||
|
||||
$guid = $item['guid'];
|
||||
$item_id = $item['id'];
|
||||
$item_uri = $item['uri'];
|
||||
$source = $conversation['source'];
|
||||
$terms = Model\Term::tagArrayFromItemId($item['id'], [Model\Term::HASHTAG, Model\Term::MENTION, Model\Term::IMPLICIT_MENTION]);
|
||||
}
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('debug/itemsource.tpl');
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$guid' => ['guid', L10n::t('Item Guid'), defaults($_REQUEST, 'guid', ''), ''],
|
||||
'$guid' => ['guid', L10n::t('Item Guid'), $guid, ''],
|
||||
'$source' => $source,
|
||||
'$item_uri' => $item_uri
|
||||
'$item_uri' => $item_uri,
|
||||
'$item_id' => $item_id,
|
||||
'$terms' => $terms,
|
||||
]);
|
||||
|
||||
return $o;
|
||||
|
|
|
@ -10,6 +10,14 @@
|
|||
|
||||
{{if $source}}
|
||||
<div class="itemsource-results">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Item Id</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
{{$item_id}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Item URI</h3>
|
||||
|
@ -18,6 +26,35 @@
|
|||
{{$item_uri}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Terms</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<table class="table table-condensed table-striped">
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Term</th>
|
||||
<th>URL</th>
|
||||
</tr>
|
||||
{{foreach $terms as $term}}
|
||||
<tr>
|
||||
<td>
|
||||
{{if $term.type == 1}}Tag{{/if}}
|
||||
{{if $term.type == 2}}Mention{{/if}}
|
||||
{{if $term.type == 8}}Implicit Mention{{/if}}
|
||||
</td>
|
||||
<td>
|
||||
{{$term.term}}
|
||||
</td>
|
||||
<td>
|
||||
{{$term.url}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Source</h3>
|
||||
|
|
Loading…
Reference in a new issue