- Timestamp:
- 03/05/09 17:32:04 (3 years ago)
- Location:
- branches/nathan
- Files:
-
- 16 modified
-
common/javascript/smartsearch.js (modified) (25 diffs)
-
common/stylesheet/mozilla/base.css (modified) (4 diffs)
-
common/stylesheet/mozilla/menu.css (modified) (6 diffs)
-
common/stylesheet/mozilla/pages/quickview.css (modified) (2 diffs)
-
common/stylesheet/mozilla/pages/snapshot.css (modified) (7 diffs)
-
include/fields.php (modified) (42 diffs)
-
include/jstransport.php (modified) (1 diff)
-
install/install_include.php (modified) (11 diffs)
-
modules/base/adminsettings.php (modified) (15 diffs)
-
modules/base/include/snapshot_include.php (modified) (2 diffs)
-
modules/base/javascript/snapshot.js (modified) (5 diffs)
-
modules/base/snapshot.php (modified) (3 diffs)
-
modules/bms/clients_credit.php (modified) (6 diffs)
-
modules/bms/install/updatev0.96.sql (modified) (1 diff)
-
report/report_class.php (modified) (1 diff)
-
smartsearch.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/nathan/common/javascript/smartsearch.js
r386 r450 38 38 39 39 smartSearch = { 40 40 41 41 displayValue: Array(), 42 42 43 43 triggerLookup: Array(), 44 44 … … 48 48 49 49 committedDisplayValue: Array(), 50 51 changeDisplay: function(e){ 50 51 changeDisplay: function(e){ 52 52 //this sets the time out to do an ajax lookup when they are done typing their search criteria. 53 53 54 54 var display = e.src(); 55 55 var ssID = display.id.substr(3); … … 57 57 if(!smartSearch.displayValue[ssID]) 58 58 smartSearch.displayValue[ssID] = ""; 59 59 60 60 var lookupValue = display.value.trim(); 61 61 62 62 if (lookupValue != smartSearch.displayValue[ssID] && lookupValue != ""){ 63 63 … … 66 66 67 67 smartSearch.triggerLookup[ssID] = window.setTimeout("smartSearch.lookup('"+ssID+"')",250); 68 68 69 69 } else { 70 70 //it's possible they hit the down, up arrow, or the return button … … 73 73 74 74 switch(key){ 75 75 76 76 case 40: 77 77 //move highlight down 78 78 smartSearch.moveSearchHighlight(ssID, "down"); 79 79 break; 80 80 81 81 case 38: 82 82 //move highlight down 83 83 smartSearch.moveSearchHighlight(ssID, "up"); 84 84 break; 85 85 86 86 case 27: 87 87 //cancel 88 88 smartSearch.cancelSearch(null, ssID); 89 89 90 90 }//endswitch 91 91 92 92 }//endif 93 93 94 94 },//end method 95 95 … … 98 98 99 99 lookup: function(ssID, offset){ 100 100 101 101 // We need to do an ajax lookup based on the criteria. 102 102 // Fisrt we need to see if the holding box is visible. 103 // if not we need to create it 103 // if not we need to create it 104 104 if (!smartSearch.searchBox[ssID]) 105 105 smartSearch.createSearchBox(ssID); 106 106 107 107 108 108 var sbResults = getObjectFromID("SBResults-" + ssID); … … 112 112 sbResults.style.height=""; 113 113 } 114 115 var closeButton = getObjectFromID("SBCloseButton-" + ssID); 114 115 var closeButton = getObjectFromID("SBCloseButton-" + ssID); 116 116 closeButton.className = "graphicButtons buttonSpinner"; 117 117 118 118 var searchDisplay = getObjectFromID("ds-" + ssID); 119 119 smartSearch.displayValue[ssID] = searchDisplay.value; 120 120 121 121 var sdbid = getObjectFromID("sdbid-" + ssID); 122 122 123 123 124 124 var theurl = APP_PATH + "smartsearch.php?sdbid=" + encodeURI(sdbid.value) + "&t=" + encodeURI(searchDisplay.value.trim()); 125 125 126 126 if(offset != 0) 127 127 theurl += "&o=" + offset; 128 128 129 129 if(!smartSearch.searchResultsConnects[ssID]) 130 130 smartSearch.searchResultsConnects[ssID] = Array(); … … 144 144 145 145 var numRecords = response.resultRecords.length 146 146 147 147 var totalRecords = response.totalRecords; 148 148 149 var newText=""; 149 var newText=""; 150 150 151 151 if(numRecords) { 152 for(var i=0; i<numRecords; i++){ 152 for(var i=0; i<numRecords; i++){ 153 153 154 154 newText += '\ … … 158 158 </a>'; 159 159 160 160 161 161 }//endfor 162 162 … … 167 167 <div id="SBMoreDiv-' + ssID + '">\ 168 168 <button type="button" id="SBMoreButton-' + ssID +'" class="smallButtons" name="' + (parseInt(offset) + parseInt(numRecords)) + '">more results...</button>\ 169 </div>'; 169 </div>'; 170 170 171 171 }//end if 172 172 173 173 } else { 174 174 175 175 newText = '<div>No Records Found Matching Criteria</div>'; 176 176 177 177 }//endif 178 178 179 179 if(!offset) 180 sbResults.innerHTML = newText; 180 sbResults.innerHTML = newText; 181 181 else 182 182 sbResults.innerHTML += newText; 183 183 184 184 var searchItems = getElementsByClassName("SBSI-" + ssID); 185 185 smartSearch.searchResultsConnects[ssID] = Array(); … … 187 187 for(i=0; i < searchItems.length; i++) 188 188 smartSearch.searchResultsConnects[ssID][smartSearch.searchResultsConnects[ssID].length] = connect(searchItems[i], "onclick", smartSearch.clickSearchResult); 189 189 190 190 var moreButton = getObjectFromID("SBMoreButton-" + ssID); 191 191 if(moreButton) 192 smartSearch.searchResultsConnects[ssID][smartSearch.searchResultsConnects[ssID].length] = connect(moreButton, "onclick", smartSearch.getMoreResults); 192 smartSearch.searchResultsConnects[ssID][smartSearch.searchResultsConnects[ssID].length] = connect(moreButton, "onclick", smartSearch.getMoreResults); 193 193 194 194 closeButton.className = "graphicButtons buttonX"; … … 197 197 198 198 createSearchBox: function(ssID){ 199 199 200 200 //need to grab search box for reference x and ys 201 201 var searchdisplay = getObjectFromID("ds-"+ssID); 202 202 203 203 if(!smartSearch.searchBoxConnects[ssID]) 204 204 smartSearch.searchBoxConnects[ssID] = Array(); 205 205 206 206 if(smartSearch.searchBoxConnects[ssID][0]) 207 207 disconnect(smartSearch.searchBoxConnects[ssID][0]); … … 227 227 newDiv.innerHTML = '<button type="button" id="SBCloseButton-' + ssID + '" class="SBCloseButton graphicButtons buttonSpinner" tabindex="4000"><span>close</span></button>'; 228 228 smartSearch.searchBox[ssID].appendChild(newDiv) 229 229 230 230 newDiv = document.createElement("div"); 231 231 newDiv.id = "SBResults-" + ssID; … … 237 237 newDiv.id = "SBFooter"; 238 238 smartSearch.searchBox[ssID].appendChild(newDiv) 239 239 240 240 searchdisplay.parentNode.appendChild(smartSearch.searchBox[ssID]); 241 241 242 242 var closeButton = getObjectFromID("SBCloseButton-" + ssID); 243 243 244 244 smartSearch.searchBoxConnects[ssID][0] = connect(smartSearch.searchBox[ssID],"onmousedown", smartSearch.mouseDownDropDown); 245 245 smartSearch.searchBoxConnects[ssID][1] = connect(closeButton,"onclick",smartSearch.cancelSearch); 246 246 247 247 },//end method 248 248 … … 253 253 var box = e.src(); 254 254 var ssID = box.id.substr(10) 255 255 256 256 smartSearch.inDropDown[ssID] = true; 257 257 258 258 },//end method - clickDropDown 259 259 … … 261 261 262 262 blurIdent: Array(), 263 263 264 264 blurDisplay: function(e){ 265 265 266 266 var display = e.src(); 267 var ssID = display.id.substr(3); 267 var ssID = display.id.substr(3); 268 268 269 269 if(!smartSearch.inDropDown[ssID]) 270 270 smartSearch.blurIdent[ssID] = window.setTimeout("smartSearch._blurDisplay('" + ssID + "')",200); 271 271 272 272 smartSearch.inDropDown[ssID] = false; 273 274 },//end method 275 276 273 274 },//end method 275 276 277 277 _blurDisplay: function(ssID){ 278 278 279 279 var searchDisplay = getObjectFromID("ds-" + ssID); 280 280 281 281 if(smartSearch.searchBox[ssID] || searchDisplay.value != smartSearch.committedDisplayValue[ssID]){ 282 282 283 283 var highlight = getElementsByClassName("SBSel-"+ssID); 284 284 285 285 if(highlight.length !== 0){ 286 286 287 287 smartSearch.chooseSearchItem(highlight[0]) 288 288 289 289 } else { 290 290 … … 293 293 else 294 294 smartSearch.blankSearch(ssID); 295 295 296 296 }//end if 297 297 298 298 }//end if 299 299 300 300 smartSearch.blurIdent[ssID] = false; 301 301 302 302 },//end method 303 303 304 304 305 305 blankSearch: function(ssID){ 306 307 var searchDisplay = getObjectFromID("ds-" + ssID); 306 307 var searchDisplay = getObjectFromID("ds-" + ssID); 308 308 var valueField = getObjectFromID(ssID); 309 309 310 310 valueField.value = "" 311 311 smartSearch.displayValue[ssID] = ""; … … 324 324 325 325 cancelSearch: function(e, ssID){ 326 326 327 327 if(e){ 328 328 329 329 var thebutton = e.src() 330 330 ssID = thebutton.id.substr(14); 331 331 332 332 }//endif - e 333 334 var searchDisplay = getObjectFromID("ds-" + ssID); 335 336 if(smartSearch.searchBox[ssID]) 333 334 var searchDisplay = getObjectFromID("ds-" + ssID); 335 var freeForm = getObjectFromID("sff-" + ssID); 336 337 if(smartSearch.searchBox[ssID]) 337 338 searchDisplay.parentNode.removeChild(smartSearch.searchBox[ssID]); 338 339 searchDisplay.value = smartSearch.committedDisplayValue[ssID]; 340 smartSearch.displayValue[ssID] = smartSearch.committedDisplayValue[ssID]; 339 340 if(freeForm.value == 0){ 341 342 searchDisplay.value = smartSearch.committedDisplayValue[ssID]; 343 smartSearch.displayValue[ssID] = smartSearch.committedDisplayValue[ssID]; 344 345 }//end free forming wipes 346 341 347 smartSearch.searchBox[ssID] = null; 342 348 343 349 smartSearch.inDropDown[ssID] = false; 344 350 //searchDisplay.blur(); … … 349 355 350 356 clickSearchResult: function(e){ 351 357 352 358 var theItem = e.src(); 353 359 var classes = theItem.className.split(" "); 354 360 var ssID = classes[1].substr(5); 355 361 356 362 window.clearTimeout(smartSearch.blurIdent[ssID]); 357 363 smartSearch.blurIdent[ssID] = false; 358 364 359 365 smartSearch.chooseSearchItem(theItem); 360 366 e.stop(); 361 367 362 368 },//end method 363 369 364 370 365 371 chooseSearchItem: function(atag){ 366 372 367 373 var classes = atag.className.split(" "); 368 374 var ssID = classes[1].substr(5); 369 375 370 376 var valueField = getObjectFromID(ssID); 371 377 var searchDisplay = getObjectFromID("ds-"+ssID); 372 378 373 379 valueField.value = atag.id.substr(3); 374 380 375 381 for(var i=0; i< atag.childNodes.length; i++) 376 382 if(atag.childNodes[i].className) 377 383 if(atag.childNodes[i].className == "SBMain") 378 384 searchDisplay.value = htmlDecode(atag.childNodes[i].innerHTML); 379 385 380 386 smartSearch.committedDisplayValue[ssID] = searchDisplay.value; 381 387 smartSearch.displayValue[ssID] = searchDisplay.value; … … 383 389 //remove the box 384 390 searchDisplay.parentNode.removeChild(smartSearch.searchBox[ssID]); 385 391 386 392 smartSearch.searchBox[ssID] = null; 387 393 388 394 //lastly, if the value field has an onchange we need to trgger it 389 395 //First we check for legacy on changes … … 398 404 399 405 moveSearchHighlight: function(ssID, direction){ 400 406 401 407 var sbResults = getObjectFromID("SBResults-" + ssID); 402 408 var currentItem = 0 403 409 var classes, newClassName 404 410 405 411 if(direction=="down") 406 412 direction = 1; 407 413 else 408 414 direction =-1; 409 415 410 416 for(var i=0; i < sbResults.childNodes.length; i++){ 411 417 412 418 if(sbResults.childNodes[i].className){ 413 419 if(sbResults.childNodes[i].className.indexOf("SBSelected") !== -1){ … … 425 431 }//endif - SBSELECTED 426 432 }//endif - clasname 427 433 428 434 }//endfor 429 435 430 436 var newItem = currentItem + direction 431 437 432 438 while(newItem >= 0 && newItem < sbResults.childNodes.length){ 433 439 434 440 if(sbResults.childNodes[newItem].className){ 435 441 436 442 sbResults.childNodes[newItem].className += " SBSelected SBSel-"+ssID; 437 443 newItem = -1000; 438 439 }else 444 445 }else 440 446 newItem += direction 441 447 442 448 }//endwhile 443 449 444 450 }, //endif 445 451 446 452 447 453 getMoreResults: function(e){ 448 454 449 455 var button = e.src(); 450 456 var ssID = button.id.substr(13); … … 452 458 window.clearTimeout(smartSearch.blurIdent[ssID]); 453 459 smartSearch.blurIdent[ssID] = false; 454 460 455 461 var thediv = button.parentNode; 456 462 457 463 thediv.parentNode.removeChild(thediv); 458 464 459 465 var sbResults = getObjectFromID("SBResults-" + ssID); 460 466 sbResults.style.height = "330px"; 461 462 var offset = button.name 467 468 var offset = button.name 463 469 button.id = "invalid-removed"; 464 465 smartSearch.lookup(ssID, offset); 466 470 471 smartSearch.lookup(ssID, offset); 472 467 473 var searchDisplay = getObjectFromID("ds-" + ssID); 468 474 searchDisplay.focus(); 469 475 470 476 }//end method 471 477 472 478 }//end struct 473 479 … … 475 481 /* ------------------------------------------------------- */ 476 482 connect(window,"onload",function() { 477 483 478 484 //grab all smart search boxes 479 485 var smartSearches = getElementsByClassName("inputSmartSearch"); … … 486 492 487 493 var ssID = smartSearches[i].id.substr(3); 488 494 489 495 smartSearch.displayValue[ssID] = smartSearches[i].value; 490 496 smartSearch.committedDisplayValue[ssID] = smartSearches[i].value; 491 497 492 498 }//endfor smartSearches 493 494 499 500 495 501 }) -
branches/nathan/common/stylesheet/mozilla/base.css
r384 r450 69 69 #MLAddP{float:right;padding-left:0} 70 70 #MLStatus{clear:both;text-align:center} 71 71 72 72 73 73 /* ============================================================================== */ … … 86 86 #saveButton1,#saveButton2{width:68px;margin-right:3px;} 87 87 #cancelButton1,#cancelButton2{width:68px;} 88 88 89 89 /* ============================================================================== */ 90 90 /* Smart Searches */ … … 101 101 background:white; 102 102 position:absolute; 103 z-index: 90; 103 104 } 104 105 … … 149 150 .SBHeader{ 150 151 background:#EEEEEE; 151 text-align:right; 152 text-align:right; 152 153 padding:5px; 153 154 height:16px; -
branches/nathan/common/stylesheet/mozilla/menu.css
r311 r450 45 45 border-bottom:1px solid #ACB7C4; 46 46 margin:0; 47 padding:0 0 0 5px; 47 padding:0 0 0 5px; 48 48 height:26px; 49 49 } … … 68 68 } 69 69 70 #menuBar .firstLevel a:hover, #menuBar a.hovered{ 71 text-decoration:none; 70 #menuBar .firstLevel a:hover, #menuBar a.hovered{ 71 text-decoration:none; 72 72 background-color:#663366; 73 73 color:white; … … 82 82 margin-top:-1px; 83 83 position:absolute; 84 z-index: 100; 84 85 background-color:white; 85 86 border:1px solid #999999; … … 91 92 background-image:none; 92 93 margin:0px; 93 display:block; 94 display:block; 94 95 padding:3px 25px 3px 15px; 95 96 font-size:11px; … … 101 102 102 103 #menuBar .submenuitems a:hover{ 103 text-decoration:none; 104 text-decoration:none; 104 105 background-color:#663366; 105 106 color:white; … … 116 117 #SMText{ 117 118 background:url("image/statusmessage.png") 7px 5px no-repeat; 118 color:white; 119 font-weight:bold; 119 color:white; 120 font-weight:bold; 120 121 font-size:15px; 121 122 padding: 5px 5px 0px 30px; -
branches/nathan/common/stylesheet/mozilla/pages/quickview.css
r420 r450 63 63 64 64 .RDNames{ 65 float:left; 65 float:left; 66 66 width:100px; 67 67 text-align:right; … … 91 91 .disabledP{display:none;} 92 92 93 #clientrecord{94 position:relative;95 z-index:-1;96 }97 93 #theDetails{margin-top:15px;} 98 94 #rightSideDiv{float:right;width:300px;margin-top:0;} -
branches/nathan/common/stylesheet/mozilla/pages/snapshot.css
r312 r450 30 30 31 31 h2{ 32 margin:3px 0 5px; 33 padding:0 0 4px; 32 margin:3px 0 5px; 33 padding:0 0 4px; 34 34 border:0; 35 35 font-size:15px … … 40 40 cursor:pointer;font-size:13px;background:#EEEEEE url("../image/section-down.png") 99% 3px no-repeat; 41 41 padding:4px; 42 border-bottom:1px solid #BBBBBB; 42 border-bottom:1px solid #BBBBBB; 43 43 } 44 44 #invoiceBox h3, #clientBox h3, #arBox h3{ … … 59 59 } 60 60 61 .tasksDivs p{ 62 margin:0; 63 padding:4px 4px 4px 8px; 64 border-bottom:1px solid #EEEEEE; 65 font-size:11px; 61 .tasksDivs div div{ 62 clear: both; 63 margin:0; 64 padding:4px 4px 4px 8px; 65 border-bottom:1px solid #EEEEEE; 66 font-size:12px; 66 67 } 67 68 68 .tasksDivs a{font-weight:normal} 69 .tasksDivs div div:hover{ 70 background: #EEEEEE; 71 } 69 72 70 .tasksDivs .private a{font-weight:bold} 73 .tasksDivs div div.taskSection{ 74 font-weight: bold; 75 border-bottom-color: #999999; 76 padding-top: 16px; 77 } 78 79 .tasksDivs div div.taskSection:hover{ 80 background: #FFF; 81 } 82 83 .taskRight{ 84 padding-left: 2px; 85 font-size: 10px; 86 display: block; 87 float: right; 88 text-align: right; 89 } 90 91 .tasksDivs div div p{ 92 font-style: italic; 93 font-size: 11px; 94 padding: 2px 20px; 95 } 96 97 .tasksDivs a{ 98 font-weight:bold; 99 } 71 100 72 101 73 .tasksDivs .complete , .tasksDivs .completea {102 .tasksDivs .complete a { 74 103 text-decoration:line-through; 75 104 color:#CCCCCC; … … 84 113 85 114 #eventsBox #eventsList td{ 86 padding:10px 5px; 87 border-bottom:1px solid #DDDDDD; 115 padding:10px 5px; 116 border-bottom:1px solid #DDDDDD; 88 117 font-size:11px; 89 118 } … … 104 133 float:right; 105 134 margin:0; 106 padding:0; 135 padding:0; 107 136 } 108 137 … … 110 139 list-style-type:none; 111 140 display:inline; 112 padding:0 4px 0 0; 141 padding:0 4px 0 0; 113 142 margin:0; 114 143 } … … 118 147 } 119 148 120 #icalA { 149 #icalA { 121 150 float:left; 122 151 height:16px; -
branches/nathan/include/fields.php
r417 r450 15 15 | notice, this list of conditions and the following disclaimer. | 16 16 | | 17 | - Redistributions in binary form must reproduce the above copyright | 17 | - Redistributions in binary form must reproduce the above copyright | 18 18 | notice, this list of conditions and the following disclaimer in the | 19 19 | documentation and/or other materials provided with the distribution. | … … 39 39 40 40 class phpbmsForm{ 41 41 42 42 var $jsIncludes = array("common/javascript/fields.js"); 43 43 var $topJS = array( … … 52 52 ); 53 53 var $bottomJS = array(); 54 54 55 55 var $fields = array(); 56 56 57 57 var $onload = array(); 58 58 59 59 function phpbmsForm($action = NULL, $method="post", $name="record", $onsubmit="return validateForm(this);", $dontSubmit = true){ 60 60 if ($action == NULL) 61 61 $action = $_SERVER["REQUEST_URI"]; 62 62 63 63 $this->action= $action; 64 64 $this->method = $method; 65 65 $this->name = $name; 66 66 $this->onsubmit = $onsubmit; 67 67 68 68 $this->dontSubmit = $dontSubmit; 69 69 70 70 } 71 71 72 72 function startForm($pageTitle){ 73 73 74 ?><form action="<?php echo str_replace("&","&",$this->action) ?>" method="<?php echo $this->method?>" name="<?php echo $this->name?>" onsubmit="<?php echo $this->onsubmit?>" <?php 74 ?><form action="<?php echo str_replace("&","&",$this->action) ?>" method="<?php echo $this->method?>" name="<?php echo $this->name?>" onsubmit="<?php echo $this->onsubmit?>" <?php 75 75 if(isset($this->enctype)) echo ' enctype="'.$this->enctype.'" '; 76 76 if(isset($this->id)) echo ' id="'.$this->id.'" '; 77 ?>><?php 77 ?>><?php 78 78 if($this->dontSubmit){ 79 79 ?><div id="dontSubmit"><input type="submit" value=" " onclick="return false;" /></div><?php 80 80 } ?> 81 81 <div id="topButtons"><?php showSaveCancel(1); ?></div> 82 <h1 id="h1Title"><span><?php echo $pageTitle ?></span></h1><?php 83 84 }//end method 85 86 82 <h1 id="h1Title"><span><?php echo $pageTitle ?></span></h1><?php 83 84 }//end method 85 86 87 87 function showCreateModify($phpbms, $therecord){ 88 88 ?> … … 94 94 <input name="createdby" type="hidden" value="<?php $therecord["createdby"] ?>" /> 95 95 <input name="creationdate" type="hidden" value="<?php echo formatFromSQLDatetime($therecord["creationdate"]) ?>"/> 96 created 96 created 97 97 </td> 98 98 <td><?php echo htmlQuotes($phpbms->getUserName($therecord["createdby"]))?></td> … … 114 114 }//end method 115 115 116 116 117 117 function endForm(){ 118 118 ?></form><?php 119 119 } 120 121 120 121 122 122 function addField($inputObject){ 123 123 if(is_object($inputObject)) 124 124 $this->fields[$inputObject->id] = $inputObject; 125 125 } 126 127 126 127 128 128 function showField($fieldname){ 129 129 if(isset($this->fields[$fieldname])){ … … 138 138 echo "Field Not Defined: ".$fieldname; 139 139 } 140 141 142 function jsMerge(){ 140 141 142 function jsMerge(){ 143 143 global $phpbms; 144 144 145 145 $phpbms->jsIncludes = array_merge($phpbms->jsIncludes,$this->jsIncludes); 146 146 $phpbms->topJS = array_merge($this->topJS,$phpbms->topJS); 147 147 $phpbms->bottomJS = array_merge($this->bottomJS,$phpbms->bottomJS); 148 148 $phpbms->onload = array_merge($this->onload,$phpbms->onload); 149 149 150 150 //next we go through the list of fields 151 151 foreach($this->fields as $field){ 152 152 153 153 $toAdd = $field->getJSMods(); 154 154 155 155 foreach($toAdd["jsIncludes"] as $jsinclude) 156 156 if(!in_array($jsinclude,$phpbms->jsIncludes)) … … 158 158 159 159 $phpbms->topJS = array_merge($phpbms->topJS,$toAdd["topJS"]); 160 $phpbms->bottomJS = array_merge($phpbms->bottomJS,$toAdd["bottomJS"]); 161 $phpbms->onload = array_merge($phpbms->onload,$toAdd["onload"]); 160 $phpbms->bottomJS = array_merge($phpbms->bottomJS,$toAdd["bottomJS"]); 161 $phpbms->onload = array_merge($phpbms->onload,$toAdd["onload"]); 162 162 163 163 }//endforeach 164 164 165 165 }//end method - jsMerge 166 166 }//end class … … 174 174 175 175 value = Value of input 176 displayName = Name to displayed in label, and on default messages when not overriden 176 displayName = Name to displayed in label, and on default messages when not overriden 177 177 required = true/false wether the field is validated by javascript before submitting for blank values 178 178 type = Type of field (integer, phone, email, wwww, real, date) to validate against 179 179 180 180 size = size of the input 181 181 maxlength max length of the input 182 183 displayLabel (boolean default = true) use this if you want the object to display a label tag above the input 182 183 displayLabel (boolean default = true) use this if you want the object to display a label tag above the input 184 184 when displaying 185 185 186 186 ==overridable variables== 187 187 188 188 message = message displayed if not validated 189 189 name = if your input needs a name different from the id 190 190 191 191 == variable setting methods == 192 192 193 193 setAttribute($name,$values) 194 194 195 195 Use this method to set an additional HTML property for the input 196 196 e.g. setAttribute("onclick","someJavascriptFunction()") 197 197 198 198 == methods == 199 199 getJSMods() 200 200 201 201 Typically this get called from the form container object, but 202 202 you can use it to get an array of all the Javascript this input affects (include, top JS, and bottom JS) 203 203 204 204 display() 205 206 Use this method to display the input in your page. 205 206 Use this method to display the input in your page. 207 207 */ 208 208 … … 210 210 var $name; 211 211 var $value; 212 212 213 213 var $displayName =""; 214 214 var $message = ""; 215 215 var $displayLabel = true; 216 216 217 217 var $_attributes = array(); 218 218 219 219 var $required = false; 220 220 var $type = NULL; 221 221 222 222 var $jsIncludes = array(); 223 223 224 224 function inputField($id, $value, $displayName = NULL ,$required = false, $type = NULL, $size = 32, $maxlength = 128, $displayLabel = true){ 225 225 $this->id = $id; … … 229 229 else 230 230 $this->displayName = $displayName; 231 231 232 232 if($size) 233 233 $this->_attributes["size"] = $size; 234 234 if($maxlength) 235 235 $this->_attributes["maxlength"] = $maxlength; 236 236 237 237 $this->displayLabel = $displayLabel; 238 238 239 239 $this->value = $value; 240 240 … … 242 242 $this->type = $type; 243 243 } 244 245 244 245 246 246 function setAttribute($name,$value){ 247 247 $this->_attributes[strtolower($name)] = $value; 248 248 } 249 249 250 250 251 251 function getJSMods(){ 252 252 $thereturn = array("jsIncludes" => array(), "topJS" => array(), "bottomJS" => array(), "onload" => array()); 253 253 254 254 foreach($this->jsIncludes as $theinclude) 255 255 $thereturn["jsIncludes"][] = $theinclude; … … 261 261 $thereturn["topJS"][] = "requiredArray[requiredArray.length]=new Array(\"".$this->name."\",\"".$message."\");"; 262 262 } 263 263 264 264 if($this->type){ 265 $message = $this->message; 265 $message = $this->message; 266 266 if($message == ""){ 267 267 switch($this->type){ … … 286 286 case "time": 287 287 $message = $this->displayName." must be a valid time."; 288 break; 288 break; 289 289 } 290 290 }//end if 291 291 $thereturn["topJS"][] = $this->type."Array[".$this->type."Array.length]=new Array(\"".$this->name."\",\"".$message."\");"; 292 292 } 293 293 294 294 return $thereturn; 295 295 }//end if 296 297 296 297 298 298 function displayAttributes(){ 299 299 foreach($this->_attributes as $key => $value) 300 echo " ".$key."=\"".$value."\""; 301 } 302 303 300 echo " ".$key."=\"".$value."\""; 301 } 302 303 304 304 function showLabel(){ 305 ?><label for="<?php echo $this->id?>" <?php 305 ?><label for="<?php echo $this->id?>" <?php 306 306 if(isset($this->_attributes["class"])) 307 307 if(strpos($this->_attributes["class"],"important") !== false) … … 309 309 ?>><?php echo $this->displayName?></label><br /><?php 310 310 } 311 312 313 function display(){ 314 315 if($this->displayLabel) 316 $this->showLabel(); 317 318 ?><input type="text" id="<?php echo $this->id?>" name="<?php echo $this->name?>" <?php 319 if($this->value !== "") 311 312 313 function display(){ 314 315 if($this->displayLabel) 316 $this->showLabel(); 317 318 ?><input type="text" id="<?php echo $this->id?>" name="<?php echo $this->name?>" <?php 319 if($this->value !== "") 320 320 echo " value=\"".htmlQuotes($this->value)."\""; 321 321 $this->displayAttributes(); 322 322 ?> /><?php 323 323 324 324 switch($this->type){ 325 325 case "email": 326 326 ?><button id="<?php echo $this->id?>Button" type="button" class="graphicButtons buttonEmail" onclick="openEmail('<?php echo $this->id?>')" title="Send E-Mail"><span>send e-mail</span></button><?php 327 327 break; 328 328 329 329 case "www": 330 330 ?><button id="<?php echo $this->id?>Button" type="button" class="graphicButtons buttonWWW" onclick="openWebpage('<?php echo $this->id?>')" title="Visit site in new window"><span>visit site</span></button><?php 331 331 break; 332 332 } 333 333 334 334 }//end method 335 335 }//end class … … 344 344 */ 345 345 function inputCheckbox($id,$value = false, $displayName = NULL, $disabled = false, $displayLabel = true){ 346 346 347 347 parent::inputField($id, $value, $displayName, false, NULL, NULL, NULL, $displayLabel); 348 348 349 349 if($disabled) 350 $this->_attributes["disabled"] = "disabled"; 351 }//end method 352 350 $this->_attributes["disabled"] = "disabled"; 351 }//end method 352 353 353 function showLabel(){ 354 354 $classText=""; … … 363 363 if($classText!="") 364 364 $classText = ' class="'.$classText.'"'; 365 365 366 366 ?><label id="<?php echo $this->id?>Label" for="<?php echo $this->id?>" <?php echo $classText?>><?php echo $this->displayName?></label><?php 367 367 } … … 369 369 370 370 function display(){ 371 ?><input type="checkbox" id="<?php echo $this->id?>" name="<?php echo $this->name?>" value="1" class="radiochecks" <?php 371 ?><input type="checkbox" id="<?php echo $this->id?>" name="<?php echo $this->name?>" value="1" class="radiochecks" <?php 372 372 if($this->value) echo "checked=\"checked\" "; 373 373 $this->displayAttributes(); 374 ?> /> <?php 375 374 ?> /> <?php 375 376 376 if($this->displayLabel) 377 377 $this->showLabel(); … … 387 387 function inputBasicList ($id,$value = "",$list = array(), $displayName = NULL, $displayLabel = true){ 388 388 parent::inputField($id, $value, $displayName, false, NULL, NULL, NULL, $displayLabel); 389 389 390 390 $this->thelist = $list; 391 391 } 392 393 function display(){ 394 395 if($this->displayLabel) 396 $this->showLabel(); 397 398 ?><select name="<?php echo $this->name?>" id="<?php echo $this->id?>" <?php 399 $this->displayAttributes(); 392 393 function display(){ 394 395 if($this->displayLabel) 396 $this->showLabel(); 397 398 ?><select name="<?php echo $this->name?>" id="<?php echo $this->id?>" <?php 399 $this->displayAttributes(); 400 400 ?> > <?php 401 401 foreach($this->thelist as $key => $value){ 402 402 403 403 ?><option value="<?php echo htmlQuotes($value)?>" <?php if ($value == $this->value) echo " selected=\"selected\" "?> ><?php echo $key?></option><?php echo "\n"; 404 404 … … 421 421 hasblank = boolean, wehterh <none> (0) can be an option 422 422 */ 423 424 function inputDataTableList($db, $id, $value, $table, $valuefield, $displayfield, 423 424 function inputDataTableList($db, $id, $value, $table, $valuefield, $displayfield, 425 425 $whereclause = "", $orderclause = "", $hasblank = true, $displayName=NULL, $displayLabel = true){ 426 426 427 427 parent::inputField($id, $value, $displayName, false, NULL, NULL, NULL, $displayLabel); 428 428 429 429 $this->hasblank = $hasblank; 430 430 $this->db = $db; … … 435 435 if($orderclause) 436 436 $querystatement.=" ORDER BY ".$orderclause; 437 437 438 438 $this->queryresult=$this->db->query($querystatement); 439 439 440 440 }//end method 441 442 function display(){ 443 444 if($this->displayLabel) 445 $this->showLabel(); 446 447 ?><select name="<?php echo $this->name?>" id="<?php echo $this->id?>" <?php 441 442 function display(){ 443 444 if($this->displayLabel) 445 $this->showLabel(); 446 447 ?><select name="<?php echo $this->name?>" id="<?php echo $this->id?>" <?php 448 448 $this->displayAttributes(); 449 449 ?> ><?php … … 460 460 } 461 461 ?></select> 462 <?php 463 462 <?php 463 464 464 } 465 465 }//end class … … 474 474 function inputChoiceList($db, $id, $value, $listname, $displayName="", $blankvalue="none", $displayLabel = true){ 475 475 parent::inputField($id, $value, $displayName, false, NULL, NULL, NULL, $displayLabel); 476 476 477 477 $this->db = $db; 478 478 $this->listname = $listname; 479 479 $this->blankvalue = $blankvalue; 480 480 481 481 $querystatement="SELECT thevalue FROM choices WHERE listname=\"".$this->listname."\" ORDER BY thevalue;"; 482 482 $this->queryresult = $this->db->query($querystatement); 483 483 484 484 $this->jsIncludes[] = "common/javascript/choicelist.js"; 485 485 … … 490 490 if($this->displayLabel) 491 491 $this->showLabel(); 492 ?><select name="<?php echo $this->name?>" id="<?php echo $this->id?>" <?php 492 ?><select name="<?php echo $this->name?>" id="<?php echo $this->id?>" <?php 493 493 $this->displayAttributes(); 494 494 ?> onchange="changeChoiceList(this,'<?php echo APP_PATH?>','<?php echo $this->listname?>','<?php echo $this->blankvalue?>');" onfocus="setInitialML(this)"> 495 <?php 495 <?php 496 496 $inlist=false; 497 497 while($therecord = $this->db->fetchArray($this->queryresult)){ … … 520 520 $theclass=""; 521 521 } 522 ?><option value="<?php echo $this->value?>" <?php echo $theclass?> selected="selected"><?php echo $display?></option><?php 522 ?><option value="<?php echo $this->value?>" <?php echo $theclass?> selected="selected"><?php echo $display?></option><?php 523 523 }//end if 524 524 ?> 525 <option value="*mL*" class="choiceListModify">modify list...</option></select><?php 525 <option value="*mL*" class="choiceListModify">modify list...</option></select><?php 526 526 527 527 } … … 534 534 535 535 function inputCurrency($id, $value, $displayName = NULL ,$required = false, $size = 10, $maxlength = 12, $displayLabel = true){ 536 536 537 537 $type = NULL; 538 538 parent::inputField($id, $value, $displayName,$required, $type, $size, $maxlength, $displayLabel); … … 547 547 if(!is_numeric($this->value)) $this->value = 0; 548 548 $this->value = htmlQuotes(numberToCurrency($this->value)); 549 549 550 550 if(!isset($this->_attributes["onchange"])) $this->_attributes["onchange"] = ""; 551 551 $this->_attributes["onchange"] = "validateCurrency(this);".$this->_attributes["onchange"]; 552 552 553 if(!isset($this->_attributes["class"])) 553 if(!isset($this->_attributes["class"])) 554 554 $this->_attributes["class"] = ""; 555 555 else 556 556 $this->_attributes["class"] = " ".$this->_attributes["class"]; 557 557 558 558 $this->_attributes["class"] = "currency".$this->_attributes["class"]; 559 559 560 560 561 561 ?><input name="<?php echo $this->name?>" id="<?php echo $this->id?>" type="text" value="<?php echo $this->value?>" <?php 562 562 $this->displayAttributes(); … … 570 570 //============================================================================================ 571 571 class inputTextarea extends inputField{ 572 572 573 573 function inputTextarea($id, $value, $displayName = NULL ,$required = false, $rows = 5, $cols= 48, $displayLabel = true){ 574 574 parent::inputField($id, $value, $displayName, $required, NULL, NULL, NULL, $displayLabel); … … 578 578 579 579 $this->_attributes["rows"] = $rows; 580 $this->_attributes["cols"] = $cols; 581 582 } 583 584 585 function display(){ 586 587 if($this->displayLabel) 588 $this->showLabel(); 589 590 ?><textarea id="<?php echo $this->id?>" name="<?php echo $this->name?>" <?php 580 $this->_attributes["cols"] = $cols; 581 582 } 583 584 585 function display(){ 586 587 if($this->displayLabel) 588 $this->showLabel(); 589 590 ?><textarea id="<?php echo $this->id?>" name="<?php echo $this->name?>" <?php 591 591 $this->displayAttributes(); 592 592 ?>><?php echo htmlQuotes($this->value)?></textarea><?php 593 593 594 594 }//end method 595 595 … … 603 603 */ 604 604 function inputPercentage($id, $value, $displayName = NULL , $precision = 1, $required = false, $size = 9, $maxlength = 10, $displayLabel = true){ 605 605 606 606 $this->precision = (int) $precision; 607 607 608 608 $type = NULL; 609 609 parent::inputField($id, $value, $displayName,$required, $type, $size, $maxlength, $displayLabel); … … 613 613 614 614 function display() { 615 616 if($this->displayLabel) 617 $this->showLabel(); 618 619 if(is_numeric($this->value)) $this->value = $this->value."%"; 620 615 616 if($this->displayLabel) 617 $this->showLabel(); 618 619 if(is_numeric($this->value)) $this->value = $this->value."%"; 620 621 621 if(!isset($this->_attributes["onchange"])) $this->_attributes["onchange"] = ""; 622 622 $this->_attributes["onchange"] = "validatePercentage(this,".$this->precision.");".$this->_attributes["onchange"]; … … 636 636 function inputDatePicker($id, $value, $displayName = NULL ,$required = false, $size = 10, $maxlength = 15, $displayLabel = true){ 637 637 $type = "date"; 638 638 639 639 parent::inputField($id, $value, $displayName,$required, $type, $size, $maxlength, $displayLabel); 640 640 641 641 $this->jsIncludes[] = "common/javascript/datepicker.js"; 642 642 } 643 643 644 644 function display(){ 645 645 … … 648 648 649 649 $value = formatFromSQLDate($this->value); 650 650 651 651 if(!isset($this->_attributes["onchange"])) $this->_attributes["onchange"] = ""; 652 652 $this->_attributes["onchange"] = "formatDateField(this);".$this->_attributes["onchange"]; 653 653 654 654 ?><input name="<?php echo $this->name?>" id="<?php echo $this->id?>" type="text" value="<?php echo $value?>" <?php 655 655 $this->displayAttributes(); 656 656 ?>/><button id="<?php echo $this->id?>Button" type="button" class="graphicButtons buttonDate" onclick="showDP('<?php echo APP_PATH?>','<?php echo $this->id?>');"><span>pick date</span></button><?php 657 658 }//end method 659 657 658 }//end method 659 660 660 }//end class 661 661 … … 666 666 function inputTimePicker($id, $value, $displayName = NULL ,$required = false, $size = 10, $maxlength = 15, $displayLabel = true){ 667 667 $type = "time"; 668 668 669 669 parent::inputField($id, $value, $displayName,$required, $type, $size, $maxlength, $displayLabel); 670 670 671 671 $this->jsIncludes[] = "common/javascript/timepicker.js"; 672 672 } … … 678 678 679 679 $value = formatFromSQLTime($this->value); 680 680 681 681 ?><input name="<?php echo $this->name?>" id="<?php echo $this->id?>" type="text" value="<?php echo $value?>" <?php 682 682 $this->displayAttributes(); 683 683 ?>/><button id="<?php echo $this->id?>Button" type="button" class="graphicButtons buttonTime" onclick="showTP('<?php echo APP_PATH?>','<?php echo $this->id?>');"><span>pick time</span></button><?php 684 685 }//end method 686 687 }//end class 688 689 684 685 }//end method 686 687 }//end class 688 689 690 690 //============================================================================================ 691 691 class inputRolesList extends inputField{ 692 692 693 693 function inputRolesList($db,$id,$selected,$displayName = NULL, $required = false, $displayLabel = true){ 694 694 695 695 parent::inputField($id, $selected, $displayName, $required, NULL, NULL, NULL, $displayLabel); 696 696 697 697 $this->db = $db; 698 698 699 699 $querystatement = "SELECT name, id FROM roles WHERE inactive = 0"; 700 700 $this->queryresult = $this->db->query($querystatement); 701 702 } 703 704 705 function display(){ 706 if($this->displayLabel) 707 $this->showLabel(); 708 701 702 } 703 704 705 function display(){ 706 if($this->displayLabel) 707 $this->showLabel(); 708 709 709 ?><select id="<?php echo $this->id?>" name="<?php echo $this->name?>" <?php $this->displayAttributes();?>> 710 710 <option value="0" <?php if($this->value==0) echo "selected=\"selected\""?>>EVERYONE</option> 711 711 <?php while($therecord = $this->db->fetchArray($this->queryresult)){ ?> 712 <option value="<?php echo $therecord["id"]?>" <?php if($this->value==$therecord["id"]) echo "selected=\"selected\""?>><?php echo $therecord["name"]?></option> 712 <option value="<?php echo $therecord["id"]?>" <?php if($this->value==$therecord["id"]) echo "selected=\"selected\""?>><?php echo $therecord["name"]?></option> 713 713 <?php }?> 714 714 <option value="-100" <?php if($this->value == -100) echo "selected=\"selected\""?>>Administrators</option> … … 716 716 717 717 } 718 718 719 719 }//end class 720 720 … … 732 732 maxlength = (int) max length attribute for displayed input tag (255) 733 733 displayLabel (boolean) Show label tag with displayName (true) 734 735 The JS used by this field type requires that the field NOT be implemented inside a p tag, 736 inline element, or any tag that should not contain a div tag. In IE, if the field placed 737 inside an element that should not be able to handle a DIV tag inside it (standards-wise), 734 735 The JS used by this field type requires that the field NOT be implemented inside a p tag, 736 inline element, or any tag that should not contain a div tag. In IE, if the field placed 737 inside an element that should not be able to handle a DIV tag inside it (standards-wise), 738 738 IE will report a Javascript error. 739 739 */ 740 function inputSmartSearch($db, $id, $searchName, $initialvalue = "", $displayName = NULL, $required=false, 741 $size = 32, $maxlength = 255, $displayLabel = true) {740 function inputSmartSearch($db, $id, $searchName, $initialvalue = "", $displayName = NULL, $required=false, 741 $size = 32, $maxlength = 255, $displayLabel = true, $allowFreeForm = false) { 742 742 $this->db = $db; 743 743 744 744 parent::inputField($id, $initialvalue, $displayName,$required, NULL, $size, $maxlength, $displayLabel); 745 745 746 746 $this->searchName = $searchName; 747 $this->allowFreeForm = $allowFreeForm; 748 747 749 748 750 //next I need to initialize and do the correct search 749 751 $this->searchInfo = $this->getSearchInfo($searchName); 750 752 751 753 $this->displayValue = $this->getInitialDisplay(); 752 754 … … 755 757 756 758 function getSearchInfo($searchInfo){ 757 759 758 760 $querystatement = " 759 761 SELECT … … 764 766 name = '".mysql_real_escape_string($searchInfo)."' 765 767 "; 766 768 767 769 return $this->db->fetchArray($this->db->query($querystatement)); 768 770 769 771 }//end method getInfo 770 772 771 773 function getInitialDisplay(){ 772 774 773 775 $querystatement = " 774 776 SELECT … … 779 781 ".$this->searchInfo["valuefield"]." = '".mysql_real_escape_string($this->value)."' 780 782 "; 781 783 782 784 $queryresult = $this->db->query($querystatement); 783 785 … … 786 788 $therecord = $this->db->fetchArray($queryresult); 787 789 return $therecord["display"]; 788 790 789 791 } else 790 792 return ''; 791 793 792 794 }//end method getInitialDisplay 793 795 … … 795 797 // CLASS OVERIDES ================================================ 796 798 function getJSMods(){ 797 799 798 800 $thereturn = array("jsIncludes" => array(), "topJS" => array(), "bottomJS" => array(), "onload" => array()); 799 801 800 802 $thereturn["jsIncludes"][] = "common/javascript/smartsearch.js"; 801 803 802 804 if($this->required){ 803 805 804 806 $message = $this->message; 805 807 806 808 if($message == "") 807 809 $message = $this->displayName." cannot be blank."; 808 810 $thereturn["topJS"][] = "requiredArray[requiredArray.length]= [ '".$this->name."','".$message."' ];"; 809 811 810 812 }//endif - required 811 813 812 814 return $thereturn; 813 815 814 816 }//end method - getJSMods 815 817 816 818 817 819 function showLabel(){ … … 819 821 }//end method 820 822 821 822 function display(){ 823 824 if($this->displayLabel) 825 $this->showLabel(); 826 827 if(!isset($this->_attributes["class"])) 823 824 function display(){ 825 826 if($this->displayLabel) 827 $this->showLabel(); 828 829 if(!isset($this->_attributes["class"])) 828 830 $this->_attributes["class"] = ""; 829 831 else 830 832 $this->_attributes["class"] = " ".$this->_attributes["class"]; 831 833 832 834 $this->_attributes["class"] = "inputSmartSearch".$this->_attributes["class"]; 833 835 834 836 ?><input type="hidden" name="<?php echo $this->id?>" id="<?php echo $this->id?>" value="<?php echo $this->value?>" /> 837 <input type="hidden" id="sff-<?php echo $this->id?>" value="<?php echo ((int) $this->allowFreeForm); ?>"/> 835 838 <input type="hidden" id="sdbid-<?php echo $this->id?>" value="<?php echo $this->searchInfo["id"]?>"/> 836 <input type="text" name="ds-<?php echo $this->id?>" id="ds-<?php echo $this->id?>" title="Use % for wildcard searches." <?php 837 839 <input type="text" name="ds-<?php echo $this->id?>" id="ds-<?php echo $this->id?>" title="Use % for wildcard searches." <?php 840 838 841 $this->displayAttributes(); 839 840 ?> value="<?php echo htmlQuotes($this->displayValue) ?>"/><?php 842 843 ?> value="<?php echo htmlQuotes($this->displayValue) ?>"/><?php 841 844 842 845 }//end method -display 843 846 844 847 }//end class - inputSmartSearch 845 848 ?> -
branches/nathan/include/jstransport.php
r349 r450 40 40 41 41 ?>LOGIN_REFRESH=<?php echo LOGIN_REFRESH?>;<?php 42 42 43 if(defined("TERM1_DAYS")){ 43 44 ?>TERM1_DAYS=<?php echo TERM1_DAYS?>;<?php 45 }//end if 44 46 45 47 ?>MONTH_NAMES_LONG= [ <?php -
branches/nathan/install/install_include.php
r386 r450 2 2 function processSQLfile($db,$filename){ 3 3 global $dblink; 4 4 5 5 $thefile = @ fopen($filename,"r"); 6 if(!$thefile) 6 if(!$thefile) 7 7 return "Could not open the file ".$filename.".\n"; 8 8 … … 29 29 else 30 30 $querystatement="SELECT id FROM users WHERE login=\"".mysql_real_escape_string($user)."\" AND password=encode(\"".mysql_real_escape_string($pass)."\",\"".ENCRYPTION_SEED."\") AND accesslevel>=90"; 31 31 32 32 $queryresult=$db->query($querystatement); 33 33 34 34 if(!$queryresult) 35 35 return false; … … 44 44 45 45 $ver=$db->fetchArray($queryresult); 46 return $ver["version"]; 46 return $ver["version"]; 47 47 } 48 48 … … 52 52 53 53 $thedir= @ opendir("../modules/"); 54 54 55 55 echo 'modules = Array();'."\n"; 56 56 57 57 $modules = array(); 58 58 while($entry=readdir($thedir)){ … … 60 60 if(file_exists("../modules/".$entry."/install/".$type.".php") && file_exists("../modules/".$entry."/install/version.php")){ 61 61 include("../modules/".$entry."/install/version.php"); 62 } 62 } 63 63 } 64 } 65 64 } 65 66 66 foreach($modules as $name=>$module) 67 67 if(is_array($module)){ … … 70 70 echo 'modules["'.$name.'"]["'.$key.'"] = "'.$value.'";'."\n"; 71 71 } 72 72 73 73 @ chdir ($currdirectory); 74 74 75 75 return $modules; 76 76 }//end function 77 77 78 78 79 79 function showModules($modules){ 80 80 if(is_array($modules)){ … … 92 92 $sqlstatement=""; 93 93 $thereturn = ""; 94 94 95 95 $createfile = @ fopen("createtables.sql","r"); 96 if(!$createfile) 97 return "Could not open SQL file: ". sqlfile;96 if(!$createfile) 97 return "Could not open SQL file: ".$sqlfile; 98 98 else{ 99 99 while(!feof($createfile)) { 100 100 $sqlstatement.= @ fgets($createfile,1024); 101 101 if(strpos($sqlstatement,";")){ 102 103 $theresult = $db->query(trim($sqlstatement)); 104 102 103 $theresult = $db->query(trim($sqlstatement)); 104 105 105 if($db->error){ 106 106 return "Error creating tables: ".$db->error."\n\n".trim($sqlstatement); … … 109 109 }//end if; 110 110 }//end while 111 112 }//end if 111 112 }//end if 113 113 114 114 return true; … … 117 117 118 118 function importData($db,$tablename){ 119 119 120 120 $tablefile = @ fopen($tablename.".sql","rb"); 121 if(!$tablefile) 121 if(!$tablefile) 122 122 return "Could not open the file ".$tablename.".sql\n"; 123 123 … … 125 125 $counter=0; 126 126 $failure = false; 127 127 128 128 while(!feof($tablefile)) { 129 129 $sqlstatement=trim(fgets($tablefile,8184)); … … 142 142 }//end if; 143 143 }//end while 144 144 145 145 if($failure) 146 146 $threturn = "Importing of some records in ".$tablename." occured.\n\n"; 147 147 else 148 148 $thereturn.="Import of ".$counter." record(s) for '".$tablename."' complete.\n"; 149 149 150 150 return $thereturn; 151 151 }//end function -
branches/nathan/modules/base/adminsettings.php
r419 r450 1 <?php 1 <?php 2 2 /* 3 3 $Rev$ | $LastChangedBy$ … … 52 52 goURL(APP_PATH."noaccess.php"); 53 53 54 if (isset($_POST["command"])) 54 if (isset($_POST["command"])) 55 55 $statusmessage = $settings->processForm($_POST); 56 56 … … 71 71 $theform = new phpbmsForm(); 72 72 $theform->enctype="multiform/form-data"; 73 73 74 74 $theinput = new inputField("application_name",$therecord["application_name"],"application name",true); 75 75 $theform->addField($theinput); … … 77 77 $theinput = new inputField("record_limit",$therecord["record_limit"],"record display limit",true,"integer",5,3); 78 78 $theform->addField($theinput); 79 79 80 80 $theinput = new inputField("default_load_page",$therecord["default_load_page"],"default page",true); 81 81 $theform->addField($theinput); 82 82 83 83 $theinput = new inputField("encryption_seed",$therecord["encryption_seed"],"encryption_seed",true); 84 84 $theinput->setAttribute("readonly","readonly"); 85 $theinput->setAttribute("class","uneditable"); 85 $theinput->setAttribute("class","uneditable"); 86 86 $theform->addField($theinput); 87 87 … … 108 108 foreach($phpbms->modules as $module => $moduleinfo) 109 109 if($module != "base" && class_exists($module."Display")){ 110 110 111 111 $class = $module."Display"; 112 112 $theform->extraModules[$module] = new $class(); … … 116 116 foreach($additionalFields as $field) 117 117 $theform->addField($field); 118 } 119 118 } 119 120 120 121 121 $theform->jsMerge(); 122 122 //============================================================== 123 123 //End Form Elements 124 124 125 125 include("header.php"); 126 126 ?> 127 127 <div class="bodyline"> 128 128 <form action="<?php echo $_SERVER["PHP_SELF"]?>" method="post" enctype="multipart/form-data" name="record" onsubmit="return processForm(this);"> 129 129 130 130 <h1 id="h1Title"><span><?php echo $pageTitle ?></span></h1> 131 131 132 132 <div id="phpbmsSplash" class="box"> 133 133 <div id="phpbmslogo"> … … 139 139 </div> 140 140 </div> 141 141 142 142 <fieldset> 143 143 <legend>general</legend> 144 145 <p> 144 145 <p> 146 146 <?php $theform->fields["application_name"]->display();?><br /> 147 147 <span class="notes"> … … 154 154 <?php $theform->fields["record_limit"]->display();?> 155 155 </p> 156 156 157 157 <p> 158 158 <?php $theform->fields["default_load_page"]->display();?> … … 163 163 <select id="stylesheet" name="stylesheet"> 164 164 <?php $settings->displayStylesheets($therecord["stylesheet"]);?> 165 </select> 166 </p> 165 </select> 166 </p> 167 167 </fieldset> 168 168 <p class="updateButtonP"><input name="command" type="submit" class="Buttons" value="update settings" /></p> 169 169 170 170 <fieldset> 171 171 <legend>company</legend> 172 <p> 172 <p> 173 173 <label for="company_name">company name</label><br /> 174 174 <input id="company_name" name="company_name" type="text" size="40" maxlength="128" value="<?php echo htmlQuotes($therecord["company_name"]) ?>" /> … … 179 179 <input id="company_address" name="company_address" type="text" value="<?php echo htmlQuotes($therecord["company_address"]) ?>" size="40" maxlength="128" /> 180 180 </p> 181 181 182 182 <p> 183 183 <label for="company_csz">city, state/province and zip/postal code</label><br /> 184 184 <input id="company_csz" name="company_csz" type="text" size="40" maxlength="128" value="<?php echo htmlQuotes($therecord["company_csz"]) ?>" /> 185 185 </p> 186 186 187 187 <p> 188 188 <label for="company_phone">phone number</label><br /> 189 189 <input id="company_phone" name="company_phone" type="text" value="<?php echo htmlQuotes($therecord["company_phone"]) ?>" size="40" maxlength="128" /> 190 190 </p> 191 192 <p> 191 192 <?php if(isset($therecord["company_taxid"])){?> 193 <p> 193 194 <label for="company_taxid">company tax id</label><br /> 194 195 <input id="company_taxid" name="company_taxid" type="text" value="<?php echo htmlQuotes($therecord["company_taxid"]) ?>" size="40" maxlength="128" /> 195 196 </p> 197 <?php }//endif - tax id?> 196 198 197 199 <div class="fauxP"> … … 199 201 <div id="graphicHolder"><img alt="logo" src="<?php echo APP_PATH?>dbgraphic.php?t=files&f=file&mf=type&r=1" /></div> 200 202 </div> 201 203 202 204 <p> 203 205 <label for="printedlogo">upload new logo file</label> <span class="notes">(PNG or JPEG format)</span><br /> 204 206 <input id="printedlogo" name="printedlogo" type="file" size="64" /><br /> 205 207 </p> 206 208 207 209 <p class="notes"> 208 210 <strong>Note:</strong> This graphic is used on some reports. <br /> … … 213 215 </fieldset> 214 216 <p class="updateButtonP"><input name="command" type="submit" class="Buttons" value="update settings" /></p> 215 217 216 218 <fieldset> 217 219 <legend>Localization</legend> … … 256 258 </fieldset> 257 259 <p class="updateButtonP"><input name="command" type="submit" class="Buttons" value="update settings" /></p> 258 260 259 261 <fieldset> 260 262 <legend>encryption seed</legend> … … 271 273 </p> 272 274 273 <p> 275 <p> 274 276 <?php $theform->fields["encryption_seed"]->display();?> 275 277 </p> … … 295 297 <p class="notes"><strong>Note:</strong> Does not work with Microsoft Internet Explorer versions less than 7. 296 298 </p> 297 </fieldset> 299 </fieldset> 298 300 <p class="updateButtonP"><input name="command" type="submit" class="Buttons" value="update settings" /></p> 299 300 <?php 301 302 <?php 301 303 foreach($theform->extraModules as $module) 302 304 if(method_exists($module,"display")){ -
branches/nathan/modules/base/include/snapshot_include.php
r308 r450 1 <?php 1 <?php 2 2 /* 3 3 $Rev$ | $LastChangedBy$ … … 37 37 +-------------------------------------------------------------------------+ 38 38 */ 39 function showSystemMessages($db){ 40 $querystatement="SELECT notes.id,subject,content,concat(users.firstname,\" \",users.lastname) as createdby, 41 notes.creationdate 42 FROM notes INNER JOIN users ON notes.createdby=users.id 43 WHERE type=\"SM\" ORDER BY importance DESC,notes.creationdate"; 44 45 $queryresult=$db->query($querystatement); 46 47 if($db->numRows($queryresult)){ 48 ?> 49 <div class="box" id="systemMessageContainer"> 50 <h2>System Messages</h2> 51 <?php while($therecord=$db->fetchArray($queryresult)) { 52 $therecord["content"]=str_replace("\n","<br />",htmlQuotes($therecord["content"])); 39 class baseSnapshot{ 40 41 function baseSnapshot($db, $phpbms, $userid){ 42 43 $this->db = $db; 44 $this->phpbms = $phpbms; 45 $this->userid = $userid; 46 47 }//endmethod (init) 48 49 50 function showSystemMessages(){ 51 52 $querystatement = " 53 SELECT 54 notes.id, 55 notes.subject, 56 notes.content, 57 concat(users.firstname,' ',users.lastname) AS createdby, 58 notes.creationdate 59 FROM 60 notes INNER JOIN users ON notes.createdby=users.id 61 WHERE 62 type='SM' 63 ORDER BY 64 importance DESC, 65 notes.creationdate"; 66 67 $queryresult = $this->db->query($querystatement); 68 69 if($this->db->numRows($queryresult)){ ?> 70 71 <div class="box" id="systemMessageContainer"> 72 <h2>System Messages</h2> 73 <?php while($therecord = $this->db->fetchArray($queryresult)) { 74 75 $therecord["content"] = str_replace("\n","<br />",htmlQuotes($therecord["content"])); 76 77 ?> 78 <h3 class="systemMessageLinks"><?php echo htmlQuotes($therecord["subject"])?> <span>[ <?php echo htmlQuotes(formatFromSQLDateTime($therecord["creationdate"]))?> <?php echo htmlQuotes($therecord["createdby"])?>]</span></h3> 79 <div class="systemMessages"> 80 <p><?php echo $therecord["content"]?></p> 81 </div> 82 <?php }//end while ?> 83 </div> 84 <?php }//endif 85 86 }//end method showSystemMessages 87 88 89 function showTasks($type){ 90 91 $querystatement=" 92 SELECT 93 id, 94 type, 95 subject, 96 completed, 97 if(enddate < CURDATE(),1,0) AS ispastdue, 98 if(assignedtodate < CURDATE(),1,0) AS ispastassigneddate, 99 startdate, 100 enddate, 101 assignedtodate, 102 private, 103 assignedbyid, 104 assignedtoid, 105 IF(assignedtodate IS NOT NULL, assignedtodate, IF((enddate IS NOT NULL && type = 'TS'), enddate, IF((startdate IS NOT NULL && type = 'EV'), startdate, CURDATE()))) AS xdate 106 FROM 107 notes 108 WHERE"; 109 110 switch($type){ 111 112 case "ReceivedAssignments": 113 114 $querystatement.=" 115 assignedtoid = ".$this->userid." 116 OR ( 117 type = 'TS' 118 AND (assignedtoid = 0 OR assignedtoid IS NULL) 119 AND createdby = ".$this->userid." 120 ) AND (completed = 0 121 OR (completed = 1 AND completeddate >= CURDATE()) 122 )"; 123 124 $title = "Assignments"; 125 $id = "AS"; 126 break; 127 128 case "GivenAssignments": 129 130 $querystatement.=" 131 assignedbyid = ".$this->userid." 132 AND (completed = 0 133 OR (completed = 1 AND completeddate >= CURDATE()) 134 )"; 135 136 $title = "Delegations"; 137 $id = "DG"; 138 break; 139 140 }//endswitch 141 142 143 $querystatement.="AND ( 144 (startdate IS NULL AND enddate IS NULL AND assignedtodate IS NULL) OR 145 (startdate IS NOT NULL AND startdate <= DATE_ADD(CURDATE(),INTERVAL 30 DAY)) OR 146 (enddate IS NOT NULL AND enddate <= DATE_ADD(CURDATE(),INTERVAL 30 DAY)) OR 147 (assignedtodate IS NOT NULL AND assignedtodate <= DATE_ADD(CURDATE(),INTERVAL 30 DAY)) 148 )"; 149 150 $querystatement.=" ORDER BY 151 importance DESC, 152 xdate, 153 subject"; 154 155 156 $queryresult = $this->db->query($querystatement); 157 158 $numRows = $this->db->numRows($queryresult); 53 159 ?> 54 <h3 class="systemMessageLinks"><?php echo htmlQuotes($therecord["subject"])?> <span>[ <?php echo htmlQuotes(formatFromSQLDateTime($therecord["creationdate"]))?> <?php echo htmlQuotes($therecord["createdby"])?>]</span></h3> 55 <div class="systemMessages"> 56 <p><?php echo $therecord["content"]?></p> 57 </div> 58 <?php }//end while ?> 59 </div> 60 <?php } 61 } 62 63 64 function showTasks($db,$userid,$type="Tasks"){ 65 66 global $phpbms; 67 68 $querystatement="SELECT id,type,subject, completed, if(enddate < CURDATE(),1,0) as ispastdue, startdate, enddate, private, assignedbyid, assignedtoid 69 FROM notes 70 WHERE "; 71 switch($type){ 72 case "Tasks": 73 $querystatement.=" type=\"TS\" AND (private=0 or (private=1 and createdby=".$userid.")) 74 AND (completed=0 or (completed=1 and completeddate=CURDATE())) 75 AND (assignedtoid is null or assignedtoid=0)"; 76 $title="Tasks"; 77 $id = "TS"; 78 break; 79 80 case "ReceivedAssignments": 81 $querystatement.=" assignedtoid=".$userid." AND (completed=0 or (completed=1 and completeddate=CURDATE()))"; 82 $title="Assignments"; 83 $id = "AS"; 84 break; 85 86 case "GivenAssignments": 87 $querystatement.=" assignedbyid=".$userid." AND (completed=0 or (completed=1 and completeddate=CURDATE()))"; 88 $title="Delegations"; 89 $id = "DG"; 90 break; 91 } 92 $querystatement.="AND ( 93 (startdate is null AND enddate is null) OR 94 (startdate is not null AND startdate <= DATE_ADD(CURDATE(),INTERVAL 7 DAY)) OR 95 (enddate is not null AND enddate <= DATE_ADD(CURDATE(),INTERVAL 7 DAY)) 96 )"; 97 98 $querystatement.=" ORDER BY importance DESC,notes.enddate,notes.endtime,notes.startdate DESC,notes.starttime DESC,notes.creationdate DESC"; 99 100 101 $queryresult=$db->query($querystatement); 102 103 ?> 104 <h3 class="tasksLinks"><?php echo $title; if($db->numRows($queryresult)) {?> <span class="small">(<?php echo $db->numRows($queryresult)?>)</span><?php } ?></h3> 105 <div class="tasksDivs"><div> 106 <?php 107 108 if($db->numRows($queryresult)){ 109 while($therecord=$db->fetchArray($queryresult)) { 110 111 $className="tasks"; 112 113 if($therecord["completed"]) 114 $className.=" complete"; 115 else if($therecord["ispastdue"]) 116 $className.=" pastDue"; 117 118 if($therecord["private"]) $className.=" private"; 119 120 $className.=" ".$therecord["type"]; 121 122 $checkBoxID = $id.$therecord["type"]."C".$therecord["id"]; 123 ?> 124 <p id="<?php echo $id.$therecord["id"]?>" class="<?php echo $className?>"> 125 <input class="radiochecks taskChecks" id="<?php echo $checkBoxID?>" name="<?php echo $checkBoxID?>" type="checkbox" value="1" <?php if($therecord["completed"]) echo 'checked="checked"'?> align="middle" /> 126 <a href="<?php echo getAddEditFile($db,12)."?id=".$therecord["id"]?>&backurl=snapshot.php"><?php echo htmlQuotes($therecord["subject"])?></a> 127 <?php 128 if($type == "Tasks") { 129 if($therecord["enddate"]) { 130 ?><em >(<?php echo htmlQuotes(formatFromSQLDate($therecord["enddate"])) ?>)</em><?php 131 } 132 } else { 133 ?> <em>(<?php if($type=="ReceivedAssignments") $tid=$therecord["assignedbyid"]; else $tid=$therecord["assignedtoid"]; echo htmlQuotes($phpbms->getUserName($tid))?>)</em><?php 134 } ?> 135 </p> 136 <?php } } else { 137 ?><p class="small disabledtext">no <?php echo strtolower($title)?></p><?php 138 }?></div></div> <?php 139 } 140 160 161 <h3 class="tasksLinks"><?php echo $title; if($numRows) {?> <span class="small">(<?php echo $numRows?>)</span><?php } ?></h3> 162 163 <div class="tasksDivs"> 164 <div> 165 166 <?php if($numRows){ 167 168 $linkStart = getAddEditFile($this->db,12); 169 $section["title"] = "Now"; 170 $section["date"] = mktime(0,0,0,date("m"),date("d")+3,date("Y"));; 171 172 while($therecord = $this->db->fetchArray($queryresult)) { 173 174 $className="tasks"; 175 176 if($therecord["completed"]) 177 $className.=" complete"; 178 else if($therecord["ispastdue"] || $therecord["ispastassigneddate"]) 179 $className.=" pastDue"; 180 181 if($therecord["private"]) $className.=" private"; 182 183 $className.=" ".$therecord["type"]; 184 185 $checkBoxID = $id.$therecord["type"]."C".$therecord["id"]; 186 187 $link = $linkStart."?id=".$therecord["id"]."&backurl=snapshot.php"; 188 189 $rightSide = ""; 190 191 if($therecord["assignedtodate"]) 192 $rightSide .= "FUP: ".formatFromSQLDate($therecord["assignedtodate"])."<br />"; 193 194 switch($therecord["type"] ){ 195 196 case "TS": 197 if($therecord["enddate"]) 198 $rightSide .= "Due: ".formatFromSQLDate($therecord["enddate"])."<br />"; 199 break; 200 201 case "EV": 202 $rightSide .= "Start: ".formatFromSQLDate($therecord["startdate"])."<br />"; 203 $rightSide .= "End: ".formatFromSQLDate($therecord["enddate"])."<br />"; 204 break; 205 206 }//endswitch 207 208 if(!$rightSide) 209 $rightSide = " "; 210 211 $bottomInfo = ""; 212 213 switch($type){ 214 215 case "ReceivedAssignments": 216 if($therecord["assignedbyid"]) 217 $bottomInfo = "Assigned By: ".htmlQuotes($this->phpbms->getUserName($therecord["assignedbyid"])); 218 break; 219 220 case "GivenAssignments": 221 $bottomInfo = "Assigned To: ".htmlQuotes($this->phpbms->getUserName($therecord["assignedtoid"])); 222 break; 223 224 }//endswitch 225 226 // Looking for grouping changes in headers (3 days, 4-7 days, > 7 days) 227 $xdate = stringToDate($therecord["xdate"],"SQL") ; 228 if($xdate > $section["date"]){ 229 230 while($xdate > $section["date"]){ 231 232 switch($section["title"]){ 233 234 case "Now": 235 $section["title"] = "Soon"; 236 $section["date"] = mktime(0,0,0,date("m"),date("d")+7,date("Y"));; 237 break; 238 239 case "Soon": 240 $section["title"] = "Later"; 241 $section["date"] = mktime(0,0,0,date("m"),date("d")+31,date("Y"));; 242 break; 243 244 }//end switch 245 246 }//endwhile 247 248 ?><div class="taskSection"><?php echo $section["title"] ?></div><?php 249 250 }//end if 251 252 ?> 253 254 <div id="<?php echo $id.$therecord["id"]?>" class="<?php echo $className?>"> 255 256 <span class="taskRight"><?php echo $rightSide ?></span> 257 258 <input class="radiochecks taskChecks" id="<?php echo $checkBoxID?>" name="<?php echo $checkBoxID?>" type="checkbox" value="1" <?php if($therecord["completed"]) echo 'checked="checked"'?> align="middle" /> 259 260 <a href="<?php echo $link?>"><?php echo htmlQuotes($therecord["subject"])?></a> 261 262 <?php if($bottomInfo){ ?> 263 264 <p><?php echo $bottomInfo ?></p> 265 266 <? }//endif ?> 267 </div> 268 269 <?php }//endwhile 270 } else { ?> 271 <p class="small disabledtext">no <?php echo strtolower($title)?></p><?php 272 }?> 273 </div> 274 </div> <?php 275 276 }//end method showTasks 277 278 279 }// end class baseSnapshot 141 280 142 281 ?> 143 -
branches/nathan/modules/base/javascript/snapshot.js
r308 r450 38 38 39 39 theEvent = { 40 40 41 41 idents: Array(), 42 42 43 43 getWeek: function(e){ 44 44 45 45 var eventDate; 46 46 47 47 if(e){ 48 48 var srcObj = e.src(); 49 49 50 50 for(var i=0; i<theEvent.idents.length; i++) 51 51 disconnect(theEvent.idents[i]); 52 52 53 53 switch(srcObj.id) { 54 54 55 55 case "eventLastWeek": 56 56 eventDate = getObjectFromID("eventDateLast").value; 57 57 break; 58 58 59 59 case "eventToday": 60 60 eventDate = getObjectFromID("eventDateToday").value; 61 61 break; 62 62 63 63 case "eventNextWeek": 64 64 eventDate = getObjectFromID("eventDateNext").value; … … 67 67 }//endswitch 68 68 }//endif 69 69 70 70 var theURL = "snapshot_ajax.php?cm=getWeek"; 71 71 if(eventDate) 72 72 theURL += "&d="+eventDate; 73 73 74 74 var weekContainer = getObjectFromID("eventsBox"); 75 75 loadXMLDoc(theURL,null,false); … … 78 78 theEvent.idents[theEvent.idents.length] = connect(getObjectFromID("eventLastWeek"),"onclick",theEvent.getWeek); 79 79 theEvent.idents[theEvent.idents.length] = connect(getObjectFromID("eventToday"),"onclick",theEvent.getWeek); 80 theEvent.idents[theEvent.idents.length] = connect(getObjectFromID("eventNextWeek"),"onclick",theEvent.getWeek); 81 80 theEvent.idents[theEvent.idents.length] = connect(getObjectFromID("eventNextWeek"),"onclick",theEvent.getWeek); 81 82 82 }//end method 83 83 84 84 }//end class 85 85 86 86 87 87 task = { 88 88 89 89 check: function(e){ 90 90 var srcObj = e.src(); 91 91 92 92 var id = srcObj.id.substr(5); 93 93 var type = srcObj.id.substr(2,2); 94 94 var section = srcObj.id.substr(0,2); 95 95 96 96 var checkBox = srcObj; 97 97 var containerP = srcObj.parentNode; 98 98 99 99 var theURL = "snapshot_ajax.php?id="+id+"&ty="+type+"&cm=updateTask&cp="; 100 100 101 101 if(checkBox.checked){ 102 102 103 103 theURL += 1; 104 104 105 105 containerP.className += " complete"; 106 106 107 107 } else { 108 108 109 109 theURL += 0; 110 110 111 111 containerP.className = containerP.className.replace(/complete/g, ""); 112 112 113 113 }//end if 114 114 115 115 loadXMLDoc(theURL,null,false); 116 116 117 117 }//end method 118 118 }//end class … … 127 127 for(var i=0; i<taskChecks.length; i++) 128 128 connect(taskChecks[i],"onclick",task.check); 129 129 130 130 var systemMessageDivs = getElementsByClassName('systemMessages'); 131 131 var systemMessageLinks = getElementsByClassName('systemMessageLinks'); … … 136 136 var systemMessageAccordion = new fx.Accordion(systemMessageLinks, systemMessageDivs, {opacity: true, duration:150}); 137 137 var taskAccordion = new fx.Accordion(taskLinks, taskDivs, {opacity: true, duration:300}); 138 taskAccordion.showThisHideOpen(taskDivs[ 2]);139 138 taskAccordion.showThisHideOpen(taskDivs[1]); 139 140 140 theEvent.getWeek(); 141 141 }); -
branches/nathan/modules/base/snapshot.php
r371 r450 37 37 +-------------------------------------------------------------------------+ 38 38 */ 39 require_once("../../include/session.php"); 39 require_once("../../include/session.php"); 40 40 require_once("include/snapshot_include.php"); 41 41 42 42 //Page details; 43 43 $pageTitle = APPLICATION_NAME; 44 44 45 45 $phpbms->cssIncludes[] = "pages/snapshot.css"; 46 46 47 47 $phpbms->jsIncludes[] = "modules/base/javascript/snapshot.js"; 48 48 49 49 foreach($phpbms->modules as $modulename => $modinfo){ 50 50 if(file_exists("../".$modulename."/javascript/snapshot.js") && $modulename != "base") 51 51 $phpbms->jsIncludes[] = "modules/".$modulename."/javascript/snapshot.js"; 52 52 53 53 if(file_exists("../../common/stylesheet/".STYLESHEET."/pages/".$modulename."/snapshot.css")) 54 54 $phpbms->cssIncludes[] = "pages/".$modulename."/snapshot.css"; 55 55 56 56 }//end if 57 57 58 58 require("header.php"); 59 59 60 $myBase = new baseSnapshot($db, $phpbms, $_SESSION["userinfo"]["id"]); 61 60 62 ?> 61 63 <div class="bodyline"> 62 64 <h1><?php echo $_SESSION["userinfo"]["firstname"]; if($_SESSION["userinfo"]["lastname"]) echo " ".$_SESSION["userinfo"]["lastname"]?>'s Snapshot</h1> 63 <?php showSystemMessages($db) ?>64 65 <?php $myBase->showSystemMessages() ?> 66 65 67 <div id="notesStuff"> 66 68 <table cellpadding="0" cellspacing="0" border="0"> … … 70 72 <td class="box" id="tasksBox"> 71 73 <h2>Workload</h2> 72 <?php 73 showTasks($db,$_SESSION["userinfo"]["id"],"GivenAssignments");74 showTasks($db,$_SESSION["userinfo"]["id"],"ReceivedAssignments");75 showTasks($db,$_SESSION["userinfo"]["id"],"Tasks");74 <?php 75 $myBase->showTasks("GivenAssignments"); 76 $myBase->showTasks("ReceivedAssignments"); 77 //showTasks($db,$_SESSION["userinfo"]["id"],"Tasks"); 76 78 ?> 77 79 </td> … … 79 81 </table> 80 82 </div> 81 83 82 84 <div style="clear:both;"></div> 83 85 84 <?php 85 foreach($phpbms->modules as $modulename => $modinfo) 86 <?php 87 foreach($phpbms->modules as $modulename => $modinfo) 86 88 if(file_exists("../".$modulename."/snapshot.php") && $modulename != "base") 87 89 include("../".$modulename."/snapshot.php"); -
branches/nathan/modules/bms/clients_credit.php
r311 r450 1 <?php 1 <?php 2 2 /* 3 3 $Rev: 285 $ | $LastChangedBy: brieb $ … … 46 46 $clientCredit = new clientCredit($db, $_GET["id"]); 47 47 48 if(isset($_POST[" hascredit"])){48 if(isset($_POST["creditlimit"])){ 49 49 if($clientCredit->update(addSlashesToArray($_POST) )) 50 $status Message = "Credit Updated";50 $statusmessage = "Credit Updated"; 51 51 } 52 52 53 53 $therecord = $clientCredit->get(); 54 54 55 55 //setting page title 56 56 $pageTitle="Credit: "; … … 76 76 $theinput->setAttribute("readonly","readonly"); 77 77 $theform->addField($theinput); 78 78 79 79 $theinput = new inputCurrency("creditleft", ($therecord["creditlimit"]-$therecord["outstanding"]), "credit left"); 80 80 $theinput->setAttribute("readonly","readonly"); … … 86 86 87 87 88 include("header.php"); 88 include("header.php"); 89 89 90 90 $phpbms->showTabs("clients entry",300,$_GET["id"]);?><div class="bodyline"> 91 <form action="<?php echo str_replace("&","&",$_SERVER["REQUEST_URI"]) ?>" 91 <form action="<?php echo str_replace("&","&",$_SERVER["REQUEST_URI"]) ?>" 92 92 method="post" name="record" id="record"> 93 93 <div id="topButtons"> 94 94 <input type="button" class="Buttons" id="update1" name="update" value="save"/> 95 95 </div> 96 96 97 97 <h1 id="h1Title"><span><?php echo $pageTitle ?></span></h1> 98 98 <input type="hidden" id="type" name="type" value="<?php echo $therecord["type"]?>" /> 99 99 100 100 <fieldset> 101 101 <legend>Credit</legend> … … 103 103 <p class="notes">Credit can only be set for clients.</p> 104 104 <?php }?> 105 105 106 106 <p><?php $theform->showField("hascredit")?></p> 107 107 108 108 <p><?php $theform->showField("creditlimit")?></p> 109 109 … … 114 114 115 115 <?php if($therecord["hascredit"]) {?> 116 116 117 117 <fieldset> 118 118 <legend>open items</legend> 119 119 <div class="fauxP"> 120 120 121 121 <?php $clientCredit->showHistory($_GET["id"])?> 122 122 123 123 </div> 124 124 </fieldset> 125 125 126 126 <?php } //end if?> 127 127 -
branches/nathan/modules/bms/install/updatev0.96.sql
r397 r450 18 18 INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('2', 'e-mail', 'clients.email', 'left', '', '3', '', '0', '', NULL, '0'); 19 19 INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('2', 'has credit', 'clients.hascredit', 'center', '', '1', '', '0', '', 'boolean', '80'); 20 INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('2', 'name / location', 'CONCAT(\'[b]\',IF(clients.company != \'\', CONCAT(clients.company,IF(clients.lastname != \'\' OR clients.firstname != \'\', CONCAT(\' (\',if(clients.lastname != \'\', clients.lastname, \'{blank}\'),\', \',if(clients.firstname != \'\', clients.firstname, \'{blank}\'),\')\'), \'\')), IF(clients.lastname != \'\' OR clients.firstname != \'\', CONCAT(if(clients.lastname != \'\', clients.lastname, \'{blank}\'),\', \',if(clients.firstname != \'\', clients.firstname, \'{blank}\')), \'\')),\'[/b][br][space]\', IF(addresses.city != \'\' OR addresses.state !=\'\' OR addresses.postalcode != \'\', CONCAT(IF(addresses.city != \'\',addresses.city,\'\'),\', \',IF(addresses.state != \'\', addresses.state, \'\'),\' \',IF(addresses.postalcode != \'\', addresses.postalcode, \'\')),\'(no location)\'))', 'left', '', '2', 'concat(clients.company,clien nts.lastname,clients.firstname)', '0', '100%', 'bbcode', '0');20 INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('2', 'name / location', 'CONCAT(\'[b]\',IF(clients.company != \'\', CONCAT(clients.company,IF(clients.lastname != \'\' OR clients.firstname != \'\', CONCAT(\' (\',if(clients.lastname != \'\', clients.lastname, \'{blank}\'),\', \',if(clients.firstname != \'\', clients.firstname, \'{blank}\'),\')\'), \'\')), IF(clients.lastname != \'\' OR clients.firstname != \'\', CONCAT(if(clients.lastname != \'\', clients.lastname, \'{blank}\'),\', \',if(clients.firstname != \'\', clients.firstname, \'{blank}\')), \'\')),\'[/b][br][space]\', IF(addresses.city != \'\' OR addresses.state !=\'\' OR addresses.postalcode != \'\', CONCAT(IF(addresses.city != \'\',addresses.city,\'\'),\', \',IF(addresses.state != \'\', addresses.state, \'\'),\' \',IF(addresses.postalcode != \'\', addresses.postalcode, \'\')),\'(no location)\'))', 'left', '', '2', 'concat(clients.company,clients.lastname,clients.firstname)', '0', '100%', 'bbcode', '0'); 21 21 INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('2', 'type', 'clients.type', 'left', '', '0', '', '0', '', NULL, '0'); 22 22 INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('2', 'phone', 'IF(clients.workphone != \'\' OR clients.homephone != \'\' OR clients.mobilephone != \'\' OR clients.otherphone != \'\',IF(clients.workphone != \'\', concat(clients.workphone, \' (w)\'), IF(clients.homephone != \'\', concat(clients.homephone, \' (h)\'), IF(clients.mobilephone != \'\', concat(clients.mobilephone, \' (m)\'), IF(clients.otherphone != \'\', concat(clients.otherphone, \' (o)\'), \'\')))) ,\'\')', 'left', '', '4', 'concat(clients.workphone, clients.homephone, clients.mobilephone,clients.otherphone)', '0', '', NULL, '0'); -
branches/nathan/report/report_class.php
r416 r450 58 58 $this->sortorder = $_SESSION["printing"]["sortorder"]; 59 59 60 if(isset($_SESSION["printing"]["whereclause"])) 60 if(isset($_SESSION["printing"]["whereclause"])){ 61 62 if(strpos($_SESSION["printing"]["whereclause"],"WHERE") === 0) 63 $this->whereclause = substr($this->whereclause, 5); 64 61 65 $this->whereclause = $_SESSION["printing"]["whereclause"]; 66 67 }//endif 62 68 63 69 //backwards compatibility -
branches/nathan/smartsearch.php
r384 r450 47 47 48 48 function smartSearch($db, $sdbid){ 49 49 50 50 $this->db = $db; 51 51 52 52 $this->getSearchParams($sdbid); 53 53 54 54 }//end method init 55 55 56 56 57 57 function getSearchParams($sdbid){ 58 58 59 59 $querystatement = " 60 60 SELECT … … 64 64 WHERE 65 65 id = ".((int) $sdbid); 66 66 67 67 $this->searchParams = $this->db->fetchArray($this->db->query($querystatement)); 68 68 69 69 }//end method - getSearchParams 70 70 … … 73 73 74 74 $term = trim(mysql_real_escape_string($term)); 75 75 76 76 // first we take the entered text and explode int by words 77 77 $terms = explode(" ",$term); 78 78 79 79 //next we take the list of fields to search and create an array 80 80 $searchFields = explode(",", $this->searchParams["searchfields"]); 81 81 82 82 $wheres=""; 83 83 foreach($terms as $value){ 84 84 85 85 // this series of foreachs builds a SQL OR clause to search 86 86 // the search fields to match things that start with the term 87 87 // or has words inside that start with the term. 88 88 89 89 $wheres .="AND ("; 90 90 91 91 foreach($searchFields as $field) 92 92 $wheres .= trim($field)." LIKE '".$value."%' OR ".trim($field)." LIKE '% ".$value."%'\nOR "; 93 93 94 94 $wheres = substr($wheres,0,strlen($wheres)-3); 95 95 $wheres .= ")"; 96 96 97 97 }//endforeach 98 98 99 99 if($wheres){ 100 100 101 101 $finalsearch = ""; 102 102 foreach($searchFields as $field) 103 103 $finalsearch .= trim($field)." LIKE '".$term."%'\nOR "; 104 104 105 105 $finalsearch = substr($finalsearch,0,strlen($finalsearch)-3); 106 106 107 107 $wheres = "AND ( (".$finalsearch.") OR (".substr($wheres,4)."))"; 108 108 109 109 }//endif - where 110 110 111 111 $securityWhere = ""; 112 112 113 113 if($this->searchParams["rolefield"]){ 114 114 115 115 // If the rolefield is present, we need to make sure the rolefield 116 116 // of each record matches the logged in users array of roles 117 117 118 118 if ($_SESSION["userinfo"]["admin"]!=1){ 119 119 120 120 if(count($_SESSION["userinfo"]["roles"])>0) 121 121 $securityWhere = " AND ".$this->searchParams["rolefield"]." IN (".implode(",",$_SESSION["userinfo"]["roles"]).",0)"; 122 122 else 123 123 $securityWhere = " AND ".$this->searchParams["rolefield"]." = 0"; 124 124 125 125 }//endif admin 126 126 127 127 }//endif rolefield 128 128 129 129 $querystatement = " 130 130 SELECT DISTINCT … … 136 136 ".$this->searchParams["fromclause"]." 137 137 WHERE 138 (".$this->s earchParams["filterclause"].")138 (".$this->subout($this->searchParams["filterclause"]).") 139 139 ".$securityWhere." 140 140 ".$wheres." … … 145 145 146 146 //need to retireve count of all records so 147 // the JS can know wheher to put the show more results on. 147 // the JS can know wheher to put the show more results on. 148 148 $totalCountStatement = " 149 149 SELECT … … 155 155 ".$securityWhere." 156 156 ".$wheres; 157 157 158 158 $countrecord = $this->db->fetchArray($this->db->query($totalCountStatement)); 159 159 $this->totalcount = $countrecord["thecount"]; 160 160 161 161 return $this->db->query($querystatement); 162 162 163 163 }//end method 164 164 165 165 166 166 function display($result){ 167 167 // This function will spit out a JSON array of records 168 168 169 169 $output = "{totalRecords: ".$this->totalcount.", resultRecords: ["; 170 170 171 171 while($therecord = $this->db->fetchArray($result)){ 172 172 173 173 $output .= "{display: '".str_replace("'", "\'", formatVariable($therecord["display"],"bbcode"))."',"; 174 174 $output .= "value: '".str_replace("'", "\'", formatVariable($therecord["value"]))."',"; 175 175 $output .= "secondary: '".str_replace("'", "\'", formatVariable($therecord["secondary"],"bbcode"))."',"; 176 176 $output .= "classname: '".str_replace("'", "\'", formatVariable($therecord["classname"]))."'},"; 177 177 178 178 }//endwhile 179 179 180 180 if($output != "{totalRecords: ".$this->totalcount.", resultRecords: [") 181 181 $output = substr($output, 0, strlen($output)-1); 182 182 183 183 $output .= "] }"; 184 184 185 185 header("Content-type: text/plain"); 186 186 echo $output; 187 187 188 188 }//end method - display 189 190 191 // replace variables 192 // strings with entrys like " {{$ENTRY}} " 193 // get everything in the {{ }} evaluated 194 function subout($string){ 195 196 while(strpos($string,"{{")){ 197 $start=strpos($string,"{{"); 198 $startsubout=$start+2; 199 $endsubout=strpos($string,"}}"); 200 $end=$endsubout+2; 201 $temp=""; 202 eval(stripslashes("\$temp=".substr($string,$startsubout,$endsubout-$startsubout).";")); 203 $string=substr($string,0,$start).$temp.substr($string,$end); 204 } 205 206 return $string; 207 208 }//end function 189 209 190 210 }//end class … … 196 216 197 217 $smartSearch = new smartSearch($db, $_GET["sdbid"]); 198 218 199 219 if(!isset($_GET["o"])) 200 220 $_GET["o"] = 0; … … 202 222 $theresult = $smartSearch->find($_GET["t"],((int) $_GET["o"])); 203 223 204 if(isset($theresult)) 224 if(isset($theresult)) 205 225 $smartSearch->display($theresult); 206 226 207 227 }//end if 208 228 ?>