Files
alfresco-community-repo/source/web/scripts/office/search.js
Mike Hatfield fabc884c7b Merged V2.9 to HEAD
9229: Merged V2.1 to V2.9
      8654: Office add-in client updates
      8655: Office add-in UI updates
   9230: Minor updates to Office add-in UI webscripts


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@9242 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2008-05-22 20:39:26 +00:00

62 lines
1.7 KiB
JavaScript

/*
* Prerequisites: mootools.v1.11.js
* office_addin.js
*/
var OfficeSearch =
{
init: function()
{
$('searchText').addEvent('keydown', function(event)
{
event = new Event(event);
if (event.key == 'enter')
{
$("simpleSearchButton").onclick();
}
});
$('itemsFound').innerHTML = "Results Shown Below";
},
itemsFound: function(shownResults, totalResults)
{
var strFound;
if (totalResults == 0)
{
strFound = "No items found";
}
else if (shownResults < totalResults)
{
strFound = "Showing first " + shownResults + " of " + totalResults + " total items found";
}
else
{
strFound = "Showing all " + shownResults + " items found";
}
$('itemsFound').innerHTML = strFound;
},
/* AJAX call to perform server-side search */
runSearch: function(useTemplate, argPath)
{
OfficeAddin.showStatusText("Searching...", "ajax_anim.gif", false);
var searchString = $('searchText').value;
var maxResults = $('maxResults').value;
var actionURL = useTemplate + argPath + "&search=" + encodeURIComponent(searchString) + "&maxresults=" + maxResults;
var myAjax = new Ajax(actionURL, {
method: 'get',
headers: {'If-Modified-Since': 'Sat, 1 Jan 2000 00:00:00 GMT'},
evalScripts: true,
onComplete: function(textResponse, xmlResponse)
{
OfficeAddin.hideStatusText();
$('searchResultsList').innerHTML = textResponse;
}
});
myAjax.request();
}
};
window.addEvent('domready', OfficeSearch.init);