From 98ce7daf5650ebd7e6f6bbaca6e57069ffccae55 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Tue, 29 Dec 2009 16:17:17 -0500 Subject: Implement user interface for user to preview what location they are sharing with a notice --- lib/noticeform.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/noticeform.php') diff --git a/lib/noticeform.php b/lib/noticeform.php index 593a1e932..d85de9c22 100644 --- a/lib/noticeform.php +++ b/lib/noticeform.php @@ -220,5 +220,11 @@ class NoticeForm extends Form 'name' => 'status_submit', 'type' => 'submit', 'value' => _('Send'))); + if($this->user->shareLocation()) { + $this->out->elementStart('div',array('id' => 'notice_data-location_enabled_container', 'data-geocode-url' => common_local_url('geocode'))); + $this->out->checkbox('notice_data-location_enabled',_('Share your location ')); + $this->out->element('a', array('style' => 'display: none', 'target' => '_blank', 'id' => 'notice_data-location_name'), _('Finding your location...')); + $this->out->elementEnd('div'); + } } } -- cgit v1.2.3-54-g00ecf From 024704e0b70cb29107929cc2cce0ddc6b2d2e42b Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Wed, 30 Dec 2009 20:26:23 +0100 Subject: Remove trailing space in checkbox text. --- lib/noticeform.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/noticeform.php') diff --git a/lib/noticeform.php b/lib/noticeform.php index d85de9c22..76715c35a 100644 --- a/lib/noticeform.php +++ b/lib/noticeform.php @@ -222,7 +222,7 @@ class NoticeForm extends Form 'value' => _('Send'))); if($this->user->shareLocation()) { $this->out->elementStart('div',array('id' => 'notice_data-location_enabled_container', 'data-geocode-url' => common_local_url('geocode'))); - $this->out->checkbox('notice_data-location_enabled',_('Share your location ')); + $this->out->checkbox('notice_data-location_enabled',_('Share your location')); $this->out->element('a', array('style' => 'display: none', 'target' => '_blank', 'id' => 'notice_data-location_name'), _('Finding your location...')); $this->out->elementEnd('div'); } -- cgit v1.2.3-54-g00ecf From 4985582880b56f23226dfffb3f81140d8d4c055f Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Thu, 31 Dec 2009 12:43:33 +0000 Subject: Fixed Event end name --- lib/noticeform.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/noticeform.php') diff --git a/lib/noticeform.php b/lib/noticeform.php index 76715c35a..0af497099 100644 --- a/lib/noticeform.php +++ b/lib/noticeform.php @@ -203,7 +203,7 @@ class NoticeForm extends Form $this->out->hidden('notice_data-location_id', empty($this->location_id) ? null : $this->location_id, 'location_id'); $this->out->hidden('notice_data-location_ns', empty($this->location_ns) ? null : $this->location_ns, 'location_ns'); - Event::handle('StartShowNoticeFormData', array($this)); + Event::handle('EndShowNoticeFormData', array($this)); } } -- cgit v1.2.3-54-g00ecf From 58714808443204ecbd98b9763aeaeb1929341213 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Thu, 31 Dec 2009 12:52:39 +0000 Subject: Moved shareLocation data from formActions() to formData() --- lib/noticeform.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'lib/noticeform.php') diff --git a/lib/noticeform.php b/lib/noticeform.php index 0af497099..bfdab7738 100644 --- a/lib/noticeform.php +++ b/lib/noticeform.php @@ -203,6 +203,13 @@ class NoticeForm extends Form $this->out->hidden('notice_data-location_id', empty($this->location_id) ? null : $this->location_id, 'location_id'); $this->out->hidden('notice_data-location_ns', empty($this->location_ns) ? null : $this->location_ns, 'location_ns'); + if($this->user->shareLocation()) { + $this->out->elementStart('div',array('id' => 'notice_data-location_enabled_container', 'data-geocode-url' => common_local_url('geocode'))); + $this->out->checkbox('notice_data-location_enabled',_('Share your location')); + $this->out->element('a', array('style' => 'display: none', 'target' => '_blank', 'id' => 'notice_data-location_name'), _('Finding your location...')); + $this->out->elementEnd('div'); + } + Event::handle('EndShowNoticeFormData', array($this)); } } @@ -220,11 +227,5 @@ class NoticeForm extends Form 'name' => 'status_submit', 'type' => 'submit', 'value' => _('Send'))); - if($this->user->shareLocation()) { - $this->out->elementStart('div',array('id' => 'notice_data-location_enabled_container', 'data-geocode-url' => common_local_url('geocode'))); - $this->out->checkbox('notice_data-location_enabled',_('Share your location')); - $this->out->element('a', array('style' => 'display: none', 'target' => '_blank', 'id' => 'notice_data-location_name'), _('Finding your location...')); - $this->out->elementEnd('div'); - } } } -- cgit v1.2.3-54-g00ecf From 923e27b01a81c70ab52bc1b5856368143d0d32cf Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Thu, 31 Dec 2009 14:23:11 +0000 Subject: Fix to grab and use the actual lat/lon values from the user profile --- lib/noticeform.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib/noticeform.php') diff --git a/lib/noticeform.php b/lib/noticeform.php index bfdab7738..c60ac29c3 100644 --- a/lib/noticeform.php +++ b/lib/noticeform.php @@ -110,6 +110,8 @@ class NoticeForm extends Form $this->user = common_current_user(); } + $this->profile = $this->user->getProfile(); + if (common_config('attachments', 'uploads')) { $this->enctype = 'multipart/form-data'; } @@ -198,10 +200,11 @@ class NoticeForm extends Form $this->out->hidden('notice_return-to', $this->action, 'returnto'); } $this->out->hidden('notice_in-reply-to', $this->inreplyto, 'inreplyto'); - $this->out->hidden('notice_data-lat', empty($this->lat) ? null : $this->lat, 'lat'); - $this->out->hidden('notice_data-lon', empty($this->lon) ? null : $this->lon, 'lon'); - $this->out->hidden('notice_data-location_id', empty($this->location_id) ? null : $this->location_id, 'location_id'); - $this->out->hidden('notice_data-location_ns', empty($this->location_ns) ? null : $this->location_ns, 'location_ns'); + + $this->out->hidden('notice_data-lat', empty($this->profile->lat) ? null : $this->profile->lat, 'lat'); + $this->out->hidden('notice_data-lon', empty($this->profile->lon) ? null : $this->profile->lon, 'lon'); + $this->out->hidden('notice_data-location_id', empty($this->profile->location_id) ? null : $this->profile->location_id, 'location_id'); + $this->out->hidden('notice_data-location_ns', empty($this->profile->location_ns) ? null : $this->profile->location_ns, 'location_ns'); if($this->user->shareLocation()) { $this->out->elementStart('div',array('id' => 'notice_data-location_enabled_container', 'data-geocode-url' => common_local_url('geocode'))); -- cgit v1.2.3-54-g00ecf From 4efa841ba330cedd4ad71349a8196f18d5546cb8 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Thu, 31 Dec 2009 14:24:27 +0000 Subject: If user doesn't want to share their location (which is globally set from their profile settings), don't bother to output form data for lat/long in the notice form. --- lib/noticeform.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/noticeform.php') diff --git a/lib/noticeform.php b/lib/noticeform.php index c60ac29c3..50b2e6893 100644 --- a/lib/noticeform.php +++ b/lib/noticeform.php @@ -201,12 +201,12 @@ class NoticeForm extends Form } $this->out->hidden('notice_in-reply-to', $this->inreplyto, 'inreplyto'); - $this->out->hidden('notice_data-lat', empty($this->profile->lat) ? null : $this->profile->lat, 'lat'); - $this->out->hidden('notice_data-lon', empty($this->profile->lon) ? null : $this->profile->lon, 'lon'); - $this->out->hidden('notice_data-location_id', empty($this->profile->location_id) ? null : $this->profile->location_id, 'location_id'); - $this->out->hidden('notice_data-location_ns', empty($this->profile->location_ns) ? null : $this->profile->location_ns, 'location_ns'); + if ($this->user->shareLocation()) { + $this->out->hidden('notice_data-lat', empty($this->profile->lat) ? null : $this->profile->lat, 'lat'); + $this->out->hidden('notice_data-lon', empty($this->profile->lon) ? null : $this->profile->lon, 'lon'); + $this->out->hidden('notice_data-location_id', empty($this->profile->location_id) ? null : $this->profile->location_id, 'location_id'); + $this->out->hidden('notice_data-location_ns', empty($this->profile->location_ns) ? null : $this->profile->location_ns, 'location_ns'); - if($this->user->shareLocation()) { $this->out->elementStart('div',array('id' => 'notice_data-location_enabled_container', 'data-geocode-url' => common_local_url('geocode'))); $this->out->checkbox('notice_data-location_enabled',_('Share your location')); $this->out->element('a', array('style' => 'display: none', 'target' => '_blank', 'id' => 'notice_data-location_name'), _('Finding your location...')); -- cgit v1.2.3-54-g00ecf From c986f59143b1969dc4ae324409295728b1d06e82 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Thu, 31 Dec 2009 14:34:07 +0000 Subject: If user is sharing their location (based on profile setting), then enable it for form notice by default. This can be overriden by the cookie to preserve states. --- lib/noticeform.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/noticeform.php') diff --git a/lib/noticeform.php b/lib/noticeform.php index 50b2e6893..f45e6629b 100644 --- a/lib/noticeform.php +++ b/lib/noticeform.php @@ -208,7 +208,7 @@ class NoticeForm extends Form $this->out->hidden('notice_data-location_ns', empty($this->profile->location_ns) ? null : $this->profile->location_ns, 'location_ns'); $this->out->elementStart('div',array('id' => 'notice_data-location_enabled_container', 'data-geocode-url' => common_local_url('geocode'))); - $this->out->checkbox('notice_data-location_enabled',_('Share your location')); + $this->out->checkbox('notice_data-location_enabled', _('Share your location'), true); $this->out->element('a', array('style' => 'display: none', 'target' => '_blank', 'id' => 'notice_data-location_name'), _('Finding your location...')); $this->out->elementEnd('div'); } -- cgit v1.2.3-54-g00ecf From 0320bf2fb3cdd4b9e6b635485421833fde447da8 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Thu, 31 Dec 2009 15:46:43 +0000 Subject: Use the location setting profile as secondary --- lib/noticeform.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/noticeform.php') diff --git a/lib/noticeform.php b/lib/noticeform.php index f45e6629b..5afa41e25 100644 --- a/lib/noticeform.php +++ b/lib/noticeform.php @@ -202,10 +202,10 @@ class NoticeForm extends Form $this->out->hidden('notice_in-reply-to', $this->inreplyto, 'inreplyto'); if ($this->user->shareLocation()) { - $this->out->hidden('notice_data-lat', empty($this->profile->lat) ? null : $this->profile->lat, 'lat'); - $this->out->hidden('notice_data-lon', empty($this->profile->lon) ? null : $this->profile->lon, 'lon'); - $this->out->hidden('notice_data-location_id', empty($this->profile->location_id) ? null : $this->profile->location_id, 'location_id'); - $this->out->hidden('notice_data-location_ns', empty($this->profile->location_ns) ? null : $this->profile->location_ns, 'location_ns'); + $this->out->hidden('notice_data-lat', empty($this->lat) ? (empty($this->profile->lat) ? null : $this->profile->lat) : $this->lat, 'lat'); + $this->out->hidden('notice_data-lon', empty($this->lon) ? (empty($this->profile->lon) ? null : $this->profile->lon) : $this->lon, 'lon'); + $this->out->hidden('notice_data-location_id', empty($this->location_id) ? (empty($this->profile->location_id) ? null : $this->profile->location_id) : $this->location_id, 'location_id'); + $this->out->hidden('notice_data-location_ns', empty($this->location_ns) ? (empty($this->profile->location_ns) ? null : $this->profile->location_ns) : $this->location_ns, 'location_ns'); $this->out->elementStart('div',array('id' => 'notice_data-location_enabled_container', 'data-geocode-url' => common_local_url('geocode'))); $this->out->checkbox('notice_data-location_enabled', _('Share your location'), true); -- cgit v1.2.3-54-g00ecf From 8872d91483b689d168244ff0df2fa4b5b23a38cc Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Thu, 31 Dec 2009 16:44:24 +0000 Subject: Removed style information out of HTML --- lib/noticeform.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/noticeform.php') diff --git a/lib/noticeform.php b/lib/noticeform.php index 5afa41e25..98f15ca09 100644 --- a/lib/noticeform.php +++ b/lib/noticeform.php @@ -209,7 +209,7 @@ class NoticeForm extends Form $this->out->elementStart('div',array('id' => 'notice_data-location_enabled_container', 'data-geocode-url' => common_local_url('geocode'))); $this->out->checkbox('notice_data-location_enabled', _('Share your location'), true); - $this->out->element('a', array('style' => 'display: none', 'target' => '_blank', 'id' => 'notice_data-location_name'), _('Finding your location...')); + $this->out->element('a', array('id' => 'notice_data-location_name'), _('Finding your location...')); $this->out->elementEnd('div'); } -- cgit v1.2.3-54-g00ecf From dde6415a6a91eb6670a80279a344ab6cc56ef17d Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Thu, 31 Dec 2009 18:08:21 +0000 Subject: Moved JavaScript dependant stuff out of noticeform. --- js/util.js | 29 ++++++++++++++++++++++------- lib/noticeform.php | 4 ++-- 2 files changed, 24 insertions(+), 9 deletions(-) (limited to 'lib/noticeform.php') diff --git a/js/util.js b/js/util.js index 8ac0cbd66..41b3fdb25 100644 --- a/js/util.js +++ b/js/util.js @@ -440,8 +440,20 @@ var SN = { // StatusNet NoticeLocationAttach: function() { if ($('#notice_data-location_enabled').length > 0) { if (navigator.geolocation) { - $('#notice_data-location_enabled').change(function() { + var NLE = $('#notice_data-location_wrap'); + var geocodeURL = NLE.attr('title'); + + NLE.change(function() { + NLE.removeAttr('title'); + $.cookie(SN.C.S.NoticeLocationCookieName, $('#notice_data-location_enabled').attr('checked')); + + var NLN = $('#'+SN.C.S.NoticeLocationName); + if (NLN.length > 0) { + NLN.remove(); + } + + NLE.append('Geo'); NLN = $('#'+SN.C.S.NoticeLocationName); if ($('#notice_data-location_enabled').attr('checked') === true) { @@ -458,8 +470,9 @@ var SN = { // StatusNet 'token': $('#token').val() }; - $.getJSON($('#notice_data-location_enabled_container').attr('data-geocode-url'), data, function(location) { - NLN.removeClass('processing'); + $.getJSON(geocodeURL, data, function(location) { + NLN.replaceWith(''); + NLN = $('#'+SN.C.S.NoticeLocationName); if (typeof(location.location_ns) != 'undefined') { $('#'+SN.C.S.NoticeLocationNs).val(location.location_ns); @@ -470,12 +483,14 @@ var SN = { // StatusNet } if (typeof(location.name) == 'undefined') { - NLN.text(position.coords.latitude + ';' + position.coords.longitude); + NLN_text = position.coords.latitude + ';' + position.coords.longitude; } else { - NLN.text(location.name); - NLN.attr('href',location.url); + NLN_text = location.name; } + + NLN.attr('href', location.url); + NLN.text(NLN_text); }); }); } @@ -490,7 +505,7 @@ var SN = { // StatusNet var cookieVal = $.cookie(SN.C.S.NoticeLocationCookieName); $('#notice_data-location_enabled').attr('checked',(cookieVal == null || cookieVal == 'true')); - $('#notice_data-location_enabled').change(); + NLE.change(); } } }, diff --git a/lib/noticeform.php b/lib/noticeform.php index 98f15ca09..7ed880442 100644 --- a/lib/noticeform.php +++ b/lib/noticeform.php @@ -207,9 +207,9 @@ class NoticeForm extends Form $this->out->hidden('notice_data-location_id', empty($this->location_id) ? (empty($this->profile->location_id) ? null : $this->profile->location_id) : $this->location_id, 'location_id'); $this->out->hidden('notice_data-location_ns', empty($this->location_ns) ? (empty($this->profile->location_ns) ? null : $this->profile->location_ns) : $this->location_ns, 'location_ns'); - $this->out->elementStart('div',array('id' => 'notice_data-location_enabled_container', 'data-geocode-url' => common_local_url('geocode'))); + $this->out->elementStart('div', array('id' => 'notice_data-location_wrap', + 'title' => common_local_url('geocode'))); $this->out->checkbox('notice_data-location_enabled', _('Share your location'), true); - $this->out->element('a', array('id' => 'notice_data-location_name'), _('Finding your location...')); $this->out->elementEnd('div'); } -- cgit v1.2.3-54-g00ecf From 01dbee2ba5280d97ddd0bb82217e8b3e7680e67b Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Thu, 31 Dec 2009 18:41:10 +0000 Subject: Initial UI for geo location share option in notice form --- js/util.js | 2 +- lib/noticeform.php | 1 + theme/base/css/display.css | 15 +++++++++++++++ theme/identica/css/display.css | 4 ++++ 4 files changed, 21 insertions(+), 1 deletion(-) (limited to 'lib/noticeform.php') diff --git a/js/util.js b/js/util.js index 0969ba5e2..dd7a74a7a 100644 --- a/js/util.js +++ b/js/util.js @@ -455,7 +455,7 @@ var SN = { // StatusNet NLN.remove(); } - NLE.append('Geo'); + NLE.prepend('Geo'); NLN = $('#'+SN.C.S.NoticeLocationName); if ($('#notice_data-location_enabled').attr('checked') === true) { diff --git a/lib/noticeform.php b/lib/noticeform.php index 7ed880442..d35655a0b 100644 --- a/lib/noticeform.php +++ b/lib/noticeform.php @@ -208,6 +208,7 @@ class NoticeForm extends Form $this->out->hidden('notice_data-location_ns', empty($this->location_ns) ? (empty($this->profile->location_ns) ? null : $this->profile->location_ns) : $this->location_ns, 'location_ns'); $this->out->elementStart('div', array('id' => 'notice_data-location_wrap', + 'class' => 'success', 'title' => common_local_url('geocode'))); $this->out->checkbox('notice_data-location_enabled', _('Share your location'), true); $this->out->elementEnd('div'); diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 29c7ee963..d6a50ac60 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -566,6 +566,21 @@ overflow:auto; float:right; font-size:0.8em; } +.form_notice #notice_data-location_wrap input { +margin-right:7px; +float:left; +} +.form_notice #notice_data-location_wrap label { +font-weight:normal; +font-size:1em; +} +.form_notice #notice_data-location_name { +display:block; +line-height:1.6; +} +.form_notice span#notice_data-location_name { +padding-left:18px; +} button.close { width:16px; diff --git a/theme/identica/css/display.css b/theme/identica/css/display.css index e86ee2437..78a0707ce 100644 --- a/theme/identica/css/display.css +++ b/theme/identica/css/display.css @@ -111,6 +111,10 @@ box-shadow:3px 3px 3px rgba(194, 194, 194, 0.1); text-shadow:none; } +.form_notice #notice_data-location_name { +background-position:0 47%; +} + a, .form_settings input.form_action-primary, .notice-options input, -- cgit v1.2.3-54-g00ecf From ec5850d26a46b88c14579959c8bcf34e936b087e Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 3 Jan 2010 00:33:41 +0000 Subject: Changed location share representation to be more like the file attachment. Init UI. Probably a little buggy. --- js/util.js | 38 ++++++++++++++++++++++++++--------- lib/noticeform.php | 3 +-- theme/base/css/display.css | 29 ++++++++++++++++++-------- theme/base/images/icons/icons-01.gif | Bin 3443 -> 3533 bytes theme/identica/css/display.css | 9 ++++++++- 5 files changed, 59 insertions(+), 20 deletions(-) (limited to 'lib/noticeform.php') diff --git a/js/util.js b/js/util.js index dd7a74a7a..8ee0dd05d 100644 --- a/js/util.js +++ b/js/util.js @@ -52,7 +52,9 @@ var SN = { // StatusNet NoticeLocationId: 'notice_data-location_id', NoticeLocationNs: 'notice_data-location_ns', NoticeLocationName: 'notice_data-location_name', - NoticeLocationCookieName: 'location_enabled' + NoticeLocationCookieName: 'location_enabled', + NoticeDataGeo: 'notice_data-geo', + NoticeDataGeoSelected: 'notice_data-geo_selected' } }, @@ -438,29 +440,46 @@ var SN = { // StatusNet }, NoticeLocationAttach: function() { - if ($('#notice_data-location_enabled').length > 0) { + var NDG = $('#'+SN.C.S.NoticeDataGeo); + if (NDG.length > 0) { + NDG.attr('title', NDG.text()); var NLE = $('#notice_data-location_wrap'); var geocodeURL = NLE.attr('title'); - NLE.insertAfter('#'+SN.C.S.FormNotice+' fieldset'); + var S = '
'; + var NDGS = $('#'+SN.C.S.NoticeDataGeoSelected); + + if (NDGS.length > 0) { + NDGS.replaceWith(S); + } + else { + $('#'+SN.C.S.FormNotice).append(S); + } + NDGS = $('#'+SN.C.S.NoticeDataGeoSelected); + + $('#'+SN.C.S.NoticeDataGeoSelected+' button.close').click(function(){ + $('#'+SN.C.S.NoticeDataGeoSelected).remove(); + $('#'+SN.C.S.NoticeDataGeo).attr('checked', false); + }); if (navigator.geolocation) { NLE.change(function() { NLE.removeAttr('title'); - $.cookie(SN.C.S.NoticeLocationCookieName, $('#notice_data-location_enabled').attr('checked')); + $.cookie(SN.C.S.NoticeLocationCookieName, $('#'+SN.C.S.NoticeDataGeo).attr('checked')); var NLN = $('#'+SN.C.S.NoticeLocationName); if (NLN.length > 0) { NLN.remove(); } - NLE.prepend('Geo'); + NDGS.prepend('Geo'); NLN = $('#'+SN.C.S.NoticeLocationName); - if ($('#notice_data-location_enabled').attr('checked') === true) { - NLN.show(); + if ($('#'+SN.C.S.NoticeDataGeo).attr('checked') === true) { + NDGS.show(); NLN.addClass('processing'); + $('label[for=notice_data-geo]').addClass('checked'); navigator.geolocation.getCurrentPosition(function(position) { $('#'+SN.C.S.NoticeLat).val(position.coords.latitude); @@ -497,7 +516,8 @@ var SN = { // StatusNet }); } else { - NLN.hide(); + $('label[for=notice_data-geo]').removeClass('checked'); + NDGS.hide(); $('#'+SN.C.S.NoticeLat).val(''); $('#'+SN.C.S.NoticeLon).val(''); $('#'+SN.C.S.NoticeLocationNs).val(''); @@ -506,7 +526,7 @@ var SN = { // StatusNet }); var cookieVal = $.cookie(SN.C.S.NoticeLocationCookieName); - $('#notice_data-location_enabled').attr('checked', (cookieVal == null || cookieVal == 'true')); + $('#'+SN.C.S.NoticeDataGeo).attr('checked', (cookieVal == null || cookieVal == 'true')); NLE.change(); } } diff --git a/lib/noticeform.php b/lib/noticeform.php index d35655a0b..99865645a 100644 --- a/lib/noticeform.php +++ b/lib/noticeform.php @@ -208,9 +208,8 @@ class NoticeForm extends Form $this->out->hidden('notice_data-location_ns', empty($this->location_ns) ? (empty($this->profile->location_ns) ? null : $this->profile->location_ns) : $this->location_ns, 'location_ns'); $this->out->elementStart('div', array('id' => 'notice_data-location_wrap', - 'class' => 'success', 'title' => common_local_url('geocode'))); - $this->out->checkbox('notice_data-location_enabled', _('Share your location'), true); + $this->out->checkbox('notice_data-geo', _('Share your location'), true); $this->out->elementEnd('div'); } diff --git a/theme/base/css/display.css b/theme/base/css/display.css index a0b12a9f4..fc8762cdc 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -554,31 +554,44 @@ width:81.5%; margin-bottom:0; line-height:1.618; } -.form_notice #notice_data-attach_selected code { +.form_notice #notice_data-attach_selected code, +.form_notice #notice_data-location_name { float:left; -width:90%; +width:87%; display:block; -font-size:1.1em; line-height:1.8; overflow:auto; } -.form_notice #notice_data-attach_selected button { +.form_notice #notice_data-attach_selected code { +font-size:1.1em; +} +.form_notice #notice_data-attach_selected button.close, +.form_notice #notice_data-geo_selected button.close { float:right; font-size:0.8em; } + +.form_notice #notice_data-location_wrap label { +position:absolute; +top:25px; +right:4px; +left:auto; +cursor:pointer; +width:16px; +height:16px; +display:block; +} .form_notice #notice_data-location_wrap input { -margin-right:7px; -float:left; -top:3px; +display:none; } .form_notice #notice_data-location_wrap label { font-weight:normal; font-size:1em; margin-bottom:0; +text-indent:-9999px; } .form_notice #notice_data-location_name { display:block; -line-height:1.6; padding-left:21px; } diff --git a/theme/base/images/icons/icons-01.gif b/theme/base/images/icons/icons-01.gif index cda932161..03db8c09c 100644 Binary files a/theme/base/images/icons/icons-01.gif and b/theme/base/images/icons/icons-01.gif differ diff --git a/theme/identica/css/display.css b/theme/identica/css/display.css index 34be6eefa..a47837387 100644 --- a/theme/identica/css/display.css +++ b/theme/identica/css/display.css @@ -117,6 +117,12 @@ background-position:0 47%; .form_notice a#notice_data-location_name { background-position:0 -1711px; } +.form_notice label[for=notice_data-geo] { +background-position:0 -1780px; +} +.form_notice label[for=notice_data-geo].checked { +background-position:0 -1847px; +} a, .form_settings input.form_action-primary, @@ -185,7 +191,8 @@ button.close, .entity_silence input.submit, .entity_delete input.submit, .notice-options .repeated, -.form_notice a#notice_data-location_name { +.form_notice a#notice_data-location_name, +.form_notice label[for=notice_data-geo] { background-image:url(../../base/images/icons/icons-01.gif); background-repeat:no-repeat; background-color:transparent; -- cgit v1.2.3-54-g00ecf From 54c18e68dadc37174e8631db76dae064a88920a6 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Fri, 8 Jan 2010 13:58:23 +0000 Subject: Some code cleaning for geo UI --- js/util.js | 42 ++++++++++++++++++++---------------------- lib/noticeform.php | 2 +- theme/base/css/display.css | 10 +++++----- theme/default/css/display.css | 6 +++--- theme/identica/css/display.css | 6 +++--- 5 files changed, 32 insertions(+), 34 deletions(-) (limited to 'lib/noticeform.php') diff --git a/js/util.js b/js/util.js index a29b158be..9c6342ffe 100644 --- a/js/util.js +++ b/js/util.js @@ -51,8 +51,7 @@ var SN = { // StatusNet NoticeLon: 'notice_data-lon', NoticeLocationId: 'notice_data-location_id', NoticeLocationNs: 'notice_data-location_ns', - NoticeLocationName: 'notice_data-location_name', - NoticeLocationCookieName: 'location_enabled', + NoticeGeoName: 'notice_data-geo_name', NoticeDataGeo: 'notice_data-geo', NoticeDataGeoSelected: 'notice_data-geo_selected' } @@ -460,7 +459,7 @@ var SN = { // StatusNet var NLon = $('#'+SN.C.S.NoticeLon).val(); var NLNS = $('#'+SN.C.S.NoticeLocationNs).val(); var NLID = $('#'+SN.C.S.NoticeLocationId).val(); - var NLN = $('#'+SN.C.S.NoticeLocationName).text(); + var NLN = $('#'+SN.C.S.NoticeGeoName).text(); var NDGe = $('#'+SN.C.S.NoticeDataGeo); function removeNoticeDataGeo() { @@ -473,7 +472,7 @@ var SN = { // StatusNet $('#'+SN.C.S.NoticeLocationId).val(''); $('#'+SN.C.S.NoticeDataGeo).attr('checked', false); - $.cookie(SN.C.S.NoticeLocationCookieName, 'disabled'); + $.cookie(SN.C.S.NoticeDataGeo, 'disabled'); } function getJSONgeocodeURL(geocodeURL, data) { @@ -497,10 +496,10 @@ var SN = { // StatusNet NLN_text = location.name; } - $('#'+SN.C.S.NoticeLocationName) - .replaceWith('
'); + $('#'+SN.C.S.NoticeGeoName) + .replaceWith(''); - $('#'+SN.C.S.NoticeLocationName) + $('#'+SN.C.S.NoticeGeoName) .attr('href', location.url) .text(NLN_text) .click(function() { @@ -524,32 +523,31 @@ var SN = { // StatusNet 'NLNU': location.url, 'NDG': true }; - $.cookie(SN.C.S.NoticeLocationCookieName, JSON.stringify(cookieValue)); + $.cookie(SN.C.S.NoticeDataGeo, JSON.stringify(cookieValue)); }); } if (NDGe.length > 0) { - var cookieValue = $.cookie(SN.C.S.NoticeLocationCookieName); - if (cookieValue == 'disabled') { + if ($.cookie(SN.C.S.NoticeDataGeo) == 'disabled') { NDGe.attr('checked', false); } else { NDGe.attr('checked', true); } - var NLE = $('#notice_data-location_wrap'); - var geocodeURL = NLE.attr('title'); - NLE.removeAttr('title'); + var NGW = $('#notice_data-geo_wrap'); + var geocodeURL = NGW.attr('title'); + NGW.removeAttr('title'); $('label[for='+SN.C.S.NoticeDataGeo+']').attr('title', jQuery.trim($('label[for='+SN.C.S.NoticeDataGeo+']').text())); NDGe.change(function() { - var NLN = $('#'+SN.C.S.NoticeLocationName); + var NLN = $('#'+SN.C.S.NoticeGeoName); if (NLN.length > 0) { NLN.remove(); } - if ($('#'+SN.C.S.NoticeDataGeo).attr('checked') === true || $.cookie(SN.C.S.NoticeLocationCookieName) === null) { + if ($('#'+SN.C.S.NoticeDataGeo).attr('checked') === true || $.cookie(SN.C.S.NoticeDataGeo) === null) { $('label[for='+SN.C.S.NoticeDataGeo+']').addClass('checked'); var S = '
'; @@ -563,9 +561,9 @@ var SN = { // StatusNet } NDGS = $('#'+SN.C.S.NoticeDataGeoSelected); - NDGS.prepend('Geo '); + NDGS.prepend('Geo '); - var NLN = $('#'+SN.C.S.NoticeLocationName); + var NLN = $('#'+SN.C.S.NoticeGeoName); NLN.addClass('processing'); $('#'+SN.C.S.NoticeDataGeoSelected+' button.close').click(function(){ @@ -582,7 +580,7 @@ var SN = { // StatusNet return false; }); - if ($.cookie(SN.C.S.NoticeLocationCookieName) === null || $.cookie(SN.C.S.NoticeLocationCookieName) == 'disabled') { + if ($.cookie(SN.C.S.NoticeDataGeo) === null || $.cookie(SN.C.S.NoticeDataGeo) == 'disabled') { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition( function(position) { @@ -623,17 +621,17 @@ var SN = { // StatusNet } } else { - var cookieValue = JSON.parse($.cookie(SN.C.S.NoticeLocationCookieName)); + var cookieValue = JSON.parse($.cookie(SN.C.S.NoticeDataGeo)); $('#'+SN.C.S.NoticeLat).val(cookieValue.NLat); $('#'+SN.C.S.NoticeLon).val(cookieValue.NLon); $('#'+SN.C.S.NoticeLocationNs).val(cookieValue.NLNS); $('#'+SN.C.S.NoticeLocationId).val(cookieValue.NLID); $('#'+SN.C.S.NoticeDataGeo).attr('checked', cookieValue.NDG); - $('#'+SN.C.S.NoticeLocationName) - .replaceWith(''); + $('#'+SN.C.S.NoticeGeoName) + .replaceWith(''); - $('#'+SN.C.S.NoticeLocationName) + $('#'+SN.C.S.NoticeGeoName) .attr('href', cookieValue.NLNU) .text(cookieValue.NLN) .click(function() { diff --git a/lib/noticeform.php b/lib/noticeform.php index 99865645a..ddfe45055 100644 --- a/lib/noticeform.php +++ b/lib/noticeform.php @@ -207,7 +207,7 @@ class NoticeForm extends Form $this->out->hidden('notice_data-location_id', empty($this->location_id) ? (empty($this->profile->location_id) ? null : $this->profile->location_id) : $this->location_id, 'location_id'); $this->out->hidden('notice_data-location_ns', empty($this->location_ns) ? (empty($this->profile->location_ns) ? null : $this->profile->location_ns) : $this->location_ns, 'location_ns'); - $this->out->elementStart('div', array('id' => 'notice_data-location_wrap', + $this->out->elementStart('div', array('id' => 'notice_data-geo_wrap', 'title' => common_local_url('geocode'))); $this->out->checkbox('notice_data-geo', _('Share your location'), true); $this->out->elementEnd('div'); diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 2031aed21..cdacb9a62 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -555,7 +555,7 @@ margin-bottom:0; line-height:1.618; } .form_notice #notice_data-attach_selected code, -.form_notice #notice_data-location_name { +.form_notice #notice_data-geo_name { float:left; width:80%; display:block; @@ -575,7 +575,7 @@ font-size:0.8em; float:left; } -.form_notice #notice_data-location_wrap label { +.form_notice #notice_data-geo_wrap label { position:absolute; top:25px; right:4px; @@ -585,16 +585,16 @@ width:16px; height:16px; display:block; } -.form_notice #notice_data-location_wrap input { +.form_notice #notice_data-geo_wrap input { display:none; } -.form_notice #notice_data-location_wrap label { +.form_notice #notice_data-geo_wrap label { font-weight:normal; font-size:1em; margin-bottom:0; text-indent:-9999px; } -.form_notice #notice_data-location_name { +.form_notice #notice_data-geo_name { display:block; padding-left:21px; } diff --git a/theme/default/css/display.css b/theme/default/css/display.css index 1fe2bd569..2360976e5 100644 --- a/theme/default/css/display.css +++ b/theme/default/css/display.css @@ -111,10 +111,10 @@ box-shadow:3px 3px 3px rgba(194, 194, 194, 0.1); text-shadow:none; } -.form_notice span#notice_data-location_name { +.form_notice span#notice_data-geo_name { background-position:0 47%; } -.form_notice a#notice_data-location_name { +.form_notice a#notice_data-geo_name { background-position:0 -1711px; } .form_notice label[for=notice_data-geo] { @@ -192,7 +192,7 @@ button.close, .entity_silence input.submit, .entity_delete input.submit, .notice-options .repeated, -.form_notice a#notice_data-location_name, +.form_notice a#notice_data-geo_name, .form_notice label[for=notice_data-geo], button.minimize { background-image:url(../../base/images/icons/icons-01.gif); diff --git a/theme/identica/css/display.css b/theme/identica/css/display.css index dd02de6b9..91af1d8ec 100644 --- a/theme/identica/css/display.css +++ b/theme/identica/css/display.css @@ -111,10 +111,10 @@ box-shadow:3px 3px 3px rgba(194, 194, 194, 0.1); text-shadow:none; } -.form_notice span#notice_data-location_name { +.form_notice span#notice_data-geo_name { background-position:0 47%; } -.form_notice a#notice_data-location_name { +.form_notice a#notice_data-geo_name { background-position:0 -1711px; } .form_notice label[for=notice_data-geo] { @@ -192,7 +192,7 @@ button.close, .entity_silence input.submit, .entity_delete input.submit, .notice-options .repeated, -.form_notice a#notice_data-location_name, +.form_notice a#notice_data-geo_name, .form_notice label[for=notice_data-geo], button.minimize { background-image:url(../../base/images/icons/icons-01.gif); -- cgit v1.2.3-54-g00ecf From 8901e01692e6010a371a4aa2e5a9b3649e0bcc2f Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Fri, 8 Jan 2010 18:07:02 +0000 Subject: Added i18n text for @title values in geo sharing actions --- js/util.js | 6 +++--- lib/noticeform.php | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/noticeform.php') diff --git a/js/util.js b/js/util.js index 4e588a3b6..0314668d9 100644 --- a/js/util.js +++ b/js/util.js @@ -480,7 +480,7 @@ var SN = { // StatusNet var NDGe = $('#'+SN.C.S.NoticeDataGeo); function removeNoticeDataGeo() { - $('label[for='+SN.C.S.NoticeDataGeo+']').removeClass('checked'); + $('label[for='+SN.C.S.NoticeDataGeo+']').removeClass('checked').attr('title', jQuery.trim($('label[for='+SN.C.S.NoticeDataGeo+']').text())); $('#'+SN.C.S.NoticeDataGeoSelected).hide(); $('#'+SN.C.S.NoticeLat).val(''); @@ -566,7 +566,7 @@ var SN = { // StatusNet } if ($('#'+SN.C.S.NoticeDataGeo).attr('checked') === true || $.cookie(SN.C.S.NoticeDataGeoCookie) === null) { - $('label[for='+SN.C.S.NoticeDataGeo+']').addClass('checked'); + $('label[for='+SN.C.S.NoticeDataGeo+']').addClass('checked').attr('title', NoticeDataGeoShareDisable_text); var S = '
'; var NDGS = $('#'+SN.C.S.NoticeDataGeoSelected); @@ -579,7 +579,7 @@ var SN = { // StatusNet } NDGS = $('#'+SN.C.S.NoticeDataGeoSelected); - NDGS.prepend('Geo '); + NDGS.prepend('Geo '); var NLN = $('#'+SN.C.S.NoticeGeoName); NLN.addClass('processing'); diff --git a/lib/noticeform.php b/lib/noticeform.php index ddfe45055..f0b704e87 100644 --- a/lib/noticeform.php +++ b/lib/noticeform.php @@ -209,8 +209,10 @@ class NoticeForm extends Form $this->out->elementStart('div', array('id' => 'notice_data-geo_wrap', 'title' => common_local_url('geocode'))); - $this->out->checkbox('notice_data-geo', _('Share your location'), true); + $this->out->checkbox('notice_data-geo', _('Share my location'), true); $this->out->elementEnd('div'); + $this->out->inlineScript(' var NoticeDataGeoShareDisable_text = "'._('Do not share my location.').'";'. + ' var NoticeDataGeoInfoMinimize_text = "'._('Hide this info').'";'); } Event::handle('EndShowNoticeFormData', array($this)); -- cgit v1.2.3-54-g00ecf