Merge branch 'master', remote-tracking branch 'remotes/upstream/master'

* remotes/upstream/master:
  Darkzero - fixed notifications bar.
  diabook-theme: update mapquery and small fix
  diabook-theme: add "population density 2010"-layer to EarthLayers-box
  fix search/new against possible email leakage
  better test of email reply visibility
  diabook-theme:small fix
  moderated comment templates
  diabook-theme: small fix
  diabook-theme: include prv_message autocomplete
  fix PM replies after autocomplete changes
  add photos to PM autocomplete, improved appearance
  rev update
  diabook-theme: small fix

* master:
This commit is contained in:
Simon L'nu 2012-05-11 20:39:06 -04:00
commit 534a93f81c
22 changed files with 1740 additions and 326 deletions

View file

@ -9,7 +9,7 @@ require_once('include/nav.php');
require_once('include/cache.php'); require_once('include/cache.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica'); define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_VERSION', '3.0.1337' ); define ( 'FRIENDICA_VERSION', '3.0.1338' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1143 ); define ( 'DB_UPDATE_VERSION', 1143 );
@ -123,6 +123,8 @@ define ( 'NETWORK_XMPP', 'xmpp'); // XMPP
define ( 'NETWORK_MYSPACE', 'mysp'); // MySpace define ( 'NETWORK_MYSPACE', 'mysp'); // MySpace
define ( 'NETWORK_GPLUS', 'goog'); // Google+ define ( 'NETWORK_GPLUS', 'goog'); // Google+
define ( 'NETWORK_PHANTOM', 'unkn'); // Place holder
/** /**
* These numbers are used in stored permissions * These numbers are used in stored permissions
* and existing allocations MUST NEVER BE CHANGED * and existing allocations MUST NEVER BE CHANGED
@ -142,6 +144,8 @@ $netgroup_ids = array(
NETWORK_XMPP => (-10), NETWORK_XMPP => (-10),
NETWORK_MYSPACE => (-11), NETWORK_MYSPACE => (-11),
NETWORK_GPLUS => (-12), NETWORK_GPLUS => (-12),
NETWORK_PHANTOM => (-127),
); );

View file

@ -278,6 +278,9 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
else else
$nickname = $a->user['nickname']; $nickname = $a->user['nickname'];
// prevent private email from leaking.
if($item['network'] === NETWORK_MAIL && local_user() != $item['uid'])
continue;
$profile_name = ((strlen($item['author-name'])) ? $item['author-name'] : $item['name']); $profile_name = ((strlen($item['author-name'])) ? $item['author-name'] : $item['name']);
if($item['author-link'] && (! $item['author-name'])) if($item['author-link'] && (! $item['author-name']))
@ -447,8 +450,8 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
else { else {
// prevent private email reply to public conversation from leaking. // prevent private email reply to public conversation from leaking.
if($item['private'] && ! $threads[$threadsid]['private']) if($item['network'] === NETWORK_MAIL && local_user() != $item['uid'])
continue; continue;
$comments_seen ++; $comments_seen ++;
$comment_lastcollapsed = false; $comment_lastcollapsed = false;

View file

@ -119,7 +119,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
$check_date = datetime_convert('UTC','UTC',$last_update,'Y-m-d H:i:s'); $check_date = datetime_convert('UTC','UTC',$last_update,'Y-m-d H:i:s');
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`, $r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`name`, `contact`.`network`, `contact`.`photo`, `contact`.`url`,
`contact`.`name-date`, `contact`.`uri-date`, `contact`.`avatar-date`, `contact`.`name-date`, `contact`.`uri-date`, `contact`.`avatar-date`,
`contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
`contact`.`id` AS `contact-id`, `contact`.`uid` AS `contact-uid`, `contact`.`id` AS `contact-id`, `contact`.`uid` AS `contact-uid`,

View file

@ -70,8 +70,10 @@ function reload_plugins() {
$installed = array(); $installed = array();
$parr = explode(',',$plugins); $parr = explode(',',$plugins);
if(count($parr)) { if(count($parr)) {
foreach($parr as $pl) { foreach($parr as $pl) {
$pl = trim($pl); $pl = trim($pl);
$fname = 'addon/' . $pl . '/' . $pl . '.php'; $fname = 'addon/' . $pl . '/' . $pl . '.php';
@ -101,6 +103,7 @@ function reload_plugins() {
} }
} }
} }
}} }}
@ -163,6 +166,14 @@ function call_hooks($name, &$data = null) {
$func = $hook[HOOK_FUNCTION]; $func = $hook[HOOK_FUNCTION];
$func($a,$data); $func($a,$data);
} }
else {
// remove orphan hooks
q("delete from hook where hook = '%s' and file = '$s' and function = '%s' limit 1",
dbesc($hook[HOOK_HOOK]),
dbesc($hook[HOOK_FILE]),
dbesc($hook[HOOK_FUNCTION])
);
}
} }
} }
} }

View file

@ -0,0 +1,395 @@
/**
* Ajax Autocomplete for jQuery, version 1.1.3
* (c) 2010 Tomas Kirda
*
* Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license.
* For details, see the web site: http://www.devbridge.com/projects/autocomplete/jquery/
*
* Last Review: 04/19/2010
* Heavily modified for contact completion in Friendica (add photos, hover tips. etc.) 11-May-2012 mike@macgirvin.com
*/
/*jslint onevar: true, evil: true, nomen: true, eqeqeq: true, bitwise: true, regexp: true, newcap: true, immed: true */
/*global window: true, document: true, clearInterval: true, setInterval: true, jQuery: true */
(function($) {
var reEscape = new RegExp('(\\' + ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\'].join('|\\') + ')', 'g');
function fnFormatResult(value, data, currentValue) {
var pattern = '(' + currentValue.replace(reEscape, '\\$1') + ')';
return value.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
}
function Autocomplete(el, options) {
this.el = $(el);
this.el.attr('autocomplete', 'off');
this.suggestions = [];
this.data = [];
this.badQueries = [];
this.selectedIndex = -1;
this.currentValue = this.el.val();
this.intervalId = 0;
this.cachedResponse = [];
this.onChangeInterval = null;
this.ignoreValueChange = false;
this.serviceUrl = options.serviceUrl;
this.isLocal = false;
this.options = {
autoSubmit: false,
minChars: 1,
maxHeight: 300,
deferRequestBy: 0,
width: 0,
highlight: true,
params: {},
fnFormatResult: fnFormatResult,
delimiter: null,
zIndex: 9999
};
this.initialize();
this.setOptions(options);
}
$.fn.autocomplete = function(options) {
return new Autocomplete(this.get(0)||$('<input />'), options);
};
Autocomplete.prototype = {
killerFn: null,
initialize: function() {
var me, uid, autocompleteElId;
me = this;
uid = Math.floor(Math.random()*0x100000).toString(16);
autocompleteElId = 'Autocomplete_' + uid;
this.killerFn = function(e) {
if ($(e.target).parents('.autocomplete').size() === 0) {
me.killSuggestions();
me.disableKillerFn();
}
};
if (!this.options.width) { this.options.width = this.el.width(); }
this.mainContainerId = 'AutocompleteContainter_' + uid;
$('<div id="' + this.mainContainerId + '" style="position:absolute;z-index:9999;"><div class="autocomplete-w1"><div class="autocomplete" id="' + autocompleteElId + '" style="display:none; width:300px;"></div></div></div>').appendTo('body');
this.container = $('#' + autocompleteElId);
this.fixPosition();
if (window.opera) {
this.el.keypress(function(e) { me.onKeyPress(e); });
} else {
this.el.keydown(function(e) { me.onKeyPress(e); });
}
this.el.keyup(function(e) { me.onKeyUp(e); });
this.el.blur(function() { me.enableKillerFn(); });
this.el.focus(function() { me.fixPosition(); });
},
setOptions: function(options){
var o = this.options;
$.extend(o, options);
if(o.lookup){
this.isLocal = true;
if($.isArray(o.lookup)){ o.lookup = { suggestions:o.lookup, data:[] }; }
}
$('#'+this.mainContainerId).css({ zIndex:o.zIndex });
this.container.css({ maxHeight: o.maxHeight + 'px', width:o.width });
},
clearCache: function(){
this.cachedResponse = [];
this.badQueries = [];
},
disable: function(){
this.disabled = true;
},
enable: function(){
this.disabled = false;
},
fixPosition: function() {
var offset = this.el.offset();
$('#' + this.mainContainerId).css({ top: (offset.top + this.el.innerHeight()) + 'px', left: offset.left + 'px' });
},
enableKillerFn: function() {
var me = this;
$(document).bind('click', me.killerFn);
},
disableKillerFn: function() {
var me = this;
$(document).unbind('click', me.killerFn);
},
killSuggestions: function() {
var me = this;
this.stopKillSuggestions();
this.intervalId = window.setInterval(function() { me.hide(); me.stopKillSuggestions(); }, 300);
},
stopKillSuggestions: function() {
window.clearInterval(this.intervalId);
},
onKeyPress: function(e) {
if (this.disabled || !this.enabled) { return; }
// return will exit the function
// and event will not be prevented
switch (e.keyCode) {
case 27: //KEY_ESC:
this.el.val(this.currentValue);
this.hide();
break;
case 9: //KEY_TAB:
case 13: //KEY_RETURN:
if (this.selectedIndex === -1) {
this.hide();
return;
}
this.select(this.selectedIndex);
if(e.keyCode === 9){ return; }
break;
case 38: //KEY_UP:
this.moveUp();
break;
case 40: //KEY_DOWN:
this.moveDown();
break;
default:
return;
}
e.stopImmediatePropagation();
e.preventDefault();
},
onKeyUp: function(e) {
if(this.disabled){ return; }
switch (e.keyCode) {
case 38: //KEY_UP:
case 40: //KEY_DOWN:
return;
}
clearInterval(this.onChangeInterval);
if (this.currentValue !== this.el.val()) {
if (this.options.deferRequestBy > 0) {
// Defer lookup in case when value changes very quickly:
var me = this;
this.onChangeInterval = setInterval(function() { me.onValueChange(); }, this.options.deferRequestBy);
} else {
this.onValueChange();
}
}
},
onValueChange: function() {
clearInterval(this.onChangeInterval);
this.currentValue = this.el.val();
var q = this.getQuery(this.currentValue);
this.selectedIndex = -1;
if (this.ignoreValueChange) {
this.ignoreValueChange = false;
return;
}
if (q === '' || q.length < this.options.minChars) {
this.hide();
} else {
this.getSuggestions(q);
}
},
getQuery: function(val) {
var d, arr;
d = this.options.delimiter;
if (!d) { return $.trim(val); }
arr = val.split(d);
return $.trim(arr[arr.length - 1]);
},
getSuggestionsLocal: function(q) {
var ret, arr, len, val, i;
arr = this.options.lookup;
len = arr.suggestions.length;
ret = { suggestions:[], data:[] };
q = q.toLowerCase();
for(i=0; i< len; i++){
val = arr.suggestions[i];
if(val.toLowerCase().indexOf(q) === 0){
ret.suggestions.push(val);
ret.data.push(arr.data[i]);
}
}
return ret;
},
getSuggestions: function(q) {
var cr, me;
cr = this.isLocal ? this.getSuggestionsLocal(q) : this.cachedResponse[q];
if (cr && $.isArray(cr.suggestions)) {
this.suggestions = cr.suggestions;
this.data = cr.data;
this.suggest();
} else if (!this.isBadQuery(q)) {
me = this;
me.options.params.query = q;
$.get(this.serviceUrl, me.options.params, function(txt) { me.processResponse(txt); }, 'text');
}
},
isBadQuery: function(q) {
var i = this.badQueries.length;
while (i--) {
if (q.indexOf(this.badQueries[i]) === 0) { return true; }
}
return false;
},
hide: function() {
this.enabled = false;
this.selectedIndex = -1;
this.container.hide();
},
suggest: function() {
if (this.suggestions.length === 0) {
this.hide();
return;
}
var me, len, div, f, v, i, s, mOver, mClick, l, img;
me = this;
len = this.suggestions.length;
f = this.options.fnFormatResult;
v = this.getQuery(this.currentValue);
mOver = function(xi) { return function() { me.activate(xi); }; };
mClick = function(xi) { return function() { me.select(xi); }; };
this.container.hide().empty();
for (i = 0; i < len; i++) {
s = this.suggestions[i];
l = this.links[i];
img = '<img height="24" width="24" src="' + this.photos[i] + '" alt="' + s + '" />&nbsp;';
div = $((me.selectedIndex === i ? '<div class="selected"' : '<div') + ' title="' + l + '">' + img + f(s, this.data[i], v) + '</div>');
div.mouseover(mOver(i));
div.click(mClick(i));
this.container.append(div);
}
this.enabled = true;
this.container.show();
},
processResponse: function(text) {
var response;
try {
response = eval('(' + text + ')');
} catch (err) { return; }
if (!$.isArray(response.data)) { response.data = []; }
if(!this.options.noCache){
this.cachedResponse[response.query] = response;
if (response.suggestions.length === 0) { this.badQueries.push(response.query); }
}
if (response.query === this.getQuery(this.currentValue)) {
this.photos = response.photos;
this.links = response.links;
this.suggestions = response.suggestions;
this.data = response.data;
this.suggest();
}
},
activate: function(index) {
var divs, activeItem;
divs = this.container.children();
// Clear previous selection:
if (this.selectedIndex !== -1 && divs.length > this.selectedIndex) {
$(divs.get(this.selectedIndex)).removeClass();
}
this.selectedIndex = index;
if (this.selectedIndex !== -1 && divs.length > this.selectedIndex) {
activeItem = divs.get(this.selectedIndex);
$(activeItem).addClass('selected');
}
return activeItem;
},
deactivate: function(div, index) {
div.className = '';
if (this.selectedIndex === index) { this.selectedIndex = -1; }
},
select: function(i) {
var selectedValue, f;
selectedValue = this.suggestions[i];
if (selectedValue) {
this.el.val(selectedValue);
if (this.options.autoSubmit) {
f = this.el.parents('form');
if (f.length > 0) { f.get(0).submit(); }
}
this.ignoreValueChange = true;
this.hide();
this.onSelect(i);
}
},
moveUp: function() {
if (this.selectedIndex === -1) { return; }
if (this.selectedIndex === 0) {
this.container.children().get(0).className = '';
this.selectedIndex = -1;
this.el.val(this.currentValue);
return;
}
this.adjustScroll(this.selectedIndex - 1);
},
moveDown: function() {
if (this.selectedIndex === (this.suggestions.length - 1)) { return; }
this.adjustScroll(this.selectedIndex + 1);
},
adjustScroll: function(i) {
var activeItem, offsetTop, upperBound, lowerBound;
activeItem = this.activate(i);
offsetTop = activeItem.offsetTop;
upperBound = this.container.scrollTop();
lowerBound = upperBound + this.options.maxHeight - 25;
if (offsetTop < upperBound) {
this.container.scrollTop(offsetTop);
} else if (offsetTop > lowerBound) {
this.container.scrollTop(offsetTop - this.options.maxHeight + 25);
}
this.el.val(this.getValue(this.suggestions[i]));
},
onSelect: function(i) {
var me, fn, s, d;
me = this;
fn = me.options.onSelect;
s = me.suggestions[i];
d = me.data[i];
me.el.val(me.getValue(s));
if ($.isFunction(fn)) { fn(s, d, me.el); }
},
getValue: function(value){
var del, currVal, arr, me;
me = this;
del = me.options.delimiter;
if (!del) { return value; }
currVal = me.currentValue;
arr = currVal.split(del);
if (arr.length === 1) { return value; }
return currVal.substr(0, currVal.length - arr[arr.length - 1].length) + value;
}
};
}(jQuery));

