View Issue Details

IDProjectCategoryView StatusLast Update
733RackTablesdefaultpublic2013-02-24 23:42
Reporterblaza-pl Assigned Toadoom42  
PrioritylowSeverityfeatureReproducibilityalways
Status closedResolutionfixed 
Product Version0.20.3 
Target Version0.20.4Fixed in Version0.20.4 
Summary733: Enable files/images links for row
DescriptionI have created a patch that enables files for rack rows. It may be useful when you have photos of the whole row - now you can link this images to the row.
TagsNo tags attached.

Activities

blaza-pl

blaza-pl

2013-01-30 13:14

reporter  

files4row-patch.diff (3,011 bytes)   
diff -rupN ../RackTables-0.20.3/wwwroot/inc//database.php /var/www/racktables/inc//database.php
--- ../RackTables-0.20.3/wwwroot/inc//database.php	2012-12-19 17:30:47.000000000 +0100
+++ /var/www/racktables/inc//database.php	2013-01-30 12:50:09.773695518 +0100
@@ -4271,6 +4271,12 @@ function getFileLinks ($file_id)
 				$parent = spotEntity ($row['entity_type'], $row['entity_id']);
 				$name = $parent['user_name'];
 				break;
+			case 'row':
+				$page = 'row';
+				$id_name = 'row_id';
+				$parent = spotEntity ($row['entity_type'], $row['entity_id']);
+				$name = $parent['name'];
+				break;
 		}
 
 		// name needs to have some value for hrefs to work
diff -rupN ../RackTables-0.20.3/wwwroot/inc//functions.php /var/www/racktables/inc//functions.php
--- ../RackTables-0.20.3/wwwroot/inc//functions.php	2012-12-19 17:30:47.000000000 +0100
+++ /var/www/racktables/inc//functions.php	2013-01-30 12:59:36.089199950 +0100
@@ -65,6 +65,7 @@ $etype_by_pageno = array
 	'user' => 'user',
 	'file' => 'file',
 	'vst' => 'vst',
+	'row' => 'row',
 );
 
 // Rack thumbnail image width summands: "front", "interior" and "rear" elements w/o surrounding border.
@@ -2571,6 +2588,8 @@ function formatEntityName ($name) {
 			return 'Location';
 		case 'user':
 			return 'User';
+		case 'row':
+			return 'Row';
 	}
 	return 'invalid';
 }
diff -rupN ../RackTables-0.20.3/wwwroot/inc//interface.php /var/www/racktables/inc//interface.php
--- ../RackTables-0.20.3/wwwroot/inc//interface.php	2012-12-19 17:30:47.000000000 +0100
+++ /var/www/racktables/inc//interface.php	2013-01-30 13:00:37.309320540 +0100
@@ -566,7 +566,7 @@ function renderRow ($row_id)
 	echo "</table><br>\n";
 	finishPortlet();
 	renderCellFilterPortlet ($cellfilter, 'rack', $rackList, array ('row_id' => $row_id));
-
+	renderFilesPortlet ('row',$row_id);
 	echo "</td><td class=pcright>";
 
 	global $nextorder;
diff -rupN ../RackTables-0.20.3/wwwroot/inc//navigation.php /var/www/racktables/inc//navigation.php
--- ../RackTables-0.20.3/wwwroot/inc//navigation.php	2012-12-19 17:30:47.000000000 +0100
+++ /var/www/racktables/inc//navigation.php	2013-01-30 12:56:22.969262638 +0100
@@ -103,12 +103,18 @@ $tab['row']['default'] = 'View';
 $tab['row']['editracks'] = 'Manage racks';
 $tab['row']['newrack'] = 'Add new rack';
 $tab['row']['tagroller'] = 'Tag roller';
+$tab['row']['files'] = 'Files';
 $tabhandler['row']['default'] = 'renderRow';
 $tabhandler['row']['editracks'] = 'renderRackSortForm';
 $tabhandler['row']['newrack'] = 'renderNewRackForm';
 $tabhandler['row']['tagroller'] = 'renderTagRollerForRow';
+$tabhandler['row']['files'] = 'renderFilesForEntity';
 $ophandler['row']['tagroller']['rollTags'] = 'rollTags';
 $ophandler['row']['newrack']['addRack'] = 'addRack';
+$ophandler['row']['files']['addFile'] = 'addFileToEntity';
+$ophandler['row']['files']['linkFile'] = 'linkFileToEntity';
+$ophandler['row']['files']['unlinkFile'] = 'unlinkFile';
+
 
 $page['rack']['bypass'] = 'rack_id';
 $page['rack']['bypass_type'] = 'uint';
files4row-patch.diff (3,011 bytes)   
blaza-pl

blaza-pl

2013-01-30 13:14

reporter  

files4row.sql (167 bytes)
blaza-pl

blaza-pl

2013-01-30 13:15

reporter   ~0001119

To make this work you have to patch the files and extend the column restriction in database table FileLink.
adoom42

adoom42

2013-02-24 23:42

administrator   ~0001161

The feature will be available in 0.20.4. Thanks for the patch!

Issue History

Date Modified Username Field Change
2013-01-30 13:14 blaza-pl New Issue
2013-01-30 13:14 blaza-pl File Added: files4row-patch.diff
2013-01-30 13:14 blaza-pl File Added: files4row.sql
2013-01-30 13:15 blaza-pl Note Added: 0001119
2013-02-24 23:42 adoom42 Note Added: 0001161
2013-02-24 23:42 adoom42 Assigned To => adoom42
2013-02-24 23:42 adoom42 Status new => closed
2013-02-24 23:42 adoom42 Resolution open => fixed
2013-02-24 23:42 adoom42 Fixed in Version => 0.20.4
2013-02-24 23:42 adoom42 Target Version => 0.20.4