mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 00:13:35 +01:00
fixed not allways used category color, because regular expression missed every 2. category
This commit is contained in:
parent
3c7a04f903
commit
fe44c6bb5e
@ -477,6 +477,19 @@ var et2_nextmatch_rowProvider = ClassWithAttributes.extend(
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Match category-ids from class attribute eg. "cat_15" or "123,456,789 "
|
||||
*
|
||||
* Make sure to not match numbers inside other class-names.
|
||||
*
|
||||
* We can NOT use something like /(^| |,|cat_)([0-9]+)( |,|$)/g as it wont find all cats in "123,456,789 "!
|
||||
*/
|
||||
cat_regexp: /(^| |,|cat_)([0-9]+)/g,
|
||||
/**
|
||||
* Regular expression used to filter out non-nummerical chars from above matches
|
||||
*/
|
||||
cat_cleanup: /[^0-9]/g,
|
||||
|
||||
/**
|
||||
* Applies additional row data (like the class) to the tr
|
||||
*
|
||||
@ -499,10 +512,8 @@ var et2_nextmatch_rowProvider = ClassWithAttributes.extend(
|
||||
var category_location = _data["class"].match(/(cat(_id|egory)?)/);
|
||||
if(category_location) category_location = category_location[0];
|
||||
|
||||
// Get actual categories, eg. "cat_15" or "123,456,789", make sure to not match numbers inside other class-names
|
||||
cats = classes.match(/(^| |,|cat_)([0-9]+)( |,|$)/g);
|
||||
if (!cats) cats = [];
|
||||
classes = classes.replace(/(^| |,|cat_)([0-9]+)( |,|$)/g, '');
|
||||
cats = classes.match(this.cat_regexp) || [];
|
||||
classes = classes.replace(this.cat_regexp, '');
|
||||
|
||||
// Get category info
|
||||
if(!this.categories)
|
||||
@ -521,8 +532,7 @@ var et2_nextmatch_rowProvider = ClassWithAttributes.extend(
|
||||
for(var i = 0; i < cats.length && this.categories; i++)
|
||||
{
|
||||
// Need cat_, classes can't start with a number
|
||||
var cat_id = cats[i];
|
||||
cat_id = cat_id.replace(/[^0-9]/g, '');
|
||||
var cat_id = cats[i].replace(this.cat_cleanup, '');
|
||||
var cat_class = 'cat_'+cat_id;
|
||||
|
||||
// Check for existing class
|
||||
|
Loading…
Reference in New Issue
Block a user