2010-01-14 Javier Lanz <javier.lanz@artica.es>

* trunk/pandora_console/include/functions_html.php: print_select function edited to deal with long fields.
	* trunk/pandora_console/include/functions_ui.php: printTruncateText function edited to truncate in the middle of the word.
	* trunk/pandora_console/pandoradb.sql: changed type for field "nombre" in "tgrupo" table.
	* trunk/pandora_console/pandora_console_install: added support for Fedora. Thanks to philipmbrown.
	* trunk/pandora_console/extensions/agents_modules.php: truncated text to 19 characters showing agent names
	* trunk/pandora_console/operation/agentes/group_view.php: Truncated group name to deal with long fields.
	* trunk/pandora_console/extras/pandoradb_migrate_v3.2_to_v4.0.sql: changed type for field "nombre" in "tgrupo" table.
	* trunk/pandora_console/godmode/groups/group_list.php: Truncated group name to deal with long fields.
	* trunk/pandora_console/godmode/agentes/modificar_agente.php: truncated agent names to deal with long fields.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3744 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
javilanz 2011-01-14 12:33:31 +00:00
parent d32d4b307b
commit ab5b664f07
10 changed files with 93 additions and 45 deletions

View File

@ -1,3 +1,15 @@
2010-01-14 Javier Lanz <javier.lanz@artica.es>
* trunk/pandora_console/include/functions_html.php: print_select function edited to deal with long fields.
* trunk/pandora_console/include/functions_ui.php: printTruncateText function edited to truncate in the middle of the word.
* trunk/pandora_console/pandoradb.sql: changed type for field "nombre" in "tgrupo" table.
* trunk/pandora_console/pandora_console_install: added support for Fedora. Thanks to philipmbrown.
* trunk/pandora_console/extensions/agents_modules.php: truncated text to 19 characters showing agent names
* trunk/pandora_console/operation/agentes/group_view.php: Truncated group name to deal with long fields.
* trunk/pandora_console/extras/pandoradb_migrate_v3.2_to_v4.0.sql: changed type for field "nombre" in "tgrupo" table.
* trunk/pandora_console/godmode/groups/group_list.php: Truncated group name to deal with long fields.
* trunk/pandora_console/godmode/agentes/modificar_agente.php: truncated agent names to deal with long fields.
2010-01-14 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_db.php: In get_group_agents function, now agent's name search is not case sensitive.

View File

