Re: [web2py] Re: Upload form

2013-11-03 Thread Martin Weissenboeck
Thank you fpr these details.


2013/11/3 Anthony abasta...@gmail.com

 The admin upload widget you see is actually handled via JS in layout.html:
 https://github.com/web2py/web2py/blob/master/applications/admin/views/layout.html#L80

 There is some associated CSS in bootstrap_essentials.css:
 https://github.com/web2py/web2py/blob/master/applications/admin/static/css/bootstrap_essentials.css#L285

 Anthony


 On Saturday, November 2, 2013 6:42:26 PM UTC-4, mweissen wrote:

 Sorry ... the screen shots are visible in my mail program.

 Again:

 form = SQLFORM.factory(Field('file', 'upload', uploadfield=False))
 shows like upload1.png


 If I want to upload a package in the admin app it looks like upload2.png



 2013/11/2 Niphlod nip...@gmail.com

  the images that **shuould** be attached to this post in the group
 aren't included can you show an example of what you're trying to
 achieve ?


 On Saturday, November 2, 2013 4:25:00 PM UTC+1, mweissen wrote:

 A question about the upload form (Version 2.7.4):

 A form like

  form = SQLFORM.factory(Field('file', 'upload', uploadfield=False))

 shows something like



 But in the admin application the widget for an upload filename looks
 like



 Nice - but how to get it?

 Regards, Martin

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google
 Groups web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to web2py+un...@googlegroups.com.

 For more options, visit https://groups.google.com/groups/opt_out.






  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] how do i return several rows from json using ajax?

2013-11-03 Thread Mihir Lade
hi,

i have a function in a controller which queries the database if the user is 
logged in and then grabs the information using json (as below)

def pruchaseHistoryJson():
if auth.user:
rows = db(db.sale.auth_id == auth.user.id
).select(db.sale.title,
 db.sale.price,
 db.sale.shipping_address,
 db.sale.shipping_state,
 db.sale.shipping_city,
 db.sale.shipping_zip_code)
else:
redirect(URL('default', 'user/login'))

import  gluon.contrib.simplejson as json
prodHistory = json.dumps([{'name': i.title,
   'prodValue':i.price,
   'shipAdd':i.shipping_address,
   'shipCity':i.shipping_city,
   'shipState':i.shipping_state,
   'shipCode':i.shipping_zip_code} for i in 
rows])
return prodHistory

i am now trying to figure out the $.ajax function so i can display this 
result in a view. below is the $.ajax function. i get an error using 
firebug stating, invalid request. What do i do to fix this?

script type=text/javascript
function testAjax()
{
$.ajax({
type: 'GET',
url:'127.0.0.1:8000/suzannecollins/onlineStore/pruchaseHistoryJson',
data:{prodName: rows.name, prodCost: rows.prodValue, prodAdd: 
rows.shipAdd, prodCity: rows.shipCity, prodState: rows.shipState, 
prodCode: rows.shipCode},
dataType: json,
timeout: 5000,
success: function(msg){
prodHistory = $.parseJSON(msg);
$(#shopProdHistory).html(prodHistory.prodName
+ +prodHistory.prodCost
+ +prodHistory.prodAdd
+ +prodHistory.prodCity
+ +prodHistory.prodState
+ +prodHistory.prodCode);}
});
}
/script

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: how do i return several rows from json using ajax?

2013-11-03 Thread Mihir Lade
I have made changes to the $.ajax which now gives me a different error but 
i think it's moving forward.. i have changed this line.. 
url:{{=URL('suzannecollinshttp://127.0.0.1:8000/suzannecollins/onlineStore/pruchaseHistoryJson',
 
'onlineStore', 'purchaseHistoryJson')}},

the error i encounter now is.. SyntaxError: JSON.parse: unexpected character

according to firebug, it's actually getting all the data and i can see that 
all the data is in response tab of the firebug debugger.. but not sure what 
the above error means.. 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] how do i return several rows from json using ajax?

2013-11-03 Thread Ricardo Pedroso
Try change the response content-type, see below:


