Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#133 2014-09-30 17:08:06

gfdesign
Member
From: Argentina
Registered: 2009-04-20
Posts: 401

Re: adi_matrix – Multi-article update tabs

gomedia wrote #284357:

Unfortunately not, sorry … life & clients have taken over somewhat. I haven’t even managed to officially release 2.0. I’ve still got your list of excellent suggestions, as well as some from mrdale. One day, I’ll get organised.

Don’t worry and don’t hurry. I understand how it’s :)
Thanks for replying me.
We’re in touch.
Regards

Offline

#134 2015-05-24 20:40:13

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: adi_matrix – Multi-article update tabs

Live Geocoder Script for adi_matricies…

I have a geocoder script written by manfre for the write page. With the help of that clever bastard Igner I adapted this geocoder to work with multiple articles on a matrix page.

What it does

  1. An editor enters info into or updates designated address, city, state, zip custom_fields
  2. The script looks up the address in google maps API which returns Lat and Long values
  3. The Lat and Long values get pushed into corresponding Lat and Long custom fields.

On save your article now has pre-geocoded locations.

The Script

You’ll have to load the script somehow, either with jmd_admin_js or bot_write_tab_customize and change the custom field numbers according to your setup.

<script type="text/javascript" src="//maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function($) {
    $(function() {
        $(".adi_matrix_matrix tr").each(function() {
            $('input[name*="custom_4"],input[name*="custom_5"],input[name*="custom_6"],input[name*="custom_7"]').blur(function() {
                var row = $(this).parents('tr');
                // now set your variables
                var geocoder = new google.maps.Geocoder();
                var address = $('input[name*="custom_4"]', row); //4
                var city = $('input[name*="custom_5"]', row); //5
                var state = $('input[name*="custom_6"]', row); //6
                var zip = $('input[name*="custom_7"]', row); //7
                var lat = $('input[name*="custom_11"]', row); //11
                var lng = $('input[name*="custom_12"]', row); //12
                // probably good to test that they're all non-null
                if (address != undefined && city != undefined && state != undefined && zip != undefined) {
                    var a = address.val() + ' ' + city.val() + ' ' + state.val() + ' ' + zip.val();
                    geocoder.geocode({
                        'address': a
                    }, function(results, status) {
                        if (status == google.maps.GeocoderStatus.OK) {
                            var x = results[0].geometry.location.lat();
                            var y = results[0].geometry.location.lng();
                            lat.val(x);
                            lng.val(y);
                            if (console && console.log) {
                                console.log('Geocoded address "' + a + '" ' + x + ',' + y);
                            }
                        } else {
                            if (console && console.log) {
                                console.log('Geocode failed with status ' + status + '; address=' + a);
                            }
                        }
                    });
                }
            });
        });
    });
})(jQuery);
</script>

Write Page version (for extra points)

<script type="text/javascript">
(function($){
	$(function(){
		var geocoder = new google.maps.Geocoder();
		var address = $('#custom-4');
		var city = $('#custom-5');
		var state = $('#custom-6');
		var zip = $('#custom-7');
		var lat = $('#custom-11');
		var lng = $('#custom-12');
		$('#custom-4, #custom-5, #custom-6, #custom-7').blur(function(){
			var a = address.val() + ' ' + city.val() + ' ' + state.val() + ' ' + zip.val();
			geocoder.geocode( { 'address': a }, function(results, status) {
				if (status == google.maps.GeocoderStatus.OK) {
					var x = results[0].geometry.location.lat();
					var y = results[0].geometry.location.lng();
					lat.val(x);
					lng.val(y);
					if (console && console.log){
						console.log('Geocoded address "' + a + '" ' + x + ',' + y);
					}
				} else {
					if (console && console.log){
						console.log('Geocode failed with status ' + status + '; address=' + a);
					}
				}
			});
		});
	});
})(jQuery);
</script>

enjoy!

Offline

#135 2015-05-24 21:52:45

joebaich
Member
From: DC Metro Area and elsewhere
Registered: 2006-09-24
Posts: 507
Website

Re: adi_matrix – Multi-article update tabs

Good to have! Thanks very much.

Offline

#136 2015-05-24 22:00:22

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: adi_matrix – Multi-article update tabs

