Commit d564806b92266cd63d6ad4ece2cdbe7a3c8cd750

Authored by Neil Blakey-Milner
1 parent 5d349757

Until this inelegant pattern is refactored away, allow users to securely

add code to run before and after storage of the item.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3525 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/visualpatterns/PatternEditableTableSqlQuery.inc
@@ -68,6 +68,8 @@ class PatternEditableTableSqlQuery { @@ -68,6 +68,8 @@ class PatternEditableTableSqlQuery {
68 var $aRequiredColumnNames; 68 var $aRequiredColumnNames;
69 var $aRequiredFieldNames; 69 var $aRequiredFieldNames;
70 var $aMetaDataFields; 70 var $aMetaDataFields;
  71 +
  72 + var $sPreCode;
71 73
72 function PatternEditableTableSqlQuery($sTmpQuery, $sTmpTableName, $aTmpStoreColumnNames, $aTmpDisplayColumnNames, $aTmpColumnsEditable, $aTmpColumnsVisible, $aTmpColumnDisplayTypes, $aTmpColumnDatabaseTypes) { 74 function PatternEditableTableSqlQuery($sTmpQuery, $sTmpTableName, $aTmpStoreColumnNames, $aTmpDisplayColumnNames, $aTmpColumnsEditable, $aTmpColumnsVisible, $aTmpColumnDisplayTypes, $aTmpColumnDatabaseTypes) {
73 $this->sQuery = $sTmpQuery; 75 $this->sQuery = $sTmpQuery;
@@ -81,41 +83,16 @@ class PatternEditableTableSqlQuery { @@ -81,41 +83,16 @@ class PatternEditableTableSqlQuery {
81 $this->aColumnDatabaseTypes = $aTmpColumnDatabaseTypes; 83 $this->aColumnDatabaseTypes = $aTmpColumnDatabaseTypes;
82 } 84 }
83 85
84 - function setUniqueName($sNewValue) {  
85 - $this->sUniqueName = $sNewValue;  
86 - }  
87 -  
88 - function setMetaDataFields($aNewValue) {  
89 - $this->aMetaDataFields = $aNewValue;  
90 - }  
91 -  
92 - function setDisplayColumnHeadings($bNewValue) {  
93 - $this->bDisplayColumnHeadings = $bNewValue;  
94 - }  
95 -  
96 - function setTableCaption($sNewValue) {  
97 - $this->sTableCaption = $sNewValue;  
98 - }  
99 -  
100 - function setColumnHeaderNames($aNewValue) {  
101 - $this->aColumnHeaderNames = $aNewValue;  
102 - }  
103 -  
104 - /*function getRequiredVariableNames() {  
105 - return $this->aRequiredVariableNames;  
106 - }*/  
107 -  
108 - function setRequiredColumnNames($aNewValue) {  
109 - $this->aRequiredColumnNames = $aNewValue;  
110 - }  
111 -  
112 - function setEmptyTableMessage($sNewValue) {  
113 - $this->sEmptyTableMessage = $sNewValue;  
114 - }  
115 -  
116 - function setRenderJavascriptValidation($bNewValue) {  
117 - $this->bRenderJavascriptValidation = $bNewValue;  
118 - } 86 + function setUniqueName($sNewValue) { $this->sUniqueName = $sNewValue; }
  87 + function setMetaDataFields($aNewValue) { $this->aMetaDataFields = $aNewValue; }
  88 + function setDisplayColumnHeadings($bNewValue) { $this->bDisplayColumnHeadings = $bNewValue; }
  89 + function setTableCaption($sNewValue) { $this->sTableCaption = $sNewValue; }
  90 + function setColumnHeaderNames($aNewValue) { $this->aColumnHeaderNames = $aNewValue; }
  91 + function setRequiredColumnNames($aNewValue) { $this->aRequiredColumnNames = $aNewValue; }
  92 + function setEmptyTableMessage($sNewValue) { $this->sEmptyTableMessage = $sNewValue; }
  93 + function setRenderJavascriptValidation($bNewValue) { $this->bRenderJavascriptValidation = $bNewValue; }
  94 + function setPreCode($sNewValue) { $this->sPreCode = $sNewValue; }
  95 + function setPostCode($sNewValue) { $this->sPostCode = $sNewValue; }
119 96
120 function & render() { 97 function & render() {
121 global $default; 98 global $default;
@@ -150,6 +127,8 @@ class PatternEditableTableSqlQuery { @@ -150,6 +127,8 @@ class PatternEditableTableSqlQuery {
150 while ($sql->next_record()) { 127 while ($sql->next_record()) {
151 $sToRender .= "<tr>\n"; 128 $sToRender .= "<tr>\n";
152 $_SESSION["pelfq_" . $this->sUniqueName . $iRowCount . "_id"] = $sql->f("id"); 129 $_SESSION["pelfq_" . $this->sUniqueName . $iRowCount . "_id"] = $sql->f("id");
  130 + $_SESSION["pelfq_" . $this->sUniqueName . $iRowCount . "_code_pre"] = $this->sPreCode;
  131 + $_SESSION["pelfq_" . $this->sUniqueName . $iRowCount . "_code_post"] = $this->sPostCode;
153 $_SESSION["pelfq_" . $this->sUniqueName . $iRowCount . "_tn"] = $this->sTableName; 132 $_SESSION["pelfq_" . $this->sUniqueName . $iRowCount . "_tn"] = $this->sTableName;
154 $_SESSION["pelfq_" . $this->sUniqueName . $iRowCount . "_columns"] = $this->aStoreColumnNames; 133 $_SESSION["pelfq_" . $this->sUniqueName . $iRowCount . "_columns"] = $this->aStoreColumnNames;
155 $sToRender .= "<input type=\"hidden\" name=\"unique_start_" . $this->sUniqueName . $iRowCount . "\" value=\"\" />\n"; 134 $sToRender .= "<input type=\"hidden\" name=\"unique_start_" . $this->sUniqueName . $iRowCount . "\" value=\"\" />\n";