Im adding Documents with this snippet of code:
fileEntry = DLAppServiceUtil.addFileEntry(
repositoryId, folderId, filename, MimeTypesUtil.getContentType(strFile), filename,
description, changelog, in, srcfile.length(), serviceContext);
Documents are shown in Asset Publisher and Documents and Media Portlet.
After this im adding Vocabularies and Categories programatically, which are shown correctly in Categories Navigation Portlet. Then i'm adding the Categories to the documents. This Categories are shown in Asset Publisher correctly, but when i select a Category in Category Navigation Portlet i don't get any result. In Documents and Media Portlet selection by Category is working without problems.
This is the code i'm using to attach Categories:
DLAppHelperLocalServiceUtil.updateAsset(userId, fileEntry, fileEntry.getLatestFileVersion(), categoryIds, null, null);
I would be very glad anybody got a hint.
Problem was they did not have same scope.
Related
Hi whenever i try to create the new product category in hybris product cockpit
i create the identifier, name and the correct catalog version which is Online
but when i try to edit the navigation of the website im currently lost where do i find the url of that specific category so when the user click on that navigation it will filter on which category of the product is tagged
If your navigation menu is composed of CMSLinkComponents you are lucky, because CMSLinkComponent was already made to handle this, you have just to :
create a new CMSLinkComponent.
Attach the new create Category to the CMSLinkComponent.
Then add this CMSLinkComponent to your navigation menu. (that's all what you need to do).
However if you don't use CMSLinkComponent, you can use the defaultCategoryModelUrlResolver.resolve(newCategory) to generate the URL of the category and then send it back to the Front to be printed.
Or just print it like this in your jsp file :
<c:url var="categoryUrl" value="/c/${newCategory.code}" />
${newCategory.name}
I'm building a site using Orchard CMS and have built several lists of taxonomoies. I now want to create links on the admin menu directly to some of these lists (so the user doesn't have to navigate through the taxonomy link).
I have tried adding the Admin Menu content part to the taxonomy type and then checking the 'Show on Admin Menu' checkbox for a taxonomy, and this does create a admin menu link, but it is a link to the definition for the taxonomy - not the list of the terms for the taxonomy.
I can programmatically add a link via the Orchard.Taxonomies.Admin.GetNavigation(NavigationBuilder) method (as below) but I don't want to have to hard code the links
public void GetNavigation(NavigationBuilder builder) {
builder
.AddImageSet("taxonomies")
.Add(T("Topics"), "4", menu => menu
.Add(T("Manage Topics"), "1.0", item => item.Action("ListByName", "TermAdmin", new {area = "Orchard.Taxonomies", taxonomyName = "Topics"}).Permission(Permissions.ManageTerms))
)
.Add(T("Taxonomies"), "5", menu => menu
.Add(T("Manage Taxonomies"), "1.0", item => item.Action("Index", "Admin", new { area = "Orchard.Taxonomies"}).Permission(Permissions.ManageTaxonomies))
);
}
Is there any other way to create a link to the taxonomy list on the admin menu?
Thanks
You are doing great, but you need to get the taxonomyIds and their names to show in the links right? then the links should look something like this: /Taxonomies/TermAdmin?taxonomyId=767, not with the name.
In the Taxonomies AdminController and its View you can find some of the logic.
You should be able to inject the taxonomyService and query the taxonomies created and their terms or if its only one taxonomy you are interested in get its id by querying with the name.
Using orchard 1.6. I've created a content type 'ImageUpload' which has 2 fields 'Image' and 'Date'. So the user can select todays date and upload an image. The uploads can be viewed from the 'Content Items' section of the dashboard but...
I would separately like to access/view the uploads from a different section(as the user wont have access to view the content items page) Iv set up a navigation menu but how can I view the records?
The content items are stored in the 'ContentItemVersionRecord' table...?
I don't fully understand your question. View the content items on the front end? Try using the projections module. You create a query that gets content of ImageUpload type and then you create a projection page that will use this query. Enable Projections feature, it comes with 1.6
I created a new content definition, added a field "Media Library Picker Field" MYIMAGE.
There I can configure some things like "A content item is required" ... "Content Types and Parts" but I left them blank.
Then I can successfully select a image from my media library and see it from Admin/Contents/List.
Then I made a new query: I selected new layout, Html List, selected properties, add new property: "Title Part Title" with no configuration and MYIMAGE:Ids with no configuration.
Then I created a projection so I can see for every match of the query the titles BUT NO Ids.
I searched in shape tracing, i suppose I can find it in Zone[Content]->Content->List->PropertyWrapper (this is the first query result) and then under the Model Tab I suppose Model->Items->[0] should be the title so #Model.Items[1] should be the Ids.
How can I get the image's Id from #Model.Items[1]? And the URL?
This issue has been resolved. See https://orchard.codeplex.com/workitem/19956.
There is also a module called Vitus.Utils that adds some very useful tokens for Media Library items. See http://gallery.orchardproject.net/List/Modules/Orchard.Module.Vitus.Utils/1.0
I'm trying to make the Liferay (6.0.6) Asset Publisher publish all changes across multiple communities on the portal homepage. By clicking on a link the user is supposed to be redirected to another community and see the new web content. The problem is that the default behaviour of asset publisher (even with the hook to gather info from all communities) tries to get the url by searching the group of the current page (in which the content is not).
I decided to change the jsp showing the page to search all pages across all communities and find the first one containing the portlet with the desired web content. So
How could I get the portlet containing the web content by journal id of the web content?
How could I get the page containing the portlet?
Thanks
The PortletPreferences table in the database contains the configurations of each portlet in the system. The configuration of an articleId for a Web Content Display portlet is stored as a preference in this table. If you look at that table, there are 3 important columns:
plid contains the id of the Layout (=page) on which the portlet was dropped.
portletid contains the instance id of the portlet. For Web Content Display portlet, this ID has the format 56_INSTANCE_XXXX where XXXX is a unique hash.
preferences is an XML formatted string of all preferences and their values for this portlet.
An example of the preferences XML:
<portlet-preferences>
<preference><name>group-id</name><value>10139</value></preference>
<preference><name>article-id</name><value>14295</value></preference>
</portlet-preferences>
So it's just a question of getting your SQL queries right. As far as I know, there is no service you can call directly for this.
SELECT l.friendlyURL
FROM PortletPreferences p, Layout l
WHERE p.plid=l.plid
AND p.portletid LIKE '56_INSTANCE_%'
AND p.preferences LIKE '<preference><name>article-id</name><value>14295</value></preference>';
Something like the following allows you to find the Layout on which an article is Rendered.
List<Long> layoutIds = JournalContentSearchLocalServiceUtil.getLayoutIds(groupId, false, articleId);
long layoutId = 0;
if (!layoutIds.isEmpty()) {
layoutId = layoutIds.get(0).longValue();
Layout layout = LayoutLocalServiceUtil.getLayout(groupId, false, layoutId);
String url = PortalUtil.getLayoutURL(layout, themeDisplay);
...
}