View file

@ -127,12 +127,15 @@ function acl_init(&$a){
if($type == 'm') { if($type == 'm') {
$x = array(); $x = array();
$x['query'] = $search; $x['query'] = $search;
$x['photos'] = array();
$x['links'] = array();
$x['suggestions'] = array(); $x['suggestions'] = array();
$x['data'] = array(); $x['data'] = array();
if(count($r)) { if(count($r)) {
foreach($r as $g) { foreach($r as $g) {
$x['suggestions'][] = sprintf( t('%s [%s]'),$g['name'],$g['url']); $x['photos'][] = $g['micro'];
// '<img src="' . $g['micro'] . ' height="16" width="16" alt="' . t('Image/photo') . '" />' . $x['links'][] = $g['url'];
$x['suggestions'][] = $g['name']; // sprintf( t('%s [%s]'),$g['name'],$g['url']);
$x['data'][] = intval($g['id']); $x['data'][] = intval($g['id']);
} }
} }

View file

@ -18,7 +18,7 @@ function message_init(&$a) {
)); ));
$base = $a->get_baseurl(); $base = $a->get_baseurl();
$a->page['htmlhead'] .= '<script src="' . $a->get_baseurl(true) . '/library/jquery_ac/jquery.autocomplete-min.js" ></script>'; $a->page['htmlhead'] .= '<script src="' . $a->get_baseurl(true) . '/library/jquery_ac/friendica.complete.js" ></script>';
$a->page['htmlhead'] .= <<< EOT $a->page['htmlhead'] .= <<< EOT
<script>$(document).ready(function() { <script>$(document).ready(function() {
@ -172,7 +172,7 @@ function message_content(&$a) {
)); ));
$preselect = (isset($a->argv[2])?array($a->argv[2]):false); $preselect = (isset($a->argv[2])?array($a->argv[2]):false);
$prename = $preurl = $preid = ''; $prename = $preurl = $preid = '';
@ -188,7 +188,7 @@ function message_content(&$a) {
} }
} }
$prefill = (($preselect) ? $prename . ' [' . $preurl . ']' : ''); $prefill = (($preselect) ? $prename : '');
// the ugly select box // the ugly select box
@ -198,6 +198,7 @@ function message_content(&$a) {
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$header' => t('Send Private Message'), '$header' => t('Send Private Message'),
'$to' => t('To:'), '$to' => t('To:'),
'$showinputs' => 'true',
'$prefill' => $prefill, '$prefill' => $prefill,
'$autocomp' => $autocomp, '$autocomp' => $autocomp,
'$preid' => $preid, '$preid' => $preid,
@ -376,9 +377,10 @@ function message_content(&$a) {
$seen = $message['seen']; $seen = $message['seen'];
} }
$select = $message['name'] . '<input type="hidden" name="messageto" value="' . $contact_id . '" />'; $select = $message['name'] . '<input type="hidden" name="messageto" value="' . $contact_id . '" />';
$parent = '<input type="hidden" name="replyto" value="' . $message['parent-uri'] . '" />'; $parent = '<input type="hidden" name="replyto" value="' . $message['parent-uri'] . '" />';
$tpl = get_markup_template('mail_display.tpl'); $tpl = get_markup_template('mail_display.tpl');
$o = replace_macros($tpl, array( $o = replace_macros($tpl, array(
@ -393,6 +395,7 @@ function message_content(&$a) {
// reply // reply
'$header' => t('Send Reply'), '$header' => t('Send Reply'),
'$to' => t('To:'), '$to' => t('To:'),
'$showinputs' => '',
'$subject' => t('Subject:'), '$subject' => t('Subject:'),
'$subjtxt' => template_escape($message['title']), '$subjtxt' => template_escape($message['title']),
'$readonly' => ' readonly="readonly" style="background: #BBBBBB;" ', '$readonly' => ' readonly="readonly" style="background: #BBBBBB;" ',

View file

@ -6,9 +6,9 @@
#, fuzzy #, fuzzy
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: 2.3.1337\n" "Project-Id-Version: 3.0.1338\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-05-09 10:00-0700\n" "POT-Creation-Date: 2012-05-10 10:00-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -48,8 +48,8 @@ msgstr ""
#: ../../mod/register.php:38 ../../mod/regmod.php:116 ../../mod/item.php:124 #: ../../mod/register.php:38 ../../mod/regmod.php:116 ../../mod/item.php:124
#: ../../mod/item.php:140 ../../mod/profile_photo.php:19 #: ../../mod/item.php:140 ../../mod/profile_photo.php:19
#: ../../mod/profile_photo.php:139 ../../mod/profile_photo.php:150 #: ../../mod/profile_photo.php:139 ../../mod/profile_photo.php:150
#: ../../mod/profile_photo.php:163 ../../mod/message.php:40 #: ../../mod/profile_photo.php:163 ../../mod/message.php:44
#: ../../mod/message.php:92 ../../mod/allfriends.php:9 #: ../../mod/message.php:96 ../../mod/allfriends.php:9
#: ../../mod/nogroup.php:25 ../../mod/wall_upload.php:53 #: ../../mod/nogroup.php:25 ../../mod/wall_upload.php:53
#: ../../mod/follow.php:8 ../../mod/display.php:138 ../../mod/profiles.php:7 #: ../../mod/follow.php:8 ../../mod/display.php:138 ../../mod/profiles.php:7
#: ../../mod/profiles.php:365 ../../mod/delegate.php:6 #: ../../mod/profiles.php:365 ../../mod/delegate.php:6
@ -158,7 +158,7 @@ msgstr ""
#: ../../addon/irc/irc.php:55 ../../addon/blogger/blogger.php:102 #: ../../addon/irc/irc.php:55 ../../addon/blogger/blogger.php:102
#: ../../addon/posterous/posterous.php:103 #: ../../addon/posterous/posterous.php:103
#: ../../view/theme/cleanzero/config.php:80 #: ../../view/theme/cleanzero/config.php:80
#: ../../view/theme/diabook/theme.php:683 #: ../../view/theme/diabook/theme.php:685
#: ../../view/theme/diabook/config.php:190 #: ../../view/theme/diabook/config.php:190
#: ../../view/theme/quattro/config.php:52 ../../view/theme/dispy/config.php:70 #: ../../view/theme/quattro/config.php:52 ../../view/theme/dispy/config.php:70
#: ../../include/conversation.php:555 #: ../../include/conversation.php:555
@ -532,8 +532,8 @@ msgid "Share"
msgstr "" msgstr ""
#: ../../mod/photos.php:1214 ../../mod/editpost.php:104 #: ../../mod/photos.php:1214 ../../mod/editpost.php:104
#: ../../mod/wallmessage.php:145 ../../mod/message.php:206 #: ../../mod/wallmessage.php:145 ../../mod/message.php:213
#: ../../mod/message.php:398 ../../include/conversation.php:361 #: ../../mod/message.php:405 ../../include/conversation.php:361
#: ../../include/conversation.php:706 ../../include/conversation.php:983 #: ../../include/conversation.php:706 ../../include/conversation.php:983
msgid "Please wait" msgid "Please wait"
msgstr "" msgstr ""
@ -631,7 +631,7 @@ msgid "Edit"
msgstr "" msgstr ""
#: ../../mod/editpost.php:96 ../../mod/wallmessage.php:143 #: ../../mod/editpost.php:96 ../../mod/wallmessage.php:143
#: ../../mod/message.php:204 ../../mod/message.php:396 #: ../../mod/message.php:211 ../../mod/message.php:403
#: ../../include/conversation.php:965 #: ../../include/conversation.php:965
msgid "Upload photo" msgid "Upload photo"
msgstr "" msgstr ""
@ -641,7 +641,7 @@ msgid "Attach file"
msgstr "" msgstr ""
#: ../../mod/editpost.php:98 ../../mod/wallmessage.php:144 #: ../../mod/editpost.php:98 ../../mod/wallmessage.php:144
#: ../../mod/message.php:205 ../../mod/message.php:397 #: ../../mod/message.php:212 ../../mod/message.php:404
#: ../../include/conversation.php:969 #: ../../include/conversation.php:969
msgid "Insert web link" msgid "Insert web link"
msgstr "" msgstr ""
@ -1775,8 +1775,8 @@ msgid "Remove account"
msgstr "" msgstr ""
#: ../../mod/settings.php:88 ../../mod/admin.php:735 ../../mod/admin.php:940 #: ../../mod/settings.php:88 ../../mod/admin.php:735 ../../mod/admin.php:940
#: ../../addon/mathjax/mathjax.php:36 ../../view/theme/diabook/theme.php:700 #: ../../addon/mathjax/mathjax.php:36 ../../view/theme/diabook/theme.php:571
#: ../../include/nav.php:137 #: ../../view/theme/diabook/theme.php:701 ../../include/nav.php:137
msgid "Settings" msgid "Settings"
msgstr "" msgstr ""
@ -2368,7 +2368,7 @@ msgstr ""
msgid "Number of daily wall messages for %s exceeded. Message failed." msgid "Number of daily wall messages for %s exceeded. Message failed."
msgstr "" msgstr ""
#: ../../mod/wallmessage.php:56 ../../mod/message.php:61 #: ../../mod/wallmessage.php:56 ../../mod/message.php:65
msgid "No recipient selected." msgid "No recipient selected."
msgstr "" msgstr ""
@ -2376,15 +2376,15 @@ msgstr ""
msgid "Unable to check your home location." msgid "Unable to check your home location."
msgstr "" msgstr ""
#: ../../mod/wallmessage.php:62 ../../mod/message.php:68 #: ../../mod/wallmessage.php:62 ../../mod/message.php:72
msgid "Message could not be sent." msgid "Message could not be sent."
msgstr "" msgstr ""
#: ../../mod/wallmessage.php:65 ../../mod/message.php:71 #: ../../mod/wallmessage.php:65 ../../mod/message.php:75
msgid "Message collection failure." msgid "Message collection failure."
msgstr "" msgstr ""
#: ../../mod/wallmessage.php:68 ../../mod/message.php:74 #: ../../mod/wallmessage.php:68 ../../mod/message.php:78
msgid "Message sent." msgid "Message sent."
msgstr "" msgstr ""
@ -2397,7 +2397,7 @@ msgstr ""
msgid "Please enter a link URL:" msgid "Please enter a link URL:"
msgstr "" msgstr ""
#: ../../mod/wallmessage.php:131 ../../mod/message.php:195 #: ../../mod/wallmessage.php:131 ../../mod/message.php:199
msgid "Send Private Message" msgid "Send Private Message"
msgstr "" msgstr ""
@ -2408,18 +2408,18 @@ msgid ""
"your site allow private mail from unknown senders." "your site allow private mail from unknown senders."
msgstr "" msgstr ""
#: ../../mod/wallmessage.php:133 ../../mod/message.php:196 #: ../../mod/wallmessage.php:133 ../../mod/message.php:200
#: ../../mod/message.php:388 #: ../../mod/message.php:395
msgid "To:" msgid "To:"
msgstr "" msgstr ""
#: ../../mod/wallmessage.php:134 ../../mod/message.php:197 #: ../../mod/wallmessage.php:134 ../../mod/message.php:204
#: ../../mod/message.php:389 #: ../../mod/message.php:396
msgid "Subject:" msgid "Subject:"
msgstr "" msgstr ""
#: ../../mod/wallmessage.php:140 ../../mod/message.php:201 #: ../../mod/wallmessage.php:140 ../../mod/message.php:208
#: ../../mod/message.php:392 ../../mod/invite.php:113 #: ../../mod/message.php:399 ../../mod/invite.php:113
msgid "Your message:" msgid "Your message:"
msgstr "" msgstr ""
@ -2962,7 +2962,7 @@ msgstr ""
msgid "New Message" msgid "New Message"
msgstr "" msgstr ""
#: ../../mod/message.php:65 #: ../../mod/message.php:69
msgid "Unable to locate contact information." msgid "Unable to locate contact information."
msgstr "" msgstr ""
@ -2974,55 +2974,55 @@ msgstr ""
msgid "Conversation removed." msgid "Conversation removed."
msgstr "" msgstr ""
#: ../../mod/message.php:237 #: ../../mod/message.php:244
msgid "No messages." msgid "No messages."
msgstr "" msgstr ""
#: ../../mod/message.php:244 #: ../../mod/message.php:251
#, php-format #, php-format
msgid "Unknown sender - %s" msgid "Unknown sender - %s"
msgstr "" msgstr ""
#: ../../mod/message.php:247 #: ../../mod/message.php:254
#, php-format #, php-format
msgid "You and %s" msgid "You and %s"
msgstr "" msgstr ""
#: ../../mod/message.php:250 #: ../../mod/message.php:257
#, php-format #, php-format
msgid "%s and You" msgid "%s and You"
msgstr "" msgstr ""
#: ../../mod/message.php:260 ../../mod/message.php:381 #: ../../mod/message.php:267 ../../mod/message.php:388
msgid "Delete conversation" msgid "Delete conversation"
msgstr "" msgstr ""
#: ../../mod/message.php:263 #: ../../mod/message.php:270
msgid "D, d M Y - g:i A" msgid "D, d M Y - g:i A"
msgstr "" msgstr ""
#: ../../mod/message.php:265 #: ../../mod/message.php:272
#, php-format #, php-format
msgid "%d message" msgid "%d message"
msgid_plural "%d messages" msgid_plural "%d messages"
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
#: ../../mod/message.php:300 #: ../../mod/message.php:307
msgid "Message not available." msgid "Message not available."
msgstr "" msgstr ""
#: ../../mod/message.php:365 #: ../../mod/message.php:372
msgid "Delete message" msgid "Delete message"
msgstr "" msgstr ""
#: ../../mod/message.php:383 #: ../../mod/message.php:390
msgid "" msgid ""
"No secure communications available. You <strong>may</strong> be able to " "No secure communications available. You <strong>may</strong> be able to "
"respond from the sender's profile page." "respond from the sender's profile page."
msgstr "" msgstr ""
#: ../../mod/message.php:387 #: ../../mod/message.php:394
msgid "Send Reply" msgid "Send Reply"
msgstr "" msgstr ""
@ -4683,10 +4683,6 @@ msgstr ""
msgid "event" msgid "event"
msgstr "" msgstr ""
#: ../../addon/hangman/hangman.php:19
msgid "Hangman"
msgstr ""
#: ../../addon/uhremotestorage/uhremotestorage.php:84 #: ../../addon/uhremotestorage/uhremotestorage.php:84
#, php-format #, php-format
msgid "" msgid ""
@ -5641,26 +5637,38 @@ msgstr ""
#: ../../view/theme/diabook/theme.php:130 #: ../../view/theme/diabook/theme.php:130
#: ../../view/theme/diabook/theme.php:571 #: ../../view/theme/diabook/theme.php:571
#: ../../view/theme/diabook/theme.php:675
#: ../../view/theme/diabook/config.php:201
msgid "Community Pages" msgid "Community Pages"
msgstr "" msgstr ""
#: ../../view/theme/diabook/theme.php:418 #: ../../view/theme/diabook/theme.php:418
#: ../../view/theme/diabook/theme.php:677
#: ../../view/theme/diabook/config.php:203
msgid "Community Profiles" msgid "Community Profiles"
msgstr "" msgstr ""
#: ../../view/theme/diabook/theme.php:439 #: ../../view/theme/diabook/theme.php:439
#: ../../view/theme/diabook/theme.php:682
#: ../../view/theme/diabook/config.php:208
msgid "Last users" msgid "Last users"
msgstr "" msgstr ""
#: ../../view/theme/diabook/theme.php:468 #: ../../view/theme/diabook/theme.php:468
#: ../../view/theme/diabook/theme.php:684
#: ../../view/theme/diabook/config.php:210
msgid "Last likes" msgid "Last likes"
msgstr "" msgstr ""
#: ../../view/theme/diabook/theme.php:513 #: ../../view/theme/diabook/theme.php:513
#: ../../view/theme/diabook/theme.php:683
#: ../../view/theme/diabook/config.php:209
msgid "Last photos" msgid "Last photos"
msgstr "" msgstr ""
#: ../../view/theme/diabook/theme.php:550 #: ../../view/theme/diabook/theme.php:550
#: ../../view/theme/diabook/theme.php:680
#: ../../view/theme/diabook/config.php:206
msgid "Find Friends" msgid "Find Friends"
msgstr "" msgstr ""
@ -5677,6 +5685,8 @@ msgid "Invite Friends"
msgstr "" msgstr ""
#: ../../view/theme/diabook/theme.php:606 #: ../../view/theme/diabook/theme.php:606
#: ../../view/theme/diabook/theme.php:676
#: ../../view/theme/diabook/config.php:202
msgid "Earth Layers" msgid "Earth Layers"
msgstr "" msgstr ""
@ -5696,14 +5706,20 @@ msgid "Set latitude (Y) for Earth Layer"
msgstr "" msgstr ""
#: ../../view/theme/diabook/theme.php:626 #: ../../view/theme/diabook/theme.php:626
#: ../../view/theme/diabook/theme.php:678
#: ../../view/theme/diabook/config.php:204
msgid "Help or @NewHere ?" msgid "Help or @NewHere ?"
msgstr "" msgstr ""
#: ../../view/theme/diabook/theme.php:633 #: ../../view/theme/diabook/theme.php:633
#: ../../view/theme/diabook/theme.php:679
#: ../../view/theme/diabook/config.php:205
msgid "Connect Services" msgid "Connect Services"
msgstr "" msgstr ""
#: ../../view/theme/diabook/theme.php:640 #: ../../view/theme/diabook/theme.php:640
#: ../../view/theme/diabook/theme.php:681
#: ../../view/theme/diabook/config.php:207
msgid "Last Tweets" msgid "Last Tweets"
msgstr "" msgstr ""
@ -5712,54 +5728,34 @@ msgstr ""
msgid "Set twitter search term" msgid "Set twitter search term"
msgstr "" msgstr ""
#: ../../view/theme/diabook/theme.php:663
#: ../../view/theme/diabook/theme.php:664
#: ../../view/theme/diabook/theme.php:665
#: ../../view/theme/diabook/theme.php:666
#: ../../view/theme/diabook/theme.php:667
#: ../../view/theme/diabook/theme.php:668
#: ../../view/theme/diabook/theme.php:669
#: ../../view/theme/diabook/theme.php:670
#: ../../view/theme/diabook/theme.php:671
#: ../../view/theme/diabook/theme.php:672 ../../include/acl_selectors.php:288
msgid "don't show"
msgstr ""
#: ../../view/theme/diabook/theme.php:663
#: ../../view/theme/diabook/theme.php:664
#: ../../view/theme/diabook/theme.php:665
#: ../../view/theme/diabook/theme.php:666
#: ../../view/theme/diabook/theme.php:667
#: ../../view/theme/diabook/theme.php:668
#: ../../view/theme/diabook/theme.php:669
#: ../../view/theme/diabook/theme.php:670
#: ../../view/theme/diabook/theme.php:671
#: ../../view/theme/diabook/theme.php:672 ../../include/acl_selectors.php:287
msgid "show"
msgstr ""
#: ../../view/theme/diabook/theme.php:673 #: ../../view/theme/diabook/theme.php:673
#: ../../view/theme/diabook/config.php:201 msgid "Show/hide boxes at right-hand coloumn:"
msgid "Show \"Cummunity Pages\" at right-hand coloumn?"
msgstr ""
#: ../../view/theme/diabook/theme.php:674
#: ../../view/theme/diabook/config.php:202
msgid "Show \"Earth Layers\" at right-hand coloumn?"
msgstr ""
#: ../../view/theme/diabook/theme.php:675
#: ../../view/theme/diabook/config.php:203
msgid "Show \"Cummunity Profiles\" at right-hand coloumn?"
msgstr ""
#: ../../view/theme/diabook/theme.php:676
#: ../../view/theme/diabook/config.php:204
msgid "Show \"Help or @NewHere\" at right-hand coloumn?"
msgstr ""
#: ../../view/theme/diabook/theme.php:677
#: ../../view/theme/diabook/config.php:205
msgid "Show \"Connect Services\" at right-hand coloumn?"
msgstr ""
#: ../../view/theme/diabook/theme.php:678
#: ../../view/theme/diabook/config.php:206
msgid "Show \"Find Friends\" at right-hand coloumn?"
msgstr ""
#: ../../view/theme/diabook/theme.php:679
#: ../../view/theme/diabook/config.php:207
msgid "Show \"Last Tweets\" at right-hand coloumn?"
msgstr ""
#: ../../view/theme/diabook/theme.php:680
#: ../../view/theme/diabook/config.php:208
msgid "Show \"Last Users\" at right-hand coloumn?"
msgstr ""
#: ../../view/theme/diabook/theme.php:681
#: ../../view/theme/diabook/config.php:209
msgid "Show \"Last Photos\" at right-hand coloumn?"
msgstr ""
#: ../../view/theme/diabook/theme.php:682
#: ../../view/theme/diabook/config.php:210
msgid "Show \"Last Likes\" at right-hand coloumn?"
msgstr "" msgstr ""
#: ../../view/theme/diabook/config.php:194 #: ../../view/theme/diabook/config.php:194
@ -6683,14 +6679,6 @@ msgstr ""
msgid "Visible to everybody" msgid "Visible to everybody"
msgstr "" msgstr ""
#: ../../include/acl_selectors.php:287
msgid "show"
msgstr ""
#: ../../include/acl_selectors.php:288
msgid "don't show"
msgstr ""
#: ../../include/enotify.php:14 #: ../../include/enotify.php:14
msgid "Friendica Notification" msgid "Friendica Notification"
msgstr "" msgstr ""

View file

@ -36,6 +36,7 @@
obj.value = ''; obj.value = '';
$("#comment-edit-text-" + id).addClass("comment-edit-text-full"); $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
$("#comment-edit-text-" + id).removeClass("comment-edit-text-empty"); $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
$("#mod-cmnt-wrap-" + id).show();
openMenu("comment-edit-submit-wrapper-" + id); openMenu("comment-edit-submit-wrapper-" + id);
} }
} }
@ -44,6 +45,7 @@
obj.value = '$comment'; obj.value = '$comment';
$("#comment-edit-text-" + id).removeClass("comment-edit-text-full"); $("#comment-edit-text-" + id).removeClass("comment-edit-text-full");
$("#comment-edit-text-" + id).addClass("comment-edit-text-empty"); $("#comment-edit-text-" + id).addClass("comment-edit-text-empty");
$("#mod-cmnt-wrap-" + id).hide();
closeMenu("comment-edit-submit-wrapper-" + id); closeMenu("comment-edit-submit-wrapper-" + id);
} }
} }

