Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Zimlets

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-04-2009, 09:04 PM
Intermediate Member
 
Posts: 20
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?
Reply With Quote
  #2 (permalink)  
Old 11-25-2009, 12:28 AM
Moderator
 
Posts: 75
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
Reply With Quote
  #3 (permalink)  
Old 12-22-2009, 02:45 PM
Advanced Member
 
Posts: 203
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 02:54 PM..
Reply With Quote
  #4 (permalink)  
Old 12-22-2009, 04:00 PM
Moderator
 
Posts: 75
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
Reply With Quote
  #5 (permalink)  
Old 12-22-2009, 04:27 PM
Advanced Member
 
Posts: 203
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 02:55 PM..
Reply With Quote
  #6 (permalink)  
Old 12-22-2009, 05:16 PM
Moderator
 
Posts: 75
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
Reply With Quote
  #7 (permalink)  
Old 12-22-2009, 05:19 PM
Advanced Member
 
Posts: 203
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"?
Reply With Quote
  #8 (permalink)  
Old 12-22-2009, 05:30 PM
Advanced Member
 
Posts: 203
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
File Type: jpg motd_zimlet_errors.jpg (23.1 KB, 77 views)

Last edited by blazeking; 12-23-2009 at 02:56 PM..
Reply With Quote
  #9 (permalink)  
Old 12-22-2009, 09:27 PM
Moderator
 
Posts: 75
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
Reply With Quote
  #10 (permalink)  
Old 12-23-2009, 12:17 AM
Advanced Member
 
Posts: 203
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.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.