[Vtigercrm-commits] [vtiger-commits] r5061 - /vtigercrm/trunk/modules/Import/ImportStep3.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Tue Apr 11 11:58:38 EDT 2006


Author: saraj
Date: Tue Apr 11 09:58:29 2006
New Revision: 5061

Log:
Modified the ImportStep3.php file for smartification & new ui integration of Import Module - Ahmed

Modified:
    vtigercrm/trunk/modules/Import/ImportStep3.php

Modified: vtigercrm/trunk/modules/Import/ImportStep3.php
==============================================================================
--- vtigercrm/trunk/modules/Import/ImportStep3.php (original)
+++ vtigercrm/trunk/modules/Import/ImportStep3.php Tue Apr 11 09:58:29 2006
@@ -20,7 +20,7 @@
  * Contributor(s): ______________________________________..
  ********************************************************************************/
 
-require_once('XTemplate/xtpl.php');
+require_once('Smarty_setup.php');
 require_once('data/Tracker.php');
 require_once('modules/Import/ImportContact.php');
 require_once('modules/Import/ImportAccount.php');
@@ -32,6 +32,7 @@
 require_once('include/database/PearDatabase.php');
 require_once('include/CustomFieldUtil.php');
 require_once('modules/Import/ImportProduct.php');
+require_once('include/utils/CommonUtils.php');
 
 @session_unregister('column_position_to_field');
 @session_unregister('totalrows');
@@ -76,7 +77,7 @@
 
 
 
