Advertisement
Guest User

DisplayTemplateExplainRank

a guest
Feb 22nd, 2013
1,413
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
  2. <head>
  3. <title>Common Item Body</title>
  4.  
  5. <!--[if gte mso 9]><xml>
  6. <mso:CustomDocumentProperties>
  7. <mso:TemplateHidden msdt:dt="string">0</mso:TemplateHidden>
  8. <mso:MasterPageDescription msdt:dt="string">Displays the inline result body elements that are common to all results.</mso:MasterPageDescription>
  9. <mso:ContentTypeId msdt:dt="string">0x0101002039C03B61C64EC4A04F5361F385106603</mso:ContentTypeId>
  10. <mso:TargetControlType msdt:dt="string">;#SearchResults;#</mso:TargetControlType>
  11. <mso:HtmlDesignAssociated msdt:dt="string">1</mso:HtmlDesignAssociated>
  12. <mso:ManagedPropertyMapping msdt:dt="string">'Title':'Title','Path':'Path','Description':'Description','EditorOWSUSER':'EditorOWSUSER','LastModifiedTime':'LastModifiedTime','CollapsingStatus':'CollapsingStatus','DocId':'DocId','HitHighlightedSummary':'HitHighlightedSummary','HitHighlightedProperties':'HitHighlightedProperties','FileExtension':'FileExtension','ViewsLifeTime':'ViewsLifeTime','ParentLink':'ParentLink','FileType':'FileType','IsContainer':'IsContainer','SecondaryFileExtension':'SecondaryFileExtension','DisplayAuthor':'DisplayAuthor','filename':'filename'</mso:ManagedPropertyMapping>
  13. </mso:CustomDocumentProperties>
  14. </xml><![endif]-->
  15. </head>
  16. <body>
  17.     <div id="Item_CommonItem_Body">
  18. <!--#_
  19.         var id = ctx.CurrentItem.csr_id;
  20.         var title = Srch.U.getHighlightedProperty(id, ctx.CurrentItem, "Title");
  21.         debugger;
  22.         if ($isEmptyString(title)) {title = $htmlEncode(ctx.CurrentItem.Title)}
  23.         var appAttribs = "";
  24.         if (!$isEmptyString(ctx.CurrentItem.csr_OpenApp)) { appAttribs += "openApp=\"" + $htmlEncode(ctx.CurrentItem.csr_OpenApp) + "\"" };
  25.         if (!$isEmptyString(ctx.CurrentItem.csr_OpenControl)) { appAttribs += " openControl=\"" + $htmlEncode(ctx.CurrentItem.csr_OpenControl) + "\"" };
  26.         var showHoverPanelCallback = ctx.currentItem_ShowHoverPanelCallback;
  27.         if (Srch.U.n(showHoverPanelCallback)) {
  28.             var itemId = id + Srch.U.Ids.item;
  29.             var hoverId = id + Srch.U.Ids.hover;
  30.             var hoverUrl = "~sitecollection/_catalogs/masterpage/Display Templates/Search/Item_Default_HoverPanel.js";
  31.             showHoverPanelCallback = Srch.U.getShowHoverPanelCallback(itemId, hoverId, hoverUrl);
  32.         }
  33.         var displayPath = Srch.U.getHighlightedProperty(id, ctx.CurrentItem, "Path");
  34.         if ($isEmptyString(displayPath)) {displayPath = $htmlEncode(ctx.CurrentItem.Path)}
  35.         var url = ctx.CurrentItem.csr_Path;
  36.         if($isEmptyString(url)){
  37.             var useWACUrl = !$isEmptyString(ctx.CurrentItem.ServerRedirectedURL);
  38.             if(ctx.ScriptApplicationManager && ctx.ScriptApplicationManager.states){
  39.                 useWACUrl = (useWACUrl && !ctx.ScriptApplicationManager.states.openDocumentsInClient);
  40.             }
  41.             if(useWACUrl)
  42.             {
  43.                 url = ctx.CurrentItem.ServerRedirectedURL;
  44.             } else {
  45.                 url = ctx.CurrentItem.Path;
  46.             }      
  47.         }
  48.         ctx.CurrentItem.csr_Path = url;
  49.         var pathLength = ctx.CurrentItem.csr_PathLength;
  50.         if(!pathLength) {pathLength = Srch.U.pathTruncationLength}
  51.  
  52.         var maxTitleLengthInChars = Srch.U.titleTruncationLength;
  53.         var termsToUse = 2;
  54.         if(ctx.CurrentItem.csr_PreviewImage != null)
  55.         {
  56.             maxTitleLengthInChars = Srch.U.titleTruncationLengthWithPreview;
  57.             termsToUse = 1;
  58.         }
  59.  
  60.         var clickType = ctx.CurrentItem.csr_ClickType;
  61.         if(!clickType) {clickType = "Result"}        
  62. _#-->  
  63.                    
  64.         <div id="_#= $htmlEncode(id + Srch.U.Ids.body) =#_" class="ms-srch-item-body" onclick="_#= showHoverPanelCallback =#_">
  65. <!--#_
  66.             if (!$isEmptyString(ctx.CurrentItem.csr_Icon)) {
  67. _#-->
  68.                 <div class="ms-srch-item-icon">
  69.                     <img id="_#= $htmlEncode(id + Srch.U.Ids.icon) =#_" onload="this.style.display='inline'" src="_#= $urlHtmlEncode(ctx.CurrentItem.csr_Icon) =#_" />
  70.                 </div>
  71. <!--#_
  72.             }
  73.             var titleHtml = String.format('<a clicktype="{0}" id="{1}" href="{2}" class="ms-srch-item-link" title="{3}" onfocus="{4}" {5}>{6}</a>',
  74.                                           $htmlEncode(clickType), $htmlEncode(id + Srch.U.Ids.titleLink), $urlHtmlEncode(url), $htmlEncode(ctx.CurrentItem.Title),
  75.                                           showHoverPanelCallback, appAttribs, Srch.U.trimTitle(title, maxTitleLengthInChars, termsToUse));
  76.                                          
  77.             var explainHtml = String.format('<a href="/_layouts/15/ExplainRank.aspx?q={0}&d={1}" title="Explain">Explain Rank</a>',
  78.                                             ctx.DataProvider.$2_3.k,
  79.                                             ctx.CurrentItem.Path);
  80. _#-->      
  81.             <div id="_#= $htmlEncode(id + Srch.U.Ids.title) =#_" class="ms-srch-item-title">
  82.                 <h3 class="ms-srch-ellipsis">
  83.                     _#= titleHtml =#_
  84.                 </h3>
  85.             </div>
  86.            
  87.             <div>_#= explainHtml =#_               
  88.             </div> 
  89. <!--#_
  90.             if (!$isEmptyString(ctx.CurrentItem.HitHighlightedSummary)) {
  91. _#-->
  92.                 <div id="_#= $htmlEncode(id + Srch.U.Ids.summary) =#_" class="ms-srch-item-summary">_#= Srch.U.processHHXML(ctx.CurrentItem.HitHighlightedSummary) =#_</div>
  93. <!--#_
  94.             }
  95.             var truncatedUrl = Srch.U.truncateHighlightedUrl(displayPath, pathLength);
  96. _#-->
  97.             <div id="_#= $htmlEncode(id + Srch.U.Ids.path) =#_" tabindex="0" class="ms-srch-item-path" title="_#= $htmlEncode(ctx.CurrentItem.Path) =#_" onblur="Srch.U.restorePath(this, '_#= $scriptEncode(truncatedUrl) =#_', '_#= $scriptEncode(ctx.CurrentItem.Path) =#_')" onclick="Srch.U.selectPath('_#= $scriptEncode(ctx.CurrentItem.Path) =#_', this)" onkeydown="Srch.U.setPath(event, this, '_#= $scriptEncode(ctx.CurrentItem.Path) =#_', '_#= $scriptEncode(truncatedUrl) =#_')" >
  98.                 _#= truncatedUrl =#_
  99.             </div>
  100.         </div>
  101. <!--#_
  102.         if (!$isEmptyString(ctx.CurrentItem.csr_PreviewImage))
  103.         {
  104.             var altText = Srch.Res.item_Alt_Preview;
  105.             if(!$isEmptyString(ctx.CurrentItem.csr_PreviewImageAltText)){
  106.                 altText = ctx.CurrentItem.csr_PreviewImageAltText;
  107.             }
  108.  
  109.             var onloadJS = "var container = $get('" + $scriptEncode(id + Srch.U.Ids.preview) + "'); if(container){container.style.display = 'inline-block';}" +
  110.                            "var path = $get('" + $scriptEncode(id + Srch.U.Ids.path) + "'); if (path) { Srch.U.ensureCSSClassNameExist(path, 'ms-srch-item-preview-path');}" +
  111.                            "var body = $get('" + $scriptEncode(id + Srch.U.Ids.body) + "'); if (body) { Srch.U.ensureCSSClassNameExist(body, 'ms-srch-item-summaryPreview');}";
  112.  
  113.             var previewHtml = String.format('<a clicktype="{0}" href="{1}" class="ms-srch-item-previewLink" {2}><img class="ms-srch-item-preview" src="{3}" alt="{4}" onload="{5}" /></a>',
  114.                                         $htmlEncode(clickType), $urlHtmlEncode(url), appAttribs, $urlHtmlEncode(ctx.CurrentItem.csr_PreviewImage), $htmlEncode(altText), onloadJS);
  115. _#-->      
  116.             <div id="_#= $htmlEncode(id + Srch.U.Ids.preview) =#_"  class="ms-srch-item-previewContainer">
  117.                 _#= previewHtml =#_
  118.             </div>
  119. <!--#_
  120.         }
  121. _#-->
  122.     </div>
  123. </body>
  124. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement