#** * Render a complex document in the results list *# ## Load Mime-Type List and Mapping #parse('mime_type_lists.vm') ## Sets: ## * supportedMimeTypes, AKA supportedtypes ## * mimeExtensionsMap, AKA extMap ## Title #if($doc.getFieldValue('title')) #set($title = $esc.html($doc.getFirstValue('title'))) #else #set($title = "["+$doc.getFieldValue('id')+"]") #end ## URL #if($doc.getFieldValue('url')) #set($url = $doc.getFieldValue('url')) #elseif($doc.getFieldValue('resourcename')) #set($url = "file:///$doc.getFieldValue('resourcename')") #else #set($url = "$doc.getFieldValue('id')") #end ## Sort out Mime-Type #set($ct = $list.get($doc.getFirstValue('content_type').split(";"),0)) #set($filename = $doc.getFieldValue('resourcename')) #set($filetype = false) #set($filetype = $mimeExtensionsMap.get($ct)) ## TODO: falling back to file extension is convenient, ## except when you don't have an icon for that extension ## example "application/vnd.openxmlformats-officedocument.wordprocessingml.document" ## document with a .docx extension. ## It'd be nice to fall back to an "unknown" or the existing "file" type ## We sort of do this below, but only if the filename has no extension ## (anything after the last dot). #if(!$filetype) #set($filetype = $filename.substring($filename.lastIndexOf(".")).substring(1)) #end ## #if(!$filetype) ## #set($filetype = "file") ## #end ## #if(!$supportedMimeTypes.contains($filetype)) ## #set($filetype = "file") ## #end ## Row 1: Icon and Title and mlt link