From 37e3536d01ed4f75f58839e4ad08dcb600f157e7 Mon Sep 17 00:00:00 2001 From: Conrad Vermeulen Date: Fri, 11 Jan 2008 09:56:23 +0000 Subject: [PATCH] KTS-2456 "Dropdown in search bar and search portlet needs to be aligned correctly" Fixed. --- lib/templating/kt3template.inc.php | 15 ++++++++++++--- lib/templating/smartytemplate.inc.php | 4 ++-- resources/js/search2widget.js | 202 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ templates/kt3/standard_page.smarty | 184 ++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------------------- templates/ktcore/search2/search_portlet.smarty | 13 +++---------- thirdpartyjs/extjs/ext-all.js | 18 +++++++++--------- 6 files changed, 278 insertions(+), 158 deletions(-) create mode 100644 resources/js/search2widget.js diff --git a/lib/templating/kt3template.inc.php b/lib/templating/kt3template.inc.php index b8f0793..3f7e23d 100644 --- a/lib/templating/kt3template.inc.php +++ b/lib/templating/kt3template.inc.php @@ -104,7 +104,13 @@ class KTPage { $aCSS = Array( "resources/css/kt-framing.css", "resources/css/kt-contenttypes.css", - "resources/css/kt-headings.css" + "resources/css/kt-headings.css", +// "thirdpartyjs/extjs/resources/css/xtheme-kt.css", + "thirdpartyjs/extjs/resources/css/ext-all.css", + "thirdpartyjs/extjs/examples/examples.css", + // "thirdpartyjs/extjs/examples/menu/menu.css", + "thirdpartyjs/extjs/examples/lib.css", +// "skins/kt-toolbar.css" ); $this->requireCSSResources($aCSS); @@ -134,9 +140,12 @@ class KTPage { $aJS[] = 'thirdpartyjs/curvycorners/rounded_corners.inc.js'; $aJS[] = 'resources/js/loader.js'; $aJS[] = 'thirdpartyjs/yui/tools/tools.js'; - $aJS[] = 'thirdpartyjs/yui/connection/connection.js'; - + $aJS[] = 'thirdpartyjs/yui/connection/connection-min.js'; + $aJS[] = 'thirdpartyjs/extjs/adapter/ext/ext-base.js'; + $aJS[] = 'thirdpartyjs/extjs/ext-all.js'; + $aJS[] = 'thirdpartyjs/extjs/examples/examples.js'; + $aJS[] = 'resources/js/search2widget.js'; //$aJS[] = 'thirdpartyjs/MochiKit/.js'; //$aJS[] = 'resources/js/translate.js'; diff --git a/lib/templating/smartytemplate.inc.php b/lib/templating/smartytemplate.inc.php index 34dadcc..1d21484 100644 --- a/lib/templating/smartytemplate.inc.php +++ b/lib/templating/smartytemplate.inc.php @@ -90,14 +90,14 @@ class KTSmartyTemplate extends KTTemplate { $search2_quickQuery = trim($_SESSION['search2_quickQuery']); if ($search2_quickQuery == '') { - $search2_quickQuery = _kt('Enter search criteria'); + $search2_quickQuery = ''; } } else { $search2_quick=0; $search2_general=1; - $search2_quickQuery = _kt('Enter search criteria'); + $search2_quickQuery = ''; $_SESSION['search2_quick'] = $search2_quick; $_SESSION['search2_general'] = $search2_general; $_SESSION['search2_quickQuery'] = ''; diff --git a/resources/js/search2widget.js b/resources/js/search2widget.js new file mode 100644 index 0000000..e898cfb --- /dev/null +++ b/resources/js/search2widget.js @@ -0,0 +1,202 @@ +Ext.onReady(function(){ + +var bSearchOptionMetadataAndContent = true; + +Ext.BLANK_IMAGE_URL = '../../thirdpartyjs/extjs/resources/images/default/s.gif'; + +function doAdvancedSearch() +{ + document.location=rootURL + "/search2.php?action=guiBuilder"; +} + +function doViewPreviousSearchResults() +{ + document.location=rootURL + "/search2.php?action=searchResults"; +} + +function onMetadataAndContentClick() +{ + bSearchOptionMetadataAndContent = true; + Ext.example.msg(sSearchTranslations[0], sSearchTranslations[1]); /* Quick Search Options, Searches will now search both content and metadata */ +} + +function onMetadataClick() +{ + bSearchOptionMetadataAndContent = false; + Ext.example.msg(sSearchTranslations[0], sSearchTranslations[2]); /* Quick Search Options, Searches will now only search metadata */ +} + +function onSavedSearchClick(item) +{ + id = item.id.substr(11); + document.location=rootURL + "/search2.php?action=processSaved&fSavedSearchId=" + id; +} + +function onSearchClick(sender) +{ + + var suffix = sender.id.substring(12); + + var text = Ext.get('txtSearchBar' + suffix).getValue(false); + + if (text == sSearchTranslations[12] || text == '') + { + Ext.example.msg(sSearchTranslations[3], sSearchTranslations[4]); /* Hint, Please enter some search criteria! */ + return; + } + + var sq = document.getElementById('txtQuery'); + var qg = document.getElementById('cbQuickGeneral'); + + text = text.replace(/\"/g, "'"); + + if (bSearchOptionMetadataAndContent) + { + sq.value = '(GeneralText contains "' + text + '")'; + } + else + { + sq.value = '(Metadata contains "' + text + '")'; + } + qg.value = bSearchOptionMetadataAndContent?1:0; + + var frm = document.getElementById('frmQuickSearch'); + frm.submit(); + +} + +function populateSavedSearch(menu) +{ + if (aSavedSearches.length == 0) + { + return; + } + item = menu.addMenuItem({ + text: sSearchTranslations[5], /*Saved Searches*/ + menu: { + items: [] + } + }); + + for(i=0;i {foreach item=sJavascript from=$page->getJSStandalone()} {/foreach} @@ -90,123 +92,47 @@
  • {/foreach} - {literal} + - {/literal} + {literal} + + {/literal}
  • {if ($page->user)} @@ -231,28 +157,18 @@
  • - - - + +
    + +
    + + +
  • @@ -332,13 +248,13 @@
    {foreach item=sError from=$page->errStack} - + {if ($page->booleanLink == '0')}

    {$sError|sanitize}

    {else}

    {$sError}

    - {/if} - + {/if} + {/foreach}
    diff --git a/templates/ktcore/search2/search_portlet.smarty b/templates/ktcore/search2/search_portlet.smarty index cd800ac..d027220 100644 --- a/templates/ktcore/search2/search_portlet.smarty +++ b/templates/ktcore/search2/search_portlet.smarty @@ -1,13 +1,6 @@ -
    - - - -
    + +
    +