From 9d2c0a113cd7505c8555c1a9a3e23974ebcd58d4 Mon Sep 17 00:00:00 2001 From: Megan Watson Date: Wed, 10 Sep 2008 14:04:08 +0000 Subject: [PATCH] KTS-3459 "Make length of document and folder display names configurable." Fixed. Added a new config setting to set the length. --- plugins/ktcore/KTColumns.inc.php | 14 ++++++++++---- sql/mysql/install/data.sql | 3 ++- sql/mysql/upgrade/3.5.3/length_config_setting.sql | 3 +++ 3 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 sql/mysql/upgrade/3.5.3/length_config_setting.sql diff --git a/plugins/ktcore/KTColumns.inc.php b/plugins/ktcore/KTColumns.inc.php index 87c258c..0110aea 100644 --- a/plugins/ktcore/KTColumns.inc.php +++ b/plugins/ktcore/KTColumns.inc.php @@ -81,9 +81,12 @@ class AdvancedTitleColumn extends AdvancedColumn { function renderFolderLink($aDataRow) { /* this check has to be done so that any titles longer than 40 characters is not displayed incorrectly. as mozilla cannot wrap text without white spaces */ - if (mb_strlen($aDataRow["folder"]->getName(), 'UTF-8') > 40) { + global $default; + $charLength = (isset($default->titleCharLength)) ? $default->titleCharLength : 40; + + if (mb_strlen($aDataRow["folder"]->getName(), 'UTF-8') > $charLength) { mb_internal_encoding("UTF-8"); - $outStr = htmlentities(mb_substr($aDataRow["folder"]->getName(), 0, 40, 'UTF-8')."...", ENT_NOQUOTES, 'UTF-8'); + $outStr = htmlentities(mb_substr($aDataRow["folder"]->getName(), 0, $charLength, 'UTF-8')."...", ENT_NOQUOTES, 'UTF-8'); }else{ $outStr = htmlentities($aDataRow["folder"]->getName(), ENT_NOQUOTES, 'UTF-8'); } @@ -97,9 +100,12 @@ class AdvancedTitleColumn extends AdvancedColumn { function renderDocumentLink($aDataRow) { /* this check has to be done so that any titles longer than 40 characters is not displayed incorrectly. as mozilla cannot wrap text without white spaces */ - if (mb_strlen($aDataRow["document"]->getName(), 'UTF-8') > 40) { + global $default; + $charLength = (isset($default->titleCharLength)) ? $default->titleCharLength : 40; + + if (mb_strlen($aDataRow["document"]->getName(), 'UTF-8') > $charLength) { mb_internal_encoding("UTF-8"); - $outStr = htmlentities(mb_substr($aDataRow["document"]->getName(), 0, 40, 'UTF-8')."...", ENT_NOQUOTES, 'UTF-8'); + $outStr = htmlentities(mb_substr($aDataRow["document"]->getName(), 0, $charLength, 'UTF-8')."...", ENT_NOQUOTES, 'UTF-8'); }else{ $outStr = htmlentities($aDataRow["document"]->getName(), ENT_NOQUOTES, 'UTF-8'); } diff --git a/sql/mysql/install/data.sql b/sql/mysql/install/data.sql index 4c12ca5..4b56921 100644 --- a/sql/mysql/install/data.sql +++ b/sql/mysql/install/data.sql @@ -269,7 +269,8 @@ INSERT INTO `config_settings` VALUES (95, 'KnowledgeTree', 'Redirect To Browse View', 'Defines whether to redirect to the Browse view (Browse Documemts) on login, instead of the Dashboard.
Default is \'False\'. ', 'redirectToBrowse', 'default', 'false', 'boolean', NULL, 1), (96, 'KnowledgeTree', 'Redirect To Browse View: Exceptions', 'Specifies that, when \'Redirect To Browse\' is set to \'True\' all users, except for the users listed in the text field below are redirected to the Browse view on log in. The users listed for this setting are directed to the KnowledgeTree Dashboard. To define exceptions, add user names in the text field as follows, e.g. admin, joebloggs, etc.', 'redirectToBrowseExceptions', '', '', '', NULL, 1), (97, 'session', 'Allow Automatic Sign In', 'Defines whether to automatically create a user account on first login for any user who does not yet exist in the system. Default is \'False\'.', 'allowAutoSignup', 'default', 'false', 'boolean', '', 1), -(98, 'ldapAuthentication', 'Create Groups Automatically', 'Defines whether to allow LDAP groups to be created automatically. Default is \'False\'.', 'autoGroupCreation', 'default', 'false', 'boolean', '', 1); +(98, 'ldapAuthentication', 'Create Groups Automatically', 'Defines whether to allow LDAP groups to be created automatically. Default is \'False\'.', 'autoGroupCreation', 'default', 'false', 'boolean', '', 1), +(99, 'browse', 'Truncate Document and Folder Titles in Browse View', 'Defines the length of the document or folder title displayed in the browse view.', 'titleCharLength', 'default', '40', 'numeric_string', '', 1); /*!40000 ALTER TABLE `config_settings` ENABLE KEYS */; UNLOCK TABLES; diff --git a/sql/mysql/upgrade/3.5.3/length_config_setting.sql b/sql/mysql/upgrade/3.5.3/length_config_setting.sql new file mode 100644 index 0000000..af35a67 --- /dev/null +++ b/sql/mysql/upgrade/3.5.3/length_config_setting.sql @@ -0,0 +1,3 @@ +INSERT INTO `config_settings` (group_name, display_name, description, item, value, default_value, type, options, can_edit) VALUES +('browse', 'Truncate Document and Folder Titles in Browse View', 'Defines the length of the document or folder title displayed in the +browse view.', 'titleCharLength', 'default', '40', 'numeric_string', '', 1); \ No newline at end of file -- libgit2 0.21.4