Teie kommentaarid

Here is a very simple example of how you can post data to an external server. To query that data later, just follow any tutorial on reading data from a datasource. Let me know if you have any questions. This code is no longer posting anything, but you should get the idea. 

<wire>
    <datasources>
        <!-- add http header values the service needs into the httpheader tag -->
        <httpheader name="jsonheader" Accept="text/json">
        <datasource name="validation" httpheader="jsonheader" source="" query="/" providertype="json" querycomplete="validate" httpmethod="post"/>
    </datasources>
    <main>
       <!-- this text template contains the content you want to send to the service add [var:xxx] for variables from the WIRE, etc. -->
       <texttemplate name="expired-receipt"><![CDATA[ {"format_version":1,"type":"email","email":{"to_email":"TO_ADDRESS","to_name":"TO_NAME","from_email":"FROM_EMAIL","from_name":"FROM_NAME","subject":"EMAIL_SUBJECT","body_html":"BODY_HTML_VERSION","body_text":"BODY_TEXT_VERSION"}}]]></texttemplate>


        <panel name="body" height="50%" width="50%" background="#ff0000" valign="center" align="center">
        </panel>
    </main>
    <actions>
        <action name="start" oninit="yes">
            <sync>
                <!-- assign the value of the text template to the postContent property of the datasource to be sent to the server -->
                <assign property="datasource:validation.postContent" value="[template:expired-receipt.content]" />
                 <!-- update the source of the datasource to initiate the request -->
                <assign property="datasource:validation.source" value="http://content.rarewire.com/get-apple-subscription-data/D3mwuC8bvBWUXSnq" />
            </sync>
        </action>
        <action name="validate">
            <alert message="[datasource:validation.1.status]"/>
        </action>
    </actions>
</wire>
Settings for an app can be accessed from inside the Editor. Then it will be the leftmost option in your editor menu bar.
Here is a short example: 

Add this to a functions.html file: (download a functions file here: http://content.rarewire.com/wordpress/wp-content/u...

           var startTime = 0;
            var stopTime  = 0;
            
            function timerStart() {
                startTime =  new Date().getTime();
                return startTime;
                
            }
        
            function timerStop() {
                stopTime = new Date().getTime() - startTime;
                return stopTime;
            }
        
            function formatTime() {
            
                var time = stopTime;
                var hr  = 0;
                var min = 0;
                var sec = 0;
                var ms = 0;
              
                hr = Math.floor( time / (60 * 60 * 1000) );
                time = time % (60 * 60 * 1000);
                min = Math.floor( time / (60 * 1000) );
                time = time % (60 * 1000);
                sec = Math.floor( time / 1000 );
                ms = time % 1000;
                return "" + hr + " hours " + min + " min " + sec + " sec";            
            }




Now use this in your WIRE:
<wire>
    <class name="field">
    	<text name="charCount" alias="FIELD1" width="50%" height="fit" color="#ffffff" font="Avenir-Medium" size="16" bottomof="text" align="center" alignment="center" text=""></text>
    </class>
    <main>
        <panel name="2" alias="PAGE" width="95%" height="50%" align="center" _scroll="2" _name="Page One of Five" onscrollto="addStory-scroll">
            <panel name="text" width="100%" height="85%" >
               <panel name="1" width="100" height="100" background="ff0000" align="left" onclickup="start">
                 <text name="start" width="100%" height="100%" color="#ffffff" font="Avenir-Medium" size="16" alignment="center" text="Start"></text>
               </panel>
               <panel name="2" width="100" height="100" background="ff0000" align="right" onclickup="stop">
               	 <text name="stop" width="100%" height="100%" color="#ffffff" font="Avenir-Medium" size="16" alignment="center" text="Stop"></text> 
               </panel>
            </panel>
            <text name="charCount" alias="FIELD" width="50%" height="fit" color="#ffffff" font="Avenir-Medium" size="16" bottomof="text" align="center" alignment="center" text="Start"></text>
        </panel>
    </main>
    <actions>
        <action name="start">
            <sync>
                <delete target="FIELD"/>
                <delete target="FIELD1"/>
                <assign property="var:startTime" value="[js: timerStart(); ]"/>
                <play action="timer" />
            </sync>
        </action>
        <action name="timer">
            <create class="field" target="PAGE"/>
            <sync delay="1" loop="yes">
                <assign property="var:stopTime" value="[js: timerStop();]"/>
                <assign property="object:FIELD1.text" value="[js: formatTime(); ]" />
            </sync>
        </action>
        <action name="stop">
            <sync>
            <assign property="var:startTime" value="0"/>
            <delete target="FIELD1"/>
			<alert message="[js: formatTime(); ]" />            
            </sync>    
        </action>
    </actions>
</wire>



You should consider using javascript to accomplish this. This would involve using a [js:] (same as [eval:]) tag to evaluate. 

Check out the documentation here:
https://studio.rarewire.com/wordpress/2012/05/eval...
https://studio.rarewire.com/wordpress/2013/05/java...

Javascript around timing:
http://www.w3schools.com/js/js_timing.asp
Yes this is pretty easy to do, however you have to balance when the map finds your GPS location and then zoom into that location after the fact. 

Here is a sample:

<wire>
   <main>
       <panel name="test" width="100%" height="100%" >
         <map name="map" alias="MAP" width="100%" height="100%" type="satelite"></map>
       </panel>
   </main>
   <actions>
     <action name="zoom" oninit="yes">
       <assign property="object:MAP.showuser" value="yes"/>
      <sync delay="1">   
       <play action="region" />   
      </sync>    
     </action>
     <action name="region">
     	<assign property="object:MAP.region" value="[object:MAP.gpslatitude] [object:MAP.gpslongitude] [object:MAP.gpslatitude] [object:MAP.gpslongitude]"/>
     </action>  
   </actions>
</wire>
Can you email me your app id so I can take a look? 
It seems like your code is incomplete in this example. Your class has no params? 

Your lineout panel should look something like this :

<panel name="lineout-[param:dataSourceIndex]" alias="LINEOUT-[param:dataSourceIndex]" dsindex="[param:dataSourceIndex]" width="75%" height="3" xpos="20%" valign="center" background="#000000" alpha="0"></panel>
Interesting. Well as long as the LINEOUT panel is in the class and doesn't have a dynamic name, it will apply to every item in the list, so you would need to give it a name and an alias that coincides with the datasourceIndex. That way on swipe you can capture the item number and set only that item to alpha on. 

So you would be saying onswipe alpha on LINEOUT-2 (LINEOUT-[param:datasourceIndex]).