Monday, May 14, 2012

Quick Lunch Box in Results.aspx

I run into something very strange in the Results.aspx page OOTB. Suddenly a wired box appeared. It seems to be the Quick Lunch zone but without the items inside. The wired thing is in the CSS code there are styles to hide it and fix it, but they are not working properly.

The wired box on the left below the status bar:



The CSS:


The thing is that the CSS have the styles as display:none, float:left and more to hide it when you don’t have the left navigation but it seems to ignore it.
So, in the hard way, as always, add these to the CSS / to the <style> in the page so it will do the work properly:


1.  #s4-mainarea #s4-leftpanel{   
2.    display:none!important;   
3.  }   
4.  .s4-ca {   
5.      background-color: inherit;   
6.      margin-left: 0px!important;   
7. 

My Presentation from SharePoint Extreme 2012

After the big event of SharePoint 2012, here is a little web site with all of the workshop content:
Which is by the way, SharePoint Online site.

My SharePoint Extreme presentation about CQWP and XSLT editing from the event:

Have fun!

Second day - second presentation @ SharePoint Extreme 2012

Customizing Advanced Search Web Part

In the Advanced Search Web Part there are a lot of properties can be editable OOTB without designer. Some of them are for properties, the scopes, the languages, and even the fields. Moreover, the advanced search web part properties can be edit by XML.


To add properties and languages to the web part, edit them, remove and move: Edit the web part -> Properties -> Properties. In the same code there are the Properties Definitions and the Result Types. The properties definitions are the source of fields to be referenced in the Result Types, such as property name, type and display name. The Result Types are the options to search by properties according to the selected type and filtered results, for example “PowerPoint Presentations” will display results filtered by file extensions: pptx, ppt, pptm, and odp. It can be modified such as add fields, names, filters and more.



This is the XML by default:
1.  <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">  
2.    <LangDefs>  
3.      <LangDef DisplayName="Arabic" LangID="ar"/>  
4.      <LangDef DisplayName="Bengali" LangID="bn"/>  
5.      <LangDef DisplayName="Bulgarian" LangID="bg"/>  
6.      <LangDef DisplayName="Catalan" LangID="ca"/>  
7.      <LangDef DisplayName="Simplified Chinese" LangID="zh-cn"/>  
8.      <LangDef DisplayName="Traditional Chinese" LangID="zh-tw"/>  
9.      <LangDef DisplayName="Croatian" LangID="hr"/>  
10.     <LangDef DisplayName="Czech" LangID="cs"/>  
11.     <LangDef DisplayName="Danish" LangID="da"/>  
12.     <LangDef DisplayName="Dutch" LangID="nl"/>  
13.     <LangDef DisplayName="English" LangID="en"/>  
14.     <LangDef DisplayName="Finnish" LangID="fi"/>  
15.     <LangDef DisplayName="French" LangID="fr"/>  
16.     <LangDef DisplayName="German" LangID="de"/>  
17.     <LangDef DisplayName="Greek" LangID="el"/>  
18.     <LangDef DisplayName="Gujarati" LangID="gu"/>  
19.     <LangDef DisplayName="Hebrew" LangID="he"/>  
20.     <LangDef DisplayName="Hindi" LangID="hi"/>  
21.     <LangDef DisplayName="Hungarian" LangID="hu"/>  
22.     <LangDef DisplayName="Icelandic" LangID="is"/>  
23.     <LangDef DisplayName="Indonesian" LangID="id"/>  
24.     <LangDef DisplayName="Italian" LangID="it"/>  
25.     <LangDef DisplayName="Japanese" LangID="ja"/>  
26.     <LangDef DisplayName="Kannada" LangID="kn"/>  
27.     <LangDef DisplayName="Korean" LangID="ko"/>  
28.     <LangDef DisplayName="Latvian" LangID="lv"/>  
29.     <LangDef DisplayName="Lithuanian" LangID="lt"/>  
30.     <LangDef DisplayName="Malay" LangID="ms"/>  
31.     <LangDef DisplayName="Malayalam" LangID="ml"/>  
32.     <LangDef DisplayName="Marathi" LangID="mr"/>  
33.     <LangDef DisplayName="Norwegian" LangID="no"/>  
34.     <LangDef DisplayName="Polish" LangID="pl"/>  
35.     <LangDef DisplayName="Portuguese" LangID="pt"/>  
36.     <LangDef DisplayName="Punjabi" LangID="pa"/>  
37.     <LangDef DisplayName="Romanian" LangID="ro"/>  
38.     <LangDef DisplayName="Russian" LangID="ru"/>  
39.     <LangDef DisplayName="Slovak" LangID="sk"/>  
40.     <LangDef DisplayName="Slovenian" LangID="sl"/>  
41.     <LangDef DisplayName="Spanish" LangID="es"/>  
42.     <LangDef DisplayName="Swedish" LangID="sv"/>  
43.     <LangDef DisplayName="Tamil" LangID="ta"/>  
44.     <LangDef DisplayName="Telugu" LangID="te"/>  
45.     <LangDef DisplayName="Thai" LangID="th"/>  
46.     <LangDef DisplayName="Turkish" LangID="tr"/>  
47.     <LangDef DisplayName="Ukrainian" LangID="uk"/>  
48.     <LangDef DisplayName="Urdu" LangID="ur"/>  
49.     <LangDef DisplayName="Vietnamese" LangID="vi"/>  
50.   </LangDefs>  
51.   <Languages>  
52.     <Language LangRef="en"/>  
53.     <Language LangRef="fr"/>  
54.     <Language LangRef="de"/>  
55.     <Language LangRef="ja"/>  
56.     <Language LangRef="zh-cn"/>  
57.     <Language LangRef="es"/>  
58.     <Language LangRef="zh-tw"/>  
59.   </Languages>  
60.   <PropertyDefs>  
61.     <PropertyDef Name="Path" DataType="text" DisplayName="URL"/>  
62.     <PropertyDef Name="Size" DataType="integer" DisplayName="Size (bytes)"/>  
63.     <PropertyDef Name="Write" DataType="datetime" DisplayName="Last Modified Date"/>  
64.     <PropertyDef Name="FileName" DataType="text" DisplayName="Name"/>  
65.     <PropertyDef Name="Description" DataType="text" DisplayName="Description"/>  
66.     <PropertyDef Name="Title" DataType="text" DisplayName="Title"/>  
67.     <PropertyDef Name="Author" DataType="text" DisplayName="Author"/>  
68.     <PropertyDef Name="DocSubject" DataType="text" DisplayName="Subject"/>  
69.     <PropertyDef Name="DocKeywords" DataType="text" DisplayName="Keywords"/>  
70.     <PropertyDef Name="DocComments" DataType="text" DisplayName="Comments"/>  
71.     <PropertyDef Name="CreatedBy" DataType="text" DisplayName="Created By"/>  
72.     <PropertyDef Name="ModifiedBy" DataType="text" DisplayName="Last Modified By"/>  
73.   </PropertyDefs>  
74.   <ResultTypes>  
75.     <ResultType DisplayName="All Results" Name="default">  
76.       <KeywordQuery/>  
77.       <PropertyRef Name="Author" />  
78.       <PropertyRef Name="Description" />  
79.       <PropertyRef Name="FileName" />  
80.       <PropertyRef Name="Size" />  
81.       <PropertyRef Name="Path" />  
82.       <PropertyRef Name="Write" />  
83.       <PropertyRef Name="CreatedBy" />  
84.       <PropertyRef Name="ModifiedBy" />  
85.     </ResultType>  
86.     <ResultType DisplayName="Documents" Name="documents">  
87.       <KeywordQuery>IsDocument="True"</KeywordQuery>  
88.       <PropertyRef Name="Author" />  
89.       <PropertyRef Name="DocComments"/>  
90.       <PropertyRef Name="Description" />  
91.       <PropertyRef Name="DocKeywords"/>  
92.       <PropertyRef Name="FileName" />  
93.       <PropertyRef Name="Size" />  
94.       <PropertyRef Name="DocSubject"/>  
95.       <PropertyRef Name="Path" />  
96.       <PropertyRef Name="Write" />  
97.       <PropertyRef Name="CreatedBy" />  
98.       <PropertyRef Name="ModifiedBy" />  
99.       <PropertyRef Name="Title"/>  
100.              </ResultType>  
101.              <ResultType DisplayName="Word Documents" Name="worddocuments">  
102.                <KeywordQuery>FileExtension="doc" OR FileExtension="docx" OR FileExtension="dot" OR FileExtension="docm" OR FileExtension="odt"</KeywordQuery>  
103.                <PropertyRef Name="Author" />  
104.                <PropertyRef Name="DocComments"/>  
105.                <PropertyRef Name="Description" />  
106.                <PropertyRef Name="DocKeywords"/>  
107.                <PropertyRef Name="FileName" />  
108.                <PropertyRef Name="Size" />  
109.                <PropertyRef Name="DocSubject"/>  
110.                <PropertyRef Name="Path" />  
111.                <PropertyRef Name="Write" />  
112.                <PropertyRef Name="CreatedBy" />  
113.                <PropertyRef Name="ModifiedBy" />  
114.                <PropertyRef Name="Title"/>  
115.              </ResultType>  
116.              <ResultType DisplayName="Excel Documents" Name="exceldocuments">  
117.                <KeywordQuery>FileExtension="xls" OR FileExtension="xlsx" OR FileExtension="xlsm" OR FileExtension="xlsb" OR FileExtension="ods"</KeywordQuery>  
118.                <PropertyRef Name="Author" />  
119.                <PropertyRef Name="DocComments"/>  
120.                <PropertyRef Name="Description" />  
121.                <PropertyRef Name="DocKeywords"/>  
122.                <PropertyRef Name="FileName" />  
123.                <PropertyRef Name="Size" />  
124.                <PropertyRef Name="DocSubject"/>  
125.                <PropertyRef Name="Path" />  
126.                <PropertyRef Name="Write" />  
127.                <PropertyRef Name="CreatedBy" />  
128.                <PropertyRef Name="ModifiedBy" />  
129.                <PropertyRef Name="Title"/>  
130.              </ResultType>  
131.              <ResultType DisplayName="PowerPoint Presentations" Name="presentations">  
132.                <KeywordQuery>FileExtension="ppt" OR FileExtension="pptx" OR FileExtension="pptm" OR FileExtension="odp"</KeywordQuery>  
133.                <PropertyRef Name="Author" />  
134.                <PropertyRef Name="DocComments"/>  
135.                <PropertyRef Name="Description" />  
136.                <PropertyRef Name="DocKeywords"/>  
137.                <PropertyRef Name="FileName" />  
138.                <PropertyRef Name="Size" />  
139.                <PropertyRef Name="DocSubject"/>  
140.                <PropertyRef Name="Path" />  
141.                <PropertyRef Name="Write" />  
142.                <PropertyRef Name="CreatedBy" />  
143.                <PropertyRef Name="ModifiedBy" />  
144.                <PropertyRef Name="Title"/>  
145.              </ResultType>  
146.            </ResultTypes>  
147.          </root>  

To remove the languages except of the English, remove the yellow marked lines.

If required, there is a possibility to change the “ResultType” and to add another one.
In order to add a new property, add the property to the “Metadata Properties”, run a crawling over the site, add it to the “PropertyDefs” and to the “ResultType” as well, and For example:

1.  <PropertyDefs>  
2.      <PropertyDef Name="{Managed Property Name}" DataType="{Type}" DisplayName="{Display Name}"/>
3.  </PropertyDefs>  

1.  <PropertyDefs>  
2.      <PropertyDef Name="ProductName" DataType="text" DisplayName="Product Name"/>
3.  </PropertyDefs>  

1.      <ResultType DisplayName="All Results" Name="default">  
2.        <KeywordQuery/>  
3.        <PropertyRef Name="ProductName" />  
4.      </ResultType>  

The fields to input the search text can be removed by the check boxes:

The scope to search in to be deifned in the “Scopes” -> “Display group”:


The result page URL for the results to be displayed:


This is the Advanced Sarch Box properties OOTB and a little bit beyond. Without any SharePoint Designer customization. There are more options to edit and customie it, but that is it for this post.