-$log->info($mod_strings['LBL_MODULE_NAME']." Upload Step 3");
+$log->info($mod_strings['LBL_MODULE_NAME']." Upload Step 2");
 
 if (!is_uploaded_file($_FILES['userfile']['tmp_name']) )
 {
@@ -132,11 +133,13 @@
 
 $ret_field_count = $ret_value['field_count'];
 //echo 'my return field count i s ' .$ret_field_count;
-$xtpl=new XTemplate ('modules/Import/ImportStep3.html');
-
-$xtpl->assign("TMP_FILE", $tmp_file_name );
-
-$xtpl->assign("SOURCE", $_REQUEST['source'] );
+//$xtpl=new XTemplate ('modules/Import/ImportStep3.html');
+
+$smarty =  new vtigerCRM_Smarty;
+
+$smarty->assign("TMP_FILE", $tmp_file_name );
+
+$smarty->assign("SOURCE", $_REQUEST['source'] );
 
 $source_to_name = array( 'outlook'=>$mod_strings['LBL_MICROSOFT_OUTLOOK'],
 'act'=>$mod_strings['LBL_ACT'],
@@ -145,19 +148,20 @@
 'other'=>$mod_strings['LBL_CUSTOM'],
 );
 
-$xtpl->assign("SOURCE_NAME", $source_to_name[$_REQUEST['source']] );
-$xtpl->assign("MOD", $mod_strings);
-$xtpl->assign("APP", $app_strings);
-
-if (isset($_REQUEST['return_module'])) $xtpl->assign("RETURN_MODULE", $_REQUEST['return_module']);
-
-if (isset($_REQUEST['return_action'])) $xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']);
-
-$xtpl->assign("THEME", $theme);
-
-$xtpl->assign("IMAGE_PATH", $image_path);$xtpl->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']);
-
-$xtpl->assign("HEADER", $app_strings['LBL_IMPORT']." ". $mod_strings['LBL_MODULE_NAME']);
+$smarty->assign("SOURCE_NAME", $source_to_name[$_REQUEST['source']] );
+$smarty->assign("MOD", $mod_strings);
+$smarty->assign("APP", $app_strings);
+
+if (isset($_REQUEST['return_module'])) $smarty->assign("RETURN_MODULE", $_REQUEST['return_module']);
+
+if (isset($_REQUEST['return_action'])) $smarty->assign("RETURN_ACTION", $_REQUEST['return_action']);
+
+$smarty->assign("THEME", $theme);
+
+$smarty->assign("IMAGE_PATH", $image_path);$smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']);
+
+$smarty->assign("HEADER", $app_strings['LBL_IMPORT']." ". $mod_strings['LBL_MODULE_NAME']);
+$smarty->assign("HASHEADER", $has_header);
 
 
 if (! isset( $_REQUEST['module'] ) || $_REQUEST['module'] == 'Contacts')
@@ -183,13 +187,18 @@
 
 
 
-//if ($has_header)
-//{
-//	$firstrow = array_shift($rows);
-//} 
-//else
-//{
+	$total_num_rows=sizeof($rows);	
 	$firstrow = $rows[0];
+	if($total_num_rows >1 )
+	{
+		$secondrow = $rows[1];
+	}		
+	if($total_num_rows >2)
+	{
+		$thirdrow = $rows[2];
+	}
+	
+	
 //}
 
 $field_map = $outlook_contacts_field_map;
@@ -265,7 +274,7 @@
 }
 else if ($_REQUEST['source'] == 'outlook')
 {
-	$xtpl->assign("IMPORT_FIRST_CHECKED", " CHECKED");
+	$smarty->assign("IMPORT_FIRST_CHECKED", " CHECKED");
 	if ($_REQUEST['module'] == 'Contacts')
 	{
 		$field_map = $outlook_contacts_field_map;
@@ -282,18 +291,18 @@
 
 if ( $has_header)
 {
-	$xtpl->parse("main.table.toprow.headercell");
+	//$smarty->parse("main.table.toprow.headercell");
 	$add_one = 0;
 	$start_at = 1;
 } 
 
 for($row_count = $start_at; $row_count < count($rows); $row_count++ )
 {
-	$xtpl->assign("ROWCOUNT", $row_count + $add_one);
-	$xtpl->parse("main.table.toprow.topcell");
-}
-
-$xtpl->parse("main.table.toprow");
+	$smarty->assign("ROWCOUNT", $row_count + $add_one);
+	//$smarty->parse("main.table.toprow.topcell");
+}
+
+//$xtpl->parse("main.table.toprow");
 
 $list_string_key = strtolower($_REQUEST['module']);
 $list_string_key .= "_import_fields";
@@ -315,7 +324,7 @@
 for($field_count = 0; $field_count < $ret_field_count; $field_count++)
 {
 
-	$xtpl->assign("COLCOUNT", $field_count + 1);
+	$smarty->assign("COLCOUNT", $field_count + 1);
 	$suggest = "";
 
 	if ($has_header && isset( $field_map[$firstrow[$field_count]] ) )
@@ -357,90 +366,73 @@
 //echo 'xxxxxxxxxxxxxxxxxxxx';
 //print_r($focus->importable_fields);
 //print_r($focus->column_fields);
-/*
-	$xtpl->assign("SELECTFIELD", getFieldSelect(	$focus->importable_fields,
-							$requiredfieldval,
-							$focus1->required_fields,
-							$suggest,
-							$focus1->column_fields,
-							$tablename
-						   ));
-*/
-	$xtpl->assign("SELECTFIELD", getFieldSelect(	$focus->importable_fields,
+
+	$smarty->assign("FIRSTROW",$firstrow);
+	$smarty->assign("SECONDROW",$secondrow);
+	$smarty->assign("THIRDROW",$thirdrow);
+	$smarty_array[$field_count + 1] = getFieldSelect(	$focus->importable_fields,
 							$field_count,//requiredfieldval,
 							$focus1->required_fields,
 							$suggest,
 							$translated_column_fields,
 							$tablename
-						   ));
-
-/*		getFieldSelect(	$focus->importable_fields,
-				$field_count,
-				$focus->required_fields,
-				$suggest,
-				$translated_column_fields,
-				$_REQUEST['module']
-				));
-*/
-	$xtpl->parse("main.table.row.headcell");
+						   );
+	$smarty->assign("SELECTFIELD",$smarty_array);
+
+	//$xtpl->parse("main.table.row.headcell");
 
 	$pos = 0;
 
 	foreach ( $rows as $row ) 
 	{
-		if ($cnt%2==0)
-			$xtpl->assign("ROWCLASS","evenListRow");
-		else
-			$xtpl->assign("ROWCLASS","oddListRow");
 		
 		if( isset($row[$field_count]) && $row[$field_count] != '')
 		{
-			$xtpl->assign("CELL",htmlspecialchars($row[$field_count]));
-			$xtpl->parse("main.table.row.cell");
+			$smarty->assign("CELL",htmlspecialchars($row[$field_count]));
+//			$smarty->parse("main.table.row.cell");
 		} 
 		else
 		{
-			$xtpl->parse("main.table.row.cellempty");
+//			$smarty->parse("main.table.row.cellempty");
 		}
 		
 		$cnt++;
 	}
 
-	$xtpl->parse("main.table.row");
-
-}
-
-$xtpl->parse("main.table");
+//	$xtpl->parse("main.table.row");
+
+}
+
+$smarty->assign("ROW", $row);
+//$xtpl->parse("main.table");
 
 $module_key = "LBL_".strtoupper($_REQUEST['module'])."_NOTE_";
 
 for ($i = 1;isset($mod_strings[$module_key.$i]);$i++)
 {
-	$xtpl->assign("NOTETEXT", $mod_strings[$module_key.$i]);
-	$xtpl->parse("main.note");
+	$smarty->assign("NOTETEXT", $mod_strings[$module_key.$i]);
+	//$xtpl->parse("main.note");
 }
 
 
 
 if($has_header)
 {
-	$xtpl->assign("HAS_HEADER", 'on');
+	$smarty->assign("HAS_HEADER", 'on');
 } 
 else
 {
-	$xtpl->assign("HAS_HEADER", 'off');
-}
-
-
-$xtpl->assign("MODULE", $_REQUEST['module']);
-//$xtpl->assign("JAVASCRIPT", get_validate_import_fields_js($focus->required_fields,$translated_column_fields) );
-
-$xtpl->assign("JAVASCRIPT2", get_readonly_js() );
-
-
-$xtpl->parse("main");
-
-$xtpl->out("main");
-
+	$smarty->assign("HAS_HEADER", 'off');
+}
+
+
+$smarty->assign("MODULE", $_REQUEST['module']);
+
+$category = getParenttab();
+$smarty->assign('CATEGORY' , $category);
+
+$smarty->assign("JAVASCRIPT2", get_readonly_js() );
+
+$smarty->display('ImportStep2.tpl');
 
 ?>





More information about the vtigercrm-commits mailing list