2
2
/* Basic users should NOT need to ever edit this file */
3
3
4
4
/************************************************************************/
5
- /* ajaxCRUD.class.php v8.71 */
5
+ /* ajaxCRUD.class.php v8.72 */
6
6
/* =========================== */
7
7
/* Copyright (c) 2013 by Loud Canvas Media (arts@loudcanvas.com) */
8
8
/* http://www.ajaxcrud.com by http://www.loudcanvas.com */
@@ -281,7 +281,8 @@ class ajaxCRUD{
281
281
changed by setting them via $obj->addText = "Añadir"
282
282
*/
283
283
var $ emptyTableMessage ;
284
- var $ addText , $ deleteText , $ cancelText ;
284
+ var $ addText , $ deleteText , $ cancelText ; //text values for buttons
285
+ var $ addMessage ; //used when onAddExecuteCallBackFunction is leveraged
285
286
286
287
var $ sort_direction ; //used when sorting the table via ajax
287
288
@@ -362,6 +363,7 @@ function ajaxCRUD($item, $db_table, $db_table_pk, $ajaxcrud_root = "") {
362
363
$ this ->deleteText = "Delete " ;
363
364
$ this ->cancelText = "Cancel " ;
364
365
$ this ->emptyTableMessage = "No data in this table. Click add button below. " ;
366
+ $ this ->addMessage = "" ; //when blank, defaults to generic '{Item} added' message
365
367
366
368
$ this ->onAddExecuteCallBackFunction = '' ;
367
369
$ this ->onFileUploadExecuteCallBackFunction = '' ;
@@ -962,7 +964,12 @@ function doAction($action){
962
964
$ insert_id = mysql_insert_id (); //the old, mysql way of getting it (procedurual php)
963
965
}
964
966
965
- $ report_msg [] = "$ item Added " ;
967
+ if ($ this ->addMessage == "" ){
968
+ $ report_msg [] = "$ item Added " ;
969
+ }
970
+ else {
971
+ $ report_msg [] = $ this ->addMessage ;
972
+ }
966
973
967
974
if ($ uploads_on ){
968
975
foreach ($ this ->file_uploads as $ field_name ){
@@ -975,7 +982,7 @@ function doAction($action){
975
982
}
976
983
977
984
if ($ this ->onAddExecuteCallBackFunction != '' ){
978
- $ submitted_array [id ] = $ insert_id ;
985
+ $ submitted_array [' id ' ] = $ insert_id ;
979
986
$ submitted_array [$ this ->db_table_pk ] = $ insert_id ;
980
987
call_user_func ($ this ->onAddExecuteCallBackFunction , $ submitted_array );
981
988
}
@@ -1823,7 +1830,13 @@ function showTable(){
1823
1830
//$add_html .= " <input type=\"button\" value=\"Go Back\" class=\"btn\" onClick=\"history.back();\">\n";
1824
1831
$ add_html .= "</center> \n" ;
1825
1832
1826
- $ add_html .= "<form action= \"" . $ _SERVER ['PHP_SELF ' ] ."#ajaxCRUD \" id= \"add_form_ $ this ->db_table \" method= \"POST \" ENCTYPE= \"multipart/form-data \" style= \"display:none; \"> \n" ;
1833
+ $ formActionURL = $ _SERVER ['PHP_SELF ' ];
1834
+ if (isset ($ _SERVER ['QUERY_STRING ' ]) && $ _SERVER ['QUERY_STRING ' ] != "" ){
1835
+ //some web applications require posting to the same exact page (with parameters included); this is useful if/when onAddExecuteCallbackFunction is used
1836
+ $ formActionURL = $ _SERVER ['PHP_SELF ' ] . '? ' . $ _SERVER ['QUERY_STRING ' ];
1837
+ }
1838
+
1839
+ $ add_html .= "<form action= \"" . $ formActionURL . "#ajaxCRUD \" id= \"add_form_ $ this ->db_table \" method= \"POST \" ENCTYPE= \"multipart/form-data \" style= \"display:none; \"> \n" ;
1827
1840
//$add_html .= "<br /><h3 align='center'>New <b>$item</b></h3>\n";
1828
1841
$ add_html .= "<br /> \n" ;
1829
1842
$ add_html .= "<table align='center' name='form'> \n" ;
0 commit comments