[Trac] Re: displaying custom warning message on new ticket page.

2008-01-29 Thread osimons



On Jan 28, 7:33 pm, osimons [EMAIL PROTECTED] wrote:
 [EMAIL PROTECTED] wrote:

  On 28 jan, 14:49, osimons [EMAIL PROTECTED] wrote:
   There is an example snippet for including in a project templates/
   site.html at:

  http://trac.edgewall.org/wiki/TracInterfaceCustomization#SiteAppearance
 Save the following content as 'site.html' inside your projects
 templates directory (each Trac project can have their own site.html),
 or in a shared location as specified by the '[inherit] templates_dir
 =' setting in the project trac.ini:

  Start cut

 html xmlns=http://www.w3.org/1999/xhtml;
xmlns:py=http://genshi.edgewall.org/;
xmlns:xi=http://www.w3.org/2001/XInclude;
py:strip=

 !--! Add modification sections below --

 /html

 = End cut


Oops. Seems I shortened and changed the orgiginal from
TracInterfaceCustomisation a bit too much... I also chops the Ticket
properties form when viewing tickets... :-)

For reference, here is the full (working) section as found on t.e.o -
put this inside the site.html html tag instead:

form py:match=[EMAIL PROTECTED]'content' and @class='ticket']/form
py:attrs=select('@*')
  py:if test=req.environ['PATH_INFO'] == '/newticket' and (not
'preview' in req.args)
pPlease make sure to search for existing tickets before
reporting a new one!/p
  /py:if
  ${select('*')}
/form


:::simon

https://www.coderesort.com


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Trac 
Users group.
To post to this group, send email to trac-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en
-~--~~~~--~~--~--~---



[Trac] Re: displaying custom warning message on new ticket page.

2008-01-29 Thread [EMAIL PROTECTED]

Hi again Simon,

Thanks a lot for your time and your usefull comments. I will dig into
template engines very soon as I heard about them but never look at
them closely.
I tried your update but there is still a problem :
The Trac Logo and Powered by Trac 0.11b1 ...By Edgewall Software.
label are located on top of Create a new ticket : the footer seems
to be before the form...
I would be very interested in teo's site.html ...

Thanks again for your precious help

Pierre

On 29 jan, 12:35, osimons [EMAIL PROTECTED] wrote:
 On Jan 28, 7:33 pm, osimons [EMAIL PROTECTED] wrote:



  [EMAIL PROTECTED] wrote:

   On 28 jan, 14:49, osimons [EMAIL PROTECTED] wrote:
There is an example snippet for including in a project templates/
site.html at:

   http://trac.edgewall.org/wiki/TracInterfaceCustomization#SiteAppearance
  Save the following content as 'site.html' inside your projects
  templates directory (each Trac project can have their own site.html),
  or in a shared location as specified by the '[inherit] templates_dir
  =' setting in the project trac.ini:

   Start cut

  html xmlns=http://www.w3.org/1999/xhtml;
 xmlns:py=http://genshi.edgewall.org/;
 xmlns:xi=http://www.w3.org/2001/XInclude;
 py:strip=

  !--! Add modification sections below --

  /html

  = End cut

 Oops. Seems I shortened and changed the orgiginal from
 TracInterfaceCustomisation a bit too much... I also chops the Ticket
 properties form when viewing tickets... :-)

 For reference, here is the full (working) section as found on t.e.o -
 put this inside the site.html html tag instead:

 form py:match=[EMAIL PROTECTED]'content' and @class='ticket']/form
 py:attrs=select('@*')
   py:if test=req.environ['PATH_INFO'] == '/newticket' and (not
 'preview' in req.args)
 pPlease make sure to search for existing tickets before
 reporting a new one!/p
   /py:if
   ${select('*')}
 /form

 :::simon

 https://www.coderesort.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Trac 
Users group.
To post to this group, send email to trac-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en
-~--~~~~--~~--~--~---



[Trac] Re: displaying custom warning message on new ticket page.

2008-01-29 Thread [EMAIL PROTECTED]

Impossible :-) ... I've just washed my glasses and still see what
I described before...
Here's my trac about :
Trac:   0.11b1
Python: 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit
(Intel)]
setuptools: 0.6c7
SQLite: 3.3.4
pysqlite:   2.3.2
Genshi: 0.5dev-r789
Pygments:   0.9
Subversion: 1.4.6 (r28521)
jQuery: 1.2.1

And I'm using only one additional plugin which is AccountManager...
Can't understand what happens then...

On 29 jan, 15:58, osimons [EMAIL PROTECTED] wrote:
 On Jan 29, 3:17 pm, [EMAIL PROTECTED] [EMAIL PROTECTED]
 wrote:

  I tried your update but there is still a problem :
  The Trac Logo and Powered by Trac 0.11b1 ...By Edgewall Software.
  label are located on top of Create a new ticket : the footer seems
  to be before the form...

 That is... impossible :-) I have no idea how that snippet could ever
 manage that. Is your Genshi up-to-date - from trunk? Any other
 modifications or plugins that change the layout and ordering of that
 page?

 I've used it for a long time without issues. Anyone else using the
 snippet: feel free to chime in with your experience of using it.

  I would be very interested in teo's site.html ...

 t.e.o is still on 0.10, so that is the old way of site_newticket.cs in
 templates folder.

 :::simon

 https://www.coderesort.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Trac 