On Sun, Nov 3, 2013 at 6:28 AM, Mihir Lade lade.mi...@gmail.com wrote:

 hi,

 i have a function in a controller which queries the database if the user
 is logged in and then grabs the information using json (as below)

 def pruchaseHistoryJson():
 if auth.user:
 rows = db(db.sale.auth_id == auth.user.id
 ).select(db.sale.title,
  db.sale.price,
  db.sale.shipping_address,
  db.sale.shipping_state,
  db.sale.shipping_city,
  db.sale.shipping_zip_code)
 else:
 redirect(URL('default', 'user/login'))



response.headers['Content-Type'] = 'application/json'




 import  gluon.contrib.simplejson as json
 prodHistory = json.dumps([{'name': i.title,
'prodValue':i.price,
'shipAdd':i.shipping_address,
'shipCity':i.shipping_city,
'shipState':i.shipping_state,
'shipCode':i.shipping_zip_code} for i in
 rows])
 return prodHistory


Also note that json top level arrays are not recommended:

  http://haacked.com/archive/2009/06/25/json-hijacking.aspx

http://security.stackexchange.com/questions/7001/how-should-web-app-developers-defend-against-json-hijacking

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] how show images from side sites?

2013-11-03 Thread Copper Lark
I save a image source url  in my db
and how I may show this image on my page?

{{ = XML('img src=%s' % 'https://some_url/image01.jpg') ) }}
this not work (

if I try ths url in browser - it showed

for example
https://money.yandex.ru/i/shop/mosenergosbut.gif

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Aplicação Estoque

2013-11-03 Thread Ovidio Marinho
http://www.stoq.com.br/ (feito em python gtk para desktop)
https://github.com/mdipierro/web2py-appliances/tree/master/PosOnlineStore(feito
em web2py)
http://custom.sourceforge.net/ ( Implementar em linux , roda com
debian+Mysql+python
https://www.openerp.com/ ( baixar e estudar o modulo estoque)

dica se vc quiser implementar isto no web2py estude a parte de estoque de
entrada e saidas e ai vc consegue, outra boa dica seria analisar as bases
de dados de um sistema de estoque.

http://www.las.pucpr.br/mcfmello/BD/BD-Aula02-MER.pdf
http://www.si.lopesgazzani.com.br/TFC/monografias/TRABALHO_FINAL_CURSO-final1.pdf

Mão na massa e boa sorte.






 Ovidio Marinho Falcao Neto
  ITJP.NET.BR
 ovidio...@gmail.com
 Brasil



2013/11/1 Hermano Ponce mangabeir...@gmail.com

 I do not know if I'm asking the right question, but I wonder if anyone has
 a model of an application type product inventory, where there are
 calculations in the fields of the table being shown in the view. who can
 send me. Thank you.

 Não sei se estou fazendo a pergunta correta, mas gostaria de saber se
 alguém tem um modelo de uma aplicação tipo estoque de produtos, onde haja
 cálculos nos campos da tabela sendo mostrada na view, que possa me enviar.
 Obrigado.

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] How to use response.flash() to inform user about current status of a process

2013-11-03 Thread Andreas Wienes
Hello,

I try to use response.flash() to inform my users whats happening on my 
website. Is there a way to quick update the displayed message?

Example:
User clicks on a button, response.flash() informs about the start of a 
process.
The user waits, response.flash() informs about several process steps and 
after the process has finished, the response.flash() informs about the 
result of the process.

Or is there a better way instead using response.flash()

Best regards
- Andreas

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Ticket issued: unknown after upgrade to 2.7.4 from 2.4.6 and running on GAE SDK

2013-11-03 Thread David Manns
I plan to start with a clean 2.7.4 distribution and re-integrate my 
application. Hopefully this will solve the problem.

