Meeskond "Kujuneb": Difference between revisions

From ICO wiki
Jump to navigationJump to search
Alea (talk | contribs)
Alea (talk | contribs)
Line 361: Line 361:


AnnaArtistid
AnnaArtistid
AnnaKasutajad


AnnaZanr
AnnaZanr
Line 377: Line 379:


LisaZanr
LisaZanr
LogiSisse
LogiValja


MuudaArtist
MuudaArtist

Revision as of 14:27, 6 May 2011

Liikmed

  • Rauno Väli
  • Andreas Lea
  • Erik Peinar


XML

Andmefail (XML)

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<!-- <?xml-stylesheet type="text/xsl" href="style.xslt"?> -->
<tootekataloog>

  <!-- zanride loetelu-->
  <zanrid>
    <zanr id="1">
      <nimi>Pop</nimi>
    </zanr>
    <zanr id="2">
      <nimi>Rap</nimi>
    </zanr>
  </zanrid>

  <!-- artistide loetelu-->
  <artistid>
    <artist id="1">
      <nimi>Queen</nimi>
    </artist>
    <artist id="2">
      <nimi>Madonna</nimi>
    </artist>
  </artistid>

  <!-- albumite loetelu-->
  <albumid>
    <album id="1">
      <zanr>1</zanr>
      <artist>1</artist>
      <nimi>Greatest Hits</nimi>
      <aasta>2005</aasta>
      <lugusi>15</lugusi>
      <pilt>http://bit.ly/jreygb</pilt>
      <hind>12</hind>
    </album>
    <album id="2">
      <zanr>2</zanr>
      <artist>2</artist>
      <nimi>American Life</nimi>
      <aasta>2002</aasta>
      <lugusi>19</lugusi>
      <pilt>http://bit.ly/jwEHdl</pilt>
      <hind>8.3</hind>
    </album>
  </albumid>
</tootekataloog>

Skeemifail (XSD)

<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="tootekataloog">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="zanrid">
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" name="zanr">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="nimi" type="xs:string" />
                  </xs:sequence>
                  <xs:attribute name="id" type="xs:unsignedByte" use="required" />
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="artistid">
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" name="artist">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="nimi" type="xs:string" />
                  </xs:sequence>
                  <xs:attribute name="id" type="xs:unsignedByte" use="required" />
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="albumid">
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" name="album">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="zanr" type="xs:unsignedByte" />
                    <xs:element name="artist" type="xs:unsignedByte" />
                    <xs:element name="nimi" type="xs:string" />
                    <xs:element name="aasta" type="xs:unsignedShort" />
                    <xs:element name="lugusi" type="xs:unsignedByte" />
                    <xs:element name="pilt" type="xs:string" />
                    <xs:element name="hind" type="xs:decimal" />
                  </xs:sequence>
                  <xs:attribute name="id" type="xs:unsignedByte" use="required" />
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

