Annotation of OSAS/OSA_system/OSAS_addfiles.py, revision 1.4
1.1 dwinter 1: # Methoden und Classen zum Hinzufuegen von Dokumenten
2:
1.3 dwinter 3: import urllib
1.1 dwinter 4: import OSAS_add
5: from OFS.Folder import Folder
6: from AccessControl import ClassSecurityInfo
7: from Globals import InitializeClass
8: from Products.PageTemplates.PageTemplateFile import PageTemplateFile
9: from Products.PageTemplates.PageTemplate import PageTemplate
10:
11: class OSAS_add_Document(Folder):
12: """Hinzufuegen eines Dokumentes zum Storage"""
13: security=ClassSecurityInfo()
14:
15: def __init__(self,id):
16: """initialize a new instance"""
17: self.id = id
18:
19:
20: meta_type='OSAS_add_Document'
21: manage_options = Folder.manage_options+(
22: {'label':'Main Config','action':'add_Document_config'},
23: )
24:
25:
26:
27: security.declarePublic('add_Document_config')
28: def add_Document_config(self):
29: """Main configuration"""
30: pt=PageTemplateFile('products/OSA_system/ChangeOSAS_addDocument.zpt').__of__(self)
31: return pt()
32:
33: security.declarePublic('change_OSAS_add_Document')
34: def change_OSAS_add_Document(self,RESPONSE=None):
35: """Change"""
36: # self.RootFolderName=RootFolderName
37: if RESPONSE is not None:
38: RESPONSE.redirect('manage_main')
39:
40: security.declarePublic('index_html')
41: def index_html(self):
42: """stantard aufruf"""
43: return OSAS_add.add(self,no_upload=1)
44:
45:
46: security.declarePublic('add2')
47: def add2(self):
48: """ anlegen naechster schritt"""
49: return OSAS_add.add2(self)
50:
51: def add3(self):
52: """Foldername"""
53: return OSAS_add.add3(self)
54:
55: def add4(self):
56: """Applet"""
57: return OSAS_add.add4(self)
58:
59: def add5(self):
60: """Foldername"""
61: return OSAS_add.add5(self)
62:
63: def add6(self):
64: """write new index.meta file"""
65: return OSAS_add.add6(self)
66:
67:
68: def addImages(self,path):
69: """Hinzufügen eines neuen Imagesfolders"""
70: return OSAS_add.addImages(self,path)
71:
72: def addImages2(self):
73: """Upload des neuen Imagefolders"""
1.2 dwinter 74: return OSAS_add.addImages2(self)
75:
1.1 dwinter 76:
77: def manage_AddOSAS_add_DocumentForm(self):
78: """interface for adding the OSAS_add_Metadata"""
79: pt=PageTemplateFile('products/OSA_system/AddOSAS_document.zpt').__of__(self)
80: return pt()
81:
82: def manage_AddOSAS_add_Document(self,id,RESPONSE=None):
83: """add the OSAS_root"""
84: newObj=OSAS_add_Document(id)
85: self.Destination()._setObject(id,newObj)
86: if RESPONSE is not None:
87: RESPONSE.redirect('manage_main')
88:
89:
90: InitializeClass(OSAS_add_Document)
91:
1.2 dwinter 92:
93: class OSAS_add_Text(Folder):
94: """Hinzufuegen eines Text-Dokumentes zum Storage"""
95: security=ClassSecurityInfo()
96:
97: def __init__(self,id):
98: """initialize a new instance"""
99: self.id = id
100:
101:
102: meta_type='OSAS_add_Text'
103: manage_options = Folder.manage_options+(
104: {'label':'Main Config','action':'add_Text_config'},
105: )
106:
107:
108:
109: security.declarePublic('add_Text_config')
110: def add_Text_config(self):
111: """Main configuration"""
112: pt=PageTemplateFile('products/OSA_system/ChangeOSAS_addText.zpt').__of__(self)
113: return pt()
114:
115: security.declarePublic('change_OSAS_add_Text')
116: def change_OSAS_add_Text(self,RESPONSE=None):
117: """Change"""
118: # self.RootFolderName=RootFolderName
119: if RESPONSE is not None:
120: RESPONSE.redirect('manage_main')
121:
122: def addText(self,path):
123: """Add a fulltext"""
124: return OSAS_add.addText(self,path)
125:
126: def addText2(self):
127: """Read the file and store it"""
128: return OSAS_add.addText2(self)
129: def manage_AddOSAS_add_TextForm(self):
130: """interface for adding the OSAS_add_Metadata"""
131: pt=PageTemplateFile('products/OSA_system/AddOSAS_text.zpt').__of__(self)
132: return pt()
133:
134: def manage_AddOSAS_add_Text(self,id,RESPONSE=None):
135: """add the OSAS_root"""
136: newObj=OSAS_add_Text(id)
137: self.Destination()._setObject(id,newObj)
138: if RESPONSE is not None:
139: RESPONSE.redirect('manage_main')
140:
141:
142: InitializeClass(OSAS_add_Text)
1.3 dwinter 143:
144: class OSAS_add_contextData(Folder):
145: """Einfuegen eines Documentes in eine Collection"""
146:
147: security=ClassSecurityInfo()
148:
149:
150: meta_type='OSAS_add_contextData'
151:
152: def __init__(self,id,collection):
153: self.id=id
154: self.collection=collection
155:
1.4 ! dwinter 156: def getChilds(self,id,depth,items):
! 157: list=[]
! 158: for object in items:
! 159: print object[2]
! 160: if (depth==object[2])&(id==object[0]):
! 161: list.append(object)
! 162: return list
! 163:
! 164: def printChilds(self,startItem,depth,items,enddepth):
1.3 dwinter 165:
1.4 ! dwinter 166: def spaces(depth):
! 167: tmp=""
! 168: k=0
! 169: while k<2*depth:
! 170: k+=1
! 171: tmp=tmp+" "+" "
! 172: return tmp
1.3 dwinter 173:
1.4 ! dwinter 174: def retLink(object):
! 175: return "<input type='checkbox' name='collection' value='%s'>%s</input>"% (str(object),object.title)
! 176:
! 177: depth+=1
! 178: childs=self.getChilds(startItem,depth,items)
! 179: tmp=""
! 180: for child in childs:
! 181: if depth < enddepth:
! 182: tmp=tmp+spaces(depth)
! 183: tmp= tmp+retLink(child[1])+"<br>"+self.printChilds(child[1],depth,items,enddepth)+"<br>"
! 184: else:
! 185: tmp=tmp+spaces(2*depth)
! 186: tmp = tmp+retLink(child[1])+"<br>"
1.3 dwinter 187:
1.4 ! dwinter 188: return tmp
! 189:
! 190: def generateTree(self,depth=3):
! 191: """Erzeugt HTML-Tree der Collection"""
! 192:
1.3 dwinter 193: exec("items=self.getPhysicalRoot()."+self.collection+".getCollectionTree()")
1.4 ! dwinter 194: #print items[0][0]
1.3 dwinter 195:
1.4 ! dwinter 196: childs=self.printChilds(items[0][0],0,items,3)
1.3 dwinter 197:
198:
199:
1.4 ! dwinter 200: return "<html><body"+childs+"</html></body>"
1.3 dwinter 201:
202: def addContextData(self):
203: pt=PageTemplateFile('products/OSA_system/contextDataMain.zpt').__of__(self)
204:
205:
206: manage_options = Folder.manage_options+(
207: {'label':'Main Config','action':'add_contextData_config'},
208: )
209:
210:
211: def add_contextData_config(self):
212: """Main configuration"""
213: pt=PageTemplateFile('products/OSA_system/ChangeOSAS_add_contextData.zpt').__of__(self)
214: return pt()
215:
216:
217: def change_OSAS_add_contextData(self,collection,RESPONSE=None):
218: """Change"""
219: self.collection=collection
220: if RESPONSE is not None:
221: RESPONSE.redirect('manage_main')
222:
223: def manage_AddOSAS_add_contextDataForm(self):
224: """interface for adding the OSAS_add_Metadata"""
225: pt=PageTemplateFile('products/OSA_system/AddOSAS_contextData.zpt').__of__(self)
226: return pt()
227:
228: def manage_AddOSAS_add_contextData(self,id,collection,RESPONSE=None):
229: """add the OSAS_root"""
230: newObj=OSAS_add_contextData(id,collection)
231: self.Destination()._setObject(id,newObj)
232: if RESPONSE is not None:
233: RESPONSE.redirect('manage_main')
234:
235:
236: InitializeClass(OSAS_add_contextData)
1.2 dwinter 237:
238: class OSAS_add_Presentation(Folder):
239: """Hinzufügen der Presentationsinformationen"""
240: security=ClassSecurityInfo()
241:
242: def __init__(self,id):
243: """initialize a new instance"""
244: self.id = id
245:
246:
247: meta_type='OSAS_add_Presentation'
248: manage_options = Folder.manage_options+(
249: {'label':'Main Config','action':'add_Presentation_config'},
250: )
251:
252:
253:
254: security.declarePublic('add_Presentation_config')
255: def add_Presentation_config(self):
256: """Main configuration"""
257: pt=PageTemplateFile('products/OSA_system/ChangeOSAS_addPresentation.zpt').__of__(self)
258: return pt()
259:
260: security.declarePublic('change_OSAS_add_Presentation')
261: def change_OSAS_add_Presentation(self,RESPONSE=None):
262: """Change"""
263: # self.RootFolderName=RootFolderName
264: if RESPONSE is not None:
265: RESPONSE.redirect('manage_main')
266:
267: def addPresentation(self,path):
268: """Hinzufügen der Presenationsinformation"""
269: return OSAS_add.addPresentation(self,path)
270:
271: def addPresentation2(self):
272: """Eingabe von Metadateninformationen"""
273: return OSAS_add.addPresentation2(self)
274:
275: def manage_AddOSAS_add_PresentationForm(self):
276: """interface for adding the OSAS_add_Metadata"""
277: pt=PageTemplateFile('products/OSA_system/AddOSAS_presentation.zpt').__of__(self)
278: return pt()
279:
280: def manage_AddOSAS_add_Presentation(self,id,RESPONSE=None):
281: """add the OSAS_root"""
282: newObj=OSAS_add_Presentation(id)
283: self.Destination()._setObject(id,newObj)
284: if RESPONSE is not None:
285: RESPONSE.redirect('manage_main')
286:
287:
288: InitializeClass(OSAS_add_Presentation)
289:
290: class OSAS_combineTextImage(Folder):
291: """Hinzufügen der Combine Text und Image"""
292: security=ClassSecurityInfo()
293:
294: def __init__(self,id):
295: """initialize a new instance"""
296: self.id = id
297:
298:
299: meta_type='OSAS_combineTextImage'
300: manage_options = Folder.manage_options+(
301: {'label':'Main Config','action':'combineTextImage_config'},
302: )
303:
304:
305:
306: security.declarePublic('combineTextImage_config')
307: def combineTextImage_config(self):
308: """Main configuration"""
309: pt=PageTemplateFile('products/OSA_system/ChangeOSAS_combineTextImage.zpt').__of__(self)
310: return pt()
311:
312: security.declarePublic('change_OSAS_combineTextImage')
313: def change_OSAS_combineTextImage(self,RESPONSE=None):
314: """Change"""
315: # self.RootFolderName=RootFolderName
316: if RESPONSE is not None:
317: RESPONSE.redirect('manage_main')
318:
319: security.declarePublic('combineTextImage')
320: def combineTextImage(self,path):
321: """Hinzufügen der Presenationsinformation"""
322: return OSAS_add.combineTextImage(self,path)
323:
324: def combineTextImage2(self,path):
325: """Eingabe von Metadateninformationen"""
326: return OSAS_add.combineTextImage2(self,path)
327:
328:
329: def manage_AddOSAS_combineTextImageForm(self):
330: """interface for adding the OSAS_add_Metadata"""
331: pt=PageTemplateFile('products/OSA_system/AddOSAS_combineTextImage.zpt').__of__(self)
332: return pt()
333:
334: def manage_AddOSAS_combineTextImage(self,id,RESPONSE=None):
335: """add the OSAS_root"""
336: newObj=OSAS_combineTextImage(id)
337: self.Destination()._setObject(id,newObj)
338: if RESPONSE is not None:
339: RESPONSE.redirect('manage_main')
340:
341:
342: InitializeClass(OSAS_combineTextImage)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>