How to hide URL Selector content tab? - kentico

I am creating a custom webpart using the Url Selector from kentico. I want the user to select content just from the Media Library. I went to form controls -> Url Selector -> Properties -> Dialogs_Content_Hide -> Default Value -> Yes and it still showing it in the Web Part. If I select the Dialogs_Web_Hide, Dialogs_Libraries_Hide and select the yes option in the default values, they hide, all except the Content_Dialogs.
Is this a bug? Or its something wrong?
Here is an example of the tabs

First set the form controls properties back to the way they were. If you don't, it will cause all kinds of problems later on.
Secondly, when you create the property in the webpart in the UI, select the URL selector form control for your text fields control. The scroll down just a bit and under the Editing Control Settings you'll see an "Configure" link. Click it. In there you will be able to tell the form control what tabs you want to enable and disable.

To add to Brenden's answer; if this is something you need to do a lot for your current build, then I'd also suggest making a copy of the Url selector form control and customize the properties as you originally mentioned. This way, you leave the default control in place for the system and have a control tailored to your needs. I've done this just now to check with a new form control that I called Media URL selector. Do make sure that you select the same source file as the original control in the Cloned form control file name property - Kentico by default will try to locate a new file called <original filename>_1.ascx. The reason for this is that admin section of your site also makes use of this control, so you may cause a nasty side effect somewhere else in the system.
As for why the settings had no effect; these are the default values you are setting. If you already have the form control in use, then the default setting would have been applied as they originally were. If you find one of the fields in question, you can change the control type to Text box, click Save, and then reassign it to Media URL selector.

Related

Proper Kentico object for non-user-editable block of static html/javascript

