turnermm / Updatable-Snippets-for-Dokuwiki

Inserts updatable snippets into Dokuwiki pages
https://dokuwiki.org/plugin:snippets
GNU General Public License v2.0
6 stars 4 forks source link

JSINFO variable not set in snippets.php #3

Closed bitozoid closed 9 years ago

bitozoid commented 9 years ago

Where is the JSINFO variable set when loading exe/snippets.php? I see that tpl_metaheaders() writes its value, but it is not assigned anywhere. I get a javascript error when loading the popup window.

Looking at the source, JSINFO is set in doku.php, so it is not assigned when calling other php files. https://www.dokuwiki.org/devel:javascript?s[]=jsinfo#jsinfo

action.php does assign JSINFO but it does not reach script.js.

After some debugging, I see JSINFO set to null in the snippets popup.

turnermm commented 9 years ago

I can't reproduce this error. If you check the devel page cited above, you will find this: DokuWiki passes the global $JSINFO to JavaScript So there have to be two initial values: JSINFO[id] and JSINFO[namespace] I just uploaded a revision to action.php which assigns false $JSINFO['updatable'] in case that was the source of your problem. Which browser are you using?

bitozoid commented 9 years ago

JSINFO is set for any dokuwiki page, but not for the 'snippets' window, because you don't get there via doku.php. It is only defined in doku.php and mediamanager.php: http://xref.dokuwiki.org/reference/dokuwiki/_variables/JSINFO.html

I have tried with chrome and firefox. In chrome, I just edit a page, click on the snippets button (it opens the snippets windows), right click wherever in the snippets window, Inspect Element and I can see the error in the console.

turnermm commented 9 years ago

Well, I generally use firefox, but I just opened it in Chrome and inserted several snippets, both updatable and non-updatable and I don't see the error in the console. Apart from checking the console, does the plugin fail or does it work? Also what desktop platform are you on?

bitozoid commented 9 years ago

It does work. However, I added some code and realised about this error. screenshot 2015-05-07 at 14 46 04

bitozoid commented 9 years ago

I remember. The point was that 'qs' did not get assigned properly and replacement in templates did not work.

turnermm commented 9 years ago

First, as I mentioned above, I added a false value to $JSINFO[updatable] in action.php, in case that was the problem. As for the id value, that is set by Dokuwiki and should be available in the jQuery.ready function; it has nothing to do with opener. If you enter alert(opener.JSINFO['id']) into the documenht ready function and check the console you will see that the value opener is null.

bitozoid commented 9 years ago

In my case:

Thanks anyway.

turnermm commented 9 years ago

I have to apologize for being a bit obtuse. But I believe the error is now corrected.

bitozoid commented 9 years ago

Never mind. Glad to help. :blush: