From ccc825ccbc58890b1619852a34b60bacf71b185d Mon Sep 17 00:00:00 2001 From: tommy tomson Date: Fri, 11 May 2012 02:39:54 +0200 Subject: [PATCH 01/13] diabook-theme: small fix --- view/theme/diabook/config.php | 6 +++--- view/theme/diabook/theme.php | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/view/theme/diabook/config.php b/view/theme/diabook/config.php index 2a418909b0..cc7da1b000 100644 --- a/view/theme/diabook/config.php +++ b/view/theme/diabook/config.php @@ -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), '$TSearchTerm' => array('diabook_TSearchTerm', t('Set twitter search term'), $TSearchTerm, '', $TSearchTerm), '$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), - '$ELPosY' => array('diabook_ELPosY', t('Set latitude (Y) for Earth Layer'), $ELPosY, '', $ELPosY), + '$ELPosX' => array('diabook_ELPosX', t('Set longitude (X) for Earth Layers'), $ELPosX, '', $ELPosX), + '$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_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_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_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_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), diff --git a/view/theme/diabook/theme.php b/view/theme/diabook/theme.php index f1e4d0ba02..7336383d7a 100755 --- a/view/theme/diabook/theme.php +++ b/view/theme/diabook/theme.php @@ -608,9 +608,9 @@ if ($color=="dark") $color_path = "/diabook-dark/"; $ELZoom = get_pconfig(local_user(), 'diabook', 'ELZoom' ); $ELPosX = get_pconfig(local_user(), 'diabook', 'ELPosX' ); $ELPosY = get_pconfig(local_user(), 'diabook', 'ELPosY' ); - $aside['$ELZoom'] = array('diabook_ELZoom', t('Set zoomfactor for Earth Layer'), $ELZoom, '', $ELZoom); - $aside['$ELPosX'] = array('diabook_ELPosX', t('Set longitude (X) for Earth Layer'), $ELPosX, '', $ELPosX); - $aside['$ELPosY'] = array('diabook_ELPosY', t('Set latitude (Y) for Earth Layer'), $ELPosY, '', $ELPosY); + $aside['$ELZoom'] = array('diabook_ELZoom', t('Set zoomfactor for Earth Layers'), $ELZoom, '', $ELZoom); + $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 Layers'), $ELPosY, '', $ELPosY); 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', 'ELPosX', $_POST['diabook_ELPosX']); @@ -670,7 +670,7 @@ if ($color=="dark") $color_path = "/diabook-dark/"; $close_lastusersC = 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"),); - $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['$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); From 8600afafe29051425e775d56166124f12020e191 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 10 May 2012 18:50:11 -0700 Subject: [PATCH 02/13] rev update --- boot.php | 2 +- util/messages.po | 174 ++++++++++++++++++++++------------------------- 2 files changed, 82 insertions(+), 94 deletions(-) diff --git a/boot.php b/boot.php index e4d8663a3f..6e3f8c0b50 100644 --- a/boot.php +++ b/boot.php @@ -9,7 +9,7 @@ require_once('include/nav.php'); require_once('include/cache.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica'); -define ( 'FRIENDICA_VERSION', '3.0.1337' ); +define ( 'FRIENDICA_VERSION', '3.0.1338' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); define ( 'DB_UPDATE_VERSION', 1143 ); diff --git a/util/messages.po b/util/messages.po index 37878d86a9..485dfd7b7e 100644 --- a/util/messages.po +++ b/util/messages.po @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: 2.3.1337\n" +"Project-Id-Version: 3.0.1338\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" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -48,8 +48,8 @@ msgstr "" #: ../../mod/register.php:38 ../../mod/regmod.php:116 ../../mod/item.php:124 #: ../../mod/item.php:140 ../../mod/profile_photo.php:19 #: ../../mod/profile_photo.php:139 ../../mod/profile_photo.php:150 -#: ../../mod/profile_photo.php:163 ../../mod/message.php:40 -#: ../../mod/message.php:92 ../../mod/allfriends.php:9 +#: ../../mod/profile_photo.php:163 ../../mod/message.php:44 +#: ../../mod/message.php:96 ../../mod/allfriends.php:9 #: ../../mod/nogroup.php:25 ../../mod/wall_upload.php:53 #: ../../mod/follow.php:8 ../../mod/display.php:138 ../../mod/profiles.php:7 #: ../../mod/profiles.php:365 ../../mod/delegate.php:6 @@ -158,7 +158,7 @@ msgstr "" #: ../../addon/irc/irc.php:55 ../../addon/blogger/blogger.php:102 #: ../../addon/posterous/posterous.php:103 #: ../../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/quattro/config.php:52 ../../view/theme/dispy/config.php:70 #: ../../include/conversation.php:555 @@ -532,8 +532,8 @@ msgid "Share" msgstr "" #: ../../mod/photos.php:1214 ../../mod/editpost.php:104 -#: ../../mod/wallmessage.php:145 ../../mod/message.php:206 -#: ../../mod/message.php:398 ../../include/conversation.php:361 +#: ../../mod/wallmessage.php:145 ../../mod/message.php:213 +#: ../../mod/message.php:405 ../../include/conversation.php:361 #: ../../include/conversation.php:706 ../../include/conversation.php:983 msgid "Please wait" msgstr "" @@ -631,7 +631,7 @@ msgid "Edit" msgstr "" #: ../../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 msgid "Upload photo" msgstr "" @@ -641,7 +641,7 @@ msgid "Attach file" msgstr "" #: ../../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 msgid "Insert web link" msgstr "" @@ -1775,8 +1775,8 @@ msgid "Remove account" msgstr "" #: ../../mod/settings.php:88 ../../mod/admin.php:735 ../../mod/admin.php:940 -#: ../../addon/mathjax/mathjax.php:36 ../../view/theme/diabook/theme.php:700 -#: ../../include/nav.php:137 +#: ../../addon/mathjax/mathjax.php:36 ../../view/theme/diabook/theme.php:571 +#: ../../view/theme/diabook/theme.php:701 ../../include/nav.php:137 msgid "Settings" msgstr "" @@ -2368,7 +2368,7 @@ msgstr "" msgid "Number of daily wall messages for %s exceeded. Message failed." msgstr "" -#: ../../mod/wallmessage.php:56 ../../mod/message.php:61 +#: ../../mod/wallmessage.php:56 ../../mod/message.php:65 msgid "No recipient selected." msgstr "" @@ -2376,15 +2376,15 @@ msgstr "" msgid "Unable to check your home location." msgstr "" -#: ../../mod/wallmessage.php:62 ../../mod/message.php:68 +#: ../../mod/wallmessage.php:62 ../../mod/message.php:72 msgid "Message could not be sent." msgstr "" -#: ../../mod/wallmessage.php:65 ../../mod/message.php:71 +#: ../../mod/wallmessage.php:65 ../../mod/message.php:75 msgid "Message collection failure." msgstr "" -#: ../../mod/wallmessage.php:68 ../../mod/message.php:74 +#: ../../mod/wallmessage.php:68 ../../mod/message.php:78 msgid "Message sent." msgstr "" @@ -2397,7 +2397,7 @@ msgstr "" msgid "Please enter a link URL:" msgstr "" -#: ../../mod/wallmessage.php:131 ../../mod/message.php:195 +#: ../../mod/wallmessage.php:131 ../../mod/message.php:199 msgid "Send Private Message" msgstr "" @@ -2408,18 +2408,18 @@ msgid "" "your site allow private mail from unknown senders." msgstr "" -#: ../../mod/wallmessage.php:133 ../../mod/message.php:196 -#: ../../mod/message.php:388 +#: ../../mod/wallmessage.php:133 ../../mod/message.php:200 +#: ../../mod/message.php:395 msgid "To:" msgstr "" -#: ../../mod/wallmessage.php:134 ../../mod/message.php:197 -#: ../../mod/message.php:389 +#: ../../mod/wallmessage.php:134 ../../mod/message.php:204 +#: ../../mod/message.php:396 msgid "Subject:" msgstr "" -#: ../../mod/wallmessage.php:140 ../../mod/message.php:201 -#: ../../mod/message.php:392 ../../mod/invite.php:113 +#: ../../mod/wallmessage.php:140 ../../mod/message.php:208 +#: ../../mod/message.php:399 ../../mod/invite.php:113 msgid "Your message:" msgstr "" @@ -2962,7 +2962,7 @@ msgstr "" msgid "New Message" msgstr "" -#: ../../mod/message.php:65 +#: ../../mod/message.php:69 msgid "Unable to locate contact information." msgstr "" @@ -2974,55 +2974,55 @@ msgstr "" msgid "Conversation removed." msgstr "" -#: ../../mod/message.php:237 +#: ../../mod/message.php:244 msgid "No messages." msgstr "" -#: ../../mod/message.php:244 +#: ../../mod/message.php:251 #, php-format msgid "Unknown sender - %s" msgstr "" -#: ../../mod/message.php:247 +#: ../../mod/message.php:254 #, php-format msgid "You and %s" msgstr "" -#: ../../mod/message.php:250 +#: ../../mod/message.php:257 #, php-format msgid "%s and You" msgstr "" -#: ../../mod/message.php:260 ../../mod/message.php:381 +#: ../../mod/message.php:267 ../../mod/message.php:388 msgid "Delete conversation" msgstr "" -#: ../../mod/message.php:263 +#: ../../mod/message.php:270 msgid "D, d M Y - g:i A" msgstr "" -#: ../../mod/message.php:265 +#: ../../mod/message.php:272 #, php-format msgid "%d message" msgid_plural "%d messages" msgstr[0] "" msgstr[1] "" -#: ../../mod/message.php:300 +#: ../../mod/message.php:307 msgid "Message not available." msgstr "" -#: ../../mod/message.php:365 +#: ../../mod/message.php:372 msgid "Delete message" msgstr "" -#: ../../mod/message.php:383 +#: ../../mod/message.php:390 msgid "" "No secure communications available. You may be able to " "respond from the sender's profile page." msgstr "" -#: ../../mod/message.php:387 +#: ../../mod/message.php:394 msgid "Send Reply" msgstr "" @@ -4683,10 +4683,6 @@ msgstr "" msgid "event" msgstr "" -#: ../../addon/hangman/hangman.php:19 -msgid "Hangman" -msgstr "" - #: ../../addon/uhremotestorage/uhremotestorage.php:84 #, php-format msgid "" @@ -5641,26 +5637,38 @@ msgstr "" #: ../../view/theme/diabook/theme.php:130 #: ../../view/theme/diabook/theme.php:571 +#: ../../view/theme/diabook/theme.php:675 +#: ../../view/theme/diabook/config.php:201 msgid "Community Pages" msgstr "" #: ../../view/theme/diabook/theme.php:418 +#: ../../view/theme/diabook/theme.php:677 +#: ../../view/theme/diabook/config.php:203 msgid "Community Profiles" msgstr "" #: ../../view/theme/diabook/theme.php:439 +#: ../../view/theme/diabook/theme.php:682 +#: ../../view/theme/diabook/config.php:208 msgid "Last users" msgstr "" #: ../../view/theme/diabook/theme.php:468 +#: ../../view/theme/diabook/theme.php:684 +#: ../../view/theme/diabook/config.php:210 msgid "Last likes" msgstr "" #: ../../view/theme/diabook/theme.php:513 +#: ../../view/theme/diabook/theme.php:683 +#: ../../view/theme/diabook/config.php:209 msgid "Last photos" msgstr "" #: ../../view/theme/diabook/theme.php:550 +#: ../../view/theme/diabook/theme.php:680 +#: ../../view/theme/diabook/config.php:206 msgid "Find Friends" msgstr "" @@ -5677,6 +5685,8 @@ msgid "Invite Friends" msgstr "" #: ../../view/theme/diabook/theme.php:606 +#: ../../view/theme/diabook/theme.php:676 +#: ../../view/theme/diabook/config.php:202 msgid "Earth Layers" msgstr "" @@ -5696,14 +5706,20 @@ msgid "Set latitude (Y) for Earth Layer" msgstr "" #: ../../view/theme/diabook/theme.php:626 +#: ../../view/theme/diabook/theme.php:678 +#: ../../view/theme/diabook/config.php:204 msgid "Help or @NewHere ?" msgstr "" #: ../../view/theme/diabook/theme.php:633 +#: ../../view/theme/diabook/theme.php:679 +#: ../../view/theme/diabook/config.php:205 msgid "Connect Services" msgstr "" #: ../../view/theme/diabook/theme.php:640 +#: ../../view/theme/diabook/theme.php:681 +#: ../../view/theme/diabook/config.php:207 msgid "Last Tweets" msgstr "" @@ -5712,54 +5728,34 @@ msgstr "" msgid "Set twitter search term" 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/config.php:201 -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?" +msgid "Show/hide boxes at right-hand coloumn:" msgstr "" #: ../../view/theme/diabook/config.php:194 @@ -6683,14 +6679,6 @@ msgstr "" msgid "Visible to everybody" msgstr "" -#: ../../include/acl_selectors.php:287 -msgid "show" -msgstr "" - -#: ../../include/acl_selectors.php:288 -msgid "don't show" -msgstr "" - #: ../../include/enotify.php:14 msgid "Friendica Notification" msgstr "" From 547007e1993a21347db327f5c030dd1dac60f28f Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 10 May 2012 19:29:01 -0700 Subject: [PATCH 03/13] add photos to PM autocomplete, improved appearance --- library/jquery_ac/friendica.complete.js | 395 ++++++++++++++++++++++++ mod/acl.php | 7 +- mod/message.php | 2 +- 3 files changed, 401 insertions(+), 3 deletions(-) create mode 100644 library/jquery_ac/friendica.complete.js diff --git a/library/jquery_ac/friendica.complete.js b/library/jquery_ac/friendica.complete.js new file mode 100644 index 0000000000..81eba564e1 --- /dev/null +++ b/library/jquery_ac/friendica.complete.js @@ -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'), '$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)||$(''), 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; + + $('
').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 = '' + s + ' '; + div = $((me.selectedIndex === i ? '
' + img + f(s, this.data[i], v) + '
'); + 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)); diff --git a/mod/acl.php b/mod/acl.php index 402d37376c..168b1f59f0 100644 --- a/mod/acl.php +++ b/mod/acl.php @@ -127,12 +127,15 @@ function acl_init(&$a){ if($type == 'm') { $x = array(); $x['query'] = $search; + $x['photos'] = array(); + $x['links'] = array(); $x['suggestions'] = array(); $x['data'] = array(); if(count($r)) { foreach($r as $g) { - $x['suggestions'][] = sprintf( t('%s [%s]'),$g['name'],$g['url']); - // '' . t('Image/photo') . '' . + $x['photos'][] = $g['micro']; + $x['links'][] = $g['url']; + $x['suggestions'][] = $g['name']; // sprintf( t('%s [%s]'),$g['name'],$g['url']); $x['data'][] = intval($g['id']); } } diff --git a/mod/message.php b/mod/message.php index 8cfa0256cd..29a2fa2532 100644 --- a/mod/message.php +++ b/mod/message.php @@ -18,7 +18,7 @@ function message_init(&$a) { )); $base = $a->get_baseurl(); - $a->page['htmlhead'] .= ''; + $a->page['htmlhead'] .= ''; $a->page['htmlhead'] .= <<< EOT ', $cookieJS); //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('', $imageresizeJS); //load jquery.ui.js @@ -198,6 +198,10 @@ if ($color=="dark") $color_path = "/diabook-dark/"; $a->page['htmlhead'] .= sprintf('', $mqmouseposJS); $mousewheelJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.mousewheel.js"; $a->page['htmlhead'] .= sprintf('', $mousewheelJS); + $mqlegendJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.mapquery.legend.js"; + $a->page['htmlhead'] .= sprintf('', $mqlegendJS); + $mqlayermanagerJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.mapquery.mqLayerManager.js"; + $a->page['htmlhead'] .= sprintf('', $mqlayermanagerJS); } @@ -248,9 +252,12 @@ if ($color=="dark") $color_path = "/diabook-dark/"; }); function open_mapcontrol() { - $("div#mapcontrol").attr("style","display: block;width:900px;height:600px;"); - $("#map2").mapQuery({layers:[{type:"osm"}], - center:({zoom:'.$ELZoom.',position:['.$ELPosX.','.$ELPosY.']})}); + $("div#mapcontrol").attr("style","display: block;width:900px;height:900px;"); + $("#map2").mapQuery({ + layers:[{type:"osm", minZoom:1, label:"OpenStreetMap" }, + {type:"wms", minZoom:1, 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({ map: "#map2", @@ -259,7 +266,8 @@ if ($color=="dark") $color_path = "/diabook-dark/"; precision:4 }); - + $("#layermanager").mqLayerManager({map:"#map2"}); + map = $("#map2").mapQuery().data("mapQuery"); textarea = document.getElementById("id_diabook_ELZoom"); From 48c48d644f4b6dca237e61594d5d95a0c1c3f6e8 Mon Sep 17 00:00:00 2001 From: tommy tomson Date: Fri, 11 May 2012 16:41:16 +0200 Subject: [PATCH 12/13] diabook-theme: update mapquery and small fix --- view/theme/diabook/communityhome.tpl | 3 +- view/theme/diabook/js/jquery.mapquery.core.js | 655 +++++++++++++++--- .../js/jquery.mapquery.mqLayerManager.js | 23 +- .../js/jquery.mapquery.mqMousePosition.js | 59 +- view/theme/diabook/theme.php | 14 +- 5 files changed, 596 insertions(+), 158 deletions(-) diff --git a/view/theme/diabook/communityhome.tpl b/view/theme/diabook/communityhome.tpl index 90253882f8..6fa330140a 100755 --- a/view/theme/diabook/communityhome.tpl +++ b/view/theme/diabook/communityhome.tpl @@ -10,8 +10,9 @@