Documentation >> Outline of How-To Docs >> How-To Add Labels To Query Pages
Content
If the labels aren't already displayed in your Query page, we'll see here how to add them. If you're using several Query pages, you'll have to do this for each of them.
Depending on the case we'll:
Decide What To Do
As for the DG Calendar Page, the first thing to ask is "did you modify the page's templates?" The FullThread pages have three templates called Form Template, Page Template and Item Template. These templates are located at:
"/yourSite/admins/conversation/yourSite/structure$path=yourSite%2FpageName"
... where pageName defaults to "query".
Did you edit them?
Reset The Query Page
Resetting the Query page will allow you to get the new default templates. If you use your own templates, you certainly don't want to overwrite them. In this case, jump to Editing The Templates.
- If you're not already there, go to:
"/yourSite/admins/conversation/yourSite/structure$path=yourSite%2FpageName"
- Look at the current settings of your Query page (like the stylesheet, the Javascript or the magicNavbars it uses). If needed, write them down. You'll have to restore your own settings.
- Scroll the page all the way down and click on Delete.
- You'll be prompted to confirm. Make sure you're not deleting the wrong page and click on OK. The page will be deleted and you'll be returned to the listing of the folder which contained it.
- Scroll the window all the way down, to get the Add New File Or Folder form.
- In the Navigation Title field enter the name of your calendar page (by default it's "query"). Select "Query Page" in the File Type popup menu, and click on Add New File.
- When the page has reloaded, locate in the listing the page you just created, and click on its name.
- Then, you'll get the File Properties screen of that page, where you'll just have to restore your settings. A few choices in popup menus and text fields, and you're done.
- Finally, click on Change File Properties. That's it, the page will reload, confirming the changes, and you're done. Click on View Page, and enjoy using labels.
If you need to add labels to other areas of your conversation, see More Infos.
Edit the templates
Each Query page has three templates called Form Template, Page Template and Item Template.
They're located at:
"/yourSite/admins/conversation/yourSite/structure$path=yourSite%2FpageName"
(Again, pageName defaults to "query".) That's the templates we'll edit.
Form Template
This template is used to make the query form (where you enter the values to search for).
Macros
There's only one macro to use from this template (which, as usual, must be called in the form <!--#macroName-->):
- queryLabel
This will be replaced with a label popup menu if the user is allowed to see the labels (see labels' preferences). The content of this menu will also depend on the labels' access properties and on the user's access rights (that is an "admin-only" label won't be in the menu when a simple member sees it).
Example
Here's what we added to the default Form Template:
<tr>
<th nowrap align='right' valign='middle' class='msgLabelCell'><span class='msgLabelText'>Label Is</span></th>
<td valign='top' class='msgValueCell'><span class='msgValueText'>
<!--#queryLabel-->
</span></td>
</tr>
Page Template
This template contains (amongst other things) the header of the search result html table (where are the links to sort the result). We'll add one more column to this table header.
Macros
Here too, there's only one macro to use:
- searchResultLabelLink
For users allowed to see the labels, this will be replaced with an opening <a> tag that will make a link allowing to sort the search result by label. For users not allowed to see the labels, this will be replaced with a fake link, pointing to the same page. Note that the template is assumed to contain the closing </a> tag. This allows you to localize "Label", for example.
Example
Here's what we added to the default Page Template:
<th nowrap align='center' valign='middle' class='listDayHeaderCell'>
<!--#searchResultLabelLink--><span class='listDayHeaderText'>Label</span></a>
</th>
Note that if your template is based on the default one, you'll have to increase a couple of colspan by one.
Item Template
This template is used for each message displayed in a search result.
Macros
Here are the macros you may call from this template. As always, macro calls are on the form "<!--#macroName-->".
- searchResultMsgLabel
This will be replaced with a colored block (colored with the label's color, of course). You may use it alone.
- searchResultMsgLabelColor
This will be simply replaced with the label's color. Use it if you want to display the label's name on its background, for example.
- searchResultMsgLabelTextColor
This will be simply replaced with the label's text color. You may call it from a <font> tag, for example.
- searchResultMsgLabelName
This will be replaced with the label's name.
- searchResultLabelId
This will be replaced with the label's id (its unique, non editable identifier).
Example
Here's what we added to the default Item Template:
<td class='listDayCell' nowrap align='center' valign='middle'>
<span class='listDayText'><b> <!--#searchResultMsgLabel--></b></span>
</td>
When you're done editing the templates (and pasting them back in the File Properties screen if you edited them in an external text editor), click on Change File Properties. The page will reload, confirming the changes.
That's it, you're done. Click on View Page an enjoy using labels.
More Infos
If you're adding labels to your whole conversation, you may want to go back to the labels documentation, where you'll find links to the other How-To's about labels.
If you need more infos about the Query Page, see the Query Pages documentation.
View in DG
|