Closed (outdated)
Project:
Event
Version:
5.x-2.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
4 Jan 2006 at 09:03 UTC
Updated:
13 Apr 2018 at 20:57 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
drewish commentedI'll save killes the trouble and suggest that a patch would be most welcome.
Comment #2
killes@www.drop.org commentedYep. Especially since I have absolutely no clue about Ajax. :p
Comment #3
markus_petrux commentedYou may want to check out this:
http://www.jonabad.com/livecalendar/
It's a WordPress plugin that exactly does this. A demo can be found at the very bottom of the page.
Comment #4
ahoeben commentedTook me a while, but it works (and degrades nicely).
Notes:
Is there a call I can make from inside a _block hook to know the id of the div the block gets put in?
Comment #5
amanuel commentedWould be nice to move the JS out of the html (the onclick for example) to keep things nice and clean. Make the JS truly unobtrusive (http://www.onlinetools.org/articles/unobtrusivejavascript/).
Otherwise it looks good.
Comment #6
ahoeben commentedAnswering my own third question: *If* the user has not changed the default theming for a block, the calendar block should always be inside a div with id "block-event-0".
In order to remove the ugly <div> from the patch, I'ld have to either refresh the entire block (including the block title, going halfway through the theming system), or find the <div> with class = "content" in the block <div>, again provided the user has not changed the default theming for blocks.
Would that be worth the effort, or do we want to keep the hack? We could rename the added <div> to block-event-0-content to get in line with the (default) block naming.
Comment #7
scroogie commentedFor me the work-around sounds more like a hack than the extra-diff. Like the change though, hope this gets committed.
Comment #8
scroogie commentedI meant extra-div of course.
Comment #9
markus_petrux commentedI also think you could move all javascript to a separate file. In this file you could create an onload event handler, and here searchn for the calendar block, attach the onclick events, etc.
I would also add a small animation (similar to the one used in autocomplete fields) to be shown while waiting for the AJAX method to process the request and rebuild the block.
Comment #10
markus_petrux commentedI forgot to add that maybe the javascript part could be made as a reusable component, so other calendar-like modules could use the same method.
Comment #11
ahoeben commentedI'll be implementing the javascript suggestions later this week (thanks for the hints), unless someone beats me to it.
It would indeed be usefull to make what I do in js reuable for other other (calendar) modules such as the archive module, but I think that should be true for the full calendar block (not just the javascript). But ofcourse, that's a bigger task...
About my <div> hack... I thought of a way to make this <div> itself themeable. More about that later.
Comment #12
Thox commentedIf you make a "loading" widget then we've got the progress bar already and the little spinning icon.
AFAIK, all JS in Drupal is currently in external files (e.g. upload.js). This would be a little cleaner in my opinion, but not really essential.
Lastly, I've not got event module around to see, but I'm assuming that you haven't declared $file - so in fact you're probably outputting an extra useless script tag in the HTML. This might be better off as
drupal_add_js('misc/drupal.js');, although that seems just as bad.Comment #13
ahoeben commentedNew patch, externalises all javascript in an additional javascript file 'eventblock.js' (see next post)
This is a separate file from event.js, since eventblock is for the block, and event.js for the full page event. The block may be on pages where the full page calendar is not, and vice versa.
Comment #14
ahoeben commentedHere's the eventblock.js for the patch above.
The blockupdater function could eventually grow into it's own file living in /misc, I have written it so it can be used to update other blocks as well.
Comment #15
ahoeben commentedLeft to do:
Comment #16
markus_petrux commentedFor the firefox issue: Have you tried createElement("a") instead of createElement("A") ?
Comment #17
ahoeben commentedNo, it was missing support for element.innerText.
New version of eventblock.js has a cancel button in Firefox, and removes the 'Updating block' caption since it annoyed me (and serves no real purpose; what else could be going on?)
Comment #18
killes@www.drop.org commentedIt's a shame I never looked at this.
Could this be reworked into using jquery?
Comment #19
snufkin commentedupdated the patch for the actual 4.7 (no real change, just patch update, will try to update for HEAD)
Comment #20
snufkin commentedcant believe its been only one day. my first work on AJAX stuff, voila.
patch for the module and theme in this post, javascript file in the next one.
Comment #21
snufkin commentedjavascript port for HEAD with jquery.
Comment #22
ahoeben commentedIt would be great if the block update mechanism could somehow be abstracted into something that could eventually be moved to core. That's why I originally chose a 'generic' name in the javascript (blockUpdater instead of eventBlockUpdater), but that might actually not be a smart thing to do if this actually gets moved to core or a generic contrib module.
Comment #23
ahoeben commentedUpdated patch looks good, but have not tested (I currently have no 5.x site with event.module)
Comment #24
killes@www.drop.org commentedI tried it, one chunk of the patch failed, I fixed that manually (and attach the patch here). However, I am not able to discover any evidence of Ajaxification.
Ok, found the problem: The vevntblock.js file was not where the patch expected it to be, I've fixed that. However, there is still a problem: The page is still changed to the general calendar. I think the idea is to not change the rest of the page, but only reload the event block.
Comment #25
snufkin commentedkilles: you removed the event.theme part from the patch, that is required, otherwise it considers the click as normal navigation.
Comment #26
killes@www.drop.org commentedevent.theme included again.
I had used the patcheed version on my test setup.
Comment #27
snufkin commentedafter an incredibly long battle with jQuery, here it is: the (supposed) eventblock.js for Drupal 5
There is a glitch I have no clue how to fix: the cancel button sometimes doesnt stop the process correctly, as if it were disregarding it.
Comment #28
killes@www.drop.org commentedI've commited this to the HEAD branch. If there are no complaints, I'll port it to the Drupal 5 branch.
Comment #29
(not verified) commentedComment #30
baloneysammitch commentedI updated to jQuery 1.2 and the code no longer works. It seemed to not like href():
$(this).href() is not a funciton
So I replaced href() with attr("href") and it seemed to at least get past that point. I'm lost as to why it isn't updating the block though.
Comment #31
japerryEvent for Drupal 8 is unrelated to older versions. If an issue similar to this one exists, please open a new issue with the 8.x branch.