Re: [Freeipa-devel] [PATCH] 106 I18n update.

2011-02-21 Thread Adam Young

On 02/18/2011 11:48 PM, Endi Sukma Dewata wrote:

On 2/18/2011 10:35 PM, Adam Young wrote:

Hard-coded messages through out the code have been replaced by i18n
messages obtained from json_metadata and i18n_messages.

https://fedorahosted.org/freeipa/ticket/899


Needs rebase, due to mkosek's big patch.


Attached is an updated version. I had to change IPA.cert into an 
entity

because it has to be initialized after IPA.init() finishes loading the
metadata  messages.

We might want to introduce a concept of plugin for Web UI (similar to
plugin for ipalib). The first step is to rename IPA.entity_factories
into IPA.plugins, but most of the work will be splitting the 
IPA.entity

into plugin and real entity.

Patch #107 can be used without rebase.


Attached is a new version using the plugin framework. Please see
certificate.js.


Every function is an Object. There is no reason to create an object, and
then have an init method on it.


I haven't got a chance to provide a long explanation for this, but 
please try to apply all patches that I've submitted (until 109) and 
see the user.js, group.js and certificate.js. I think they are clearly 
structured and easy to understand.


Try to think plugins as modules, and init() as start() or 
main(), or some other terms. Once all entity files are converted to 
use this framework, it maybe possible to remove init() from 
entity/facet/widget. The init() is not an unnecessary duplication of 
constructor, but it's a callback to indicate that the messages are 
loaded.




OK, just completed a more in depth review.  I stand by my origianl 
call.  I don't want to make a change like this in the 2.0 timeframe.  
When we do make the change, it will incorporate some of these ideas, but 
we are not going to use the deliberate init() call.



For now, just make the  libraries for cert etc as lazy load accessors 
like I recommended earlier.  It should be a pretty short addition to 
Patch 106-2.  Hold on to the changes from patches 106-3 on and we will 
design a more complete refactoring target for the 2.1 release.






___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] [PATCH] 106 I18n update.

2011-02-21 Thread Adam Young

On 02/21/2011 11:05 AM, Endi Sukma Dewata wrote:

On 2/21/2011 9:25 AM, Adam Young wrote:

I haven't got a chance to provide a long explanation for this, but
please try to apply all patches that I've submitted (until 109) and
see the user.js, group.js and certificate.js. I think they are clearly
structured and easy to understand.

Try to think plugins as modules, and init() as start() or
main(), or some other terms. Once all entity files are converted to
use this framework, it maybe possible to remove init() from
entity/facet/widget. The init() is not an unnecessary duplication of
constructor, but it's a callback to indicate that the messages are
loaded.


OK, just completed a more in depth review. I stand by my origianl call.
I don't want to make a change like this in the 2.0 timeframe. When we do
make the change, it will incorporate some of these ideas, but we are not
going to use the deliberate init() call.

For now, just make the libraries for cert etc as lazy load accessors
like I recommended earlier. It should be a pretty short addition to
Patch 106-2. Hold on to the changes from patches 106-3 on and we will
design a more complete refactoring target for the 2.1 release.


Attached is an updated patch with the IPA.plugin framework removed. 
For now I'm just using the same method used for IPA.sudo, using a 
plain hash table. The IPA.cert.CRL_REASON for now is hard-coded. Let's 
get this patch and 107 in first because they really should go together 
with patch 105 which is already pushed. Please submit your registry 
code as a separate patch, it shouldn't be combined with these i18n 
fixes. Thanks!




I'm not ready to submit the Registry code either.  I promise you that it 
will get the same scruitny from you and the team as any other design 
decision.  I'll test 106-4 and 107 together.



___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] [PATCH] 106 I18n update.

2011-02-21 Thread Adam Young

On 02/21/2011 11:05 AM, Endi Sukma Dewata wrote:

On 2/21/2011 9:25 AM, Adam Young wrote:

I haven't got a chance to provide a long explanation for this, but
please try to apply all patches that I've submitted (until 109) and
see the user.js, group.js and certificate.js. I think they are clearly
structured and easy to understand.

Try to think plugins as modules, and init() as start() or
main(), or some other terms. Once all entity files are converted to
use this framework, it maybe possible to remove init() from
entity/facet/widget. The init() is not an unnecessary duplication of
constructor, but it's a callback to indicate that the messages are
loaded.


OK, just completed a more in depth review. I stand by my origianl call.
I don't want to make a change like this in the 2.0 timeframe. When we do
make the change, it will incorporate some of these ideas, but we are not
going to use the deliberate init() call.