The Situation: I've got a mid-sized chunk of html/javascript that contains an authentication script/input (it's a text input, radio control, and a combo box and a few buttons). What it is is less important than the concept that it's a mass of static client side code that the marketing department can pretty easily accidentally the whole thing.
The Desire: I want the users to be able to add it as a whole to a page, but not be able to modify it. When something needs to change, I want to change it in one place and have it be changed on all the pages.
What I've Tried: Widget with a default text. It works, but feels wrong. Users can edit it, and if they do when I fix it one place it doesn't propagate to all the instances. I'm a bit of a Kentico noob, but it seems like there should be a better way to do this.
Also note: I'm using portal engine if that makes a difference.
A widget is the proper usage. What you make your widget inherit from is the key in this case. I'd suggest creating a new widget based on a static HTML webpart. This way you can set the static HTML markup and hide the property from the content editor on the front end. You can do this by going to the Properties tab of the widget and setting the visibility of the field on the form. Don't delete the field, just hide it. It should be a checkbox that says hide on public form or editing form.
** Edit **
As I read through my answer and comments, I realized I meant to say clone the static HTML webpart and set its default text to your javascript. Then create a widget based on that cloned webpart. The text will reside in the web part and will allow you to update it in one place later, if needed.
I will not do it this way because you will be not able to make changes in the future. You can better create a new webpart this can be an empty webpart and then create a custom layout. In this layout you can put you're code. In this way you can always change you're code in the future and then it will be changed on all the places where the widget is placed.
I'd use a new widget based on the Static HTML webpart (make the field read only or hide it as Brenden mentioned), but store the data in a new custom setting.
no coding needed (only a macro to read the custom setting)
able to edit the script on the fly on any instance in the settings module. If you have multiple of these settings you won't need to go through all kinds of widgets to adjust their default setting but find them on a central place.
Cheers!
David
In this case I think it makes sense to create a custom web part to store all your code in it and use it that way. If you want to achieve it without creating a custom web part, you have to store the code in some non-web part and not widget specific object. I like the suggestion of creating a custom setting. You can then access this custom setting via a macro. This macro can be used as a default property of a newly created web part (inherited e.g. from the static text web part, you'd use the text property). You may as well create a widget out of it. Another approach is to use Kentico localization keys as a workaround. you can create a key in the Localization application and access it again, via a macro, e.g. {?customkey.myhtml?}. The approach with a custom setting however sounds cleaner to me.
This syntax should be working to access a custom setting value via macro:
{%Settings.CustomSettings.xxx%}
{%Settings.CustomSettings["xxx"]%}
{%Settings.CustomSettings.GetValue("xxx")%}

Orchard CMS - limiting pages to only a specific layer - how?

Silly really - but I just can't seem to find my way around this just yet....
I installed the Orchard CMS in Azure - worked like a charm, added a few pages, played around, watched the Pluralsight "Orchard Fundamentals" course - seemed to make a lot of sense.
But now I'm stuck - I'm trying to create a public facing site, where some of the pages should be visible to any visitor including anonymous users, and some of course should be visible to only authenticated users.
OK, so I understand those are layers in play - default for everyone, authenticated for authenticated users - great. But how do I limit a given page which is present as Content in my dashboard so that it'll be displayed only on a given layer (e.g. only on the authenticated layer - not the default layer for everyone)
Seems like a simple task - but I just cannot seem to find the way to do it (nor does any of the docs or tutorial videos really help :-( )
Any takers?
Layers are only for widgets. In order to restrict access to a content item such as a page, what you need is content item permissions. That's a separate feature that is not enabled by default.
To enabled the Content Item Permissions module
In the admin panel go to Modules
Start typing permissions into the filter box at the top left hand corner of the tabs.
The Content Item Permissions should be shown in the list, click Enable in the top right hand corner of its box
This will reload the page and you should see a message at the top saying Content Item Permissions was enabled
Enabling this feature with your pages
Orchard CMS uses a concept where you can glue components together however you want them to be composed in order for them to support the features you want. The concept of a page is just a collection of parts like a page title, a url, text, setting a publish date and things like that.
By default simply enabling the module doesn't make any difference. You will need to add the feature to the Page content. To do this you just need to:
In the admin panel go to Content Definition
Find / filter the Page content type and click Edit on the right hand side
Scroll down to Parts and click Add Parts
Search for Content Permissions in the list, tick the checkbox and press Save at the bottom of the page
You will be taken back to the Page content definition screen. At the bottom of the Parts list you will now see a Content Permissions entry. If you want to set up defaults for new pages click the little > arrow to the left of the header and a panel will expand.
If you want to add it to other content types such as blog posts then you can repeat this process and add it to any content type you want to.
Making an individual page password protected
Now that the feature is enabled and attached to your Page content type you can create a new private page by following these steps:
In the admin panel click New > Page in the sidebar
Give the page some basic content
Scroll down close to the end of the page and tick the checkbox labelled Enable Content Item access control
Let's say you want to make it so anon uses cannot see the page. Under the View this item section just tick all of the roles except for Anonymous (the second one in the list)
Publish the page
Open up a new incognito / in-private browser tab (so the site thinks you aren't logged in) and visit the new page you just published.
You will be redirected to an error screen similar to this page:
You will want to enable the Content Item Permissions feature in order to restrict individual content items to certain permissions. With layers you can only make widgets appear in different zones defined in your theme when the layer's rules are met.
To enable the Content Item Permissions feature, go to your admin dashboard and click on "Modules" on the left hand side. On the modules page enter "Content Item Permissions" in the filter text box to help find the feature. Click on the enable button of the feature in the top right corner. The feature will now be enabled.
Now that you have the feature enabled, you need to add the Content Permissions part to one of your content definitions. To do this click on "Content Definition" on the left hand side of the admin dashboard. Find the content type you want to add permissions to (for instance, Page) and click the edit button. Click the Add Parts button. You will see a list of parts you can add to the content type. Check the checkbox next to Content Permissions and click save.
Next, in the admin dashboard go to one of your content items that is of the content type that you just added the content permissions part to. You will see a new checkbox towards the bottom to enable content item access control. Click the checkbox and you will be able to set the different roles for that content item.
Edit: It looks like it took me too long to write my response. rtpHarry's editted answer is very similar but better formatted.

Command Not Handled Exception

I'm new to Domino Designer. I'm trying to modify an existing application which is running on a remote server. I create a blank xPage and view in browser and it works. I add a label and view in browser and it works. I add a combo box and setup a data source for my xPage. The data source is in the current application and I'm using a view. I setup my combo to point to that data source and specify BindTo value. I view it in browser and I get Error 500 "HTTP Web Server: Command Not Handled Exception" I can open the view that I've used and see all the data in the view. I can even add, edit, and delete from the view.
Ideas... Thnxs in advance.
Additional Info. I've added a "View" from "Container Controls" and used the same data source and the same view and it also works in the browser.
The error being printed is:
javax.faces.el.PropertyNotFoundException: Error getting property 'CompanyName' from bean of type lotus.domino.local.View
com.sun.faces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:119)
com.ibm.xsp.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:144)
com.sun.faces.el.impl.ArraySuffix.evaluate(ArraySuffix.java:182)
com.sun.faces.el.impl.ComplexValue.evaluate(ComplexValue.java:163)
com.sun.faces.el.impl.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.j‌​ava:257)
com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:150) ....
This was already answered in the comments, but I want to write a better answer.
The problem in this case is that a view data source is being used for editing a document. Directly, this is not a possibility, though there are a few great ways to get around this. The first way, and my favorite, is to use an inline form. I think the Extension Library Demo database offers a few great examples of how to go about doing this. One way is to use a tooltip dialog. Another way is an inline form. A repeater is used and for every row in the view, a hidden panel can be made which contains the document data source and all field which are required to be changeable. By clicking on a button or link, the panel is made visible. This is my favorite variant because it is simple, quick, and generally looks great.
Another way to go about this is to have a view data source only, but use scripts to retrieve the document and set the values in the background and then save and release. It all depends on what you are trying to achieve.
My main recommendation is to look at the ExtLib demo and take a look at what they are doing there.

