Results 1 to 10 of 10

Thread: Motd

  1. #1
    Join Date
    Sep 2008
    Posts
    20
    Rep Power
    7

    Default Motd

    Im in the middle of deploying this zimlet:
    Get or contribute Zimlets, UI themes, and languages in the Zimbra Gallery - Tips and Alerts Zimlet

    A broadcasting zimlets.

    I've setup the cgi and the rest-data.

    I've uploaded the admin page on my site.

    So i can visit through:
    http://www.mysite.com/motd/settings/

    No problem, I can even add a tips & pa which I can check back on the rest-data/motd/tips directory.

    The problem is I cannot list the existing post. I've the FF plugin: Firebugs, when I click refresh button to load the list of Tips, I got empty result.
    The url request is:
    http://www.mysite.com/cgi-bin/zimbra....js?sfu_token=

    Strange things is, when I turn on the debug mode in the cgi, I got this:

    Code:
    path: motd/tips/all.js
    query type: GET
    Loaded tips: 3
    Content-Type: application/json; charset=ISO-8859-1
    which gives me the exactly number of tips I have. So it seems like the cgi was unable to return me the content of the tips...

    Any suggestion?

  2. #2
    Join Date
    May 2007
    Location
    Vancouver, Canada
    Posts
    75
    Rep Power
    8

    Default

    Any chance you've just got a permissions problem? When you enable debug mode in zimbrarest.cgi, all it does is read in the list of tips by fetching the contents of the directory, then call the function that prints all of the tips. Since you saw no tips in debug mode, that suggests that the print function failed. All the print function does is suck in the file and print it to stdout, so there's not a lot to fail (that said, it's supposed to return a 500 error code if it can't open one of the files)

    The function that actually returns the tips is "send_all_tips". It's pretty simple perl - you could try sticking in some judicious 'prints' to figure out where it's losing the data (in 'debug' mode, you can run zimbrarest.cgi from the command line to see the list of tips - no need to access it via the web)
    Steve Hillman
    IT Architect
    Simon Fraser University

  3. #3
    Join Date
    May 2008
    Location
    California!
    Posts
    226
    Rep Power
    7

    Default

    I'll probably run into this :-) But I have a different issue. I don't understand step 6:

    In the admin app, 2 files need to be edited to define your URLs:
    ./motd/settings/index.html - search for urlBase and set appropriately
    ./motd/_js/motd.js - change the GET and POST URLs at the top of the file


    I am very inexperienced in this area... what do I set these to? Here's my current (probably incorrect) config:


    My file paths:

    website root: /usr/local/wwwroot/zimbramotd
    admin app: ./adminapp
    rest_data: ./ds and ./motd


    Changed settings:

    ./adminapp/motd/settings/index.html: (urlBase = 'http://mysite.org/zimbrarest.cgi/adminapp/motd/global/')
    ./adminapp/motd/_js/motd.js:
    var getUrlBase = 'http://mysite.org/motd';
    var postUrlBase = 'http://mysite.org/motd/';
    var myUrlBase = 'http://mysite.org/';


    How many things do I have wrong?
    Last edited by blazeking; 12-23-2009 at 01:54 PM.

  4. #4
    Join Date
    May 2007
    Location
    Vancouver, Canada
    Posts
    75
    Rep Power
    8

    Default

    Quote Originally Posted by blazeking View Post


    Changed settings:

    ./adminapp/motd/settings/index.html: (urlBase = 'http://zimbramotd.lakecoe.org/zimbrarest.cgi/adminapp/motd/global/')
    ./adminapp/motd/_js/motd.js:
    var getUrlBase = 'http://zimbramotd.lakecoe.org/motd';
    var postUrlBase = 'http://zimbramotd.lakecoe.org/motd/';
    var myUrlBase = 'http://zimbramotd.lakecoe.org/';


    How many things do I have wrong?
    In the urlBase variable, there's no need to change anything after the ".cgi" part (if you do, you'd need to modify the CGI perl code accordingly). So your urlBase should be "http://zimbramotd.lakecoe.org/zimbrarest.cgi/datastore/motd/global" - assuming of course that your zimbrarest.cgi program is at the root level and not in a "/cgi-bin' sub dir or something like that.

    Your getUrlBase and postUrlBase should be the same as each other, and the same as the first part of the urlBase - in your case, it looks like they should both be "http://zimbramotd.lakecoe.org/zimbrarest.cgi/"
    Steve Hillman
    IT Architect
    Simon Fraser University

  5. #5
    Join Date
    May 2008
    Location
    California!
    Posts
    226
    Rep Power
    7

    Default

    Ok, changed a few things:


    Sample REST data is now located at /home/zimbramotd/

    AdminApp unpacked to root of Apache website (/usr/local/wwwroot/zimbramotd)

    Line 24 of ./motd/settings/index.html is now: (var urlBase = 'http://mysite.org/zimbrarest.cgi/datastore/motd/global'

    getUrlBase, postUrlBase, and myUrlBase are now all http://mysite.org/zimbrarest.cgi/

    zimbrarest.cgi modified: ($basedir = "/home/zimbramotd/)


    Still get the firebug error: GET http://mysite.org/zimbrarest.cgi/datastore/motd/global 404 Not Found
    Last edited by blazeking; 12-23-2009 at 01:55 PM.

  6. #6
    Join Date
    May 2007
    Location
    Vancouver, Canada
    Posts
    75
    Rep Power
    8

    Default

    Quote Originally Posted by blazeking View Post

    Still get the firebug error: GET http://zimbramotd.lakecoe.org/zimbra...re/motd/global 404 Not Found
    Try enabling debug mode in the zimbrarest.cgi code (uncomment the $debug=1 line at the beginning of the file), then view the results again in Firebug. In debug mode, it just dumps a copy of all of the tips it read in, regardless of what request is sent to it. That will at least tell you that the cgi is working
    Steve Hillman
    IT Architect
    Simon Fraser University

  7. #7
    Join Date
    May 2008
    Location
    California!
    Posts
    226
    Rep Power
    7

    Default

    Here's what doesn't make sense to me:


    In the README, step 4 instructs "Unpack the sample REST data into whatever directory you've chosen to be your datastore."

    Step 2 says "Edit zimbrarest.cgi and set $basedir to the path to use as the datastore."

    But the error I'm getting above tells me I have some path incorrect. Am I just not understanding the "datastore"?

  8. #8
    Join Date
    May 2008
    Location
    California!
    Posts
    226
    Rep Power
    7

    Default

    Quote Originally Posted by hillman View Post
    Try enabling debug mode in the zimbrarest.cgi code (uncomment the $debug=1 line at the beginning of the file), then view the results again in Firebug. In debug mode, it just dumps a copy of all of the tips it read in, regardless of what request is sent to it. That will at least tell you that the cgi is working
    Uncommented the debug line, but no additional messages show in firebug. This runs OK:

    [root@www zimbramotd]# perl -c zimbrarest.cgi
    zimbrarest.cgi syntax OK


    Maybe my website isn't configured correctly for the CGI app? I get this error in /var/log/httpd/error_log.log:
    [Tue Dec 22 05:10:08 2009] [error] [client 10.2.1.29] Premature end of script headers: zimbrarest.cgi, referer: http://mysite.org/motd/settings/


    Or, perl wasn't being called correctly. :-) Apparently perl (on my system) is at /usr/bin/perl, and your cgi script was calling /usr/local/bin/perl. Now I'm getting some weird errors (attached).
    Attached Images Attached Images
    Last edited by blazeking; 12-23-2009 at 01:56 PM.

  9. #9
    Join Date
    May 2007
    Location
    Vancouver, Canada
    Posts
    75
    Rep Power
    8

    Default

    Quote Originally Posted by blazeking View Post
    Uncommented the debug line, but no additional messages show in firebug. This runs OK:

    [root@www zimbramotd]# perl -c zimbrarest.cgi
    zimbrarest.cgi syntax OK


    Maybe my website isn't configured correctly for the CGI app? I get this error in /var/log/httpd/error_log.log:
    [Tue Dec 22 05:10:08 2009] [error] [client 10.2.1.29] Premature end of script headers: zimbrarest.cgi, referer: http://zimbramotd.lakecoe.org/motd/settings/


    Or, perl wasn't being called correctly. :-) Apparently perl (on my system) is at /usr/bin/perl, and your cgi script was calling /usr/local/bin/perl. Now I'm getting some weird errors (attached).
    I'm guessing you're getting the syntax error because you've still got debug enabled in zimbrarest.cgi. The results will be somewhat garbage to firebug, but if you look at the raw data returned, you should see your tips in JSON format. If you don't have debug on, I can't tell what's causing the error. Is there a way for me to hit the cgi from the Internet?
    Steve Hillman
    IT Architect
    Simon Fraser University

  10. #10
    Join Date
    May 2008
    Location
    California!
    Posts
    226
    Rep Power
    7

    Default

    Quote Originally Posted by hillman View Post
    I'm guessing you're getting the syntax error because you've still got debug enabled in zimbrarest.cgi. The results will be somewhat garbage to firebug, but if you look at the raw data returned, you should see your tips in JSON format. If you don't have debug on, I can't tell what's causing the error. Is there a way for me to hit the cgi from the Internet?
    Server IP PM'd.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •