Changeset 1352 for HelpIM3

Show
Ignore:
Timestamp:
12/21/10 15:50:45 (17 months ago)
Author:
zeank
Message:

make emoticons be a config option
closes #262

Location:
HelpIM3/branches/chatgroups
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • HelpIM3/branches/chatgroups/HelpIM/chat/templates/Chat.py

    r1323 r1352  
    5858    "STARTUPLINES": [], 
    5959    "CHATGROUP_CHAT": "false", 
     60    "EMOTICONS": ":-\\) ;-\\) :-\\(", 
    6061    } 
    6162 
    6263class Template(HelpIM.web.templateBase.TemplateBase): 
     64 
    6365    def updateConfigs(self): 
    6466        """Class to update config from module globs. Has to be 
     
    8486            if not self.configs.get("NICKNAME", False): 
    8587                self.configs["NICKNAME"] = "Child" 
     88 
     89        # read config from config file 
     90        if self.site and self.site.siteConfig.emoticons: 
     91            self.configs["EMOTICONS"] = self.site.siteConfig.emoticons 
     92 
    8693        # compose page: 
    8794        replacements = self.translations 
    8895        replacements.update(self.configs) 
     96 
    8997        # compose startup lines 
    9098        seperator = "" 
     
    150158var STARTUPLINES = %(STARTUPLINES)s; 
    151159var CHATGROUP_CHAT = %(CHATGROUP_CHAT)s; 
     160var EMOTICONS = "%(EMOTICONS)s"; 
    152161 
    153162/************************************************************************ 
     
    209218var VERSION = "HelpIM3 based on Muckl 0.4.3"; 
    210219var PLAYSOUNDS = true; 
    211 var EMOTICONS = ":-\\\\) ;-\\\\) :-\\\\("; 
    212220//]]>--> 
    213221    </script> 
  • HelpIM3/branches/chatgroups/HelpIM/chatgroup/pages/Chat.py

    r1350 r1352  
    8181 
    8282            # write template 
    83             template = HelpIM.chat.templates.Chat.Template() 
     83            template = HelpIM.chat.templates.Chat.Template(*pargs, **kwargs) 
    8484            return "text/html; charset=utf-8", template.compose(translations, configs) 
    8585        except (NoMeetingTodayException, TooLateException): 
  • HelpIM3/branches/chatgroups/HelpIM/web/templateBase.py

    r915 r1352  
    2626 
    2727class TemplateBase: 
    28     def __init__(self): 
     28    def __init__(self, *args, **kwargs): 
    2929        """Create a new instance of the template""" 
     30 
     31        if kwargs.has_key('him_request'): 
     32            self.site = kwargs['him_request'].site 
     33 
    3034        self.translations = translations 
    3135        self.configs = configs 
  • HelpIM3/branches/chatgroups/config/sites/chatgroups.xml

    r1340 r1352  
    2929        mailFromName='helpim' 
    3030        mailFromEmail='helpim@localhost' 
    31   chatGroupStartWindow='10' 
     31        chatGroupStartWindow='10' 
     32        emoticons=":-\) ;-\) :-\( :-p" 
    3233        > 
    3334 
  • HelpIM3/branches/chatgroups/htdocs/chat.js

    r1351 r1352  
    524524    cFrame.dir = DIR; 
    525525 
    526  
    527526    var showEmoticons = EMOTICONS.split(" ") 
    528527    if (typeof(emoticons) != 'undefined') { 
    529528        var insert = ""; 
    530529        for (var i=0; i<showEmoticons.length; i++) { 
    531             var iq = showEmoticons[i].replace(/\\/g, ''); 
    532530            var emo = new Image(); 
    533531            emo.src = emoticonpath+emoticons[showEmoticons[i]]; 
     532            var iq = showEmoticons[i].replace(/\\/g, ''); 
    534533            insert += '&#160;<img src="'+emo.src+'" '; 
    535534            if (emo.width > 0 && emo.height > 0) {