From: Wido D. <wi...@us...> - 2005-10-24 18:44:02
|
Update of /cvsroot/luma/luma/lib/luma/base/utils/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9257/lib/luma/base/utils/gui Modified Files: AdvancedObjectWidget.py Log Message: Added support for deleting object classes. Index: AdvancedObjectWidget.py =================================================================== RCS file: /cvsroot/luma/luma/lib/luma/base/utils/gui/AdvancedObjectWidget.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** AdvancedObjectWidget.py 23 Oct 2005 16:41:42 -0000 1.11 --- AdvancedObjectWidget.py 24 Oct 2005 18:43:53 -0000 1.12 *************** *** 194,203 **** tmpList.append("""</tr>""") for x in self.ldapDataObject.getObjectClasses(): if self.ldapDataObject.isObjectclassStructural(x): ! x = "<b>" + x + "</b>" tmpList.append("""<tr>""") ! tmpList.append("""<td colspan=2 bgcolor="#E5E5E5" width="100%">""" + x + """</td>""") ! tmpList.append("""</tr>""") tmpList.append("""</table>""") --- 194,233 ---- tmpList.append("""</tr>""") + rdn = self.ldapDataObject.getPrettyRDN() + rdnClass = rdn.split("=")[0] + for x in self.ldapDataObject.getObjectClasses(): + classString = x[:] if self.ldapDataObject.isObjectclassStructural(x): ! classString = "<b>" + classString + "</b>" tmpList.append("""<tr>""") ! tmpList.append("""<td colspan=2 bgcolor="#E5E5E5" width="100%">""") ! tmpList.append(classString) ! ! allowDelete = True ! if self.ldapDataObject.isObjectclassStructural(x): ! classList = self.ldapDataObject.getObjectClasses() ! classList.remove(x) ! if len(self.ldapDataObject.getObjectClassChain(x, classList)) == 0: ! allowDelete = False ! ! if rdnClass in self.ldapDataObject.getAttributeListForObjectClass(x): ! allowDelete = False ! ! # Now we check if another objectclass provides the rdn attribute ! classList = self.ldapDataObject.getObjectClasses() ! classList.remove(x) ! for y in classList: ! if rdnClass in self.ldapDataObject.getAttributeListForObjectClass(y): ! allowDelete = True ! break ! ! if allowDelete and (not (x == 'top')): ! deleteName = x + "__delete\"" ! self.mimeFactory.setPixmap("deletePixmap", self.deletePixmap) ! tmpList.append(""" <a name=\"""" + deleteName + """><img source="deletePixmap"></a>""") ! ! ! tmpList.append("""</td></tr>""") tmpList.append("""</table>""") *************** *** 376,392 **** tmpList = nameString.split("__") ! if not len(tmpList) == 3: ! return ! ! attributeName = tmpList[0] ! index = int(tmpList[1]) ! operation = tmpList[2] ! if operation == "edit": ! self.editAttribute(attributeName, index) ! elif operation == "delete": ! self.deleteAttribute(attributeName, index) ! elif operation == "export": ! self.exportAttribute(attributeName, index) ############################################################################### --- 406,425 ---- tmpList = nameString.split("__") ! if tmpList[0] in self.ldapDataObject.getObjectClasses(): ! self.deleteObjectClass(tmpList[0]) ! else: ! if not len(tmpList) == 3: ! return ! ! attributeName = tmpList[0] ! index = int(tmpList[1]) ! operation = tmpList[2] ! if operation == "edit": ! self.editAttribute(attributeName, index) ! elif operation == "delete": ! self.deleteAttribute(attributeName, index) ! elif operation == "export": ! self.exportAttribute(attributeName, index) ############################################################################### *************** *** 452,455 **** --- 485,495 ---- self.displayValues() + ############################################################################### + + def deleteObjectClass(self, className): + self.ldapDataObject.deleteObjectClass(className) + self.EDITED = True + self.displayValues() + ############################################################################### |