Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Filtering news based on department. View modes: 
User avatar
Member
Member
idorko - 1/7/2013 5:40:19 PM
   
Filtering news based on department.
I'm working on a home page for our company's intranet site where I'd like to display a user's relevant news, basically pulling news from all the locations he/she belongs to. We want all locations to be public, so users can see news from any location if they were to navigate to that location's news page, but we would like the home page by default to only display news relevant to a user's assigned locations.

So far I've been able to gather all location news using

/Locations/%/News/%
as the path in a repeater, but I'm having troubling figuring out how to filter it to only the locations a user belongs to.

Anyone have any ideas to get me on the right track?

Thanks!

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 1/8/2013 1:13:01 PM
   
RE:Filtering news based on department.
If your structure is as such:

-root
--Locations
---Dept1
----News1
----News2
---Dept2
----News1
----News2
----News3

At the --Locations level you put a CMSListMenu that is filtered by CMS.MenuItem (Page) so it displays all your Departments.

Then create ONE page template for use in all the departments and add a repeater webpart on the page. Important, DO NOT SET the Path property, only the Document Type Filter to use CMS.News. By default if the Path property is null, it selects the current node and all nodes below.

If you wanted to display all the departments news items on the Locations page, leave the Path property blank and filter out by CMS.News (so no departments show in there) and maybe give them a search box.

The beauty of this is you only need one page template that dynamicaly changes based on the node (department) selected. You could also display the departments name (assuming you have the page named the same) by using the {% CurrentDocument.DocumentName %} macro. So as you add more departments, you click add New Page and select the News page you created already and in a matter of about 15 seconds, you're done.

User avatar
Member
Member
kmiday-cuyahogalibrary - 3/20/2013 11:50:20 AM
   
RE:Filtering news based on department.
I too am able to display all news from all departments on an intranet, but have been unable to display only news from departments a user is a member of. (I'm using Kentico's Intranet product.)

I think those steps FroggEye outlined will display the news for all locations, or the specific location you're in, but I think the original poster is asking how do you get a list on the home page that displays news only from departments/locations that user is a member of. I too am trying to do this.

With the intranet product, the Departments page has a section that displays the departments you're a member of with a WHERE clause of:

NodeID IN (SELECT ACLOwnerNodeID FROM View_CMS_ACLItem_ItemsAndOperators WHERE ((Allowed & 1) >= 1) AND (RoleID IN(SELECT RoleID FROM CMS_UserRole WHERE UserID = '{%CurrentUser.UserID%}')))


I'm not having success getting the where clause to work with news though. I'm new to Kentico, and haven't delved deeply into WHERE clauses, so I'm probably missing something simple.