View file

@ -0,0 +1,34 @@
<div class="comment-wwedit-wrapper" id="comment-edit-wrapper-$id" style="display: block;">
<form class="comment-edit-form" id="comment-edit-form-$id" action="item" method="post" onsubmit="post_comment($id); return false;">
<input type="hidden" name="type" value="$type" />
<input type="hidden" name="profile_uid" value="$profile_uid" />
<input type="hidden" name="parent" value="$parent" />
<input type="hidden" name="return" value="$return_path" />
<input type="hidden" name="jsreload" value="$jsreload" />
<input type="hidden" name="preview" id="comment-preview-inp-$id" value="0" />
<div class="comment-edit-photo" id="comment-edit-photo-$id" >
<a class="comment-edit-photo-link" href="$mylink" title="$mytitle"><img class="my-comment-photo" src="$myphoto" alt="$mytitle" title="$mytitle" /></a>
</div>
<div class="comment-edit-photo-end"></div>
<div id="mod-cmnt-wrap-$id" class="mod-cmnt-wrap" style="display:none">
<div id="mod-cmnt-name-lbl-$id" class="mod-cmnt-name-lbl">$lbl_modname</div>
<input type="text" id="mod-cmnt-name-$id" class="mod-cmnt-name" name="mod-cmnt-name" value="$modname" />
<div id="mod-cmnt-email-lbl-$id" class="mod-cmnt-email-lbl">$lbl_modemail</div>
<input type="text" id="mod-cmnt-email-$id" class="mod-cmnt-email" name="mod-cmnt-email" value="$modemail" />
<div id="mod-cmnt-url-lbl-$id" class="mod-cmnt-url-lbl">$lbl_modurl</div>
<input type="text" id="mod-cmnt-url-$id" class="mod-cmnt-url" name="mod-cmnt-url" value="$modurl" />
</div>
<textarea id="comment-edit-text-$id" class="comment-edit-text-empty" name="body" onFocus="commentOpen(this,$id);" onBlur="commentClose(this,$id);" >$comment</textarea>
<div class="comment-edit-text-end"></div>
<div class="comment-edit-submit-wrapper" id="comment-edit-submit-wrapper-$id" style="display: none;" >
<input type="submit" onclick="post_comment($id); return false;" id="comment-edit-submit-$id" class="comment-edit-submit" name="submit" value="$submit" />
<span onclick="preview_comment($id);" id="comment-edit-preview-link-$id" class="fakelink">$preview</span>
<div id="comment-edit-preview-$id" class="comment-edit-preview" style="display:none;"></div>
</div>
<div class="comment-edit-end"></div>
</form>
</div>

View file

@ -105,3 +105,17 @@ blockquote {
input#acl-search { input#acl-search {
background-color: #aaa; background-color: #aaa;
} }
.notify-seen {
background:#666;
}
#nav-notifications-menu {
background: #2e2e2f;
}
#nav-notifications-menu li:hover {
background: #444;
}

View file

@ -10,16 +10,7 @@
<div id="mapcontrol" style="display:none;"> <div id="mapcontrol" style="display:none;">
<form id="mapform" action="network" method="post" > <form id="mapform" action="network" method="post" >
<span style="width: 500px;position: relative;float: right;right:20px;"><p>this ist still under development. <div id="layermanager" style="width: 350px;position: relative;float: right;right:20px;"></div>
the idea is to provide a map with different layers(e.g. earth population, atomic power plants, wheat growing acreages, sunrise or what you want)
and markers(events, demos, friends, anything, that is intersting for you).
These layer and markers should be importable and deletable by the user.</p>
<p>help on this feature is very appreciated. i am not that good in js so it's a start, but needs tweaks and further dev.
just contact me, if you are intesrested in joining</p>
<p>http://localhost/friendica/profile/thomas</p>
<p>this is build with <b>mapquery</b> http://mapquery.org/ and
<b>openlayers</b>http://openlayers.org/</p>
</span>
<div id="map2" style="height:350px;width:350px;"></div> <div id="map2" style="height:350px;width:350px;"></div>
<div id="mouseposition" style="width: 350px;"></div> <div id="mouseposition" style="width: 350px;"></div>
{{inc field_input.tpl with $field=$ELZoom}}{{endinc}} {{inc field_input.tpl with $field=$ELZoom}}{{endinc}}
@ -28,6 +19,16 @@ just contact me, if you are intesrested in joining</p>
<div class="settings-submit-wrapper"> <div class="settings-submit-wrapper">
<input id="mapsub" type="submit" value="$sub" class="settings-submit" name="diabook-settings-map-sub"></input> <input id="mapsub" type="submit" value="$sub" class="settings-submit" name="diabook-settings-map-sub"></input>
</div> </div>
<span style="width: 500px;"><p>this ist still under development.
the idea is to provide a map with different layers(e.g. earth population, atomic power plants, wheat growing acreages, sunrise or what you want)
and markers(events, demos, friends, anything, that is intersting for you).
These layer and markers should be importable and deletable by the user.</p>
<p>help on this feature is very appreciated. i am not that good in js so it's a start, but needs tweaks and further dev.
just contact me, if you are intesrested in joining</p>
<p>https://toktan.org/profile/thomas</p>
<p>this is build with <b>mapquery</b> http://mapquery.org/ and
<b>openlayers</b>http://openlayers.org/</p>
</span>
</form> </form>
</div> </div>

View file

