Meeskond "Harold": Difference between revisions
m →XML |
m →XML |
||
Line 65: | Line 65: | ||
<?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||
<?xml-stylesheet type="text/xsl" href="Response.xsl"?> | <?xml-stylesheet type="text/xsl" href="Response.xsl"?> | ||
<!-- List of user's current challenges --> | |||
<challenges> | <challenges> | ||
<!-- First challenge, started by the user --> | <!-- First challenge, started by the user --> | ||
Line 73: | Line 74: | ||
<points_required>18</points_required> | <points_required>18</points_required> | ||
<badge_id>2</badge_id> | <badge_id>2</badge_id> | ||
<!-- Each challenge has a number of tasks that have to be completed.--> | |||
<!-- No challenge can be completed before earned points from tasks (rewards) exceed the points_required field --> | |||
<tasks max_points="26"> | <tasks max_points="26"> | ||
<task id="19"> | <task id="19"> | ||
Line 78: | Line 82: | ||
<description>If you can read this, you're probably among the luckier ones. Do something for the ones who can't.</description> | <description>If you can read this, you're probably among the luckier ones. Do something for the ones who can't.</description> | ||
<badge_id>2</badge_id> | <badge_id>2</badge_id> | ||
<!-- Each task yields rewards on completion. Rewards are "power" points of different categories.--> | |||
<rewards> | <rewards> | ||
<reward power_id="1">2</reward> | <reward power_id="1">2</reward> | ||
Line 129: | Line 135: | ||
</tasks> | </tasks> | ||
</challenge> | </challenge> | ||
<!-- Second challenge, | <!-- Second challenge, no progress --> | ||
<challenge id="5" tasks="3" progress="0%"> | <challenge id="5" tasks="3" progress="0%"> | ||
<title>The Improgrupp Jaa!</title> | <title>The Improgrupp Jaa!</title> |
Revision as of 19:18, 28 February 2012
Paistab, et tegu on üheliikmelise meeskonnaga. |
Meeskond "Harold" | |
Aine: | Category:Võrgurakendused II: hajussüsteemide ehitamine |
Juhend: | Juhend |
Tüüp: | Projekt |
Liikmed: | User:Anroots |
Juhendajad: | User:Mposka User:Kraspel |
Semester: | 2011/2012 kevad |
Kood (GitHub) | |
Challengo: | https://github.com/anroots/Challengo |
Projekt
Projekti kõik kolm osa keskenduvad veebiteenuse "Challengo" taasloomisele. Projekti esimene osa valmistab ette peamis(t)e päringu(te) XML vastuse struktuuri, projekti teine osa (veebiteenuse loomine) ehitab vastava API ning kolmanda osa raames (klientrakendus) realiseeritakse Windows Phone 7 rakendus.
Korraldus
Projektiga seonduv dokumentatsioon (erandiks on käesolev wiki leht), kasutajale nähtavad tekstid ning lähtekood on kirjutatud inglise keeles. Võimalusel on kood kirjutatud hilisema I18n toe võimaldamiseks.
Koodi haldab GitHub repositoorium, juurdepääsu saamiseks tuleb projektijuhile saata oma GitHub kasutajanimi (või pull request). Tegemist vajavaid töid näeb GitHub lehel Issues vahekaardilt ning asjakohane dokumentatsioon (API) on GitHub wiki alamjaotises.
Lähtekood on põhjalikult kommenteeritud, muud, eraldiseisvat dokumentatsiooni koodi kohta pole.
XML Andmefailid
Tähtaeg 3. märts 2012
XML andmefail kirjeldab veebiteenuse "Challengo" andmeid. Andmed asuvad MYSQL andmebaasis, mille struktuur on kirjeldatud ERD mudeliga
. XML formaadis andmeid väljastab serveris asuv PHP API. Järgnevalt toodud XML näited ei pruugi projekti esimese osa nõudmiste tõttu olla vastavuses teise osana valmiva veebiteenuse tegeliku väljundiga.
Faile saab vaadata ka võrgust: http://enos.itcollege.ee/~anroots/challengo/xml/. Soovitatav on seda teha just XSLT stiilifaili jaoks (http://enos.itcollege.ee/~anroots/challengo/xml/Response.xml).
XML
Järgnevalt on toodud lõik kasutaja praeguste väljakutsete päringust. Kasutajal on parajasti kaks aktiivset väljakutset, igal väljakutsel on veidi meta-infot, mingi hulk ülesandeid (tasks) ning igal ülesandel on üks või mitu autasu (rewards).
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="Response.xsl"?>
<!-- List of user's current challenges -->
<challenges>
<!-- First challenge, started by the user -->
<challenge id="4" tasks="6" progress="17%">
<title>The Improgrupp Jaa!</title>
<description>Inspired by a true story, the Improgrupp Jaa! contains tasks that challenge ones spontaniety and social courage.</description>
<duration>1209600</duration>
<points_required>18</points_required>
<badge_id>2</badge_id>
<!-- Each challenge has a number of tasks that have to be completed.-->
<!-- No challenge can be completed before earned points from tasks (rewards) exceed the points_required field -->
<tasks max_points="26">
<task id="19">
<title>Make a present to a homeless person</title>
<description>If you can read this, you're probably among the luckier ones. Do something for the ones who can't.</description>
<badge_id>2</badge_id>
<!-- Each task yields rewards on completion. Rewards are "power" points of different categories.-->
<rewards>
<reward power_id="1">2</reward>
<reward power_id="2">2</reward>
</rewards>
</task>
<task id="20" completed="true">
<title>Compliment a stranger</title>
<description>Make a sincere compliment to someone you don't know. We could do with more praise where it's due.</description>
<badge_id>1</badge_id>
<rewards>
<reward power_id="2">4</reward>
</rewards>
</task>
<task id="21">
<title>Do volunteer work</title>
<description>Offer yourself as a volunteer to an event or a cause.</description>
<badge_id>4</badge_id>
<rewards>
<reward power_id="1">2</reward>
<reward power_id="2">4</reward>
<reward power_id="3">1</reward>
</rewards>
</task>
<task id="22">
<title>Perform to a security camera</title>
<description>Do a little dance to a security camera. It shouldn't be illegal...probably. Don't get in trouble!</description>
<badge_id>2</badge_id>
<rewards>
<reward power_id="1">2</reward>
</rewards>
</task>
<task id="23">
<title>Compliment someone for a job well done</title>
<description>When was the last time you thanked the janitor?</description>
<badge_id>1</badge_id>
<rewards>
<reward power_id="1">2</reward>
<reward power_id="3">1</reward>
</rewards>
</task>
<task id="24">
<title>Take a day off</title>
<description>This is mostly for work-a-holics: rest for a while.</description>
<badge_id>4</badge_id>
<rewards>
<reward power_id="1">2</reward>
<reward power_id="2">4</reward>
</rewards>
</task>
</tasks>
</challenge>
<!-- Second challenge, no progress -->
<challenge id="5" tasks="3" progress="0%">
<title>The Improgrupp Jaa!</title>
<description>Inspired by a true story, the Improgrupp Jaa! contains tasks that challenge ones spontaniety and social courage.</description>
<duration>1209600</duration>
<points_required>8</points_required>
<badge_id>1</badge_id>
<tasks max_points="14">
<task id="31">
<title>Make a present to a homeless person</title>
<description>If you can read this, you're probably among the luckier ones. Do something for the ones who can't.</description>
<badge_id>22</badge_id>
<rewards>
<reward power_id="3">2</reward>
<reward power_id="2">2</reward>
</rewards>
</task>
<task id="32">
<title>Compliment a stranger</title>
<description>Make a sincere compliment to someone you don't know. We could do with more praise where it's due.</description>
<badge_id>24</badge_id>
<rewards>
<reward power_id="3">4</reward>
</rewards>
</task>
<task id="33">
<title>Do volunteer work</title>
<description>Offer yourself as a volunteer to an event or a cause.</description>
<badge_id>23</badge_id>
<rewards>
<reward power_id="1">4</reward>
<reward power_id="2">1</reward>
<reward power_id="1">1</reward>
</rewards>
</task>
</tasks>
</challenge>
</challenges>
XSLT (stiilifail)
Toodud stiilifail muudab ülaltoodud XML vastuse inimesele kergemini loetavaks.
<?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 class="no-js" lang="en">
<head>
<meta charset="utf-8"/>
<meta name="author" content="Ando Roots" />
<title>Challengo Response</title>
<link rel="stylesheet" href="http://i.jaa.ee/assets/bootstrap-2.0/css/bootstrap.min.css" />
<link rel="stylesheet" href="http://i.jaa.ee/assets/bootstrap-2.0/css/bootstrap.min.responsive.css" />
</head>
<body>
<div class="container">
<h1>Challengo API response</h1>
<p class="help-block">
The following is a list of challenges reported by the XML API.
</p>
<!-- Go over each challenge -->
<xsl:for-each select="challenges/challenge">
<h2>
<!-- Challenge badge image and title -->
<img alt="Challenge badge" height="48" width="48">
<xsl:attribute name="src">
http://enos.itcollege.ee/~anroots/challengo/badges/<xsl:value-of select="badge_id"/>.png</xsl:attribute>
</img>
<xsl:value-of select="title"/>
<!-- Challenge progress, if applicable -->
<xsl:if test="@progress">
(<span>
<xsl:value-of select="@progress"/>
</span>)
</xsl:if>
</h2>
<p class="well">
<xsl:value-of select="description"/>
</p>
<!-- Table for some challenge meta-info -->
<table class="table table-bordered span4">
<tbody>
<tr>
<th>
Points required to complete:
</th>
<td>
<xsl:value-of select="points_required"/>
</td>
</tr>
<tr>
<th>
Time left (hours):
</th>
<td>
<xsl:value-of select="round(duration div 1800)"/>
</td>
</tr>
</tbody>
</table>
<div class="clearfix"></div>
<!-- List all challenge tasks -->
<h3 style="margin-top:140px">Tasks (<xsl:value-of select="@tasks"/>)</h3>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>ID</th>
<th>Title</th>
<th>Badge</th>
<th>Rewards</th>
</tr>
</thead>
<tbody>
<xsl:for-each select="tasks/task">
<tr>
<!-- Color the row gray if task is completed -->
<xsl:if test="@completed">
<xsl:attribute name="class">
help-block
</xsl:attribute>
</xsl:if>
<td>
<xsl:value-of select="@id"/>
</td>
<td>
<xsl:value-of select="title"/>
<p class="help-block">
<xsl:value-of select="description"/>
</p>
</td>
<td>
<img alt="Challenge badge" height="48" width="48">
<xsl:attribute name="src">
http://enos.itcollege.ee/~anroots/challengo/badges/<xsl:value-of select="badge_id"/>.png
</xsl:attribute>
</img>
</td>
<td>
<ul>
<xsl:for-each select="rewards/reward">
<li>
<xsl:if test="(@power_id)=1">
Compassion
</xsl:if>
<xsl:if test="(@power_id)=2">
Strength
</xsl:if>
<xsl:if test="(@power_id)=3">
Intelligence
</xsl:if>
<span>
<xsl:value-of select="."/>
</span>
</li>
</xsl:for-each>
</ul>
</td>
</tr>
</xsl:for-each>
</tbody>
</table>
<!-- End of challenge task table -->
</xsl:for-each>
<!-- End of challenge -->
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
XSD skeemifail
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="challenges">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="challenge">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string" />
<xs:element name="description" type="xs:string" />
<xs:element name="duration" type="xs:unsignedInt" />
<xs:element name="points_required" type="xs:unsignedByte" />
<xs:element name="badge_id" type="xs:unsignedByte" />
<xs:element name="tasks">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="task">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string" />
<xs:element name="description" type="xs:string" />
<xs:element name="badge_id" type="xs:unsignedByte" />
<xs:element name="rewards">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="reward">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:unsignedByte">
<xs:attribute name="power_id" type="xs:unsignedByte" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedByte" use="required" />
<xs:attribute name="completed" type="xs:boolean" use="optional" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="max_points" type="xs:unsignedByte" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedByte" use="required" />
<xs:attribute name="tasks" type="xs:unsignedByte" use="required" />
<xs:attribute name="progress" type="xs:string" use="optional" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Veebiteenus
Tähtaeg 14. aprill 2012
Veebiteenuseks on PHP rakendus, mis hakkab WP7 rakendusele andmeid pakkuma ja neid vastu võtma.
Klientrakendus
Tähtaeg 5. mai 2012
Klientrakendus on Windows Phone 7 klient Challengo teenusele, mis kasutab projekti esimeses osas koostatud XML andmestruktuuri.
XML-i väljastab Challengo API, mis vajab veel kirjutamist. Challengo on realiseeritud PHP-s.
Feature set
- Autentimine
- Login
- Logout
- Nimekiri aktiivsetest väljakutsetest ja nende staatustest
- Nimekiri väljakutse alamülesannetest ja nende staatustest
- Väljakutse märkimine lõpetatuks
- Alamülesande märkimine lõpetatuks
- Uue väljakutse valimine nimekirjast
- Väljakutse detailide ja alamülesannete vaatamine
- Väljakutse "hülgamine" (abandon)
- Kasutaja statistika näitamine
- Praegune punktiseis
- Lõpetatud väljakutsed
- Lõpetatud alamülesanded
- Teenitud märgid
Meeskonna Liikmed
- Ando Roots anroots@itcollege.ee
Liitumine
for t in tudengid: if !t.laisk && t.oskab_progreda: kutsu_meeskonda(t)
$ mail -s "Harold" anroots@itcollege.ee
Eeldan varasemaid teadmisi ning usaldusväärsust. Soovin, et asi ei lõppeks jälle nii, et projektijuht on kaitsmiseelsel õhtul üleval ja lõpetab üksinda projekti. Ole nii kena ja anna huvist märku enne 26. veebruari.
Lisad
Challengo
Challengo.me on Garage48 Tallinn 2011 raames alustatud veebiteenus.
A social network of themed challenges, comes with a Karma profile and level-system. Revenues from ads on the mobile version. Team members: Ando Roots, Kristo Vaher, Valeria Gasik, Jelena Savinen