On Thursday, October 31, 2013 4:52:42 PM UTC-4, David Manns wrote:

 Running standalone in the web2py dev environment, errors produce good 
 tickets.  However, when running in the GAE SDK, all I get is Ticket 
 issued: unknown. 

 I have done these things that I found in the users group:

  Attention all users: For pre 2.6 applications to work with web2py 
 =2.6, you must copy static/js/web2py.js, controllers/appadmin.py, and 
 views/appadmin.html from the welcome app to your own apps (all of them).

  Attention production users: The updated handlers and examples are in 
 handlers/ and examples/. The updated ones will not override the existing 
 ones. To use the new ones it is not sufficient to upgrade web2py, you also 
 need to copy the desired handler/example in the root web2py/ folder.
  Attention all users: For pre 2.6 applications to work with web2py 
 =2.6, you must copy static/js/web2py.js, controllers/appadmin.py, and 
 views/appadmin.html from the welcome app to your own apps (all of them).

  Attention production users: The updated handlers and examples are in 
 handlers/ and examples/. The updated ones will not override the existing 
 ones. To use the new ones it is not sufficient to upgrade web2py, you also 
 need to copy the desired handler/example in the root web2py/ folder.

 What else do I need to do?





-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] aplicação com calculo de campos

2013-11-03 Thread Diogo Munaro
Oi Hermano, tem alguns exemplos aqui de aplicações:
http://www.web2py.com/appliances

Veja o que mais se parece com o que deseja.

Abraços!


Em 2 de novembro de 2013 17:00, Ovidio Marinho ovidio...@gmail.comescreveu:

 Hermano boa tarde faz isso no python:

 a =0
 b =1
 c=2
 a=b+c

 e ve o resultado.




  Ovidio Marinho Falcao Neto
   ITJP.NET.BR
  ovidio...@gmail.com
  Brasil



 2013/11/2 Hermano Ponce mangabeir...@gmail.com

 Alguém pode disponibilizar uma app que tenha cálculos entre campos. por
 exemplo: campo A * campo B = campo C oucampo A + campo B = campo C.
 App tipo estoque de produtos.
 Quero somente um exemplo da aplicação.

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Downloading files from the disk using the path specfied in the db

2013-11-03 Thread Anthony
You can use response.stream (see 
http://web2py.com/books/default/chapter/29/04/the-core#response).

Anthony

On Saturday, November 2, 2013 11:33:44 PM UTC-4, Sarbjit wrote:

 I have a model which is having a field having the path of the file (could 
 be of big size) and is present outside the web2py folder. In the web2py 
 book, examples given for downloading files are specific to files uploaded 
 or in the static folder.

 Can some one please provide me an example of how to serve this?

 example of download controller :

 def download():
 dbid = request.args(0,cast=int)
 filePath= str(db(db.person.id==dbid).select()[0].DataPath)
 print filePath





-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: how show images from side sites?

2013-11-03 Thread Anthony


 {{ = XML('img src=%s' % 'https://some_url/image01.jpg') ) }}


The above code is fine, except there is an extra ) at the end. Another 
option is to use the IMG helper:

{{=IMG(_src='https://some_url/image01.jpg')}}

https://money.yandex.ru/i/shop/mosenergosbut.gif


If you are wondering why the above image in particular doesn't show up when 
you attempt to display it with an img tag, they are probably using some 
mechanism to prevent 
hotlinkinghttp://simple.wikipedia.org/wiki/Hotlinking(e.g., they check the 
HTTP_REFERER header and return a 302 not found error 
when external sites attempt to load the image). If you want to display the 
image (and doing so is not prohibited by copyright), you will have to 
download the image and serve it yourself.

Anthony 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] how do i return several rows from json using ajax?

2013-11-03 Thread Mihir Lade
still encounter the same error message..

SyntaxError: JSON.parse: unexpected character

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: How to use response.flash() to inform user about current status of a process

2013-11-03 Thread Niphlod
response.flash is used to set a fixed content into the layout.html
This happens to be a div class=flash/div in the scaffolding app.
That being said, you can't update the contents without refreshing the page, 
and / or using ajax. 
The implementation relies entirely on how your app works (i.e. how the page 
fetches the progress of the process steps).
web2py.js has a js function to update the contents of the flash message and 
to display it (because usually it's hidden).
try 
$.web2py.flash(message, status)

it will insert message into the flash and add status classes to the 
corresponding div.




On Sunday, November 3, 2013 1:37:26 PM UTC+1, Andreas Wienes wrote:

 Hello,

 I try to use response.flash() to inform my users whats happening on my 
 website. Is there a way to quick update the displayed message?

 Example:
 User clicks on a button, response.flash() informs about the start of a 
 process.
 The user waits, response.flash() informs about several process steps and 
 after the process has finished, the response.flash() informs about the 
 result of the process.

 Or is there a better way instead using response.flash()

 Best regards
 - Andreas


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] aplicação com calculo de campos