Why is my fileDownload control showing the trashcan even in read mode?

This is a rather strange one I think, and I'm sure I made a mistake here myself:
in one of my applications I'm showing a fileDownload control bound to a Richtext field in my underlying NotesDocument. The control's properties a are set to Hide if no attachments, show size, type and created as well as allow delete. The control itself sits inside a custom control, being part of another custom control, similar to this:
Xpage.xsp
- ccContainer
- - ccInnerDoc
Document datasources for both the container and the "inner" doc are defined at the root of ccContainer and passed into the inner doc.
The inner doc's datasource is comnputed based on a document selection, and it's igenoreRequestParams property is set to false so that I can display the contents of the selected datasource in a given panel etc.
The selected doc is first opened in read mode, and I can set it to edit mode using a button.
Problem now is that my file download control always is showing the delete icon (trashcan) no matter which mode the doc is opened in. And it's not only the icon showing, it also pretends to work by asking me whether I really want to delete and then really removes the file attachment. Only that this change of course cannot be stored into the datasource because it's only open in read mode.
I'm sure that this behaviour is some side-effect of something else in my application (to a certain extent I rebuilt this in a plain new db and until now cannot reproduce it), but I'm at the end of my knowledge of what this could be.
Any hint of what could be causing this is more than welcome.
In place of #Frantisek Kossuth I answer this myself: see compute dynamically the allowDelete property of file download xpages
Thanks again, Frantisek!

Default content editor in list form doesn't allow image alignment

I need to be able to adjust the alignment of an image in an "Enhanced Rich Text Field" in an announcements list in MOSS 2007. However, the default content editor in the edit form for the list doesn't provide a way to do that. What's the fastest way for me to make sure users can align images? My first thought was to customize the DispForm.aspx and EditForm.aspx pages, but they just have the ListForm web part in the content region and as far as I know, you can't customize the ListForm web part from the designer.
You can't customize the LisForm web part, but you can add a "custom list form" to create a custom edit form. Maybe you haven't seen this article: http://weblogs.asp.net/jan/archive/2006/11/06/Custom-Edit-Forms-for-SharePoint-2007-Lists.aspx
Then you could do some javascript hackery to insert your own button which then calls something similar to existing RTE_InsertImage function to call a pop-up window and do whatever you need (you'll find this function in 12\template\layouts\1033\form.js)
I fail to see (or understand) your issue. I created a new announcements list, created a new item, inserted an image, aligned it to the right, viewed the item and it worked.
Then I proceeded to create a new custom column, choose multiple lines,enhanced rich text field, edited my list item, added an image, centered it, viewed and it was also working.
The only thing I noticed is that the "rich" control does not appears on non-IE browsers.

Resources