Permalink
Browse files

Forma basica,

  • Loading branch information...
1 parent c81dc4a commit d807bb5dae31df184abf032f81d4e6a3ea3f23e7 @certae committed Jun 6, 2012
View
Binary file not shown.
@@ -200,8 +200,7 @@ class PropertyAdmin(django.contrib.admin.ModelAdmin):
# - __ptConfig
# - items u objetos
- protoExt['protoForm'] = [{
- "items": [
+ protoExt['protoForm'] = [
{"title" : 'Basicas ',
"__ptType" : 'fieldset',
"code" : { "__ptType" : "formField"},
@@ -218,6 +217,4 @@ class PropertyAdmin(django.contrib.admin.ModelAdmin):
"concept__code" : { "__ptType" : "formField"},
"concept__model__code" : { "__ptType" : "formField"},
},
- ]
- }]
-
+ ]
@@ -216,7 +216,7 @@ function DefineProtoModel ( myMeta , modelClassName ){
// convert : Campo Virtual calculado, Apunta a una funcion q genera el valor
var myFields = []; // model Fields
- var dict = {}; // For indexing fields
+ var __ptDict = {}; // For indexing fields
for (var ix in myMeta.fields ) {
@@ -263,13 +263,13 @@ function DefineProtoModel ( myMeta , modelClassName ){
// Asigna el modelo y el diccionario
myFields.push(mField);
- dict[vFld.name] = vFld
+ __ptDict[vFld.name] = vFld
}
// Asigna un diccionario con las llaves como clave
- myMeta.dict = dict
+ myMeta.__ptDict = __ptDict
// Agrega el status y el interna ID
@@ -637,7 +637,7 @@ function savePci( protoMeta, options) {
});
var protoOption = protoMeta.protoOption
- var sMeta = Ext.encode( clone( protoMeta, 0, ['dict'] ) )
+ var sMeta = Ext.encode( clone( protoMeta, 0, ['__ptDict'] ) )
Ext.Ajax.request({
method: 'POST',
@@ -24,82 +24,79 @@ function FormatMETA( oData, pName, ptType ) {
if ( ! ptType ) ptType = sDataType
-
- // La pcl debe abrirse
- if ( pName == 'pcl' ) {
- tData['expanded'] = true
- }
-
-
- tData['text'] = pName
- tData['__ptType'] = ptType
- tData['children'] = []
-
// Obtiene un Id y genera una referencia cruzada de la pcl con el arbol
// El modelo debe crear la referencia a la data o se perdera en el treeStore
var IxTree = Ext.id()
tData['id'] = IxTree
-
- // me.refDict[ IxTree ] = oData
+ tData['text'] = pName
+ tData['__ptType'] = ptType
tData[ '__ptConfig' ] = oData
-
- // // Si es un objeto hay una propiedad q servira de titulo
- // if ( sDataType == "object" ) {
- // if ( oData['protoOption'] ) {
- // tData['ptValue'] = oData.protoOption
- // }
- // }
+ if ( ptType == 'fields' || ptType == 'formFields' ) {
+ // Los fields no deben abrirse
+ tData['leaf'] = true
+ return tData
+ }
+
+ tData['children'] = []
+
// Recorre las propiedades
for (var sKey in oData) {
var vValue = oData[ sKey ]
var typeItem = typeOf(vValue);
// PRegunta es por el objeto padre para enviar el tipo en los arrays
if ( sDataType == "object" ) {
- if ( sKey == 'dict' ) continue
+ if ( sKey.indexOf( "__pt" ) == 0 ) continue
if ( !( typeItem in oc( [ 'boolean', 'number', 'string' ]) )) {
var nBase = pName
// Todos los contenedores del protoForm son manejados como protoForm
- if ( ptType == 'protoForm' ) nBase = ptType
-
+ if ( ptType == 'protoForm' ) {
+ nBase = ptType
+ if ( vValue.__ptType && ( vValue.__ptType == 'formField' )) {
+ nBase = 'formFields'
+ }
+ }
tData['children'].push( FormatMETA(vValue, sKey , nBase ) )
}
} else if ( sDataType == "array" ) {
var oTitle = pName + '.' + sKey
-
- if ( pName == 'fields' && vValue.name ) {
- oTitle = vValue.name
- } else if ( pName == 'protoForm' ) {
-
- oTitle = vValue.style
-
- }
- if ( pName == 'formFields' && typeItem == 'string' ) {
+ if ( vValue.__ptType && vValue.title ) {
+ oTitle = vValue.__ptType + ' [' + vValue.title + ']'
+ } else if ( vValue.__ptType && vValue.name ) {
+ oTitle = vValue.__ptType + ' [' + vValue.name + ']'
+
+ } else if ( vValue.name ) {
+ oTitle = vValue.name
+
+ } else if ( vValue.__ptType ) {
+ oTitle = vValue.__ptType
+
+ } else if ( typeItem == 'string' ) {
+
+ oTitle = vValue
var nData = {
- '__ptType' : 'formField',
- 'text' : vValue,
+ '__ptType' : pName,
+ 'text' : oTitle,
'leaf': true,
'id' : Ext.id(),
'__ptConfig' : {}
}
tData['children'].push( nData )
-
- } else {
-
- tData['children'].push( FormatMETA(vValue, oTitle , pName ) )
-
+ continue
}
+ tData['children'].push( FormatMETA(vValue, oTitle , pName ) )
+
}
}
@@ -131,7 +131,7 @@ Ext.define('ProtoUL.view.ProtoForm', {
// Agrega los items
prLayout.items = []
for(var ix in protoObj ) {
- if ( ix in oc( ['__ptConfig', '__ptType'] )) continue
+ if ( ix.indexOf( "__pt" ) == 0 ) continue
var prVar = protoObj[ix];
var prFld = this.defineProtoFormItem( protoObj, prVar, ix )
@@ -234,9 +234,9 @@ Ext.define('ProtoUL.view.ProtoForm', {
},
getProtoField : function(myMeta, fldName) {
- var dict = myMeta.dict;
- if ( ! dict[fldName] ) dict[fldName] = {}
- return dict[fldName]
+ var __ptDict = myMeta.__ptDict;
+ if ( ! __ptDict[fldName] ) __ptDict[fldName] = {}
+ return __ptDict[fldName]
},
@@ -60,7 +60,7 @@ Ext.define('ProtoUL.view.ProtoGrid' ,{
//console.log ( this.protoOption, ' Loading store ... ' );
// prepara la meta
- var excludeP = ['dict', 'protoForm', 'sheetConfig', 'protoViews', 'protoDetails']
+ var excludeP = ['__ptDict', 'protoForm', 'sheetConfig', 'protoViews', 'protoDetails']
var safeMeta = clone( myMeta, 0, excludeP );
var storeDefinition = {
@@ -776,7 +776,7 @@ Ext.define('ProtoUL.view.ProtoGrid' ,{
myWin.show()
- // var safeConf = clone( myMeta , 0, exclude =['dict','gridDefinition', 'formDefinition'] )
+ // var safeConf = clone( myMeta , 0, exclude =['__ptDict','gridDefinition', 'formDefinition'] )
// showConfig( 'MetaConfig', safeConf )
},
@@ -810,7 +810,7 @@ Ext.define('ProtoUL.view.ProtoGrid' ,{
myWin.show()
- // var safeConf = clone( myMeta , 0, exclude =['dict','gridDefinition', 'formDefinition'] )
+ // var safeConf = clone( myMeta , 0, exclude =['__ptDict','gridDefinition', 'formDefinition'] )
// showConfig( 'MetaConfig', safeConf )
},
@@ -849,7 +849,7 @@ showProtoDesigner: function() {
myWin.show()
- // var safeConf = clone( myMeta , 0, exclude =['dict','gridDefinition', 'formDefinition'] )
+ // var safeConf = clone( myMeta , 0, exclude =['__ptDict','gridDefinition', 'formDefinition'] )
// showConfig( 'MetaConfig', safeConf )
}

0 comments on commit d807bb5

Please sign in to comment.