From 2ec7d0e1843d7106d78b5604d0dfbd6f4e9050c7 Mon Sep 17 00:00:00 2001 From: "support@subpointsolutions.com" Date: Sat, 8 Oct 2016 20:13:40 -0700 Subject: [PATCH] + Add AdvancedSearchBoxDefinition - support AdvancedSearchBox webpart provision #857 + CSOM impl and tests --- .../Webparts/AdvancedSearchBoxModelHandler.cs | Bin 2428 -> 11082 bytes .../AdvancedSearchBoxDefinitionGenerator.cs | Bin 1484 -> 3918 bytes .../Webparts/AdvancedSearchBoxValidator.cs | Bin 2920 -> 42126 bytes .../WebpartDefinitionCoverageTest2.cs | 11 ++++- SPMeta2/SPMeta2/SPMeta2.csproj | 1 + .../AdvancedSearchBoxWebPartXmlExtensions.cs | 39 ++++++++++++++++++ 6 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 SPMeta2/SPMeta2/Utils/AdvancedSearchBoxWebPartXmlExtensions.cs diff --git a/SPMeta2/SPMeta2.CSOM.Standard/ModelHandlers/Webparts/AdvancedSearchBoxModelHandler.cs b/SPMeta2/SPMeta2.CSOM.Standard/ModelHandlers/Webparts/AdvancedSearchBoxModelHandler.cs index 12de272e101176406cc2825de3d5ba6180c7f005..43054bbd0ae9e7f15ec5094a853f4e867a1d6bca 100644 GIT binary patch literal 11082 zcmdT~-&4~-5Z-5J{2wB`lo=-vK8iAffXIkYEr_r5htM%JwN1s2(1NV#%Jug8p7Yc8Ff{ths>pzD(6~krOWG%97yjS+X&KJnft-O#_^fvpiP*wJx70 zUsf$-e?L?Vc<6l$vO&XqmG6M?F(E*xMoyRQ&O9ePkUJ1tB!1C>d&^? z^xgwnA?yr*;5n=ut>8jFY5z#x;godCe!-9EU7_8Rm-uOqP4t@{%<*R~0-Mml zcuwM&ht?|EQ%Hq~5{@H|M8;{JY#Qkh(L<>jq?kuMIfH-H#4|<`J&W#Iv$(TktK~gJ zvc~b6ZD_AxRBKs)w7@=+#-=Q#r%_%u`sF&H`CDo1E^+Ev)RT zm}jiTd9BL0W9FJAB4L=&r$Z_JvUb*>RN%!E4fchv~mgI4 zMhZDSFCN44K3amicCuu%%-|SvO8sEaips|8&1wUw!AKG+zmrmt)+btLXw_5Pyi>xC*F*jTHguiml5{pK7iI_}O) z#ir>jx!G*v#Z5!KO!P2L^xm!M_}eVCp>C5~7uM~{Pcec;cDwOVq@`|F;&%?o5o+q< z=ctYyH*7ag1kHPre4FiTxM(QDM0V{)zni!%s0aD#{ohhDuvpn{}yn**RLRJDj45W!6xvkn$aE(>b#H;KGqz zgP(}eb#P>_KeU4*yALiL*)^=2BU}BU9Sqq#aN)-$zixJ1Y7OmR$;A^Fwp{eApS9#W zCS6-euOr*SS&<)Zj1_5FH($wBsoCLoQI8qmn-i{F+QC+l7cN{C=~y>Y@$RlIYrLez zE(|1}e|WV2|INR7(;vSdNN2jHS8B@JZ)35%HkV!N3|T1tmMi&9MAp75`|FqTUucV_D5*LIi|^c%%3Kk$%{-r$0V@Xhvfhhb2&r7W>I!#CUt!VeFg=F5C(q+7a-OF hvI`iB81fmC8B!UFflz@Vg29);XR@KZ;^YHbT>!Gt6nOvu diff --git a/SPMeta2/SPMeta2.Containers.Standard/DefinitionGenerators/Webparts/AdvancedSearchBoxDefinitionGenerator.cs b/SPMeta2/SPMeta2.Containers.Standard/DefinitionGenerators/Webparts/AdvancedSearchBoxDefinitionGenerator.cs index 718366f014237f0dcd9beba09c29ce92e9abc2b1..cdca4738f81eae077712185b8ed3f73598fe886d 100644 GIT binary patch literal 3918 zcmc&$O>f#j5Pj!L{SQ`7AhreT_=wpa$1ZZNyuM81x@eVKX0`A`sU-&P>72cqZ4~ThAzT|v_ zglFrNA+tNKbvToi6YfYkFP3=9T|Jf7r`*2EPfMI@sun|ZiInhNhhI`1KZwxANcUyb zYO0f1I^^1|YAk<6cj2R)#lk@m`e#a8w2Gtpk4!F zrF;S$)6zRd7HzxAyx8Bt4LOhT+sneL9s%A`T8q9PsT?17tEXH)n~x9wQ>!D#W|sj! z6ESU88oRjZpOAmN=E`8U?&3er7pL?^%9xTm zGGSIEWN^&yDlx@H~7r$l&uJhpZ0?8J6B!tp;Uc`2YuunHCzX zObu_nvs|@NPFUU+_pVSQQ#w*Y-}X65&nvDThPG}r4Se#Yr_HPQZe#XBEs{!=&3f-{ z5u3Cv)*k;b?cg&CsiXZW`o`GLsrxdellm0 rrJQ(tbk6I{a>ZViy-lv!Eoq)*E^pOVwfou4Zn=}(JKb*jHGTgBg2ykQ delta 15 WcmX>ncZPdI9_wT)4z0;j{3ZY{$^_N` diff --git a/SPMeta2/SPMeta2.Regression.CSOM.Standard/Validation/Webparts/AdvancedSearchBoxValidator.cs b/SPMeta2/SPMeta2.Regression.CSOM.Standard/Validation/Webparts/AdvancedSearchBoxValidator.cs index 475ef16740fc313dc06c4b17cb9471ce65b4bb65..2e034ef0493ca1fa1fb55bcf174ced6e85669a88 100644 GIT binary patch literal 42126 zcmeI5-*4MC5XbpEVE==gCkH6>u*YpJkhbYsplh-w?e@CZS?blbJzHrL6#dt?eUHqU zqD+e?RZ6Y&5VVwJOFZ7M4=GXffB#;Zm6@2CxiABBVy>~5n{)Ht{A9j2-EeUkH^ zpvJ$fW+td{f)>t1^~TT3%p=IY!Zp(x*>;8cI(UWpE}*e<)J#^UHWcml1~N@?e2kLY zn3nIvdH`9OtTDzF+mraUm18Q>^kdr|@<#Gs=Wm%gux+Kiutns}Gko{G)dqRe2wUXy zp;xDLw%Pia7B@YX>i=Y8YJghlZ-MAKv-%%lZ-g!KkQKHMpw$o9n^_shkntRQOYFUc zAI;5`3G1BWvw`^$|D2B;+i&MlyKJ6GlCeyognTrVbPm}_zf0>mq{CC>jfK_bsjc|} z+xhxv@%ntlcs=~7JAVLu4NwbR>k{P*d-+XGbHwIQpr@E;?jr^V=5t^RuGt-pNu1Kb z2iS!oX<)U!fHmik)n~>b_Rq}UXw3+%7{CvG&U9Jn{>{1Ntize3c+P%Q`f9D7!8VkE zT)f64jLYPYlIBP^G5xRx$#2OUDX$Pqp5q_!#B1UiT27w~%!8;ND0V34z71me0QMh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IYpW^+h(a`ttDkD$2K#n3#LjeA@vfLmrIs=H`pp^ zsWO&r=SyX**M%}x8B0&y$|F`uZjokD&)W9x2dCGDP}*{oGqt**ZEEczsh6;{T(Z== z!rD|jm9%U*Un*(6E|j!N+Bj)bnMImGyWs3A%tTz--;B=)jhMmc7wC^+uI$5!yd=x`;f)APu)ANCxvJmVqFtw2}#7V6}Z%KCTn7VS)Dq| hw~i0p^?6D4a|B1C_o?`nqip=MsyBVZ^W2{M|9?X+=iC4Q delta 38 pcmeA>$@D^O!vdzwub3)0CMR*qOg7Mynk*2-$5YF|%fQ6|Apr<@3M~Kt diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/DefinitionCoverage/WebpartDefinitionCoverageTest2.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/DefinitionCoverage/WebpartDefinitionCoverageTest2.cs index 12d85ef2b..9c8011330 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/DefinitionCoverage/WebpartDefinitionCoverageTest2.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/DefinitionCoverage/WebpartDefinitionCoverageTest2.cs @@ -80,7 +80,7 @@ public static void Cleanup() public static bool UseSubWebs = true; public static bool UseApps = false; - + #endregion #region pre-generated tests @@ -284,6 +284,15 @@ public void CanDeploy_XsltListViewWebPartDefinition_To_AllPageTypes() } + [TestMethod] + [TestCategory("Regression.DefinitionCoverage.WebpartDefinitions")] + [SiteCollectionIsolation] + public void CanDeploy_AdvancedSearchBoxDefinition_To_AllPageTypes() + { + DeployWebpartOnSupportedHosts(); + } + + [TestMethod] [TestCategory("Regression.DefinitionCoverage.WebpartDefinitions")] [SiteCollectionIsolation] diff --git a/SPMeta2/SPMeta2/SPMeta2.csproj b/SPMeta2/SPMeta2/SPMeta2.csproj index 6c3f3677d..1959dfeef 100644 --- a/SPMeta2/SPMeta2/SPMeta2.csproj +++ b/SPMeta2/SPMeta2/SPMeta2.csproj @@ -595,6 +595,7 @@ + diff --git a/SPMeta2/SPMeta2/Utils/AdvancedSearchBoxWebPartXmlExtensions.cs b/SPMeta2/SPMeta2/Utils/AdvancedSearchBoxWebPartXmlExtensions.cs new file mode 100644 index 000000000..b5fe93d42 --- /dev/null +++ b/SPMeta2/SPMeta2/Utils/AdvancedSearchBoxWebPartXmlExtensions.cs @@ -0,0 +1,39 @@ +using System.Xml.Linq; + +namespace SPMeta2.Utils +{ + /// + /// Helper class to work with AdvancedSearchBoxWebPart xml properties. + /// Allows to props with xmlns="urn:schemas-microsoft-com:AdvancedSearchBox" + /// + public static class AdvancedSearchBoxWebPartXmlExtensions + { + #region properties + + private const string XmlNs = "urn:schemas-microsoft-com:AdvancedSearchBox"; + + #endregion + + #region methods + + public static string GetAdvancedSearchBoxWebPartProperty(this XDocument webpartXmlDocument, string propName) + { + return webpartXmlDocument.GetProperty(propName, XmlNs); + } + + public static XDocument SetOrUpdateAdvancedSearchBoxWebPartProperty(this XDocument webpartXmlDocument, + string propName, + string propValue) + { + return SetOrUpdateAdvancedSearchBoxWebPartProperty(webpartXmlDocument, propName, propValue, false); + } + + public static XDocument SetOrUpdateAdvancedSearchBoxWebPartProperty(this XDocument webpartXmlDocument, string propName, + string propValue, bool isCData) + { + return webpartXmlDocument.SetOrUpdateProperty(propName, propValue, "string", XmlNs, isCData); + } + + #endregion + } +}