Discussion Forums  >  Config Data, JSON, App Refresh

Replies: 15    Views: 301

Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
09/26/13 08:53 AM (10 years ago)

JSON Snippet Keeper broken again

Sheri complained here about it https://www.buzztouch.com/forum/thread.php?tid=E46B04D2EDE48A591221EBD&fid=A00805FCC9962ECBA15A891&sortColumn=FT.id&sortUpDown=&currentPage=1 and the recommended fix was to load the index.php file from this link, from an earlier thread: http://www.buzztouch.com/forum/thread.php?fid=F08725BA98BCAA9B71E2299&tid=F08725BA98BCAA9B71E2299 and the link was https://dl.dropboxusercontent.com/s/40rai1a01dss3hs/index.php?token_hash=AAEpJoTnmnpChPGoh13ywVJLgy6kdky6-MWPSasbXjnqvw&dl=1 However, today all day I have the same problem as Sheri did. The JSON Snippet Keeper is not remembering anything and the suggested fix only made it worse. When I switched to that index.php the JSON option from the main menu of the control panel stopped working. I brought back the original version, so the panel is now working, but the Snippet Keeper is still broken. It would be nice if this plugin was renewed together with the other changes that are now introduced into the Buzztouch core.
 
Stobe
buzztouch Evangelist
Profile
Posts: 1527
Reg: Mar 04, 2011
Fredericksburg,...
24,670
like
09/26/13 12:16 PM (10 years ago)
looking into this....
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
09/26/13 01:00 PM (10 years ago)
When you sasy "the JSON option from the main menu of the control panel stopped working", what option are you talking about? Do you mean the link to retrieve all the JSON for your entire app? If so, what od you mean by it 'stopped working'? Some details would be helpful. The only change I made in that "new index.php" file was to make a change around line 235 from: url: "<?php echo rtrim($controlPanelURL, "/");?>/bt_saveScreenData_AJAX.php", to: url: "save_JSON.php",
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
09/26/13 01:15 PM (10 years ago)
"the JSON option from the main menu of the control panel stopped working", The main menu from the control panel for the application, the one between "Files / Media" and "Publish Changes". After clicking on it, the spinner of death was shown and it continued to spin for several minutes. It never stopped, so I assumed it was broken and brought back the original version of index.php in /api/app. Now I have the control panel back but the screen made with JSON Snippet Keeper returns only {} after being saved and recalled. I last updated the control panel on the 20th of September 2013, it is still the version 2.1.9. The JSON Snippet Keeper used to work OK until today, using the version by Chris1, from the link in the first post of this thread.
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
09/26/13 01:20 PM (10 years ago)
Not sure what's going on, as I can't duplicate the issue. I just tried adding a JSON Snippet Keeper screen to a blank plugin, and added in some random JSON. It saved properly and the JSON link for the app displayed it correctly. I also checked the server update link from the admin menu, and it found no updates to install.
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
09/26/13 01:27 PM (10 years ago)
Thank you for looking into this. The last version of Snippet Keeper is 1.2 and is also an up to date version on my system.
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
09/26/13 01:32 PM (10 years ago)
This plugin has been updated in the market and in bt hosted control panels. Self hosters can re-download and updates as needed. Details: Prior to the Android v3.0 release this plugins used save_JSON.php to save the entries to the database. This file was called when the Submit button was pressed. When all the plugins were updated a few weeks ago the path to save_JSON.php (on line 235 of index.php) was changed and was pointed to the wrong .php script used when saving. It's been set-back to what it was before, and what it should be using. All's good.
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
09/26/13 01:35 PM (10 years ago)
So the advice is to reinstall the control panel? Not a problem, if that will fix it. Do we still need to overwrite the existing index.php from the control panel -- the plugin documentation still states so.
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
09/26/13 01:41 PM (10 years ago)
Just to be on the safe side, I have redownloaded the current version of the plugin index.php file, and on line 235 it says url: "save_JSON.php", Is that correct? If it is, the error must be elsewhere in my setup.
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
09/26/13 01:51 PM (10 years ago)
Is it possible you have some bad JSON somewhere in your app? What happens if you grab the dataURL for your app and paste it in your browser?
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
09/26/13 01:58 PM (10 years ago)
It is possible that there is some bad JSON somewhere, but when I paste in a verified piece of JSON, the error is still there. When I check "Save to the Snippet Keeper" and give it a name, and when I refresh the JSON snippets, the newly saved snippet is not shown in the list of snippets. >What happens if you grab the dataURL for your app and paste it in your browser? Which url would that exactly be?
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
09/26/13 02:02 PM (10 years ago)
On the "core" settings for your app in the control panel, there's a section for "Configuration Data URL". Copy that link and paste it in a new browser window.
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
09/26/13 02:04 PM (10 years ago)
OK, thank you. I did that and the full JSON config file was returned. Was that supposed to be so? I just checked it, it validates.
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
09/26/13 02:19 PM (10 years ago)
Could be a server issue, then. Basically that JSON link on your control panel just uses some Javascript to pull in the data from the URL you just successfully tested. The javascript just looks like this: function getConfigData(){ if(getConfigDataURL != ""){ if(window.XMLHttpRequest){ xmlhttp = new XMLHttpRequest(); } else { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function(){ if(xmlhttp.readyState == 4 && xmlhttp.status == 200){ var result = xmlhttp.responseText; var result = xmlhttp.responseText; document.getElementById("isLoading").style.display = "none"; document.getElementById("doneLoading").style.display = "block"; document.getElementById("configDataResults").innerHTML = result; } } xmlhttp.open("GET",getConfigDataURL, true); xmlhttp.send(); } }
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
09/26/13 02:23 PM (10 years ago)
you could, I suppose, edit it to update the textbox with the readyState, like so: xmlhttp.onreadystatechange=function(){ if(xmlhttp.readyState == 4 && xmlhttp.status == 200){ var result = xmlhttp.responseText; var result = xmlhttp.responseText; document.getElementById("isLoading").style.display = "none"; document.getElementById("doneLoading").style.display = "block"; document.getElementById("configDataResults").innerHTML = result; } else { document.getElementById("isLoading").style.display = "none"; document.getElementById("doneLoading").style.display = "block"; document.getElementById("configDataResults").innerHTML = xmlhttp.readyState; } }
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
10/01/13 04:15 AM (10 years ago)
There is a new version of JSON Snippet Keeper. I downloaded it yesterday and now it works again. Thanks!
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.