ecleese / plexWatchWeb

A web front-end for plexWatch.
254 stars 41 forks source link

History Screen is blank - shows only "Loading data from server" #135

Closed rjsears closed 9 years ago

rjsears commented 9 years ago

Running the latest dev branch and the history tab only shows a blank screen (no history information) with a note that it is: "Loading data from server".

This was prior to updating to the latest dev branch: screen shot 2015-06-11 at 4 03 21 pm

This was after updating to the latest dev branch: screen shot 2015-06-11 at 3 59 43 pm

Arcanemagus commented 9 years ago

Can you open the developer console (Ctrl + Shift + I) and reload the page to see if it is spitting out any javascript errors?

rjsears commented 9 years ago

Yep - here is what it spit out:

history.php:165 Uncaught SyntaxError: missing ) after argument list

timrettop commented 9 years ago

Hmm, by the looks of it, that is the sAjaxSource, is it possible there is a open parens in the oDb serialized data? Or would the single quote take care of that.

@rjsears, could you check like 165 on that page and provide it here?

rjsears commented 9 years ago

Not sure what you are asking @timrettop - Do you want me to copy line 165 from the history.php file and paste it here or...?

timrettop commented 9 years ago

Yeah, sorry I wasn't clear.

rjsears commented 9 years ago
FriendlyName.source = JSON.parse('{"saracannonhoover":"Sara Hoover","rsears":"Richard Sears","sammy308":"Sammy Reese","bdavis008":"Becky Davis","desertmansd":"Ted Petrina","rsears+plex for vizio (vizio mtk)":"Rick Creighton","rsears+dana's i pad":"Dana Hoover iPad","smpxone":"Ryan Miller","rsears+office":"RJS Home Office","rsears+plex for sony (playstation 4 01.17)":"Ryan Miller","bphoover":"Bill Hoover","rsears+my sm-t330nu":"Freddie Manuel","rsears+darryl's ipad":"Darryl Hoover iPad","logan700":"Logan Stuard"}');
rjsears commented 9 years ago

The above is from the output of Chrome. (CMD+Option+J).

The actual history.php file does not have 165 lines, only 157 lines (/var/www/plexwatchweb/history.php)

rjsears commented 9 years ago

Here is 161 through 172:

<!-- Start generated Jquery from serverdatapdo.php  -->
<script type="text/javascript">
function FriendlyName(user) {
  if (!FriendlyName.hasOwnProperty('source')) {
    FriendlyName.source = JSON.parse('{"saracannonhoover":"Sara Hoover","rsears":"Richard   Sears","sammy308":"Sammy Reese","bdavis008":"Becky Davis","desertmansd":"Ted    Petrina","rsears+plex for vizio (vizio mtk)":"Rick Creighton","rsears+dana's i pad":"Dana Hoover    iPad","smpxone":"Ryan Miller","rsears+office":"RJS Home Office","rsears+plex for sony (playstation 4   01.17)":"Ryan Miller","bphoover":"Bill Hoover","rsears+my sm-t330nu":"Freddie Manuel","rsears+darryl's   ipad":"Darryl Hoover iPad","logan700":"Logan Stuard"}');
  }
  if (FriendlyName.source.hasOwnProperty(user.toLowerCase())) {
    return FriendlyName.source[user.toLowerCase()];
  } else {
    return user;
  }
}
timrettop commented 9 years ago

Yeah, its because server datapdatapdo.php is called in history.php generating more output than the original file.

was there supposed to be more in your last comment, I only see the one line.

rjsears commented 9 years ago

Yes, I put line 165 up a few comments above as that is where it said the error was, then I also put lines 161 - 172. But the spacing was kind of messed up a bit.

Arcanemagus commented 9 years ago

So that line is part of my "dirty hack" of outputting the json_encode()'d friendly name database and then parsing that in the javascript to get the database into the client side code...

Can you go to line 173 in serverdatapdo.php and after that put var_dump($friendlyname_json); so it should look like:

        }
        $friendlyName_json = json_encode($friendlyName);
var_dump($friendlyName_json);
        /* Edit Jqeury Here */
        $js=  <<<EOT

If you load up history.php after that it should put a bunch of junk into the page (and the table will probably be broken). Right click on the page-> View source and copy the line that has all that output in it.

Either paste it here or look over it yourself to make sure that it is properly escaping any ' marks in there. I'll see if I can reproduce the issue on my side.

Arcanemagus commented 9 years ago

Reproduced it here, looking into what it will take to get PHP's json_encode() to behave.

Arcanemagus commented 9 years ago

Checkout the latest dev branch, that should fix things for you. Sorry about that!

Closing for now, please re-open if the issue is still present on your setup.

rjsears commented 9 years ago

Problem Solved. Thank You @Arcanemagus