Free-Conversant Support / How-To Add Labels To DG Messages
 Home   About Conversant   Free Sites   Hosting   Support   XML-RPC 

Search



Documentation >> Outline of How-To Docs >> How-To Add Labels To DG Messages

Content

If labels aren't already displayed in your DG messages, we'll see here how to add them. To do this, we'll:

  1. Identify the templates to edit
  2. Edit the Message Editing Template
  3. Edit the Message Viewing Template
  4. Find More Infos

Identify the Templates To Edit

First you must know which templates are used to display your DG messages, in editing and in viewing modes. If you're not sure, go to:

"/yourSite/admin/conversations/yourSite/preferences$conversation=yourSite&plugin=mainResponder&plugin=Default%20DG"

Scroll the window down until you find the "2. Appearance" section and look at the Message Edit Template and Message View Template preferences.

  • If they're set to "Default", the labels are already displayed in your messages.
  • If they're not set to "Default", they give you the name of the templates you'll have to edit.

Edit The Message Editing Template

We'll start with the template for editing mode (that is the template used to build the screen where you enter the message's subject, body, etc.)

Go to "/yourSite/admin/conversations/free-conversant/templates".

Locate in the listing the name of that template (the one that was in the Message Edit Template preference field, for example, "Styled Message Editing") and click on it.

The template will be displayed in a text area. Since it may be pretty large, it will be easier to edit in a text editor that doesn't force the text to wrap (like BBEdit). Copy the template's text and paste it into such a text editor's document.

Macros

There are several macros you may call from this template (using the usual simple macro form: <!--#macroName-->):

  • msgLabelCellStyle
    This macro is assumed to be called from a <td> tag. It will return either a bgcolor attribute with the label's color, or a CSS class attribute if the message doesn't have a label yet. It's effect is to make the whole background of the label field in the label's own color.
  • msgLabelColor
    This macro will simply return the label's color. You may use it if you prefer to use a different way than msgLabelCellStyle to show the label's color.
  • msgLabelPopup
    This will be replaced with the popup menu that allows admins and editors to set the messages' label. Other users won't see this popup menu.
  • msgLabelName
    This will be replaced with the label's name for users that are allowed to see labels (see Viewers) but that aren't allowed to set labels (non-admins and non-editors). Admins and Editors will see the popup menu instead, so for them this macro will return an empty string.
  • msgLabelTextStyle
    This macro is assumed to be called from a <font> tag put around the msgLabelName macro call. It will return a color attribute with the label's text color, or an empty string if there's no label. Since msgLabelName will return an empty string to Admins and Editors, this macro won't affect what they see.
  • msgLabelTextColor
    This macro will simply return the label's text color. You may use it if you prefer to use a different way than msgLabelTextStyle to set the color of the label name.
  • msgLabelId
    This will be replaced with the label's id (its unique, non editable identifier).

Example

For example, here's what we added to the Styled Message Editing template:

<tr>
	<td class='msgLabelCell' align='right' nowrap>
		<span class='msgLabelText'>Label</span>
		</td>
	<td <!--#msgLabelCellStyle--> align='left' nowrap>
		<span class='msgValueText'><!--#msgLabelPopup--><font <!--#msgLabelTextStyle-->><!--#msgLabelName--></font></span>
		</td>
	</tr>

When you're done editing the template, paste it back into the "Edit Template" text area of the Templates screen, and click on "Save Template".

Checking

Now go to your conversation, and create a new message or edit and existing one. In editing mode, you should now see the labels popup menu. While you're there, give a label to this message and click on "Submit Changes". If you don't see the label in the message in view mode, don't worry, we'll add it in a moment. But click on Edit to see the message in editing mode again. Now that it has a label, its color should be displayed. With the example above, the whole label cell's background has the color defined in the label.

Edit The Message Viewing Template

Here we'll edit the template which is used to display the DG messages in view mode.

If you're not already in a templates screen, go to:

"/yourSite/admin/conversations/free-conversant/templates"

Locate in the listing the name of the template (the one that was in the Message View Template preference field, for example, "Styled Message Viewing") and click on it.

The template will be displayed in a text area. Again, it may be easier to edit the template in a text editor that doesn't force the text to wrap.

Macros

There are several macros you may call from this template (still using the usual simple macro form: <!--#macroName-->). Note that these macros are the same as for the Message Editing Template. The only difference is that msgLabelPopup will always return an empty string.

  • msgLabelCellStyle
    This macro is assumed to be called from a <td> tag. It will return either a bgcolor attribute with the label's color, or a CSS class attribute if the message doesn't have a label yet. It's effect is to make the whole background of the label field in the label's own color.
  • msgLabelColor
    This macro will simply return the label's color. You may use it if you prefer to use a different way than msgLabelCellStyle to show the label's color.
  • msgLabelPopup
    This macro is assumed to be called from the Message Editing Template. It may be called from the Message Viewing Template too, but here, it will always return an empty string.
  • msgLabelName
    This will be replaced with the label's name for users that are allowed to see labels (see Viewers).
  • msgLabelTextStyle
    This macro is assumed to be called from a <font> tag put around the msgLabelName macro call. It will return a color attribute with the label's text color, or an empty string if there's no label. Since msgLabelName will return an empty string to Admins and Editors, this macro won't affect what they see.
  • msgLabelTextColor
    This macro will simply return the label's text color. You may use it if you prefer to use a different way than msgLabelTextStyle to set the color of the label name.
  • msgLabelId
    This will be replaced with the label's id (its unique, non editable identifier).

Example

For example, here's what we added to the Styled Message Viewing template:

<tr>
	<td class='msgLabelCell' align='right' nowrap>
		<span class='msgLabelText'>Label</span>
		</td>
	<td <!--#msgLabelCellStyle--> align='left'>
		<span class='msgValueText'><font <!--#msgLabelTextStyle-->><!--#msgLabelName--></font></span>
		</td>
	</tr>

When you're done editing the template, paste it back into the "Edit Template" text area of the Templates screen, and click on "Save Template".

Checking

Now go back to your conversation, and request a message that has a label. In viewing mode, you should now see the labels color and name displayed in the message header.

Find More Infos

That's it, we've added the labels to your DG messages.

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 DG messages templates, see How To Edit Message Templates.

View in DG