tuankhac / share-extras

Automatically exported from code.google.com/p/share-extras
0 stars 0 forks source link

Media Viewers - Easy integration, not only in document-details #109

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What enhancement would you like to see? Is this a new feature, a
translation, or something else?

I would like to be able to integrate Media Viewers in edit-metadata (and on any 
other page) easily.

Does the enhancement relate to an existing add-on or to a new add-on? If an
existing add-on, which one?

Media Viewers

Have you done any work to implement the enhancement? Please detail any
simple changes inline, or for changes involving multiple files please add a
diff file to the issue as an attachment.

In share-config-custom.xml, I have a new form like this, with his own edit-form 
template :

<config evaluator="node-type" condition="my:doc">
  <forms>
    <form>
      <field-visibility>
        <show .../>
      </field-visibility>
      <edit-form template="/path/to/my-custom-form.ftl" />
      <appearance>
        <field ... />
      </appearance>
    </form>
  </form>
</config>

In edit-metadata.xml, I added the web-preview component.

<!-- WebPreview -->
<component>
  <region-id>web-preview</region-id>
  <sub-components>
    <sub-component id="default">
      <evaluations>
        <evaluation>
          <evaluators>
            <evaluator type="config.component.evaluator">
              <params>
                <element>DocumentDetails/document-details/display-web-preview</element>
              </params>
            </evaluator>
          </evaluators>
          <url>/components/preview/web-preview</url>
          <properties>
            <nodeRef>{nodeRef}</nodeRef>
          </properties>
        </evaluation>
      </evaluations>
    </sub-component>
  </sub-components>
</component>

In my-custom-form.ftl, I added this code portion where I want the viewer to be

<#if 
(config.scoped['DocumentDetails']['document-details'].getChildValue('display-web
-preview') == "true")>
  <@region id="web-preview" scope="template"/>
</#if>

The problem is that css and js imports from web-preview.get.head.ftl are not 
outputted in source code when I show my form.
I have to put these includes by hand, and oddly, when I do that, I see css 
imports before <!DOCTYPE>.

<style type="text/css" media="screen">
  ...
  @import "/share/res/components/preview/web-preview.css"
  ...
</style>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Original issue reported on code.google.com by philippe...@gmail.com on 30 Nov 2012 at 1:24

GoogleCodeExporter commented 8 years ago
Hi Phillipe, I've looked at this issue again and I think this would make a good 
blog post on the subject of integrating the Media Viewers into other areas of 
Share, but it is probably best as a separate project outside of the existing 
add-on.

If you're still interested in getting this working I would certainly have some 
tips, and I'm happy to continue the dialogue here or on the mailing list 
(perhaps better as there are more eyes there).

I'm closing this issue for now as WontFix but again I'm happy to help you get 
this working yourself.

Original comment by will.abson on 15 Jul 2013 at 7:07