aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/To-Do-Code.md2
-rw-r--r--include/widgets.php33
-rw-r--r--mod/photos.php17
-rw-r--r--view/pdl/mod_photos.pdl4
4 files changed, 29 insertions, 27 deletions
diff --git a/doc/To-Do-Code.md b/doc/To-Do-Code.md
index df8a476b9..dc2ba8245 100644
--- a/doc/To-Do-Code.md
+++ b/doc/To-Do-Code.md
@@ -43,7 +43,7 @@ We need much more than this, but here are areas where developers can help. Pleas
* Family Account creation - using service classes (an account holder can create a certain number of sub-accounts which are all tied to their subscription - if the subscription lapses they all go away).
-* Re-working of widgets so that entire application and page contents (e.g. modules) will be available to and under the control of themes/apps using Comanche layouts.
+* (In Progress) Re-working of widgets so that entire application and page contents (e.g. modules) will be available to and under the control of themes/apps using Comanche layouts.
In many cases some of the work has already been started and code exists so that you needn't start from scratch. Please contact one of the developer channels like Channel One (one@zothub.com) before embarking and we can tell you what we already have and provide some insights on how we envision these features fitting together.
diff --git a/include/widgets.php b/include/widgets.php
index 5418d6d8e..5bb937c2e 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -1,18 +1,5 @@
<?php /** @file */
-function list_widgets() {
- $widgets = array(
- 'profile' => t('Displays a full channel profile'),
- 'tagcloud' => t('Tag cloud of webpage categories'),
- 'collections' => t('List and filter by collection'),
- 'suggestions' => t('Show a couple of channel suggestion'),
- 'follow' => t('Provide a channel follow form')
- );
- $arr = array('widgets' => $widgets);
- call_hooks('list_widgets',$arr);
- return $arr['widgets'];
-}
-
function widget_profile($args) {
$a = get_app();
@@ -514,4 +501,22 @@ function widget_design_tools($arr) {
function widget_findpeople($arr) {
return findpeople_widget();
-} \ No newline at end of file
+}
+
+
+function widget_photo_albums($arr) {
+ $a = get_app();
+ if(! $a->profile['profile_uid'])
+ return '';
+ $channelx = channelx_by_n($a->profile['profile_uid']);
+ if((! $channelx) || (! perm_is_allowed($a->profile['profile_uid'],get_observer_hash(),'view_photos')))
+ return '';
+ return photos_album_widget($channelx[0],$a->get_observer());
+
+}
+
+
+function widget_vcard($arr) {
+ return vcard_from_xchan('',get_app()->get_observer());
+}
+
diff --git a/mod/photos.php b/mod/photos.php
index 0e23aa5bf..63806896b 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -34,16 +34,7 @@ function photos_init(&$a) {
$observer_xchan = (($observer) ? $observer['xchan_hash'] : '');
- $a->data['perms'] = get_all_perms($channelx[0]['channel_id'],$observer_xchan);
-
-
-
- $a->set_widget('vcard',vcard_from_xchan('',$observer));
head_set_icon($a->data['channel']['xchan_photo_s']);
- if($a->data['perms']['view_photos']) {
- $a->data['albums'] = photos_albums_list($a->data['channel'],$observer);
- $a->set_widget('photo_albums',photos_album_widget($a->data['channel'],$observer,$a->data['albums']));
- }
$a->page['htmlhead'] .= "<script> var ispublic = '" . t('everybody') . "'; var profile_uid = " . (($a->data['channel']) ? $a->data['channel']['channel_id'] : 0) . "; </script>" ;
@@ -599,6 +590,8 @@ function photos_content(&$a) {
// Parse arguments
//
+ $can_comment = perm_is_allowed($a->profile['profile_uid'],get_observer_hash(),'post_comments');
+
if(argc() > 3) {
$datatype = argv(2);
$datum = argv(3);
@@ -1066,7 +1059,7 @@ function photos_content(&$a) {
$likebuttons = '';
- if($can_post || $a->data['perms']['post_comments']) {
+ if($can_post || $can_comment) {
$likebuttons = replace_macros($like_tpl,array(
'$id' => $link_item['id'],
'$likethis' => t("I like this \x28toggle\x29"),
@@ -1078,7 +1071,7 @@ function photos_content(&$a) {
$comments = '';
if(! count($r)) {
- if($can_post || $a->data['perms']['post_comments']) {
+ if($can_post || $can_comment) {
$comments .= replace_macros($cmnt_tpl,array(
'$return_path' => '',
'$mode' => 'photos',
@@ -1166,7 +1159,7 @@ function photos_content(&$a) {
}
- if($can_post || $a->data['perms']['post_comments']) {
+ if($can_post || $can_comment) {
$comments .= replace_macros($cmnt_tpl,array(
'$return_path' => '',
'$jsreload' => $return_url,
diff --git a/view/pdl/mod_photos.pdl b/view/pdl/mod_photos.pdl
new file mode 100644
index 000000000..c37cf02fe
--- /dev/null
+++ b/view/pdl/mod_photos.pdl
@@ -0,0 +1,4 @@
+[region=aside]
+[widget=vcard][/widget]
+[widget=photo_albums][/widget]
+[/region]