2013-11-03 Thread Hermano Ponce
Valeu Diogo. Já procurei por ali. Web2py é muito ágil e bom pra algumas
coisas mas tem suas limitações. Estou a procura de App tipo estoque de
produtos. Mesmo valeu e estamos aí.
Em 03/11/2013 10:37, Diogo Munaro diogo.mvie...@gmail.com escreveu:

 Oi Hermano, tem alguns exemplos aqui de aplicações:
 http://www.web2py.com/appliances

 Veja o que mais se parece com o que deseja.

 Abraços!


 Em 2 de novembro de 2013 17:00, Ovidio Marinho ovidio...@gmail.comescreveu:

 Hermano boa tarde faz isso no python:

 a =0
 b =1
 c=2
 a=b+c

 e ve o resultado.




  Ovidio Marinho Falcao Neto
   ITJP.NET.BR
  ovidio...@gmail.com
  Brasil



 2013/11/2 Hermano Ponce mangabeir...@gmail.com

 Alguém pode disponibilizar uma app que tenha cálculos entre campos. por
 exemplo: campo A * campo B = campo C oucampo A + campo B = campo C.
 App tipo estoque de produtos.
 Quero somente um exemplo da aplicação.

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google
 Groups web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/_w0TDXKusaY/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Documentation of the date time picker from dynarch, version 1.0

2013-11-03 Thread Martin Weissenboeck
datetime uses the Dynarch date Time Picker version 1.0
But the website www.dynarch.com/projects/calendar is down - does anybody
know where to find the documenation for version 1.0?

I want to translate the names of the months,...

Regards Martin

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Access to server variables from within javascript

2013-11-03 Thread david.waldrop
How can I access the web2py object passed to the view with Javascript.

