Julian Tree | 1 Feb 07:24
Picon

access session.user's parent

I'm doing this a bit unusual thing.  Here are the hierarchy of the tables

company  (parent of )-> user
company  (parent of )-> jobs

When users are logged in they are able to see all jobs that belongs
the company they belong to. The user can also edit their parent
company's information.

After login, I have a session.user obj indicating the current logged
user.  Now, I know how to access the jobs from session.user, but I
don't know how to access the company object from user.

How can I access the company of session.user?

I tried session.user._parent. It didn't work.  Anyone has any
suggestion, I would greatly appricated.

Tree
Michael Platzer | 1 Feb 11:28
Picon

Re: access session.user's parent

if you provide your type.properties it would help solving your problem.

but from what you write, i think you simply need a object-reference 
pointing from the user to the company
user/type.properties
  company = object(Company)
  company.local = user_f_company
  company.foreign = company_id

and then you should be able to access the company via
  session.user.company

hth
  michi

Julian Tree schrieb:

>I'm doing this a bit unusual thing.  Here are the hierarchy of the tables
>
>company  (parent of )-> user
>company  (parent of )-> jobs
>
>When users are logged in they are able to see all jobs that belongs
>the company they belong to. The user can also edit their parent
>company's information.
>
>After login, I have a session.user obj indicating the current logged
>user.  Now, I know how to access the jobs from session.user, but I
>don't know how to access the company object from user.
>
(Continue reading)

Julian Tree | 1 Feb 17:29
Picon

Re: access session.user's parent

That is what I tried first, but it didn't work. Here are my type files

User/type.properties
_db                 = filepressdb
_table              = USERLOGIN
_id                 = USERLOGIN_ID
_name               = USERLOGIN_ID
company_id          = COMPANY_ID
userlogin_id        = USERLOGIN_ID
password            = PASSWORD
email               = EMAIL

agency               = object(Company)
agency.local         = COMPANY_ID
agency.foreign       = COMPANY_ID

Company/type.properties
_db         = filepressdb
_table      = COMPANY
_id         = COMPANY_ID
creator         = CREATOR
modifier        = MODIFIER
company_id      = COMPANY_ID
contactname     = CONTACT_NAME
companyname     = COMPANY_NAME

I'm calling my company agency.

res.debug(uneval(session.user)); // output the correct user

(Continue reading)

Julian Tree | 1 Feb 17:51
Picon

Re: access session.user's parent

Ah I just answered my own question.  Appearently,  you have to name
the foreign and local has to refer to column with different names.

I created another  column in User, user_company_id
and changed the User/type.properties to

agency               = object(Company)
agency.local         = USER_COMPANY_ID
agency.foreign       = COMPANY_ID

And now it is seems to be working.

However that doesn't solve my problem.  I've already named all my
foreign and primary key to be the same name in the database. Is there
a workaround in hemla to allow me to do the following?

agency               = object(Company)
agency.local         = COMPANY_ID  // with this refering to company_id
in user table
agency.foreign       = COMPANY_ID // with this refering to company_id
in the company table

Tree

P.S. Naming the foreign and local key with the same name allows me to
use the "USING" keyword when I'm doing complex quries in Postgresql.
So it would be nice that i don't have rename all my keys in my
database.

On 2/1/06, Julian Tree <julian.tree <at> gmail.com> wrote:
(Continue reading)

Julian Tree | 1 Feb 18:32
Picon

find absolute file path of the current app

is there a way to find the full path to the current app

forexample if  myapp is in

/usr/local/hemla/apps/myapp

is that value stored any where ?
Julian Tree | 1 Feb 20:47
Picon

res.forward() not working

I get this error when I try to use res.forward, in helma 1.5_xx

Below are my configuration? is it a bug or am I not using it correctly?

Error in application filepress
The server encountered an error while processing your request. Please
check back later.

apps.properties
filepress.protectedStatic = apps/filepress/protected

Root/test.hac
res.forward('/usr/local/helma/apps/filepress/protected/nothere');

protected/nothere
hello
Michael Platzer | 1 Feb 22:26
Picon

Re: find absolute file path of the current app

app.dir

   michi

