Files
alfresco-community-repo/source/web/scripts/office/search.js
Mike Hatfield 77cee95439 Merged V3.1 to HEAD
12950: JAWS-11 -  Integrate OpenOffice addin contribution (webscripts only)
          ETHREEOH-991 - Window without scroll bars is opened when we click "Manage" button on "Task details" screen(Microsoft Office Add-in)
          ETHREEOH-994 - Incorrect work when we try to open document by cliking on its version number on View Details tab(Microsoft Office Add-in)
          ETHREEOH-988 - Incorrect work of Search Alfresco tab(Microsoft Office Add-in)
   12951: ETHREEOH-1010 - IE window was not closed when we click "Save Changes" button on "Manage Task" page(Office Add-in)
   12952: JAWS-226 - Support Office 2007 Transformations
   12953: ALFCOM-2490 - MS Office 2007 documents can't be previewed

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13532 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2009-03-10 14:59:16 +00:00

71 lines
1.9 KiB
JavaScript

/*
* Prerequisites: mootools.v1.11.js
* office_addin.js
*/
var OfficeSearch =
{
MIN_LENGTH: 3,
init: function()
{
$('searchText').addEvent('keydown', function(event)
{
event = new Event(event);
if (event.key == 'enter')
{
$("simpleSearchButton").onclick();
}
});
$('itemsFound').innerHTML = "Results Shown Below";
$('searchText').focus();
},
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)
{
var searchString = $('searchText').value;
var maxResults = $('maxResults').value;
if (searchString.length < OfficeSearch.MIN_LENGTH)
{
OfficeAddin.showStatusText("Minimum " + OfficeSearch.MIN_LENGTH + " characters.", "info.gif", true);
return;
}
OfficeAddin.showStatusText("Searching...", "ajax_anim.gif", false);
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);