From 9c3e4be52ec5ea147c86b6e8396c78111a13fba7 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Tue, 8 May 2012 22:37:00 +0000 Subject: [PATCH] Better checking for row category --- .../js/et2_extension_nextmatch_rowProvider.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/etemplate/js/et2_extension_nextmatch_rowProvider.js b/etemplate/js/et2_extension_nextmatch_rowProvider.js index deaf544699..424c516f21 100644 --- a/etemplate/js/et2_extension_nextmatch_rowProvider.js +++ b/etemplate/js/et2_extension_nextmatch_rowProvider.js @@ -432,7 +432,7 @@ var et2_nextmatch_rowProvider = Class.extend({ // Get fancy with categories var cats = []; - if(_data["class"].indexOf("cat") !== false) + if(_data["class"].indexOf("cat") !== -1) { cats = classes.match(/(cat_)?([0-9]+)/); var invalid = typeof cats[1] == 'undefined'; @@ -442,7 +442,7 @@ var et2_nextmatch_rowProvider = Class.extend({ field = _data["class"].match(/\[(.*?cat.*?)\]/); // Get category info - if(!this.categories) + if(!this.categories && field) { if(field.length > 1) { @@ -458,15 +458,18 @@ var et2_nextmatch_rowProvider = Class.extend({ var cat_class = 'cat_'+cats[i]; // Check for existing class - + // TODO // Create class - if(this.categories[cats[i]] && this.categories[cats[i]].color) + if(this.categories) { - var cat = this.categories[cats[i]]; - egw().css('.'+cat_class, "background-color: " + cat.color + ";"); + if(this.categories[cats[i]] && this.categories[cats[i]].color) + { + var cat = this.categories[cats[i]]; + egw().css('.'+cat_class, "background-color: " + cat.color + ";"); + } } - classes = classes.replace(cats[i], cat_class); + if(invalid) classes = classes.replace(cats[i], cat_class); } classes += " row_category"; }