LIFERAY PROJECTS ?Should we create diffrent projects for every section? - liferay

I am about to develop one liferay projects and have some query regarding that as follows..
should we create a different portlet project per section or we should combine all section in single portlet project?
we have a different section like "Campaign","Advertise" etc now each section is interconnected,
i mean to say in i would be able to display list of advertise mapped with particular portlet. can please guide me?

I think by section you mean Categories in the Add more section that appears in the dockbar at top-left corner of the portal page.
It is not mandatory to create different portlet projects that go in different categories. It is purely your choice keeping in mind future management.
Following are some considerations to keep all the portlets in one project:
If the portlets are going to use each others services
The portlets will depend on each other for showing the same or similar data, like take for eg: Documents & Media portlet and Documents & Media display portlet would go in one project.
I would say to keep in mind the Software Design Principle of Cohesion and Loose coupling.
This is what I can think at the moment. Hope this helps you in taking your own decision.

Try and put all Portlets under one Project. So that deploy is easy because basically the config files (like, liferay-portlet.tld, liferay-portlet-ext.tld) will be same.
You might wanna make different projects for code that's not about portlets.
I mean different project for Theme, or UI class, different one under Services/Server Side Java code, different for database config/connections etc.
All portlets could go under one project for above mentioned reason.
And you can still have separate space / loose coupling inside this one big portlet project because your (javascript/whichever tech you're using) code will be in separate folders.
About your question of displaying a particular list inside of the portlet, I guess it depends on how you want to code inside that portlet to show your list.

I agree with Prakash K.
Moreover, you should need to have two portlets in the same project (and with "project", I hear "war") if you need to share private portletsessions. So, as Prakash said, if you need interactions between 2 portlets, use one single project.
You can find more information about this particular point in this great blog (not mine): Liferay session sharing demystified

Related

Gitlab Hide Projects From Dashboard

Problem
I have a gitlab with a lot of old repositories. I want to mention my gitlab as a reference on my CV but I do not want all the old repositories to appear there, just the more relevant ones.
Just making the projects private is not enough as this leaves a lot of clutter in my dashboard and it is hard to see the projects I am trying to showcase.
I do not want to delete the old projects, as I want access to them in the future, I just want to hide them from other people to see that they even exist.
What I Tried
I tried archiving the old projects but they still appear on my Projects lists, just with an archived tag.
I saw mentions of playing with the "Metrics Dashboard" under the visibility settings but this is greyed out for me + I do not think this is what I need from my understanding.
Required Result
For me to be able to choose which projects appear and do not appear in my gitlab dashboard.
Thanks in advance for any help available!
EDIT
I found out that I can star and un-star projects, and that will count as activity on the project without actually changing anything. As the dashboard displays projects by when there was last activity on them then you can actually arrange your project by staring and un-staring the projects in the reverse order you want them to appear.
This somewhat does what I want, but with an ugly work around. Also it will always display 10 projects as far as I can tell, so if I want to only showcase 6 of them the best I can do is push the 4 I don't want to the bottom, but I still can't hide them completely.
This is why I am not writing this as an answer to my question. There has to be a way to just tell a project to be hidden or arrange the projects without this ugly workaround, and if there truly by design isn't a way of doing this then it will also just be good to be officially told that.
GitLab Groups do exactly what you need. See here for more info.
You can assign each project to a different group
You can move a project from one group to another as needed
You can assign different permissions and visibility for each group
You can also create subgroups
Each group/subgroup is treated as a separate namespace, meaning you access it using a different URL
So you can define a public group called yourfullname and a public subgroup called portfolio. Move the projects you want prospective employers to view to the portfolio subgroup and make sure their visibility is also public. All other groups/subgroups should be private. Then people can access your projects by visiting the following URL:
gitlab.com/yourfullname/portfolio
You can still view all of your projects in a single dashboard if you want, or you can view all projects within a group or sub-group by navigating to the desired group URL or dashboard. In the image below, archive and development are private (see the lock icon), but portfolio is public:

Liferay: How can I get the pages of the site in a web content?

I have a portal in Liferay 6.2, and need to design the velocity template of a web content that must have a menu listing the pages (linked names) of the site where is present.
My questions are:
Is this possible?
What would be the correct way to do this?
Would it be better to make a portlet instead of a web content for this purpose?
Thanks for the help.
It feels a bit like you are trying to solve many problems in a single template - consider to compose the UI from many different elements (e.g. custom portlets) rather than building the one structure/template that fits all requirements.
That being said, as there's also the chance that your template doesn't do more than just displaying the current navigation: You have two options: The out-of-the-box Navigation portlet is quite configurable, you might be able to utilize that one instead of implementing anything yourself (check the configuration options).
And lastly, if you want to implement for yourself: Get hold of the themeDisplay object. With getLayout() you'll get the current page, while getLayouts() you'll get all pages of the current site and can enumerate them. However, there's one problem: You typically don't have access to the themeDisplay object from a CMS template. But there are several ways to still get to the data (search the Liferay forums for cms template themedisplay). Also, an Application Display Template will be a lot more powerful - and you can also check how the layouts collection is built - just search for usage of ThemeDisplay.setLayouts in Liferay's source code. But with ADT we're diverting from your original question.
Liferay offers a sitemap portlet out-of-the-box which lists pages of a site. You can configure it and define your own application display template (ADT).

Utilize Organization selection in custom portlet

I want to use Liferay's Organization select/search feature such as when adding a new user through the Control Panel (under Users and Organizations).
Does anyone know where that code lives? Trying to get a grasp on navigating their source code but can't find it.
Thanks
All the liferay OOTB portlets' JSPs lie in the folder portal-web/docroot/html/portlet.
And all the implementation classes (service implementation) reside in the portal-impl/src/com/liferay/portlet for respective portlets.
So keeping this convention in mind, the JSPs for the Users & Organization would reside in portal-web/docroot/html/portlet/users_admin since you can't see any folder with the name users or organizations or users_organization, so your best bet is to look inside the users_admin folder, also because this folder has user & organization folder which include specific JSPs for Users and Organizations.
In this folder you would find different *search.jsp & *search_results.jsp which would be what you might be looking for.
I would suggest always start looking from the view.jsp for a particular portlet since this is the first landing page when we add the portlet to the page or click on any Control Panel portlets the first time. Most probably this view.jsp would include all the other JSPs which you might want to customize or take an idea from.
Most of the time the JSPs lead you to the implementation classes, we can't use liferay's implementation classes (since they live in portal-impl.jar and using this jar in plugin-portlets is prohibited) but we can use the different *Util.java classes which are exposed for our use like the UserLocalServiceUtil, OrganizationLocalServiceUtil, OrganizationServiceUtil etc.
Hope this gives a clue to finding out Liferay implementations.

Using Liferay for an already developed project

First of all, let me tell you what I am or my company is intended to do. We have already developed a project using Java, JSP and Servlet. We want it to integrate with Liferay so that we can change logo, css, images, themes or any other UI related component at run time using Liferay admin panel. But backend should be what we have developed.
In short, the UI of our project is controlled by Liferay, but control of data displayed on UI or submitted from UI should be from our developed backend code.
Now I have a few questions regarding above said approach of fulfilling the requirement:
What we are trying to do is possible?
Is this approach recommendable for what we intended to do?
Or do we need to develop our project from scratch to fit into Liferay? Like developing portlets and deploying in Liferay or other approach that has been given in Liferay documentation.
What about database integration? We have around 15 columns/fields in user table in database of our project which is completely different from that of Liferay's user table.
Liferay is a very new for us. We have checked the documentation section of Liferay but still few things like above said requirements and its implementation is not clear. Also, we would like to know in what scenarios/requirements Liferay is useful.
Ok let me try to answer your question point-wise and I would answer your last question first, which should automatically clear other questions:
Q. Also, we would like to know in what scenarios/requirements Liferay is useful.
This can have a very wide answer, but I have made it shorter for you:
If your site is content heavy and not data heavy then go for Portal
If you plan to use only a single web-application in a portal then I would suggest standalone custom developed web-application is much better.
I agree liferay portal will give you lot of things out-of-box like Single Sign-on, authorization, authentication, friendly-url and page creation and also lot of applications like Blogs, Wikis, Document library, some social networking apps etc. But think about it, do you really need all this? if not, then this is overkill
Here are some really nice links to better understand a portal's usage:
When to use a portal
Why to use portal technology
liferay tag wiki: It has nice description as to what is liferay and it also contains relevant links to Admin guide which will tell you what all functionalities liferay has and how you can manage it.
So still if you find your other questions unanswered, read-on ...
Q1. What we are trying to do is possible?
Nope. Portlet technology is different from Servlet technology. Liferay (or anyother portal) does not provide a way (atleast a simple one) to integrate servlets that would render pages inside a portal. For eg: Since with servlet you define URL mappings for a particular servlets before-hand in a web.xml but in a portal the URLs are generated by the Portlet Container. So portals work with portlets and not Servlets.
Q2. Is this approach recommendable for what we intended to do?
Nope. As I already explained in Q1.
Q3. Or do we need to develop our project from scratch to fit into Liferay? Like developing portlets and deploying in Liferay or other approach that has been given in Liferay documentation.
If you want to go the liferay way then Yes.
If you want to build applications that talk to your custom tables then portlets are the way to go.
Q4. What about database integration? We have around 15 columns/fields in user table in database of our project which is completely different from that of Liferay's user table.
If you go with Liferay. In this scenario you can create a combination of liferay-hook & portlet (may be using service-builder) to customize liferay's User creation mechanism and there by store data in both Liferay's User table and your custom tables.
Liferay's permission system is really fine-grained so you can also benefit from this system and put permission even on the data level.
In conclusion I would say:
Everything boils down to what your requirements are and what resources you have. And sometimes what future requirements you can have.
Note: All the terms used in this answer which are specific to liferay (like service-builder, hook etc) are explained in the liferay tag wiki.
Hope this helps. If you would like to know anything specific I would gladly update my answer.

How do I implement user theme switching in SharePoint?

My customer wants to provide 2 themes for a SharePoint application. Is there a strategy to accomplish this in MOSS 2007?
We want to apply user profile-based theme selection, and maybe even a drop-down to switch modes.
I don't know how extensive you want your re-theming to be. However if it could be CSS-only you could use this approach:
Store the CSS files for the different themes in the Style Library.
Create a list that stores the user and their chosen theme.
Write a feature and custom application page to allow the user to change their theme.
Write a control that does a lookup on the list against the current user and obtains the a reference to the corresponding CSS file in the Style Library. The control would then output the CssRegistration and CssLink controls to the page for this file.
Add this control to the master page so it executes on every page (caching should be added).
I can't see why this wouldn't be supportable by Microsoft as you're only changing CSS.
If you need to do more than that then another option is to write an HTTP module that changes the HTML output. Or of course JavaScript. With these two options you may have supportability issues (it depends on how extensive your changes are).
There is also SPThemes now available on Codeplex from Bjørn Furuknap. Users can choose their own themes and they can be applied at different scopes.
Here are the options that I’ve come up with from research and feedback. Both of which seem mostly infeasible.
Implement major UI layout changes in JavaScript. This would lead to client slowdowns, would be difficult to code, and would be completely unsupported by Microsoft due to the need to reference SharePoint objects that may change with subsequent SharePoint patches.
Provide two parallel themed sites based on the same data, and provide a way to switch between them. This would require that we deploy each site to multiple locations, and would require retooling of any site creation mechanisms in code (since they'd need to target two sites instead of one).
One another thing you can try is to use the Theme Changer and ThemeChangerStaple from codeplex , That is implemented as feature you can use the same code logic to archive what you want with bit of modification, give it as an option for the user using CustomAction.

Resources