Start polling notifications when loading the page.
[Sone.git] / src / main / resources / templates / include / head.html
index 1b89747..41c7971 100644 (file)
                /* process all existing notifications, ajaxify dismiss buttons. */
                $(document).ready(function() {
                        $("#sone #notification-area .notification").each(function() {
-                               ajaxifyNotificationArea($(this));
+                               ajaxifyNotification($(this));
                        });
                });
        </script>
 
+       <script language="javascript">
+               /* activate notification polling. */
+               $(document).ready(function() {
+                       setTimeout(getNotifications, 5000);
+               });
+       </script>
+
        <div id="main">
 
                <%if !webInterface.core.identityManager.connected>
                <%/if>
 
                <div id="notification-area">
+
+                       <form id="notification-dismiss-template" class="hidden dismiss" action="dismissNotification.html" method="post">
+                               <input type="hidden" name="formPassword" value="<% formPassword|html>" />
+                               <input type="hidden" name="returnPage" value="<% request.uri|html>" />
+                               <input type="hidden" name="notification" value="" />
+                               <button type="submit"><%= Notification.Button.Dismiss|l10n|html></button>
+                       </form>
+
                        <%foreach webInterface.notifications.all notification>
                                <div class="notification" id="<% notification.id|html>">
                                        <%if notification.dismissable>