mrdale wrote #291041:

Live Geocoder Script for adi_matricies…

Holy crap!

Offline

#137 2015-08-04 04:21:37

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: adi_matrix – Multi-article update tabs

I’m just about ready to release a new version of adi_matrix but being of an (occasionally) cautious disposition, I’m looking for some volunteer guinea pigs to test the final beta.

From the draft release notes:

  • enhancements:
    • publish & delete articles (for mrdale)
    • extra article data options: title, section
    • show sections
    • added section & author to article title tooltip
    • matrix under Content or Home tab
    • improved validation error messages
    • custom WHERE clause conditions
    • article list paging
  • requires TXP 4.5+
  • tested on TXP 4.6
  • fix: matrix privileges
  • improved validation message (URL-only titles)
  • article edit link styling
  • and as Apple says “Includes general performance and stability improvements”, as well as code “sanity” improvements for my sake

As adi_matrix mucks around with articles en masse, please take precautions – i.e. backups.

Thanks in advance.

Offline

#138 2015-09-09 05:31:22

gfdesign
Member
From: Argentina
Registered: 2009-04-20
Posts: 401

Re: adi_matrix – Multi-article update tabs

Hi Adi.
Today I’ve discovered the last version of your plugin. Unfortunately the notification email are not working normally. I have to say it’s much better than I thought.

The only thing I would include would be a thumbimage in order to have a quick look about the article we want to modify.

Once again, thanks a lot for this and your other plugins.
Regards

Offline

#139 2015-09-09 09:40:39

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: adi_matrix – Multi-article update tabs

gfdesign wrote #294559:

Today I’ve discovered the last version of your plugin. Unfortunately the notification email are not working normally.

There’s something funny going on today as well – I got 17 email notifications in one blast.

I have to say it’s much better than I thought.

Phew! BTW I’ve still got all your excellent suggestions from a while ago … at some stage I’ll spent some time on the matrix admin UI side of things.

The only thing I would include would be a thumbimage in order to have a quick look about the article we want to modify.

Interesting idea. When you say “thumb image” what did you have in mind? Some sort of excerpt?

Once again, thanks a lot for this and your other plugins.

My pleasure.

Last edited by gomedia (2015-09-09 09:50:31)

Offline

#140 2015-09-09 12:59:39

maverick
Member
From: Southeastern Michigan, USA
Registered: 2005-01-14
Posts: 976
Website

Re: adi_matrix – Multi-article update tabs

gomedia wrote #294574:

There’s something funny going on today as well – I got 17 email notifications in one blast.

Incident: Outgoing Mail not being sent

Offline

#141 2015-09-10 01:06:39

gfdesign
Member
From: Argentina
Registered: 2009-04-20
Posts: 401

Re: adi_matrix – Multi-article update tabs

gomedia wrote #294574:

Interesting idea. When you say “thumb image” what did you have in mind? Some sort of excerpt?

Hi Adi
Take a look in this screen capture that I did about how the thumbimage would look like.

I guess it would be useful because the user would have an idea about the article, especially when articles share similar names. It’s just a suggestion :)
Unfortunatelly I don’t have programming skills, but anyway I want to know if I can help with something.
Best regards

Offline

#142 2015-09-10 05:24:51

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

Re: adi_matrix – Multi-article update tabs

gfdesign wrote #294593:

Hi Adi
Take a look in this screen capture that I did about how the thumbimage would look like.

Good idea but what happens if someone uses multiple images in the article_image field?


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#143 2015-09-10 05:34:44

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: adi_matrix – Multi-article update tabs

colak wrote #294609:

Good idea but what happens if someone uses multiple images in the article_image field?

Yes, that’s why it’s been in the too-hard-basket for a while, but maybe some sort of popup/floaty/lightbox/tooltip thing might work.

Offline

#144 2015-09-10 07:41:55

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,595
Website

Re: adi_matrix – Multi-article update tabs

maybe some sort of popup/floaty/lightbox/tooltip thing might work

UI-wise you could do it as an image carousel with left/right buttons to flick through, but if you want to see the image(s) change when you change the image id, then you’ll need to ajax-fetch the images when the input box changes…

Or you hook it up to bot_image_upload which opens a modified image panel in a lightbox.


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB