There was a question on the support forum today where a user wanted to hide certain attributes on the new document creation page but show it on the document properties page. This cannot be achieved by configuration in DAB as the definition would make it universal. The only way to do this is to customize the WDK component.
Ok here is the complete code tested and 100% functional:
1. Custom Docbase Attribute config file: Place the file in your custom/config directory.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<config version='1.0'>
<scope type="YOUR_CUSTOM_TYPE">
<!-- docbaseattributelist definition -->
<attributelist id="YOUR_ATTR_ID" extends="attributes:webcomponent/config/library/attributes_dm_document_docbasea
ttributelist.xml">
<data_dictionary_population>
<enable>true</enable>
<ddscopes>
<ddscope name="application">webtop</ddscope>
</ddscopes>
<ignore_attributes>
<!-- add any attributes that shouldn't be shown in the UI here -->
<!-- <attribute name="attribute2"/> -->
<attribute name="YOUR_ATTRIBUTE_TO_HIDE"/>
</ignore_attributes>
</data_dictionary_population>
</attributelist>
</scope>
</config> |
2. This will be your custom newdoccontainer component: Place the xml file in
custom/config directory
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<config version="1.0">
<scope>
<component extends="newdoccontainer:webcomponent/config/library/create/newdoccontainer_com
ponent.xml" id="newdoccontainer">
<!-- Contained components -->
<contains>
<component requiresVisit="true">newdocument</component>
<component requiresVisit="false">newdocattributes</component>
<component requiresVisit="false">permissions</component>
</contains>
</component>
</scope>
</config> |
3. Here is the definition for your newdocattributes component: Place it in your custom/config directory
<?xml version="1.0"?>
<config version="1.0">
<scope>
<component extends="attributes:/webcomponent/config/library/attributes/attributes_dm_docum
ent_component.xml" id="newdocattributes">
<!-- Component Layouts -->
<pages>
<start>/custom/attributes/new_document_attributes.jsp</start>
</pages>
</component>
</scope>
</config> |
4. Finally the jsp file for the above custom attributes component: Place it in custom/attributes directory and name it new_document_attributes.jsp
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page errorPage="/wdk/errorhandler.jsp" %>
<%@ taglib uri="/WEB-INF/tlds/dmform_1_0.tld" prefix="dmf" %>
<%@ taglib uri="/WEB-INF/tlds/dmformext_1_0.tld" prefix="dmfx" %>
?<dmf:html>
<dmf:head>
<dmf:webform/>
</dmf:head>
<dmf:body cssclass='contentBackground' id='attributes_dm_document' titlenlsid='MSG_TITLE' >
<dmf:form>
<!-- the Docbase object -->
<dmfx:docbaseobject name="obj" configid="attributes"/>
<!-- the attributes -->
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="spacer" width="4">
</td>
<td valign="top">
<table border="0" cellpadding="0" cellspacing="0">
<dmfx:docbaseattributelist name="attrlist" object="obj" attrconfigid="YOUR_ATTR_ID"/>
</table>
</td>
</tr>
<!-- show all attributes checkbox -->
<tr>
<td align="left" colspan="2" valign="middle" scope="row" height="30">
<dmf:checkbox name='show_all' onclick='onShowAllClicked' nlsid='MSG_SHOW_ALL_PROPERTIES'/>
</td>
</tr>
</table>
</dmf:form>
</dmf:body>
</dmf:html> |
Make sure you modify the following words YOUR_CUSTOM_TYPE, YOUR_ATTRIBUTE_TO_HIDE, YOUR_ATTR_ID as per your needs.
0 Comments.