This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository mum. See http://git.chorem.org/mum.git commit 13ba585dc6f0c29b5b1bd5a63f52305570e87bfe Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Wed Mar 25 17:33:11 2015 +0100 notifications: corrigé bug d'affichage si plusieurs modules de notif chargés --- app/modules/notification_modules/sms_notif.py | 35 +++++++++++++++++++++++++++ views/notifications.html | 27 +++++++++++++++------ 2 files changed, 54 insertions(+), 8 deletions(-) diff --git a/app/modules/notification_modules/sms_notif.py b/app/modules/notification_modules/sms_notif.py new file mode 100644 index 0000000..b20438f --- /dev/null +++ b/app/modules/notification_modules/sms_notif.py @@ -0,0 +1,35 @@ +__author__ = 'aguilbaud' + +import urllib2 + +def get_class_name(): + return "SMS" + + +class SMS: + def __init__(self, user_data, title, msg, settings): + self.name = get_class_name() + self.user_data = user_data # {'email': val, ...} + self.title = title + self.msg = msg + self.settings = settings # = conf attribute on ModuleLoader class + + def get_name(self): + return self.name + + def notify(self): + url = self.user_data['sms_url'] + self.msg + + req = urllib2.Request(url) + try: + urllib2.urlopen(req) + except IOError, e: + if hasattr(e,'code'): + if e.code == 400: + print 'One of the url parameters is missing.' + if e.code == 402: + print 'Too many SMS have been sent in short time.' + if e.code == 403: + print 'The service is not activated or wrong login/key.' + if e.code == 500: + print 'Server error. Please try again later.' \ No newline at end of file diff --git a/views/notifications.html b/views/notifications.html index f150519..181a7eb 100644 --- a/views/notifications.html +++ b/views/notifications.html @@ -40,18 +40,29 @@ <table class="table table-bordered"> <thead> <tr> - <th>User <button type="button" class="btn btn-primary btn-xs" ng-click="open_modal_add_subscriber()">Add...</button></th> + <th>User + <button type="button" class="btn btn-primary btn-xs" + ng-click="open_modal_add_subscriber()">Add... + </button> + </th> <th>Notification service </th> <th>Minor notifications</th> <th>Major notifications</th> </tr> </thead> <tbody> - <tr ng-repeat="(username, user) in subscriber_data"> + <tr ng-repeat-start="(username, user) in subscriber_data"> <td>{{username}}<br/> - <button type="button" class="btn btn-danger btn-xs" ng-click="unsubscribe(username)">Unsubscribe</button></td> - <td ng-repeat="(mod_name, mod_param) in user.minor">{{mod_name}}</td> - <td ng-repeat="(mod_name, mod_param) in user.minor"> + <button type="button" class="btn btn-danger btn-xs" + ng-click="unsubscribe(username)">Unsubscribe + </button> + </td> + </tr> + <tr ng-repeat-end + ng-repeat="(mod_name, mod_param) in user.minor"> + <td></td> + <td>{{mod_name}}</td> + <td> <div class="input-group"> <span class="input-group-addon"> <input type="checkbox" ng-model="mod_param.activated"> @@ -59,12 +70,12 @@ <input type="number" min="1" class="form-control" ng-model="mod_param.priority"> </div> </td> - <td ng-repeat="(mod_name, mod_param) in user.major"> + <td> <div class="input-group"> <span class="input-group-addon"> - <input type="checkbox" ng-model="mod_param.activated"> + <input type="checkbox" ng-model="subscriber_data[username].major[mod_name].activated"> </span> - <input type="number" min="1" class="form-control" ng-model="mod_param.priority"> + <input type="number" min="1" class="form-control" ng-model="subscriber_data[username].major[mod_name].priority"> </div> </td> </tr> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.