@ -218,7 +218,7 @@ function mainAgentsModules() {
echo "<tr style='height: 35px;'>";
$file_name = string2image(printTruncateText($agent['nombre'],17, false, true, false, '...'), 140, 15, 3, 0, $rowcolor, $textcolor, 4, 0);
$file_name = string2image(printTruncateText($agent['nombre'],19, false, true, false, '...'), 140, 15, 3, 0, $rowcolor, $textcolor, 4, 0);
echo "<td style='background-color: ".$rowcolor.";'><a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$agent['id_agente']."'>".print_image($file_name, true, array('title' => $agent['nombre']))."</a></td>";
$agent_modules = get_agent_modules($agent['id_agente']);

View File

@ -0,0 +1,24 @@
-- Pandora FMS - the Flexible Monitoring System
-- ============================================
-- Copyright (c) 2010 Artica Soluciones Tecnológicas, http://www.artica.es
-- Please see http://pandora.sourceforge.net for full contribution list
-- This program is free software; you can redistribute it and/or
-- modify it under the terms of the GNU General Public License
-- as published by the Free Software Foundation for version 2.
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-- PLEASE NO NOT USE MULTILINE COMMENTS
-- Because Pandora Installer don't understand them
-- and fails creating database !!!
-- -----------------------------------------------------
-- Table `tgrupo`
-- -----------------------------------------------------
ALTER TABLE `tgrupo` MODIFY `nombre` text;

View File

@ -271,7 +271,7 @@ if ($agents !== false) {
echo '<span class="left">';
echo "<strong><a href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=main&
id_agente=".$agent["id_agente"]."'>".$agent["nombre"]."</a></strong>";
id_agente=".$agent["id_agente"]."'>".printTruncateText($agent["nombre"], 30, true)."</a></strong>";
if ($agent["disabled"]) {
print_help_tip(__('Disabled'));
echo "</em>";

View File

@ -255,10 +255,10 @@ foreach ($groups as $id_group => $group) {
if ($group['hash_branch']) {
$data[0] = '<strong>'.$tabulation . ' ' .
'<a href="javascript: showBranch(' . $group['id_grupo'] . ', ' . $group['parent'] . ');" title="' . __('Show branch children') . '"><span class="symbol_' . $group['id_grupo'] . ' ' . $symbolBranchs . '">' . $symbol . '</span> '. $group['nombre'].'</a></strong>';
'<a href="javascript: showBranch(' . $group['id_grupo'] . ', ' . $group['parent'] . ');" title="' . __('Show branch children') . '"><span class="symbol_' . $group['id_grupo'] . ' ' . $symbolBranchs . '">' . $symbol . '</span> '. printTruncateText($group['nombre']).'</a></strong>';
}
else {
$data[0] = '<strong>'.$tabulation . ' '. $group['nombre'].'</strong>';
$data[0] = '<strong>'.$tabulation . ' '. printTruncateText($group['nombre']).'</strong>';
}
$data[1] = print_group_icon($group['id_grupo'], true);
$data[2] = $group['disabled'] ? __('Disabled') : __('Enabled');

View File

@ -248,10 +248,10 @@ function print_select ($fields, $name, $selected = '', $script = '', $nothing =
}
if ($style === false) {
$styleText = '';
$styleText = 'style="max-width: 180px"';
}
else {
$styleText = 'style="' . $style . '"';
$styleText = 'style="max-width: 180px; ' .$style . '"';
}
$output .= '<select id="'.$id.'" name="'.$name.'"'.$attributes.' ' . $styleText . '>';

View File

@ -24,16 +24,21 @@
* true the html artifal to show the tooltip with rest of text.
*
* @param string $text The text to truncate.
* @param integer $numChars Number chars (-1 for char "...") max the text.
* @param integer $numChars Number chars (-3 for char "[...]") max the text.
* @param boolean $showTextInAToopTip Flag to show the tooltip.
* @param boolean $return Flag to return as string or not.
* @param boolean $showTextInTitle Flag to show the text on title.
* @param string $suffix String at the end of a strimmed string.
*/
function printTruncateText($text, $numChars = 25, $showTextInAToopTip = true, $return = true, $showTextInTitle = true, $suffix = '&hellip;') {
function printTruncateText($text, $numChars = 25, $showTextInAToopTip = true, $return = true, $showTextInTitle = true, $suffix = '[&hellip;]') {
$text = safe_output_html($text);
if (strlen($text) > ($numChars - 1)) {
$truncateText = mb_strimwidth($text, 0, ($numChars - 1)) . $suffix;
if ((strlen($text)) > ($numChars)) {
$l=intval(($numChars-3)/2); // '/2' because [...] is in the middle of the word.
$truncateText2 = mb_strimwidth($text, (strlen($text)-$l), strlen($text));
// In case $numChars were an odd number.
$l=$numChars-$l-3;
$truncateText = mb_strimwidth($text, 0, $l) . $suffix;
$truncateText=$truncateText . $truncateText2;
if ($showTextInTitle) {
$truncateText = '<span title="'.$text.'">'.$truncateText.'</span>';

View File

@ -58,19 +58,9 @@ print_page_header (__("Group view"), "images/bricks.png", false, "", false, $upd
$groups_info = array ();
$counter = 1;
// Old style table, we need a lot of special formatting,don't use table function
// Prepare old-style table
$agents = get_group_agents(array_keys($groups));
foreach ($groups as $id_group) {
$data = get_group_stats($id_group);
if ($data["total_agents"] == 0) {
$agents = 0;
} else {
$agents = 1;
}
}
if ($agents == 1) {
if (count($agents) > 0) {
echo '<table cellpadding="0" cellspacing="0" border="0" width="98%">';
@ -124,7 +114,7 @@ foreach ($groups as $id_group => $group_name) {
echo "</td>";
echo "<td style='font-weight: bold; font-size: 12px;'>";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id=$id_group'>";
echo $group_name;
echo printTruncateText($group_name, 35);
echo "</a>";
echo "</td>";
echo "<td style='text-align: center; vertica-align: middle;'>";

View File

@ -1,8 +1,8 @@
#!/bin/sh
# Pandora FMS Console Installer (c) 2008-2010 Artica ST
# Linux/FreeBSD Version (generic), for SuSe, Debian/Ubuntu, RHEL/CentOS and
# FreeBSD only
# Linux/FreeBSD Version (generic), for SuSe, Debian/Ubuntu, RHEL/CentOS,
# Fedora and FreeBSD only
# other Linux distros could not work properly without modifications
# Please see http://www.pandorafms.org
# v3.2 Build 101125
@ -73,11 +73,16 @@ uninstall () {
then
PANDORA_HOME=/var/www/html/pandora_console
else
if [ "$DISTRO" = "FreeBSD" ]
if [ "$DISTRO" = "FEDORA" ]
then
PANDORA_HOME="/usr/local/www/data/pandora_console /usr/local/www/apache22/data/pandora_console"
PANDORA_HOME=/var/www/html/pandora_console
else
PANDORA_HOME=/srv/www/htdocs/pandora
if [ "$DISTRO" = "FreeBSD" ]
then
PANDORA_HOME="/usr/local/www/data/pandora_console /usr/local/www/apache22/data/pandora_console"
else
PANDORA_HOME=/srv/www/htdocs/pandora
fi
fi
fi
fi
@ -103,18 +108,24 @@ install () {
PANDORA_HOME=/var/www/html/pandora_console
PANDORA_CONF=$PANDORA_HOME/include/config.php
else
if [ "$DISTRO" = "FreeBSD" ]
if [ "$DISTRO" = "FEDORA" ]
then
if [ -d /usr/local/www/apache22 ]
then
PANDORA_HOME=/usr/local/www/apache22/data/pandora_console
else
PANDORA_HOME=/usr/local/www/data/pandora_console
fi
PANDORA_HOME=/var/www/html/pandora_console
PANDORA_CONF=$PANDORA_HOME/include/config.php
else
PANDORA_HOME=/srv/www/htdocs/pandora
PANDORA_CONF=$PANDORA_HOME/include/config.php
if [ "$DISTRO" = "FreeBSD" ]
then
if [ -d /usr/local/www/apache22 ]
then
PANDORA_HOME=/usr/local/www/apache22/data/pandora_console
else
PANDORA_HOME=/usr/local/www/data/pandora_console
fi
PANDORA_CONF=$PANDORA_HOME/include/config.php
else
PANDORA_HOME=/srv/www/htdocs/pandora
PANDORA_CONF=$PANDORA_HOME/include/config.php
fi
fi
fi
fi
@ -173,15 +184,21 @@ install () {
then
chown -R apache:apache $PANDORA_HOME
chown -R pandora:apache /var/spool/pandora/
else
if [ "$DISTRO" = "FreeBSD" ]
else
if [ "$DISTRO" = "FEDORA" ]
then
chown -R www:www $PANDORA_HOME
chown -R pandora:www /var/spool/pandora/
chown -R apache:apache $PANDORA_HOME
chown -R pandora:apache /var/spool/pandora/
else
# Assuming SUSE
chown -R wwwrun:root $PANDORA_HOME
chown -R pandora:www /var/spool/pandora/
if [ "$DISTRO" = "FreeBSD" ]
then
chown -R www:www $PANDORA_HOME
chown -R pandora:www /var/spool/pandora/
else
# Assuming SUSE
chown -R wwwrun:root $PANDORA_HOME
chown -R pandora:www /var/spool/pandora/
fi
fi
fi
fi

View File

@ -430,7 +430,7 @@ CREATE TABLE IF NOT EXISTS `tevento` (
CREATE TABLE IF NOT EXISTS `tgrupo` (
`id_grupo` mediumint(4) unsigned NOT NULL auto_increment,
`nombre` varchar(100) NOT NULL default '',
`nombre` text NOT NULL default '',
`icon` varchar(50) default NULL default 'world',
`parent` mediumint(4) unsigned NOT NULL default '0',
`propagate` tinyint(1) unsigned NOT NULL default '0',