Julian Tree schrieb:

>is there a way to find the full path to the current app
>
>forexample if  myapp is in
>
>/usr/local/hemla/apps/myapp
>
>is that value stored any where ?
>_______________________________________________
>Helma-user mailing list
>Helma-user <at> helma.org
>http://helma.org/mailman/listinfo/helma-user
>
>  
>
Michael Platzer | 1 Feb 22:30
Picon

Re: res.forward() not working


you have to specify the location of the file relative to the 
protectedStaticDir.
i.e. just try
  res.forward("nothere");

   michi

Julian Tree schrieb:

>I get this error when I try to use res.forward, in helma 1.5_xx
>
>Below are my configuration? is it a bug or am I not using it correctly?
>
>
>Error in application filepress
>The server encountered an error while processing your request. Please
>check back later.
>
>apps.properties
>filepress.protectedStatic = apps/filepress/protected
>
>
>Root/test.hac
>res.forward('/usr/local/helma/apps/filepress/protected/nothere');
>
>protected/nothere
>hello
>_______________________________________________
>Helma-user mailing list
(Continue reading)

Hannes Wallnoefer | 2 Feb 15:40
Picon
Gravatar

Re: xml-rpc encode and decode to javascript object

Hi Julian,

there's no functionality for this provided by Helma, but you can do
this using the XML-RPC library directly. It may not be trivial if
you're not fluent in Java, but you may have a look at the
XmlRpcResponseProcessor.encodeResponse() and
XmlRpcRequestProcessor.encodeRequest() methods:

http://ws.apache.org/xmlrpc/apidocs/org/apache/xmlrpc/XmlRpcResponseProcessor.html#encodeResponse(java.lang.Object,%20java.lang.String)
http://ws.apache.org/xmlrpc/apidocs/org/apache/xmlrpc/XmlRpcClientRequestProcessor.html#encodeRequest(org.apache.xmlrpc.XmlRpcClientRequest,%20java.lang.String,%20java.io.OutputStream)

hannes

2006/1/27, Julian Tree <julian.tree <at> gmail.com>:
> Is there a function to encode and decode XML-RPC document to a
> javascrip to object?   I know in php there is something called
> xmlrpc_enocde('method_name', $php_array) => and it turn it into a
> XMLRPC document.  And xmlrpc_decode($xmlrpc_document); returns a php
> data struct representation of the the xmlrpc document.
> _______________________________________________
> Helma-user mailing list
> Helma-user <at> helma.org
> http://helma.org/mailman/listinfo/helma-user
>
Julian Tree | 2 Feb 17:20
Picon

Re: xml-rpc encode and decode to javascript object

Thanks Hanns. I took a look.  I haven't fully grasp the concet of
scripting java.  The XmlRpcClientRequestProcessor,  expect a Java Obj.
 How would I script that in Javascript. I'll play around with it, and
let you guys know if it works.

In the meantime I did discover a js implementation of XMLRPC

http://jsolait.net/doc/xmlrpc.xhtml

I think unmarshall(xml) is maybe what I need.  I'll let you guys know
if that works.

Tree

On 2/2/06, Hannes Wallnoefer <hannesw <at> gmail.com> wrote:
> Hi Julian,
>
> there's no functionality for this provided by Helma, but you can do
> this using the XML-RPC library directly. It may not be trivial if
> you're not fluent in Java, but you may have a look at the
> XmlRpcResponseProcessor.encodeResponse() and
> XmlRpcRequestProcessor.encodeRequest() methods:
>
> http://ws.apache.org/xmlrpc/apidocs/org/apache/xmlrpc/XmlRpcResponseProcessor.html#encodeResponse(java.lang.Object,%20java.lang.String)
> http://ws.apache.org/xmlrpc/apidocs/org/apache/xmlrpc/XmlRpcClientRequestProcessor.html#encodeRequest(org.apache.xmlrpc.XmlRpcClientRequest,%20java.lang.String,%20java.io.OutputStream)
>
> hannes
>
> 2006/1/27, Julian Tree <julian.tree <at> gmail.com>:
> > Is there a function to encode and decode XML-RPC document to a
(Continue reading)


Gmane