aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-12-10 00:05:31 -0800
committerfriendica <info@friendica.com>2013-12-10 00:05:31 -0800
commite873f6e95ed167e48a557365089ec97abee473cc (patch)
tree0fce400cedb80748d1df0215e1492ace95c9e182
parented9f10872240231125007cf32b95007281558cac (diff)
downloadvolse-hubzilla-e873f6e95ed167e48a557365089ec97abee473cc.tar.gz
volse-hubzilla-e873f6e95ed167e48a557365089ec97abee473cc.tar.bz2
volse-hubzilla-e873f6e95ed167e48a557365089ec97abee473cc.zip
we're almost ready to turn on comanche for mod_network. All the widgets are done.
-rw-r--r--include/widgets.php67
-rw-r--r--mod/network.php131
-rw-r--r--version.inc2
3 files changed, 91 insertions, 109 deletions
diff --git a/include/widgets.php b/include/widgets.php
index e64920cdc..e0fc94e18 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -231,7 +231,72 @@ function widget_savedsearch($arr) {
'$searchbox' => searchbox('','netsearch-box',$srchurl . (($hasq) ? '' : '?f='),true),
'$saved' => $saved,
));
-
+
return $o;
}
+
+
+function widget_filer($arr) {
+ if(! local_user())
+ return '';
+
+ $a = get_app();
+
+ $selected = ((x($_REQUEST,'file')) ? $_REQUEST['file'] : '');
+
+ $terms = array();
+ $r = q("select distinct(term) from term where uid = %d and type = %d order by term asc",
+ intval(local_user()),
+ intval(TERM_FILE)
+ );
+ if(! $r)
+ return;
+
+ foreach($r as $rr)
+ $terms[] = array('name' => $rr['term'], 'selected' => (($selected == $rr['term']) ? 'selected' : ''));
+
+ return replace_macros(get_markup_template('fileas_widget.tpl'),array(
+ '$title' => t('Saved Folders'),
+ '$desc' => '',
+ '$sel_all' => (($selected == '') ? 'selected' : ''),
+ '$all' => t('Everything'),
+ '$terms' => $terms,
+ '$base' => z_root() . '/' . $a->cmd
+
+ ));
+}
+
+function widget_archive($arr) {
+
+ $o = '';
+ $a = get_app();
+
+ if(! $a->profile_uid) {
+ return '';
+ }
+
+ $uid = $a->profile_uid;
+
+ if(! feature_enabled($uid,'archives'))
+ return '';
+
+
+ $wall = ((array_key_exists('wall', $arr)) ? intval($arr['wall']) : 0);
+ $url = z_root() . '/' . $a->cmd;
+
+ $ret = posted_dates($uid,$wall);
+
+ if(! count($ret))
+ return '';
+
+ $o = replace_macros(get_markup_template('posted_date_widget.tpl'),array(
+ '$title' => t('Archives'),
+ '$size' => ((count($ret) > 6) ? 6 : count($ret)),
+ '$url' => $url,
+ '$dates' => $ret
+ ));
+ return $o;
+}
+
+
diff --git a/mod/network.php b/mod/network.php
index 6c9cef11e..31b377432 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -16,46 +16,34 @@ function network_init(&$a) {
$channel = $a->get_channel();
$a->profile_uid = local_user();
head_set_icon($channel['xchan_photo_s']);
-
-
- if(! x($a->page,'aside'))
- $a->page['aside'] = '';
-
- $search = ((x($_GET,'search')) ? $_GET['search'] : '');
-
-
-/*
- if(x($_GET,'save') && $search) {
- $r = q("select * from `term` where `uid` = %d and `type` = %d and `term` = '%s' limit 1",
- intval(local_user()),
- intval(TERM_SAVEDSEARCH),
- dbesc($search)
- );
- if(! count($r)) {
- q("insert into `term` ( `uid`,`type`,`term` ) values ( %d, %d, '%s') ",
- intval(local_user()),
- intval(TERM_SAVEDSEARCH),
- dbesc($search)
- );
- }
- }
- if(x($_GET,'remove')) {
- q("delete from `term` where `uid` = %d and `type` = %d and `term` = '%s' limit 1",
- intval(local_user()),
- intval(TERM_SAVEDSEARCH),
- dbesc($search)
- );
- }
-*/
+
require_once('include/widgets.php');
$a->set_widget('collections',widget_collections(array()));
- $a->set_widget('archives',posted_date_widget($a->get_baseurl() . '/network',local_user(),false));
+ $a->set_widget('archives',widget_archive(array()));
$a->set_widget('suggestions',widget_suggestions(array()));
$a->set_widget('savedsearch',widget_savedsearch(array()));
- $a->set_widget('filer',fileas_widget($a->get_baseurl(true) . '/network',(x($_GET, 'file') ? $_GET['file'] : '')));
+ $a->set_widget('filer',widget_filer(array()));
$a->set_widget('notes',widget_notes(array()));
+}
+
+function network_content(&$a, $update = 0, $load = false) {
+
+
+ if(! local_user()) {
+ $_SESSION['return_url'] = $a->query_string;
+ return login(false);
+ }
+
+
+ $arr = array('query' => $a->query_string);
+
+ call_hooks('network_content_init', $arr);
+
+ $channel = $a->get_channel();
+
+ $search = (($_GET['search']) ? $_GET['search'] : '');
if($search) {
if(strpos($search,'@') === 0) {
$r = q("select abook_id from abook left join xchan on abook_xchan = xchan_hash where xchan_name = '%s' and abook_channel = %d limit 1",
@@ -72,80 +60,7 @@ function network_init(&$a) {
}
}
- $group_id = ((x($_GET,'gid')) ? intval($_GET['gid']) : 0);
-
-
-
-
-}
-
-function saved_searches($search) {
- if(! feature_enabled(local_user(),'savedsearch'))
- return '';
-
- $a = get_app();
-
- $srchurl = '/network?f='
- . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '')
- . ((x($_GET,'star')) ? '&star=' . $_GET['star'] : '')
- . ((x($_GET,'conv')) ? '&conv=' . $_GET['conv'] : '')
- . ((x($_GET,'cmin')) ? '&cmin=' . $_GET['cmin'] : '')
- . ((x($_GET,'cmax')) ? '&cmax=' . $_GET['cmax'] : '')
- . ((x($_GET,'file')) ? '&file=' . $_GET['file'] : '');
- ;
-
- $o = '';
-
- $r = q("select `tid`,`term` from `term` WHERE `uid` = %d and `type` = %d ",
- intval(local_user()),
- intval(TERM_SAVEDSEARCH)
- );
-
- $saved = array();
-
- if(count($r)) {
- foreach($r as $rr) {
- $saved[] = array(
- 'id' => $rr['tid'],
- 'term' => $rr['term'],
- 'displayterm' => htmlspecialchars($rr['term']),
- 'encodedterm' => urlencode($rr['term']),
- 'delete' => t('Remove term'),
- 'selected' => ($search==$rr['term']),
- );
- }
- }
-
-
- $tpl = get_markup_template("saved_searches_aside.tpl");
- $o = replace_macros($tpl, array(
- '$title' => t('Saved Searches'),
- '$add' => t('add'),
- '$searchbox' => search('','netsearch-box',$srchurl,true),
- '$saved' => $saved,
- ));
-
- return $o;
-
-}
-
-
-
-function network_content(&$a, $update = 0, $load = false) {
-
-
- if(! local_user()) {
- $_SESSION['return_url'] = $a->query_string;
- return login(false);
- }
-
-
- $arr = array('query' => $a->query_string);
-
- call_hooks('network_content_init', $arr);
-
- $channel = $a->get_channel();
$datequery = $datequery2 = '';
@@ -229,7 +144,9 @@ function network_content(&$a, $update = 0, $load = false) {
// --- end item filter tabs
- $search = (($_GET['search']) ? $_GET['search'] : '');
+
+
+
// search terms header
if($search)
$o .= '<h2>' . t('Search Results For:') . ' ' . htmlspecialchars($search) . '</h2>';
diff --git a/version.inc b/version.inc
index 96c514ecf..e228ff0df 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2013-12-09.522
+2013-12-10.523