Reference PID of Current Object

44 views
Skip to first unread message

adam....@rochester.edu

unread,
Feb 4, 2016, 9:37:36 AM2/4/16
to islandora

Hi All,


This will probably sound like a silly question, but what is the best way to get the PID of the current object?  We're using Open Seadragon, so the PID does not appear in the URL of the page.  Ideally, I'm looking for a solution where I can write a block that gets the current PID, then uses that to pull display associated metadata from a MODS datastream.


Of course, I'm open to suggestions if I'm going about this the wrong way.


Thanks in advance!

Adam Traub

Jared Whiklo

unread,
Feb 4, 2016, 9:46:50 AM2/4/16
to isla...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Most of the time I see the use of menu_get_object[1]. Like here[2] in
the compound solution pack blocks. That is probably the easiest.

cheers,
jared

[1]
https://api.drupal.org/api/drupal/includes%21menu.inc/function/menu_get_
object/7
[2]
https://github.com/Islandora/islandora_solution_pack_compound/blob/fb1a5
16ebf2f1c6d87a7670a5134372f478dd2d9/includes/blocks.inc#L16
> -- For more information about using this group, please read our
> Listserv Guidelines:
> http://islandora.ca/content/welcome-islandora-listserv --- You
> received this message because you are subscribed to the Google
> Groups "islandora" group. To unsubscribe from this group and stop
> receiving emails from it, send an email to
> islandora+...@googlegroups.com
> <mailto:islandora+...@googlegroups.com>. Visit this group
> at https://groups.google.com/group/islandora. To view this
> discussion on the web visit
> https://groups.google.com/d/msgid/islandora/d0d4abad-8eef-4c94-8923-8b
142c200c04%40googlegroups.com
>
>
<https://groups.google.com/d/msgid/islandora/d0d4abad-8eef-4c94-8923-8b1
42c200c04%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

- --
Jared Whiklo
jwh...@gmail.com
- --------------------------------------------------
Junk is something you've kept for years and throw away three weeks
before you need it.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.14 (Darwin)

iEYEARECAAYFAlazZFcACgkQqhIY384dF1b6YACgiwYuipNECBEHggLtXoP1np1m
ZacAoJihClDtXaHAlA8hL7Ix6G2uzR3S
=N6Yj
-----END PGP SIGNATURE-----

adam....@rochester.edu

unread,
Feb 4, 2016, 4:12:47 PM2/4/16
to islandora
Jared,

Thanks!  That worked for when the URL reflects the PID and is much cleaner than my previous approach.  

However, when using OpenSeadragon, it tacks on a URL param instead of the actual PID.  So, to give some more details let's say I'm working with the chucknorris namespace:

chucknorris:1 is the PID of the volume

When paging through the content - let's say to from page 3 to page 4 - the URL changes to:

chucknorris:1?islandora_paged_content_page=4

While there's definitely an aspect of the entire page not reloading, even when I force a full page reload the value returned is still:  chucknorris:1

What am I missing?

Thanks again!
Adam


Jared Whiklo

unread,
Feb 4, 2016, 6:00:59 PM2/4/16
to isla...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

So it sounds like javascript and an AJAX call. I don't have alot of
experience with OpenSeadragon in this context, but I would look around
their javascript and see if you can't figure out when it returns the
new pages. Might have the information you are looking for.

cheers,
jared
> -- For more information about using this group, please read our
> Listserv Guidelines:
> http://islandora.ca/content/welcome-islandora-listserv --- You
> received this message because you are subscribed to the Google
> Groups "islandora" group. To unsubscribe from this group and stop
> receiving emails from it, send an email to
> islandora+...@googlegroups.com
> <mailto:islandora+...@googlegroups.com>. Visit this group
> at https://groups.google.com/group/islandora. To view this
> discussion on the web visit
> https://groups.google.com/d/msgid/islandora/e631dbae-a364-4d56-9d93-75
1e3460f4ad%40googlegroups.com
>
>
<https://groups.google.com/d/msgid/islandora/e631dbae-a364-4d56-9d93-751
e3460f4ad%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

- --
Jared Whiklo
jwh...@gmail.com
- --------------------------------------------------
You know you're from Winnipeg when...You are bundled up in three
sweaters, a parka, ski pants, a touque, two pairs of mittens, boots
past you knees in 3 feet of snow in a -35 (-8000 with the windchill)
blizzard, your eyelashes are frozen together, your nose is running,
your can't feel your toes, and you stop at 7-11 for a Slurpee on the
way home.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.14 (Darwin)

iEYEARECAAYFAlaz2CcACgkQqhIY384dF1a85wCgqbkrfAdN4AtNmhaa0jlXJPjM
KvwAnj7yLeenuGrO5e7BLEodAyvi53vo
=FGRJ
-----END PGP SIGNATURE-----

Nelson Hart

unread,
Feb 4, 2016, 6:09:28 PM2/4/16
to isla...@googlegroups.com
something like so?

$object = islandora_object_load('pid from url');
$pages = islandora_paged_content_get_pages($object);

