From 9e2705d9d3add426fae4ef998075dab72a736b34 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Fri, 11 Sep 2009 20:40:51 -0400 Subject: The site id was hardcoded inside the plugin code. Instead the piwikid is used now. Fixes http://status.net/trac/ticket/1864 Thanks zmf --- plugins/PiwikAnalyticsPlugin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/PiwikAnalyticsPlugin.php b/plugins/PiwikAnalyticsPlugin.php index 85a24c132..45a11dfe4 100644 --- a/plugins/PiwikAnalyticsPlugin.php +++ b/plugins/PiwikAnalyticsPlugin.php @@ -96,7 +96,7 @@ document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/ja -EOT; - $action->raw($js_string); $action->script('plugins/Autocomplete/jquery-autocomplete/jquery.autocomplete.pack.js'); $action->script('plugins/Autocomplete/Autocomplete.js'); } @@ -59,5 +54,12 @@ EOT; } } + function onRouterInitialized($m) + { + if (common_logged_in()) { + $m->connect('plugins/Autocomplete/autocomplete.json', array('action'=>'autocomplete')); + } + } + } ?> diff --git a/plugins/Autocomplete/autocomplete.php b/plugins/Autocomplete/autocomplete.php new file mode 100644 index 000000000..96d54af8d --- /dev/null +++ b/plugins/Autocomplete/autocomplete.php @@ -0,0 +1,90 @@ +. + * + * @category Plugin + * @package StatusNet + * @author Craig Andrews + * @copyright 2008-2009 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET') && !defined('LACONICA')) { + exit(1); +} + +/** + * List users for autocompletion + * + * This is the form for adding a new g + * + * @category Plugin + * @package StatusNet + * @author Craig Andrews + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +class AutocompleteAction extends Action +{ + private $result; + + function prepare($args) + { + parent::prepare($args); + $this->results = array(); + $q = $this->arg('q'); + $limit = $this->arg('limit'); + if($limit > 200) $limit=200; //prevent DOS attacks + if(substr($q,0,1)=='@'){ + //user search + $q=substr($q,1); + $user = new User(); + $user->limit($limit); + $user->whereAdd('nickname like \'' . trim($user->escape($q), '\'') . '%\''); + $user->find(); + while($user->fetch()) { + $profile = Profile::pkeyGet(array('id' => $user->id)); + $this->results[]=array('nickname' => $user->nickname, 'fullname'=> $profile->fullname, 'type'=>'user'); + } + } + if(substr($q,0,1)=='!'){ + //group search + $q=substr($q,1); + $group = new User_group(); + $group->limit($limit); + $group->whereAdd('nickname like \'' . trim($group->escape($q), '\'') . '%\''); + $group->find(); + while($group->fetch()) { + $this->results[]=array('nickname' => $group->nickname, 'fullname'=> $group->fullname, 'type'=>'group'); + } + } + return true; + } + + function handle($args) + { + parent::handle($args); + foreach($this->results as $result) { + print json_encode($result) . "\n"; + } + } +} -- cgit v1.2.3-54-g00ecf From a9cf185e692fdc9dea2a9b127826ea8e0f9f1021 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Tue, 15 Sep 2009 13:53:16 +0000 Subject: Updated XHR return markup for Realtime plugin --- plugins/Realtime/realtimeupdate.js | 42 +++++++++----------------------------- 1 file changed, 10 insertions(+), 32 deletions(-) (limited to 'plugins') diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index d55db5859..eba8ac1d9 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -1,8 +1,8 @@ // add a notice encoded as JSON into the current timeline // +// TODO: i18n RealtimeUpdate = { - _userid: 0, _replyurl: '', _favorurl: '', @@ -50,26 +50,15 @@ RealtimeUpdate = { "

"+html+"

