File:  [Repository] / OSAS / OSA_system / OSAS_addfiles.py
Revision 1.5: download - view: text, annotated - select for diffs - revision graph
Mon Oct 6 22:19:47 2003 UTC (20 years, 8 months ago) by dwinter
Branches: MAIN
CVS tags: HEAD
Hinzufügen von Objekten in eine Collection

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>