I think it would be useful to be able to show a block for each location. If you think this could be useful, I'll write a patch.

Comments

tjodolv’s picture

This could absolutely be useful to some people, but there would still be a need for letting people just keep all locations in one block. A patch, at least a "proof of concept", would be appreciated. I'm back from traveling, and will be starting on some other issues. If you have the time, feel free :)

held69’s picture

Are there any developments on this patch?

Would be great if this patch came out.
I'm not a coder but i would be glad to test things out.

Thanks

subscribing

tjodolv’s picture

Hello there. I have not had the time to work on this yet, but I will, when I get the time. Until then, I appreciate any usable code :)

blackdog’s picture

Version: 6.x-1.6 » 6.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new3.32 KB

Here's a quick proof of concept.

I created a separat function to fetch all locations, creates a block for each location and the default block with all location data. Also changes the theme function to check for a single location, and changes the block output to not show just the credit if the row object is empty.

held69’s picture

Great!

I'll check it out, and report back.

held69’s picture

StatusFileSize
new13.97 KB

I used the patch and all seem to work very well :)

However there seem to be a little problem, allthough i dont know if this is due to the patch.

When i click the forecast link in the weather block, i get to a page where there is a forecast for coming days, for that location.

Some of the days on that page are doubled or repeated for some reason.(see attachment) ......

This is the case with each forecast page for each location.

tjodolv’s picture

Assigned: Unassigned » tjodolv

Hello again. I finally have some free time on my hands, so I will look into this today. Strange issue with the duplicated forecast periods, but I'll try to track it down.
Thanks for the patch, blackdog!

tjodolv’s picture

Ok, I've used the concept in blackdog's patch, and added this feature. I also made this an administrative setting, disabled by default. I made it disabled by default, since your block regions can become quite cluttered if you have more than two locations stored.

I have not seen the issue reported by held69 in #6, but please check it out anyway. Might be something else that's causing it.

It should show up in a new dev snapshot within a day. Please test and let me know of any problems :)

blackdog’s picture

Status: Needs review » Fixed

Great! I'll set this to fixed then?

tjodolv’s picture

Sure :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jisuo’s picture

StatusFileSize
new20.87 KB

I also get duplicated days, see screenshot. This is using http://website.com/yr_verdata/1

edit: nvm, it might not be a bug at all...

held69’s picture

Version: 6.x-1.x-dev » 6.x-2.0
Category: feature » support
Status: Closed (fixed) » Active

With succes i have applied the patch under #4.

However when i trie to upgrade to 6.x-2.0 i loose all my weather blocks (per location).
Without result i have tried to apply the patch to yr_verdata-6.x-2.0.

patch fails at line 111,364 and 403.

Help appreciated...

thanks

tjodolv’s picture

Hello there. The blocks are defined differently in the 6.x-2.x branch, and because of that, Drupal's block system "forgets" them when you upgrade. All you have to do is to go to the settings page for the module and activate the multiblocks again (and maybe also re-enable them on the block settings page; if you have a lot of locations with custom settings, you'll have to do a manual backup of the visibility settings and re-apply them afterwards).

held69’s picture

Thanks for your swift reply.

I have applied the update on a localhost and activated all the blocks.
Indeed i have to re-enable all my blocks (100) and put all the custom visibilitye settings back.
Will take quit some effort.

Would this all be necessary with each upgrade?

The reason for my update were these warnings i kept receiving:
warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "sites/default/files/yr_verdata/a7d79df259b28b1ef0b6132d58a99dc0" in C:\wamp\www\mysite\sites\all\modules\yr_verdata\yr_verdata.module on line 423

However it looks like i'm still getting these warnings....

Let me know if i should make a different issue for this

Thanks

tjodolv’s picture

Version: 6.x-2.0 » 6.x-2.2

About the multiblocks being forgotten, I will try to prevent this problem in future updates.

The warning you get is because the module cannot find an xml file it is looking for. If you have cleared the caches and run cron, but still get the update, you might need to edit the database entry for that location and add .xml to the filename. The .xml should have been added when the location was first added, but... Not sure why that happened...

held69’s picture

StatusFileSize
new21.49 KB
new22.06 KB

It would be a great time saver updating without the re-enable proces.
Thanks

Clearing caches and running cron didn't take the warnings away.
I have openened the database entries of two locations, one with the error and another without the error.
However they look quit the same.

Where should i put .xml in the entry.......

tjodolv’s picture

This seems very strange. I guess you could try deleting the location and re-adding it. That's not a very elegant solution, and I have to apologize for the inconvenience. I'll try to reproduce the error and see if I can figure out why it happens.

tjodolv’s picture

Status: Active » Postponed

Hello again. I have not been able to reproduce this error, but I think it may be because I have been sloppy in the past when writing update hooks. The only thing I can do at this point is really to be more thorough with update hooks in the future.

held69’s picture

Thanx!