In Umbraco 7, i am trying to get the Id of a Image on the page. I am using;
#Umbraco.Field("myImage")
But, it does not return the mediaId. Instead it returns;
Umbraco.Web.PublishedCache.XmlPublishedCache.PublishedMediaCache+DictionaryPublishedContent
What am i doing wrong?
There are basically 3 ways:
#CurrentPage.myImage
#Model.Content.GetPropertyValue<int>("myImage")
Using ModelsBuilders you can access it as #Model.myImage
The first method should be avoided because Umbraco will be dropping support for Dynamics (see https://our.umbraco.org/Documentation/Reference/Common-Pitfalls/#dynamics).
ModelsBuilder is my preferred way for accessing published content properties as it provides a strongly typed model based on your Document Type. But it requires some setup. See https://24days.in/umbraco-cms/2016/getting-started-with-modelsbuilder/ for a great intro.
The final option is accessing the properties from #Model.Content (IPublishedContent and unlike the Dyanamics method, will continue to be supported in the next version of Umbraco.
In Umbraco 7 you can use #CurrentPage. You just need to use:
#CurrentPage.myImage
instead of #Umbraco.Field("myImage") and it will return mediaId
I have just upgraded to version 7.6.12 and there are some updates with the media picker. To use it as you done you should select the obsolete mediapicker in the backoffice otherwise Model.Content.GetPropertyValue<IPublishedContent>("myImage").Url should work. If you using the UmbracoHelper, you could write UmbracoHelper.AssignedContentItem.GetPropertyValue<IPublishedContent>(propertyName, recursive).Url
https://our.umbraco.org/documentation/getting-started/backoffice/property-editors/built-in-property-editors/
Related
Code:
DocumentFile dfNew = dfDirectory.createFile("video/mp4", "foo.mp4");
//dfNew.getParentFile() is NOT null.
DocumentFile dfNewCopy = DocumentFile.fromSingleUri(activity, dfNew.getUri());
//dfNewCopy.getParentFile() IS null. Otherwise, dfNewCopy works fine
Why is a DocumentFile created from a DocumentFile's Uri different from the original in this regard?
Storage Access Framework has been designed in days of API 16 for a very narrow use case (implementing the first official Android file picker). DocumentsProvider lacked a lot of useful functionality back then. Many more methods were added in following versions of platform.
The method, required to check whether one Uri is parent of another Uri (isChildDocument) has been added in API 21.
The method for getting parent of Uri (findDocumentPath) has been added in API 26 (Oreo).
DocumentFile can not return the parent Uri on older platforms, because the system itself does not provide it there.
Umbraco 7.2.8 site. We have managed to create a CI process, which includes migration of added fields, properties types etc.
We have not done Languages and I'm wondering if its possible.
So what I would like to know is if there is a way in code to add a new language to the Languages tab within Settings from code?
Thanks
I haven't used or tested this myself but according to the source code it should be possible through the LocalizationService
var languageSE = new Language("sv-SE") { CultureName = "sv-SE" };
Services.LocalizationService.Save(languageSE);
Im using SUP2.2 SP06 version. My question is how to get the synchronizationGroup names in iOS ??? I found some methods in generated DB class. Which one I have to use it and how ??
In Win32 code, I find the method GetAllSynchronizationGroups in the generated DB class. There should be something similar in the generated iOS DB class...
Hello i am new in smart gwt and now we are migrate from smartgwt 2.1 to smart gwt 3.1p
and i have got problem :
java.lang.UnsupportedOperationException: Can not convert element 0 of
the array to a JavaScriptObject. Instances of class
`com.test.ListDTO'
can not automatically be converted. Please see the SmartClient
documentation of RPCRequest.data for a table of Java types that can be
converted automatically.
someone write :
treeNode.setAttribute(TODO, listDTO.getLis());
how i can fix that code ?
The setAttribute method of the TreeNode tries to convert the list elements internally. That fails with your own domain objects. You can try to set the list with this helper method:
com.smartgwt.client.util.JSOHelper.setObjectAttribute(treeNode.getJsObj(), TODO, listDTO.getLis());
Now the Java object is set on the JavaScriptObject. To get this object back you can call:
treeNode.getAttributeAsObject(TODO);
I am building an Internal social networking website on SharePoint. Since its a networking intranet, I want it to be Open and non moderated. However, I also dont want people to use abusive / Foul or bad language words in the portal.
I tried Googling and wasnt really sucessfull in finding a solution.
Microsoft Forefront will do that for me, but it only does for Documents. But I also want to do that on Lists since Discussion forum on the SharePoint is in a list format.
You may create site solution/list definition for your site using Visual studio Sharepoint Site Solution Genarator. Create a custom list and name it as you wish. I would name it "AbusiveWordList" in the following code example.
After creating site solution/list definition, Add below code in Item Adding function, which will iterate through all column in the list and will check from the custom list that is created named "AbusiveWordList". This list contains abusive words.
The chkbody function which will reference list item from custom list named "AbusiveWordList" and check if the bodytext contains item from AbusiveWordList.If yes, then it will throw an error.
*base.ItemAdding(properties);
foreach (DictionaryEntry
dictionaryEntry in
properties.AfterProperties) { string
bodytext = "";
bodytext = bodytext +
dictionaryEntry.Value;
finalwordcount = finalwordcount +
chkbody(bodytext, properties); }
if (finalwordcount > 0) {
properties.ErrorMessage = "Abusive /
Foul / Illicit information
found.Kindly refer to the terms and
conditions.";
properties.Cancel = true;
}
You will probably need to override any controls that display text to avoid this issue. As this would be a lot of work, perhaps an HTTP Module would be a better solution.
I've worked on a module that used regular expressions to make SharePoint's output XHTML compliant. Similarly, you could use regular expressions to strip out offensive words when a page is rendered. It wouldn't stop people typing them but as no-one would be able to see them this wouldn't matter. You could use a basic SharePoint custom list to store the offensive words you don't want displayed.