Stiilifail (XSLT)

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
    <html>
      <head>
        <title>Tootekataloog</title>
        <style type="text/css">
          body {
          font-family: Arial, Verdana;
          }

          table {
          font-size: 12px;
          border-collapse: collapse;
          }

          table.main {
          border: 1px solid #98bf21;
          }

          table.main th {
          padding: 3px 10px 3px 10px;
          border: 1px solid #98bf21;
          background-color: #A7C942;
          color: #FFFFFF;
          }

          table.main tr {
          background-color: #FFFFFF;
          }

          table.main td {
          text-align: center;
          padding: 3px;
          border: 1px solid #98bf21;
          }

          a, a:hover, a:active, a:visited {
          color: #000000;
          }

          a img {
          border: none;
          }
        </style>
      </head>
      <body>
        
        <h3>Albumid</h3>
        
        <table class="main">
          <tr>
            <th>Artist</th>
            <th>Album</th>
            <th>Žanr</th>
            <th>Aasta</th>
            <th>Lugusi</th>
            <th>Pilt</th>
            <th>YouTube</th>
            <th>Hind</th>
          </tr>
          <xsl:for-each select="tootekataloog/albumid/album">
            <xsl:variable name="artistID" select="artist"/>
            <xsl:variable name="zanrID" select="zanr"/>
            <tr>
              <xsl:if test="position() mod 2 =0">
                <xsl:attribute name="style">
                  background-color: #EAF2D3;
                </xsl:attribute>
              </xsl:if>
              <td>
                <xsl:value-of select="/tootekataloog/artistid/artist[@id=$artistID]/nimi"/>
              </td>
              <td>
                <xsl:value-of select="nimi"/>
              </td>
              <td>
                <xsl:value-of select="/tootekataloog/zanrid/zanr[@id=$zanrID]/nimi"/>
              </td>
              <td>
                <xsl:value-of select="aasta"/>
              </td>
              <td>
                <xsl:value-of select="lugusi"/>
              </td>
              <td>
                <img width="100" height="100">
                  <xsl:attribute name="src">
                    <xsl:value-of select="pilt"/>
                  </xsl:attribute>
                </img>
              </td>
              <td>
                <a>
                  <xsl:attribute name="href">
                    <xsl:text>http://www.youtube.com/results?search_query=</xsl:text><xsl:value-of select="/tootekataloog/artistid/artist[@id=$artistID]/nimi"/>+<xsl:value-of select="nimi"/>
                  </xsl:attribute>
                  <img src="http://www.upload.ee/image/1288041/youtube-badge-64x64.png">
                  </img>
                </a>
              </td>
              <td>
                <xsl:value-of select="hind"/>               </td>
            </tr>
          </xsl:for-each>
        </table>

        <br/><br/>
        
        <h3>Toored andmed</h3>
        <table>
          <tr>
            <td style="padding-right: 50px; vertical-align: top;">

              <h4>Žanrid</h4>
              <table class="main">
                <tr>
                  <th>id</th>
                  <th>nimi</th>
                </tr>
                <xsl:for-each select="tootekataloog/zanrid/zanr">
                  <tr>
                    <xsl:if test="position() mod 2 =0">
                      <xsl:attribute name="style">
                        background-color: #EAF2D3;
                      </xsl:attribute>
                    </xsl:if>
                    <td>
                      <xsl:value-of select="@id"/>
                    </td>
                    <td>
                      <xsl:value-of select="nimi"/>
                    </td>
                  </tr>
                </xsl:for-each>
              </table>  
                  
            </td>
            <td style="padding-right: 50px; vertical-align: top;">
              
              <h4>Artistid</h4>
              <table class="main">
                <tr>
                  <th>id</th>
                  <th>nimi</th>
                </tr>
                <xsl:for-each select="tootekataloog/artistid/artist">
                  <tr>
                    <xsl:if test="position() mod 2 =0">
                      <xsl:attribute name="style">
                        background-color: #EAF2D3;
                      </xsl:attribute>
                    </xsl:if>
                    <td>
                      <xsl:value-of select="@id"/>
                    </td>
                    <td>
                      <xsl:value-of select="nimi"/>
                    </td>
                  </tr>
                </xsl:for-each>
              </table>
              
            </td>
            <td style="vertical-align: top;">

              <h4>Albumid</h4>
              <table class="main">
                <tr>
                  <th>id</th>
                  <th>zanr</th>
                  <th>artist</th>
                  <th>nimi</th>
                  <th>aasta</th>
                  <th>lugusi</th>
                  <th>pilt</th>
                  <th>hind</th>
                </tr>
                <xsl:for-each select="tootekataloog/albumid/album">
                  <tr>
                    <xsl:if test="position() mod 2 =0">
                      <xsl:attribute name="style">
                        background-color: #EAF2D3;
                      </xsl:attribute>
                    </xsl:if>
                    <td>
                      <xsl:value-of select="@id"/>
                    </td>
                    <td>
                      <xsl:value-of select="zanr"/>
                    </td>
                    <td>
                      <xsl:value-of select="artist"/>
                    </td>
                    <td>
                      <xsl:value-of select="nimi"/>
                    </td>
                    <td>
                      <xsl:value-of select="aasta"/>
                    </td>
                    <td>
                      <xsl:value-of select="lugusi"/>
                    </td>
                    <td>
                      <xsl:value-of select="pilt"/>
                    </td>
                    <td>
                      <xsl:value-of select="hind"/>
                    </td>
                  </tr>
                </xsl:for-each>
              </table>

            </td>
          </tr>
        </table>
        
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>

Andmefaili vaade stiilifailiga

Teenus

Teenuse kirjeldus

Meie teenuseks on albumite kataloog.

Teenusel on järgmised meetodid:

AnnaAlbum

AnnaAlbumid

AnnaArtist

AnnaArtistid

AnnaKasutajad

AnnaZanr

AnnaZanrid

KustutaAlbum

KustutaArtist

KustutaZanr

LisaAlbum

LisaArtist

LisaZanr

LogiSisse

LogiValja

MuudaArtist

MuudaZanr

Andmetabelid

Klientrakendus