aboutsummaryrefslogtreecommitdiffstats
path: root/include/page_widgets.php
diff options
context:
space:
mode:
authorThomas Willingham <founder@kakste.com>2013-08-14 20:46:48 +0100
committerThomas Willingham <founder@kakste.com>2013-08-14 20:46:48 +0100
commit608e04c65eb2433a1cece9b5798f8577b611a288 (patch)
treec63c91f20d0bd5fd71e9afda20998d00ea28e3a8 /include/page_widgets.php
parenta0dfd44f9178796eaf55e4a2ab0194c12e7dfd21 (diff)
downloadvolse-hubzilla-608e04c65eb2433a1cece9b5798f8577b611a288.tar.gz
volse-hubzilla-608e04c65eb2433a1cece9b5798f8577b611a288.tar.bz2
volse-hubzilla-608e04c65eb2433a1cece9b5798f8577b611a288.zip
More progress on pages - extend writepages widget, add pagelist widget
Diffstat (limited to 'include/page_widgets.php')
-rw-r--r--include/page_widgets.php31
1 files changed, 29 insertions, 2 deletions
diff --git a/include/page_widgets.php b/include/page_widgets.php
index 21d5e5382..23d6d25ba 100644
--- a/include/page_widgets.php
+++ b/include/page_widgets.php
@@ -1,8 +1,8 @@
<?php
-// A toolbar for observers with write_pages permissions
+// A basic toolbar for observers with write_pages permissions
function writepages_widget ($who,$which){
-return replace_macros(get_markup_template('write_pages.tpl'), array(
+ return replace_macros(get_markup_template('write_pages.tpl'), array(
'$new' => t('New Page'),
'$newurl' => "webpages/$who",
'$edit' => t('edit'),
@@ -10,3 +10,30 @@ return replace_macros(get_markup_template('write_pages.tpl'), array(
));
}
+
+
+// Chan is channel_id, $who is channel_address - we'll need to pass observer later too.
+function pagelist_widget ($chan,$who){
+ $r = q("select * from item_id where uid = %d and service = 'WEBPAGE' order by sid asc",
+ intval($chan)
+ );
+ $pages = null;
+// TODO - only list public pages. Doesn't matter for now, since we don't have ACL anyway.
+
+ if($r) {
+ $pages = array();
+ foreach($r as $rr) {
+ $pages[$rr['iid']][] = array('url' => $rr['iid'],'title' => $rr['sid']);
+ }
+ }
+
+ return replace_macros(get_markup_template('webpagelist.tpl'), array(
+ '$baseurl' => $url,
+ '$edit' => '',
+ '$pages' => $pages,
+ '$channel' => $who,
+ '$preview' => '',
+ '$widget' => 1,
+ ));
+
+}