Better checking for row category

This commit is contained in:
Nathan Gray 2012-05-08 22:37:00 +00:00
parent 92dbd693d7
commit 9c3e4be52e

View File

@ -432,7 +432,7 @@ var et2_nextmatch_rowProvider = Class.extend({
// Get fancy with categories // Get fancy with categories
var cats = []; var cats = [];
if(_data["class"].indexOf("cat") !== false) if(_data["class"].indexOf("cat") !== -1)
{ {
cats = classes.match(/(cat_)?([0-9]+)/); cats = classes.match(/(cat_)?([0-9]+)/);
var invalid = typeof cats[1] == 'undefined'; var invalid = typeof cats[1] == 'undefined';
@ -442,7 +442,7 @@ var et2_nextmatch_rowProvider = Class.extend({
field = _data["class"].match(/\[(.*?cat.*?)\]/); field = _data["class"].match(/\[(.*?cat.*?)\]/);
// Get category info // Get category info
if(!this.categories) if(!this.categories && field)
{ {
if(field.length > 1) if(field.length > 1)
{ {
@ -458,15 +458,18 @@ var et2_nextmatch_rowProvider = Class.extend({
var cat_class = 'cat_'+cats[i]; var cat_class = 'cat_'+cats[i];
// Check for existing class // Check for existing class
// TODO
// Create class // Create class
if(this.categories[cats[i]] && this.categories[cats[i]].color) if(this.categories)
{ {
var cat = this.categories[cats[i]]; if(this.categories[cats[i]] && this.categories[cats[i]].color)
egw().css('.'+cat_class, "background-color: " + cat.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"; classes += " row_category";
} }