New Tab Widget at data_templates.php

Anything that you think should be in Cacti.

Moderators: Developers, Moderators

Post Reply
User avatar
mojiro
Cacti User
Posts: 121
Joined: Sun Jul 24, 2005 12:20 pm
Location: Ireland, Dublin

New Tab Widget at data_templates.php

Post by mojiro »

When you have lots of Data Sources in a Data Template, you have lots of tabs.. and <td>!

So I have replaced the table/td Tab Widget with a more useful code based on <div>.

In file data_templates.php replace with the following code after the 485 line

Code: Select all

	$i = 0;

	if (isset($template_data_rrds)) {
		if (sizeof($template_data_rrds) > 1) {
			/* draw the data source tabs on the top of the page */
			foreach ($template_data_rrds as $template_data_rrd) {
				$i++;

				print '
<div
  style="
    float:      left;
    border:     1px solid #999;
    margin:     0 4px 4px 0;
    padding:    2px 4px;
    background: ' . (($template_data_rrd['id'] == $_GET['view_rrd']) ? 'silver' : '#DFDFDF') . ';
  ">
  <span class="textHeader">
    <a href="' . htmlspecialchars('data_templates.php?action=template_edit&id=' . $_GET['id'] . '&view_rrd=' . $template_data_rrd['id']) . '">' .
      $i . ': ' . htmlspecialchars($template_data_rrd['data_source_name']) . '
	</a>
	<a href="' . htmlspecialchars('data_templates.php?action=rrd_remove&id=' . $template_data_rrd['id'] . '&data_template_id=' . $_GET['id']) . '">
	  <img src="images/delete_icon.gif" border="0" alt="Delete">
	</a>
  </span>
</div>' . "\n";
			}
		} elseif (sizeof($template_data_rrds) == 1) {
			$_GET["view_rrd"] = $template_data_rrds[0]["id"];
		}
	}
div.png
div.png (181.62 KiB) Viewed 2216 times
[i]Born to be online![/i]
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests