# HG changeset patch # User casties # Date 1384448956 -3600 # Node ID e2d2f018a8e26c3d09343f459d4bb961757a6c28 # Parent 76ea03db3426f87f32584f83049df5c1100345c2 add character count to staff profile editing page. diff -r 76ea03db3426 -r e2d2f018a8e2 MPIWGStaff.py --- a/MPIWGStaff.py Thu Nov 14 15:17:05 2013 +0100 +++ b/MPIWGStaff.py Thu Nov 14 18:09:16 2013 +0100 @@ -21,7 +21,7 @@ from Products.ZDBInterface.ZDBInterfaceFolder import ZDBInterfaceFolder from Products.MPIWGManager.MPIWGIcsManager import MPIWGIcsManager -from SrvTxtUtils import getInt, unicodify, utf8ify, sqlName +from SrvTxtUtils import getInt, unicodify, utf8ify, sqlName, getPlaintext import MPIWGHelper # @@ -145,6 +145,8 @@ query += " ORDER BY lower(last_name)" elif sortBy == 'date_from': query += " ORDER BY date_from DESC" + elif sortBy: + query += ' ORDER BY "%s"'%sqlName(sortBy) if limit > 0: query += " LIMIT %s"%int(limit) @@ -413,6 +415,18 @@ getUrl = MPIWGHelper.getUrl + + def getProfile(self, filter=None, length=0): + """Return the profile""" + logging.debug("getProfile: self.content=%s"%(repr(self.content))) + text = self.content.profile + if filter == 'plaintext': + # filter out any tags, keep only text + text = getPlaintext(text, length=length, wordwrap=True, ignoretags=['style']) + + return text + + def getTalks(self, published=True, sortBy='priority'): """Return the list of talks""" query = "SELECT oid,* FROM talks WHERE key_main = %s" @@ -984,17 +998,13 @@ return self.executeZSQL(query,[self.getKey()]) - def getProfile(self,REQUEST): + def getProfileHtml(self, REQUEST): """get the profile""" - self.REQUEST.RESPONSE.setHeader('Last-Modified',email.Utils.formatdate().split("-")[0]+'GMT') - - + REQUEST.RESPONSE.setHeader('Last-Modified',email.Utils.formatdate().split("-")[0]+'GMT') html="""%s""" if self.content.profile and self.content.profile != "": - return html%self.content.profile else: - return html%"" diff -r 76ea03db3426 -r e2d2f018a8e2 zpt/staff/edit_profile.zpt --- a/zpt/staff/edit_profile.zpt Thu Nov 14 15:17:05 2013 +0100 +++ b/zpt/staff/edit_profile.zpt Thu Nov 14 18:09:16 2013 +0100 @@ -28,6 +28,7 @@ + (currently published: characters) @@ -50,7 +51,7 @@