Skip to content
Browse files

Change family generation to dissociate structure and param

The family CSV is splitted in two CSV
> STRUCT that handle attr stuct
> PARAM that handle family param

Modify extractAttr to take care of the new struct
Modify generateFamily
Add to generateFamily a strOut width the string for info.xml.in
  • Loading branch information...
1 parent 706beab commit 1ef41bc2d3a43b38a2ed4f48ee2c71fe06aeedc6 @cbonnissent committed
View
4 Families/template/extractAttrProductConst.py
@@ -12,7 +12,7 @@ def callback ( args, directory, files ) :
print 'Scanning',directory
for fileName in files:
if os.path.isfile( os.path.join(directory,fileName) ) :
- if (string.lower(os.path.splitext(fileName)[1]) in ['.csv']) and (fileName[:3] in ["FAM"]) :
+ if (string.lower(os.path.splitext(fileName)[1]) in ['.csv']) and (fileName[:6] == "STRUCT") :
extractAttr(directory,fileName)
def extractAttr(directory, fileName):
@@ -22,7 +22,7 @@ def extractAttr(directory, fileName):
currentLine = currentLine.split(";")
if currentLine[0] == "ATTR":
attributes.append(currentLine[1])
- methodFileName = os.path.join(directory,"Method."+os.path.splitext(fileName)[0][4:]+".php")
+ methodFileName = os.path.join(directory,"Method."+os.path.splitext(fileName)[0][7:]+".php")
if os.path.isfile(methodFileName):
methodPhp = codecs.open(methodFileName, 'r', 'utf8')
methodContent = []
View
27 Families/template/generateFamily.py
@@ -11,20 +11,37 @@
familyName = familyName.upper()
-templateCSVContent = Template(open("templateFamily.csv", "r").read())
+templateCSVStruct = Template(open("templateFamilyStruct.csv", "r").read())
+templateCSVParam = Template(open("templateFamilyParam.csv", "r").read())
templatePHPContent = Template(open("templateFamily.php", "r").read())
familyIcon =familyName.lower()+".png"
familyMethod = "Method."+familyName.lower()+".php"
familyDFLID = "FLD_"+familyName
-csv = templateCSVContent.safe_substitute(familyName=familyName, parentFamily="", familyNameIcon=familyIcon, familyNameMethod=familyMethod, familyNameDFLDID=familyDFLID)
+csvStruct = templateCSVStruct.safe_substitute(familyName=familyName)
+csvParam = templateCSVParam.safe_substitute(familyName=familyName, parentFamily="", familyNameIcon=familyIcon, familyNameMethod=familyMethod, familyNameDFLDID=familyDFLID)
php = templatePHPContent.safe_substitute(familyName=familyName)
-familyCSV = open("../FAM_"+familyName.lower()+".csv","w")
-familyCSV.write(csv)
-familyCSV.close()
+familyCSVStruct = open("../STRUCT_"+familyName.lower()+".csv","w")
+familyCSVStruct.write(csvStruct)
+familyCSVStruct.close()
+
+familyCSVParam = open("../PARAM_"+familyName.lower()+".csv","w")
+familyCSVParam.write(csvParam)
+familyCSVParam.close()
familyPHP = open("../"+familyMethod,"w")
familyPHP.write(php)
familyPHP.close()
+
+importStr = """
+<process command="./wsh.php --api=importDocuments --file=./@APPNAME@/PARAM_$familyFileName.csv">
+ <label lang="en">importing PARAM_$familyName.csv</label>
+</process>
+<process command="./wsh.php --api=importDocuments --file=./@APPNAME@/STRUCT_$familyFileName.csv">
+ <label lang="en">importing STRUCT_$familyName.csv</label>
+</process>
+"""
+
+print Template(importStr).safe_substitute(familyName=familyName, familyFileName=familyName.lower())
View
11 Families/template/templateFamilyParam.csv
@@ -0,0 +1,11 @@
+//FAM;dossier(DIR);<specid>;<fldid>;titre;
+ORDER;DIR;;;ba_title;
+DOC;DIR;$familyNameDFLDID;;$familyNameDFLDID;
+;;;;;
+//;Father ;Title;Id;Classe;Logical Name
+BEGIN;$parentFamily;$familyName;;;$familyName
+TYPE;C;;;;
+ICON;$familyNameIcon;;;;
+METHOD;$familyNameMethod;;;;
+DFLDID;$familyNameDFLDID;;;;
+END;;;;;
View
11 Families/template/templateFamily.csv → Families/template/templateFamilyStruct.csv
@@ -1,9 +1,5 @@
//;Father ;Title;Id;Classe;Logical Name;;;;;;;;;;;
-BEGIN;$parentFamily;$familyName;;;$familyName;;;;;;;;;;;
-TYPE;C;;;;;;;;;;;;;;;
-ICON;$familyNameIcon;;;;;;;;;;;;;;;
-DFLDID;$familyNameDFLDID;;;;;;;;;;;;;;;
-METHOD;$familyNameMethod;;;;;;;;;;;;;;;
+BEGIN;;;;;$familyName;;;;;;;;;;;
//;idattr;idframe;label;T;A;type;ord;vis;need;link;phpfile;phpfunc;elink ;constraint ;option;Commentaires
;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;
@@ -22,8 +18,3 @@ METHOD;$familyNameMethod;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;
END;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;
-//FAM;dossier(DIR);<specid>;<fldid>;titre;;;;;;;;;;;;
-ORDER;DIR;;;ba_title;;;;;;;;;;;;
-DOC;DIR;$familyNameDFLDID;;$familyNameDFLDID;;;;;;;;;;;;

0 comments on commit 1ef41bc

Please sign in to comment.
Something went wrong with that request. Please try again.