Permalink
Browse files

Merge pull request #772 from arnavkagrawal/chat

Sahana Eden Chat
  • Loading branch information...
flavour committed May 29, 2014
2 parents dff1c69 + 87f4cb3 commit f217937ce8822bf6969d43bf27493812f31d1c42
No changes.
@@ -132,6 +132,12 @@ def get_template(self):
"""
return self.base.get("template", "default")
def get_chat_server(self):
"""
Get the ip of the chat server if enabled or return False
"""
return self.base.get("chat_server", False)
def exec_template(self, path):
"""
Execute the template
@@ -25,6 +25,10 @@
# - note that you should restart your web2py after changing this setting
settings.base.template = "default"
# Enable Disable Chat Module
# Enter ip of the chat sever, refer http://eden.sahanafoundation.org/wiki/InstallationGuidelines/Chat
#settings.base.chat_server = "127.0.0.1:7070"
# Database settings
# Uncomment to use a different database, other than sqlite
#settings.database.db_type = "postgres"
@@ -0,0 +1,15 @@
require(['converse'], function (converse) {
converse.initialize({
allow_otr: true,
auto_list_rooms: true,
auto_subscribe: false,
bosh_service_url: S3.chat_url,
debug: true ,
hide_muc_server: false,
i18n: locales['en'],
prebind: false,
show_controlbox_by_default: true,
xhr_user_search: false,
});
});

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -262,6 +262,22 @@ def dojs(dogis = False, warnings = True):
pass
shutil.move(outputFilename, "../S3")
# Chat
print "Compressing Chat"
sourceDirectory = ".."
configFilename = "sahana.chat.js.cfg"
outputFilename = "s3.chat.min.js"
merged = mergejs.run(sourceDirectory,
None,
configFilename)
minimized = minimize(merged)
open(outputFilename, "w").write(minimized)
try:
os.remove("../S3/%s" % outputFilename)
except:
pass
shutil.move(outputFilename, "../S3")
# Guided Tour
print "Compressing Guided Tour"
sourceDirectory = ".."
@@ -0,0 +1,9 @@
[first]
converse.min.js
[last]
[include]
S3/s3.chat.js
[exclude]

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,13 @@
{{chat_server = settings.get_chat_server()}}
{{if chat_server:}}
{{if s3.debug:}}
{{main_css = "<link href='/%s/static/styles/plugins/converse.css' rel='stylesheet' type='text/css'/>" % appname}}
{{s3.scripts.append(URL(c="static", f="scripts", args=["converse.min.js"]))}}
{{s3.scripts.append(URL(c="static", f="scripts", args=["S3", "s3.chat.js"]))}}
{{else:}}
{{main_css = "<link href='/%s/static/styles/plugins/converse.min.css' rel='stylesheet' type='text/css'/>" % appname}}
{{s3.scripts.append(URL(c="static", f="scripts", args=["S3", "s3.chat.min.js"]))}}
{{pass}}
{{s3.js_global.append('''S3.chat_url="%s"\n$('link:first').before("%s")''' % ("http://"+str(chat_server+"/http-bind/"),main_css))}}
<div id="conversejs"></div>
{{pass}}
@@ -1,4 +1,5 @@
{{# Include dynamically added Scripts at the end of the body}}
{{include "chat.html"}}
{{for script in s3.scripts:}}
{{=SCRIPT(_src=script)}}
{{pass}}

0 comments on commit f217937

Please sign in to comment.