mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 23:55:19 +00:00
layout export to file
This commit is contained in:
parent
bfd9f5ec87
commit
cdd2e9cd95
3 changed files with 38 additions and 3 deletions
|
@ -40,6 +40,20 @@ function layouts_content(&$a) {
|
|||
return;
|
||||
}
|
||||
|
||||
if((argc() > 3) && (argv(2) === 'share') && (argv(3))) {
|
||||
$r = q("select sid, service, mimetype, title, body from item_id left join item on item.id = item_id.iid where item_id.uid = %d and item.mid = '%s' and service = 'PDL' order by sid asc",
|
||||
intval($owner),
|
||||
dbesc(argv(3))
|
||||
);
|
||||
if($r) {
|
||||
header('Content-type: application/x-redmatrix-layout');
|
||||
header('Content-disposition: attachment; filename="' . $r[0]['sid'] . '.pdl"');
|
||||
echo json_encode($r);
|
||||
killme();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$tabs = array(
|
||||
array(
|
||||
'label' => t('Layout Help'),
|
||||
|
@ -75,7 +89,7 @@ function layouts_content(&$a) {
|
|||
// Get a list of blocks. We can't display all them because endless scroll makes that unusable, so just list titles and an edit link.
|
||||
// TODO - this should be replaced with pagelist_widget
|
||||
|
||||
$r = q("select * from item_id where uid = %d and service = 'PDL' order by sid asc",
|
||||
$r = q("select iid, sid, mid from item_id left join item on item.id = item_id.iid where item_id.uid = %d and service = 'PDL' order by sid asc",
|
||||
intval($owner)
|
||||
);
|
||||
|
||||
|
@ -84,7 +98,7 @@ function layouts_content(&$a) {
|
|||
if($r) {
|
||||
$pages = array();
|
||||
foreach($r as $rr) {
|
||||
$pages[$rr['iid']][] = array('url' => $rr['iid'],'title' => $rr['sid']);
|
||||
$pages[$rr['iid']][] = array('url' => $rr['iid'],'title' => $rr['sid'], 'mid' => $rr['mid']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,9 +106,10 @@ function layouts_content(&$a) {
|
|||
//Build the base URL for edit links
|
||||
$url = z_root() . "/editlayout/" . $which;
|
||||
|
||||
return $o . replace_macros(get_markup_template("webpagelist.tpl"), array(
|
||||
return $o . replace_macros(get_markup_template("layoutlist.tpl"), array(
|
||||
'$baseurl' => $url,
|
||||
'$edit' => t('Edit'),
|
||||
'$share' => t('Share'),
|
||||
'$pages' => $pages,
|
||||
'$channel' => $which,
|
||||
'$view' => t('View'),
|
||||
|
|
|
@ -53,4 +53,5 @@ $(document).ready(function() {
|
|||
$('.icon-circle').addClass('');
|
||||
$('.icon-bookmark').addClass('');
|
||||
$('.icon-fullscreen').addClass('');
|
||||
$('.icon-share').addClass('');
|
||||
});
|
19
view/tpl/layoutlist.tpl
Normal file
19
view/tpl/layoutlist.tpl
Normal file
|
@ -0,0 +1,19 @@
|
|||
{{if $pages}}
|
||||
|
||||
<div id="pagelist-content-wrapper" class="generic-content-wrapper">
|
||||
{{foreach $pages as $key => $items}}
|
||||
{{foreach $items as $item}}
|
||||
<div class="page-list-item">
|
||||
{{if $edit}}<a href="{{$baseurl}}/{{$item.url}}" title="{{$edit}}"><i class="icon-pencil design-icons design-edit-icon"></i></a> {{/if}}
|
||||
{{if $view}}<a href="page/{{$channel}}/{{$item.title}}" title="{{$view}}"><i class="icon-external-link design-icons design-view-icon"></i></a> {{/if}}
|
||||
{{if $share}}<a href="layouts/{{$channel}}/share/{{$item.mid}}" title="{{$share}}"><i class="icon-share design-icons"></i></a> {{/if}}
|
||||
{{if $preview}}<a href="page/{{$channel}}/{{$item.title}}?iframe=true&width=80%&height=80%" title="{{$preview}}" class="webpage-preview" ><i class="icon-eye-open design-icons design-preview-icon"></i></a> {{/if}}
|
||||
{{$item.title}}
|
||||
</div>
|
||||
{{/foreach}}
|
||||
{{/foreach}}
|
||||
</div>
|
||||
|
||||
<div class="clear"></div>
|
||||
|
||||
{{/if}}
|
Loading…
Reference in a new issue