def dashlet_notify_users(nr, dashlet): html.open_div(class_="notify_users") table.begin("notify_users", sortable=False, searchable=False, omit_if_empty=True) for entry in sorted(notify.get_gui_messages(), key=lambda e: e["time"], reverse=True): if "dashlet" in entry["methods"]: table.row() msg_id = entry["id"] datetime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(entry['time'])) message = entry["text"].replace("\n", " ") table.cell(_("Actions"), css="buttons", sortable=False) html.icon_button("", _("Delete"), "delete", onclick="delete_user_notification('%s', this);" % msg_id) table.cell(_("Message"), html.attrencode(message)) table.cell(_("Date"), datetime) table.end() html.javascript('function delete_user_notification(msg_id, btn) {' 'post_url("ajax_delete_user_notification.py", "id=" + msg_id);' 'var row = btn.parentNode.parentNode;' 'row.parentNode.removeChild(row);}') html.close_div()
def dashlet_notify_users(nr, dashlet): html.write('<div class="notify_users">') table.begin("notify_users", sortable=False, searchable=False, omit_if_empty=True) for entry in sorted(notify.get_gui_messages(), key=lambda e: e["time"], reverse=True): if "dashlet" in entry["methods"]: table.row() msg_id = entry["id"] datetime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(entry['time'])) message = entry["text"].replace("\n", " ") table.cell(_("Actions"), css="buttons", sortable=False) html.icon_button("", _("Delete"), "delete", onclick="delete_user_notification('%s', this);" % msg_id) table.cell(_("Message"), html.attrencode(message)) table.cell(_("Date"), datetime) table.end() html.javascript('function delete_user_notification(msg_id, btn) {' 'post_url("ajax_delete_user_notification.py", "id=" + msg_id);' 'var row = btn.parentNode.parentNode;' 'row.parentNode.removeChild(row);}') html.write("</div>")
def render_messages(): for msg in notify.get_gui_messages(): if 'gui_hint' in msg['methods']: html.write('<div class="popup_msg" id="message-%s">' % msg['id']) html.write('<a href="javascript:void(0)" class="close" onclick="message_close(\'%s\')">x</a>' % msg['id']) html.write(html.attrencode(msg['text']).replace('\n', '<br />\n')) html.write('</div>\n') if 'gui_popup' in msg['methods']: html.javascript('alert(\'%s\'); mark_message_read("%s")' % (html.attrencode(msg['text']).replace('\n', '\\n'), msg['id']))
def render_messages(): for msg in notify.get_gui_messages(): if "gui_hint" in msg["methods"]: html.write('<div class="popup_msg" id="message-%s">' % msg["id"]) html.write('<a href="javascript:void(0)" class="close" onclick="message_close(\'%s\')">x</a>' % msg["id"]) html.write(html.attrencode(msg["text"]).replace("\n", "<br />\n")) html.write("</div>\n") if "gui_popup" in msg["methods"]: html.javascript( "alert('%s'); mark_message_read(\"%s\")" % (html.attrencode(msg["text"]).replace("\n", "\\n"), msg["id"]) )
def render_messages(): for msg in notify.get_gui_messages(): if 'gui_hint' in msg['methods']: html.open_div(id_="message-%s" % msg['id'], class_=["popup_msg"]) html.a("x", href="javascript:void(0)", class_=["close"], onclick="message_close(\'%s\')" % msg['id']) html.write_text(msg['text'].replace('\n', '<br/>\n')) html.close_div() if 'gui_popup' in msg['methods']: html.javascript( 'alert(\'%s\'); mark_message_read("%s")' % (html.attrencode(msg['text']).replace('\n', '\\n'), msg['id']))