I’ve just migrated the Autocomplete-User plugin to work with the globale jQuery version (ui.autocomplete widget) used in the latest Trac versions.
Feel free to test it -> download
have fun
Mario
I’ve just migrated the Autocomplete-User plugin to work with the globale jQuery version (ui.autocomplete widget) used in the latest Trac versions.
Feel free to test it -> download
have fun
Mario
I just have added a visit motivation feature to the Trac Usermanager plugin. With the included patch set you will get an additional column Last Login in the “UserProfilesList” macro.
This patch applies to UserManager plugin rev 5520 🙂
--- macros.py (revision 300) +++ macros.py (revision 301) @@ -10,6 +10,8 @@ from trac.wiki.macros import WikiMacroBase from trac.wiki.formatter import wiki_to_html from trac.web.chrome import Chrome, add_stylesheet, add_script -from trac.util.datefmt import format_datetime +from trac.util.datefmt import format_datetime, to_datetime +from datetime import datetime from tracusermanager.api import UserManager, User from tracusermanager.profile.api import UserProfileManager, IUserProfilesListMacroCellContributor @@ -72,9 +73,29 @@ data['user_profiles'] = UserManager(self.env).search_users(user_profile_templates) else: data['user_profiles'] = UserManager(self.env).get_active_users() - + + db = self.env.get_db_cnx() + cursor = db.cursor() + cursor.execute("SELECT sid,last_visit FROM session WHERE authenticated=1") + last_visits={} + for username, last_visit in cursor: + for user in data['user_profiles']: + date_diff = datetime.now().date() - datetime.date(to_datetime(last_visit)) + if date_diff.days > 1: + user['last_visit'] = "%d days ago" % date_diff.days + elif date_diff.days == 1: + user['last_visit'] = "%d day ago" % date_diff.days + else: + user['last_visit'] = "today" + + #user['last_visit'] = format_datetime(last_visit,"%b %d.%m.%Y %H:%M:%S") + + data['cells']=list(self._get_cells(data['user_profiles'])) - + # add stylesheet&script add_stylesheet(formatter.req,'tracusermanager/css/macros_um_profile.css') add_script(formatter.req,'tracusermanager/js/macros_um_profile.js') @@ -102,8 +113,9 @@ yield ('name', _('Name'),0) yield ('email', _('Email'),1) yield ('role', _('Role'),2) + yield ('last_visit', _('Last login'),3) def render_userlistmacro_cell(self, cell_name, user): - """Should render user cell""" + """Should render user cell""" return user[cell_name] class TeamRosterMacro(UserProfilesListMacro):
have fun
This is a patch for getting the WatchPlugin working with trac 0.12.
+++ ./plugin.py Sat Apr 03 16:56:17 2010 @@ -26,6 +26,7 @@ from trac.env import IEnvironmentSetupParticipant from trac.util import format_datetime, pretty_timedelta +from trac.util.datefmt import from_utimestamp, to_utimestamp from trac.web.chrome import INavigationContributor from trac.web.api import IRequestFilter, IRequestHandler, RequestDone from trac.web.chrome import ITemplateProvider, add_ctxtnav, add_link, add_script, add_notice @@ -38,6 +39,7 @@ from trac.wiki.model import WikiPage from trac.ticket.model import Ticket + __DB_VERSION__ = 3 class WatchlistError(TracError): @@ -347,9 +349,9 @@ 'name' : name, 'author' : author, 'version' : version, - 'datetime' : format_datetime( time ), - 'timedelta' : pretty_timedelta( time ), - 'timeline_link' : timeline_link( time ), + 'datetime' : from_utimestamp( time ), + 'timedelta' : pretty_timedelta( from_utimestamp(time) ), + 'timeline_link' : timeline_link( from_utimestamp(time) ), 'comment' : comment, 'notify' : notify, }) @@ -426,9 +428,9 @@ 'author' : author, 'commentnum': to_unicode(self.commentnum), 'comment' : len(self.comment) <= 250 and self.comment or self.comment[:250] + '...', - 'datetime' : format_datetime( changetime ), - 'timedelta' : pretty_timedelta( changetime ), - 'timeline_link' : timeline_link( changetime ), + 'datetime' : from_utimestamp( changetime ), + 'timedelta' : pretty_timedelta( from_utimestamp( changetime ) ), + 'timeline_link' : timeline_link( from_utimestamp( changetime ) ), 'changes' : changes, 'summary' : summary, 'notify' : notify,
This patch applies to rev 7710, you can download the patch from trac-Hacks
Have fun 🙂