Index: branches/RC/core/install/install_schema.sql
===================================================================
diff -u -r10908 -r10923
--- branches/RC/core/install/install_schema.sql (.../install_schema.sql) (revision 10908)
+++ branches/RC/core/install/install_schema.sql (.../install_schema.sql) (revision 10923)
@@ -622,3 +622,13 @@
KEY MisspelledWord (MisspelledWord),
KEY SuggestedCorrection (SuggestedCorrection)
);
+
+CREATE TABLE Thesaurus (
+ ThesaurusId int(11) NOT NULL auto_increment,
+ SearchTerm varchar(255) NOT NULL default '',
+ ThesaurusTerm varchar(255) NOT NULL default '',
+ ThesaurusType tinyint(3) unsigned NOT NULL default '0',
+ PRIMARY KEY (ThesaurusId),
+ KEY ThesaurusType (ThesaurusType),
+ KEY SearchTerm (SearchTerm)
+);
\ No newline at end of file
Index: branches/RC/core/install/upgrades.sql
===================================================================
diff -u -r10918 -r10923
--- branches/RC/core/install/upgrades.sql (.../upgrades.sql) (revision 10918)
+++ branches/RC/core/install/upgrades.sql (.../upgrades.sql) (revision 10923)
@@ -359,4 +359,14 @@
);
INSERT INTO ConfigurationValues VALUES(NULL, 'YahooApplicationId', '56QxES3V34FXHPPcrPI_6.0mjc6QIG4AnHP0OC2LZEePW0nq_uNG.kVmSKG4llurekJ.OIE-', 'In-Portal', 'in-portal:configure_categories');
-INSERT INTO ConfigurationAdmin VALUES('YahooApplicationId', 'la_Text_General', 'la_config_YahooApplicationId', 'text', NULL, NULL, 10.15, 0, 0);
\ No newline at end of file
+INSERT INTO ConfigurationAdmin VALUES('YahooApplicationId', 'la_Text_General', 'la_config_YahooApplicationId', 'text', NULL, NULL, 10.15, 0, 0);
+
+CREATE TABLE Thesaurus (
+ ThesaurusId int(11) NOT NULL auto_increment,
+ SearchTerm varchar(255) NOT NULL default '',
+ ThesaurusTerm varchar(255) NOT NULL default '',
+ ThesaurusType tinyint(3) unsigned NOT NULL default '0',
+ PRIMARY KEY (ThesaurusId),
+ KEY ThesaurusType (ThesaurusType),
+ KEY SearchTerm (SearchTerm)
+);
\ No newline at end of file
Index: branches/RC/core/admin_templates/thesaurus/thesaurus_edit.tpl
===================================================================
diff -u
--- branches/RC/core/admin_templates/thesaurus/thesaurus_edit.tpl (revision 0)
+++ branches/RC/core/admin_templates/thesaurus/thesaurus_edit.tpl (revision 10923)
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/RC/admin/install/inportal_remove.sql
===================================================================
diff -u -r10908 -r10923
--- branches/RC/admin/install/inportal_remove.sql (.../inportal_remove.sql) (revision 10908)
+++ branches/RC/admin/install/inportal_remove.sql (.../inportal_remove.sql) (revision 10923)
@@ -238,4 +238,6 @@
# --------------------------------------------------------
DROP TABLE Agents
# --------------------------------------------------------
-DROP TABLE SpellingDictionary
\ No newline at end of file
+DROP TABLE SpellingDictionary
+# --------------------------------------------------------
+DROP TABLE Thesaurus
Index: branches/RC/core/install/english.lang
===================================================================
diff -u -r10908 -r10923
--- branches/RC/core/install/english.lang (.../english.lang) (revision 10908)
+++ branches/RC/core/install/english.lang (.../english.lang) (revision 10923)
@@ -7,7 +7,10 @@
TmV4dCBSdW4gT24=
UnVuIEludGVydmFs
UnVuIE1vZGU=
+ U2VhcmNoIFRlcm0=
U3VnZ2VzdGVkIENvcnJlY3Rpb24=
+ VGhlc2F1cnVzIFRlcm0=
+ VGhlc2F1cnVzIFR5cGU=
RmlsZW5hbWUgU3BlY2lhbCBDaGFyIFJlcGxhY2VtZW50
RXZlbnQ=
RmlsZW5hbWUgUmVwbGFjZW1lbnRz
@@ -18,7 +21,10 @@
UnVuIEludGVydmFs
UnVuIE1vZGU=
UnVuIFRpbWU=
+ U2VhcmNoIFRlcm0=
U3VnZ2VzdGVkIENvcnJlY3Rpb24=
+ VGhlc2F1cnVzIFRlcm0=
+ VGhlc2F1cnVzIFR5cGU=
VHlwZQ==
QWN0aXZl
QWZ0ZXI=
@@ -36,6 +42,7 @@
RWRpdGluZyBTcGVsbGluZyBEaWN0aW9uYXJ5
TmV3IEFnZW50
U3BlbGxpbmcgRGljdGlvbmFyeQ==
+ VGhlc2F1cnVz
\ No newline at end of file
Index: branches/RC/core/units/thesaurus/thesaurus_tp.php
===================================================================
diff -u
--- branches/RC/core/units/thesaurus/thesaurus_tp.php (revision 0)
+++ branches/RC/core/units/thesaurus/thesaurus_tp.php (revision 10923)
@@ -0,0 +1,82 @@
+getObject();
+ /* @var $object kDBItem */
+
+ $params['search_type'] = 'subsearch';
+ $params['keywords'] = $object->GetDBField('ThesaurusTerm');
+ $params['narrow_search'] = 1;
+
+ return $this->Application->ProcessParsedTag('m', 'Link', $params);
+ }
+
+ function _getThesaurusRecords()
+ {
+ $keywords = unhtmlentities( trim($this->Application->GetVar('keywords')) );
+ $table_name = $this->Application->getUnitOption($this->Prefix, 'TableName');
+
+ $sql = 'SELECT *
+ FROM ' . $table_name . '
+ WHERE SearchTerm LIKE ' . $this->Conn->qstr($keywords).' OR SearchTerm LIKE ' . $this->Conn->qstr($keywords . '_');
+ $records = $this->Conn->Query($sql);
+
+ $new_records = Array ();
+ foreach ($records as $record) {
+ if ($record['ThesaurusType'] == THESAURUS_TYPE_USE) {
+ // expand in global scope
+ $sql = 'SELECT *
+ FROM ' . $table_name . '
+ WHERE SearchTerm = ' . $this->Conn->qstr($record['ThesaurusTerm']);
+ $use_records = $this->Conn->Query($sql);
+ if ($use_records) {
+ $new_records = array_merge($new_records, $use_records);
+ }
+ }
+
+ $new_records[] = $record;
+ }
+
+ usort($new_records, Array (&$this, '_sortThesaurus'));
+ ksort($new_records);
+
+ return $new_records;
+ }
+
+ function HasThesaurus($params)
+ {
+ $new_records = $this->_getThesaurusRecords();
+ return count($new_records) > 0;
+ }
+
+ function PrintThesaurus($params)
+ {
+ $new_records = $this->_getThesaurusRecords();
+
+ $ret = '';
+ $block_params = $this->prepareTagParams($params);
+ $block_params['name'] = $params['render_as'];
+ foreach ($new_records as $record) {
+ $block_params['term'] = $record['ThesaurusTerm'];
+
+ $url_params = Array (
+ 'search_type' => 'subsearch',
+ 'keywords' => $record['ThesaurusTerm'],
+ 'narrow_search' => 1,
+ );
+ $block_params['url'] = $this->Application->ProcessParsedTag('m', 'Link', $url_params);
+
+ $ret .= $this->Application->ParseBlock($block_params);
+ }
+
+ return $ret;
+ }
+
+ function _sortThesaurus($record_a, $record_b)
+ {
+ return strcmp(strtolower($record_a['ThesaurusTerm']), strtolower($record_b['ThesaurusTerm']));
+ }
+ }
Index: branches/RC/core/admin_templates/thesaurus/thesaurus_list.tpl
===================================================================
diff -u
--- branches/RC/core/admin_templates/thesaurus/thesaurus_list.tpl (revision 0)
+++ branches/RC/core/admin_templates/thesaurus/thesaurus_list.tpl (revision 10923)
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: branches/RC/core/units/thesaurus/thesaurus_config.php
===================================================================
diff -u
--- branches/RC/core/units/thesaurus/thesaurus_config.php (revision 0)
+++ branches/RC/core/units/thesaurus/thesaurus_config.php (revision 10923)
@@ -0,0 +1,85 @@
+ 'thesaurus',
+ 'ItemClass' => Array ('class' => 'kDBItem', 'file' => '', 'build_event' => 'OnItemBuild'),
+ 'ListClass' => Array ('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'),
+ 'EventHandlerClass' => Array ('class' => 'ThesaurusEventHandler', 'file' => 'thesaurus_eh.php', 'build_event' => 'OnBuild'),
+ 'TagProcessorClass' => Array ('class' => 'ThesaurusTagProcessor', 'file' => 'thesaurus_tp.php', 'build_event' => 'OnBuild'),
+
+ 'AutoLoad' => true,
+
+ 'QueryString' => Array (
+ 1 => 'id',
+ 2 => 'Page',
+ 3 => 'event',
+ 4 => 'mode',
+ ),
+
+ 'IDField' => 'ThesaurusId',
+
+ 'TableName' => TABLE_PREFIX.'Thesaurus',
+
+ 'TitleField' => 'SearchTerm',
+
+ 'TitlePresets' => Array (
+ 'default' => Array (
+ 'new_status_labels' => Array ('thesaurus' => '!la_title_AddingThesaurus!'),
+ 'edit_status_labels' => Array ('thesaurus' => '!la_title_EditingThesaurus!'),
+ ),
+
+ 'thesaurus_list' => Array ('prefixes' => Array ('thesaurus_List'), 'format' => "!la_title_Thesaurus! (#thesaurus_recordcount#)"),
+ 'thesaurus_edit' => Array ('prefixes' => Array ('thesaurus'), 'format' => "#thesaurus_status# '#thesaurus_titlefield#'"),
+ ),
+
+ 'PermSection' => Array('main' => 'in-portal:thesaurus'),
+
+ 'Sections' => Array (
+ 'in-portal:thesaurus' => Array (
+ 'parent' => 'in-portal:site',
+ 'icon' => 'custom',
+ 'label' => 'la_title_Thesaurus',
+ 'url' => Array('t' => 'thesaurus/thesaurus_list', 'pass' => 'm'),
+ 'permissions' => Array('view', 'add', 'edit', 'delete'),
+ 'priority' => 4.2,
+ 'type' => stTREE,
+ ),
+ ),
+
+ 'ListSQLs' => Array (
+ '' => ' SELECT %1$s.* %2$s FROM %1$s',
+ ),
+
+ 'ListSortings' => Array (
+ '' => Array (
+ 'Sorting' => Array ('SearchTerm' => 'asc'),
+ )
+ ),
+
+ 'Fields' => Array (
+ 'ThesaurusId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
+ 'SearchTerm' => Array ('type' => 'string', 'max_len' => 255, 'required' => 1, 'not_null' => 1, 'default' => ''),
+ 'ThesaurusTerm' => Array ('type' => 'string', 'max_len' => 255, 'required' => 1, 'not_null' => 1, 'default' => ''),
+ 'ThesaurusType' => Array (
+ 'type' => 'int',
+ 'formatter' => 'kOptionsFormatter', 'options' => Array (
+ 0 => 'NT',
+// 1 => 'RT',
+// 2 => 'USE'
+ ),
+ 'not_null' => 1, 'required' => 1, 'default' => 0
+ ),
+ ),
+
+ 'Grids' => Array (
+ 'Default' => Array (
+ 'Icons' => Array ('default' => 'icon16_custom.gif'),
+ 'Fields' => Array (
+ 'ThesaurusId' => Array ('title' => 'la_col_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter', ),
+ 'SearchTerm' => Array ('title' => 'la_col_SearchTerm', 'filter_block' => 'grid_like_filter',),
+ 'ThesaurusTerm' => Array ('title' => 'la_col_ThesaurusTerm', 'filter_block' => 'grid_like_filter',),
+ 'ThesaurusType' => Array ('title' => 'la_col_ThesaurusType', 'filter_block' => 'grid_options_filter',),
+ ),
+ ),
+ ),
+ );
\ No newline at end of file
Index: branches/RC/core/units/thesaurus/thesaurus_eh.php
===================================================================
diff -u
--- branches/RC/core/units/thesaurus/thesaurus_eh.php (revision 0)
+++ branches/RC/core/units/thesaurus/thesaurus_eh.php (revision 10923)
@@ -0,0 +1,22 @@
+getObject();
+ /* @var $object kDBList */
+
+ if (!$this->Application->IsAdmin()) {
+ $keywords = unhtmlentities( trim($this->Application->GetVar('keywords')) );
+ $object->addFilter('search_filter', '%1$s.SearchTerm LIKE ' . $this->Conn->qstr($keywords).' OR %1$s.SearchTerm LIKE ' . $this->Conn->qstr($keywords . '_'));
+ }
+ }
+ }
\ No newline at end of file