Disable the customize link in the list mode

rajcheram
2008-11-20
2014-03-21
  • rajcheram

    rajcheram - 2008-11-20

    Hi i am 1+ experienced  guy, developing application Using OX .

    i can do Java, JSP programming contributions, and can learn things ..

    While my development i faced an issue .. disabling the customize link in the list mode [ for all or particular portlet ] ..

    So that the end users will be restricted to add more / remove the columns in the list mode ... by doing configurations ...

    I will be very happy to contribute this to OX .. and expecting more to do.

    How can i do... oh .. how can we do ..

    - rajcheram

     
    • Javier Paniza

      Javier Paniza - 2008-11-21

      Hi Rajcheram,

      > disabling the customize link in the list mode [ for all or particular portlet ]
      OK.
      First, edit the class Tab and add a boolean property called 'userCanCustomize'. Then edit list.jsp and use a 'if (tab.isUserCanCustomize())' for show:
      <xava:image action="List.customize" argv="<%=collectionArgv%>"/>

      With this simple step, now we can hide and show the customize button programatically. Now you have all the flexiblity you want.

      Now, we want to do it in a declarative way.
      For hide the customize link in all application, we must add a property to xava.property called 'userCanCustomizeList'. Add the property editing the XavaPreferences.

      Now edit the execute.jsp (since 3.1beta3, in OX3.0.3 it would be module.jsp). And after adquire the tab for list read the property userCanCustomize from XavaPreferences and put its value on tab.userCanCustomize property.

      Do first this work, and when it works fine, I'll guide you to do this customization only for a concrete module.

      It's better that you use the latest OX version (the OX3.1beta3, or event th OpenXava_20081121 from CVS), in this way the integration of your code is easier for me.

      Cheers
      Javi

       
    • Javier Paniza

      Javier Paniza - 2008-11-21

      A little correction.
      The latest CVS version of OX is OpenXava_20081120 (not 21)

      Cheers
      Javi

       
  • Vadim Yezhakov

    Vadim Yezhakov - 2014-03-05

    Hi Javier,

    Do first this work, and when it works fine, I'll guide you to do this customization only for a concrete module.

    Have you guided Rajcheram how to do it?

    Best regards,
    Vadim

     
  • Javier Paniza

    Javier Paniza - 2014-03-07

    Hi Vadim,

    Have you guided Rajcheram how to do it?

    No.
    However now OpenXava has an entry you can add to your xava.propeties to disable customization:

    customizeList=false
    

    It has a global effect. Is it enough for you?


    Help others in this forum as I help you.

     
  • Vadim Yezhakov

    Vadim Yezhakov - 2014-03-12

    Hi Javi,

    Yes, I've found global property "customizeList". But for me is very interesting how to do it separately for module or "tab". I whould appriciate if you point me the direction.

    Best regards,
    Vadim

     
  • Javier Paniza

    Javier Paniza - 2014-03-14

    Hi Vadim,

    how to do it separately for module or "tab"

    Implementing it is not very difficult. The tricky part is designing the interface for the programmer.

    I'm thinking in several options:

    A) In module declaration

    <module name="CustomerNoCustomizing">
        <model name="Customer"/>
        <tab name="NoCustomize" customize="false"/>
        <controller name="Typical"/>
    </module>
    

    However, I think that module declaration is to join parts not to configure them.

    B) In @Tab

    @Tab(name="NoCustomize", customize=false)
    

    Yes, it's simple and discoverable. But something inside me says that is not so good. The question is that OpenXava UI annotation has a high abstraction level, that is, they don't talk about user interface details. I don't sure that specifying if customizing is available keeps our current abstraction level. We could have a list UI without customization.

    C) Defining and editor:

    @Tab(name="NoCustomize", editor="NoCustomizeList")
    

    It's not so simple and discoverable than B, but it preserves the current abstraction level, because NoCustomizeList is not part of the annotation, it's just the name of an editor. Moreover, we don't need to extend the current OpenXava annotations.

    D) In xava.properties

    tabWithoutCustome=Customer.NoCustomize, Invoice.DEFAULT, Product.ThisYear
    

    I prefer to use xava.properties for global setup, but well, it's an option.

    E) From NaviOX: That is using NaviOX to exclude list customization for some Role/Module combination. This is more flexible because we can exclude the customization only to certain user, furthermore we move this work from the developer to the administrator.

    What do you think?

     
  • Vadim Yezhakov

    Vadim Yezhakov - 2014-03-18

    Hi Javi,

    I think that option B is the simplest way for end-developers. But I get your thought about abstraction level.
    Option E is very interesting and probably useful, but I'm not familiar with NaviOX yet. How it will looks?

    Best regards,
    Vadim

     
  • Javier Paniza

    Javier Paniza - 2014-03-18

    Hi Vadim,

    well. We could start implementing the C option and if this feature starts to be very used we could move to B. And both options are compatible with E.

    Moreover, creating an editor is very simple. Do you agree to implement it? If yes I will guide you to do it.

    I'm not familiar with NaviOX yet ... How it will looks?

    The list customization could be work as action rights. Look at this video:
    http://www.openxava.org/web/guest/videos/restrict-actions-naviox

    Cheers

     
  • Vadim Yezhakov

    Vadim Yezhakov - 2014-03-19

    Hi Javi,

    Today I've found interesting thing "Tab.setCustomizeAllowed(boolean customizeAllowed)". So, I can create Action:


    public class DisableCustomizeListAction extends TabBaseAction {
    @Override
    public void execute() throws Exception {
    getTab().setCustomizeAllowed(false);
    }
    }

    Then I put action definition to module controller and make it "on-init"

    <controller name="Country">
        <extends controller="EsbdController"/>
        <action 
            name="DisableCustomizeList"
            mode="list"
            hidden="true"
            on-init="true"
            class="kz.novelty.xava.actions.DisableCustomizeListAction"/>
        <action 
            name="SynchronizeEsbd"
            mode="list"
            class="kz.novelty.alt.actions.esbd.SyncEsbdCountryAction"/>
    </controller>
    

    But I would like to try implement new editor as well. Also about NaviOX. As I understood we can assign allowed Actions to users, but CustomizeList is not an Action, isn't it?

    Best regards,
    Vadim

     
  • Vadim Yezhakov

    Vadim Yezhakov - 2014-03-20

    Hi again,

    This is what i've did last night. I've made a copy of listEditor.jsp and call it listWithoutCustomizationEditor.jsp. In new jsp I get rid 10 strings between 117 and 127. Then I've added new Editor into my editors.xml and defined custom editor ListWithoutCustomizationEditor in my @Tab definition.
    It works.
    I love Openxava engine more and more every day :)

    Thanks to You.

     
  • Javier Paniza

    Javier Paniza - 2014-03-21

    Hi Vadim,

    your idea of using an action to disable the customization is very good, indeed better than mines. In this way you have not to extend OpenXava and it's easy to create a controller than a new editor.

    You can create a new controller that we can put in default-controllers.xml to be used in this way:

    <controller name="Country">
        <extends controller="NoCustomizeList"/>
        <extends controller="EsbdController"/>
        <action 
            name="SynchronizeEsbd"
            mode="list"
            class="kz.novelty.alt.actions.esbd.SyncEsbdCountryAction"/>
    </controller>
    

    If you create such controller and add the code to a new Feature Request, I will include it in future OX releases.

    I've made a copy of listEditor.jsp

    It would be better to modify the listEditor.jsp to accept a parameter, because copy & paste it's not good, it produces duplicated code. Anyways, I think that the option of the controller is good enough.

    but CustomizeList is not an Action, isn't it?

    Well, it's an action, but by it's ignored by NaviOX. I would need to improved NaviOX for it.


    Help others in this forum as I help you.

     

Log in to post a comment.