"+ ""+ "
"+ - "
"+ - "
Published
"+ - "
"+ - ""+ + ""+ "a few seconds ago"+ " "+ - "
"+ - "
"+ - "
"+ - "
From
"+ - "
"+source+"
"+ // may have a link, I think - "
"; - + ""+ + "from "+ + "+source+"++ // may have a link + ""; if (data['in_reply_to_status_id']) { - ni = ni+"
"+ - "
To
"+ - "
"+ - "in reply to"+ - "
"+ - "
"; + ni = ni+" in context"; } ni = ni+"
"+ @@ -96,7 +85,7 @@ RealtimeUpdate = { ff = "
"+ "
"+ - "Favor this notice"+ // XXX: i18n + "Favor this notice"+ ""+ ""+ ""+ @@ -108,13 +97,7 @@ RealtimeUpdate = { makeReplyLink: function(id, nickname) { var rl; - rl = "
"+ - "
Reply to this notice
"+ - "
"+ - "Reply "+id+""+ - ""+ - "
"+ - "
"; + rl = "Reply "+id+""; return rl; }, @@ -123,12 +106,7 @@ RealtimeUpdate = { var dl, delurl; delurl = RealtimeUpdate._deleteurl.replace("0000000000", id); - dl = "
"+ - "
Delete this notice
"+ - "
"+ - "Delete"+ - "
"+ - "
"; + dl = "Delete"; return dl; }, -- cgit v1.2.3-54-g00ecf From 4a97ad9efeeb350159e1d0c82686d234ee0cdb12 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Tue, 15 Sep 2009 17:08:26 -0400 Subject: Remove unnecessary Profile::pkeyGet Thanks for the info, Evan. --- classes/Profile.php | 5 ----- plugins/Autocomplete/autocomplete.php | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) (limited to 'plugins') diff --git a/classes/Profile.php b/classes/Profile.php index c4fb3a543..6ad0e7a3a 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -47,11 +47,6 @@ class Profile extends Memcached_DataObject /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE - function &pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('Profile', $kv); - } - function getAvatar($width, $height=null) { if (is_null($height)) { diff --git a/plugins/Autocomplete/autocomplete.php b/plugins/Autocomplete/autocomplete.php index 96d54af8d..4379a86f2 100644 --- a/plugins/Autocomplete/autocomplete.php +++ b/plugins/Autocomplete/autocomplete.php @@ -62,7 +62,7 @@ class AutocompleteAction extends Action $user->whereAdd('nickname like \'' . trim($user->escape($q), '\'') . '%\''); $user->find(); while($user->fetch()) { - $profile = Profile::pkeyGet(array('id' => $user->id)); + $profile = Profile::staticGet($user->id); $this->results[]=array('nickname' => $user->nickname, 'fullname'=> $profile->fullname, 'type'=>'user'); } } -- cgit v1.2.3-54-g00ecf From 6568a3202d3acfde694b359e2524d52d93dc83dd Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 16 Sep 2009 13:29:46 +0000 Subject: Fixed typo --- plugins/Realtime/realtimeupdate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index eba8ac1d9..b2c8bb56d 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -55,7 +55,7 @@ RealtimeUpdate = { " "+ ""+ "from "+ - "+source+"++ // may have a link + "+source+"+ // may have a link ""; if (data['in_reply_to_status_id']) { ni = ni+" in context"; -- cgit v1.2.3-54-g00ecf From 5ab1ec7ad578e1ac1f2d18ad8e2299cda21f572a Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 16 Sep 2009 11:57:07 -0400 Subject: make PiwikAnalytics work a little nicer --- plugins/PiwikAnalyticsPlugin.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/PiwikAnalyticsPlugin.php b/plugins/PiwikAnalyticsPlugin.php index 45a11dfe4..e36bd1c5c 100644 --- a/plugins/PiwikAnalyticsPlugin.php +++ b/plugins/PiwikAnalyticsPlugin.php @@ -59,9 +59,9 @@ if (!defined('STATUSNET')) { class PiwikAnalyticsPlugin extends Plugin { /** the base of your Piwik installation */ - var $piwikroot = null; + public $piwikroot = null; /** the Piwik Id of your statusnet installation */ - var $piwikId = null; + public $piwikId = null; /** * constructor @@ -96,7 +96,7 @@ document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/ja