Commit 257d83f7cf59a2b365f160fcbaacf751db9d75a0

Authored by nbm
1 parent a66d226d

Dynamically generate the groups and users given in the email view.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4734 c91229c3-7414-0410-bfa2-8a42b809f60b
plugins/ktstandard/KTEmail.php
@@ -210,9 +210,13 @@ class KTDocumentEmailAction extends KTDocumentAction { @@ -210,9 +210,13 @@ class KTDocumentEmailAction extends KTDocumentAction {
210 $fields[] = new KTCheckboxWidget(_("Attach document"), _("By default, documents are sent as links into the document management system. Select this option if you want the document contents to be sent as an attachment in the email."), 'fAttachDocument', null, $this->oPage); 210 $fields[] = new KTCheckboxWidget(_("Attach document"), _("By default, documents are sent as links into the document management system. Select this option if you want the document contents to be sent as an attachment in the email."), 'fAttachDocument', null, $this->oPage);
211 $fields[] = new KTTextWidget(_("Email addresses"), _("Add extra email addresses here"), 'fEmailAddresses', "", $this->oPage); 211 $fields[] = new KTTextWidget(_("Email addresses"), _("Add extra email addresses here"), 'fEmailAddresses', "", $this->oPage);
212 $fields[] = new KTTextWidget(_("Comment"), _("A message for those who receive the document"), 'fComment', "", $this->oPage, true); 212 $fields[] = new KTTextWidget(_("Comment"), _("A message for those who receive the document"), 'fComment', "", $this->oPage, true);
  213 + $aGroups = Group::getList();
  214 + $aUsers = User::getEmailUsers();
213 $aTemplateData = array( 215 $aTemplateData = array(
214 'context' => &$this, 216 'context' => &$this,
215 'fields' => $fields, 217 'fields' => $fields,
  218 + 'groups' => $aGroups,
  219 + 'users' => $aUsers,
216 ); 220 );
217 return $oTemplate->render($aTemplateData); 221 return $oTemplate->render($aTemplateData);
218 } 222 }
templates/ktstandard/action/email.smarty
@@ -45,22 +45,19 @@ addLoadEvent(kt_email_onload); @@ -45,22 +45,19 @@ addLoadEvent(kt_email_onload);
45 45
46 <table> 46 <table>
47 <tr><td valign="top" colspan="3"><strong>Groups</strong></td></tr><tr><td valign="top" width=1%> 47 <tr><td valign="top" colspan="3"><strong>Groups</strong></td></tr><tr><td valign="top" width=1%>
48 -<select name="groupSelect" size="4" multiple>  
49 -<OPTION value="3" onDblClick="optGroup.transferRight()" >  
50 -Anonymous</OPTION>  
51 -<OPTION value="4" onDblClick="optGroup.transferRight()" >  
52 -Stuff</OPTION>  
53 -<OPTION value="1" onDblClick="optGroup.transferRight()" >  
54 -System Administrators</OPTION>  
55 -<OPTION value="2" onDblClick="optGroup.transferRight()" >  
56 -Unit Administrators</OPTION>  
57 48
  49 +<select name="groupSelect" size="4" multiple>
  50 +{foreach from=$groups item=oGroup}
  51 +<OPTION value="{$oGroup->getId()}" onDblClick="optGroup.transferRight()" >{$oGroup->getName()}</OPTION>
  52 +{/foreach}
58 </select></td><td width=1%><input TYPE="button" NAME="right" VALUE="&gt;&gt;" ONCLICK="optGroup.transferRight()"><input TYPE="button" NAME="left" VALUE="&lt;&lt;" ONCLICK="optGroup.transferLeft()"></td><td><select name="chosenGroups" size="5" multiple><option>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option></select></td></tr> 53 </select></td><td width=1%><input TYPE="button" NAME="right" VALUE="&gt;&gt;" ONCLICK="optGroup.transferRight()"><input TYPE="button" NAME="left" VALUE="&lt;&lt;" ONCLICK="optGroup.transferLeft()"></td><td><select name="chosenGroups" size="5" multiple><option>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option></select></td></tr>
59 54
60 <tr><td colspan="3"><strong>Users</strong></td><tr> 55 <tr><td colspan="3"><strong>Users</strong></td><tr>
61 <tr><td><select name="userSelect" size="4" multiple> 56 <tr><td><select name="userSelect" size="4" multiple>
62 -<OPTION value="1" onDblClick="optUser.transferRight()">  
63 -Administrator</OPTION> 57 +{foreach from=$users item=oUser}
  58 +<OPTION value="{$oUser->getId()}" onDblClick="optUser.transferRight()">
  59 +{$oUser->getName()}</OPTION>
  60 +{/foreach}
64 </select></td><td><input TYPE="button" NAME="right" VALUE="&gt;&gt;" ONCLICK="optUser.transferRight()"><input TYPE="button" NAME="left" VALUE="&lt;&lt;" ONCLICK="optUser.transferLeft()"></td><td width="30%"><select name="chosenUsers" size="5" multiple><option>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option></select></td></tr> 61 </select></td><td><input TYPE="button" NAME="right" VALUE="&gt;&gt;" ONCLICK="optUser.transferRight()"><input TYPE="button" NAME="left" VALUE="&lt;&lt;" ONCLICK="optUser.transferLeft()"></td><td width="30%"><select name="chosenUsers" size="5" multiple><option>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option></select></td></tr>
65 62
66 </table> 63 </table>