diff -crb /var/www/word2book/word2book.info /var/www/ad7/sites/all/modules/word2book/word2book.info
*** /var/www/word2book/word2book.info	2011-06-10 11:31:49.000000000 +0530
--- /var/www/ad7/sites/all/modules/word2book/word2book.info	2011-08-03 12:02:38.605410141 +0530
***************
*** 1,8 ****
  ; $Id$
  name = Word2Book
  description = To create book from word document[Filtered HTML].
! version = "6.x-1.0"
! core = 6.x
  
  
  
--- 1,8 ----
  ; $Id$
  name = Word2Book
  description = To create book from word document[Filtered HTML].
! version = "7.x-1.0"
! core = 7.x
  
  
  
diff -crb /var/www/word2book/word2book.module /var/www/ad7/sites/all/modules/word2book/word2book.module
*** /var/www/word2book/word2book.module	2011-08-02 15:50:49.294191000 +0530
--- /var/www/ad7/sites/all/modules/word2book/word2book.module	2011-08-04 17:23:48.738357100 +0530
***************
*** 13,23 ****
  * @param arg array that holds the current path as would be returned from arg() function
  * @return help text for the path
  */
  function word2book_help($path, $arg) {
      switch ($path) {
!         case "admin/help/word2book":
          $output = '<p>'.  t("To create book from word document[Filtered HTML].").'</p>';
              break;
      }
      return $output;
  }
--- 13,26 ----
  * @param arg array that holds the current path as would be returned from arg() function
  * @return help text for the path
  */
+ 
  function word2book_help($path, $arg) {
      switch ($path) {
!         case "admin/help#word2book":
          $output = '<p>'.  t("To create book from word document[Filtered HTML].").'</p>';
              break;
+         default:
+             $output=null;
      }
      return $output;
  }
***************
*** 68,74 ****
  // Profile Update log
  function generate_book(){
  	$page_content='';
! 	$page_content .= drupal_get_form('word2book_module_upload_form');
  	return $page_content;
  }
  
--- 71,77 ----
  // Profile Update log
  function generate_book(){
  	$page_content='';
! 	$page_content .= drupal_render(drupal_get_form('word2book_module_upload_form'));
  	return $page_content;
  }
  
