Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
This commit is contained in:
commit
2eae258319
|
@ -54,6 +54,13 @@ class NoticesearchrssAction extends Rss10Action
|
|||
return true;
|
||||
}
|
||||
|
||||
function prepare($args)
|
||||
{
|
||||
parent::prepare($args);
|
||||
$this->notices = $this->getNotices();
|
||||
return true;
|
||||
}
|
||||
|
||||
function getNotices($limit=0)
|
||||
{
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ class PasswordsettingsAction extends AccountSettingsAction
|
|||
$this->elementEnd('li');
|
||||
$this->elementStart('li');
|
||||
$this->password('confirm', _('Confirm'),
|
||||
_('same as password above'));
|
||||
_('Same as password above'));
|
||||
$this->elementEnd('li');
|
||||
$this->elementEnd('ul');
|
||||
|
||||
|
|
|
@ -196,18 +196,18 @@ class SiteadminpanelAction extends AdminPanelAction
|
|||
|
||||
if (in_array($values['site']['ssl'], array('sometimes', 'always'))) {
|
||||
if (empty($values['site']['sslserver'])) {
|
||||
$this->clientError(_("You must set an SSL sever when enabling SSL."));
|
||||
$this->clientError(_("You must set an SSL server when enabling SSL."));
|
||||
}
|
||||
}
|
||||
|
||||
if (mb_strlen($values['site']['sslserver']) > 255) {
|
||||
$this->clientError(_("Invalid SSL server. Max length is 255 characters."));
|
||||
$this->clientError(_("Invalid SSL server. The maximum length is 255 characters."));
|
||||
}
|
||||
|
||||
// Validate text limit
|
||||
|
||||
if (!Validate::number($values['site']['textlimit'], array('min' => 140))) {
|
||||
$this->clientError(_("Minimum text limit is 140c."));
|
||||
$this->clientError(_("Minimum text limit is 140 characters."));
|
||||
}
|
||||
|
||||
// Validate dupe limit
|
||||
|
@ -281,7 +281,7 @@ class SiteAdminPanelForm extends AdminForm
|
|||
$this->unli();
|
||||
$this->li();
|
||||
$this->input('email', _('Email'),
|
||||
_('contact email address for your site'));
|
||||
_('Contact email address for your site'));
|
||||
$this->unli();
|
||||
$this->out->elementEnd('ul');
|
||||
$this->out->elementEnd('fieldset');
|
||||
|
@ -364,7 +364,7 @@ class SiteAdminPanelForm extends AdminForm
|
|||
|
||||
$this->li();
|
||||
$this->input('frequency', _('Frequency'),
|
||||
_('Snapshots will be sent once every N Web hits'),
|
||||
_('Snapshots will be sent once every N web hits'),
|
||||
'snapshot');
|
||||
$this->unli();
|
||||
|
||||
|
|
|
@ -261,6 +261,7 @@ modified = 384
|
|||
|
||||
[login_token__keys]
|
||||
user_id = K
|
||||
token = K
|
||||
|
||||
[message]
|
||||
id = 129
|
||||
|
|
|
@ -94,7 +94,7 @@ var GearsGeoLocation = (function() {
|
|||
}
|
||||
|
||||
};
|
||||
})();
|
||||
});
|
||||
|
||||
var AjaxGeoLocation = (function() {
|
||||
// -- PRIVATE
|
||||
|
@ -103,7 +103,7 @@ var AjaxGeoLocation = (function() {
|
|||
if (!hasGoogleLoader() && !loading) {
|
||||
loading = true;
|
||||
var s = document.createElement('script');
|
||||
s.src = 'http://www.google.com/jsapi?callback=_google_loader_apiLoaded';
|
||||
s.src = (document.location.protocol == "https:"?"https://":"http://") + 'www.google.com/jsapi?callback=_google_loader_apiLoaded';
|
||||
s.type = "text/javascript";
|
||||
document.getElementsByTagName('body')[0].appendChild(s);
|
||||
}
|
||||
|
@ -161,22 +161,23 @@ var AjaxGeoLocation = (function() {
|
|||
var cl = google.loader.ClientLocation;
|
||||
|
||||
var position = {
|
||||
coords: {
|
||||
latitude: cl.latitude,
|
||||
longitude: cl.longitude,
|
||||
altitude: null,
|
||||
accuracy: 43000, // same as Gears accuracy over wifi?
|
||||
altitudeAccuracy: null,
|
||||
heading: null,
|
||||
velocity: null,
|
||||
timestamp: new Date(),
|
||||
|
||||
speed: null,
|
||||
},
|
||||
// extra info that is outside of the bounds of the core API
|
||||
address: {
|
||||
city: cl.address.city,
|
||||
country: cl.address.country,
|
||||
country_code: cl.address.country_code,
|
||||
region: cl.address.region
|
||||
}
|
||||
},
|
||||
timestamp: new Date()
|
||||
};
|
||||
|
||||
successCallback(position);
|
||||
|
@ -208,9 +209,9 @@ var AjaxGeoLocation = (function() {
|
|||
}
|
||||
|
||||
};
|
||||
})();
|
||||
});
|
||||
|
||||
// If you have Gears installed use that, else use Ajax ClientLocation
|
||||
navigator.geolocation = (window.google && google.gears) ? GearsGeoLocation : AjaxGeoLocation;
|
||||
navigator.geolocation = (window.google && google.gears) ? GearsGeoLocation() : AjaxGeoLocation();
|
||||
|
||||
})();
|
||||
|
|
169
lib/columndef.php
Normal file
169
lib/columndef.php
Normal file
|
@ -0,0 +1,169 @@
|
|||
<?php
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Database schema utilities
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENCE: This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @category Database
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 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')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* A class encapsulating the structure of a column in a table.
|
||||
*
|
||||
* @category Database
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class ColumnDef
|
||||
{
|
||||
/** name of the column. */
|
||||
public $name;
|
||||
/** type of column, e.g. 'int', 'varchar' */
|
||||
public $type;
|
||||
/** size of the column. */
|
||||
public $size;
|
||||
/** boolean flag; can it be null? */
|
||||
public $nullable;
|
||||
/**
|
||||
* type of key: null = no key; 'PRI' => primary;
|
||||
* 'UNI' => unique key; 'MUL' => multiple values.
|
||||
*/
|
||||
public $key;
|
||||
/** default value if any. */
|
||||
public $default;
|
||||
/** 'extra' stuff. Returned by MySQL, largely
|
||||
* unused. */
|
||||
public $extra;
|
||||
/** auto increment this field if no value is specific for it during an insert **/
|
||||
public $auto_increment;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $name name of the column
|
||||
* @param string $type type of the column
|
||||
* @param int $size size of the column
|
||||
* @param boolean $nullable can this be null?
|
||||
* @param string $key type of key
|
||||
* @param value $default default value
|
||||
* @param value $extra unused
|
||||
*/
|
||||
|
||||
function __construct($name=null, $type=null, $size=null,
|
||||
$nullable=true, $key=null, $default=null,
|
||||
$extra=null, $auto_increment=false)
|
||||
{
|
||||
$this->name = strtolower($name);
|
||||
$this->type = strtolower($type);
|
||||
$this->size = $size+0;
|
||||
$this->nullable = $nullable;
|
||||
$this->key = $key;
|
||||
$this->default = $default;
|
||||
$this->extra = $extra;
|
||||
$this->auto_increment = $auto_increment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares this columndef with another to see
|
||||
* if they're functionally equivalent.
|
||||
*
|
||||
* @param ColumnDef $other column to compare
|
||||
*
|
||||
* @return boolean true if equivalent, otherwise false.
|
||||
*/
|
||||
|
||||
function equals($other)
|
||||
{
|
||||
return ($this->name == $other->name &&
|
||||
$this->_typeMatch($other) &&
|
||||
$this->_defaultMatch($other) &&
|
||||
$this->_nullMatch($other) &&
|
||||
$this->key == $other->key &&
|
||||
$this->auto_increment == $other->auto_increment);
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the type of this column match the
|
||||
* type of the other column?
|
||||
*
|
||||
* Checks the type and size of a column. Tries
|
||||
* to ignore differences between synonymous
|
||||
* data types, like 'integer' and 'int'.
|
||||
*
|
||||
* @param ColumnDef $other other column to check
|
||||
*
|
||||
* @return boolean true if they're about equivalent
|
||||
*/
|
||||
|
||||
private function _typeMatch($other)
|
||||
{
|
||||
switch ($this->type) {
|
||||
case 'integer':
|
||||
case 'int':
|
||||
return ($other->type == 'integer' ||
|
||||
$other->type == 'int');
|
||||
break;
|
||||
default:
|
||||
return ($this->type == $other->type &&
|
||||
$this->size == $other->size);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the default behaviour of this column match
|
||||
* the other?
|
||||
*
|
||||
* @param ColumnDef $other other column to check
|
||||
*
|
||||
* @return boolean true if defaults are effectively the same.
|
||||
*/
|
||||
|
||||
private function _defaultMatch($other)
|
||||
{
|
||||
return ((is_null($this->default) && is_null($other->default)) ||
|
||||
($this->default == $other->default));
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the null behaviour of this column match
|
||||
* the other?
|
||||
*
|
||||
* @param ColumnDef $other other column to check
|
||||
*
|
||||
* @return boolean true if these columns 'null' the same.
|
||||
*/
|
||||
|
||||
private function _nullMatch($other)
|
||||
{
|
||||
return ((!is_null($this->default) && !is_null($other->default) &&
|
||||
$this->default == $other->default) ||
|
||||
($this->nullable == $other->nullable));
|
||||
}
|
||||
}
|
|
@ -34,9 +34,8 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
|||
|
||||
require_once INSTALLDIR.'/lib/xmloutputter.php';
|
||||
|
||||
define('PAGE_TYPE_PREFS',
|
||||
'text/html,application/xhtml+xml,'.
|
||||
'application/xml;q=0.3,text/xml;q=0.2');
|
||||
// Can include XHTML options but these are too fragile in practice.
|
||||
define('PAGE_TYPE_PREFS', 'text/html');
|
||||
|
||||
/**
|
||||
* Low-level generator for HTML
|
||||
|
|
|
@ -396,24 +396,46 @@ class NoticeListItem extends Widget
|
|||
$lon = $this->notice->lon;
|
||||
$latlon = (!empty($lat) && !empty($lon)) ? $lat.';'.$lon : '';
|
||||
|
||||
if (empty($name)) {
|
||||
$latdms = $this->decimalDegreesToDMS(abs($lat));
|
||||
$londms = $this->decimalDegreesToDMS(abs($lon));
|
||||
$name = sprintf(
|
||||
_('%1$u°%2$u\'%3$u"%4$s %5$u°%6$u\'%7$u"%8$s'),
|
||||
$latdms['deg'],$latdms['min'], $latdms['sec'],($lat>0?_('N'):_('S')),
|
||||
$londms['deg'],$londms['min'], $londms['sec'],($lon>0?_('E'):_('W')));
|
||||
}
|
||||
|
||||
$url = $location->getUrl();
|
||||
|
||||
$this->out->elementStart('span', array('class' => 'location'));
|
||||
$this->out->text(_('at'));
|
||||
|
||||
$this->out->elementStart('a', array('class' => 'geo', 'href' => $url));
|
||||
$this->out->elementStart('abbr', array('class' => 'latitude', 'title' => $lat, 'style' => empty($name)?null:'display: none'));
|
||||
$this->out->text($lat); //TODO translate to a prettier format, like "S 37.2 deg" instead of "-37.2"
|
||||
$this->out->elementEnd('abbr');
|
||||
$this->out->elementStart('abbr', array('class' => 'longitude', 'title' => $lon, 'style' => empty($name)?null:'display: none'));
|
||||
$this->out->text($lon);
|
||||
$this->out->elementEnd('abbr');
|
||||
$this->out->text($name);
|
||||
$this->out->elementEnd('a');
|
||||
|
||||
if (empty($url)) {
|
||||
$this->out->element('span', array('class' => 'geo',
|
||||
'title' => $latlon),
|
||||
$name);
|
||||
} else {
|
||||
$this->out->element('a', array('class' => 'geo',
|
||||
'title' => $latlon,
|
||||
'href' => $url),
|
||||
$name);
|
||||
}
|
||||
$this->out->elementEnd('span');
|
||||
}
|
||||
|
||||
function decimalDegreesToDMS($dec)
|
||||
{
|
||||
|
||||
$vars = explode(".",$dec);
|
||||
$deg = $vars[0];
|
||||
$tempma = "0.".$vars[1];
|
||||
|
||||
$tempma = $tempma * 3600;
|
||||
$min = floor($tempma / 60);
|
||||
$sec = $tempma - ($min*60);
|
||||
|
||||
return array("deg"=>$deg,"min"=>$min,"sec"=>$sec);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the source of the notice
|
||||
*
|
||||
|
|
168
lib/schema.php
168
lib/schema.php
|
@ -547,171 +547,3 @@ class Schema
|
|||
return $sql;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A class encapsulating the structure of a table.
|
||||
*
|
||||
* @category Database
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class TableDef
|
||||
{
|
||||
/** name of the table */
|
||||
public $name;
|
||||
/** array of ColumnDef objects for the columns. */
|
||||
public $columns;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $name name of the table
|
||||
* @param array $columns columns in the table
|
||||
*/
|
||||
|
||||
function __construct($name=null,$columns=null)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->columns = $columns;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A class encapsulating the structure of a column in a table.
|
||||
*
|
||||
* @category Database
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class ColumnDef
|
||||
{
|
||||
/** name of the column. */
|
||||
public $name;
|
||||
/** type of column, e.g. 'int', 'varchar' */
|
||||
public $type;
|
||||
/** size of the column. */
|
||||
public $size;
|
||||
/** boolean flag; can it be null? */
|
||||
public $nullable;
|
||||
/**
|
||||
* type of key: null = no key; 'PRI' => primary;
|
||||
* 'UNI' => unique key; 'MUL' => multiple values.
|
||||
*/
|
||||
public $key;
|
||||
/** default value if any. */
|
||||
public $default;
|
||||
/** 'extra' stuff. Returned by MySQL, largely
|
||||
* unused. */
|
||||
public $extra;
|
||||
/** auto increment this field if no value is specific for it during an insert **/
|
||||
public $auto_increment;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $name name of the column
|
||||
* @param string $type type of the column
|
||||
* @param int $size size of the column
|
||||
* @param boolean $nullable can this be null?
|
||||
* @param string $key type of key
|
||||
* @param value $default default value
|
||||
* @param value $extra unused
|
||||
*/
|
||||
|
||||
function __construct($name=null, $type=null, $size=null,
|
||||
$nullable=true, $key=null, $default=null,
|
||||
$extra=null, $auto_increment=false)
|
||||
{
|
||||
$this->name = strtolower($name);
|
||||
$this->type = strtolower($type);
|
||||
$this->size = $size+0;
|
||||
$this->nullable = $nullable;
|
||||
$this->key = $key;
|
||||
$this->default = $default;
|
||||
$this->extra = $extra;
|
||||
$this->auto_increment = $auto_increment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares this columndef with another to see
|
||||
* if they're functionally equivalent.
|
||||
*
|
||||
* @param ColumnDef $other column to compare
|
||||
*
|
||||
* @return boolean true if equivalent, otherwise false.
|
||||
*/
|
||||
|
||||
function equals($other)
|
||||
{
|
||||
return ($this->name == $other->name &&
|
||||
$this->_typeMatch($other) &&
|
||||
$this->_defaultMatch($other) &&
|
||||
$this->_nullMatch($other) &&
|
||||
$this->key == $other->key &&
|
||||
$this->auto_increment == $other->auto_increment);
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the type of this column match the
|
||||
* type of the other column?
|
||||
*
|
||||
* Checks the type and size of a column. Tries
|
||||
* to ignore differences between synonymous
|
||||
* data types, like 'integer' and 'int'.
|
||||
*
|
||||
* @param ColumnDef $other other column to check
|
||||
*
|
||||
* @return boolean true if they're about equivalent
|
||||
*/
|
||||
|
||||
private function _typeMatch($other)
|
||||
{
|
||||
switch ($this->type) {
|
||||
case 'integer':
|
||||
case 'int':
|
||||
return ($other->type == 'integer' ||
|
||||
$other->type == 'int');
|
||||
break;
|
||||
default:
|
||||
return ($this->type == $other->type &&
|
||||
$this->size == $other->size);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the default behaviour of this column match
|
||||
* the other?
|
||||
*
|
||||
* @param ColumnDef $other other column to check
|
||||
*
|
||||
* @return boolean true if defaults are effectively the same.
|
||||
*/
|
||||
|
||||
private function _defaultMatch($other)
|
||||
{
|
||||
return ((is_null($this->default) && is_null($other->default)) ||
|
||||
($this->default == $other->default));
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the null behaviour of this column match
|
||||
* the other?
|
||||
*
|
||||
* @param ColumnDef $other other column to check
|
||||
*
|
||||
* @return boolean true if these columns 'null' the same.
|
||||
*/
|
||||
|
||||
private function _nullMatch($other)
|
||||
{
|
||||
return ((!is_null($this->default) && !is_null($other->default) &&
|
||||
$this->default == $other->default) ||
|
||||
($this->nullable == $other->nullable));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,8 +123,8 @@ class SearchAction extends Action
|
|||
if (!common_config('site', 'fancy')) {
|
||||
$this->hidden('action', $this->trimmed('action'));
|
||||
}
|
||||
$this->input('q', 'Keyword(s)', $q);
|
||||
$this->submit('search', 'Search');
|
||||
$this->input('q', _('Keyword(s)'), $q);
|
||||
$this->submit('search', _('Search'));
|
||||
$this->elementEnd('li');
|
||||
$this->elementEnd('ul');
|
||||
$this->elementEnd('fieldset');
|
||||
|
|
|
@ -79,9 +79,9 @@ class SearchGroupNav extends Widget
|
|||
}
|
||||
$this->out->menuItem(common_local_url('peoplesearch', $args), _('People'),
|
||||
_('Find people on this site'), $action_name == 'peoplesearch', 'nav_search_people');
|
||||
$this->out->menuItem(common_local_url('noticesearch', $args), _('Notice'),
|
||||
$this->out->menuItem(common_local_url('noticesearch', $args), _('Notices'),
|
||||
_('Find content of notices'), $action_name == 'noticesearch', 'nav_search_notice');
|
||||
$this->out->menuItem(common_local_url('groupsearch', $args), _('Group'),
|
||||
$this->out->menuItem(common_local_url('groupsearch', $args), _('Groups'),
|
||||
_('Find groups on this site'), $action_name == 'groupsearch', 'nav_search_group');
|
||||
$this->action->elementEnd('ul');
|
||||
}
|
||||
|
|
63
lib/tabledef.php
Normal file
63
lib/tabledef.php
Normal file
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Database schema utilities
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENCE: This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @category Database
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 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')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* A class encapsulating the structure of a table.
|
||||
*
|
||||
* @category Database
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class TableDef
|
||||
{
|
||||
/** name of the table */
|
||||
public $name;
|
||||
/** array of ColumnDef objects for the columns. */
|
||||
public $columns;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $name name of the table
|
||||
* @param array $columns columns in the table
|
||||
*/
|
||||
|
||||
function __construct($name=null,$columns=null)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->columns = $columns;
|
||||
}
|
||||
}
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -63,6 +63,14 @@ class GeonamesPlugin extends Plugin
|
|||
|
||||
function onLocationFromName($name, $language, &$location)
|
||||
{
|
||||
$loc = $this->getCache(array('name' => $name,
|
||||
'language' => $language));
|
||||
|
||||
if (!empty($loc)) {
|
||||
$location = $loc;
|
||||
return false;
|
||||
}
|
||||
|
||||
$client = HTTPClient::start();
|
||||
|
||||
// XXX: break down a name by commas, narrow by each
|
||||
|
@ -87,6 +95,10 @@ class GeonamesPlugin extends Plugin
|
|||
$location->location_id = $n->geonameId;
|
||||
$location->location_ns = self::LOCATION_NS;
|
||||
|
||||
$this->setCache(array('name' => $name,
|
||||
'language' => $language),
|
||||
$location);
|
||||
|
||||
// handled, don't continue processing!
|
||||
return false;
|
||||
}
|
||||
|
@ -114,6 +126,13 @@ class GeonamesPlugin extends Plugin
|
|||
return true;
|
||||
}
|
||||
|
||||
$loc = $this->getCache(array('id' => $id));
|
||||
|
||||
if (!empty($loc)) {
|
||||
$location = $loc;
|
||||
return false;
|
||||
}
|
||||
|
||||
$client = HTTPClient::start();
|
||||
|
||||
$str = http_build_query(array('geonameId' => $id,
|
||||
|
@ -148,6 +167,9 @@ class GeonamesPlugin extends Plugin
|
|||
$location->lat = $last->lat;
|
||||
$location->lon = $last->lng;
|
||||
$location->names[$language] = implode(', ', array_reverse($parts));
|
||||
|
||||
$this->setCache(array('id' => $last->geonameId),
|
||||
$location);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,6 +195,14 @@ class GeonamesPlugin extends Plugin
|
|||
|
||||
function onLocationFromLatLon($lat, $lon, $language, &$location)
|
||||
{
|
||||
$loc = $this->getCache(array('lat' => $lat,
|
||||
'lon' => $lon));
|
||||
|
||||
if (!empty($loc)) {
|
||||
$location = $loc;
|
||||
return false;
|
||||
}
|
||||
|
||||
$client = HTTPClient::start();
|
||||
|
||||
$str = http_build_query(array('lat' => $lat,
|
||||
|
@ -211,6 +241,10 @@ class GeonamesPlugin extends Plugin
|
|||
|
||||
$location->names[$language] = implode(', ', $parts);
|
||||
|
||||
$this->setCache(array('lat' => $lat,
|
||||
'lon' => $lon),
|
||||
$location);
|
||||
|
||||
// Success! We handled it, so no further processing
|
||||
|
||||
return false;
|
||||
|
@ -242,9 +276,17 @@ class GeonamesPlugin extends Plugin
|
|||
return true;
|
||||
}
|
||||
|
||||
$n = $this->getCache(array('id' => $location->location_id,
|
||||
'language' => $language));
|
||||
|
||||
if (!empty($n)) {
|
||||
$name = $n;
|
||||
return false;
|
||||
}
|
||||
|
||||
$client = HTTPClient::start();
|
||||
|
||||
$str = http_build_query(array('geonameId' => $id,
|
||||
$str = http_build_query(array('geonameId' => $location->location_id,
|
||||
'lang' => $language));
|
||||
|
||||
$result = $client->get('http://ws.geonames.org/hierarchyJSON?'.$str);
|
||||
|
@ -271,6 +313,9 @@ class GeonamesPlugin extends Plugin
|
|||
|
||||
if (count($parts)) {
|
||||
$name = implode(', ', array_reverse($parts));
|
||||
$this->setCache(array('id' => $location->location_id,
|
||||
'language' => $language),
|
||||
$name);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -326,4 +371,44 @@ class GeonamesPlugin extends Plugin
|
|||
// it's been filled, so don't process further.
|
||||
return false;
|
||||
}
|
||||
|
||||
function getCache($attrs)
|
||||
{
|
||||
$c = common_memcache();
|
||||
|
||||
if (!$c) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $c->get($this->cacheKey($attrs));
|
||||
}
|
||||
|
||||
function setCache($attrs, $loc)
|
||||
{
|
||||
$c = common_memcache();
|
||||
|
||||
if (!$c) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$c->set($this->cacheKey($attrs), $loc);
|
||||
}
|
||||
|
||||
function clearCache($attrs)
|
||||
{
|
||||
$c = common_memcache();
|
||||
|
||||
if (!$c) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$c->delete($this->cacheKey($attrs));
|
||||
}
|
||||
|
||||
function cacheKey($attrs)
|
||||
{
|
||||
return common_cache_key('geonames:'.
|
||||
implode(',', array_keys($attrs)) . ':'.
|
||||
common_keyize(implode(',', array_values($attrs))));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,12 +58,12 @@ class MapstractionPlugin extends Plugin
|
|||
*
|
||||
* The way to register new actions from a plugin.
|
||||
*
|
||||
* @param Router &$m reference to router
|
||||
* @param Router $m reference to router
|
||||
*
|
||||
* @return boolean event handler return
|
||||
*/
|
||||
|
||||
function onRouterInitialized(&$m)
|
||||
function onRouterInitialized($m)
|
||||
{
|
||||
$m->connect(':nickname/all/map',
|
||||
array('action' => 'allmap'),
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
$(document).ready(function() {
|
||||
notices = [];
|
||||
var notices = [];
|
||||
$(".notice").each(function(){
|
||||
notice = getNoticeFromElement($(this));
|
||||
var notice = getNoticeFromElement($(this));
|
||||
if(notice['geo'])
|
||||
notices.push(notice);
|
||||
});
|
||||
if($("#map_canvas") && notices.length>0)
|
||||
if($("#map_canvas").length && notices.length>0)
|
||||
{
|
||||
showMapstraction($("#map_canvas"), notices);
|
||||
}
|
||||
|
||||
$('a.geo').click(function(){
|
||||
noticeElement = $(this).closest(".notice");
|
||||
$('.geo').click(function(){
|
||||
var noticeElement = $(this).closest(".notice");
|
||||
notice = getNoticeFromElement(noticeElement);
|
||||
|
||||
$.fn.jOverlay.options = {
|
||||
|
@ -23,7 +23,7 @@ $(document).ready(function() {
|
|||
autoHide : true,
|
||||
css : {'max-width':'542px', 'top':'5%', 'left':'32.5%'}
|
||||
};
|
||||
html="<div id='map_canvas_popup' class='gray smallmap' style='width: 542px; height: 500px' />";
|
||||
var html="<div id='map_canvas_popup' class='gray smallmap' style='width: 542px; height: 500px' />";
|
||||
html+="<button class='close'>×</button>";
|
||||
html+=$("<div/>").append($(this).clone()).html();
|
||||
$().jOverlay({ "html": html });
|
||||
|
@ -47,11 +47,12 @@ function getMicroformatValue(element)
|
|||
|
||||
function getNoticeFromElement(noticeElement)
|
||||
{
|
||||
notice = {};
|
||||
if(noticeElement.find(".latitude").length){
|
||||
var notice = {};
|
||||
if(noticeElement.find(".geo").length){
|
||||
var latlon = noticeElement.find(".geo").attr('title').split(";");
|
||||
notice['geo']={'coordinates': [
|
||||
parseFloat(getMicroformatValue(noticeElement.find(".latitude"))),
|
||||
parseFloat(getMicroformatValue(noticeElement.find(".longitude")))] };
|
||||
parseFloat(latlon[0]),
|
||||
parseFloat(latlon[1])] };
|
||||
}
|
||||
notice['user']={
|
||||
'profile_image_url': noticeElement.find("img.avatar").attr('src'),
|
||||
|
|
|
@ -139,8 +139,8 @@ class RealtimePlugin extends Plugin
|
|||
|
||||
// Add to the public timeline
|
||||
|
||||
if ($notice->is_local ||
|
||||
($notice->is_local == 0 && !common_config('public', 'localonly'))) {
|
||||
if ($notice->is_local == Notice::LOCAL_PUBLIC ||
|
||||
($notice->is_local == Notice::REMOTE_OMB && !common_config('public', 'localonly'))) {
|
||||
$paths[] = array('public');
|
||||
}
|
||||
|
||||
|
@ -220,8 +220,9 @@ class RealtimePlugin extends Plugin
|
|||
|
||||
$action->elementStart('body',
|
||||
(common_current_user()) ? array('id' => $action->trimmed('action'),
|
||||
'class' => 'user_in')
|
||||
: array('id' => $action->trimmed('action')));
|
||||
'class' => 'user_in realtime-popup')
|
||||
: array('id' => $action->trimmed('action'),
|
||||
'class'=> 'realtime-popup'));
|
||||
|
||||
// XXX hack to deal with JS that tries to get the
|
||||
// root url from page output
|
||||
|
|
|
@ -1,3 +1,32 @@
|
|||
.realtime-popup address {
|
||||
display:none;
|
||||
}
|
||||
|
||||
.realtime-popup #content {
|
||||
width:93.5%;
|
||||
}
|
||||
|
||||
.realtime-popup #form_notice {
|
||||
margin:18px 0 18px 1.795%;
|
||||
width:93%;
|
||||
max-width:451px;
|
||||
}
|
||||
|
||||
.realtime-popup #form_notice label[for=notice_data-text],
|
||||
.realtime-popup h1 {
|
||||
display:none;
|
||||
}
|
||||
|
||||
.realtime-popup #form_notice label[for=notice_data-attach],
|
||||
.realtime-popup #form_notice #notice_data-attach {
|
||||
top:0;
|
||||
}
|
||||
|
||||
.realtime-popup #form_notice #notice_data-attach {
|
||||
left:auto;
|
||||
right:0;
|
||||
}
|
||||
|
||||
#notices_primary {
|
||||
position:relative;
|
||||
}
|
||||
|
|
|
@ -276,26 +276,6 @@ RealtimeUpdate = {
|
|||
|
||||
initPopupWindow: function()
|
||||
{
|
||||
$('address').hide();
|
||||
$('#content').css({'width':'93.5%'});
|
||||
|
||||
$('#form_notice').css({
|
||||
'margin':'18px 0 18px 1.795%',
|
||||
'width':'93%',
|
||||
'max-width':'451px'
|
||||
});
|
||||
|
||||
$('#form_notice label[for=notice_data-text], h1').css({'display': 'none'});
|
||||
|
||||
$('.notices li:first-child').css({'border-top-color':'transparent'});
|
||||
|
||||
$('#form_notice label[for="notice_data-attach"], #form_notice #notice_data-attach').css({'top':'0'});
|
||||
|
||||
$('#form_notice #notice_data-attach').css({
|
||||
'left':'auto',
|
||||
'right':'0'
|
||||
});
|
||||
|
||||
$('.notices .entry-title a, .notices .entry-content a').bind('click', function() {
|
||||
window.open(this.href, '');
|
||||
|
||||
|
|
|
@ -41,6 +41,12 @@ class PluginQueueHandler extends QueueHandler
|
|||
return 'plugin';
|
||||
}
|
||||
|
||||
function start()
|
||||
{
|
||||
$this->log(LOG_INFO, "INITIALIZE");
|
||||
return true;
|
||||
}
|
||||
|
||||
function handle_notice($notice)
|
||||
{
|
||||
Event::handle('HandleQueuedNotice', array(&$notice));
|
||||
|
|
|
@ -109,7 +109,7 @@ foreach ($languages as $language) {
|
|||
file_put_contents($pofile, $new_file);
|
||||
// --backup=off is workaround for Mac OS X fail
|
||||
system(sprintf('msgmerge -U --backup=off %s %s', $pofile, $statusnet_pot));
|
||||
system(sprintf('msgfmt -f -o %s %s', $mofile, $pofile));
|
||||
system(sprintf('msgfmt -o %s %s', $mofile, $pofile));
|
||||
} else {
|
||||
echo "Unchanged - ".$code."\n";
|
||||
}
|
||||
|
|
|
@ -952,6 +952,7 @@ clear:left;
|
|||
float:left;
|
||||
font-size:0.95em;
|
||||
margin-left:59px;
|
||||
min-width:60%;
|
||||
max-width:74%;
|
||||
}
|
||||
#showstream .notice div.entry-content,
|
||||
|
|
|
@ -97,8 +97,8 @@ color:#002FA7;
|
|||
.profile {
|
||||
border-top-color:#C8D1D5;
|
||||
}
|
||||
.section .profile {
|
||||
border-top-color:#87B4C8;
|
||||
.mark-top {
|
||||
border-color:#AAAAAA;
|
||||
}
|
||||
|
||||
#aside_primary {
|
||||
|
|
|
@ -97,8 +97,8 @@ color:#002FA7;
|
|||
.profile {
|
||||
border-top-color:#CEE1E9;
|
||||
}
|
||||
.section .profile {
|
||||
border-top-color:#87B4C8;
|
||||
.mark-top {
|
||||
border-color:#AAAAAA;
|
||||
}
|
||||
|
||||
#aside_primary {
|
||||
|
|
Loading…
Reference in New Issue
Block a user