I've been tasked with creating a new column in the list of files in a Liferay 6.2 document library. For each file, that column should display a link with the text "Details" and the URL for that file's metadata page. In view_entries.jsp, I'm looking to add this field to a ResultRow. All I've been able to find so far, is DLUtil's getPreviewURL, which only seems to give me the URL for downloading the file itself, rather than leading to the metadata page. The Title column uses a TextSearchEntry, which ends up displaying with the URL I want, but I can't figure out how to either get that URL from it or change the text it displays the link with.
PortletURL rowURL = liferayPortletResponse.createRenderURL();
rowURL.setParameter("struts_action", "/document_library/view_file_entry");
rowURL.setParameter("redirect", HttpUtil.removeParameter(currentURL, liferayPortletResponse.getNamespace() + "ajax"));
rowURL.setParameter("fileEntryId", String.valueOf(fileEntry.getFileEntryId()));
In this code, fileEntry is the current document. To get the URL to the preview page, it's just rowURL.toString().
Related
problem is getting meta description for twitter:description.
Currently portal-normal.ftl is handling rendering page metadata and opengraph-markup-section.ftl
is handling content page metadata. If both(render page/source page, and content page) have meta description, they are both displayed.
I can remove pageMetaDescription insertion in portal-normal.ftl file but then if content page does not contain pageMetaDescription, there is no description at all.
How can I achieve logic: if web content pageMetaDescription is empty -> then get renderer/source_page pageMetaDescription. Thank you.
I'm fairly new to Orchard and I'm wondering about the "best" way of building a basic list of documents with a download link?
Say the scenario is this, I want to make a list of newsletters, the news letter are in PDF format and the users should be able to download then straight from the list view.
An admin, should easily be able to add a new newsletter and it should turn up in the list.
My current train of thought is to, all through the dashboard,
create a content type "Newsletter" with a title field and a Media picker field, using the media picker field to upload the PDF file.
Then create a query, with the filter on Content type "Newsletter"
Create a projection pointing to the query
However, this only gives me a list of content items, showing their title as links back to the actual content item.
I've tried adding a layout to the query and set it to display properties instead of content. By doing that I can get a list where I can control the "output" a bit more. And I've gotten it to list the title and by doing a Rewrite and putting in the MediaPicker.Url, it also displays the URL in the list. This is all good but here I get stuck..
As the MediaPicker.URL outputs the url in the format like ~/media/default/xyz/filename.pdf, I cant just put it into a a href, it doesn't give a correct download link to the file.
Soo, question is, am I thinking and doing this totally the wrong way or am I missing something obvious? All ideas and suggestions and more then welcome.
Use or adapt the following template override in your theme:
#{
var url = Model.ContentField.Url;
}
#if(Model.ContentField.Url != null) {
if (url.StartsWith("~/")) {
url = Href(url);
}
<div class="media-picker-field attachment-pdf">
<span>download</span>
</div>
}
Modify the text as needed. This template was a Fields.MediaPicker-PDF.cshtml that was used for a media picker field named PDF.
I'm trying to break my body into pre content, content, and post content so I can inject ads and what not within my articles. The only HTML field module is broken for 1.4 at the moment and I can't seem to add additional body parts to the page. I'm having to create my pre content in the body, then cut the HTML into a pre conntent text field. And do the same thing for post content. There's got to be a better way to do this. Is there any way to have more than one HTML editor field in the page editor?
As I told you in another answer, you can configure the Text field to use HTML. Just add the text field, and then expand it in the type editor. There is a drop-down where you can choose HTML.
With this code I create a page in a Google site:
pageEntry = new WebPageEntry();
pageEntry.setTitle(new PlainTextConstruct(PageTitle));
..
..
client.insert(new URL(getContentFeedUrl()), pageEntry);
If the PageTitle contains something like "création" the page will created with the name https://sites.google.com/.../.../cration. So "création" is changed to "cration".
Is the process to change the page name available in the API? I would like to fetch the page by its path, but the only key I have is "création".
Maybe a better solution would be to strip the diacritics from the characters in the string before setting it as a page title? For instance, see the javascript function here. Then you page would be created with the URL /creation, which could be more desireable.
Is there a way to dynamically change the hyperlink associated with an ECB menu in WSS 3.0? For instance, I have a list with 2 fields. One field is hidden and is a link, the other is the title field which has the ECB menu. The title field currently links to the item's view page - but we want it to link to the link-field's url. Is that possible?
UPDATE - 5/29/09 9AM
I have this so far. See this TechNet post.
<script type="text/javascript">
var url = 'GoTo.aspx?ListTitle='+ctx.ListTitle;
url += '&ListName='+ctx.listName;
url += '&ListTemplate='+ctx.listTemplate;
url += '&listBaseType='+ctx.listBaseType;
url += '&view='+ctx.view;
url += '&';
var a = document.getElementsByTagName('a');
for(i=0;i<=a.length -1;i++)
{
a[i].href=a[i].href.replace('DispForm.aspx?',url);
}
</script>
This gives me a link like so (formatted so it's easier to see):
GoTo.aspx
?ListTitle=MyList
&ListName={082BB11C-1941-4906-AAE9-5F2EBFBF052B}
&ListTemplate=100
&listBaseType=0
&view={9ABE2B07-2B47-4390-9969-258F00E0812C}
&ID=1
My issue now is that the row in the grid gives each item the ID property above but if I change the view or do any filtering you can see that the ID is really just the row number. Can I get the actual item's GUID here?
If I can get the item's ID I can send it with the list ID to an application page that will get the right URL from field in the list and forward the user on to the right site.
I think the easiest solution and one I use regularly to modify default sharepoint functionality without having to install server side code is to inject some javascript onto the page to make the necessary modifications.
The Content Editor webpart is ideal for this if you don't want to edit the page source itself. Together with the IE Developer Toolbar or Firebug to inspect the elements you want to edit you should be able to achieve what you need with just a couple of lines of javascript.
Let me know if you need any further detail on getting this work.
The title/link to edit menu is a computed field - basically a combination of the title and item id. If you look at the definition of the field (off the top of my head I think it's in fields.xml) you should be able to create a modified version in your schema.xml that uses the url field in its RenderPattern.
Following up on Tom's answer, you can use the SharePoint Solution Generator in VseWss 1.3 to generate a Visual Studio solution that can re-create your list. You will faint when you see the huge amount of XML that the views use in the schema.xml file but you will see the render pattern that Tom referred to and you should be able to get a general idea of how to modify it to suit your needs.
Gotta love SharePoint. Where small customizations means "take what I give you or rewrite it from scratch"