|
|
(4 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
− | {{CGscriptClass_Template
| + | [[Category:Archive]] |
− | |Name=FolderResourceTemplate
| |
− | |Description=A Folder resource template.
| |
− | |Constructors=
| |
− | {{CGscriptConstructors_Template|Parameters=
| |
− | {{CGscriptParameters_Template|Type=string|Name=name|Description=Resource name}}
| |
− | |Description=Create a new Folder resource template}}
| |
− | |Methods=
| |
− | {{CGscriptMethods_Template|ReturnType=Empty|Name=DefaultLanguage|Parameters=
| |
− | {{CGscriptParameters_Template|Type=string|Name=isocode|Description=Iso code to set as default}}
| |
− | |Description=Which Localized Name is the default}}
| |
− | {{CGscriptMethods_Template|ReturnType=Empty|Name=Save|Description=Save the ResourceTemplate resource}}
| |
− | {{CGscriptMethods_Template|ReturnType=Empty|Name=SaveProperties|Description=Save the properties of the ResourceTemplate resource. Ignores changes to all constant options in use}}
| |
− | {{CGscriptMethods_Template|ReturnType=string|Name=ToString|Description=The string representation of the object.}}
| |
− | |Properties=
| |
− | {{CGscriptProperties_Template|ReturnType=Dictionary|Name=LocalizedNames|HasGetter=1|HasSetter=1|Description=Localized Name of the ResourceTemplate resource}}
| |
− | {{CGscriptProperties_Template|ReturnType=string|Name=ObjectTypeName|HasGetter=1|Description=The name of the type of object.}}
| |
− | {{CGscriptProperties_Template|ReturnType=array|Name=Properties|HasGetter=1|Description=Get the list of current properties. Use AddProperty/RemoveProperty to edit order}}
| |
− | {{CGscriptProperties_Template|ReturnType=int|Name=ResourceId|HasGetter=1|Description=The Id of the ResourceTemplate}}
| |
− | {{CGscriptProperties_Template|ReturnType=string|Name=ResourceName|HasGetter=1|Description=Name of the ResourceTemplate resource}}
| |
− | {{CGscriptProperties_Template|ReturnType=bool|Name=ResourceTimeregEnabled|HasGetter=1|HasSetter=1|Description=Get/set ResourceTimeregEnabled}}
| |
− | {{CGscriptProperties_Template|ReturnType=TypeInformation|Name=TypeInformation|HasGetter=1|Description=Get information about this class.}}
| |
− | }}
| |
− | | |
− | === <span style="color:#DF8621">'''Examples'''</span> ===
| |
− | | |
− | <source lang="javascript">
| |
− | //Create a new FolderResourceTemplate
| |
− | FolderResourceTemplate folderRT = new FolderResourceTemplate("folderRT name");
| |
− | folderRT.LocalizedNames={"da-DK":" name in DK", "en-US":" name in US"};
| |
− | folderRT.DefaultLanguage("da-DK");
| |
− | folderRT.Save();
| |
− | </source>
| |
− | | |
− | <br/><source lang="javascript">
| |
− | //get an existing FolderResourceTemplate
| |
− | number folderResourceTemplateRId = 15547989;
| |
− | ResourceTemplateHelper rth = new ResourceTemplateHelper ();
| |
− | FolderResourceTemplate folderRT = rth.GetTemplate(folderResourceTemplateRId);
| |
− | | |
− | folderRT.ResourceTimeregEnabled=false;
| |
− | | |
− | folderRT.Save();
| |
− | | |
− | print(folderRT.ResourceName);//folderRT name
| |
− | print(folderRT.ResourceId);//15547989
| |
− | </source>
| |
− | | |
− | <br/><source lang="javascript">
| |
− | //create properties for FolderResourceTemplate
| |
− | number folderResourceTemplateRId = 15547989;
| |
− | ResourceTemplateHelper rth = new ResourceTemplateHelper ();
| |
− | FolderResourceTemplate folderRT = rth.GetTemplate(folderResourceTemplateRId);
| |
− | | |
− | new ResourceTemplatePropertyNumber ("propertyNameTypeNumber",false,"description",folderRT);
| |
− | new ResourceTemplatePropertyBoolean ("propertyNameTypeBoolean",true,"description",folderRT);
| |
− | new ResourceTemplatePropertyString ("propertyNameTypeString",false,"description",folderRT);
| |
− | new ResourceTemplatePropertyDateTime ("propertyNameTypeDateTime",false,"description",folderRT);
| |
− | new ResourceTemplatePropertySingle ("propertyNameTypeSingle",true,"description",folderRT);
| |
− | new ResourceTemplatePropertyMulti ("propertyNameTypeMulti",false,"description",folderRT);
| |
− | ResourceTemplatePropertyResource propertyResource = new ResourceTemplatePropertyResource ("propertyNameTypeResource", false, "", folderRT);
| |
− | propertyResource.AddAllowedResourceType(Resource_Type_Folder,{2071,15504791});
| |
− | | |
− | folderRT.SaveProperties();
| |
− | </source>
| |
− | | |
− | <br/><source lang="javascript">
| |
− | //get existing properies of FolderResourceTemplate
| |
− | number folderResourceTemplateRId = 15547989;
| |
− | ResourceTemplateHelper rth = new ResourceTemplateHelper ();
| |
− | FolderResourceTemplate folderRT = rth.GetTemplate(folderResourceTemplateRId);
| |
− | | |
− | array arrayProperty = folderRT.Properties;
| |
− | ResourceTemplatePropertyNumber propertyNumber = arrayProperty[0];
| |
− | propertyNumber.IsDecimal=true;
| |
− | | |
− | ResourceTemplatePropertyString propertyString = folderRT.Properties.First(function (object p){return p.Label=="propertyNameTypeString";});
| |
− | propertyString.Required =true;
| |
− | | |
− | folderRT.SaveProperties();
| |
− | </source>
| |