Commit 63fe4978fa6d2182a4325b0027bac617e93b8c0c

Authored by omar
1 parent f3be0926

Added email address dropdown functionality


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1789 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/documentmanagement/emailBL.php
... ... @@ -55,7 +55,8 @@ if (checkSession()) {
55 55  
56 56  
57 57 $oPatternCustom = & new PatternCustom();
58   - $oPatternCustom->setHtml(getDocumentEmailPage($oDocument));
  58 + $oUserArray = User::getList();
  59 + $oPatternCustom->setHtml(getDocumentEmailPage($oDocument,$oUserArray));
59 60 $main->setErrorMessage("The email address you entered was invalid. Please enter<br> " .
60 61 "an email address of the form someone@somewhere.some postfix");
61 62 $main->setFormAction($_SERVER["PHP_SELF"] . "?fDocumentID=$fDocumentID&fSendEmail=1");
... ... @@ -67,9 +68,10 @@ if (checkSession()) {
67 68 //ask for an email address
68 69 require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
69 70 require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc");
70   -
  71 +
  72 + $oUserArray = User::getList();
71 73 $oPatternCustom = & new PatternCustom();
72   - $oPatternCustom->setHtml(getDocumentEmailPage($oDocument));
  74 + $oPatternCustom->setHtml(getDocumentEmailPage($oDocument,$oUserArray));
73 75 $main->setCentralPayload($oPatternCustom);
74 76 $main->setFormAction($_SERVER["PHP_SELF"] . "?fDocumentID=$fDocumentID&fSendEmail=1");
75 77 $main->render();
... ...
presentation/lookAndFeel/knowledgeTree/documentmanagement/emailUI.inc
... ... @@ -28,13 +28,25 @@ function getDocumentPath($oDocument) {
28 28 return "<table border=\"0\" width = 100%><tr><td bgcolor=\"$sTDBGColour\">$sDocumentPath</td></tr></table>\n";
29 29 }
30 30  
31   -function getDocumentEmailPage($oDocument) {
  31 +function getDocumentEmailPage($oDocument,$oUserArray) {
32 32 global $default;
33 33 $sToRender = renderHeading("Email document link");
34 34 $sToRender .= getDocumentPath($oDocument) . "\n<br>\n";
35   - $sToRender .= "<table>\n";
36   - $sToRender .= "<tr><td>Recipient name:</td><td><input type=\"text\" name=\"fToName\" /></td></tr>\n";
37   - $sToRender .= "<tr><td>Email address:</td><td><input type=\"text\" name=\"fToEmail\" />(separate multiple addresses with a semicolon)</td></tr>\n";
  35 + $sToRender .= "<table>\n";
  36 + $sToRender .= "<tr><td>Recipient name:</td><td>\n";
  37 + $sToRender .= "<select name=\"UserSelect\" id=\"UserSelect\" onchange=\"javascript: var sColon; var oTemp = document.getElementsByName('fToEmail')[0]; if(oTemp.value.length>0) sColon=';'; else sColon=''; if (this.value!=1 && this.value!='' && this.value!=' ') {oTemp.value=oTemp.value + sColon + this.value ;}\">\n";
  38 + $sToRender .= "<OPTION value=\"1\">\n";
  39 + $sToRender .= "Select email adresses</OPTION>\n";
  40 + for ($i = 0; $i < count($oUserArray); $i++) {
  41 + if(strlen($oUserArray[$i]->getEmail())>0){ // if an amil address exists
  42 + $sToRender .= "<OPTION value=\"" . $oUserArray[$i]->getEmail() . "\" onclick=\"document.fToEmail.value=document.fToEmail.value + ;\" >\n";
  43 + $sToRender .= $oUserArray[$i]->getName();
  44 + $sToRender .= "</OPTION>\n";
  45 + }
  46 + }
  47 + $sToRender .= "</select></td></tr>\n";
  48 + $sToRender .= "<tr><td>Email address:</td><td><input type=\"text\" name=\"fToEmail\" style=\"width:270\"/></td><td><img src=\"$default->graphicsUrl/widgets/clear.gif\" onclick=\"document.getElementsByName('fToEmail')[0].value='';document.getElementsByName('UserSelect')[0].selectedIndex=0\" onmouseover=\"this.style.cursor='hand'\"></td></tr>\n";
  49 + $sToRender .= "<tr><td></td><td>(separate multiple addresses with a semicolon)</td></tr>";
38 50 $sToRender .= "<tr><td>&nbsp</td><td>&nbsp</td></tr>\n";
39 51 $sToRender .= "<tr><td><table><tr><td><input type=\"image\" src=\"$default->graphicsUrl/widgets/email.gif\" border=\"0\"/></td><td><a href=\"$default->rootUrl/control.php?action=viewDocument&fDocumentID=" . $oDocument->getID() . "\"><img src=\"$default->graphicsUrl/widgets/cancel.gif\" border=\"0\"/></a></td></tr></table></td>\n";
40 52 $sToRender .= "</table>\n";
... ...