View Issue Details

IDProjectCategoryView StatusLast Update
577RackTablesdefaultpublic2012-10-17 09:56
Reporterracktabler Assigned Toinfrastation  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Target Version0.20.2Fixed in Version0.20.2 
Summary577: Possibilty to visually group tags
Descriptione.g.
Locations
  London
  Paris


Locations should not be selectable (no checkbox) and it should not show up as implicit tag.
Just a visual grouping of tags for better usability.
TagsNo tags attached.

Activities

2012-06-27 10:03

 

RT-taggroups.diff (2,321 bytes)   
diff -u RackTables-0.19.12/wwwroot/inc/functions.php RackTables-0.19.12_patched/wwwroot/inc/functions.php
--- RackTables-0.19.12/wwwroot/inc/functions.php	2012-03-14 13:58:35.000000000 +0100
+++ RackTables-0.19.12_patched/wwwroot/inc/functions.php	2012-06-27 11:58:44.345376128 +0200
@@ -1341,7 +1341,8 @@
 	$ret = array();
 	foreach (array_unique ($tagidlist) as $tag_id)
 		if (isset ($taglist[$tag_id]))
-			$ret[] = $taglist[$tag_id];
+			if( substr($taglist[$tag_id]['tag'],0,1) != '-')
+				$ret[] = $taglist[$tag_id];
 	return $ret;
 }
 
diff -u RackTables-0.19.12/wwwroot/inc/interface-lib.php RackTables-0.19.12_patched/wwwroot/inc/interface-lib.php
--- RackTables-0.19.12/wwwroot/inc/interface-lib.php	2012-03-14 13:58:35.000000000 +0100
+++ RackTables-0.19.12_patched/wwwroot/inc/interface-lib.php	2012-06-27 11:58:44.359385169 +0200
@@ -4,7 +4,7 @@
 # framework. See accompanying file "COPYING" for the full copyright and
 # licensing information.
 
-define ('TAGNAME_REGEXP', '/^[\p{L}0-9]([. _~-]?[\p{L}0-9])*$/u');
+define ('TAGNAME_REGEXP', '/^-?[\p{L}0-9]([. _~-]?[\p{L}0-9])*$/u');
 define ('AUTOTAGNAME_REGEXP', '/^\$[\p{L}0-9]([. _~-]?[\p{L}0-9])*$/u');
 
 // Let's have it here, so extensions can add their own images.
diff -u RackTables-0.19.12/wwwroot/inc/interface.php RackTables-0.19.12_patched/wwwroot/inc/interface.php
--- RackTables-0.19.12/wwwroot/inc/interface.php	2012-04-10 15:55:23.000000000 +0200
+++ RackTables-0.19.12_patched/wwwroot/inc/interface.php	2012-06-27 11:58:44.394380764 +0200
@@ -5857,8 +5857,10 @@
 	$tr_class = ($level == 0 && $taginfo['id'] > 0 && !$is_first_time ? 'separator' : '');
 	$is_first_time = FALSE;
 	
+	$isgroup = substr($taginfo['tag'],0,1) == '-';
+	
 	echo "<tr class='$tr_class'><td colspan=2 class='$td_class' style='padding-left: " . ($level * 16) . "px;'>";
-	echo "<label><input type=checkbox class='$input_class' name='${prepared_inputname}[]' value='${taginfo['id']}'" . ($selected ? ' checked' : '') . "> ";
+	echo "<label>".($isgroup ? "" : "<input type=checkbox class='$input_class' name='${prepared_inputname}[]' value='${taginfo['id']}'" . ($selected ? ' checked' : '') . "> ");
 	echo $taginfo['tag'];
 	if (strlen ($refcnt_realm) and isset ($taginfo['refcnt'][$refcnt_realm]))
 		echo ' <i>(' . $taginfo['refcnt'][$refcnt_realm] . ')</i>';
RT-taggroups.diff (2,321 bytes)   
racktabler

racktabler

2012-06-27 10:06

reporter   ~0000690

Patch against 0.19.12.
All tags starting with an '-' are treated as grouping tag only
Not sure if this breaks something!
infrastation

infrastation

2012-06-29 11:38

administrator   ~0000698

I confirm usefulness of this feature, but this particular way of doing it isn't right. It should be either a TagTree table column with a flag specific to each particular tag or a text-based hook machinery to accept/reject the changes based on the context.
infrastation

infrastation

2012-09-29 16:09

administrator   ~0000825

The change to DB schema below can implement "abstract" (in terms of C++) tags, that is, a tag which can never be assigned. The "abstractness" can be enabled or disabled for a tag that isn't yet assigned. "Abstract" tags cannot be assigned to objects. Normal tags cannot be switched "abstract" as long as they are assigned. A bit of PHP code is required to make this a complete solution.

ALTER TABLE TagStorage ADD COLUMN tag_is_abstract ENUM('yes', 'no') NOT NULL default 'no' AFTER tag_id;
ALTER TABLE TagStorage ADD KEY `tag_id-tag_is_abstract` (tag_id, tag_is_abstract);

ALTER TABLE TagTree ADD COLUMN is_abstract ENUM('yes', 'no') NOT NULL default 'no' AFTER parent_id;
ALTER TABLE TagTree ADD KEY `id-is_abstract` (id, is_abstract);

ALTER TABLE TagStorage DROP FOREIGN KEY `TagStorage-FK-tag_id`;
ALTER TABLE TagStorage ADD CONSTRAINT `TagStorage-FK-TagTree` FOREIGN KEY (tag_id, tag_is_abstract) REFERENCES TagTree (id, is_abstract);
infrastation

infrastation

2012-10-17 09:56

administrator   ~0000879

Implemented and will be available in the next release. The difference from the original request is that the parent tag, that cannot be assigned, is still visible on the implicit chain.

Issue History

Date Modified Username Field Change
2012-06-26 14:01 racktabler New Issue
2012-06-27 10:03 racktabler File Added: RT-taggroups.diff
2012-06-27 10:06 racktabler Note Added: 0000690
2012-06-29 11:38 infrastation Note Added: 0000698
2012-09-29 16:09 infrastation Note Added: 0000825
2012-10-06 14:59 infrastation Assigned To => infrastation
2012-10-06 14:59 infrastation Status new => assigned
2012-10-07 20:40 infrastation Target Version => 0.20.2
2012-10-17 09:56 infrastation Note Added: 0000879
2012-10-17 09:56 infrastation Status assigned => closed
2012-10-17 09:56 infrastation Resolution open => fixed
2012-10-17 09:56 infrastation Fixed in Version => 0.20.2