For example, I am trying to use jquery to retrieve some additional data for 
the current record being edited.  
When i try and invoke the jquery call passing the id of the edited record, 
i.e. results.update_form.custom.dspval.id I am unable to reference it in 
javascript, but can using the templaye language (i.e. {{print 
results.update_form.custom.dspval.id}}.

Here is the jquery call:

  $().ready(function(){
  console.log('--- all is loaded  ' + Date());
  console.log('+++');
  if (results.update_form.custom.dspval.id != null){

jQuery.getJSON({{=URL(get_days,args=[results.update_form.custom.dspval.id])}},
function(msg){
console.log('got some data')
console.log(msg);
})
  }




I am useing firebug and tried to inspect the dom to find but am unable to 
do so.
Any help would be appreciated as I bang my head against the wall trying to 
figure out this front end development. 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Access to server variables from within javascript

2013-11-03 Thread Niphlod
It's kind of the foundation of any template language to have some sort of 
delimiter to import variables and such : anything you need to use in the 
view coming from something that was on the controller MUST be called with 
{{=something}}. 

On Sunday, November 3, 2013 8:10:19 PM UTC+1, david.waldrop wrote:

 How can I access the web2py object passed to the view with Javascript.

 For example, I am trying to use jquery to retrieve some additional data 
 for the current record being edited.  
 When i try and invoke the jquery call passing the id of the edited record, 
 i.e. results.update_form.custom.dspval.id I am unable to reference it in 
 javascript, but can using the templaye language (i.e. {{print 
 results.update_form.custom.dspval.id}}.

 Here is the jquery call:

   $().ready(function(){
   console.log('--- all is loaded  ' + Date());
   console.log('+++');
   if (results.update_form.custom.dspval.id != null){
 jQuery.getJSON({{=URL(get_days,args=[
 results.update_form.custom.dspval.id])}},
 function(msg){
 console.log('got some data')
 console.log(msg);
 })
   }




 I am useing firebug and tried to inspect the dom to find but am unable to 
 do so.
 Any help would be appreciated as I bang my head against the wall trying to 
 figure out this front end development. 


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Access to server variables from within javascript

2013-11-03 Thread david.waldrop
Niphlod thanks for the quick reply.

I was heading down that path.  

I added the following in the viewcode

{{res=results}}

with the hopes of being able to reference res form javascript.  But have 
not figured it out just yet.  Is this the common way to get access to the 
server/template info form within javascript?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Anchor callback option and form submit

2013-11-03 Thread Riccardo C
Good evening,

I've just discovered the possibility to use in the view of the callback 
option when we want to create a link, e.g. {{=A('mypage', 
callback(URL='myfunction'), target='myID'). I found it really useful for 
not loading a new page again. The problem is that the callback calls a 
function that return a simple form that is correctly shown inside that div 
but when i press the 'submit' button... the page refresh, but nothing 
happen on the db. Basically nothing is register.

What am I doing wrong? I am not really interested in fixing this specific 
problem rather to understand how it works and what I didn't get.

Regards,

Riccardo

P.S. I attach the code if it might help:
def addPet():
db.pet.owner_id.readable = False
db.pet.owner_id.writable = False
db.pet.owner_id.default = auth.user.id
form = crud.create(db.pet, onaccept=lambda form: testAnotherFunction(
form.vars.id), next=URL('welcome'), message='The pet has been added')
return dict(form = form)

IN THE VIEW WELCOME.HTML
...
li{{=A('Add a Pet', callback=URL('addPet'), target=MainContent )}} /li
...
div id=MainContent
Replace the content
/div 


ADDAPET.HTML
div class=row
div  class=span5 offset1id=addPetForm 
{{=form}}
/div
/div



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Access to server variables from within javascript

2013-11-03 Thread Anthony
You can use the web2py template syntax within your JS code, just as within 
HTML:

if ({{=results.update_form.custom.dspval.id}} != null){

Above we have the web2py template delimiters, {{...}}, within the JS code.

Anthony

On Sunday, November 3, 2013 2:45:26 PM UTC-5, david.waldrop wrote:

 Niphlod thanks for the quick reply.

 I was heading down that path.  

 I added the following in the viewcode

 {{res=results}}

 with the hopes of being able to reference res form javascript.  But have 
 not figured it out just yet.  Is this the common way to get access to the 
 server/template info form within javascript?


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Anchor callback option and form submit

2013-11-03 Thread Niphlod
the callback argument is not meant to load a fragment and keep it like a 
component (meaning, trapping all links, form submissions, redirections etc. 
in that fragment).
callback was meant instead to either click on a button and show the result 
in a fragment (i.e. action completed) and/or click a button to remove an 
element from the page (i.e. remove a line from a table).

For a component-like behaviour, please use
A('mypage', _href=URL('myfunction'), cid='myID')
or the equivalent
A('mypage', _href=URL('myfunction'), target='myID')

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Documentation of the date time picker from dynarch, version 1.0

2013-11-03 Thread Martin Weissenboeck
Thank you - this will help!
By the way: is there any full description for this program?



2013/11/3 Paolo Caruccio paolo.carucci...@gmail.com

 In order to translate the text in the calendar you could adapt the
 attached calendar-en.js.As an example you will find here also attached
 calendar-it.js (italian translation)
 Put the translation file in application/static/js folder.
 In layout.html after (I would suggest just before /body tag)

 {{include 'web2py_ajax.html'}}

 write

 script src={{=URL('static','js/calendar-it.js')}}/script

 of course you have to replace calendar-it.js with the name of your
 translation file.

 If you would like apply the translation file according to browser language
 you could write in layout.html :

 {{calang = T.accepted_language or 'en'
 response.files.append(URL('static','js/calendar-%s.js' % calang))
 }}

 just before

 {{include 'web2py_ajax.html'}}

 In this case if the translation file doesn't exist then will be applied
 the english translation.
 Anyway, calendar-en.js is not necessary because calendar.js contains
 already the english terms.



 Il giorno domenica 3 novembre 2013 20:02:39 UTC+1, mweissen ha scritto:

 datetime uses the Dynarch date Time Picker version 1.0
 But the website www.dynarch.com/projects/calendar is down - does anybody
 know where to find the documenation for version 1.0?

 I want to translate the names of the months,...

 Regards Martin

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Prevent user from modifying a form field that already has a default value

2013-11-03 Thread Massimo Di Pierro
student = db.student(row.id)
db.student.admission_number.readable = False
form = SQLFORM(db.student, student, readonly=True)


On Saturday, 2 November 2013 21:43:07 UTC-5, Rupesh Pradhan wrote:

 Model
 db.define_table('student',
 Field('admission_number', 'integer', notnull=True, unique=True),
 Field('name', 'string', length=255, notnull=True))

 Controller
 student = db.student(row.id)
 form = SQLFORM(db.student, student, readonly=True)


 All the three fields of the table show up when I display the form. What do 
 I have to do to make just the 'name' field show up?



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: view says that a variable defined in controller does not exist

2013-11-03 Thread Massimo Di Pierro
def add_student_to_session():
form = SQLFORM.factory(Field('admission_number', requires=IS_NOT_EMPTY
())).process()
if form.accepted:
student = None
student_details = None
admission_number = form.vars.admission_number
row = db.student(db.student.admission_number==admission_number)
if not row:
session.flash ='Admission number does not exist. Please check 
and retry.'
redirect(URL(r=request, f='add_student_to_session'))
else:
db.school_session.admission_number.writable = False
db.school_session.admission_number.default = admission_number
form = crud.create(db.school_session)
student = db.student(row.id)
student_details = SQLFORM(db.student, student, readonly=True)



On Saturday, 2 November 2013 21:44:30 UTC-5, Rupesh Pradhan wrote:

 Please give a suggestion too.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Anchor callback option and form submit

2013-11-03 Thread Anthony


 A('mypage', _href=URL('myfunction'), target='myID')


Shouldn't above be:

A('mypage', component=URL('myfunction'), target='myID')


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] upgraded to 2.7.4 no admin ui

2013-11-03 Thread Lewis
Upgraded to 2.7.4 (from 2.5.3 I think...) two different ways:

1) used the upgrade in place feature (yes, experimental but it has worked 
several times before--thank you for that!).  The apps ran but I could not 
get into admin.  I could do some of appadmin--database views, but design 
would not work.  Later, appadmin also stopped working.
   NEWINSTALL was never replaced.
   The error is not very informative:
Internal errorTicket issued: 
admin/98.247.169.56.2013-11-04.06-14-45.aaa6fb9b-c14e-443e-afc4-cf32bef55e3bhttps://www.lewcl.com/admin/default/ticket/admin/98.247.169.56.2013-11-04.06-14-45.aaa6fb9b-c14e-443e-afc4-cf32bef55e3b
Clicking on the ticket just generates another ticket (of course, because 
the tickets are shown in the admin interface...).

2. I upgraded a second time by creating a clean web2py install from sources 
and then copied over key files and directories from the old version (now, 
unfortunately altered by the upgrade in place):
  2 of my applications--entire directories
  routes.py
  parameters_443.py
  scgihandler.py   (wonder if I got an old version of this file--would 
it matter?)
  __init__.py (it's empty--really just need the file name there for 
python to load web2py)
 There is no wsgihandler.pyc file in the web2py directory for this 
version, suggesting it's never been run--I thought that wsgihandler.py is 
what uwsgi uses to start the python process...

This second approach doesn't work at all.  Obtain the dreaded:

uWSGI ErrorPython application not found

I never touched the nginx or uwsgi configs.  I have really totally 
forgotten how.  I hope I never have to do it again.  It's just such a mess 
of inter-related config files in different syntaxes scattered all over the 
file system.

The way I switch back and forth between the 2 configs of web2py is by 
renaming the web2py directory.  I stop nginx and uwsgi.  Then start uwsgi 
and nginx (in that order).  It's hard to say that the directory renaming 
hack causes the problem.  The upgrade-in-place version always runs (after 
the stop and start); but the 2nd config never runs.  It seems like a 
crucial file is missing from default file structure of 2.7.4--which is 
there when upgrading in place, but not with a clean install.  I just 
can't figure out what the critical file is. 

---
As usual, I am stumped by config.  I wish someone would write a python, not 
bash, script that fully installed web2py and all of its dependencies in the 
optimal way.  There are a lot of variations that don't seem to produce 
benefits.  Really important functional differences (as opposed to style 
such as whether configuring uwsgi with ini, xml, or other files) could be 
part of a SMALL list of parameters.


Happy to provide any samples of config files if you can point me to where 
they are.

- Lewis


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: upgraded to 2.7.4 no admin ui

2013-11-03 Thread Lewis

Found the reference to the 2.61 changes.  I copied appadmin from welcome to 
my two applications, likewise web2py.js (into static/js).  I copied 
wsgihandler.py from the handlers directory.

This did not fix anything.  And really didn't do anything as I started from 
a fresh install from sources.

No, there is something that the uwsgi config just doesn't track--something 
is missing from the new web2py file structure that must be hardcoded in the 
classic uwsgi config.

There are so many approaches to configuring uwsgi that can be used 
concurrently, which are scattered into multiple locations, that I cannot 
tell what actually governs what happens.  This is the web2py.xml file but I 
have no idea if this is really doing anything:
uwsgi
pluginpython/plugin
socket/run/uwsgi/app/web2py/web2py.socket/socket
pythonpath/var/web2py//pythonpath
app mountpoint=/
scriptwsgihandler/script
/app
master/
processes4/processes
harakiri60/harakiri
reload-mercy8/reload-mercy
cpu-affinity1/cpu-affinity
stats/tmp/stats.socket/stats
max-requests2000/max-requests
limit-as512/limit-as
reload-on-as256/reload-on-as
reload-on-rss192/reload-on-rss
no-orphans/
vacuum/
/uwsgi


This might be the governing nginx config for the web2py server:

server {
listen  80;
server_name $hostname;
location ~* /(\w+)/static/ {
   root /var/web2py/applications/;
}
 location / {
#uwsgi_pass  127.0.0.1:9001;
uwsgi_pass  unix:///run/uwsgi/app/web2py/web2py.socket;
include uwsgi_params;
uwsgi_param UWSGI_SCHEME $scheme;
uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
}
}

server {
listen  443;
server_name $hostname;
ssl on;
ssl_certificate /etc/nginx/ssl/web2py.crt;
ssl_certificate_key /etc/nginx/ssl/web2py.key;
location / {
#uwsgi_pass  127.0.0.1:9001;
uwsgi_pass  unix:///run/uwsgi/app/web2py/web2py.socket;
include uwsgi_params;
uwsgi_param UWSGI_SCHEME $scheme;
uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
}

}

I am still stumped.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Anchor callback option and form submit

2013-11-03 Thread Riccardo Ceccarelli
Thank you very much, I'll try it later.

On Monday, November 4, 2013, Anthony wrote:


 A('mypage', _href=URL('myfunction'), target='myID')


 Shouldn't above be:

 A('mypage', component=URL('myfunction'), target='myID')


  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/A1_6kz-SBg0/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com javascript:_e({}, 'cvml',
 'web2py%2bunsubscr...@googlegroups.com');.
 For more options, visit https://groups.google.com/groups/opt_out.



-- 
Riccardo Ceccarelli

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Add custom class to...

2013-11-03 Thread lyn2py
I am using SQLFORM.grid and I need to wrap a big chunk of text (one of the 
data elements) in a CSS class called big-chunk.

I remember it wasn't hard to add a CSS class to a dal field, but I can't 
seem to find the solution.

I tried this method:

db.define_table('table', 
Field('combitext', 'text', represent=lambda x,row: XML(div 
class=big-chunk+x+/div) ),
),

This works great except, when displaying the full grid, the text-heavy 
field would be output in a whole big chunk. Appadmin also displays the 
whole text when in table format.

I tried to limit the number of characters using maxtextlengths in 
SQLFORM.grid but it isn't working either (whole chunk of text appears). I 
know that from this experience it proves that db.table.field.represent will 
ensure that it will appear the way you want it to, but I only need it to 
appear like that when I click on VIEW on the grid.

Note: I need to wrap the value of the text output (in view mode) in a 
class, I do *not* need to add a class to a form field. thanks

I appreciate any help.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.