internal FriendlyUrlProviderBase(NameValueCollection attributes) { if (!String.IsNullOrEmpty(attributes["urlFormat"])) { switch (attributes["urlFormat"].ToLower()) { case "searchfriendly": UrlFormat = UrlFormatType.SearchFriendly; break; case "humanfriendly": UrlFormat = UrlFormatType.HumanFriendly; break; case "advanced": case "customonly": UrlFormat = UrlFormatType.Advanced; break; default: UrlFormat = UrlFormatType.SearchFriendly; break; } } }
public DNNFriendlyUrlProvider() { //Read the configuration specific information for this provider var objProvider = (Provider)_providerConfiguration.Providers[_providerConfiguration.DefaultProvider]; //Read the attributes for this provider if (!String.IsNullOrEmpty(objProvider.Attributes["includePageName"])) { _includePageName = bool.Parse(objProvider.Attributes["includePageName"]); } else { _includePageName = true; } if (!String.IsNullOrEmpty(objProvider.Attributes["regexMatch"])) { _regexMatch = objProvider.Attributes["regexMatch"]; } else { _regexMatch = RegexMatchExpression; } if (!String.IsNullOrEmpty(objProvider.Attributes["fileExtension"])) { _fileExtension = objProvider.Attributes["fileExtension"]; } else { _fileExtension = ".aspx"; } if (!String.IsNullOrEmpty(objProvider.Attributes["urlFormat"])) { switch (objProvider.Attributes["urlFormat"].ToLower()) { case "searchfriendly": _urlFormat = UrlFormatType.SearchFriendly; break; case "humanfriendly": _urlFormat = UrlFormatType.HumanFriendly; break; default: _urlFormat = UrlFormatType.SearchFriendly; break; } } }
public DNNFriendlyUrlProvider() { // Read the configuration specific information for this provider var objProvider = (Provider)this._providerConfiguration.Providers[ProviderName]; if (!string.IsNullOrEmpty(objProvider.Attributes["urlFormat"])) { switch (objProvider.Attributes["urlFormat"].ToLowerInvariant()) { case "searchfriendly": this._urlFormat = UrlFormatType.SearchFriendly; break; case "humanfriendly": this._urlFormat = UrlFormatType.HumanFriendly; break; case "advanced": case "customonly": this._urlFormat = UrlFormatType.Advanced; break; default: this._urlFormat = UrlFormatType.SearchFriendly; break; } } // instance the correct provider implementation switch (this._urlFormat) { case UrlFormatType.Advanced: this._providerInstance = new AdvancedFriendlyUrlProvider(objProvider.Attributes); break; case UrlFormatType.HumanFriendly: case UrlFormatType.SearchFriendly: this._providerInstance = new BasicFriendlyUrlProvider(objProvider.Attributes); break; } string extensions = !string.IsNullOrEmpty(objProvider.Attributes["validExtensions"]) ? objProvider.Attributes["validExtensions"] : ".aspx"; this._validExtensions = extensions.Split(','); }
public DNNFriendlyUrlProvider() { //Read the configuration specific information for this provider var objProvider = (Provider) _providerConfiguration.Providers[_providerConfiguration.DefaultProvider]; if (!String.IsNullOrEmpty(objProvider.Attributes["urlFormat"])) { switch (objProvider.Attributes["urlFormat"].ToLower()) { case "searchfriendly": _urlFormat = UrlFormatType.SearchFriendly; break; case "humanfriendly": _urlFormat = UrlFormatType.HumanFriendly; break; case "advanced": case "customonly": _urlFormat = UrlFormatType.Advanced; break; default: _urlFormat = UrlFormatType.SearchFriendly; break; } } //instance the correct provider implementation switch (_urlFormat) { case UrlFormatType.Advanced: _providerInstance = new AdvancedFriendlyUrlProvider(objProvider.Attributes); break; case UrlFormatType.HumanFriendly: case UrlFormatType.SearchFriendly: _providerInstance = new BasicFriendlyUrlProvider(objProvider.Attributes); break; } string extensions = !String.IsNullOrEmpty(objProvider.Attributes["validExtensions"]) ? objProvider.Attributes["validExtensions"] : ".aspx"; _validExtensions = extensions.Split(','); }
internal FriendlyUrlProviderBase(NameValueCollection attributes) { if (!String.IsNullOrEmpty(attributes["urlFormat"])) { switch (attributes["urlFormat"].ToLower()) { case "searchfriendly": UrlFormat = UrlFormatType.SearchFriendly; break; case "humanfriendly": UrlFormat = UrlFormatType.HumanFriendly; break; case "advanced": case "customonly": UrlFormat = UrlFormatType.Advanced; break; default: UrlFormat = UrlFormatType.SearchFriendly; break; } } }
public DNNFriendlyUrlProvider() { //Read the configuration specific information for this provider var objProvider = (Provider)_providerConfiguration.Providers[_providerConfiguration.DefaultProvider]; //Read the attributes for this provider if (!String.IsNullOrEmpty(objProvider.Attributes["includePageName"])) { _includePageName = bool.Parse(objProvider.Attributes["includePageName"]); } else { _includePageName = true; } if (!String.IsNullOrEmpty(objProvider.Attributes["regexMatch"])) { _regexMatch = objProvider.Attributes["regexMatch"]; } else { _regexMatch = RegexMatchExpression; } if (!String.IsNullOrEmpty(objProvider.Attributes["fileExtension"])) { _fileExtension = objProvider.Attributes["fileExtension"]; } else { _fileExtension = ".aspx"; } if (!String.IsNullOrEmpty(objProvider.Attributes["urlFormat"])) { switch (objProvider.Attributes["urlFormat"].ToLower()) { case "searchfriendly": _urlFormat = UrlFormatType.SearchFriendly; break; case "humanfriendly": _urlFormat = UrlFormatType.HumanFriendly; break; default: _urlFormat = UrlFormatType.SearchFriendly; break; } } }
public string GetXml() { var retXml = new StringBuilder(); var baseXml = string.Format("<Field StaticName='{0}' Name='{0}' DisplayName='{1}' Type='{2}' Required='{3}' ShowInDisplayForm='{4}' ShowInEditForm='{5}' ShowInNewForm='{6}' ShowInViewForms='{7}' Hidden='{8}'", XmlName, XmlDisplayName, XmlFieldType, (Required ? "TRUE" : "FALSE"), (ShowInDisplayForm ? "TRUE" : "FALSE"), (ShowInEditForm ? "TRUE" : "FALSE"), (ShowInNewForm ? "TRUE" : "FALSE"), (ShowInViewForm ? "TRUE" : "FALSE"), (Hidden ? "TRUE" : "FALSE")); retXml.Append(baseXml); if (Overwrite) { retXml.Append(" Overwrite='TRUE'"); } if (DecimalPlaces > 0 && (Type == FieldType.Currency || Type == FieldType.Number)) { var decimalPlacesXml = string.Format(" Decimals='{0}'", DecimalPlaces); retXml.Append(decimalPlacesXml); } if (Type == FieldType.Text) { var maxLength = 255; if (MaxLength > 0 && MaxLength <= 255) { maxLength = MaxLength; } var textXml = string.Format(" MaxLength='{0}'", maxLength); retXml.Append(textXml); } if (Type == FieldType.Note) { var noteXml = string.Format(" RichText='{0}'", (RichText ? "TRUE" : "FALSE")); retXml.Append(noteXml); if (RichText) { var richTextXml = string.Format(" RichTextMode='{0}'", RichTextMode.ToString()); retXml.Append(richTextXml); } } if (Type == FieldType.DateTime) { var dateTimeXml = string.Format(" Format='{0}'", DateTimeFormatType.ToString()); retXml.Append(dateTimeXml); } if (Type == FieldType.URL) { var urlXml = string.Format(" Format='{0}'", UrlFormatType.ToString()); retXml.Append(urlXml); } if (Type == FieldType.Lookup) { if (!FieldTypeTaxonomy) { var lookupXml = string.Format(" List='{0}' ShowField='{1}'", "{" + LookupListID + "}", LookupField); retXml.Append(lookupXml); } else { string taxField = string.Format(" ShowField='Term1033' EnforceUniqueValues='FALSE' Sortable='FALSE' Group='My Group'"); } } if (Type == FieldType.User || Type == FieldType.Lookup) { if (Type == FieldType.User) { var userXml = string.Format(" UserSelectionMode='{0}'", UserSelectionMode.ToString()); retXml.Append(userXml); } if (Multiple) { retXml.Append(" Mult='TRUE'"); } } foreach (var attribute in AdditionalAttributes) { retXml.AppendFormat(" {0}='{1}'", attribute.Key, attribute.Value); } retXml.Append(">"); if (Type == FieldType.Lookup && FieldTypeTaxonomy) { string taxField0 = string.Format(@"<Customization><ArrayOfProperty> <Property><Name>SspId</Name><Value xmlns:q1='http://www.w3.org/2001/XMLSchema' p4:type='q1:string' xmlns:p4='http://www.w3.org/2001/XMLSchema-instance'>{0}</Value></Property> <Property><Name>GroupId</Name></Property><Property><Name>TermSetId</Name><Value xmlns:q2='http://www.w3.org/2001/XMLSchema' p4:type='q2:string' xmlns:p4='http://www.w3.org/2001/XMLSchema-instance'>{1}</Value></Property> <Property><Name>AnchorId</Name><Value xmlns:q3='http://www.w3.org/2001/XMLSchema' p4:type='q3:string' xmlns:p4='http://www.w3.org/2001/XMLSchema-instance'>00000000-0000-0000-0000-000000000000</Value></Property> <Property><Name>UserCreated</Name><Value xmlns:q4='http://www.w3.org/2001/XMLSchema' p4:type='q4:boolean' xmlns:p4='http://www.w3.org/2001/XMLSchema-instance'>{2}</Value></Property> <Property><Name>Open</Name><Value xmlns:q5='http://www.w3.org/2001/XMLSchema' p4:type='q5:boolean' xmlns:p4='http://www.w3.org/2001/XMLSchema-instance'>false</Value></Property> <Property><Name>TextField</Name><Value xmlns:q6='http://www.w3.org/2001/XMLSchema' p4:type='q6:string' xmlns:p4='http://www.w3.org/2001/XMLSchema-instance'>{3}</Value></Property> <Property><Name>IsPathRendered</Name><Value xmlns:q7='http://www.w3.org/2001/XMLSchema' p4:type='q7:boolean' xmlns:p4='http://www.w3.org/2001/XMLSchema-instance'>true</Value></Property> <Property><Name>IsKeyword</Name><Value xmlns:q8='http://www.w3.org/2001/XMLSchema p4:type=q8:boolean xmlns:p4=http://www.w3.org/2001/XMLSchema-instance'>false</Value></Property> <Property><Name>TargetTemplate</Name></Property><Property><Name>CreateValuesInEditForm</Name><Value xmlns:q9='http://www.w3.org/2001/XMLSchema' p4:type='q9:boolean' xmlns:p4='http://www.w3.org/2001/XMLSchema-instance'>false</Value></Property> <Property><Name>FilterAssemblyStrongName</Name><Value xmlns:q10='http://www.w3.org/2001/XMLSchema' p4:type='q10:string' xmlns:p4='http://www.w3.org/2001/XMLSchema-instance'>Microsoft.SharePoint.Taxonomy, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Value></Property> <Property><Name>FilterClassName</Name><Value xmlns:q11='http://www.w3.org/2001/XMLSchema' p4:type='q11:string' xmlns:p4='http://www.w3.org/2001/XMLSchema-instance'>Microsoft.SharePoint.Taxonomy.TaxonomyField</Value></Property> <Property><Name>FilterMethodName</Name><Value xmlns:q12='http://www.w3.org/2001/XMLSchema' p4:type='q12:string' xmlns:p4='http://www.w3.org/2001/XMLSchema-instance'>GetFilteringHtml</Value></Property> <Property><Name>FilterJavascriptProperty</Name><Value xmlns:q13='http://www.w3.org/2001/XMLSchema' p4:type='q13:string' xmlns:p4='http://www.w3.org/2001/XMLSchema-instance'>FilteringJavascript</Value></Property> </ArrayOfProperty></Customization>", TermStoreId.ToString("D"), TermSetId.ToString("D"), TermUserCreated.ToString().ToLower(), TaxFieldId.ToString("B") ); string taxField = string.Format(@"<Customization><ArrayOfProperty> <Property><Name>SspId</Name><Value xmlns:q1='http://www.w3.org/2001/XMLSchema' p4:type='q1:string' xmlns:p4='http://www.w3.org/2001/XMLSchema-instance'>{0}</Value></Property> <Property><Name>TermSetId</Name><Value xmlns:q2='http://www.w3.org/2001/XMLSchema' p4:type='q2:string' xmlns:p4='http://www.w3.org/2001/XMLSchema-instance'>{1}</Value></Property> <Property><Name>UserCreated</Name><Value xmlns:q4='http://www.w3.org/2001/XMLSchema' p4:type='q4:boolean' xmlns:p4='http://www.w3.org/2001/XMLSchema-instance'>{2}</Value></Property> <Property><Name>TextField</Name><Value xmlns:q6='http://www.w3.org/2001/XMLSchema' p4:type='q6:string' xmlns:p4='http://www.w3.org/2001/XMLSchema-instance'>{3}</Value></Property> <Property><Name>IsPathRendered</Name><Value xmlns:q7='http://www.w3.org/2001/XMLSchema' p4:type='q7:boolean' xmlns:p4='http://www.w3.org/2001/XMLSchema-instance'>true</Value></Property> <Property><Name>CreateValuesInEditForm</Name><Value xmlns:q9='http://www.w3.org/2001/XMLSchema' p4:type='q9:boolean' xmlns:p4='http://www.w3.org/2001/XMLSchema-instance'>false</Value></Property> </ArrayOfProperty></Customization>", TermStoreId.ToString("D"), TermSetId.ToString("D"), TermUserCreated.ToString().ToLower(), TaxFieldId.ToString("B") ); retXml.Append(taxField); } //Proprietà nell'InnerXml if (Type == FieldType.Choice || Type == FieldType.MultiChoice) { var choices = Choices.Select(c => string.Format("<CHOICE>{0}</CHOICE>", c)); var choicesXml = string.Format("<CHOICES>{0}</CHOICES>", string.Join("", choices.Select(c => c))); retXml.Append(choicesXml); } retXml.Append("</Field>"); return(retXml.ToString()); }