***************
*** 107,119 ****
  	//echo "The directory $folder_name exists";
  }
  else{
! 	mkdir($current_directory."/sites/default/files/html", 0777) or die('failed to create upload directory');
  }
  chdir($current_directory);
  
  
  function word2book_module_upload_form_validate($form, &$form_state) {
  	$fileData=$_FILES['files']['name']['file_upload'];
  	if($fileData==''){
  	form_set_error('', 'Please upload  file!');
  	}
--- 110,124 ----
  	//echo "The directory $folder_name exists";
  }
  else{
! 	mkdir($current_directory."/sites/default/files/html", 0777) 
! 	or die('failed to create upload directory');
  }
  chdir($current_directory);
  
  
  function word2book_module_upload_form_validate($form, &$form_state) {
  	$fileData=$_FILES['files']['name']['file_upload'];
+ 	
  	if($fileData==''){
  	form_set_error('', 'Please upload  file!');
  	}
***************
*** 160,176 ****
  
    $i=0;
    $selected_splitters=$form_state['values']['splitters'];
!   $report_directory="sites/default/files";	
    // Save new file uploads.
!   if ($file = file_save_upload('file_upload', $validators, $report_directory)) {
  	if($file){	
  	$default_directory=getcwd();
! 	chdir($default_directory.'/'.$report_directory);	
  	chmod($file->filename,0777);	
  	
  	$zip = zip_open($file->filename);
  	if (!is_resource($zip)) {
!  	 drupal_set_message(t('Failed to unzip the uploaded zip file'),'error');
  	}
  	else{
  		
--- 165,184 ----
  
    $i=0;
    $selected_splitters=$form_state['values']['splitters'];
!   //$report_directory="sites/default/files";	
!   $report_directory="public://";
!   	
    // Save new file uploads.
!   if ($file = file_save_upload('file_upload', $validators = array(), $report_directory)) {
  	if($file){	
+ 	
  	$default_directory=getcwd();
! 	chdir($default_directory.'/sites/default/files');	
  	chmod($file->filename,0777);	
  	
  	$zip = zip_open($file->filename);
  	if (!is_resource($zip)) {
!  	 drupal_set_message(t('Failed to unzip the uploaded zip file'.$zip),'error');
  	}
  	else{
  		
***************
*** 182,190 ****
  	    while($zip_entry=zip_read($zip)) {
  	       $zdir=dirname(zip_entry_name($zip_entry));
  	       $zname=zip_entry_name($zip_entry);
! 		//echo $zname; 
  		
  		$file_name=explode(".",$zname);
  		if($file_name[1]=="html"){				
  		$file_path_split=explode("/",$file_name[0]);
  		$report_file_name[]=$file_path_split[1];
--- 190,199 ----
  	    while($zip_entry=zip_read($zip)) {
  	       $zdir=dirname(zip_entry_name($zip_entry));
  	       $zname=zip_entry_name($zip_entry);
! 
  		
  		$file_name=explode(".",$zname);
+ 		drupal_set_message("zip file names :: ".$zname);
  		if($file_name[1]=="html"){				
  		$file_path_split=explode("/",$file_name[0]);
  		$report_file_name[]=$file_path_split[1];
***************
*** 222,227 ****
--- 231,237 ----
  				continue;
  			}
  			copy( $PathDir, $destination . '/' . $readdirectory );
+ 			drupal_set_message("pathDir :: ".$PathDir."<br> Destination ::". $destination . '/' . $readdirectory );
  		}
   
  		$directory->close();
***************
*** 233,253 ****
  	foreach($report_file_name as $report_name){	
  	copy_directory('sites/default/files/'.$zip_file_name[0].'/'.$report_name.'_images','sites/default/files/images/'.$report_name.'_images');
  	$current_directory=getcwd();	
! 	$images_directory="sites/default/files/images";
  	chdir($images_directory);
  	$directory_permission=$report_name."_images";
! 	chmod($directory_permission,0644);
  	chdir($current_directory);		
  	$file='sites/default/files/'.$zip_file_name[0].'/'.$report_name.'.html';
  	//echo '<br>';
  	 $newfile ='sites/default/files/html/'.$report_name.'.html';
  	if (!copy($file, $newfile)) {
! 	    echo "failed to copy $file...\n";
  	}	
  	$reportname=$report_name.".html";
  	$book_name=explode(".",$reportname);	
  	if($reportname !=''){			 	
! 	chdir($default_directory.'/'.$report_directory.'/html');			
  	$fh = fopen($reportname, 'r');
  	$theData = fread($fh, filesize($reportname));	
  	fclose($fh);	
--- 243,266 ----
  	foreach($report_file_name as $report_name){	
  	copy_directory('sites/default/files/'.$zip_file_name[0].'/'.$report_name.'_images','sites/default/files/images/'.$report_name.'_images');
  	$current_directory=getcwd();	
! 	$images_directory="public://images";
! 	drupal_set_message("images dir::".$images_directory); 
  	chdir($images_directory);
  	$directory_permission=$report_name."_images";
! 	chmod($directory_permission,0777);
  	chdir($current_directory);		
  	$file='sites/default/files/'.$zip_file_name[0].'/'.$report_name.'.html';
  	//echo '<br>';
  	 $newfile ='sites/default/files/html/'.$report_name.'.html';
  	if (!copy($file, $newfile)) {
! 	    echo "failed to copy.... $file...\n";
  	}	
  	$reportname=$report_name.".html";
  	$book_name=explode(".",$reportname);	
  	if($reportname !=''){			 	
! //	chdir($default_directory.'/'.$report_directory.'/html');
! 	chdir($default_directory.'/sites/default/files/html');
! 				
  	$fh = fopen($reportname, 'r');
  	$theData = fread($fh, filesize($reportname));	
  	fclose($fh);	
***************
*** 257,263 ****
  	$node = new stdClass();		
  	if($book_name[0] !=''){		
  	//Main Node Fields	
! 	$node->title = $book_name[0];	
  	$node->type = 'book'; //This can be any node type
  	$node->created = time();
  	$node->changed = $node->created;
--- 270,276 ----
  	$node = new stdClass();		
  	if($book_name[0] !=''){		
  	//Main Node Fields	
! 	$node->title = "book name".$book_name[0];	
  	$node->type = 'book'; //This can be any node type
  	$node->created = time();
  	$node->changed = $node->created;
***************
*** 270,275 ****
--- 283,289 ----
  	$node=node_load($node->nid);
  	$parent = array(0 => $node->nid);
  	$book = array(0 => $node);	
+ 	
  	//Update hack. save_node spirals into a infinite loop, so 
  	//check if the initial page is part of a book. If not - //create a new book (:-)
  	$op='insert';      
***************
*** 301,316 ****
  				$body = trim($split[1]);				
  				}
  				// After the first time through, clone the parent as a starting point for child nodes.
! 				$child_node = drupal_clone($node);
  				// Set the child nid and vid to zero so new nodes are created.
  				$child_node->nid = 0;
  				$child_node->vid = 0;
  				// Make sure the title is not empty and create the child's body, teaser, and weight.
  
  				 if($title !='' && $body!=''){
  				  $child_node->title = !empty($title) ? $title : t('Page !$page', array('!page' => $page));
! 				  $child_node->body = $body;
! 				  $child_node->teaser = node_teaser($body);
  
  					  if ($level > $prev_level || !isset($weight[$level])) {
  					    $weight[$level] = -15;
--- 315,333 ----
  				$body = trim($split[1]);				
  				}
  				// After the first time through, clone the parent as a starting point for child nodes.
! 				$child_node = clone($node);
  				// Set the child nid and vid to zero so new nodes are created.
  				$child_node->nid = 0;
  				$child_node->vid = 0;
  				// Make sure the title is not empty and create the child's body, teaser, and weight.
  
  				 if($title !='' && $body!=''){
+ 				  $child_node->body['und'][0]['format'] ='full_html';
  				  $child_node->title = !empty($title) ? $title : t('Page !$page', array('!page' => $page));
! 				  //$child_node->body = $body;
! 				  $child_node->body['und'][0]['value'] = $body; 
! 				  $child_node->body['und'][0]['summary'] =  text_summary($body);
! 			// 	  $child_node->body[$node->language][0]['summary'] = text_summary($body);
  				
  					  if ($level > $prev_level || !isset($weight[$level])) {
  					    $weight[$level] = -15;
***************
*** 385,389 ****
  
    }
  }
- 
- 
--- 402,404 ----
