Modify

Opened 6 years ago

Closed 5 years ago

#3520 closed enhancement (fixed)

get the names from the database

Reported by: anonymous Owned by: vnaum
Priority: normal Component: CcSelectorPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.10

Description

hello! i'm a newbie in using trac.. i just want to know on how to connect the db using sqlite in the jscript file.. hope to hear an answer from you soon.. tnx in advance!

Attachments (0)

Change History (5)

comment:1 follow-up: Changed 6 years ago by vnaum

Sorry, I do not understand what are you trying to do.
You surely cannot connect to SQLite database (on server) from Javascript in your browser.

If you want to edit pre-defined set of email addresses in
CcSelectorPlugin - just edit cc_selector.js before installing plugin.
If you already installed it - edit it now and re-install plugin again.

comment:2 in reply to: ↑ 1 Changed 6 years ago by anonymous

Replying to vnaum:

Sorry, I do not understand what are you trying to do.
You surely cannot connect to SQLite database (on server) from Javascript in your browser.

If you want to edit pre-defined set of email addresses in
CcSelectorPlugin - just edit cc_selector.js before installing plugin.
If you already installed it - edit it now and re-install plugin again.

Hi! How would I get the names of the users by means of connecting to the database? And not manually adding the names or email address of the users in the jscript file.. Hope to hear a reply from you.. tnx!

comment:3 Changed 6 years ago by vnaum

  • Keywords sqlite ccselector removed
  • Priority changed from high to normal
  • Status changed from new to assigned
  • Summary changed from how to connect trac.db to jscript file to get the names from the database
  • Type changed from defect to enhancement

I will do this eventually, but I can't promise anything: after all, I'm doing this in my spare time.

If you want your list right away - consider editing js file manually.
If you need different lists for different environments - you can compile different lists into different *.egg files (setup bdist_egg) and eggs into plugin subdirs.

comment:4 follow-up: Changed 5 years ago by anonymous

Couldn't we treat the javascript file as a Genshi template and get the user list as follows?

vars = { users: PermissionSystem(self.env).get_users_with_permission('TICKET_VIEW') }

comment:5 in reply to: ↑ 4 Changed 5 years ago by vnaum

  • Resolution set to fixed
  • Status changed from assigned to closed

Replying to anonymous:

Couldn't we treat the javascript file as a Genshi template

It's not that simple.
According to Genshi Tutorial,

The template will be parsed by Genshi using an XML parser, which means that it needs to be well-formed XML.

And I don't know if it is possible to turn JS source into well-formed
XML (it's probably possible, but I have no idea how to do this).
Instead I used template to put developer list into page source and
fetched data from there. And there are two different template engines in Trac to support (Clearsilver in 0.10 and Genshi in 0.11).

Also, to provide templates plugin should implement ITemplateProvider
and to process requests is also should be IRequestHandler - so it does
all this now.

Fixed in r5872 for 0.11 and later, and in r5873 for 0.10.

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from vnaum. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.