A Rev Web Project and On-Rev working together?

John Patten johnpatten at mac.com
Wed Dec 16 22:23:03 EST 2009


Thanks Sarah and Bj?rnke!

I had a funny feeling about the ":" colon after URL....however, I could of swore I lifted that script from one of the examples, and it had a colon in there...  In any case I removed it and it worked fine :-)

Bj?rnke, as for copying the sentence to the clipboard, is there a technical reason why this is a bad idea, it's not being written to the harddrive? Is it because the user might have been saving something else on the clipboard and that action replaces what they had previously saved?

I was using the copy to clipboard as a kind of cheat. 

I'm going to embed the rev project into Drupal web page.  Originally, I was hoping to figure out how to have the Rev app automatically post an anonymous comment to the Drupal page (the little rev app was embedded in.) But not sure how I actually would do it. Ultimately I was looking for a way the user would be able to share a sentence that they create by dragging a few words from some song lyrics.... I know it sounds a little lame, but I was just going to use it as example for some teachers as to what these tools can do all together. I was hoping to have the Rev project duplicate the process of the Drupal comment action, using the Rev interface instead of the Drupal interface...but still having the user's work show up in the comments section.

As an alternative I may just load a new Drupal Module that pulls a static html file, ...one like Rev creates in my example here. That might work to if I move a way from having the user just past their comment off the clipboard.

Thank you!

John Patten

On Dec 16, 2009, at 4:33 PM, use-revolution-request at lists.runrev.com wrote:

> 
> ------------------------------
> 
> Message: 23
> Date: Thu, 17 Dec 2009 07:45:04 +1000
> From: Sarah Reichelt <sarah.reichelt at gmail.com>
> Subject: Re: A Rev Web Project and On-Rev working together?
> To: How to use Revolution <use-revolution at lists.runrev.com>
> Message-ID:
> 	<f99b52860912161345g6d107850m7f157d17160f0dce at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
> 
>> I have a little rev project that I will eventually turn into  a
>> webRevProject. I would like to have this little webRevProject project store
>> a line of text into an on-rev text file. I'm not quite getting it right...
>> 
>> Here are the three parts that I have:
>> 
>> 1. Rev Projects  Script
>> 
>> put theSentence & "  -created in " & totalTime & " seconds" into theSentence
>>   set the clipboardData["text"] to theSentence
>>   put "sentence" & "=" & urlEncode(theSentence) into tMyPostData
>>   post tMyPostData to URL "http://jpatten.on-rev.com/xmas/saveSentence.irev"
>> 
>> 2. SaveSentence.irev
>> 
>> <html>
>> <?rev
>> put $_POST["sentence"] & return after URL: "file:sentence.txt"
>> ?>
>> </html>
>> 
>> 3. sentence.txt  (a blank text file waiting to be written to)
> 
> 
> Basically, this should work fine, but there are a couple of things
> which may be typos in your email, or may be causing problems.
> 
> In Step 1, you post to saveSentence.irev, but in step 2, you say the
> irev file is called SaveSentence.irev. Servers are usually
> case-sensitive, so you need to make these 2 consistent.
> 
> In step 2, you have:
>    ....  URL: "file:sentence.txt"
> but the colon after URL is not correct.
> 
> 
> For testing purposes, check "it" and "the result" after the "post"
> command to see if there is any error or returned value.
> 
> In your irev file, have it write a log file showing all the $_POST
> variables to check what is arriving.
> 
> HTH,
> Sarah
> 
> 
> ------------------------------
> 
> Message: 24
> Date: Wed, 16 Dec 2009 22:45:14 +0100
> From: Bj?rnke von Gierke <bvg at mac.com>
> Subject: Re: A Rev Web Project and On-Rev working together?
> To: How to use Revolution <use-revolution at lists.runrev.com>
> Message-ID: <55466469-D402-4CFC-A032-DEF7DCE2B942 at mac.com>
> Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes
> 
> A http server (like on-rev) needs to always return something. making  
> that something (as in your case) be "<html></html>" seems to be rather  
> unusual and nondescript, but should work. still you might want to  
> check "the result" in your rev stack, to make sure the script on the  
> server actually works as expected.
> 
> Also, you're missing validation and security. anyone can write  
> anything into your text file, if he or she wants to, and sooner or  
> later they will. If there are a lot of users  (hundrets per second),  
> you might also run into the problem of some text not being stored in  
> the file, because another user overwrites the first change (competing  
> file access).
> 
> Note that there's script errors in your supplied example, so i guess  
> you're missing those too. For example "URL:" in the irev file should  
> of course be "URL", and probably i'm missing some too :)
> 
> A file created by you might not be accessible to the process the web  
> server runs at (unix user handling and file access restrictions). But  
> this is more a "what if everything else is correct and it still fails  
> unexpectedly" scenario.
> 
> If things don't work, try to return stuff. for example putting the  
> data into the text field might fail, and then "the result" would  
> contain useful information so you might want to return that:
> put the result
> 
> i think that setting the clipboard, without the user demanding it, is  
> evil, and should never be done (ever).
> 
> On 16 Dec 2009, at 22:06, John Patten wrote:
> 
>> 
> 
> End of use-revolution Digest, Vol 75, Issue 34
> **********************************************




More information about the use-livecode mailing list