jobad - localcomments module

4 views
Skip to first unread message

Joe Corneli

unread,
Nov 24, 2013, 12:57:57 PM11/24/13
to planet...@googlegroups.com, tkw0...@gmail.com, yan...@ymail.com
After enabling the localcomments module on the PlanetMath dev site and
turning it on for "articles", I see the following errors when I browse
to an article:

Notice: Undefined property: stdClass::$field_type in
localcomments_getcomments() (line 48 of
/home/planetary/beta/sites/all/modules/jobad/localcomments/localcomments.module).
Notice: Undefined property: stdClass::$field_id in
localcomments_getcomments() (line 45 of
/home/planetary/beta/sites/all/modules/jobad/localcomments/localcomments.module).

The relevant bit of PHP code is
(https://github.com/KWARC/planetary/blob/master/sites/all/modules/jobad/localcomments/localcomments.module#L45-49):

$id = $node->field_id;
$id = @$id['und'][0]['value'] or "";

$type = $node->field_type;
$type = @$type['und'][0]['value'] or "";

Tom, can you tell me more about how this code is supposed to work?
As I mentioned on the list before, we have a volunteer at PlanetMath
who is interested in helping with JOBAD integration, but I'm not
having an easy time finding a working example that we can use to as a
starting point. Can you advise?

Joe Corneli

unread,
Nov 24, 2013, 3:23:24 PM11/24/13
to Tom Wiesing, planet...@googlegroups.com, yan...@ymail.com
Hi Tom:

Thanks for your reply! I hope we can work together to get a working
example of JOBAD-under-Planetary.

Here's one thing I can contribute: http://metameso.org/dev is a new,
more-or-less "out-of-the-box", Planetary installation. I can send you
login details for the site and server separately, and this would make
it possible for you to help me with the JOBAD integration issues - if
you have time, and if we can't figure them out in this conversation.

So far, after looking at the code a little more, I think what's going
on is that the localcomments module requires us to define additional
fields "id" and "type" for the forum node_type. I did that and got
past the error I was seeing before. I'm sure there's a way for us to
do that "in the code", but there's another small-but-important issue I
want to get past first before we try to clean things up.

I'm now able to load an example article:
http://metameso.org/dev/examplearticle-1 but I'm not seeing any
JOBAD-related user interface elements show up, e.g. when I right-click
on the text of the article. Can you think of why?

Like I said, I'll send you login details for the site & server.

Joe



On Sun, Nov 24, 2013 at 6:51 PM, Tom Wiesing <tkw0...@googlemail.com> wrote:
> Hi Joe,
>
> unfortunatly I have no idea where exactly the error is coming from as I
> wrote that code a long time ago. (Currently I do not even have a running
> Drupal / Planetary installation).
>
> From what I remember is that this function is supposed to look for existing
> local comments. It is searching for it with the help of a view. This is then
> passed on to the client side via drupal_add_js around line 15.
> Then the JavaScript parses the existing comments and tells JOBAD to display
> annotations in the right places.
> I can only guess that either the view is missing or I used a node type that
> is not installed on the planetary dev site.
>
>
> As for getting started with JOBAD: You can find the JOBAD documentation at
> http://kwarc.github.io/jobad/stable/. If you want an introduction on JOBAD
> you can also read http://kwarc.github.io/jobad/stable/doc/html/intro/. JOBAD
> itself works completly client side which is why Drupal in the localcomments
> module has to pass on data to the client.
>
>
> I hope that this helps,
> Tom

Joe Corneli

unread,
Nov 29, 2013, 10:28:16 AM11/29/13
to Tom Wiesing, Mihnea Iancu, yan...@ymail.com, planet...@googlegroups.com
Hi Mihnea:

Could you please clarify to me, Murray (yan...@ymail.com), and Tom a
bit more about the status of JOBAD integration in Planetary? Murray
is keen to get started helping integrate some of the existing JOBAD
work into PlanetMath, but we're confused about what's done already.
Tom helped me get the localcomments module working on a dev instance
of Planetary, but then suggested that maybe you already have more
advanced work completed on this (or related topics). If this is in
your branch of the Planetary code, could we work on bringing it into
the master branch?

Joe

Mihnea Iancu

unread,
Nov 29, 2013, 3:02:35 PM11/29/13
to planet...@googlegroups.com, Tom Wiesing, yan...@ymail.com
Dear Joe, all,

As far as I know, JOBAD is integrated into Planetary but setting it up so that it works is a matter of local installation on a per-instance basis. That means loading it on the appropriate pages, loading relevant JOBAD modules, and being careful to not get conflicts with JS libraries (e.g. bootstrap and jQuery versions).  In order to do that easily, one can use the API from the jobad module in planetary.
For example, on my instance (the OAFF) I have a hook_node_view implementation (in the oaff module currently, but I'm refactoring) that initializes JOBAD and some MMT-specific modules. You can check, as an example, the mmt_initialize() function at https://github.com/m-iancu/planetary/blob/758b2256d67827098cfb1eae657f95083037b037/sites/all/modules/mmt/mmt.module). That gets called in oaff_node_view whenever I have a node that has MMT content (so that JOBAD is set-up). There, I use the return value of mmt_initialize() (the instance name) to wrap the normal MMT-content with a <div id="instName" >  ... </div> node which tells JOBAD where to be active.

Now, regarding the local comments module, the best way to describe it is as still under development. A student over the summer (here at jacobs) did some work on stack-overflow-like, rated questions and answers nodes, and we have another student working on integrating that with local-comments. That work is not functional yet, and not yet commited.
So, the version you are using is the best we have so far, but we hope to have something better soon (a few weeks or, given the finals/holidays are coming, months).

Best,
Mihnea.


--
You received this message because you are subscribed to the Google Groups "Planetary Developers Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to planetary-de...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Joe Corneli

unread,
Nov 29, 2013, 3:12:22 PM11/29/13
to planet...@googlegroups.com, Tom Wiesing, yan...@ymail.com
Thanks Mihnea! Our concern is less about having the greatest version
of localcomments, and more about having a working and appropriate
version of the underlying JOBAD integration module. Thanks to Tom's
help so far, we do have a working version of that (... we may still
need to commit a few small changes from Tom). Hopefully that is
enough to get going with further modules and demos -- and hopefully
one or more that we can get into PlanetMath. We'll have a look at the
mmt_initialize function as another example soon.

Best,
Joe
Reply all
Reply to author
Forward
0 new messages