comanchificate mod_photos

This commit is contained in:
friendica 2013-12-19 17:36:31 -08:00
parent 7c81889b33
commit 564f431551
4 changed files with 29 additions and 27 deletions

View File

@ -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.

View File

@ -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();
}
}
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());
}

View File

@ -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,

4
view/pdl/mod_photos.pdl Normal file
View File

@ -0,0 +1,4 @@
[region=aside]
[widget=vcard][/widget]
[widget=photo_albums][/widget]
[/region]