<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

  <!-- =============================================================== -->
  <!-- hotspots-node-edit.xsl (v001)                                   -->
  <!-- opprettet 29.04.05 - oddmund.mogedal@usit.uio.no                -->
  <!-- =============================================================== -->

  <!-- =============================================================== -->
  <!-- Dokumenttypens hovedelement blir matchet i system-edit.xsl.     -->
  <!-- =============================================================== -->
  <xsl:import href="../../../system/system-edit-v001.xsl"/>
  
  <xsl:import href="../../../common/components/structuredtext/v002/structuredtext-edit.xsl" />

  <!-- =============================================================== -->
  <!-- Templates som kalles i system-edit.xsl og som kan overstyres.   -->
  <!-- Se avsnitt "Template name API" i system-edit.xsl for oversikt   -->
  <!-- over disse.                                                     -->
  <!-- =============================================================== -->

  <!-- Definer det statiske elementet rett før de flyttbare elementene -->
  <xsl:variable name="movable-or-deletable-elements-after" select="'image-url'" />

  <!-- DTD-syntaks for flyttbare og slettbare elementer (men ikke bruk mellomrom)-->
  <xsl:variable name="movable-or-deletable-elements" select="'(hotspot)*'" />

  <!-- css-klasser kan som brukes i denne dok. typen kan legges inn her -->
  <xsl:template name="css-classes" />
 
  <xsl:template name="shortcutlinks-put-bottom" />

  <!-- =============================================================== -->
  <!-- Templater for visning og redigering legges her.                 -->
  <!-- Elementene som skal redigeres må ha: mode="edit"                -->
  <!-- =============================================================== -->

  <xsl:template match="hotspot">
    <b><xsl:value-of select="name()" /></b>:&#160;<xsl:call-template name="insert-edit-link" /><br />
    <!-- TODO: Trenger visning av elementene, kopiere fra visningsxsl etter debugging -->

    <xsl:apply-templates select="@*" />
  </xsl:template>


  <xsl:template match="@*">
    <xsl:value-of select="name()" />:&#160;<xsl:value-of select="." /><br />
  </xsl:template>

  <xsl:template match="hotspot" mode="edit">
   <table border="0" cellspacing="0" cellpadding="5">
      <tr>  
        <td>
          <div style="padding-bottom:5px;padding-top:5px;" class="light">Webadresse til bilde:</div>
          <xsl:apply-templates select="url" mode="edit"/>
        </td>
      </tr>
      <tr>  
        <td>
          <div style="padding-bottom:5px;padding-top:5px;" class="light">Hotspot X1:</div>
          <xsl:apply-templates select="@x1" mode="edit"/>
        </td>
      </tr>
      <tr>  
        <td>
          <div style="padding-bottom:5px;padding-top:5px;" class="light">Hotspot Y1:</div>
          <xsl:apply-templates select="@y1" mode="edit"/>
        </td>
      </tr>
      <tr>  
        <td>
          <div style="padding-bottom:5px;padding-top:5px;" class="light">Hotspot X2:</div>
          <xsl:apply-templates select="@x2" mode="edit"/>
        </td>
      </tr>
      <tr>  
        <td>
          <div style="padding-bottom:5px;padding-top:5px;" class="light">Hotspot Y2:</div>
          <xsl:apply-templates select="@y2" mode="edit"/>
        </td>
      </tr>
      <tr>  
        <td>
          <div style="padding-bottom:5px;padding-top:5px;" class="light">Alternativ tekst (for synshemmede):</div>
          <xsl:apply-templates select="alt-text" mode="edit"/>
        </td>
      </tr>
      <tr>  
        <td>
          <div style="padding-bottom:5px;padding-top:5px;" class="light">Undertekst til bilde:</div>
          <xsl:apply-templates select="caption" mode="edit"/>
        </td>
      </tr>
      <tr>
        <td>
          <div style="padding-top:5px;" class="light">
            PS: Pass på størrelsen på bildet ditt (både areal og filstørrelse). 
          </div>
        </td>
      </tr>
    </table>
  </xsl:template>

  <!-- TODO: Visning som bilde -->
  <xsl:template match="image-url">
    <div><b><xsl:value-of select="name()" />:</b> <xsl:value-of select="." /> <xsl:call-template name="insert-edit-link" /> </div>
  </xsl:template>

  <xsl:template match="url|image-url" mode="edit">
    <xsl:call-template name="insert-inputfield" />&#160;<xsl:call-template name="insert-browsebutton" />
  </xsl:template>

  <!-- Høyde og bredde er spesifisert i schema - Ønsker foreløpig ikke redigering av disse -->
  <xsl:template match="@height | @width" mode="edit">
    <xsl:call-template name="insert-hiddenfield" />
  </xsl:template>

  <xsl:template match="@x1|@y1|@x2|@y2">
    <div><b><xsl:value-of select="name()" />:</b> <xsl:value-of select="." /></div>
  </xsl:template>


  <xsl:template match="@x1|@y1|@x2|@y2" mode="edit">
    <xsl:call-template name="insert-inputfield" />
  </xsl:template>

  <xsl:template match="alt-text" mode="edit">
    <xsl:call-template name="insert-inputfield" />
  </xsl:template>

  <xsl:template match="caption">
    <xsl:apply-templates />
  </xsl:template>

  <xsl:template match="caption" mode="edit">
    <xsl:call-template name="insert-textarea">
      <xsl:with-param name="rows" select='8' />
      <xsl:with-param name="cols" select='41' />
    </xsl:call-template>
  </xsl:template>

</xsl:stylesheet>
