',
'
{date:date("M j, Y")}
<\/span>{title}<\/h3>',
'{summary}',
'<\/div><\/tpl>'
);
var ds = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: '/echo/modules/pages/search.jsp'
}),
reader: new Ext.data.JsonReader({
root: 'data',
totalProperty: 'totalCount',
id: 'pageid'
},
[{name: 'title'}, {name: 'pageid'}, {name: 'templateid'}, {name: 'date',type: 'date', dateFormat: 'Y-m-d H:i:s'},{name: 'summary'}]
)
});
if($('search')){
var search = new Ext.form.ComboBox({
store: ds,
displayField:'title',
typeAhead: false,
loadingText: 'Searching...',
width: 360,
pageSize:10,
style: "margin-top:5px;",
hideTrigger:true,
tpl: resultTpl,
applyTo: 'search',
itemSelector: 'div.search-item',
onSelect: function(record){ // override default onSelect to do redirect
window.location = String.format('/content/{0}?q={1}', record.id, search.getValue());
}
});
}
});
function highlightWord(node,word, tagType, qtitle, qtext, classname) {
if(classname == null){classname = "searchword"}
// Iterate into this nodes childNodes
if (node.hasChildNodes) {
var hi_cn;
for (hi_cn=0;hi_cn 1){
highlightWord(document.getElementsByTagName("body")[0],words[w], tagType, qtitle, qtext, classname);
}
}
}
}
}