Scott Nixon avatar Scott Nixon committed 1822284

Refactored to write unique cookies instead of sharing the same cookie.

Comments (0)

Files changed (1)

inbounding/dispatch/static/in.js

     //console.log(name + "=" + value + "; path=" + path + "; max-age=" + maxage);
 };
 
+INBOUND.setMVCookie = function(name,value,maxage,path,domain) {
+    /*
+     * Pass the function the name, value, max-age, & domain for the cookie
+     * so this function can be used to set all cookies.
+     */
+    document.cookie = name + "=" + value + 
+	              "; path=" + path + 
+	              "; max-age=" + maxage; 
+    //console.log(name + "=" + value + "; path=" + path + "; max-age=" + maxage);
+};
+
 INBOUND.getCookie = function(name) {
     var nameEQ = name + "=";
     var ca = document.cookie.split(';');
 };
 
 INBOUND.close = function() {
-    /* This is used to close the overlay action box. */
+    /* This is used to close the overlay action box. 
+     * Cookie expires in 30 days.
+     */
     $('#ck_container').hide();
     // Value = 101 for Closed
-    INBOUND.setCookie('ck_status', INBOUND.action_id + '=' + 101, (60*60*24*365), '/', '');
+    INBOUND.setCookie('ck_status-' + INBOUND.action_id, INBOUND.action_id + '=' + 101, (60*60*24*30), '/', '');
 };
 
 INBOUND.completed = function() {
-    /* This is used to close the overlay action box. */
+    /* This is used to complete(hide) the overlay action box. 
+     * Cookie expires in 30 days.
+     */
     $('#ck_container').hide();
     // Value = 100 for Completed
-    INBOUND.setCookie('ck_status', INBOUND.action_id + '=' + 100, (60*60*24*365), '/', '');
+    INBOUND.setCookie('ck_status-' + INBOUND.action_id, INBOUND.action_id + '=' + 100, (60*60*24*30), '/', '');
 };
 
 INBOUND.usereval = function(rid) {
      * 101 = Closed; 100 = Completed
      */
 
-
-    var get_status = INBOUND.getCookie('ck_status');
+    var get_status = INBOUND.getCookie('ck_status-' + rid);
 
     /* Check to see if a value exits and return the status number. */
-    if (get_status === null && typeof get_status === 'object')
+    if (get_status === null && typeof get_status === 'object') {
 	status = 0; /* Status is False */
+    }
     else {
-	/* Split on the Action id delimiter */
-	var al = get_status.split('|');
-	for (var i=0; i < al.length; i++) { 
-	    /* Convert the list to a string. */
-	    var b = al.toString();
-	    /* split on the key value delimitor. */
-	    var c = b.split('=');
-	    /* The returned value is used to identify whether an action
-	     * is completed or closed. Example value 4=101; (action_id)=(status) 
-	     */
-	    var status = c[1]; 
-	} 
+	var values_list = get_status.split('=');
+	if (values_list[0] === rid.toString()) {
+	    var status = values_list[1];
+	}
     }
     return status;
 };
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.