pull out the current page from $pages array using this URL param islandora_paged_content_page?



To unsubscribe from this group and stop receiving emails from it, send an email to islandora+...@googlegroups.com.

Jared Whiklo

unread,
Feb 5, 2016, 10:46:31 AM2/5/16
to isla...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Perfect, there you go Adam.

Thanks Nelson.

cheers,
jared

On 2016-02-04 5:09 PM, Nelson Hart wrote:
> something like so?
>
> $object = islandora_object_load('pid from url'); $pages =
> islandora_paged_content_get_pages($object);
>
> pull out the current page from $pages array using this URL param
> islandora_paged_content_page?
>
>
>
> On Thu, Feb 4, 2016 at 7:00 PM, Jared Whiklo <jwh...@gmail.com
> <mailto:jwh...@gmail.com>> wrote:
>
> So it sounds like javascript and an AJAX call. I don't have alot
> of experience with OpenSeadragon in this context, but I would look
> around their javascript and see if you can't figure out when it
> returns the new pages. Might have the information you are looking
> for.
>
> cheers, jared
>
> On 2016-02-04 3:12 PM, adam....@rochester.edu
> <mailto:adam....@rochester.edu> wrote:
>> Jared,
>
>> Thanks! That worked for when the URL reflects the PID and is
>> much cleaner than my previous approach.
>
>> However, when using OpenSeadragon, it tacks on a URL param
>> instead of the actual PID. So, to give some more details let's
>> say I'm working with the chucknorris namespace:
>
>> chucknorris:1 is the PID of the volume
>
>> When paging through the content - let's say to from page 3 to
>> page 4 - the URL changes to:
>
>> chucknorris:1?islandora_paged_content_page=4
>
>> While there's definitely an aspect of the entire page not
>> reloading, even when I force a full page reload the value
>> returned is still: chucknorris:1
>
>> What am I missing?
>
>> Thanks again! Adam
>
>
>> -- For more information about using this group, please read our
>> Listserv Guidelines:
>> http://islandora.ca/content/welcome-islandora-listserv --- You
>> received this message because you are subscribed to the Google
>> Groups "islandora" group. To unsubscribe from this group and
>> stop receiving emails from it, send an email to
>> islandora+...@googlegroups.com
> <mailto:islandora%2Bunsu...@googlegroups.com>
>> <mailto:islandora+...@googlegroups.com
> <mailto:islandora%2Bunsu...@googlegroups.com>>. Visit this
> <https://groups.google.com/d/msgid/islandora/e631dbae-a364-4d56-9d93-7
51
>
>
e3460f4ad%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/islandora/e631dbae-a364-4d56-9d93-7
51
> -- For more information about using this group, please read our
> Listserv Guidelines:
> http://islandora.ca/content/welcome-islandora-listserv --- You
> received this message because you are subscribed to the Google
> Groups "islandora" group. To unsubscribe from this group and stop
> receiving emails from it, send an email to
> islandora+...@googlegroups.com
> <mailto:islandora%2Bunsu...@googlegroups.com>. Visit this group
> at https://groups.google.com/group/islandora. To view this
> discussion on the web visit
> https://groups.google.com/d/msgid/islandora/56B3D827.6080007%40gmail.c
om.
>
>
For more options, visit https://groups.google.com/d/optout.
>
>
> -- For more information about using this group, please read our
> Listserv Guidelines:
> http://islandora.ca/content/welcome-islandora-listserv --- You
> received this message because you are subscribed to the Google
> Groups "islandora" group. To unsubscribe from this group and stop
> receiving emails from it, send an email to
> islandora+...@googlegroups.com
> <mailto:islandora+...@googlegroups.com>. Visit this group
> at https://groups.google.com/group/islandora. To view this
> discussion on the web visit
> https://groups.google.com/d/msgid/islandora/CAAPjPt5kWqT%2BFXHmd9sNvjT
S2GJu4Dd1FQTtwKi9M-z-trywjQ%40mail.gmail.com
>
>
<https://groups.google.com/d/msgid/islandora/CAAPjPt5kWqT%2BFXHmd9sNvjTS
2GJu4Dd1FQTtwKi9M-z-trywjQ%40mail.gmail.com?utm_medium=email&utm_source=
footer>.
> For more options, visit https://groups.google.com/d/optout.
- --
Jared Whiklo
jwh...@gmail.com
- --------------------------------------------------
People will believe anything if you whisper it.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.14 (Darwin)

iEYEARECAAYFAla0w9IACgkQqhIY384dF1Z9+ACgjyLdIlE1nQg4G35n1TYKFU9c
vNEAoLpzGhixOx3AAp8RsIge6xCL5sMz
=m5lO
-----END PGP SIGNATURE-----

adam....@rochester.edu

unread,
Feb 8, 2016, 9:26:28 AM2/8/16
to islandora
Right on - thank you, both!

I'll give it a shot and see what I come up with.

Cheers,
Adam 
Reply all
Reply to author
Forward
0 new messages