[opencms-dev] edit information OpenCms help........

Christian Steinert christian_steinert at web.de
Thu Oct 1 22:05:23 CEST 2009


>
> hello, I have to change the contextual menu that is displayed when you click the 
> right mouse button on a file in the Content Explorer (the one containing the 
> commands of publication, permissions, etc..) 
> What is the class generating 
> the option list in the contextual menu?
>   
The contextual menu can also be changed through XML config files, if you 
just want to change the menu items, add new sub menus and things like that.

For the builtin content types, you do that in opencms-vfs.xml, for your 
own content types you can do that by modifying your resource type config 
in opencms-modules.xml

here is an example for a custom resource type with custom context menu 
from opencms-modules.xml:

If you find this helpful and get it to work - then please document this 
on opencms-wiki.org. I don't think that this is documented anywhere so 
far and it would help others.

Best regards
Christian

Here is my config excerpt - I left out all the normal stuff of the 
module section

<opencms>
    <modules>
...
        <module>
...
            <resourcetypes>
                <type 
class="com.berzinarchives.cms.file.BaResourceTypeAudio" name="ba_audio" 
id="1003"/>
                    <properties>
                        <property>
                            <name>content-conversion</name>
                            <value 
type="shared"><![CDATA[cleanup;xhtml]]></value>
                        </property>
                        <property>
                            <name>template-elements</name>
                            <value 
type="shared"><![CDATA[/system/modules/com.berzinarchives.cms/templates/Article.jsp]]></value>
                        </property>
                    </properties>
                    <param 
name="schema">/system/modules/com.berzinarchives.cms/resources/ba_article.xsd</param>
                </type>
            </resourcetypes>
            <explorertypes> <!-- this is where you define your custom 
context menu structure. By default, this sub-section may not exist! -->
                <explorertype name="ba_audio" 
key="com.berzinarchives.cms.file.audio" 
icon="berzinarchives/ic_file_audio.gif">
                    <newresource 
uri="/system/modules/com.berzinarchives.cms/workplace/action/create_resource.jsp?newresourcetype=ba_audio" 
order="3" autosetnavigation="false" autosettitle="false"/>
                    <accesscontrol>
                        <accessentry principal="ROLE.WORKPLACE_USER" 
permissions="+r+v+w+c"/>
                    </accesscontrol>
                    <editoptions>
                        <defaultproperties enabled="false" 
shownavigation="false"/>
                        <contextmenu>
                            <entry key="GUI_EXPLORER_CONTEXT_LOCK_0" 
uri="commons/lock.jsp" rule="lock"/>
                            <entry 
key="GUI_EXPLORER_CONTEXT_OVERRIDELOCK_0" uri="commons/lockchange.jsp" 
rule="changelock"/>
                            <entry key="GUI_EXPLORER_CONTEXT_UNLOCK_0" 
uri="commons/unlock.jsp" rule="unlock"/>
                            <separator/>
                            <entry 
key="GUI_EXPLORER_CONTEXT_COPYTOPROJECT_0" 
uri="commons/copytoproject.jsp" rule="copytoproject"/>
                            <entry key="GUI_EXPLORER_CONTEXT_PUBLISH_0" 
uri="commons/publishresource.jsp" rule="directpublish"/>
                            <separator/>
                            <entry key="GUI_EXPLORER_CONTEXT_PROPERTY_0" 
uri="commons/ba_edit_properties.jsp" rule="nondeleted"/>
                            <separator/>
                            <entry key="GUI_EXPLORER_CONTEXT_COPY_0" 
uri="commons/copy.jsp" rule="copy"/>
                            <entry key="GUI_EXPLORER_CONTEXT_MOVE_0" 
uri="commons/move.jsp" rule="standard"/>
                            <entry key="GUI_EXPLORER_CONTEXT_DELETE_0" 
uri="commons/delete.jsp" rule="standard"/>
                            <entry 
key="GUI_EXPLORER_CONTEXT_UNDOCHANGES_0" uri="commons/undochanges.jsp" 
rule="undochanges"/>
                            <entry key="GUI_EXPLORER_CONTEXT_UNDELETE_0" 
uri="commons/undelete.jsp" rule="undelete"/>
                            <separator/>
                            <entry 
key="GUI_EXPLORER_CONTEXT_RELATIONS_0" rule="substandard">
                                <entry 
key="GUI_EXPLORER_CONTEXT_LINKRELATIONTO_0" 
uri="views/admin/admin-main.jsp?root=explorer&path=%2Flinkrelationtarget" 
rule="standard"/>
                                <entry 
key="GUI_EXPLORER_CONTEXT_LINKRELATIONFROM_0" 
uri="views/admin/admin-main.jsp?root=explorer&path=%2Flinkrelationsource" 
rule="standard"/>
                                <separator/>
                                <entry 
key="GUI_EXPLORER_CONTEXT_SHOWSIBLINGS_0" 
uri="views/admin/admin-main.jsp?root=explorer&path=%2Fsiblings" 
rule="showsiblings"/>
                                <separator/>
                                <entry 
key="GUI_EXPLORER_CONTEXT_CATEGORIES_0" 
uri="views/admin/admin-main.jsp?root=explorer&path=%2Fcategories" 
rule="standard"/>
                            </entry>
                            <separator/>
                            <entry key="GUI_EXPLORER_CONTEXT_ACCESS_0" 
uri="commons/chacc.jsp" rule="permissions"/>
                            <entry key="GUI_EXPLORER_CONTEXT_CHNAV_0" 
uri="commons/chnav.jsp" rule="standard"/>
                            <separator/>
                            <entry key="GUI_EXPLORER_CONTEXT_ADVANCED_0" 
rule="substandard">
                                <entry 
key="GUI_EXPLORER_CONTEXT_EDITSOURCE_0" 
uri="editors/editor.jsp?editormode=edit" target="_top" rule="standard"/>
                                <separator/>
                                <entry 
key="GUI_EXPLORER_CONTEXT_TOUCH_0" uri="commons/touch.jsp" rule="standard"/>
                                <entry 
key="GUI_EXPLORER_CONTEXT_AVAILABILITY_0" uri="commons/availability.jsp" 
rule="standard"/>
                                <separator/>
                                <entry 
key="GUI_EXPLORER_CONTEXT_SECURE_0" uri="commons/secure.jsp" 
rule="standard"/>
                                <entry key="GUI_EXPLORER_CONTEXT_TYPE_0" 
uri="commons/chtype.jsp" rule="standard"/>
                                <separator/>
                                <entry 
key="GUI_EXPLORER_CONTEXT_EDITCONTROLFILE_0" 
uri="editors/editor.jsp?editastext=true" target="_top" 
rule="editcontrolcode"/>
                                <entry 
key="GUI_EXPLORER_CONTEXT_PROPERTY_0" uri="commons/property.jsp" 
rule="nondeleted"/>
                            </entry>
                            <separator/>
                            <entry key="GUI_EXPLORER_CONTEXT_HISTORY_0" 
uri="views/admin/admin-main.jsp?root=explorer&path=%2Fhistory" 
rule="nondeleted"/>
                        </contextmenu>
                    </editoptions>
                </explorertype>
            </explorertypes>
        </module>
...




More information about the opencms-dev mailing list