Users group.
To post to this group, send email to trac-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en
-~--~~~~--~~--~--~---



[Trac] Re: displaying custom warning message on new ticket page.

2008-01-28 Thread [EMAIL PROTECTED]

Ok thanks a lot Simon. I followed your link explanations : the warning
is welle displayed but on top of the page (before logo !) and not
under the Create new ticket label. I 've never used templates...
Could you please tell me how to do ? Is it a css property to set up
(I d'ont think so) 

THanks a lot !
Pierre

On 28 jan, 14:49, osimons [EMAIL PROTECTED] wrote:
 [EMAIL PROTECTED] wrote:
  Hi,

  When accessing the new ticket page of the Trac web site :
 http://trac.edgewall.org/newticket, a warning window is displayed on
  top of the new ticket description You are about to file a ticket
  against Trac (...) 
  I would like to implement the same on my system based on Trac 0.11b1.
  Where do I have to add this warning ? Templates ?

  thanks a lot for your help !

  Pierre

 There is an example snippet for including in a project templates/
 site.html at:

 http://trac.edgewall.org/wiki/TracInterfaceCustomization#SiteAppearance

 :::simon

 https://www.coderesort.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Trac 
Users group.
To post to this group, send email to trac-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en
-~--~~~~--~~--~--~---



[Trac] Re: displaying custom warning message on new ticket page.

2008-01-28 Thread osimons



[EMAIL PROTECTED] wrote:
 Hi,

 When accessing the new ticket page of the Trac web site :
 http://trac.edgewall.org/newticket , a warning window is displayed on
 top of the new ticket description You are about to file a ticket
 against Trac (...) 
 I would like to implement the same on my system based on Trac 0.11b1.
 Where do I have to add this warning ? Templates ?

 thanks a lot for your help !

 Pierre

There is an example snippet for including in a project templates/
site.html at:

http://trac.edgewall.org/wiki/TracInterfaceCustomization#SiteAppearance


:::simon

https://www.coderesort.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Trac 
Users group.
To post to this group, send email to trac-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en
-~--~~~~--~~--~--~---



[Trac] Re: displaying custom warning message on new ticket page.

2008-01-28 Thread osimons

[EMAIL PROTECTED] wrote:
 Ok thanks a lot Simon. I followed your link explanations : the warning
 is welle displayed but on top of the page (before logo !) and not
 under the Create new ticket label. I 've never used templates...
 Could you please tell me how to do ? Is it a css property to set up
 (I d'ont think so) 

 THanks a lot !
 Pierre

 On 28 jan, 14:49, osimons [EMAIL PROTECTED] wrote:
  There is an example snippet for including in a project templates/
  site.html at:
 
  http://trac.edgewall.org/wiki/TracInterfaceCustomization#SiteAppearance
 

The basic principle is that the site.html is one file to contain all
your modifications. It usually works by the py:match (element of
attribute), and it allows you to modify the page as it renders - the
matches hook onto specific sections depending on what it tries to find
and modify. A site.html can contain any number of such py:match
sections for whatever you need to modify. This is all Genshi, so the
docs on the templating system can be found there.

Save the following content as 'site.html' inside your projects
templates directory (each Trac project can have their own site.html),
or in a shared location as specified by the '[inherit] templates_dir
=' setting in the project trac.ini:

 Start cut

html xmlns=http://www.w3.org/1999/xhtml;
   xmlns:py=http://genshi.edgewall.org/;
   xmlns:xi=http://www.w3.org/2001/XInclude;
   py:strip=

!--! Add modification sections below --

form py:match=[EMAIL PROTECTED]'content' and @class='ticket']/form
  py:attrs=select('@*')
  py:if=req.environ['PATH_INFO']=='/newticket' and not 'preview' in
req.args
!-- Custom new ticket text goes here - example: --
pPlease make sure to search for existing tickets
   before reporting a new one!/p
  ${select('*')}
/form

/html

= End cut

As a very quick intro to the templating details, here is what happens
on a general level:
- templates are just named, and will be pulled in where they are first
located on template path
- the main layout.html renders and 'pulls in' the specific template
(like ticket.html) to make the full page
- as it gets to the bottom of layout.html, it does an include call for
site.html
- site.html contains modification(s) that change the almost-completed
html page (stream)
- at the end the page is finished and sent to the user.

Now to the details of what this modification does:
- py:if = it is only interested in ticket.html template, and not
diplay in preview
- py:match = XPath query find the position of modification start - it
grabs the form on the page
- the newticket modification is itself a form, and gets inserted into
the page instead of the existing form
- this new form has information text, but is otherwise an empty form
(not very useful)
- py:attrs = select and use in new form all the orgininal form
attributes
- ${select('*')} = insert all elements (wildcard, so all content) from
original form

= So, basically you have a new form replacing the orginal form, but
it pulls in the original attributes and the original content, but
manages to insert some informational text in the process.

Once you grasp the basics, it makes perfect sense. It is an incredibly
poweful way of doing page modifications - anything can be changed,
added and removed; all without the need to modify any of the default
Trac templates directly. And, it works just the same for any plugin
templates for that matter.


:::simon

https://www.coderesort.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Trac 
Users group.
To post to this group, send email to trac-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en
-~--~~~~--~~--~--~---