For now, just make the libraries for cert etc as lazy load accessors
like I recommended earlier. It should be a pretty short addition to
Patch 106-2. Hold on to the changes from patches 106-3 on and we will
design a more complete refactoring target for the 2.1 release.


Attached is an updated patch with the IPA.plugin framework removed. 
For now I'm just using the same method used for IPA.sudo, using a 
plain hash table. The IPA.cert.CRL_REASON for now is hard-coded. Let's 
get this patch and 107 in first because they really should go together 
with patch 105 which is already pushed. Please submit your registry 
code as a separate patch, it shouldn't be combined with these i18n 
fixes. Thanks!



ACK and pushed to master.

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] [PATCH] 106 I18n update.

2011-02-19 Thread Adam Young
Here's what I was alluding to in the prior email and in chat.  I wrote 
and tested it in Rhino, but it is standard javascript.



#!/usr/bin/rhino


var Registry = {

factories : {},
instances : {},

register:  function(name,factory){

this.factories[name] = factory;

this.__defineGetter__(name, function() {

if (!this.instances[name]){
this.instances[name] = this.factories[name]();
}

return this.instances[name];
});

}

}


Registry.register(testobj,function(){
return String;
});

print (Hello World);

print (Registry.testobj);___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Re: [Freeipa-devel] [PATCH] 106 I18n update.

2011-02-19 Thread Adam Young

Here's a better version, show the chaining of dependencies.
#!/usr/bin/rhino


var Registry = {

factories : {},
instances : {},

register:  function(name,factory){

this.factories[name] = factory;

this.__defineGetter__(name, function() {

if (!this.instances[name]){
this.instances[name] = this.factories[name]();
}

return this.instances[name];
});
}
}

Registry.register(teststring,function(){
return Injected;
});

Registry.register(testobj,function(){
var that = {};
that.string = Registry.teststring;
that.execute = function(){
print(that.string);
}
return that;
});

Registry.testobj.execute();

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Re: [Freeipa-devel] [PATCH] 106 I18n update.

2011-02-18 Thread Adam Young

On 02/18/2011 03:14 AM, Endi Sukma Dewata wrote:

Hard-coded messages through out the code have been replaced by i18n
messages obtained from json_metadata and i18n_messages.

https://fedorahosted.org/freeipa/ticket/899


___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Needs rebase, due to mkosek's big patch.
___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Re: [Freeipa-devel] [PATCH] 106 I18n update.

2011-02-18 Thread Adam Young

On 02/18/2011 05:12 PM, Endi Sukma Dewata wrote:

On 2/18/2011 1:08 PM, Endi Sukma Dewata wrote:

Hard-coded messages through out the code have been replaced by i18n
messages obtained from json_metadata and i18n_messages.

https://fedorahosted.org/freeipa/ticket/899


Needs rebase, due to mkosek's big patch.


Attached is an updated version. I had to change IPA.cert into an entity
because it has to be initialized after IPA.init() finishes loading the
metadata  messages.

We might want to introduce a concept of plugin for Web UI (similar to
plugin for ipalib). The first step is to rename IPA.entity_factories
into IPA.plugins, but most of the work will be splitting the IPA.entity
into plugin and real entity.

Patch #107 can be used without rebase.


Attached is a new version using the plugin framework. Please see 
certificate.js.





Every function is an Object.  There is no reason to create an object, 
and then have an init method on it.





___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] [PATCH] 106 I18n update.

2011-02-18 Thread Endi Sukma Dewata

On 2/18/2011 10:35 PM, Adam Young wrote:

Hard-coded messages through out the code have been replaced by i18n
messages obtained from json_metadata and i18n_messages.

https://fedorahosted.org/freeipa/ticket/899


Needs rebase, due to mkosek's big patch.


Attached is an updated version. I had to change IPA.cert into an entity
because it has to be initialized after IPA.init() finishes loading the
metadata  messages.

We might want to introduce a concept of plugin for Web UI (similar to
plugin for ipalib). The first step is to rename IPA.entity_factories
into IPA.plugins, but most of the work will be splitting the IPA.entity
into plugin and real entity.

Patch #107 can be used without rebase.


Attached is a new version using the plugin framework. Please see
certificate.js.


Every function is an Object. There is no reason to create an object, and
then have an init method on it.


I haven't got a chance to provide a long explanation for this, but 
please try to apply all patches that I've submitted (until 109) and see 
the user.js, group.js and certificate.js. I think they are clearly 
structured and easy to understand.


Try to think plugins as modules, and init() as start() or 
main(), or some other terms. Once all entity files are converted to 
use this framework, it maybe possible to remove init() from 
entity/facet/widget. The init() is not an unnecessary duplication of 
constructor, but it's a callback to indicate that the messages are loaded.


--
Endi S. Dewata

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel