Fully Disable Search in ALUI Collab 4.5

| | Comments (2)
I'm working with a Collab deployment where we want to disable the search feature. This involves two things: disabling index requests from Collab to the Search Server and removing the search form from Collab's web UI.

Disabling Index Requests from Collab to Search

The easy part is disabling index requests from Collab to the Search Server. Just open %ALUI_HOME%\ptcollab\4.5\settings\config\config.xml and change the value for "search enabled" from "yes" to "no."

Removing Search from Project Explorer UI

For whatever reason, the Project Explorer view of Collab shows a search form even when the app is configured to not have its content index. This is shown below:

collab.projexp.search.before.jpg

















The only way I know of to remove the form is to modify the JSP files within collab.war. The process for modifying collab.war is:

  1. Open %ALUI_HOME%\ptcollab\4.5\webapp
  2. Backup webapp.war to webapp.war.orig
  3. Create a new subdirectory called build
  4. Extract collab.war into a new directory at %ALUI_HOME%\ptcollab\4.5\webapp\build
  5. Make the appropriate edits (described below)
  6. Package up the contents of %ALUI_HOME%\ptcollab\4.5\webapp\build
  7. Stop Collab
  8. Replace the old collab.war with the new one
  9. Start Collab
In the case you want to remove the search UI, as in this case, make the following edits:

  1. Open %ALUI_HOME%\ptcollab\4.5\webapp\war\project\appView\projectToolbar.jsp
  2. Comment out these lines:

        <jsc:toolbarHtmlBlock align="right"><nobr>
            <fmt:message key="project.search"/>
            <input type="text" id="searchText" class="formInputBoxText" align="center"/>
            <select id="searchScope" class="objectText" width="0%">
                <option value="all"><fmt:message key="project.search.scope.all.folders"/></option>
                <option value="current"><fmt:message key="project.search.scope.current.folder"/></option>
            </select>&nbsp;
        </jsc:toolbarHtmlBlock>
        <jsc:toolbarHtmlBlock align="right"><nobr>
            <collab:img src="search.gif" border="0" align="center" onclick="searchHandler()"/></nobr>
        </jsc:toolbarHtmlBlock>

  3. Open %ALUI_HOME%\ptcollab\4.5\webapp\war\layout\templates\appViewSearchBar.jsp
  4. Comment out these lines:

        <input type="hidden" name="projID" value="${fn:escapeXml(baseAppViewBean.currentProject.ID)}">
        <input type="hidden" name="isAppView" value ="true">
        <input type="hidden" name="projRestr" value ="1">
        <input type="hidden" name="collabType" value ="<%=com.plumtree.collaboration.cssearch.CollabIndexManager.OBJECT_TYPE_ALL%>">
            <td class="banText" align="${fn:escapeXml(tdAlign)}" width="50%" nowrap style="padding-right:5">
                <b><fmt:message key="project.search.label"/></b>
                <input size="32" name="searchString" value="" class="formInputBoxText">
                <collab:simpleUI>
                    <input type="submit" name="go" value="<fmt:message key="key.search"/>" class="formBtnText">
                </collab:simpleUI>
                <collab:notSimpleUI>
                <a href="#" onClick="document.searchForm.submit();"><collab:img src="search.gif" border="0" align="absmiddle" altKey="key.search"/></a>
                <a href="${fn:escapeXml(advancedSearchURL)}"><collab:img src="advancedSearch.gif" border="0" align="absmiddle" altKey="search.advanced"/></a>&nbsp;
                <input type="button" name="closeWindow" value="<bean:message key="button.close"/>" onClick="window.close()" class="formEditorBtnText">
                </collab:notSimpleUI>
            </td>

            <collab:simpleUI>
                <td class="banText" align="right">
                    <tiles:insert attribute="help"/>
                </td>
            </collab:simpleUI>


  5. Add the following lines in the place of what was just commented out:

    <td class="banText" align="${fn:escapeXml(tdAlign)}" width="50%" nowrap style="padding-right:5">
    <input type="button" name="closeWindow" value="<bean:message key="button.close"/>" onClick="window.close()" class="formEditorBtnText">
    </td>


  6. Save the files


The edits remove the undesired UI component from each project's individual view and the Project Explorer view, this latter being shown here:

collab.projexp.search.after.jpg

















By the way, these steps are a little tedious if you will need to tweak your customizations as you try to get it right. After setting up the directories and unzipping the original collab.war, I wrap the remaining steps in a script that lets me quickly run my iterations. That script's contents:

net stop "BEA ALI Collaboration"
c:
cd c:\bea\alui\ptcollab\4.5\webapp\build
zip -r collab.war *
mv -f collab.war ..\.
net start "BEA ALI Collaboration"


Note that I'm using command line tools "mv" and "zip" that come from the Unxutils project, a collection of Windows ports of Unix utilities.

That's it. Enjoy!


2 Comments

I could be wrong, but I would imagine it would be pretty easy to disable the search via CSS. Technically speaking you'd only be hiding it, but that should suit your purposes and would be much more upgrade friendly.

Geoff, you're absolutely right. The UI could be modified with CSS, which hadn't crossed my mind.

In my case the customer already has modifications to the collab.war file for other purposes, so we'll tinker with it at upgrade time in any case. Also, after looking into the code, I realize it doesn't lend itself to a simple CSS mod anyway. Unlike the core portal's UI, the Collab UI doesn't always use nicely named IDs. The search elements I need to remove aren't all accessible through discreet IDs such as "searchRegion."

Thanks for the insight.

Bill

Leave a comment