aboutsummaryrefslogtreecommitdiffstats
path: root/include/page_widgets.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-08-14 20:56:49 -0700
committerfriendica <info@friendica.com>2013-08-14 20:56:49 -0700
commit7d0b1506a8b4e476cdabb33b6cc945b4f4113fff (patch)
tree45ff2b6d3bef287b2ccd98ec35a5ec43b5f70972 /include/page_widgets.php
parentac541a7d3246e1c5c60ae752326c1b9ba5ccd78f (diff)
parent608e04c65eb2433a1cece9b5798f8577b611a288 (diff)
downloadvolse-hubzilla-7d0b1506a8b4e476cdabb33b6cc945b4f4113fff.tar.gz
volse-hubzilla-7d0b1506a8b4e476cdabb33b6cc945b4f4113fff.tar.bz2
volse-hubzilla-7d0b1506a8b4e476cdabb33b6cc945b4f4113fff.zip
Merge pull request #96 from beardy-unixer/master
Webpages
Diffstat (limited to 'include/page_widgets.php')
-rw-r--r--include/page_widgets.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/include/page_widgets.php b/include/page_widgets.php
new file mode 100644
index 000000000..23d6d25ba
--- /dev/null
+++ b/include/page_widgets.php
@@ -0,0 +1,39 @@
+<?php
+
+// A basic toolbar for observers with write_pages permissions
+function writepages_widget ($who,$which){
+ 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, $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,
+ ));
+
+}