Consider two possible tricks:
(1) Use an Iframe -- generate whatever dynamic content and place the iframe
in the lens. When the lens instantiates,
iframe generates a separate request and places HTML results in the
iframe. This is considered "cheating" in the
AJAX world because it's guaranteeably simple and reliable and there's
no chance of it breaking in some unexpected way , plus it won't
behave differently on every operating system, browser, browser version.
Where's the fun in that?
(2) Consider also using the lens ex:onshow callback
http://www.mail-archive.com/[email protected]/msg02306.html
>> [[[ 4 ]]]
>> ex:onshow attribute in a lens template gets executed when the lens is
>> used to render an item. For example,
>>
>> <div ex:role="lens" ex:onshow="this.style.background =
>> 'blue';">...</div>
>>
>> causes the lens to always be blue. (Of course you could have just used
>> style="background: blue".) Use this.getAttribute('ex:itemID') to
>> get the
>> ID of the item. An elaborate example would include a lens template
>> like this
>>
>> <div ex:role="lens" ex:onshow="prepareLens(this);">
>> ...
>> <div ex:id-subcontent="tab1-{{value}}">...</div>
>> <div ex:id-subcontent="tab2-{{value}}">...</div>
>> ...
>> </div>
>>
>> together with some Javascript like this
>>
>> function prepareLens(elmt) {
>> var itemID = elmt.getAttribute("ex:itemID");
>> var tab1 = document.getElementById("tab1-" + itemID);
>> var tab2 = document.getElementById("tab2-" + itemID);
>> ...
>> }
Although in my case, i was unable to get ex:onshow to work "portably"
and reliably on IE for my needs, which was to put my Xwiki integration
of the JWPlayer
<http://nielsmayer.com/xwiki/bin/view/Macros/JWPlayerJSPL_Test> flash
media player in a popup bubble. That's a somewhat unusual application
where SWFobject 2.2 attempts to portably run a flash player out of
javascript by replacing a given DIV in the document with the flash
player. One of the issues with lenses is that they strip out any ID's
from the lens-template, leaving only names or classes. I attempted to
use ex:onshow to programmatically find the correct div (named by
class) and then forcibly give it a name/id in order to get swfobject
2.2. to work. This worked fine on Safari&Firefox, but failed on IE due
to timing issues. It was all good in the end because it forced me to
do the right thing, which is to put the player in it's own viewpanel,
and now I just have to get it to appropruiately hide/display some
facets based on switching viewpanels:
http://nielsmayer.com/xwiki/bin/view/Exhibit/NPRpods3 (shift-reload
because i'm updating often).
http://nielsmayer.com
On Wed, Jul 8, 2009 at 8:10 AM, JohnM <[email protected]> wrote:
>
> Hi all,
>
> Apologies in advance if this question has already been answered here
> -- I've done a few searches of past posts and haven't found anything
> directly relevant, but since I'm new to the group I may be overlooking
> the obvious...
>
> I have an exhibit on a group of authors and selected people who appear
> in their work. At the moment, I have a map view that allows a user to
> select an individual author on the map and then see some simple
> information (dates of birth/death, location of birth/death, etc.) in
> the popup. But I'd also like to be able to make a call to a web
> service and append the response at the bottom of the popup. For
> instance, I'd like to have a link that says something like "See works
> by this author" that, when clicked by the user, queries our database
> of texts and returns a list of books that can be appended after the
> link.
>
> That seems pretty straightforward to me, but everything I've tried has
> failed miserably and I'm hoping folks here can give me some pointers
> in the right direction. The exhibit is currently on a local machine,
> so I can't post a link, but here's the code I have at the moment:
>
> The relevant line in the exhibit lens that controls the map popups:
>
> <a ex:content="if(contains(.personal_role, 'author'), 'Texts by this
> author', ' ')" ex:id-subcontent="{{value}}" class="title-link"></a>
>
> The {{value}} in question is the unique name authority id we've
> assigned to the person, and can be used to query our internal
> database. The output looks something like <a id="pwheatley.boe"
> class="title-link"><span>Texts by this author</span></a>.
>
> Then, using jQuery in no-conflict mode to handle the AJAX request,
> I've tried to do something like this:
>
> $("a.title-link").click(function() {
> var nameKey = $(this).attr("id");
> $.ajax({
> type: "GET",
> url: "name-lookup.php?key=" + nameKey,
> success: function(data) {
> $(this).next("p").append(data);
> }
> });
> });
>
> (The PHP that's being called is just a simple page that runs resolves
> the unique name authority id to a particular set of title-level
> records. Nothing special there.)
>
> This method works flawlessly when I'm working with content that is
> "outside" of the exhibit -- elements that are hard-coded into a page,
> for example. But it doesn't work at all with content that's generated
> within Exhibit (it just does nothing), which makes me think that I'm
> missing something obvious in the way that jQuery interfaces with the
> Exhibit components. Can anyone point me in the right direction on
> this? Is there a better way to accomplish what I'm trying to do here?
> I should also mention that I'm not wedded to using jQuery for
> this...I've just grown accustomed to using it for other projects, so I
> thought I would use it here as well.
>
> Thanks in advance for the help!
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SIMILE Widgets" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/simile-widgets?hl=en
-~----------~----~----~----~------~----~------~--~---