1 2 Previous Next 17 Replies Latest reply on Jul 31, 2008 11:46 AM by yanivc24

    Portlet Instance configuration with nice GUI

    michaelchan

      For portlet preferences at instance level, we could use the admin portlet to change the preferences. However, there is no custom GUI available, this creates a huge drawback because the preferences data are of a raw type.

      For example, if a "Category" portlet displays some products in a Category that is identified by a catID, and the catID is in portlet preferences, system admin MUST work out the catID in order to change the category to be displayed on the "Category" portlet.

      I know we could use EDIT mode to provide a nice GUI, but the preferences are not stored at an instance level, it is stored on a per user / per instance level. Is there anyway to overcome this?

        • 1. Re: Portlet Instance configuration with nice GUI

          Actually it is a good idea.

          There is a special mode called EDIT_DEFAULT as far as I recall that is used to edit the preferences shared by all users of a portlet and that is more appropriate than EDIT mode.

          It is possible to check if the portlet supports it by reading the mode declared by the portlet.

          Edition could be done using the JSF portlet component that is already used in the same application in order to display the EDIT_DEFAULT mode instead of the generic configurator if the portlets supports it.

          Thomas, what do you think ?

          • 2. Re: Portlet Instance configuration with nice GUI
            theute

            I think i see what you both mean, and i think you are slightly diverging.

            Michael says that preferences are not stored per portlet instance but per user, that's only if you use the Portlet spec API.

            The portlet spec API doesn't define an API to modify portlet instance preferences. It means that we would need to open that internal API to a public API.

            Using this API, the first cheap solution would be to use the EDIT mode with that internal API (see portal-admin for how to do it).
            (As of now you cannot secure a portlet mode for specific roles, so that would let anyone changing the preference for everybody, this is work in progress. You can then use isUserInRole to show part of the GUI for portlet-instance changes, but if your users will still see the edit button, then a blank screen (unless you let them override that preference with a user specific one for example))

            To use Julien's (good) idea you would use the same API and create your GUI, you would then be able to change the portlet instance preference from the admin portlet (which can be secured) using the GUI defined by the portlet itself.

            Overall i think it's a good idea that should go in Jira



            • 3. Re: Portlet Instance configuration with nice GUI
              michaelchan

              Thank you all for the reply.

              Actually, i have attempted a workaround solution but with no success. My approach is as follow:

              Use portlet admin mode in JBoss portal, and enable the admin mode for uncheck user role.

              It is possible to hide the admin mode from all users apart from admin, to do it, just simply hide all portlet decorations by using empty renderer or write a custom empty renderer.

              However, even with admin mode, uncheck users could not change the perferences, this is because all perferences are set to read-only if the user role is uncheck. I tried specifying read-only to false in portlet.xml, but still not success.

              So julien do you mean that I could use EDIT_DEFAULT mode with JSF portlet bridge?? Anyway, i will give that a go.

              Thanks again for the reply.

              • 4. Re: Portlet Instance configuration with nice GUI
                theute

                 

                "michaelchan" wrote:
                Thank you all for the reply.

                Actually, i have attempted a workaround solution but with no success. My approach is as follow:

                Use portlet admin mode in JBoss portal, and enable the admin mode for uncheck user role.

                It is possible to hide the admin mode from all users apart from admin, to do it, just simply hide all portlet decorations by using empty renderer or write a custom empty renderer.


                hiding != securing

                "michaelchan" wrote:

                However, even with admin mode, uncheck users could not change the perferences, this is because all perferences are set to read-only if the user role is uncheck. I tried specifying read-only to false in portlet.xml, but still not success.


                I don't understand

                "michaelchan" wrote:
                So julien do you mean that I could use EDIT_DEFAULT mode with JSF portlet bridge?? Anyway, i will give that a go.


                No, he was talking about the JSF admin portlet.

                • 5. Re: Portlet Instance configuration with nice GUI
                  michaelchan

                  The admin portlet in 2.6.5sp1 = JSF admin portlet?

                  Does that currently supports EDIT_DEFAULT?


                  "However, even with admin mode, uncheck users could not change the perferences, this is because all perferences are set to read-only if the user role is uncheck. I tried specifying read-only to false in portlet.xml, but still not success. "

                  In very simple words, ADMIN mode could not change portlet perferences unless current user is logged in. For a user that is not logged in and attempt to change any perference in the ADMIN mode, it would result in a ReadOnlyException.


                  • 6. Re: Portlet Instance configuration with nice GUI
                    theute

                    We are getting in more and more confusion.

                    edit_defaults, is an optional mode defined by the spec, that a portal could support.

                    It's just a different view of the portlet.

                    What Julien proposed is that when you click in the admin portlet (implemented with JSF but that doesn't matter) to change the preferences instead of always showing a generic way of changing preferences, you could override that behavior by providing your own view (the edit_defaults mode).

                    About the other part, do you really want anyone to be able to edit preferences for everybody ?

                    • 7. Re: Portlet Instance configuration with nice GUI
                      theute
                      • 8. Re: Portlet Instance configuration with nice GUI
                        michaelchan

                        i don't want anyone to be able to edit preferences. What I want to achieve is to be able to use a custome GUI for editing preferences at an instance level. Since the portal I am developing do not require user to login and all portlets should maintain the same preferences at an instance level at all time. I just want to find an easy way for system admin to configure portlet instances.

                        That should clear things up. Thanks for the reply :)

                        • 9. Re: Portlet Instance configuration with nice GUI

                           

                          "michaelchan" wrote:
                          i don't want anyone to be able to edit preferences. What I want to achieve is to be able to use a custome GUI for editing preferences at an instance level. Since the portal I am developing do not require user to login and all portlets should maintain the same preferences at an instance level at all time. I just want to find an easy way for system admin to configure portlet instances.

                          That should clear things up. Thanks for the reply :)


                          isnt it what I suggested though the usage of edit_default in the instance configuration ?



                          • 10. Re: Portlet Instance configuration with nice GUI
                            michaelchan

                             

                            • 11. Re: Portlet Instance configuration with nice GUI
                              michaelchan

                               

                              "julien@jboss.com" wrote:


                              isnt it what I suggested though the usage of edit_default in the instance configuration ?




                              but... the edit_defaults mode is not supported by jboss portal...

                              • 12. Re: Portlet Instance configuration with nice GUI

                                it used to be, I scratched some code a while ago but it was commented for some reason.

                                we could make at least that mode supported for 2.7 in the normal aggregation mode, in addition of the "admin" mode.

                                actually in the instance editor we could provide edit_defaults + admin modes

                                • 13. Re: Portlet Instance configuration with nice GUI
                                  theute

                                  In the meantime, why don't you use the admin mode ?

                                  admin or edit_defaults (or view, help, edit), are just names of modes, what you do with those are just what you want to put in them.

                                  The issue IMO, is that the API to edit those preferences are not part of the public API this will probably not go in 2.7 for that reason.

                                  • 14. Re: Portlet Instance configuration with nice GUI
                                    michaelchan

                                    Admin mode does not store portlet preferences at instance level....

                                    So my guess is, that is no "Standard" way of changing portlet preferences at instance level ATM.... It's all per user per portlet instance.... the only possible cheap hack I could think of is to store perference values to the database or external xml and read / write them manually...... Any better suggestions?

                                    1 2 Previous Next