From c6657a7f19fb97fc6b84e8b6eb37152f966e0848 Mon Sep 17 00:00:00 2001
From: Christian Pointner <equinox@helsinki.at>
Date: Mon, 22 Sep 2014 11:33:22 +0000
Subject: added alertbox for main window


diff --git a/index.html b/index.html
index c4a865e..03fe6e9 100644
--- a/index.html
+++ b/index.html
@@ -43,15 +43,16 @@
         <h1 class="form-auth-heading">Radio Helsinki - Import</h1>
         <input id="username" type="text" class="form-control" placeholder="Benutzername" required autofocus>
         <input id="password" type="password" class="form-control" placeholder="Passwort" required>
-        <div id="alertbox"></div>
+        <div class="alertbox"></div>
         <button class="btn btn-primary btn-large" type="submit"><i class="icon-user icon-white"></i> Anmelden</button>
       </form>
 
     </div>
 
-
     <div id="mainwindow">
 
+      <div class="alertbox"></div>
+
       <div class="navbar navbar-fixed-top">
         <div class="navbar-inner">
           <div class="container-fluid">
diff --git a/js/auth.js b/js/auth.js
index 6528957..29dde31 100644
--- a/js/auth.js
+++ b/js/auth.js
@@ -15,7 +15,7 @@ function auth_loginSuccess(data) {
      $('#loginbox').slideUp();
      $('#mainwindow').fadeIn();
    } else {
-     alertbox.error("Fehler beim Login", data.errorstring);
+     alertbox.error('loginbox', "Fehler beim Login", data.errorstring);
      auth_cleanup();
    }
 }
@@ -25,7 +25,7 @@ function auth_loginError(req, status, error) {
    if(req.status == 401) {
      message = "Benutzer und/oder Passwort sind falsch!";
    }
-   alertbox.error("Fehler beim Login", message);
+   alertbox.error('loginbox', "Fehler beim Login", message);
    $("#password").val('');
 }
 
diff --git a/js/shows.js b/js/shows.js
index 03af34f..3d57b75 100644
--- a/js/shows.js
+++ b/js/shows.js
@@ -11,7 +11,7 @@ function shows_deleteCart(cart) {
 }
 
 function shows_importCart(cart) {
-  alert('importing carts is not implemented yet!');
+  alertbox.warning('mainwindow', 'importing carts',  'not implemented yet!');
 }
 
 // <td>
diff --git a/js/utils.js b/js/utils.js
index 4d7d0d6..0e76068 100644
--- a/js/utils.js
+++ b/js/utils.js
@@ -1,12 +1,12 @@
 alertbox = function() {}
-alertbox.warning = function (heading, message) {
-  $('#alertbox').html('<div class="alert"><a class="close" data-dismiss="alert" href="#">&times;</a><h4 class="alert-heading">' + heading + '</h4>' + message + '</div>');
+alertbox.warning = function (dest, heading, message) {
+  $('#' + dest + ' .alertbox').html('<div class="alert"><a class="close" data-dismiss="alert" href="#">&times;</a><h4 class="alert-heading">' + heading + '</h4>' + message + '</div>');
 }
-alertbox.error = function (heading, message) {
-  $('#alertbox').html('<div class="alert alert-error"><a class="close" data-dismiss="alert" href="#">&times;</a><h4 class="alert-heading">' + heading + '</h4>' + message + '</div>');
+alertbox.error = function (dest, heading, message) {
+  $('#' + dest + ' .alertbox').html('<div class="alert alert-error"><a class="close" data-dismiss="alert" href="#">&times;</a><h4 class="alert-heading">' + heading + '</h4>' + message + '</div>');
 }
-alertbox.info = function (heading, message) {
-  $('#alertbox').html('<div class="alert alert-info"><a class="close" data-dismiss="alert" href="#">&times;</a><h4 class="alert-heading">' + heading + '</h4>' + message + '</div>');
+alertbox.info = function (dest, heading, message) {
+  $('#' + dest + ' .alertbox').html('<div class="alert alert-info"><a class="close" data-dismiss="alert" href="#">&times;</a><h4 class="alert-heading">' + heading + '</h4>' + message + '</div>');
 }
 
 var weekday = new Array(7);
-- 
cgit v0.10.2