------------------------------------------------------------
revno: 1172
committer: Jakub Jankiewicz <[email protected]>
branch nick: aikiframework
timestamp: Tue 2012-04-24 10:36:12 +0200
message:
  Fix Edit in place processing
modified:
  index.php
  libs/Records.php


--
lp:aikiframework
https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk

Your team Aiki Framework Developers is subscribed to branch lp:aikiframework.
To unsubscribe from this branch go to 
https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk/+edit-subscription
=== modified file 'index.php'
--- index.php	2012-04-03 06:57:14 +0000
+++ index.php	2012-04-24 08:36:12 +0000
@@ -95,6 +95,16 @@
 		"</p>";
 }
 
+// move from $aiki->Records->edit_in_place
+if (isset($_POST['edit_form']) and
+	isset($_POST['form_id']) and
+	isset($_POST['record_id']) ) {
+	$serial_post = serialize($_POST);
+	$aiki->Records->edit_db_record_by_form_post($serial_post,
+												$_POST['form_id'],
+												$_POST['record_id']);
+}
+
 
 /**
  * Tidy html using libtidy, or output compressed output, or just output.

=== modified file 'libs/Records.php'
--- libs/Records.php	2012-04-24 07:18:40 +0000
+++ libs/Records.php	2012-04-24 08:36:12 +0000
@@ -1057,8 +1057,8 @@
 
 		$i = 0;
 		$viewCount = count($form_array);
+		
 		foreach ( $form_array as $field ) {
-
 			if ( $field != $tablename and 
 				$field != $pkey and 
 				$field != $submit ) {
@@ -1066,8 +1066,9 @@
 
 				$get_permission_and_man_info = explode("|", $intwalker[0]);
 				$intwalker[0] = $get_permission_and_man_info[0];
-
-				if (isset($intwalker['2'])) {
+    
+				// don't process form when edit in place
+				if (!isset($_POST['edit_form']) && isset($intwalker['2'])) {
 					switch ($intwalker['2']) {
 						case "orderby":
 							//$post[$intwalker[0]] = $post['editpkey'];
@@ -1229,7 +1230,7 @@
 		} else {
 			$editResult = $db->query($editQuery);
 		}
-
+		echo $editQuery ."\n";
 		/** 
 		 * @todo saving revision history needs to be abstracted
 		 */
@@ -1343,24 +1344,10 @@
 	 * @global	membership		$membership		global membership instance
 	 * @global	CreateLayout	$layout			global layout of aiki instance
 	 * @return	string
-	 *
-	 * @todo why is layout being handled in a handling function?
 	 */
 	public function edit_in_place($text, $widget_value) {
 		global $aiki,$db, $membership, $layout;
-		
-		if (isset($_POST['edit_form']) and
-			isset($_POST['form_id']) and
-			isset($_POST['record_id']) ) {
-			$serial_post = serialize($_POST);
-			/** 
-			 * @todo remove this bare echo in the code!!!
-			 */
-			$aiki->Records->edit_db_record_by_form_post($serial_post,
-														$_POST['form_id'],
-														$_POST['record_id']);
-		}
-		$edit_matchs = 
+		$edit_matchs =
 			preg_match_all('/\<edit\>(.*)\<\/edit\>/Us', $text, $matchs);
 
 		if ( $edit_matchs > 0 ) {

_______________________________________________
Mailing list: https://launchpad.net/~aikiframework-devel
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~aikiframework-devel
More help   : https://help.launchpad.net/ListHelp

Reply via email to