@ -196,15 +196,15 @@ function diabook_form(&$a, $font_size, $line_height, $resolution, $color, $TSear
'$color' => array('diabook_color', t('Set color scheme'), $color, '', $colors), '$color' => array('diabook_color', t('Set color scheme'), $color, '', $colors),
'$TSearchTerm' => array('diabook_TSearchTerm', t('Set twitter search term'), $TSearchTerm, '', $TSearchTerm), '$TSearchTerm' => array('diabook_TSearchTerm', t('Set twitter search term'), $TSearchTerm, '', $TSearchTerm),
'$ELZoom' => array('diabook_ELZoom', t('Set zoomfactor for Earth Layer'), $ELZoom, '', $ELZoom), '$ELZoom' => array('diabook_ELZoom', t('Set zoomfactor for Earth Layer'), $ELZoom, '', $ELZoom),
'$ELPosX' => array('diabook_ELPosX', t('Set longitude (X) for Earth Layer'), $ELPosX, '', $ELPosX), '$ELPosX' => array('diabook_ELPosX', t('Set longitude (X) for Earth Layers'), $ELPosX, '', $ELPosX),
'$ELPosY' => array('diabook_ELPosY', t('Set latitude (Y) for Earth Layer'), $ELPosY, '', $ELPosY), '$ELPosY' => array('diabook_ELPosY', t('Set latitude (Y) for Earth Layers'), $ELPosY, '', $ELPosY),
'$close_pages' => array('diabook_close_pages', t('Community Pages'), $close_pages, '', $close_pagesC), '$close_pages' => array('diabook_close_pages', t('Community Pages'), $close_pages, '', $close_pagesC),
'$close_mapquery' => array('diabook_close_mapquery', t('Earth Layers'), $close_mapquery, '', $close_mapqueryC), '$close_mapquery' => array('diabook_close_mapquery', t('Earth Layers'), $close_mapquery, '', $close_mapqueryC),
'$close_profiles' => array('diabook_close_profiles', t('Community Profiles'), $close_profiles, '', $close_profilesC), '$close_profiles' => array('diabook_close_profiles', t('Community Profiles'), $close_profiles, '', $close_profilesC),
'$close_helpers' => array('diabook_close_helpers', t('Help or @NewHere ?'), $close_helpers, '', $close_helpersC), '$close_helpers' => array('diabook_close_helpers', t('Help or @NewHere ?'), $close_helpers, '', $close_helpersC),
'$close_services' => array('diabook_close_services', t('Connect Services'), $close_services, '', $close_servicesC), '$close_services' => array('diabook_close_services', t('Connect Services'), $close_services, '', $close_servicesC),
'$close_friends' => array('diabook_close_friends', t('Find Friends'), $close_friends, '', $close_friendsC), '$close_friends' => array('diabook_close_friends', t('Find Friends'), $close_friends, '', $close_friendsC),
'$close_twitter' => array('diabook_close_twitter', t('Last Tweets'), $close_twitter, '', $close_twitterC), '$close_twitter' => array('diabook_close_twitter', t('Last tweets'), $close_twitter, '', $close_twitterC),
'$close_lastusers' => array('diabook_close_lastusers', t('Last users'), $close_lastusers, '', $close_lastusersC), '$close_lastusers' => array('diabook_close_lastusers', t('Last users'), $close_lastusers, '', $close_lastusersC),
'$close_lastphotos' => array('diabook_close_lastphotos', t('Last photos'), $close_lastphotos, '', $close_lastphotosC), '$close_lastphotos' => array('diabook_close_lastphotos', t('Last photos'), $close_lastphotos, '', $close_lastphotosC),
'$close_lastlikes' => array('diabook_close_lastlikes', t('Last likes'), $close_lastlikes, '', $close_lastlikesC), '$close_lastlikes' => array('diabook_close_lastlikes', t('Last likes'), $close_lastlikes, '', $close_lastlikesC),

File diff suppressed because one or more lines are too long

View file

@ -17,11 +17,11 @@ the matched element
**options** an object of key-value pairs with options for the map. Possible **options** an object of key-value pairs with options for the map. Possible
pairs are: pairs are:
* **layers** (array of MapQuery.Layer *or* MapQuery.Layer): Either an array * **layers** (array of MapQuery.Layer *or* MapQuery.Layer): Either an array
* or a single layer that should be added to the map or a single layer that should be added to the map
* **center** ({position: [x,y], zoom: z(int), box: [llx,lly,urx,ury]}): * **center** ({position: [x,y], zoom: z(int), box: [llx,lly,urx,ury]}):
* Initially go to a certain location. At least one layer (in the `layers` Initially go to a certain location. At least one layer (in the `layers`
* option) needs to be specified. option) needs to be specified.
> Returns: $('selector') (jQuery object) > Returns: $('selector') (jQuery object)
@ -68,6 +68,8 @@ $.MapQuery.Map = function(element, options) {
delete this.olMapOptions.layers; delete this.olMapOptions.layers;
delete this.olMapOptions.maxExtent; delete this.olMapOptions.maxExtent;
delete this.olMapOptions.zoomToMaxExtent; delete this.olMapOptions.zoomToMaxExtent;
delete this.olMapOptions.center;
//TODO SMO20110630 the maxExtent is in mapprojection, decide whether or //TODO SMO20110630 the maxExtent is in mapprojection, decide whether or
//not we need to change it to displayProjection //not we need to change it to displayProjection
this.maxExtent = this.options.maxExtent; this.maxExtent = this.options.maxExtent;
@ -75,6 +77,9 @@ $.MapQuery.Map = function(element, options) {
this.maxExtent[0],this.maxExtent[1],this.maxExtent[2],this.maxExtent[3]); this.maxExtent[0],this.maxExtent[1],this.maxExtent[2],this.maxExtent[3]);
this.projection = this.options.projection;
this.displayProjection = this.options.displayProjection;
OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3; OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
OpenLayers.Util.onImageLoadErrorColor = "transparent"; OpenLayers.Util.onImageLoadErrorColor = "transparent";
@ -96,14 +101,46 @@ $.MapQuery.Map = function(element, options) {
// To bind and trigger jQuery events // To bind and trigger jQuery events
this.events = $({}); this.events = $({});
// create triggers for all OpenLayers map events
var events = {}; this.handlers = {
$.each(this.olMap.EVENT_TYPES, function(i, evt) { // Triggers the jQuery events, after the OpenLayers events
events[evt] = function() { // happened without any further processing
self.events.trigger(evt, arguments); simple: function(data) {
}; this.trigger(data.type);
}
};
// MapQuery doesn't bind all OpenLayers events automatically,
// but just the ones that make sense.
// Events that are left out intensionally are:
// - changebaselayer: MapQuery doesn't have the concept of base layers
// - mouseover, mouseout, mousemove: Handle those with jQuery on the
// DOM level
// Some events can be triggered by MapQuery without listening to the
// OpenLayers events. This only works for events that are triggered
// by functionality that MapQuery implements in some custom way, e.g.
// (pre)addlayer, (pre)removelayer, changelayer.
// TODO vmx 20120309: Proper docs for the events, here's some quickly
// written info:
// - generally spoken, the map events follow the OpeLayer events
// - preaddlayer, movestart, move, moveend, zoomend: no additional
// argument
// - addlayer, preremovelayer, removelayer: layer as additional argument
// - changelayer: layer and the property that changed as additional
// argument. Possible values for the property are: position (in
// the layer stack), opacity, visibility
// Currently this event is always fired, even if the property
// was only meant to be changed, but wasn't exctually changed.
// I.e. that the event is fired even if you call
// `layer.visible(true)` although the layer is already visible.
// I'm (vmx) not sure if we want to change that :)
this.olMap.events.on({
scope: this,
movestart: this.handlers.simple,
move: this.handlers.simple,
moveend: this.handlers.simple,
zoomend: this.handlers.simple
}); });
this.olMap.events.on(events);
// Add layers to the map // Add layers to the map
if (this.options.layers!==undefined) { if (this.options.layers!==undefined) {
@ -129,7 +166,7 @@ _version added 0.1_
**options** an object of key-value pairs with options to create one or **options** an object of key-value pairs with options to create one or
more layers more layers
>Returns: [layer] (array of MapQuery.Layer) >Returns: [layer] (array of MapQuery.Layer) _or_ false
The `.layers()` method allows us to attach layers to a mapQuery object. It takes The `.layers()` method allows us to attach layers to a mapQuery object. It takes
@ -138,6 +175,10 @@ layer options objects. If an options object is given, it will return the
resulting layer(s). We can also use it to retrieve all layers currently attached resulting layer(s). We can also use it to retrieve all layers currently attached
to the map. to the map.
When adding layers, those are returned. If the creation is cancled by returning
`false` in the `preaddlayer` event, this function returns `false` to
intentionally break the chain instead of hiding errors subtly).
var osm = map.layers({type:'osm'}); //add an osm layer to the map var osm = map.layers({type:'osm'}); //add an osm layer to the map
var layers = map.layers(); //get all layers of the map var layers = map.layers(); //get all layers of the map
@ -156,7 +197,7 @@ to the map.
else { else {
return $.map(options, function(layer) { return $.map(options, function(layer) {
return self._addLayer(layer); return self._addLayer(layer);
}); }).reverse();
} }
break; break;
default: default:
@ -182,27 +223,43 @@ to the map.
_addLayer: function(options) { _addLayer: function(options) {
var id = this._createId(); var id = this._createId();
var layer = new $.MapQuery.Layer(this, id, options); var layer = new $.MapQuery.Layer(this, id, options);
// NOTE vmx 20120305: Not sure if this is a good idea, or if it would
// be better to include `options` with the preaddlayer event
if (this._triggerReturn('preaddlayer', [layer])===false) {
return false;
}
this.olMap.addLayer(layer.olLayer);
this.layersList[id] = layer; this.layersList[id] = layer;
if (layer.isVector) { if (layer.isVector) {
this.vectorLayers.push(id); this.vectorLayers.push(id);
} }
this._updateSelectFeatureControl(this.vectorLayers); this._updateSelectFeatureControl(this.vectorLayers);
this.events.trigger('mqAddLayer',layer);
layer.trigger('addlayer');
return layer; return layer;
}, },
// Creates a new unique ID for a layer // Creates a new unique ID for a layer
_createId: function() { _createId: function() {
return 'mapquery' + this.idCounter++; return 'mapquery_' + this.idCounter++;
}, },
_removeLayer: function(id) { _removeLayer: function(id) {
var layer = this.layersList[id];
if (this._triggerReturn('preremovelayer', [layer])===false) {
return false;
}
// remove id from vectorlayer if it is there list // remove id from vectorlayer if it is there list
this.vectorLayers = $.grep(this.vectorLayers, function(elem) { this.vectorLayers = $.grep(this.vectorLayers, function(elem) {
return elem != id; return elem != id;
}); });
this._updateSelectFeatureControl(this.vectorLayers); this._updateSelectFeatureControl(this.vectorLayers);
this.events.trigger('mqRemoveLayer',id); this.olMap.removeLayer(layer.olLayer);
delete this.layersList[id];
// XXX vmx: shouldn't the layer be destroyed() properly? // XXX vmx: shouldn't the layer be destroyed() properly?
delete this.layersList[id];
layer.trigger('removelayer');
return this; return this;
}, },
/** /**
@ -210,13 +267,13 @@ to the map.
_version added 0.1_ _version added 0.1_
####**Description**: get/set the extent, zoom and position of the map ####**Description**: get/set the extent, zoom and position of the map
**position** the position as [x,y] in displayProjection (default EPSG:4326) * **position** the position as [x,y] in displayProjection (default EPSG:4326)
to center the map at to center the map at
**zoom** the zoomlevel as integer to zoom the map to * **zoom** the zoomlevel as integer to zoom the map to
**box** an array with the lower left x, lower left y, upper right x, * **box** an array with the lower left x, lower left y, upper right x,
upper right y to zoom the map to, upper right y to zoom the map to,
this will take precedent when conflicting with any of the above values this will take precedent when conflicting with any of the above values
**projection** the projection the coordinates are in, default is * **projection** the projection the coordinates are in, default is
the displayProjection the displayProjection
>Returns: {position: [x,y], zoom: z(int), box: [llx,lly,urx,ury]} >Returns: {position: [x,y], zoom: z(int), box: [llx,lly,urx,ury]}
@ -239,7 +296,7 @@ extent from the map. The coordinates are returned in displayProjection.
*/ */
center: function (options) { center: function (options) {
var position; var position;
var mapProjection; var mapProjection = new OpenLayers.Projection(this.projection);
// Determine source projection // Determine source projection
var sourceProjection = null; var sourceProjection = null;
var zoom; var zoom;
@ -249,7 +306,7 @@ extent from the map. The coordinates are returned in displayProjection.
'OpenLayers.Projection' ? options.projection : 'OpenLayers.Projection' ? options.projection :
new OpenLayers.Projection(options.projection); new OpenLayers.Projection(options.projection);
} else { } else {
var displayProjection = this.olMap.displayProjection; var displayProjection = this.displayProjection;
if(!displayProjection) { if(!displayProjection) {
// source == target // source == target
sourceProjection = new OpenLayers.Projection('EPSG:4326'); sourceProjection = new OpenLayers.Projection('EPSG:4326');
@ -265,8 +322,6 @@ extent from the map. The coordinates are returned in displayProjection.
position = this.olMap.getCenter(); position = this.olMap.getCenter();
zoom = this.olMap.getZoom(); zoom = this.olMap.getZoom();
box = this.olMap.getExtent(); box = this.olMap.getExtent();
mapProjection = this.olMap.getProjectionObject();
if (!mapProjection.equals(sourceProjection)) { if (!mapProjection.equals(sourceProjection)) {
position.transform(mapProjection, sourceProjection); position.transform(mapProjection, sourceProjection);
@ -282,9 +337,8 @@ extent from the map. The coordinates are returned in displayProjection.
// Zoom to the extent of the box // Zoom to the extent of the box
if (options.box!==undefined) { if (options.box!==undefined) {
mapProjection = this.olMap.getProjectionObject();
box = new OpenLayers.Bounds( box = new OpenLayers.Bounds(
options.box[0], options.box[1],options.box[2], options.box[3]); options.box[0], options.box[1],options.box[2], options.box[3]);
if (!mapProjection.equals(sourceProjection)) { if (!mapProjection.equals(sourceProjection)) {
box.transform(sourceProjection,mapProjection); box.transform(sourceProjection,mapProjection);
} }
@ -299,7 +353,6 @@ extent from the map. The coordinates are returned in displayProjection.
else { else {
position = new OpenLayers.LonLat(options.position[0], position = new OpenLayers.LonLat(options.position[0],
options.position[1]); options.position[1]);
mapProjection = this.olMap.getProjectionObject();
if (!mapProjection.equals(sourceProjection)) { if (!mapProjection.equals(sourceProjection)) {
position.transform(sourceProjection, mapProjection); position.transform(sourceProjection, mapProjection);
} }
@ -323,11 +376,89 @@ extent from the map. The coordinates are returned in displayProjection.
this.olMap.addControl(this.selectFeatureControl); this.olMap.addControl(this.selectFeatureControl);
this.selectFeatureControl.activate(); this.selectFeatureControl.activate();
}, },
bind: function() { // This function got a bit too clever. The reason is, that jQuery's
this.events.bind.apply(this.events, arguments); // bind() is overloaded with so many possible combinations of arguments.
// And, of course, MapQuery wants to support them all
// The essence of the function is to wrap the original callback into
// the correct scope
bind: function(types, data, fn) {
var self = this;
// A map of event/handle pairs, wrap each of them
if(arguments.length===1) {
var wrapped = {};
$.each(types, function(type, fn) {
wrapped[type] = function() {
return fn.apply(self, arguments);
};
});
this.events.bind.apply(this.events, [wrapped]);
}
else {
var args = [types];
// Only callback given, but no data (types, fn), hence
// `data` is the function
if(arguments.length===2) {
fn = data;
}
else {
if (!$.isFunction(fn)) {
throw('bind: you might have a typo in the function name');
}
// Callback and data given (types, data, fn), hence include
// the data in the argument list
args.push(data);
}
args.push(function() {
return fn.apply(self, arguments);
});
this.events.bind.apply(this.events, args);
}
//this.events.bind.call(this.events, types, function() {
// data.apply(self, arguments);
//});
//this.events.bind.call(this.events, types, function() {
// data.apply(self, arguments);
//});
//this.events.bind.apply(this.events, arguments);
//this.events.bind.call(this.events, types, $.proxy(data, self));
//this.events.bind.apply(this.events, arguments);//.bind(this);
//this.events.bind.apply(this.events, $.proxy(arguments));//.bind(this);
//this.events.bind.apply(this.events, $.proxy(arguments));//.bind(this);
//this.events.bind(types, data, fn);//.bind(this);
//this.events.bind.call(this.events, types, data, fn);//.bind(this);
return this;
}, },
one: function() { /**
this.events.one.apply(this.events, arguments); ###*map*.`trigger(name [, parameters])`
_version added 0.2_
####**Description**: triggers an event on the map
* **name** the name of the event
* **parameters** additional parameters that will be passed on with the event
>Returns: map (MapQuery.Map)
To subscribe to the triggered events, you need to bind to the mapuuu.
map.bind('myEvent', function(evt) {
console.log('the values are: ' + evt.data[0] + ' and ' + evt.data[1])
});
map.trigger('myEvent', 'some', 'values');
*/
trigger: function() {
// There is no point in using trigger() insted of triggerHandler(), as
// we don't fire native events
this.events.triggerHandler.apply(this.events, arguments);
return this;
},
// Basically a trigger that returns the return value of the last listener
_triggerReturn: function() {
return this.events.triggerHandler.apply(this.events, arguments);
}, },
destroy: function() { destroy: function() {
this.olMap.destroy(); this.olMap.destroy();
@ -363,6 +494,32 @@ $.MapQuery.Layer = function(map, id, options) {
// to bind and trigger jQuery events // to bind and trigger jQuery events
this.events = $({}); this.events = $({});
this.handlers = {
// Triggers the jQuery events, after the OpenLayers events
// happened without any further processing
simple: function(data) {
this.trigger(data.type);
},
// All OpenLayers events that are triggered by user interaction,
// like clicking somewhere or selecting a feature, need to be
// handled in a special way. Those OpenLayers events will then be
// triggered by MapQuery as well
// In case of the "featureselected" event, this means that the
// logic of handling the event is completely within the event
// handler. When ".select()" on a feature is called, it will just
// trigger the OpenLayers "featureselected" event, whose handler
// will then trigger the corresponding jQuery event.
includeFeature: function(data) {
var feature = new $.MapQuery.Feature(this, {olFeature:
data.feature});
this.trigger(data.type, [feature]);
},
prependLayer: function(data) {
this.trigger('layer' + data.type);
}
};
// create the actual layer based on the options // create the actual layer based on the options
// Returns layer and final options for the layer (for later re-use, // Returns layer and final options for the layer (for later re-use,
// e.g. zoomToMaxExtent). // e.g. zoomToMaxExtent).
@ -371,17 +528,26 @@ $.MapQuery.Layer = function(map, id, options) {
this.olLayer = res.layer; this.olLayer = res.layer;
this.options = res.options; this.options = res.options;
// create triggers for all OpenLayers layer events // Some good documentation for the events is needed. Here is a short
var events = {}; // description on how the current events compare to the OpenLayer
$.each(this.olLayer.EVENT_TYPES, function(i, evt) { // events on the layer:
events[evt] = function() { // - added, remove: not needed, there's addlayer and removelayer
self.events.trigger(evt, arguments); // - visibilitychanged: not needed, there's the changelayer event
self.map.events.trigger(evt, arguments); // - move, moveend: not needed as you get them from the map, not the layer
}; // - loadstart, loadend: renamed to layerloadstart, layerloadend
this.olLayer.events.on({
scope: this,
loadstart: this.handlers.prependLayer,
loadend: this.handlers.prependLayer,
featureselected: this.handlers.includeFeature,
featureunselected: this.handlers.includeFeature,
featureremoved: this.handlers.includeFeature
}); });
this.olLayer.events.on(events);
this.map.olMap.addLayer(this.olLayer); // To be able to retreive the MapQuery layer, when we only have the
// OpenLayers layer available. For example on the layeradded event.
// NOTE vmx 2012-02-26: Any nicer solution is welcome
this.olLayer.mapQueryId = this.id;
}; };
$.MapQuery.Layer.prototype = { $.MapQuery.Layer.prototype = {
@ -390,7 +556,7 @@ $.MapQuery.Layer.prototype = {
_version added 0.1_ _version added 0.1_
####**Description**: move the layer down in the layer stack of the map ####**Description**: move the layer down in the layer stack of the map
**delta** the amount of layers the layer has to move down in the layer * **delta** the amount of layers the layer has to move down in the layer
stack (default 1) stack (default 1)
>Returns layer (MapQuery.Layer) >Returns layer (MapQuery.Layer)
@ -421,22 +587,21 @@ will put the layer at the bottom.
each: function () {}, each: function () {},
/** /**
###*layer*.`remove()` ###*layer*.`remove()`
_version added 0.1_ _version added 0.2_
####**Description**: remove the layer from the map ####**Description**: remove the layer from the map
>Returns: id (string) >Returns: map (MapQuery.Map) or false
The `.remove()` method allows us to remove a layer from the map. The `.remove()` method allows us to remove a layer from the map.
It returns an id to allow widgets to remove their references to the It returns the `map` object if the layer was removed, or `false` if the
destroyed layer. removal was prevented in the preremovelayer event.
var id = layer.remove(); //remove this layer var id = layer.remove(); //remove this layer
*/ */
remove: function() { remove: function() {
this.map.olMap.removeLayer(this.olLayer);
// remove references to this layer that are stored in the // remove references to this layer that are stored in the
// map object // map object
return this.map._removeLayer(this.id); return this.map._removeLayer(this.id);
@ -447,9 +612,9 @@ _version added 0.1_
####**Description**: get/set the `position` of the layer in the layer ####**Description**: get/set the `position` of the layer in the layer
stack of the map stack of the map
**position** an integer setting the new position of the layer in the layer stack * **position** an integer setting the new position of the layer in the layer stack
>Returns: position (integer) >Returns: position (integer) _or_ layer (MapQuery.Layer)
The `.position()` method allows us to change the position of the layer in the The `.position()` method allows us to change the position of the layer in the
@ -467,7 +632,9 @@ return the current postion.
return this.map.olMap.getLayerIndex(this.olLayer)-1; return this.map.olMap.getLayerIndex(this.olLayer)-1;
} }
else { else {
return this.map.olMap.setLayerIndex(this.olLayer, pos+1); this.map.olMap.setLayerIndex(this.olLayer, pos+1);
this.trigger('changelayer', ['position']);
return this;
} }
}, },
/** /**
@ -475,7 +642,7 @@ return the current postion.
_version added 0.1_ _version added 0.1_
####**Description**: move the layer up in the layer stack of the map ####**Description**: move the layer up in the layer stack of the map
**delta** the amount of layers the layer has to move up in the layer * **delta** the amount of layers the layer has to move up in the layer
stack (default 1) stack (default 1)
>Returns: layer (MapQuery.Layer) >Returns: layer (MapQuery.Layer)
@ -503,7 +670,7 @@ given.
_version added 0.1_ _version added 0.1_
####**Description**: get/set the `visible` state of the layer ####**Description**: get/set the `visible` state of the layer
**visible** a boolean setting the visibiliyu of the layer * **visible** a boolean setting the visibility of the layer
>Returns: visible (boolean) >Returns: visible (boolean)
@ -522,6 +689,7 @@ If no visible is given, it will return the current visibility.
} }
else { else {
this.olLayer.setVisibility(vis); this.olLayer.setVisibility(vis);
this.trigger('changelayer', ['visibility']);
return this; return this;
} }
}, },
@ -530,9 +698,9 @@ If no visible is given, it will return the current visibility.
_version added 0.1_ _version added 0.1_
####**Description**: get/set the `opacity` of the layer ####**Description**: get/set the `opacity` of the layer
**position** a float [0-1] setting the opacity of the layer * **position** a float [0-1] setting the opacity of the layer
>Returns: opacity (float) >Returns: opacity (float) _or_ layer (MapQuery.Layer)
The `.opacity()` method allows us to change the opacity of the layer. The `.opacity()` method allows us to change the opacity of the layer.
@ -544,24 +712,265 @@ If no opacity is given, it will return the current opacity.
*/ */
opacity: function(opac) { opacity: function(opac) {
if (opac===undefined) { if (opac===undefined) {
// this.olLayer.opacity can be null if never // this.olLayer.opacity can be null if never
// set so return the visibility // set so return the visibility
var value = this.olLayer.opacity ? var value = this.olLayer.opacity ?
this.olLayer.opacity : this.olLayer.getVisibility(); this.olLayer.opacity : this.olLayer.getVisibility();
return value; return value;
} }
else { else {
this.olLayer.setOpacity(opac); this.olLayer.setOpacity(opac);
this.trigger('changelayer', ['opacity']);
return this; return this;
} }
}, },
// every event gets the layer passed in // every event gets the layer passed in
bind: function() { bind: function() {
this.events.bind.apply(this.events, arguments); // Use the same bind function as for the map
this.map.bind.apply(this, arguments);
return this;
}, },
one: function() { /**
this.events.one.apply(this.events, arguments); ###*layer*.`trigger(name [, parameters])`
_version added 0.2_
####**Description**: triggers an event on the layer and map
* **name** the name of the event
* **parameters** additional parameters that will be passed on with the event
>Returns: layer (MapQuery.Layer)
The events get triggered on the layer as well as on the map. To subscribe to
the triggered events, you can either bind to the layer or the map. If bound
to the map, the second argument in the bind will be the layer the event
came from
layer.bind('myEvent', function(evt) {
console.log('the values are: ' + evt.data[0] + ' and ' + evt.data[1])
});
map.bind('myEvent', function(evt, layer) {
console.log('the values are: ' + evt.data[0] + ' and ' + evt.data[1])
});
layer.trigger('myEvent', 'some', 'values');
*/
trigger: function() {
var args = Array.prototype.slice.call(arguments);
this.events.triggerHandler.apply(this.events, args);
this._addLayerToArgs(args);
this.map.events.triggerHandler.apply(this.map.events, args);
return this;
},
// Basically a trigger that returns the return value of the last listener
_triggerReturn: function() {
var args = Array.prototype.slice.call(arguments);
var ret = this.events.triggerHandler.apply(this.events, args);
if (ret !== undefined) {
return ret;
}
this._addLayerToArgs(args);
return this.events.triggerHandler.apply(this.map.events, args);
},
// Adds the current layer to the event arguments, so that it is included
// in the event on the map
_addLayerToArgs: function(args) {
// Add layer for the map event
if (args.length===1) {
args.push([this]);
}
else {
args[1].unshift(this);
}
},
/**
###*layer*.`features([options])`
_version added 0.2.0_
####**Description**: get/set the features of a (vector) layer
**options** an object of key-value pairs with options to create one or
more features
>Returns: [features] (array of MapQuery.Feature)
The `.features()` method allows us to attach features to a mapQuery layer
object. It takes an options object with feature options. To add multiple
features, create an array of feature options objects. If an options object
is given, it will return the resulting feature(s). We can also use it to
retrieve all features currently attached to the layer.
// add an (vector) json layer to the map
var jsonlayer = map.layers({type:'json'});
// add a feature to the layer
jsonlayer.features({geometry: {type: "Point", coordinates: [5.3, 7.4]}});
// get all features of a layer (sorted with first added feature at the beginning
var features = jsonlayer.features();
*/
features: function(options) {
var self = this;
switch(arguments.length) {
// return all features
case 0:
return this._allFeatures();
// add new feature(s)
case 1:
if (!$.isArray(options)) {
return this._addFeature(options);
}
else {
return $.map(options, function(feature) {
return self._addFeature(feature);
});
}
break;
default:
throw('wrong argument number');
}
},
_allFeatures: function() {
var layer = this;
return $.map(layer.olLayer.features, function(feature) {
return new $.MapQuery.Feature(layer, {olFeature: feature});
});
},
_addFeature: function(options) {
var feature = new $.MapQuery.Feature(this, options);
// NOTE vmx 2012-04-19: Not sure if this is a good idea, or if it would
// be better to include `options` with the preaddfeature event
if (this._triggerReturn('preaddfeature', [feature])===false) {
return false;
}
this.olLayer.addFeatures(feature.olFeature);
this.trigger('addfeature', [feature]);
return feature;
}
};
/**
#MapQuery.Feature
The MapQuery.Feature object. It is constructed with a feature options object
in the layer.`features([options])` function. The Feautre object is refered to
as _feature_ in the documentation.
TODO vmx 20110905: Support other geometry types than GeoJSON
options:
* geometry: A GeoJSON geometry
* properties: Properties for the feature
*/
// Not in the pulic API docs: You can pass in as options:
// * olFeature: This will wrap the olFeature in a MapQuery feature
$.MapQuery.Feature = function(layer, options) {
// The ID is the
this._id = layer.map._createId();
this.layer = layer;
// Feature already exists on the layer, it just needs to be wrapped
// to an MapQuery feature
if (options.olFeature) {
this.olFeature = options.olFeature;
}
else {
// XXX vmx 20110905: Different feature types might make sense:
// (Geo)JSON, KML, WKT
// vmx 2012-04-14: I changed my mind quite some time ago. We should onlu
// support GeoJSON and let the user easily transfrom their format
// (e.g. KML) to GeoJSON, before they add a feature to the layer
var GeoJSON = new OpenLayers.Format.GeoJSON();
var geometry = GeoJSON.parseGeometry(options.geometry);
geometry.transform(
new OpenLayers.Projection(this.layer.map.displaProjection),
new OpenLayers.Projection(this.layer.map.projection));
this.olFeature = new OpenLayers.Feature.Vector(geometry,
options.properties);
}
// Modify the features to be more practical
// e.g. copy properties that should be easily accessed from the
// outside, out of the olLayer and to the feature level
this.properties = $.extend(true, {}, this.olFeature.attributes);
this.geometry = $.parseJSON(
new OpenLayers.Format.GeoJSON().write(this.olFeature.geometry));
return this;
};
$.MapQuery.Feature.prototype = {
/**
###*feature*.`remove()`
_version added 0.2.0_
####**Description**: remove the feature from the layer
>Returns: layer (layer) or false
The `.remove()` method allows us to remove a feature from the layer.
It returns the `layer` object if the feature was removed, or `false` if the
removal was prevented in the preremovefeature event.
// add a feature to a layer
var feature = layer.features({geometry: {type: "Point", coordinates: [5.3, 7.4]}});
// remove the feature again
feature.remove();
*/
remove: function() {
if (this.layer._triggerReturn('preremovefeature', [this])===false) {
return false;
}
this.layer.olLayer.removeFeatures(this.olFeature);
// The `removefeature` event is triggered by an OpenLayes event handler
return this.layer;
},
/**
###*feature*.`select(exclusive)`
_version added 0.2.0_
####**Description**: select a feature
**exclusive** (boolean, default: true) True means that all other features get
deselectd
>Returns: layer (layer)
The `.select()` method allows us to select a feature from the layer.
A `featureselected` will be fired.
// add a feature to a layer
var feature = layer.features({geometry: {type: "Point", coordinates: [5.3, 7.4]}});
// select the feature again
feature.select();
*/
select: function(exclusive) {
if (exclusive===undefined || exclusive===true) {
this.layer.map.selectFeatureControl.unselectAll();
}
this.layer.map.selectFeatureControl.select(this.olFeature);
},
/**
###*feature*.`unselect()`
_version added 0.2.0_
####**Description**: unselect a feature
>Returns: layer (layer)
The `.unselect()` method allows us to unselect a feature from the layer.
A `featureunselected` will be fired.
// add a feature to a layer
var feature = layer.features({geometry: {type: "Point", coordinates: [5.3, 7.4]}});
// select the feature
feature.select();
// unselect the feature again
feature.unselect();
*/
unselect: function() {
this.layer.map.selectFeatureControl.unselect(this.olFeature);
} }
}; };
@ -581,11 +990,11 @@ $.extend($.MapQuery.Layer, {
_version added 0.1_ _version added 0.1_
####**Description**: create a Bing maps layer ####**Description**: create a Bing maps layer
**view** a string ['road','hybrid','satellite'] to define which Bing maps * **view** a string ['road','hybrid','satellite'] to define which Bing maps
layer to use (default road) layer to use (default road)
**key** Bing Maps API key for your application. Get you own at * **key** Bing Maps API key for your application. Get you own at
http://bingmapsportal.com/ http://bingmapsportal.com/
**label** string with the name of the layer * **label** string with the name of the layer
layers:[{ layers:[{
@ -629,9 +1038,9 @@ http://bingmapsportal.com/
_version added 0.1_ _version added 0.1_
####**Description**: create a Google maps layer ####**Description**: create a Google maps layer
**view** a string ['road','hybrid','satellite'] to define which Google maps * **view** a string ['road','hybrid','satellite'] to define which Google maps
layer to use (default road) layer to use (default road)
**label** string with the name of the layer * **label** string with the name of the layer
*Note* you need to include the google maps v3 API in your application by adding *Note* you need to include the google maps v3 API in your application by adding
@ -669,7 +1078,7 @@ layer to use (default road)
_version added 0.1_ _version added 0.1_
####**Description**: create a vector layer ####**Description**: create a vector layer
**label** string with the name of the layer * **label** string with the name of the layer
layers:[{ layers:[{
@ -692,13 +1101,13 @@ _version added 0.1_
_version added 0.1_ _version added 0.1_
####**Description**: create a JSON layer ####**Description**: create a JSON layer
**url** a string pointing to the location of the JSON data * **url** a string pointing to the location of the JSON data
**strategies** a string ['bbox','cluster','filter','fixed','paging','refresh','save'] * **strategies** a string ['bbox','cluster','filter','fixed','paging','refresh','save']
stating which update strategy should be used (default fixed) stating which update strategy should be used (default fixed)
(see also http://dev.openlayers.org/apidocs/files/OpenLayers/Strategy-js.html) (see also http://dev.openlayers.org/apidocs/files/OpenLayers/Strategy-js.html)
**projection** a string with the projection of the JSON data (default EPSG:4326) * **projection** a string with the projection of the JSON data (default EPSG:4326)
**styleMap** {object} the style to be used to render the JSON data * **styleMap** {object} the style to be used to render the JSON data
**label** string with the name of the layer * **label** string with the name of the layer
layers:[{ layers:[{
@ -710,8 +1119,8 @@ stating which update strategy should be used (default fixed)
*/ */
json: function(options) { json: function(options) {
var o = $.extend(true, {}, $.fn.mapQuery.defaults.layer.all, var o = $.extend(true, {}, $.fn.mapQuery.defaults.layer.all,
$.fn.mapQuery.defaults.layer.vector, $.fn.mapQuery.defaults.layer.vector,
options); options);
this.isVector = true; this.isVector = true;
var strategies = []; var strategies = [];
for (var i in o.strategies) { for (var i in o.strategies) {
@ -742,26 +1151,31 @@ stating which update strategy should be used (default fixed)
} }
} }
var protocol; var protocol;
// only use JSONP if we use http(s)
if (o.url.match(/^https?:\/\//)!==null &&
!$.MapQuery.util.sameOrigin(o.url)) {
protocol = 'Script';
}
else {
protocol = 'HTTP';
}
var params = { var params = {
protocol: new OpenLayers.Protocol[protocol]({
url: o.url,
format: new OpenLayers.Format.GeoJSON()
}),
strategies: strategies, strategies: strategies,
projection: o.projection || 'EPSG:4326', projection: o.projection || 'EPSG:4326',
styleMap: o.styleMap styleMap: o.styleMap
}; };
if (o.url) {
// only use JSONP if we use http(s)
if (o.url.match(/^https?:\/\//)!==null &&
!$.MapQuery.util.sameOrigin(o.url)) {
protocol = 'Script';
}
else {
protocol = 'HTTP';
}
params.protocol = new OpenLayers.Protocol[protocol]({
url: o.url,
format: new OpenLayers.Format.GeoJSON()
});
};
var layer = new OpenLayers.Layer.Vector(o.label, params);
return { return {
layer: new OpenLayers.Layer.Vector(o.label, params), layer: layer,
options: o options: o
}; };
}, },
@ -771,10 +1185,10 @@ _version added 0.1_
####**Description**: create an OpenStreetMap layer ####**Description**: create an OpenStreetMap layer
**label** string with the name of the layer * **label** string with the name of the layer
**url** A single URL (string) or an array of URLs to OSM-like server like * **url** A single URL (string) or an array of URLs to OSM-like server like
Cloudmade Cloudmade
**attribution** A string to put some attribution on the map * **attribution** A string to put some attribution on the map
layers:[{ layers:[{
type: 'osm', type: 'osm',
@ -801,15 +1215,51 @@ Cloudmade
}; };
}, },
/** /**
###*layer* `{type:tms}`
_version added 0.1_
####**Description**: create an OpenStreetMap layer
* **label** string with the name of the layer
* **url** A single URL (string) or an array of URLs to the TMS end point
* **layer** The identifier for the <TileMap> as advertised by the service.
For example, if the service advertises a <TileMap> with href=http://tms.osgeo.org/1.0.0/vmap0”,
the layer property would be set to vmap0.
* **format** The image format (default png)
layers:[{
type: 'tms',
url: 'http://tilecache.osgeo.org/wms-c/Basic.py/',
layer: 'basic'
}]
*/
tms: function(options) {
var o = $.extend(true, {}, $.fn.mapQuery.defaults.layer.all,
$.fn.mapQuery.defaults.layer.tms,
options);
var label = options.label || undefined;
var url = options.url || undefined;
var params = {
layername: o.layer,
type: o.format
};
return {
layer: new OpenLayers.Layer.TMS(label, url, params),
options: o
};
},
/**
###*layer* `{type:wms}` ###*layer* `{type:wms}`
_version added 0.1_ _version added 0.1_
####**Description**: create a WMS layer ####**Description**: create a WMS layer
**url** a string pointing to the location of the WMS service * **url** a string pointing to the location of the WMS service
**layers** a string with the name of the WMS layer(s) * **layers** a string with the name of the WMS layer(s)
**format** a string with format of the WMS image (default image/jpeg) * **format** a string with format of the WMS image (default image/jpeg)
**transparent** a boolean for requesting images with transparency * **transparent** a boolean for requesting images with transparency
**label** string with the name of the layer * **label** string with the name of the layer
* **wms_parameters** an hashtable of extra GetMap query string parameters and parameter values
layers:[{ layers:[{
@ -828,6 +1278,9 @@ _version added 0.1_
transparent: o.transparent, transparent: o.transparent,
format: o.format format: o.format
}; };
if(typeof o.wms_parameters != "undefined"){
params = $.extend(params, o.wms_parameters);
}
return { return {
layer: new OpenLayers.Layer.WMS(o.label, o.url, params, o), layer: new OpenLayers.Layer.WMS(o.label, o.url, params, o),
options: o options: o
@ -839,11 +1292,11 @@ _version added 0.1_
_version added 0.1_ _version added 0.1_
####**Description**: create a WMTS (tiling) layer ####**Description**: create a WMTS (tiling) layer
**url** a string pointing to the location of the WMTS service * **url** a string pointing to the location of the WMTS service
**layer** a string with the name of the WMTS layer * **layer** a string with the name of the WMTS layer
**matrixSet** a string with one of the advertised matrix set identifiers * **matrixSet** a string with one of the advertised matrix set identifiers
**style** a string with one of the advertised layer styles * **style** a string with one of the advertised layer styles
**label** string with the name of the layer * **label** string with the name of the layer
layers:[{ layers:[{
@ -953,13 +1406,17 @@ $.fn.mapQuery.defaults = {
transitionEffect: 'resize', transitionEffect: 'resize',
sphericalMercator: true sphericalMercator: true
}, },
tms: {
transitionEffect: 'resize',
format: 'png'
},
raster: { raster: {
// options for raster layers // options for raster layers
transparent: true transparent: true
}, },
vector: { vector: {
// options for vector layers // options for vector layers
strategies: ['fixed'] strategies: ['bbox']
}, },
wmts: { wmts: {
format: 'image/jpeg', format: 'image/jpeg',

View file

@ -0,0 +1,87 @@
/* Copyright (c) 2011 by MapQuery Contributors (see AUTHORS for
* full list of contributors). Published under the MIT license.
* See https://github.com/mapquery/mapquery/blob/master/LICENSE for the
* full text of the license. */
/**
#jquery.mapquery.legend.js
A plugin on mapquery.core to add a legend to a layer. It will check if the layer
is within a valid extent and zoom range. And if not will return an error message.
*/
(function($, MQ) {
$.extend( $.fn.mapQuery.defaults.layer.all, {
legend: {
url: '',
msg: ''
}
});
//possible error messages to display in the legend
LEGEND_ERRORS= ['E_ZOOMOUT', 'E_ZOOMIN', 'E_OUTSIDEBOX'];
$.extend(MQ.Layer.prototype, {
/**
###**layer**.`legend([options])`
_version added 0.1_
####**Description**: get/set the legend of a layer
**options** url:url the url to the legend image
>Returns: {url:url, msg:'E\_ZOOMOUT' | 'E\_ZOOMIN' | 'E\_OUTSIDEBOX' | ''}
The `.legend()` function allows us to attach a legend image to a layer. It will
also check if the layer is not visible due to wrong extent or zoom level.
It will return an error message which can be used to notify the user.
var legend = layer.legend(); //get the current legend
//set the legend url to legendimage.png
layer.legend({url:'legendimage.png'})
*/
//get/set the legend object
legend: function(options) {
//get the legend object
var center = this.map.center();
if (arguments.length===0) {
this._checkZoom(center);
//if zoom = ok, check box
if(this.options.legend.msg==''){
this._checkBox(center);
}
return this.options.legend;
}
//set the legend url
if (options.url!==undefined) {
this.options.legend.url = options.url;
return this.options.legend;
}
},
//Check if the layer has a maximum box set and if the current box
//is outside these settings, set the legend.msg accordingly
_checkBox: function(center){
var maxExtent = this.options.maxExtent;
if(maxExtent!==undefined) {
var mapBounds = new OpenLayers.Bounds(
center.box[0],center.box[1],center.box[2],center.box[3]);
var layerBounds = new OpenLayers.Bounds(
maxExtent[0],maxExtent[1],maxExtent[2],maxExtent[3]);
var inside = layerBounds.containsBounds(mapBounds, true);
this.options.legend.msg = inside?'':LEGEND_ERRORS[2];
}
},
//Check if the layer has a minimum or maximum zoom set and if the
//current zoom is outside these settings, set the legend.msg accordingly
_checkZoom: function(center){
var zoom = center.zoom;
var maxZoom = this.options.maxZoom;
var minZoom = this.options.minZoom;
this.options.legend.msg=(
maxZoom!==undefined&&maxZoom<zoom)? LEGEND_ERRORS[0]:'';
this.options.legend.msg=(
minZoom!==undefined&&minZoom>zoom)? LEGEND_ERRORS[1]:'';
}
});
})(jQuery, $.MapQuery);

View file

@ -0,0 +1,310 @@
/* Copyright (c) 2011 by MapQuery Contributors (see AUTHORS for
* full list of contributors). Published under the MIT license.
* See https://github.com/mapquery/mapquery/blob/master/LICENSE for the
* full text of the license. */
/**
#jquery.mapquery.mqLayerManager.js
The file containing the mqLayerManager Widget
### *$('selector')*.`mqLayerManager([options])`
_version added 0.1_
####**Description**: create a widget to manage layers
+ **options**:
- **map**: the mapquery instance
- **title**: Title that will be displayed at the top of the
layer manager (default: Layer Manager)
>Returns: widget
>Requires: jquery.mapquery.legend.js
The mqLayerManager allows us to control the order, opacity and visibility
of layers. We can also remove layers. It also shows the legend of the layer if
available and the error messages provided by the legend plugin. It listens to
layerchange event for order, transparancy and opacity changes. It listens to
addlayer and removelayer events to keep track which layers are on the map.
$('#layermanager').mqLayerManager({map:'#map'});
*/
(function($) {
$.template('mqLayerManager',
'<div class="mq-layermanager ui-widget-content ">'+
'</div>');
$.template('mqLayerManagerElement',
'<div class="mq-layermanager-element ui-widget-content ui-corner-all" id="mq-layermanager-element-${id}">'+
'<div class="mq-layermanager-element-header ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix">'+
'<span class="mq-layermanager-label ui-dialog-title">${label}</span>'+
'<a class="ui-dialog-titlebar-close ui-corner-all" href="#" role="button">'+
'<span class="ui-icon ui-icon-closethick">close</span></a></div>'+
'<div class="mq-layermanager-element-content">'+
'<div class="mq-layermanager-element-visibility">'+
'<input type="checkbox" class="mq-layermanager-element-vischeckbox" id="${id}-visibility" {{if visible}}checked="${visible}"{{/if}} />'+
'<div class="mq-layermanager-element-slider-container">'+
'<div class="mq-layermanager-element-slider"></div></div>'+
'</div>'+
'<div class="mq-layermanager-element-legend">'+
'{{if imgUrl}}'+
'<img src="${imgUrl}" style="opacity:${opacity}"/>'+
'{{/if}}'+
'{{if errMsg}}'+
'${errMsg}'+
'{{/if}}'+
'</div>'+
'</div>'+
'</div>');
$.widget("mapQuery.mqLayerManager", {
options: {
// The MapQuery instance
map: undefined,
// Title that will be displayed at the top of the popup
title: "Layer Manager"
},
_create: function() {
var map;
var zoom;
var numzoomlevels;
var self = this;
var element = this.element;
//get the mapquery object
map = $(this.options.map).data('mapQuery');
this.element.addClass('ui-widget ui-helper-clearfix ' +
'ui-corner-all');
var lmElement = $.tmpl('mqLayerManager').appendTo(element);
element.find('.ui-icon-closethick').button();
lmElement.sortable({
axis:'y',
handle: '.mq-layermanager-element-header',
update: function(event, ui) {
var layerNodes = ui.item.siblings().andSelf();
var num = layerNodes.length-1;
layerNodes.each(function(i) {
var layer = $(this).data('layer');
var pos = num-i;
self._position(layer, pos);
});
}
});
//these layers are already added to the map as such won't trigger
//and event, we call the draw function directly
$.each(map.layers().reverse(), function(){
self._layerAdded(lmElement, this);
});
element.delegate('.mq-layermanager-element-vischeckbox',
'change',function() {
var checkbox = $(this);
var element = checkbox.parents('.mq-layermanager-element');
var layer = element.data('layer');
var self = element.data('self');
self._visible(layer,checkbox.is(':checked'));
});
element.delegate('.ui-icon-closethick', 'click', function() {
var control = $(this).parents('.mq-layermanager-element');
self._remove(control.data('layer'));
});
//binding events
map.bind("addlayer",
{widget:self,control:lmElement},
self._onLayerAdd);
map.bind("removelayer",
{widget:self,control:lmElement},
self._onLayerRemove);
map.bind("changelayer",
{widget:self,map:map,control:lmElement},
self._onLayerChange);
map.bind("moveend",
{widget:self,map:map,control:lmElement},
self._onMoveEnd);
},
_destroy: function() {
this.element.removeClass(' ui-widget ui-helper-clearfix ' +
'ui-corner-all')
.empty();
},
//functions that actually change things on the map
//call these from within the widget to do stuff on the map
//their actions will trigger events on the map and in return
//will trigger the _layer* functions
_add: function(map,layer) {
map.layers(layer);
},
_remove: function(layer) {
layer.remove();
},
_position: function(layer, pos) {
layer.position(pos);
},
_visible: function(layer, vis) {
layer.visible(vis);
},
_opacity: function(layer,opac) {
layer.opacity(opac);
},
//functions that change the widget
_layerAdded: function(widget, layer) {
var self = this;
var error = layer.legend().msg;
var url;
switch(error){
case '':
url =layer.legend().url;
if(url==''){error='No legend for this layer';}
break;
case 'E_ZOOMOUT':
error = 'Please zoom out to see this layer';
break;
case 'E_ZOOMIN':
error = 'Please zoom in to see this layer';
break;
case 'E_OUTSIDEBOX':
error = 'This layer is outside the current view';
break;
}
var layerElement = $.tmpl('mqLayerManagerElement',{
id: layer.id,
label: layer.label,
position: layer.position(),
visible: layer.visible(),
imgUrl: url,
opacity: layer.visible()?layer.opacity():0,
errMsg: error
})
// save layer layer in the DOM, so we can easily
// hide/show/delete the layer with live events
.data('layer', layer)
.data('self',self)
.prependTo(widget);
$(".mq-layermanager-element-slider", layerElement).slider({
max: 100,
step: 1,
value: layer.visible()?layer.opacity()*100:0,
slide: function(event, ui) {
var layer = layerElement.data('layer');
var self = layerElement.data('self');
self._opacity(layer,ui.value/100);
},
//using the slide event to check for the checkbox often gives errors.
change: function(event, ui) {
var layer = layerElement.data('layer');
var self = layerElement.data('self');
if(ui.value>=0.01) {
if(!layer.visible()){layer.visible(true);}
}
if(ui.value<0.01) {
if(layer.visible()){layer.visible(false);}
}
}
});
},
_layerRemoved: function(widget, id) {
var control = $("#mq-layermanager-element-"+id);
control.fadeOut(function() {
$(this).remove();
});
},
_layerPosition: function(widget, layer) {
var layerNodes = widget.element.find('.mq-layermanager-element');
var num = layerNodes.length-1;
var tmpNodes = [];
tmpNodes.length = layerNodes.length;
layerNodes.each(function() {
var layer = $(this).data('layer');
var pos = num-layer.position();
tmpNodes[pos]= this;
});
for (i=0;i<tmpNodes.length;i++) {
layerNodes.parent().append(tmpNodes[i]);
}
},
_layerVisible: function(widget, layer) {
var layerElement =
widget.element.find('#mq-layermanager-element-'+layer.id);
var checkbox =
layerElement.find('.mq-layermanager-element-vischeckbox');
checkbox[0].checked = layer.visible();
//update the opacity slider as well
var slider = layerElement.find('.mq-layermanager-element-slider');
var value = layer.visible()?layer.opacity()*100: 0;
slider.slider('value',value);
//update legend image
layerElement.find('.mq-layermanager-element-legend img').css(
{visibility:layer.visible()?true:'hidden'});
},
_layerOpacity: function(widget, layer) {
var layerElement = widget.element.find(
'#mq-layermanager-element-'+layer.id);
var slider = layerElement.find(
'.mq-layermanager-element-slider');
slider.slider('value',layer.opacity()*100);
//update legend image
layerElement.find(
'.mq-layermanager-element-legend img').css(
{opacity:layer.opacity()});
},
_moveEnd: function (widget,lmElement,map) {
lmElement.empty();
$.each(map.layers().reverse(), function(){
widget._layerAdded(lmElement, this);
});
},
//functions bind to the map events
_onLayerAdd: function(evt, layer) {
evt.data.widget._layerAdded(evt.data.control,layer);
},
_onLayerRemove: function(evt, layer) {
evt.data.widget._layerRemoved(evt.data.control,layer.id);
},
_onLayerChange: function(evt, layer, property) {
switch(property) {
case 'opacity':
evt.data.widget._layerOpacity(evt.data.widget,layer);
break;
case 'position':
evt.data.widget._layerPosition(evt.data.widget,layer);
break;
case 'visibility':
evt.data.widget._layerVisible(evt.data.widget,layer);
break;
}
},
_onMoveEnd: function(evt) {
evt.data.widget._moveEnd(evt.data.widget,evt.data.control,evt.data.map);
}
});
})(jQuery);

View file

@ -44,8 +44,8 @@ $.widget("mapQuery.mqMousePosition", {
// The number of decimals for the coordinates // The number of decimals for the coordinates
// default: 2 // default: 2
// TODO: JCB20110630 use dynamic precision based on the pixel // TODO: JCB20110630 use dynamic precision based on the pixel
// resolution, no need to configure precision // resolution, no need to configure precision
precision: 2, precision: 2,
// The label of the x-value // The label of the x-value
@ -57,51 +57,36 @@ $.widget("mapQuery.mqMousePosition", {
}, },
_create: function() { _create: function() {
var map;
var self = this;
var element = this.element;
var mousepos;
//get the mapquery object //get the mapquery object
map = $(this.options.map).data('mapQuery'); this.map = $(this.options.map).data('mapQuery');
map.bind("mousemove", this.map.element.bind('mousemove', {widget: this}, this._onMousemove);
{widget:self,map:map}, $.tmpl('mqMousePosition', {}).appendTo(this.element);
self._onMouseMove);
$.tmpl('mqMousePosition',{
mouseposition:mousepos
}).appendTo(element);
}, },
_destroy: function() { _destroy: function() {
this.element.removeClass(' ui-widget ui-helper-clearfix ' + this.element.removeClass('ui-widget ui-helper-clearfix ' +
'ui-corner-all') 'ui-corner-all')
.empty(); .empty();
}, },
_mouseMoved: function(data, element, map) { _onMousemove: function(evt) {
var x = data.layerX; var self = evt.data.widget;
var y = data.layerY; var x = evt.pageX;
var mapProjection = map.options.projection; var y = evt.pageY;
var displayProjection = map.options.projection; var mapProjection = new OpenLayers.Projection(self.map.projection);
var displayProjection = new OpenLayers.Projection(
self.map.displayProjection);
var pos = self.map.olMap.getLonLatFromLayerPx(
new OpenLayers.Pixel(x, y));
//if the coordinates should be displayed in something else, //if the coordinates should be displayed in something else,
//set them via the map displayProjection option //set them via the map displayProjection option
var pos = map.olMap.getLonLatFromLayerPx(new OpenLayers.Pixel(x,y)); if(!mapProjection.equals(self.map.displayProjection)) {
if(map.options.displayProjection) { pos = pos.transform(mapProjection, displayProjection);
displayProjection = map.options.displayProjection;
pos=pos.transform(
new OpenLayers.Projection(mapProjection),
new OpenLayers.Projection(displayProjection));
} }
$("#id_diabook_ELPosX", element).val( $("#id_diabook_ELPosX", document.element).val(
this.options.x+pos.lon.toFixed(this.options.precision)); self.options.x + pos.lon.toFixed(self.options.precision));
$("#id_diabook_ELPosY", element).val( $("#id_diabook_ELPosY", document.element).val(
this.options.y+pos.lat.toFixed(this.options.precision)); self.options.y + pos.lat.toFixed(self.options.precision));
},
_onMouseMove: function(evt, data) {
evt.data.widget._mouseMoved(data,evt.data.control,evt.data.map);
} }
}); });
})(jQuery); })(jQuery);

View file

@ -0,0 +1,40 @@
<h3>$header</h3>
<div id="prvmail-wrapper" >
<form id="prvmail-form" action="message" method="post" >
$parent
<div id="prvmail-to-label">$to</div>
{{ if $showinputs }}
<input type="text" id="recip" style="background: none repeat scroll 0 0 white;border: 1px solid #CCC;border-radius: 5px 5px 5px 5px;height: 20px;margin: 0 0 5px;
vertical-align: middle;" name="messageto" value="$prefill" maxlength="255" size="64" tabindex="10" />
<input type="hidden" id="recip-complete" name="messageto" value="$preid">
{{ else }}
$select
{{ endif }}
<div id="prvmail-subject-label">$subject</div>
<input type="text" size="64" maxlength="255" id="prvmail-subject" name="subject" value="$subjtxt" $readonly tabindex="11" />
<div id="prvmail-message-label">$yourmessage</div>
<textarea rows="8" cols="72" class="prvmail-text" id="prvmail-text" name="body" tabindex="12">$text</textarea>
<div id="prvmail-submit-wrapper" >
<input type="submit" id="prvmail-submit" name="submit" value="Submit" tabindex="13" />
<div id="prvmail-upload-wrapper" >
<div id="prvmail-upload" class="icon border camera" title="$upload" ></div>
</div>
<div id="prvmail-link-wrapper" >
<div id="prvmail-link" class="icon border link" title="$insert" onclick="jotGetLink();" ></div>
</div>
<div id="prvmail-rotator-wrapper" >
<img id="prvmail-rotator" src="images/rotator.gif" alt="$wait" title="$wait" style="display: none;" />
</div>
</div>
<div id="prvmail-end"></div>
</form>
</div>

View file

@ -170,7 +170,7 @@ if ($color=="dark") $color_path = "/diabook-dark/";
$a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s"></script>', $cookieJS); $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s"></script>', $cookieJS);
//load jquery.ae.image.resize.js //load jquery.ae.image.resize.js
$imageresizeJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.ae.image.resize.js"; $imageresizeJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.ae.image.resize.min.js";
$a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $imageresizeJS); $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $imageresizeJS);
//load jquery.ui.js //load jquery.ui.js
@ -198,6 +198,10 @@ if ($color=="dark") $color_path = "/diabook-dark/";
$a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $mqmouseposJS); $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $mqmouseposJS);
$mousewheelJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.mousewheel.js"; $mousewheelJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.mousewheel.js";
$a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $mousewheelJS); $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $mousewheelJS);
$mqlegendJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.mapquery.legend.js";
$a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $mqlegendJS);
$mqlayermanagerJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.mapquery.mqLayerManager.js";
$a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $mqlayermanagerJS);
} }
@ -248,9 +252,12 @@ if ($color=="dark") $color_path = "/diabook-dark/";
}); });
function open_mapcontrol() { function open_mapcontrol() {
$("div#mapcontrol").attr("style","display: block;width:900px;height:600px;"); $("div#mapcontrol").attr("style","display: block;width:900px;height:900px;");
$("#map2").mapQuery({layers:[{type:"osm"}], $("#map2").mapQuery({
center:({zoom:'.$ELZoom.',position:['.$ELPosX.','.$ELPosY.']})}); layers:[{type:"osm", label:"OpenStreetMap" },
{type:"wms", label:"Population density 2010", legend:{url:"http://mapserver.edugis.nl/cgi-bin/mapserv?map=maps/edugis/cache/population.map&version=1.1.1&service=WMS&request=GetLegendGraphic&layer=Bevolkingsdichtheid_2010&format=image/png"}, url:"http://t1.edugis.nl/tiles/tilecache.py?map=maps/edugis/cache/population.map",
layers:"Bevolkingsdichtheid_2010" }],
center:({zoom:'.$ELZoom.',position:['.$ELPosX.','.$ELPosY.']})});
$("#mouseposition").mqMousePosition({ $("#mouseposition").mqMousePosition({
map: "#map2", map: "#map2",
@ -259,13 +266,16 @@ if ($color=="dark") $color_path = "/diabook-dark/";
precision:4 precision:4
}); });
$("#layermanager").mqLayerManager({map:"#map2"});
map = $("#map2").mapQuery().data("mapQuery"); map = $("#map2").mapQuery().data("mapQuery");
textarea = document.getElementById("id_diabook_ELZoom"); textarea = document.getElementById("id_diabook_ELZoom");
textarea.value = "'.$ELZoom.'";
$("#map2").bind("mousewheel", function(event, delta) { $("#map2").bind("mousewheel", function(event, delta) {
if (delta > 0 || delta < 0){ if (delta > 0 && textarea.value < 18){
textarea.value = map.center().zoom; } textarea.value = textarea.value - delta*-1; }
if (delta < 0 && textarea.value > "0"){
textarea.value = textarea.value - delta*-1; }
}); });
}; };
</script>'; </script>';
@ -413,6 +423,68 @@ if ($color=="dark") $color_path = "/diabook-dark/";
function diabook_community_info() { function diabook_community_info() {
$a = get_app(); $a = get_app();
$close_pages = false;
$site_close_pages = get_config("diabook", "close_pages" );
if (local_user()) {$close_pages = get_pconfig(local_user(), "diabook", "close_pages");}
if ($close_pages===false) $close_pages=$site_close_pages;
if ($close_pages===false) $close_pages="1";
$close_profiles = false;
$site_close_profiles = get_config("diabook", "close_profiles" );
if (local_user()) {$close_profiles = get_pconfig(local_user(), "diabook", "close_profiles");}
if ($close_profiles===false) $close_profiles=$site_close_profiles;
if ($close_profiles===false) $close_profiles="0";
$close_helpers = false;
$site_close_helpers = get_config("diabook", "close_helpers" );
if (local_user()) {$close_helpers = get_pconfig(local_user(), "diabook", "close_helpers");}
if ($close_helpers===false) $close_helpers=$site_close_helpers;
if ($close_helpers===false) $close_helpers="0";
$close_services = false;
$site_close_services = get_config("diabook", "close_services" );
if (local_user()) {$close_services = get_pconfig(local_user(), "diabook", "close_services");}
if ($close_services===false) $close_services=$site_close_services;
if ($close_services===false) $close_services="0";
$close_friends = false;
$site_close_friends = get_config("diabook", "close_friends" );
if (local_user()) {$close_friends = get_pconfig(local_user(), "diabook", "close_friends");}
if ($close_friends===false) $close_friends=$site_close_friends;
if ($close_friends===false) $close_friends="0";
$close_lastusers = false;
$site_close_lastusers = get_config("diabook", "close_lastusers" );
if (local_user()) {$close_lastusers = get_pconfig(local_user(), "diabook", "close_lastusers");}
if ($close_lastusers===false) $close_lastusers=$site_close_lastusers;
if ($close_lastusers===false) $close_lastusers="0";
$close_lastphotos = false;
$site_close_lastphotos = get_config("diabook", "close_lastphotos" );
if (local_user()) {$close_lastphotos = get_pconfig(local_user(), "diabook", "close_lastphotos");}
if ($close_lastphotos===false) $close_lastphotos=$site_close_lastphotos;
if ($close_lastphotos===false) $close_lastphotos="0";
$close_lastlikes = false;
$site_close_lastlikes = get_config("diabook", "close_lastlikes" );
if (local_user()) {$close_lastlikes = get_pconfig(local_user(), "diabook", "close_lastlikes");}
if ($close_lastlikes===false) $close_lastlikes=$site_close_lastlikes;
if ($close_lastlikes===false) $close_lastlikes="0";
$close_twitter = false;
$site_close_twitter = get_config("diabook", "close_twitter" );
if (local_user()) {$close_twitter = get_pconfig(local_user(), "diabook", "close_twitter");}
if ($close_twitter===false) $close_twitter=$site_close_twitter;
if ($close_twitter===false) $close_twitter="1";
$close_mapquery = false;
$site_close_mapquery = get_config("diabook", "close_mapquery" );
if (local_user()) {$close_mapquery = get_pconfig(local_user(), "diabook", "close_mapquery");}
if ($close_mapquery===false) $close_mapquery=$site_close_mapquery;
if ($close_mapquery===false) $close_mapquery="1";
// comunity_profiles // comunity_profiles
if($close_profiles != "1") { if($close_profiles != "1") {
$aside['$comunity_profiles_title'] = t('Community Profiles'); $aside['$comunity_profiles_title'] = t('Community Profiles');
@ -509,7 +581,7 @@ if ($color=="dark") $color_path = "/diabook-dark/";
}} }}
// last 12 photos // last 12 photos
if($close_photos != "1") { if($close_lastphotos != "1") {
$aside['$photos_title'] = t('Last photos'); $aside['$photos_title'] = t('Last photos');
$aside['$photos_items'] = array(); $aside['$photos_items'] = array();
$r = q("SELECT `photo`.`id`, `photo`.`resource-id`, `photo`.`scale`, `photo`.`desc`, `user`.`nickname`, `user`.`username` FROM $r = q("SELECT `photo`.`id`, `photo`.`resource-id`, `photo`.`scale`, `photo`.`desc`, `user`.`nickname`, `user`.`username` FROM
@ -608,9 +680,9 @@ if ($color=="dark") $color_path = "/diabook-dark/";
$ELZoom = get_pconfig(local_user(), 'diabook', 'ELZoom' ); $ELZoom = get_pconfig(local_user(), 'diabook', 'ELZoom' );
$ELPosX = get_pconfig(local_user(), 'diabook', 'ELPosX' ); $ELPosX = get_pconfig(local_user(), 'diabook', 'ELPosX' );
$ELPosY = get_pconfig(local_user(), 'diabook', 'ELPosY' ); $ELPosY = get_pconfig(local_user(), 'diabook', 'ELPosY' );
$aside['$ELZoom'] = array('diabook_ELZoom', t('Set zoomfactor for Earth Layer'), $ELZoom, '', $ELZoom); $aside['$ELZoom'] = array('diabook_ELZoom', t('Set zoomfactor for Earth Layers'), $ELZoom, '', $ELZoom);
$aside['$ELPosX'] = array('diabook_ELPosX', t('Set longitude (X) for Earth Layer'), $ELPosX, '', $ELPosX); $aside['$ELPosX'] = array('diabook_ELPosX', t('Set longitude (X) for Earth Layers'), $ELPosX, '', $ELPosX);
$aside['$ELPosY'] = array('diabook_ELPosY', t('Set latitude (Y) for Earth Layer'), $ELPosY, '', $ELPosY); $aside['$ELPosY'] = array('diabook_ELPosY', t('Set latitude (Y) for Earth Layers'), $ELPosY, '', $ELPosY);
if (isset($_POST['diabook-settings-map-sub']) && $_POST['diabook-settings-map-sub']!=''){ if (isset($_POST['diabook-settings-map-sub']) && $_POST['diabook-settings-map-sub']!=''){
set_pconfig(local_user(), 'diabook', 'ELZoom', $_POST['diabook_ELZoom']); set_pconfig(local_user(), 'diabook', 'ELZoom', $_POST['diabook_ELZoom']);
set_pconfig(local_user(), 'diabook', 'ELPosX', $_POST['diabook_ELPosX']); set_pconfig(local_user(), 'diabook', 'ELPosX', $_POST['diabook_ELPosX']);
@ -670,7 +742,7 @@ if ($color=="dark") $color_path = "/diabook-dark/";
$close_lastusersC = array('1'=>t("don't show"), '0'=>t("show"),); $close_lastusersC = array('1'=>t("don't show"), '0'=>t("show"),);
$close_lastphotosC = array('1'=>t("don't show"), '0'=>t("show"),); $close_lastphotosC = array('1'=>t("don't show"), '0'=>t("show"),);
$close_lastlikesC = array('1'=>t("don't show"), '0'=>t("show"),); $close_lastlikesC = array('1'=>t("don't show"), '0'=>t("show"),);
$boxsettings['title'] = Array("", t('Show/hide boxes at right-hand coloumn:'), "", ""); $boxsettings['title'] = Array("", t('Show/hide boxes at right-hand column:'), "", "");
$aside['$boxsettings'] = $boxsettings; $aside['$boxsettings'] = $boxsettings;
$aside['$close_pages'] = array('diabook_close_pages', t('Community Pages'), $close_pages, '', $close_pagesC); $aside['$close_pages'] = array('diabook_close_pages', t('Community Pages'), $close_pages, '', $close_pagesC);
$aside['$close_mapquery'] = array('diabook_close_mapquery', t('Earth Layers'), $close_mapquery, '', $close_mapqueryC); $aside['$close_mapquery'] = array('diabook_close_mapquery', t('Earth Layers'), $close_mapquery, '', $close_mapqueryC);

View file

@ -0,0 +1,61 @@
<div class="comment-wwedit-wrapper" id="comment-edit-wrapper-$id" style="display: block;">
<form class="comment-edit-form" id="comment-edit-form-$id" action="item" method="post" onsubmit="post_comment($id); return false;">
<input type="hidden" name="type" value="$type" />
<input type="hidden" name="profile_uid" value="$profile_uid" />
<input type="hidden" name="parent" value="$parent" />
<input type="hidden" name="return" value="$return_path" />
<input type="hidden" name="jsreload" value="$jsreload" />
<input type="hidden" name="preview" id="comment-preview-inp-$id" value="0" />
<div class="comment-edit-photo" id="comment-edit-photo-$id" >
<a class="comment-edit-photo-link" href="$mylink" title="$mytitle"><img class="my-comment-photo" src="$myphoto" alt="$mytitle" title="$mytitle" /></a>
</div>
<div class="comment-edit-photo-end"></div>
<div id="mod-cmnt-wrap-$id" class="mod-cmnt-wrap" style="display:none">
<div id="mod-cmnt-name-lbl-$id" class="mod-cmnt-name-lbl">$lbl_modname</div>
<input type="text" id="mod-cmnt-name-$id" class="mod-cmnt-name" name="mod-cmnt-name" value="$modname" />
<div id="mod-cmnt-email-lbl-$id" class="mod-cmnt-email-lbl">$lbl_modemail</div>
<input type="text" id="mod-cmnt-email-$id" class="mod-cmnt-email" name="mod-cmnt-email" value="$modemail" />
<div id="mod-cmnt-url-lbl-$id" class="mod-cmnt-url-lbl">$lbl_modurl</div>
<input type="text" id="mod-cmnt-url-$id" class="mod-cmnt-url" name="mod-cmnt-url" value="$modurl" />
</div>
<ul class="comment-edit-bb-$id">
<li><a class="editicon boldbb shadow"
style="cursor: pointer;" title="$edbold"
onclick="insertFormatting('$comment','b', $id);"></a></li>
<li><a class="editicon italicbb shadow"
style="cursor: pointer;" title="$editalic"
onclick="insertFormatting('$comment','i', $id);"></a></li>
<li><a class="editicon underlinebb shadow"
style="cursor: pointer;" title="$eduline"
onclick="insertFormatting('$comment','u', $id);"></a></li>
<li><a class="editicon quotebb shadow"
style="cursor: pointer;" title="$edquote"
onclick="insertFormatting('$comment','quote', $id);"></a></li>
<li><a class="editicon codebb shadow"
style="cursor: pointer;" title="$edcode"
onclick="insertFormatting('$comment','code', $id);"></a></li>
<li><a class="editicon imagebb shadow"
style="cursor: pointer;" title="$edimg"
onclick="insertFormatting('$comment','img', $id);"></a></li>
<li><a class="editicon urlbb shadow"
style="cursor: pointer;" title="$edurl"
onclick="insertFormatting('$comment','url', $id);"></a></li>
<li><a class="editicon videobb shadow"
style="cursor: pointer;" title="$edvideo"
onclick="insertFormatting('$comment','video', $id);"></a></li>
</ul>
<div class="comment-edit-bb-end"></div>
<textarea id="comment-edit-text-$id" class="comment-edit-text-empty" name="body" onFocus="commentOpen(this,$id);cmtBbOpen($id);" onBlur="commentClose(this,$id);" >$comment</textarea>
<div class="comment-edit-text-end"></div>
<div class="comment-edit-submit-wrapper" id="comment-edit-submit-wrapper-$id" style="display: none;" >
<input type="submit" onclick="post_comment($id); return false;" id="comment-edit-submit-$id" class="comment-edit-submit" name="submit" value="$submit" />
<span onclick="preview_comment($id);" id="comment-edit-preview-link-$id" class="fakelink">$preview</span>
<div id="comment-edit-preview-$id" class="comment-edit-preview" style="display:none;"></div>
</div>
<div class="comment-edit-end"></div>
</form>
</div>

View file

@ -8,8 +8,12 @@ $parent
<div id="prvmail-to-label">$to</div> <div id="prvmail-to-label">$to</div>
{{ if $showinputs }}
<input type="text" id="recip" name="messageto" value="$prefill" maxlength="255" size="64" tabindex="10" /> <input type="text" id="recip" name="messageto" value="$prefill" maxlength="255" size="64" tabindex="10" />
<input type="hidden" id="recip-complete" name="messageto" value="$preid"> <input type="hidden" id="recip-complete" name="messageto" value="$preid">
{{ else }}
$select
{{ endif }}
<div id="prvmail-subject-label">$subject</div> <div id="prvmail-subject-label">$subject</div>
<input type="text" size="64" maxlength="255" id="prvmail-subject" name="subject" value="$subjtxt" $readonly tabindex="11" /> <input type="text" size="64" maxlength="255" id="prvmail-subject" name="subject" value="$subjtxt" $readonly tabindex="11" />