2015-08-23 22:38:18 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// A basic toolbar for observers with write_pages permissions
|
2017-02-05 16:11:01 +01:00
|
|
|
|
|
|
|
function writepages_widget ($who,$which) {
|
2015-08-23 22:38:18 +02:00
|
|
|
return replace_macros(get_markup_template('write_pages.tpl'), array(
|
|
|
|
'$new' => t('New Page'),
|
|
|
|
'$newurl' => "webpages/$who",
|
|
|
|
'$edit' => t('Edit'),
|
|
|
|
'$editurl' => "editwebpage/$who/$which"
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Chan is channel_id, $which is channel_address - we'll need to pass observer later too.
|
|
|
|
|
2017-02-05 16:11:01 +01:00
|
|
|
function pagelist_widget ($owner,$which) {
|
|
|
|
|
|
|
|
$r = q("select * from iconfig left join item on iconfig.iid = item.id where item_id.uid = %d
|
|
|
|
and iconfig.cat = 'system' and iconfig.k = 'WEBPAGE' order by item.created desc",
|
2015-08-23 22:38:18 +02:00
|
|
|
intval($owner)
|
|
|
|
);
|
|
|
|
|
|
|
|
$pages = null;
|
|
|
|
|
|
|
|
if($r) {
|
|
|
|
$pages = array();
|
|
|
|
foreach($r as $rr) {
|
2017-02-05 16:11:01 +01:00
|
|
|
$pages[$rr['iid']][] = array('url' => $rr['iid'],'pagetitle' => $rr['v'],'title' => $rr['title'],'created' => datetime_convert('UTC',date_default_timezone_get(),$rr['created']),'edited' => datetime_convert('UTC',date_default_timezone_get(),$rr['edited']));
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//Build the base URL for edit links
|
|
|
|
$url = z_root() . "/editwebpage/" . $which;
|
|
|
|
// This isn't pretty, but it works. Until I figure out what to do with the UI, it's Good Enough(TM).
|
|
|
|
return $o . replace_macros(get_markup_template("webpagelist.tpl"), array(
|
|
|
|
'$baseurl' => $url,
|
|
|
|
'$edit' => t('Edit'),
|
|
|
|
'$pages' => $pages,
|
|
|
|
'$channel' => $which,
|
|
|
|
'$view' => t('View'),
|
|
|
|
'$preview' => t('Preview'),
|
|
|
|
'$actions_txt' => t('Actions'),
|
|
|
|
'$pagelink_txt' => t('Page Link'),
|
|
|
|
'$title_txt' => t('Title'),
|
|
|
|
'$created_txt' => t('Created'),
|
|
|
|
'$edited_txt' => t('Edited')
|
|
|
|
|
|
|
|
));
|
|
|
|
|
|
|
|
}
|