| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | $Rev$ | $LastChangedBy$ |
|---|
| 4 | $LastChangedDate$ |
|---|
| 5 | +-------------------------------------------------------------------------+ |
|---|
| 6 | | Copyright (c) 2004 - 2010, Kreotek LLC | |
|---|
| 7 | | All rights reserved. | |
|---|
| 8 | +-------------------------------------------------------------------------+ |
|---|
| 9 | | | |
|---|
| 10 | | Redistribution and use in source and binary forms, with or without | |
|---|
| 11 | | modification, are permitted provided that the following conditions are | |
|---|
| 12 | | met: | |
|---|
| 13 | | | |
|---|
| 14 | | - Redistributions of source code must retain the above copyright | |
|---|
| 15 | | notice, this list of conditions and the following disclaimer. | |
|---|
| 16 | | | |
|---|
| 17 | | - Redistributions in binary form must reproduce the above copyright | |
|---|
| 18 | | notice, this list of conditions and the following disclaimer in the | |
|---|
| 19 | | documentation and/or other materials provided with the distribution. | |
|---|
| 20 | | | |
|---|
| 21 | | - Neither the name of Kreotek LLC nor the names of its contributore may | |
|---|
| 22 | | be used to endorse or promote products derived from this software | |
|---|
| 23 | | without specific prior written permission. | |
|---|
| 24 | | | |
|---|
| 25 | | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
|---|
| 26 | | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
|---|
| 27 | | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | |
|---|
| 28 | | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
|---|
| 29 | | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
|---|
| 30 | | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
|---|
| 31 | | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
|---|
| 32 | | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
|---|
| 33 | | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
|---|
| 34 | | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
|---|
| 35 | | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
|---|
| 36 | | | |
|---|
| 37 | +-------------------------------------------------------------------------+ |
|---|
| 38 | */ |
|---|
| 39 | |
|---|
| 40 | include("../../include/session.php"); |
|---|
| 41 | include("include/tables.php"); |
|---|
| 42 | include("include/fields.php"); |
|---|
| 43 | include("include/tabledefs.php"); |
|---|
| 44 | |
|---|
| 45 | $thetable = new tableDefinitions($db, "tbld:5c9d645f-26ab-5003-b98e-89e9049f8ac3"); |
|---|
| 46 | $therecord = $thetable->processAddEditPage(); |
|---|
| 47 | |
|---|
| 48 | if(isset($therecord["phpbmsStatus"])) |
|---|
| 49 | $statusmessage = $therecord["phpbmsStatus"]; |
|---|
| 50 | |
|---|
| 51 | |
|---|
| 52 | $pageTitle="Table Definition"; |
|---|
| 53 | |
|---|
| 54 | $phpbms->cssIncludes[] = "pages/tabledefs.css"; |
|---|
| 55 | $phpbms->jsIncludes[] = "modules/base/javascript/tabledefs.js"; |
|---|
| 56 | |
|---|
| 57 | //Form Elements |
|---|
| 58 | //============================================================== |
|---|
| 59 | $theform = new phpbmsForm(); |
|---|
| 60 | |
|---|
| 61 | $theinput = new inputBasicList ("type",$therecord["type"],$list = array("table"=>"table","view"=>"view","system"=>"system")); |
|---|
| 62 | $theinput->setAttribute("class","important"); |
|---|
| 63 | $theform->addField($theinput); |
|---|
| 64 | |
|---|
| 65 | $theinput = new inputCheckbox("canpost",$therecord["canpost"],"can post records"); |
|---|
| 66 | $theform->addField($theinput); |
|---|
| 67 | |
|---|
| 68 | $theinput = new inputCheckbox("hascustomfields",$therecord["hascustomfields"],"has custom fields"); |
|---|
| 69 | $theform->addField($theinput); |
|---|
| 70 | |
|---|
| 71 | $theinput = new inputCheckbox("apiaccessible",$therecord["apiaccessible"],"api accessible"); |
|---|
| 72 | $theform->addField($theinput); |
|---|
| 73 | |
|---|
| 74 | $theinput = new inputDataTableList($db, "moduleid", $therecord["moduleid"], "modules", "uuid", "displayname", |
|---|
| 75 | "", "", false, "module"); |
|---|
| 76 | $theform->addField($theinput); |
|---|
| 77 | |
|---|
| 78 | $theinput = new inputField("displayname",$therecord["displayname"],"display name",true,NULL,50,64,false); |
|---|
| 79 | $theinput->setAttribute("class","important"); |
|---|
| 80 | $theform->addField($theinput); |
|---|
| 81 | |
|---|
| 82 | $theinput = new inputField("prefix", $therecord["prefix"], "uuid prefix", false, NULL, 10, 4); |
|---|
| 83 | $theform->addField($theinput); |
|---|
| 84 | |
|---|
| 85 | $theinput = new inputField("maintable",$therecord["maintable"],"primary table name",true,NULL,50,64); |
|---|
| 86 | $theform->addField($theinput); |
|---|
| 87 | |
|---|
| 88 | $theinput = new inputField("importfile",$therecord["importfile"],"import records file",false,NULL,100,128); |
|---|
| 89 | $theform->addField($theinput); |
|---|
| 90 | |
|---|
| 91 | $theinput = new inputRolesList($db,"importroleid",$therecord["importroleid"],"import access (role)"); |
|---|
| 92 | $theform->addField($theinput); |
|---|
| 93 | |
|---|
| 94 | $theinput = new inputField("addfile",$therecord["addfile"],"add new record file",true,NULL,100,128); |
|---|
| 95 | $theform->addField($theinput); |
|---|
| 96 | |
|---|
| 97 | $theinput = new inputRolesList($db,"addroleid",$therecord["addroleid"],"add access (role)"); |
|---|
| 98 | $theform->addField($theinput); |
|---|
| 99 | |
|---|
| 100 | $theinput = new inputField("editfile",$therecord["editfile"],"edit record file",true,NULL,100,128); |
|---|
| 101 | $theform->addField($theinput); |
|---|
| 102 | |
|---|
| 103 | $theinput = new inputRolesList($db,"editroleid",$therecord["editroleid"],"edit access (role)"); |
|---|
| 104 | $theform->addField($theinput); |
|---|
| 105 | |
|---|
| 106 | $theinput = new inputRolesList($db,"searchroleid",$therecord["searchroleid"],"search access (role)"); |
|---|
| 107 | $theform->addField($theinput); |
|---|
| 108 | |
|---|
| 109 | $theinput = new inputRolesList($db,"advsearchroleid",$therecord["advsearchroleid"],"advanced search access (role)"); |
|---|
| 110 | $theform->addField($theinput); |
|---|
| 111 | |
|---|
| 112 | $theinput = new inputRolesList($db,"viewsqlroleid",$therecord["viewsqlroleid"],"view SQL statement access (role)"); |
|---|
| 113 | $theform->addField($theinput); |
|---|
| 114 | |
|---|
| 115 | $thetable->getCustomFieldInfo(); |
|---|
| 116 | $theform->prepCustomFields($db, $thetable->customFieldsQueryResult, $therecord); |
|---|
| 117 | $theform->jsMerge(); |
|---|
| 118 | //============================================================== |
|---|
| 119 | //End Form Elements |
|---|
| 120 | |
|---|
| 121 | $phpbms->topJS[] = "requiredArray[requiredArray.length]=new Array('querytable','Search/Display SQL FROM clause cannot be blank.');"; |
|---|
| 122 | $phpbms->topJS[] = "requiredArray[requiredArray.length]=new Array('defaultwhereclause','default search cannot be blank.');"; |
|---|
| 123 | $phpbms->topJS[] = "requiredArray[requiredArray.length]=new Array('defaultsortorder','default sort order cannot be blank.');"; |
|---|
| 124 | |
|---|
| 125 | include("header.php"); |
|---|
| 126 | |
|---|
| 127 | $phpbms->showTabs("tabledefs entry","tab:fdf064e0-f2d9-6c67-b64f-449e72e859b9",$therecord["id"]); |
|---|
| 128 | ?><div class="bodyline"> |
|---|
| 129 | <?php $theform->startForm($pageTitle)?> |
|---|
| 130 | |
|---|
| 131 | <fieldset id="fsAttributes"> |
|---|
| 132 | <legend>attributes</legend> |
|---|
| 133 | |
|---|
| 134 | <p><?php $theform->showField("type"); ?></p> |
|---|
| 135 | |
|---|
| 136 | <p><?php $theform->showField("moduleid");?></p> |
|---|
| 137 | |
|---|
| 138 | <p> |
|---|
| 139 | <label for="deletebutton">delete record display name</label><br /> |
|---|
| 140 | <input id="deletebutton" name="deletebutton" type="text" value="<?php echo htmlQuotes($therecord["deletebutton"])?>" size="20" maxlength="20" /><br /> |
|---|
| 141 | </p> |
|---|
| 142 | |
|---|
| 143 | <p><?php $theform->showField("canpost");?></p> |
|---|
| 144 | |
|---|
| 145 | <p><?php $theform->showField("hascustomfields");?></p> |
|---|
| 146 | |
|---|
| 147 | <p><?php $theform->showField("apiaccessible"); ?></p> |
|---|
| 148 | |
|---|
| 149 | </fieldset> |
|---|
| 150 | |
|---|
| 151 | <div id="leftSideDiv"> |
|---|
| 152 | <fieldset> |
|---|
| 153 | <legend><label for="displayname">name</label></legend> |
|---|
| 154 | <p class="big"><?php $theform->showField("displayname"); ?></p> |
|---|
| 155 | |
|---|
| 156 | <p><?php $theform->showField("prefix"); ?></p> |
|---|
| 157 | </fieldset> |
|---|
| 158 | |
|---|
| 159 | <fieldset> |
|---|
| 160 | <legend>SQL table</legend> |
|---|
| 161 | |
|---|
| 162 | <p><?php $theform->showField("maintable") ?></p> |
|---|
| 163 | |
|---|
| 164 | <p> |
|---|
| 165 | <label for="querytable">search/display SQL FROM clause</label><br /> |
|---|
| 166 | <textarea id="querytable" name="querytable" rows="2" cols="48"><?php echo htmlQuotes($therecord["querytable"])?></textarea><br /> |
|---|
| 167 | </p> |
|---|
| 168 | |
|---|
| 169 | <p class="notes"> |
|---|
| 170 | <strong>Note:</strong> For simple tables, entering the same information as the primary table name is sufficient. |
|---|
| 171 | For complex data views that involve multiple tables, you will want to enter the SQL's FROM clause. |
|---|
| 172 | </p> |
|---|
| 173 | <p class="notes"> |
|---|
| 174 | For example, for invoices, you want to show both the invoice information and the client's name, so you would enter:<br /><br /> |
|---|
| 175 | invoices INNER JOIN clients ON invoices.clientid=clients.id |
|---|
| 176 | </p> |
|---|
| 177 | </fieldset> |
|---|
| 178 | |
|---|
| 179 | <fieldset> |
|---|
| 180 | <legend>Adding Records</legend> |
|---|
| 181 | <p> |
|---|
| 182 | <?php $theform->showField("addfile");?><br /> |
|---|
| 183 | <span class="notes">file name, including path from application root, that is used for creating new records.</span> |
|---|
| 184 | </p> |
|---|
| 185 | |
|---|
| 186 | <p><?php $theform->showField("addroleid");?></p> |
|---|
| 187 | </fieldset> |
|---|
| 188 | |
|---|
| 189 | <fieldset> |
|---|
| 190 | <legend>Editing Records</legend> |
|---|
| 191 | |
|---|
| 192 | <p> |
|---|
| 193 | <?php $theform->showField("editfile");?><br /> |
|---|
| 194 | <span class="notes">file name, including path from application root, that is used for editing existing records.</span> |
|---|
| 195 | </p> |
|---|
| 196 | |
|---|
| 197 | <p><?php $theform->showField("editroleid");?></p> |
|---|
| 198 | </fieldset> |
|---|
| 199 | |
|---|
| 200 | <fieldset> |
|---|
| 201 | <legend>Importing Records</legend> |
|---|
| 202 | <p> |
|---|
| 203 | <?php $theform->showField("importfile") ?><br /> |
|---|
| 204 | <span class="notes">file name, including path from application root, that is used for importing records. If none |
|---|
| 205 | is specified, the general import for the table def will be used. This may not always result in accurate imports for |
|---|
| 206 | the more complicated table definitions.</span> |
|---|
| 207 | </p> |
|---|
| 208 | |
|---|
| 209 | <p><?php $theform->showField("importroleid") ?></p> |
|---|
| 210 | </fieldset> |
|---|
| 211 | |
|---|
| 212 | <fieldset> |
|---|
| 213 | <legend>search screen access</legend> |
|---|
| 214 | |
|---|
| 215 | <p><?php $theform->showField("searchroleid")?></p> |
|---|
| 216 | |
|---|
| 217 | <p><?php $theform->showField("advsearchroleid")?></p> |
|---|
| 218 | |
|---|
| 219 | <p><?php $theform->showField("viewsqlroleid")?></p> |
|---|
| 220 | </fieldset> |
|---|
| 221 | |
|---|
| 222 | <fieldset> |
|---|
| 223 | <legend>search screen defaults</legend> |
|---|
| 224 | <p> |
|---|
| 225 | <label for="defaultwhereclause">default search</label> <span class="notes">(SQL WHERE clause)</span><br /> |
|---|
| 226 | <textarea id="defaultwhereclause" name="defaultwhereclause" cols="32" rows="4"><?php echo htmlQuotes($therecord["defaultwhereclause"])?></textarea> |
|---|
| 227 | </p> |
|---|
| 228 | |
|---|
| 229 | <p> |
|---|
| 230 | <label for="defaultsortorder">default sort order</label> <span class="notes">(SQL ORDER BY clause)</span><br /> |
|---|
| 231 | <textarea id="defaultsortorder" name="defaultsortorder" cols="32" rows="4"><?php echo htmlQuotes($therecord["defaultsortorder"])?></textarea> |
|---|
| 232 | </p> |
|---|
| 233 | <p> |
|---|
| 234 | Does the default search (above) correspond to a quick search (find drop down) item?<br /> |
|---|
| 235 | <input type="radio" id="defaultsearchtypeNone" name="defaultsearchtype" class="radiochecks" value="" <?php if($therecord["defaultsearchtype"]=="") echo "checked=\"checked\""?> onchange="toggleDefaultSearch()" /> |
|---|
| 236 | <label for="defaultsearchtypeNone">no</label> |
|---|
| 237 | |
|---|
| 238 | <input type="radio" id="defaultsearchtypeSearch" name="defaultsearchtype" class="radiochecks" value="search" <?php if($therecord["defaultsearchtype"]=="search") echo "checked=\"checked\""?> onchange="toggleDefaultSearch()" /> |
|---|
| 239 | <label for="defaultsearchtypeNone">yes</label> |
|---|
| 240 | </p> |
|---|
| 241 | <div id="defaultQuickSearch" <?php if($therecord["defaultsearchtype"]=="") echo "style=\"display:none;\""?>> |
|---|
| 242 | <p> |
|---|
| 243 | <label for="defaultcriteriafindoptions">criteria: selected find option</label> <span class="notes">(quick search)</span><br/> |
|---|
| 244 | <textarea id="defaultcriteriafindoptions" name="defaultcriteriafindoptions" cols="32" rows="2"><?php echo htmlQuotes($therecord["defaultcriteriafindoptions"])?></textarea> |
|---|
| 245 | |
|---|
| 246 | </p> |
|---|
| 247 | <p> |
|---|
| 248 | <label for="defaultcriteriaselection">criteria: selected search field</label><br /> |
|---|
| 249 | <textarea id="defaultcriteriaselection" name="defaultcriteriaselection" cols="32" rows="2" ><?php echo htmlQuotes($therecord["defaultcriteriaselection"])?></textarea> |
|---|
| 250 | </p> |
|---|
| 251 | </div> |
|---|
| 252 | </fieldset> |
|---|
| 253 | |
|---|
| 254 | <?php $theform->showCustomFields($db, $thetable->customFieldsQueryResult) ?> |
|---|
| 255 | |
|---|
| 256 | </div> |
|---|
| 257 | |
|---|
| 258 | <?php |
|---|
| 259 | $theform->showGeneralInfo($phpbms,$therecord); |
|---|
| 260 | $theform->endForm(); |
|---|
| 261 | ?> |
|---|
| 262 | </div> |
|---|
| 263 | <?php include("footer.php");?> |
|---|