diff options
-rw-r--r-- | include/contact_widgets.php | 25 | ||||
-rw-r--r-- | include/widgets.php | 44 | ||||
-rw-r--r-- | mod/connections.php | 2 | ||||
-rw-r--r-- | mod/intro.php | 110 | ||||
-rw-r--r-- | mod/suggest.php | 3 | ||||
-rw-r--r-- | version.inc | 2 | ||||
-rwxr-xr-x | view/tpl/photo_drop.tpl | 2 |
7 files changed, 48 insertions, 140 deletions
diff --git a/include/contact_widgets.php b/include/contact_widgets.php index ac5382862..cc0a3d617 100644 --- a/include/contact_widgets.php +++ b/include/contact_widgets.php @@ -1,31 +1,6 @@ <?php /** @file */ -function follow_widget() { - $a = get_app(); - $uid =$a->channel['channel_id']; - $r = q("select count(*) as total from abook where abook_channel = %d and not (abook_flags & %d) ", - intval($uid), - intval(ABOOK_FLAG_SELF) - ); - if($r) - $total_channels = $r[0]['total']; - $limit = service_class_fetch($uid,'total_channels'); - if($limit !== false) { - $abook_usage_message = sprintf( t("You have %1$.0f of %2$.0f allowed connections."), $total_channels, $limit); - } - else { - $abook_usage_message = ''; - } - return replace_macros(get_markup_template('follow.tpl'),array( - '$connect' => t('Add New Connection'), - '$desc' => t('Enter the channel address'), - '$hint' => t('Example: bob@example.com, http://example.com/barbara'), - '$follow' => t('Connect'), - '$abook_usage_message' => $abook_usage_message - )); - -} function findpeople_widget() { require_once('include/Contact.php'); diff --git a/include/widgets.php b/include/widgets.php index f152e8ee1..632f85436 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -1,5 +1,18 @@ <?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(); @@ -92,4 +105,33 @@ function widget_suggestions($arr) { return $o; -}
\ No newline at end of file +} + + +function widget_follow($args) { + if(! local_user()) + return ''; + $a = get_app(); + $uid =$a->channel['channel_id']; + $r = q("select count(*) as total from abook where abook_channel = %d and not (abook_flags & %d) ", + intval($uid), + intval(ABOOK_FLAG_SELF) + ); + if($r) + $total_channels = $r[0]['total']; + $limit = service_class_fetch($uid,'total_channels'); + if($limit !== false) { + $abook_usage_message = sprintf( t("You have %1$.0f of %2$.0f allowed connections."), $total_channels, $limit); + } + else { + $abook_usage_message = ''; + } + return replace_macros(get_markup_template('follow.tpl'),array( + '$connect' => t('Add New Connection'), + '$desc' => t('Enter the channel address'), + '$hint' => t('Example: bob@example.com, http://example.com/barbara'), + '$follow' => t('Connect'), + '$abook_usage_message' => $abook_usage_message + )); + +} diff --git a/mod/connections.php b/mod/connections.php index b3532efbf..5711b2b3f 100644 --- a/mod/connections.php +++ b/mod/connections.php @@ -41,7 +41,7 @@ function connections_aside(&$a) { $a->set_widget('vcard',vcard_from_xchan($a->data['abook'],$a->get_observer())); } else { - $a->set_widget('follow', follow_widget()); + $a->set_widget('follow', widget_follow(array())); } $a->set_widget('collections', group_side('connections','group',false,0,((array_key_exists('abook',$a->data)) ? $a->data['abook']['abook_xchan'] : ''))); diff --git a/mod/intro.php b/mod/intro.php deleted file mode 100644 index 5b660485a..000000000 --- a/mod/intro.php +++ /dev/null @@ -1,110 +0,0 @@ -<?php - -function intro_post(&$a) { - if(! local_user()) - return; - if(! intval($_REQUEST['contact_id'])) - return; - - $approved = false; - $flags = 0; - if($_REQUEST['submit'] == t('Approve')) { - $approved = true; - } - elseif($_REQUEST['submit'] == t('Block')) { - $flags = ABOOK_FLAG_BLOCKED; - } - elseif($_REQUEST['submit'] == t('Ignore')) { - $flags = ABOOK_FLAG_IGNORED; - } - if(intval($_REQUEST['hidden'])) - $flags |= ABOOK_FLAG_HIDDEN; - - $r = q("update abook set abook_flags = %d where abook_channel = %d and abook_id = %d limit 1", - intval($flags), - intval(local_user()), - intval($_REQUEST['contact_id']) - ); - if($r) - info( t('Connection updated.') . EOL); - else - notice( t('Connection update failed.') . EOL); - - if($approved) - goaway(z_root() . '/connections/' . $_REQUEST['contact_id']); - - -} - -function intro_aside(&$a) { - require_once('include/contact_widgets.php'); - - $a->set_widget('follow', follow_widget()); - -} - - -function intro_content(&$a) { - - if( ! local_user()) { - notice( t('Permission denied.') . EOL); - return; - } - - - $o = replace_macros(get_markup_template('intros_header.tpl'),array( - '$title' => t('Introductions and Connection Requests') - )); - - $r = q("select count(abook_id) as total from abook where abook_channel = %d and (abook_flags & %d) and not (abook_flags & %d) ", - intval(local_user()), - intval(ABOOK_FLAG_PENDING), - intval(ABOOK_FLAG_SELF) - ); - if($r) { - $a->set_pager_total($r[0]['total']); - if(! intval($r[0]['total'])) { - notice( t('No pending introductions.') . EOL); - return $o; - } - } - else { - notice( t('System error. Please try again later.') . EOL); - return $o; - } - - $r = q("select abook.*, xchan.* from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and (abook_flags & %d) and not (abook_flags & %d) LIMIT %d, %d", - intval(local_user()), - intval(ABOOK_FLAG_PENDING), - intval(ABOOK_FLAG_SELF), - intval($a->pager['start']), - intval($a->pager['itemspage']) - ); - - if($r) { - - $tpl = get_markup_template("intros.tpl"); - - foreach($r as $rr) { - $o .= replace_macros($tpl,array( - '$uid' => local_user(), - - '$contact_id' => $rr['abook_id'], - '$photo' => ((x($rr,'xchan_photo_l')) ? $rr['xchan_photo_l'] : "images/person-175.jpg"), - '$fullname' => $rr['xchan_name'], - '$hidden' => array('hidden', t('Hide this contact from others'), ($rr['abook_flags'] & ABOOK_FLAG_HIDDEN), ''), - '$activity' => array('activity', t('Post a new friend activity'), (intval(get_pconfig(local_user(),'system','post_newfriend')) ? '1' : 0), t('if applicable')), - '$url' => zid($rr['xchan_url']), - '$approve' => t('Approve'), - '$block' => t('Block'), - '$ignore' => t('Ignore'), - '$discard' => t('Discard') - - )); - } - } - - $o .= paginate($a); - return $o; - -}
\ No newline at end of file diff --git a/mod/suggest.php b/mod/suggest.php index bfa471fa5..baccbd38f 100644 --- a/mod/suggest.php +++ b/mod/suggest.php @@ -2,6 +2,7 @@ require_once('include/socgraph.php'); require_once('include/contact_widgets.php'); +require_once('include/widgets.php'); function suggest_init(&$a) { @@ -20,7 +21,7 @@ function suggest_init(&$a) { function suggest_aside(&$a) { - $a->set_widget('follow', follow_widget()); + $a->set_widget('follow', widget_follow(array())); $a->set_widget('findpeople', findpeople_widget()); } diff --git a/version.inc b/version.inc index 33910aea3..96c514ecf 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2013-12-08.521 +2013-12-09.522 diff --git a/view/tpl/photo_drop.tpl b/view/tpl/photo_drop.tpl index 94ef5a3ee..cb7ae17ba 100755 --- a/view/tpl/photo_drop.tpl +++ b/view/tpl/photo_drop.tpl @@ -1,4 +1,4 @@ <div class="wall-item-delete-wrapper" id="wall-item-delete-wrapper-{{$id}}" > - <a href="item/drop/{{$id}}" onclick="return confirmDelete();" class="icon drophide" title="{{$delete}}" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a> + <a href="item/drop/{{$id}}" onclick="return confirmDelete();" title="{{$delete}}" ><i class="icon-remove drop-icons"></i></a> </div> <div class="wall-item-delete-end"></div> |