annotate MPIWGThesaurus.py @ 5:2773140337ad

Mangement der People f?r Tagging: verbessert. Im Triplestore eingetragenen Personen mit Vor- und Nachnamen werden jetzt nach Nachnamen sortiert. Personen verschwinden aus der Tagging-?bersicht, wenn keine Projekte mehr dazugeh?ren.
author dwinter
date Wed, 12 Oct 2011 16:01:05 +0200
parents fa8d698958f7
children fcab446bca79
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
1 #Klasse zum Taggen und Anzeigen der Tags von Projekte bzw. allgemein Webseiten des Institutes
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
2 #Tags werden in der Instanz abgespeichert
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
3 #Personenname kommen aus dem Virtuoso-Triplestore , lokal erzeugte zusaetliche Name werden dort abgespeichert
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
4 #Fuer die Suche über die Personenname wird das MetaDataManagerRestlet benoetigt.
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
5 #TODO: Zur Zeit werden die entsprechenden Server URLs hier in der Klasse definiert.
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
6
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
7
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
8 # TODO: generell verwaltung der tags im triple store und nicht in zope.
1
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
9 # TODO: mache server und namespaces konfigurierbar im project
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
10
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
11
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
12 from OFS.Folder import Folder
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
13 from Globals import package_home
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
14 from Products.PageTemplates.PageTemplateFile import PageTemplateFile
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
15 from BTrees.OOBTree import OOBTree
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
16 from BTrees.OOBTree import OOSet
2
03c4e248b9e2 Access rights added
dwinter
parents: 1
diff changeset
17 from AccessControl import ClassSecurityInfo
03c4e248b9e2 Access rights added
dwinter
parents: 1
diff changeset
18
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
19 #import os
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
20 import os.path
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
21 import logging
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
22 import time
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
23 import email.Utils
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
24 from types import ListType
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
25 import transaction
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
26 import random
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
27 import urllib2
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
28 import urllib
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
29
1
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
30 #Entry beschreibt jeweils einen Tag mit dem Namen "title", entries enthaelt eine Liste von Subtags (der Klasse Entry), die diesem Tag untergeordnet sind.
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
31 class Entry:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
32 """publicClass"""
1
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
33
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
34 #===========================================================================
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
35 # __init__
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
36 #===========================================================================
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
37 def __init__(self,title,entries=[]):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
38 self.title=title
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
39 self.entries=entries
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
40
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
41 def getTitle(self):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
42 """getTitle"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
43 return self.title
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
44
1
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
45 #Beschriebt einen von einem Benutzer vorgeschlagenen Tag
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
46 class SuggestedTag:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
47 """publicClass"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
48 type=""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
49 userName=""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
50 def __init__(self,name,comment,type,userName):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
51 self.name=name
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
52 self.comment=comment
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
53 self.type=type
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
54 self.userName=userName
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
55
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
56
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
57 class MPIWGThesaurus(Folder):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
58 """MPIWGThesaurus main folder"""
2
03c4e248b9e2 Access rights added
dwinter
parents: 1
diff changeset
59 security=ClassSecurityInfo()
03c4e248b9e2 Access rights added
dwinter
parents: 1
diff changeset
60
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
61 meta_type="MPIWGThesaurus"
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
62
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
63 TMP_PERSON_NS="http://ontologies.mpiwg-berlin.mpg.de/tempObjects/person/"
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
64 ONTOLOGY_NS="http://ontologies.mpiwg-berlin.mpg.de/authorities/namedIdentities/"
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
65 #personproviderURL="http://127.0.0.1:8280/MetaDataManagerRestlet/person/"
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
66 personproviderURL="http://virtuoso.mpiwg-berlin.mpg.de:8080/MetaDataManagerRestlet/person/"
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
67 additionalNamesGraphURL="file://newpersonsFromProjects"
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
68
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
69 #virtuosoServer="http://ontologies.mpiwg-berlin.mpg.de"
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
70 virtuosoServer="http://virtuoso.mpiwg-berlin.mpg.de:8890"
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
71 virtuosoDAV="/DAV/home/websiteuser/"
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
72 virtuosoDAVUser="websiteuser"
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
73 virtuosoDAVPW="w3s45us3"
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
74 virtuosoGraph="file://newpersonsFromProjects"
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
75
1
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
76 #BTrees fuer die Tags
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
77
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
78 projectPersons= OOBTree()
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
79 projectObjects= OOBTree()
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
80 projectHistoricalPlaces= OOBTree()
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
81 projectSuggestedTags= OOBTree()
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
82 persons2Projects= OOBTree()
3
6f4b30846fed Minor changes in deleteAllObjects
dwinter
parents: 2
diff changeset
83 objects2Projects=OOBTree()
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
84 historicalPlaces2Projects=OOBTree()
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
85 suggestedTags2Projects=OOBTree()
4
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
86 personIDtoNames=OOBTree() # weist den personenIDs Klartextnamen aus dem Triplestore zu
5
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
87 personsIDForSort=[] # liste personenID sortiert nach dem tupel (nachname,vorname)
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
88 personsIDForSortFull=[] # liste (personenID,(nachname,vorname)) nicht sortiert!
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
89
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
90 suggestedPersons= OOBTree(); #TODO: das sollte die ueberfluessig werde und nur im triple store stehen.
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
91
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
92 tagList=[]
1
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
93
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
94 #default liste fuer tags, wird ueber das Managementinterface ueberschrieben
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
95 approachesTxt="""A
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
96 ---
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
97 ent1
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
98 ---
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
99 B
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
100 ---
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
101 enta
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
102 entb
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
103 entc
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
104 """
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
105
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
106 disciplines=[]
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
107 disciplinesTxt="""A
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
108 B
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
109 C
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
110 """
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
111
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
112 periods=[]
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
113 periodsTxt="""PA
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
114 PB
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
115 PC
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
116 """
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
117
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
118 spaces=[]
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
119 spacesTxt="""SPA
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
120 ---
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
121 sPent1
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
122 ---
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
123 SPB
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
124 ---
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
125 SPenta
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
126 SPentb
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
127 SPentc
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
128 """
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
129 technologies=[]
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
130 technologiesTxt="""TPA
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
131 ---
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
132 TPent1
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
133 ---
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
134 TPB
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
135 ---
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
136 TPenta
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
137 TPentb
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
138 TPentc
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
139 """
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
140
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
141 knowledgeTransfers=[]
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
142 knowledgeTransfersTxt="""KTPA
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
143 ---
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
144 TPent1
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
145 ---
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
146 TPB
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
147 ---
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
148 TPenta
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
149 TPentb
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
150 TPentc
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
151 """
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
152
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
153
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
154
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
155
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
156
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
157
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
158 manage_options = Folder.manage_options+(
1
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
159 {'label':'Thesaurus entries','action':'changeMPIWGThesaurusForm'},
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
160 {'label':'Manage Thesaurus','action':'manageMPIWGThesaurus'},
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
161 #{'label':'Change Publications Special','action':'changePublications_specialForm'},
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
162 )
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
163
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
164 def __init__(self,id):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
165 """init"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
166 self.id=id
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
167
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
168
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
169 def index_html(self):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
170 """index file"""
1
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
171
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
172 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','index.html')).__of__(self)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
173 return pt()
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
174
2
03c4e248b9e2 Access rights added
dwinter
parents: 1
diff changeset
175 security.declareProtected('View management screens','changeMPIWGThesaurusForm')
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
176 def changeMPIWGThesaurusForm(self):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
177 """form for changing the project"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
178 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','changeMPIWGThesaurusForm.zpt')).__of__(self)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
179 return pt()
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
180
2
03c4e248b9e2 Access rights added
dwinter
parents: 1
diff changeset
181 security.declareProtected('View management screens','manageMPIWGThesaurus')
1
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
182 def manageMPIWGThesaurus(self):
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
183 """form for changing the project"""
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
184 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','manageMPIWGThesaurus.zpt')).__of__(self)
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
185 return pt()
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
186
2
03c4e248b9e2 Access rights added
dwinter
parents: 1
diff changeset
187 security.declareProtected('View management screens','changeMPIWGThesaurus')
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
188 def changeMPIWGThesaurus(self,approachesTxt,disciplinesTxt,periodsTxt,spacesTxt,technologiesTxt,knowledgeTransfersTxt,RESPONSE=None):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
189 """change it"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
190 self.approachesTxt=approachesTxt
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
191 self.disciplinesTxt=disciplinesTxt
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
192 self.periodsTxt=periodsTxt
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
193 self.spacesTxt=spacesTxt
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
194 self.technologiesTxt=technologiesTxt
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
195 self.knowledgeTransfersTxt=knowledgeTransfersTxt
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
196
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
197 if RESPONSE is not None:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
198 redirect(RESPONSE,'manage_main')
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
199
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
200 #In der Anzeige soll der Name der zitierten Personen in Klartext angezeigt werden, ausserdem die Varianten, wie sie tatsaechlich
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
201 #in den Projekten benutzt werden
2
03c4e248b9e2 Access rights added
dwinter
parents: 1
diff changeset
202
5
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
203
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
204
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
205 def addPersonAndFirstNameFromTripleStore(self, personID):
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
206 mainName, sortName = self.getMainNameFromTripleStore(personID) # hole die hauptbezeichnung aus dem triplestore
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
207 personNames = []
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
208 for project in self.persons2Projects.get(personID): #hole die personen aus dem projekte
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
209 logging.debug("Found:project:" + project)
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
210 namesInProject = self.projectPersons.get(project)
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
211 for nameInProjectTuple in namesInProject:
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
212 logging.debug(repr(nameInProjectTuple))
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
213 nameInProject = nameInProjectTuple[1]
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
214 logging.debug(nameInProjectTuple[0] + "??" + personID)
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
215 if nameInProjectTuple[0] == personID:
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
216 logging.debug("changing")
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
217 if mainName == "": # es gibt keinen Eintrag im Triplestore fuer name (sollte eigentlich nicht sein, ist dann ein Fehler dort)
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
218 mainName = nameInProject #nimm dann aber den ersten aus den projekten
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
219 if nameInProject != mainName:
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
220 personNames.append(nameInProject)
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
221
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
222 logging.debug(str(mainName) + "- foundalso :" + ",".join(personNames))
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
223 self.personIDtoNames.update({personID:(mainName, personNames)})
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
224 self.personsIDForSortFull.append((personID, sortName))
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
225
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
226
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
227
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
228 def generateSortingOrderForPersonIDs(self):
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
229 def sort(x,y):
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
230 logging.debug("sort:")
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
231 logging.debug((x[1][0],y[1][0]))
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
232 return cmp(x[1][0],y[1][0])
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
233
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
234 self.personsIDForSortFull.sort(cmp=sort)
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
235
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
236 self.personsIDForSort=[x[0] for x in self.personsIDForSortFull]
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
237
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
238 self.personIDtoNames=self.personIDtoNames # make clear that it has changed #TODO: change this to variablen with names _p
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
239
4
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
240 security.declareProtected('View management screens','collectPersonNamesToIds')
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
241 def collectPersonNamesToIds(self):
1
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
242 """Ordne Namen aus dem Triplestore bzw. die vergebenenden Label den Personen-Ids zu."""
5
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
243 #sollte z.B. gemacht werden, wenn im Triplestore editiert wurde.
4
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
244 self.personIDtoNames=OOBTree() # loesche alle
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
245 self.personsIDForSort=[]
5
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
246 self.personsIDForSortFull=[]
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
247 for personID in self.persons2Projects:
5
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
248 self.addPersonAndFirstNameFromTripleStore(personID,self.personsIDForSortFull)
4
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
249
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
250
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
251
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
252
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
253 #sortiere personIDs nach erstmal nach Nachnamene TODO: sortiere nach name,vorname
5
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
254
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
255 self.generateSortingOrderForPersonIDs();
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
256 # def sort(x,y):
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
257 # logging.debug("sort:")
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
258 # logging.debug((x[1][0],y[1][0]))
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
259 # return cmp(x[1][0],y[1][0])
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
260 #
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
261 # self.personsIDForSortFull.sort(cmp=sort)
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
262 #
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
263 # self.personsIDForSort=[x[0] for x in self.personsIDForSortFull]
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
264 #
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
265 # self.personIDtoNames=self.personIDtoNames # make clear that it has changed #TODO: change this to variablen with names _p
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
266 #
1
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
267 #Hole die Namen, die einer personID zugeordnet sind.
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
268 def getNamesFromID(self,personID):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
269 retStr=""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
270 retStr+=self.personIDtoNames.get(personID)[0] # hole die Hauptbezeichnung
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
271 additionalNames = self.personIDtoNames.get(personID)[1]
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
272 if len(additionalNames)>0:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
273 retStr+=" ("+",".join(additionalNames)+","+")"
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
274 return retStr
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
275
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
276
1
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
277 #Hole die Hauptnamemsansetzung aus dem Triplestore ),falls vorhanden, wenn nicht ist der String leer.
4
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
278 #ausserdem einen Namen zum sortieren, = Tupel(nachname, vorname)
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
279 def getMainNameFromTripleStore(self,personID):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
280
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
281
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
282 cmdString ="""select * where { <%s> <http://xmlns.com/foaf/0.1/name> ?name}"""%personID
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
283
4
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
284 names= self.callSparql(cmdString)
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
285
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
286 cmdString ="""select * where { <%s> <http://xmlns.com/foaf/0.1/lastName> ?name}"""%personID
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
287
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
288 lastName= self.callSparql(cmdString)
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
289
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
290 cmdString ="""select * where { <%s> <http://xmlns.com/foaf/0.1/firstName> ?name}"""%personID
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
291
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
292 firstName= self.callSparql(cmdString)
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
293
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
294 return names,(lastName,firstName)
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
295
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
296
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
297 def callSparql(self,cmdString):
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
298
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
299 auth_handler = urllib2.HTTPBasicAuthHandler()
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
300 auth_handler.add_password(realm='sparql',
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
301 uri=self.virtuosoServer+"/sparql",
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
302 user=self.virtuosoDAVUser,
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
303 passwd=self.virtuosoDAVPW)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
304
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
305 opener = urllib2.build_opener(auth_handler)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
306 opener.addheaders = [('Content-Type','application/sparql-query')]
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
307
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
308 logging.debug(cmdString)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
309 try:
4
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
310 logging.debug(self.virtuosoServer+"/sparql?" + urllib.urlencode({'query':cmdString,'default-graph-uri':self.virtuosoGraph,'named-graph-uri':'','format':'text/csv'}))
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
311 #r= opener.open(self.virtuosoServer+"/sparql", urllib.urlencode({'query':cmdString,'default-graph-uri':self.virtuosoGraph,'named-graph-uri':'','format':'text/csv'}))
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
312 r= opener.open(self.virtuosoServer+"/sparql", urllib.urlencode({'query':cmdString,'default-graph-uri':'','named-graph-uri':'','format':'text/csv'}))
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
313 namesTxt=r.read()
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
314 except urllib2.URLError, e:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
315 logging.error(e.code)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
316 logging.error(e.read())
4
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
317
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
318
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
319 return
4
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
320 logging.debug(namesTxt)
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
321 names=namesTxt.split("\n")
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
322 if len(names) < 2: #in der ersten Zeile stehen bei der Rückgabe die Spaltennamen, <2 heiss also es gibt keinen Eintrag
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
323 return
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
324
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
325 return names[1].replace('"','') # wir nehmen nur den ersten treffer
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
326
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
327
2
03c4e248b9e2 Access rights added
dwinter
parents: 1
diff changeset
328 security.declareProtected('View management screens','changeTags')
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
329 def changeTags(self,projectID,approaches=[],disciplines=[],periods=[],spaces=[],technologies=[],transfers=[],RESPONSE=None):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
330 """change tags"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
331 self.changeTagFromList(projectID,"approaches", approaches)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
332 self.changeTagFromList(projectID,"disciplines", disciplines)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
333 self.changeTagFromList(projectID,"periods", periods)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
334 self.changeTagFromList(projectID,"spaces", spaces)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
335 self.changeTagFromList(projectID,"technologies", technologies)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
336 self.changeTagFromList(projectID,"transfers", transfers)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
337
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
338 self.projectObjects=self.projectObjects #necessesary to make the object persistent after the first call
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
339 self.projectHistoricalPlaces=self.projectHistoricalPlaces #necessesary to make the object persistent after the first call
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
340 self.projectPersons=self.projectPersons #necessesary to make the object persistent after the first call
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
341 self.projectSuggestedTags=self.projectSuggestedTags
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
342
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
343 self.persons2Projects=self.persons2Projects
3
6f4b30846fed Minor changes in deleteAllObjects
dwinter
parents: 2
diff changeset
344 self.objects2Projects=self.objects2Projects
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
345 self.historicalPlaces2Projects=self.historicalPlaces2Projects
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
346 self.suggestedTags2Projects=self.suggestedTags2Projects;
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
347
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
348 self.suggestedPersons=self.suggestedPersons;
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
349
2
03c4e248b9e2 Access rights added
dwinter
parents: 1
diff changeset
350 security.declareProtected('View management screens','deleteAllTags')
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
351 def deleteAllTags(self):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
352 """deleteAllTags - TODO: take this out!!,"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
353 setattr(self,"tags",None)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
354
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
355 return "DONE!"
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
356
2
03c4e248b9e2 Access rights added
dwinter
parents: 1
diff changeset
357 security.declareProtected('View management screens','deleteAllPersons')
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
358 def deleteAllPersons(self):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
359 """deleteAllTags - TODO: take this out!!,"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
360 self.projectPersons= OOBTree()
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
361 self.persons2Projects= OOBTree()
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
362 self.personIDtoNames=OOBTree()
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
363 self.suggestedPersons= OOBTree(); #TODO: das sollte die ueberfluessig werde und nur im triple store stehen.
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
364
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
365
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
366 return "DONE!"
2
03c4e248b9e2 Access rights added
dwinter
parents: 1
diff changeset
367
3
6f4b30846fed Minor changes in deleteAllObjects
dwinter
parents: 2
diff changeset
368 security.declareProtected('View management screens','deleteAllObjects')
6f4b30846fed Minor changes in deleteAllObjects
dwinter
parents: 2
diff changeset
369 def deleteAllObjects(self):
6f4b30846fed Minor changes in deleteAllObjects
dwinter
parents: 2
diff changeset
370 """deleteAllTags - TODO: take this out!!,"""
6f4b30846fed Minor changes in deleteAllObjects
dwinter
parents: 2
diff changeset
371 logging.debug("delete all objects")
6f4b30846fed Minor changes in deleteAllObjects
dwinter
parents: 2
diff changeset
372 self.projectObjects= OOBTree()
6f4b30846fed Minor changes in deleteAllObjects
dwinter
parents: 2
diff changeset
373 self.objects2Projects=OOBTree()
6f4b30846fed Minor changes in deleteAllObjects
dwinter
parents: 2
diff changeset
374
6f4b30846fed Minor changes in deleteAllObjects
dwinter
parents: 2
diff changeset
375
6f4b30846fed Minor changes in deleteAllObjects
dwinter
parents: 2
diff changeset
376 return "DONE!"
6f4b30846fed Minor changes in deleteAllObjects
dwinter
parents: 2
diff changeset
377
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
378 def changeTagFromList(self,projectID,tagType,tagList):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
379
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
380 logging.debug("changing:"+projectID)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
381 logging.debug("asking tag::"+tagType)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
382 if type(tagList) is not ListType:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
383 tagList=[tagList]
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
384
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
385
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
386 tags = getattr(self,"tags",None)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
387 if tags is None:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
388 logging.debug("Create new tags")
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
389 tags=OOBTree()
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
390 setattr(self,"tags",tags)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
391
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
392
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
393 tagsStored=tags.get(tagType,None)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
394 if tagsStored is None:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
395 tagsStored=OOBTree();
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
396
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
397
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
398
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
399 for tag in tagsStored.keys(): #gehe durch alle gespeichteren tags
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
400 logging.debug("checking:"+tag)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
401 currentApproach = tagsStored.get(tag,None)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
402 logging.debug(currentApproach)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
403 if currentApproach is None:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
404 currentApproach=OOSet()
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
405
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
406 if tag in tagList: #dieser ist getagged
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
407 currentApproach.update([projectID]);
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
408 tagList.remove(tag);
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
409 else:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
410 if currentApproach.has_key(projectID):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
411 currentApproach.remove(projectID);
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
412
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
413 tagsStored.update({tag:currentApproach});
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
414
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
415 for tag in tagList: # alle die nich nicht abearbeitet worden muessen noch angelegt werden
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
416 logging.debug("adding:"+tag)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
417 newApproach=OOSet()
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
418 newApproach.update([projectID]);
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
419 tagsStored.insert(tag, newApproach);
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
420
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
421 tags.update({tagType:tagsStored})
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
422
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
423 transaction.commit()
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
424
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
425 def getTitle(self,entry):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
426 return entry.title
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
427
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
428 def getEntries(self,entry):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
429 return entry.entries
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
430
1
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
431 #nimmt ein eine Text der Form
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
432 # TAG1
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
433 # ---
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
434 # SUBTAG1_1
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
435 # SUBTAG1_2
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
436 # ---
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
437 # TAG2
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
438 # ---
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
439 # SUBTAG2_1
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
440 # SUBTAG2_2
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
441 #....
95e1e37915c6 thesaurus manager added
dwinter
parents: 0
diff changeset
442 # und erzeugt daraus eine entsprechende Liste von Entries
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
443 def getEntriesFromTxt(self,txt):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
444 apps=[]
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
445 lines=txt.split("\n");
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
446 level=False
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
447 for line in lines:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
448 line=line.rstrip().lstrip()
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
449 if line=="":
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
450 continue
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
451 if line=="---":
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
452
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
453 if level:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
454 level=False
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
455 else:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
456 level=True
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
457 else:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
458 if not level:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
459 entry=Entry(line,[])
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
460 apps.append(entry)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
461 else:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
462 entry.entries.append(Entry(line))
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
463
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
464 return apps[0:]
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
465
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
466 def getApproaches(self):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
467
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
468 self.tagList=self.getEntriesFromTxt(self.approachesTxt)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
469 return self.tagList
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
470
2
03c4e248b9e2 Access rights added
dwinter
parents: 1
diff changeset
471
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
472 def getTagsJSON(self,projectID,tagType,RESPONSE=None):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
473 """get all selected tagList"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
474 logging.debug("asking:"+projectID)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
475 logging.debug("asking tag::"+tagType)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
476 retList=[]
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
477 tags = getattr(self,"tags",None)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
478 if tags is None:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
479 return;
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
480
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
481 tagsStored=tags.get(tagType,None)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
482 if tagsStored is None:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
483 return;
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
484
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
485 for tag in tagsStored.keys(): #gehe durch alle gespeichteren approached
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
486 logging.debug("checking:"+tag)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
487 currentTag = tagsStored.get(tag,None)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
488 if currentTag is None:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
489 continue
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
490 if currentTag.has_key(projectID):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
491 retList.append(""" "%s" """%tag)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
492
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
493 if RESPONSE:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
494 RESPONSE.setHeader('Content-Type', "application/json")
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
495
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
496 logging.debug(retList)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
497 return "["+",".join(retList)+"]"
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
498
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
499 def getDisciplines(self):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
500
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
501 self.disciplines=self.getEntriesFromTxt(self.disciplinesTxt)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
502 return self.disciplines
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
503
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
504
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
505 def getObjectsJSON(self,term="",RESPONSE=None):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
506 """ get all stored objects as json list starting with term"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
507 term=term.lower();
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
508 logging.debug("Asking:"+term)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
509 #objectList=["baus","berg","lurg"]
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
510 objects = self.objects2Projects;
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
511
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
512 objectList= [x for x in objects.keys()]
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
513
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
514 logging.debug("Create:"+repr(objectList))
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
515 retList=[]
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
516 for object in objectList:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
517 if object.find(term)>-1:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
518 retList.append(""" "%s" """%object)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
519 ret="["
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
520 ret+=",".join(retList)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
521 ret+="]"
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
522 logging.debug("Objects:"+ret)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
523 if RESPONSE:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
524 RESPONSE.setHeader('Content-Type', "application/json")
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
525 return ret
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
526
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
527
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
528 def getHistoricalPlacesJSON(self,term="",RESPONSE=None):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
529 """ get all stored historicalPlaces as json list starting with term"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
530 term=term.lower();
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
531 logging.debug("Asking:"+term)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
532 #historicalPlaceList=["baus","berg","lurg"]
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
533 historicalPlaces = self.historicalPlaces2Projects;
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
534
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
535 historicalPlaceList= [x for x in historicalPlaces.keys()]
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
536
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
537 logging.debug("Create:"+repr(historicalPlaceList))
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
538 retList=[]
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
539 for historicalPlace in historicalPlaceList:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
540 if historicalPlace.find(term)>-1:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
541 retList.append(""" "%s" """%historicalPlace)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
542 ret="["
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
543 ret+=",".join(retList)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
544 ret+="]"
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
545 logging.debug("historicalPlaces:"+ret)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
546 if RESPONSE:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
547 RESPONSE.setHeader('Content-Type', "application/json")
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
548 return ret
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
549
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
550
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
551 def getPeriods(self):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
552
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
553 self.periodes=self.getEntriesFromTxt(self.periodsTxt)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
554 return self.periodes
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
555
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
556 def getSpaces(self):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
557
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
558 self.spaces=self.getEntriesFromTxt(self.spacesTxt)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
559 return self.spaces
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
560
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
561 def getTechnologies(self):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
562
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
563 self.technologies=self.getEntriesFromTxt(self.technologiesTxt)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
564 return self.technologies
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
565
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
566 def getKnowledgeTransfers(self):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
567
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
568 self.knowledgeTransfers=self.getEntriesFromTxt(self.knowledgeTransfersTxt)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
569 return self.knowledgeTransfers
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
570
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
571
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
572 def getObjectsFromProject(self,projectID):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
573 return self.getFromProject(self.projectObjects,projectID);
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
574
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
575 def getHistoricalPlacesFromProject(self,projectID):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
576 return self.getFromProject(self.projectHistoricalPlaces,projectID);
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
577
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
578 def getSuggestedTagsFromProject(self,projectID):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
579 return self.getFromProject(self.projectSuggestedTags,projectID);
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
580
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
581
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
582 def getPersonsFromProject(self,projectID):
5
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
583 #hole alle personenID die zu einem Projekt gehoeren.
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
584 #zurueckgegeben wird ein OOSet()
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
585 return self.getFromProject(self.projectPersons,projectID);
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
586
5
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
587 def getFromProject(self,objects,projectID):
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
588 #holt die zu projectID gehoerigen objekte aus dem objects-set.
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
589 #oder legt einen neuen leeren Satz zu dieser ProjektID an.
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
590 #zuruecgegeben wird ein OOSet()
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
591 if objects.has_key(projectID): #wenn zu der ProjektID schon etwas abgespeichter ist, gieb es zurueck
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
592 logging.debug("key exists:"+projectID)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
593 persons=objects.get(projectID);
5
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
594 else: # andernfalls lege einen neuen Satz an.
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
595 persons=OOSet()
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
596 objects.update({projectID:persons})
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
597 logging.debug("key does not exists:"+projectID)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
598
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
599
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
600 return persons
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
601
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
602 def getHistoricalPlacesFromProjectAsHTML(self,projectID):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
603 """gertobjects"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
604 return self.getFromProjectAsHTML(self.projectHistoricalPlaces, projectID, "HistoricalPlace");
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
605
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
606 def getObjectsFromProjectAsHTML(self,projectID):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
607 """gertobjects"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
608 return self.getFromProjectAsHTML(self.projectObjects, projectID, "Object");
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
609
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
610 def getPersonsFromProjectAsHTML(self,projectID):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
611 """getpersons"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
612 return self.getFromProjectAsHTML(self.projectPersons, projectID, "Person");
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
613
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
614
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
615 def getFromProjectAsHTML(self,objects,projectID,type):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
616 """getpersons"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
617 ret=""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
618 if objects.has_key(projectID):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
619 persons=objects.get(projectID);
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
620 else:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
621 persons=OOSet()
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
622
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
623
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
624 for person in persons:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
625 ret+="""<div class="removeButton">
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
626 <span>%s </span><div style="display:inline" class="remove%s"><span style="display:none" class="removeValue">%s</span>remove</div>
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
627 </div>"""%(person[1],type,person[0])
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
628
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
629
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
630 # ret+="""<div>
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
631 # <input type="checkbox" name="persons_remove"
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
632 # value="%s">
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
633 # <span>%s</span>
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
634 # </div>"""%(person[0],person[1])
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
635 #
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
636 logging.debug(type+":"+ret)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
637 return ret
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
638
2
03c4e248b9e2 Access rights added
dwinter
parents: 1
diff changeset
639 security.declareProtected('View management screens','removeHistoricalPlaceFromProject')
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
640 def removeHistoricalPlaceFromProject(self,projectID,value):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
641 """remove"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
642 logging.debug("removeHP:"+projectID+":"+value);
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
643
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
644 HistoricalPlaces = self.getHistoricalPlacesFromProject(projectID)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
645 for HistoricalPlace in HistoricalPlaces.keys():
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
646
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
647 logging.debug("trying:"+repr(HistoricalPlace[0])+"::"+repr(value)+"__")
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
648 if HistoricalPlace[0]==value:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
649 logging.debug("---removed!")
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
650 HistoricalPlaces.remove(HistoricalPlace)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
651
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
652 self.projectHistoricalPlaces.update({projectID:HistoricalPlaces})
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
653 retstring = self.getHistoricalPlacesFromProjectAsHTML(projectID)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
654 logging.debug(retstring)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
655 return retstring
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
656
2
03c4e248b9e2 Access rights added
dwinter
parents: 1
diff changeset
657 security.declareProtected('View management screens','removeObjectFromProject')
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
658 def removeObjectFromProject(self,projectID,value):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
659 """remove"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
660 logging.debug("remove:"+projectID+":"+value);
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
661
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
662 objects = self.getObjectsFromProject(projectID)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
663 for object in objects.keys():
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
664
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
665 logging.debug("trying:"+repr(object[0])+"::"+repr(value)+"__")
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
666 if object[0]==value:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
667 logging.debug("---removed!")
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
668 objects.remove(object)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
669
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
670 self.projectObjects.update({projectID:objects})
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
671 retstring = self.getObjectsFromProjectAsHTML(projectID)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
672 logging.debug(retstring)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
673 return retstring
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
674
2
03c4e248b9e2 Access rights added
dwinter
parents: 1
diff changeset
675 security.declareProtected('View management screens','removePersonFromProject')
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
676 def removePersonFromProject(self,projectID,value):
5
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
677 """remove a person from the projeckt"""
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
678 logging.debug("remove:"+projectID+":"+value);
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
679
5
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
680 persons = self.getPersonsFromProject(projectID) # hole alle personen die mit dem Projekt verbunden sind.
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
681 for person in persons.keys():
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
682
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
683 logging.debug("trying:"+repr(person[0])+"::"+repr(value)+"__")
5
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
684 if person[0]==value:#person ist die zuloeschende, dann raus damit
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
685
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
686 logging.debug("---removed!")
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
687 persons.remove(person)
5
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
688
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
689 #now also delete the project from the person.
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
690 projectsOfPerson=self.persons2Projects.get(person[0])
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
691 logging.debug(projectsOfPerson)
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
692 if projectID in list(projectsOfPerson):
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
693 projectsOfPerson.remove(projectID)
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
694 #self.persons2Projects.update({person:projectsList})
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
695 if (len(projectsOfPerson)==0): #loesche person aus der liste wenn keine Projekte dazu existieren.
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
696 del self.persons2Projects[person[0]]
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
697
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
698
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
699 #self.projectPersons.update({projectID:persons})
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
700 retstring = self.getPersonsFromProjectAsHTML(projectID)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
701 logging.debug(retstring)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
702 return retstring
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
703
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
704 #fuegt die neue Person zur personIDtoNames hinzu, für die spätere Anzeige in der Personenliste
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
705 def addNameTOPersonIDNames(self,personID,label):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
706 personName = self.personIDtoNames.get(personID)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
707 if personName==None: # Anlegen falls noch nicht existent
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
708 personName=(label,[])
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
709 else:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
710 if (not label in personName[1]) and (not label==personName[0]): # hinzufuegen falls der neuen name noch nicht als bezeichnugn fuer personID eingetragen ist
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
711 personName[1].append(label)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
712
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
713 self.personIDtoNames.update({personID:personName})
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
714
2
03c4e248b9e2 Access rights added
dwinter
parents: 1
diff changeset
715 security.declareProtected('View management screens','addPersonToProject')
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
716 def addPersonToProject(self,projectID,value,label):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
717 """ add a person so the project"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
718 persons=self.getPersonsFromProject(projectID);
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
719
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
720 logging.debug("adding:"+projectID+":"+value+":"+label);
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
721
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
722 persons.insert([value,label])
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
723 self.projectPersons.update({projectID:persons})
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
724
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
725 for personTuple in persons:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
726 #hole die abgespeicherten Projekte zu einer Person
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
727 person=personTuple[0] #hole die ID
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
728
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
729
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
730 if getattr(self,"persons2Projects",None)==None:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
731 setattr(self,"persons2Projects",OOBTree())
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
732
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
733 projects = self.persons2Projects.get(person,None)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
734
5
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
735 if projects==None: #person hatte noch keine projekte
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
736 projects=OOSet();
5
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
737 self.addPersonAndFirstNameFromTripleStore(person)
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
738 self.generateSortingOrderForPersonIDs();
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
739
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
740 projects.insert(projectID )
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
741 logging.debug("update:"+person)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
742 self.persons2Projects.update({person:projects})
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
743
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
744 self.addNameTOPersonIDNames(value,label)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
745 retstring = self.getPersonsFromProjectAsHTML(projectID)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
746 logging.debug(retstring)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
747 transaction.commit()
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
748 return retstring
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
749
5
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
750 security.declareProtected('View management screens','getPersonsWithProjectIDs')
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
751 def getPersonsWithProjectIDs(self,check=False):
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
752 """holt die getaggted Personen mit Projekten"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
753 persons = self.persons2Projects;
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
754 ret={}
4
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
755
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
756 logging.debug("Check Person:"+repr(persons.keys()))
4
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
757 personsList=[x for x in persons.keys()]
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
758
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
759 def sort(x,y):
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
760 sortNrx=self.personsIDForSort.index(x)
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
761 sortNry=self.personsIDForSort.index(y)
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
762 #logging.debug("INSORT***")
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
763 #logging.debug((sortNrx,sortNry))
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
764 return cmp(sortNrx,sortNry)
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
765
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
766 logging.debug("SORT***")
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
767 logging.debug(self.personsIDForSort)
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
768 logging.debug("SORT.list")
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
769 logging.debug(personsList)
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
770 personsList.sort(cmp=sort)
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
771 #for person in persons.keys():
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
772 logging.debug("AFTERSORT***")
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
773 logging.debug(personsList)
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
774 for person in personsList:
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
775 logging.debug("Check:"+person)
4
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
776 #TODO: person muss duch den namen von provider geholt werden
5
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
777 retlist=[]
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
778 projectsList=persons.get(person)
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
779
5
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
780 for projectID in list(projectsList): #list notwendig da projectList in der folgenden iteration veraendert wird.
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
781 if check: #teste ob im Projekt noch ein Verweis auf den Namen steht
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
782 #sollte eigentlich nicht sein.
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
783 personsProjects=self.getPersonsFromProject(projectID)
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
784 logging.debug("persons check mode")
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
785 personsProjectsCheck=[x[0] for x in personsProjects]
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
786 if not person in personsProjectsCheck: #falls es so ist korrigiere die Projektliste der Person
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
787 #loesche die person von projectListe
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
788 projectsList.remove(projectID)
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
789 persons.update({person:projectsList})
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
790
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
791 retlist.append(self.getProjectDetails(projectID))
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
792
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
793 if check and (len(projectsList)==0): #loesche person aus der liste wenn keine Projekte dazu existieren.
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
794 del persons[person]
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
795
2773140337ad Mangement der People f?r Tagging: verbessert.
dwinter
parents: 4
diff changeset
796 ret[person]=retlist[0:]
4
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
797
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
798 logging.debug("AFTERSORT-ret***")
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
799 logging.debug(ret.keys())
fa8d698958f7 sorting by lastname
dwinter
parents: 3
diff changeset
800 return ret,personsList
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
801
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
802 def getHistoricalPlacesWithProjectIDs(self):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
803 """holt die getaggted Personen mit Projekten"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
804 HistoricalPlaces = self.HistoricalPlaces2Projects;
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
805 ret={}
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
806 logging.debug("Check HistoricalPlace:"+repr(HistoricalPlaces.keys()))
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
807 for HistoricalPlace in HistoricalPlaces.keys():
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
808 logging.debug("Check:"+HistoricalPlace)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
809 #TODO: HistoricalPlace muss duch den namen von provuder geholt werden
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
810 list=[]
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
811 for projectID in HistoricalPlaces.get(HistoricalPlace):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
812 list.append(self.getProjectDetails(projectID))
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
813
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
814 ret[HistoricalPlace]=list[0:]
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
815 return ret
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
816
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
817 def getObjectsWithProjectIDs(self):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
818 """holt die getaggted Personen mit Projekten"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
819 objects = self.objects2Projects;
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
820 ret={}
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
821 logging.debug("Check Object:"+repr(objects.keys()))
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
822 for object in objects.keys():
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
823 logging.debug("Check:"+object)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
824 #TODO: object muss duch den namen von provuder geholt werden
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
825 list=[]
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
826 for projectID in objects.get(object):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
827 list.append(self.getProjectDetails(projectID))
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
828
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
829 ret[object]=list[0:]
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
830 return ret
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
831
2
03c4e248b9e2 Access rights added
dwinter
parents: 1
diff changeset
832 security.declareProtected('View management screens','listAllSuggestedTags')
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
833 def listAllSuggestedTags(self):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
834 """list all tags"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
835 ret="<html><body>"
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
836 for projectID in self.projectSuggestedTags:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
837 ret+="<h3>"+projectID+"</h3><table>"
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
838 for tags in self.projectSuggestedTags.get(projectID):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
839 ret+="<tr><td>"+tags[0]+"</td><td>"+tags[1].type+"</td><td>"+tags[1].comment+"</td><td>"+tags[1].userName+"</td></tr>"
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
840 ret+="</table>"
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
841 ret+="</body></html>"
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
842 logging.debug(ret);
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
843 return ret
2
03c4e248b9e2 Access rights added
dwinter
parents: 1
diff changeset
844
03c4e248b9e2 Access rights added
dwinter
parents: 1
diff changeset
845 security.declareProtected('View management screens','suggestTag')
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
846 def suggestTag(self,projectID,tagName,tagComment,tagType,tagUserName):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
847 """suggest a new tag"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
848 """ add a person so the project"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
849 SuggestedTags=self.getSuggestedTagsFromProject(projectID);
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
850
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
851 logging.debug("suggested:"+projectID+":"+tagName);
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
852
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
853
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
854 #TODO: Im moment noch keine Zuordnung zu einer ID.
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
855 newTag = SuggestedTag(tagName,tagComment,tagType,tagUserName)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
856 SuggestedTags.insert([tagName,newTag])
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
857 self.projectSuggestedTags.update({projectID:SuggestedTags})
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
858
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
859
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
860
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
861 for SuggestedTagTuple in SuggestedTags:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
862 #hole die abgespeicherten Projekte zu einer Person
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
863 person=SuggestedTagTuple[0] #hile die ID
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
864
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
865
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
866 if getattr(self,"SuggestedTags2Projects",None)==None:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
867 setattr(self,"SuggestedTags2Projects",OOBTree())
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
868
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
869 projects = self.SuggestedTags2Projects.get(person,None)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
870
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
871 if projects==None:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
872 projects=OOSet();
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
873
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
874 projects.insert(projectID )
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
875 logging.debug("update:"+person)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
876 self.SuggestedTags2Projects.update({person:projects})
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
877
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
878
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
879
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
880 #retstring = self.getSuggestedTagsFromProjectAsHTML(projectID)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
881 #logging.debug(retstring)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
882
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
883
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
884
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
885 #return retstring
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
886
2
03c4e248b9e2 Access rights added
dwinter
parents: 1
diff changeset
887 security.declareProtected('View management screens','addHistoricalPlaceToProject')
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
888 def addHistoricalPlaceToProject(self,projectID,value):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
889 """ add a person so the project"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
890 HistoricalPlaces=self.getHistoricalPlacesFromProject(projectID);
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
891
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
892 logging.debug("adding:"+projectID+":"+value);
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
893
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
894
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
895 #TODO: Im moment noch keine Zuordnung zu einer ID.
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
896 HistoricalPlaces.insert([value,value])
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
897 self.projectHistoricalPlaces.update({projectID:HistoricalPlaces})
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
898
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
899
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
900
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
901 for HistoricalPlaceTuple in HistoricalPlaces:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
902 #hole die abgespeicherten Projekte zu einer Person
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
903 person=HistoricalPlaceTuple[0] #hile die ID
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
904
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
905
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
906 if getattr(self,"HistoricalPlaces2Projects",None)==None:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
907 setattr(self,"HistoricalPlaces2Projects",OOBTree())
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
908
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
909 projects = self.HistoricalPlaces2Projects.get(person,None)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
910
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
911 if projects==None:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
912 projects=OOSet();
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
913
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
914 projects.insert(projectID )
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
915 logging.debug("update:"+person)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
916 self.HistoricalPlaces2Projects.update({person:projects})
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
917
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
918
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
919
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
920 retstring = self.getHistoricalPlacesFromProjectAsHTML(projectID)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
921 logging.debug(retstring)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
922
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
923
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
924
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
925 return retstring
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
926
2
03c4e248b9e2 Access rights added
dwinter
parents: 1
diff changeset
927 security.declareProtected('View management screens','addObjectToProject')
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
928 def addObjectToProject(self,projectID,value):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
929 """ add a person so the project"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
930 objects=self.getObjectsFromProject(projectID);
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
931
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
932 logging.debug("adding:"+projectID+":"+value);
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
933
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
934
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
935 #TODO: Im moment noch keine Zuordnung zu einer ID.
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
936 objects.insert([value,value])
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
937 self.projectObjects.update({projectID:objects})
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
938
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
939
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
940
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
941 for objectTuple in objects:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
942 #hole die abgespeicherten Projekte zu einer Person
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
943 person=objectTuple[0] #hile die ID
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
944
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
945
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
946 if getattr(self,"objects2Projects",None)==None:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
947 setattr(self,"objects2Projects",OOBTree())
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
948
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
949 projects = self.objects2Projects.get(person,None)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
950
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
951 if projects==None:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
952 projects=OOSet();
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
953
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
954 projects.insert(projectID )
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
955 logging.debug("update:"+person)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
956 self.objects2Projects.update({person:projects})
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
957
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
958
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
959
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
960 retstring = self.getObjectsFromProjectAsHTML(projectID)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
961 logging.debug(retstring)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
962
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
963
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
964
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
965 return retstring
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
966
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
967
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
968 def getProjectsWithTag(self,tagType,tagName):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
969 tags = getattr(self,"tags",None)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
970 if tags is None:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
971 logging.debug("can't find Tags")
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
972 return []
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
973
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
974
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
975
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
976 tagsStored=tags.get(tagType,None)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
977 if tagsStored is None:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
978 logging.debug("can't find Tag:"+tagType)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
979 return []
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
980
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
981 projects = tagsStored.get(tagName,None)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
982 if projects is None:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
983 logging.debug("can't find any projects for Tag:"+tagName+"("+tagType+")")
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
984 return []
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
985
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
986 ret=[]
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
987 for project in projects:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
988 logging.debug("found:"+project)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
989 ret.append(self.getProjectDetails(project))
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
990
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
991 return ret
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
992
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
993 def getProjectDetails(self,getID):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
994 project=getattr(self.www_neu.projects,getID,None)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
995 if project is None:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
996 logging.debug("no project!! " +getID)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
997 return
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
998
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
999 link="/en/research/projects/"+getID
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1000
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1001 title=project.getContent("short_title")
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1002 #persons=project.getPersonKeyList()
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1003 persons=project.getContent('xdata_01')
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1004 logging.debug("%s %s %s"%(link,title,persons))
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1005 return link,title,persons
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1006
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1007 # $.post("addNewPerson",{"projectID":
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1008 # $('#projectID').val(),
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1009 # "personName":$("#suggest_newPerson").val(),
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1010 # "personComment":$("#suggest_newPerson_comment").val()}
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1011 #
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1012 # );
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1013 #
2
03c4e248b9e2 Access rights added
dwinter
parents: 1
diff changeset
1014
03c4e248b9e2 Access rights added
dwinter
parents: 1
diff changeset
1015 security.declareProtected('View management screens','addAndCreateNewPerson')
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1016 def addAndCreateNewPerson(self,projectID,personName,personComment,personUserName):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1017 """adds anew person to the project which is not in the authority file"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1018
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1019 id = random.randint(0, 1000000);
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1020 idstring="http://ontologies.mpiwg-berlin.mpg.de/tempObjects/person/"+str(id)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1021 while self.suggestedPersons.has_key(idstring):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1022 id = random.randint(0, 1000000);
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1023 #idstring="http://ontologies.mpiwg-berlin.mpg.de/tempObjects/person/"+str(id);
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1024 idstring=self.TEMP_PERSON_NS+str(id);
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1025
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1026
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1027 self.suggestedPersons.update({idstring:(personName,personComment,projectID,personUserName)})
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1028 self.createTempPersonInVirtuoso(projectID, idstring, personName, personComment) #TODO: add suername to the triplestore
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1029 return self.addPersonToProject(projectID, idstring, personName);
2
03c4e248b9e2 Access rights added
dwinter
parents: 1
diff changeset
1030
03c4e248b9e2 Access rights added
dwinter
parents: 1
diff changeset
1031 security.declareProtected('View management screens','createTempPersonInVirtuoso')
0
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1032 def createTempPersonInVirtuoso(self,projectID,personURI, personName,personComment):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1033 """add a new person to the triple store of tempory persons"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1034 triples=[];
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1035 personID="<"+personURI+">"
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1036 triples.append((personID,"<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>","<http://ontologies.mpiwg-berlin.mpg.de/authorities/namedIdentities/Person>"))
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1037 triples.append((personID,"<http://erlangen-crm.org/110404/P3_has_note>",'"'+personComment+'"'))
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1038 triples.append((personID,"<http://xmlns.com/foaf/0.1/name>",'"'+personName+'"'))
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1039 triples.append((personID,"<http://ontologies.mpiwg-berlin.mpg.de/general/isMentionedOn>","<http://www.mpiwg-berlin.mpg.de/en/research/projects/"+projectID+">"))
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1040
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1041 cmdString ="insert in GRAPH <"+self.virtuosoGraph+"> {"
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1042 for triple in triples:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1043 cmdString+=" ".join(triple)+"."
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1044
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1045 cmdString+="}"
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1046
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1047 auth_handler = urllib2.HTTPBasicAuthHandler()
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1048 auth_handler.add_password(realm='sparql',
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1049 uri=self.virtuosoServer+"/sparql",
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1050 user=self.virtuosoDAVUser,
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1051 passwd=self.virtuosoDAVPW)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1052
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1053 opener = urllib2.build_opener(auth_handler)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1054 opener.addheaders = [('Content-Type','application/sparql-query')]
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1055
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1056 logging.debug(cmdString)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1057 try:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1058 r= opener.open(self.virtuosoServer+"/sparql", urllib.urlencode({'query':cmdString,'default-graph-uri':self.virtuosoGraph,'named-graph-uri':None}))
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1059 logging.debug(r.read())
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1060 except urllib2.URLError, e:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1061 logging.error(e.code)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1062 logging.error(e.read())
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1063 return
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1064
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1065 opener2 = urllib2.build_opener()
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1066
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1067
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1068 personIDencoded=urllib.quote(personURI,safe="")
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1069 graphEncoded=urllib.quote(self.additionalNamesGraphURL,safe="")
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1070 url = self.personproviderURL+"id/"+personIDencoded+"/"+graphEncoded
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1071
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1072 try:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1073 request = urllib2.Request(url);
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1074 request.get_method = lambda : 'PUT'
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1075 r= opener2.open(request);
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1076 logging.debug(r.read())
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1077 except urllib2.URLError, e:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1078 logging.error(e.code)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1079 logging.error(e.read())
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1080 return
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1081
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1082
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1083
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1084 return
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1085
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1086 def redirect(RESPONSE,url):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1087 """mache ein redirect mit einem angehaengten time stamp um ein reload zu erzwingen"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1088
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1089 timeStamp=time.time()
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1090
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1091 if url.find("?")>-1: #giebt es schon parameter
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1092 addStr="&time=%s"
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1093 else:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1094 addStr="?time=%s"
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1095
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1096 RESPONSE.setHeader('Last-Modified',email.Utils.formatdate().split("-")[0]+'GMT')
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1097 logging.error(email.Utils.formatdate()+' GMT')
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1098 RESPONSE.redirect(url+addStr%timeStamp)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1099
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1100 def manage_addMPIWGThesaurusForm(self):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1101 """form for adding the project"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1102 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','addMPIWGThesaurusForm.zpt')).__of__(self)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1103 return pt()
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1104
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1105
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1106
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1107 def manage_addMPIWGThesaurus(self,id,RESPONSE=None):
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1108 """add it"""
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1109 newObj=MPIWGThesaurus(id)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1110
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1111 self._setObject(id,newObj)
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1112
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1113
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1114 if RESPONSE is not None:
b2e4605f20b2 beta version
dwinter
parents:
diff changeset
1115 redirect(RESPONSE,'manage_main')