X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Faddressbook_csvimport.php;h=1dc1f1e29b52d5060bd6300c8628c19f4d3a41de;hb=efe94e8ebbbc08f3cd223656af630f0a8cf591a3;hp=f9feb71cbe90f625ba847548bf4edadc89ee9d98;hpb=5c3377dac67e0236da25535399e8d06ac914c1ed;p=squirrelmail.git diff --git a/src/addressbook_csvimport.php b/src/addressbook_csvimport.php index f9feb71c..1dc1f1e2 100644 --- a/src/addressbook_csvimport.php +++ b/src/addressbook_csvimport.php @@ -1,30 +1,16 @@ "; - echo "\n"; + if (!isset($smusercsv) || $smusercsv == "none") { + echo "

\n"; + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
" . _("Please select a file for uploading. You can do this by clicking on the browse button on the ") . "" . _("Address Book") . " " . _("page.") . "
\n"; + echo "\n"; + exit; + } +**/ /** ** Script-wide vars. Used all over the place or something you might want to change later. ** $example -->Sets how many rows of user data the script will use to play with before final write. ** $abook ---->Setup the addressbook functions for Pallo's Addressbook. + ** $tabindex ->A starting value for the loop to assign a tabindex value for the generated text input fields. + ** As long as this value is greater than the number of static submit buttons all should work fine. **/ + $tabindex = 10; $example = 6; $abook = addressbook_init(true, true); @@ -67,7 +72,7 @@ if($flag <= 1) { // If first run of script, setup the filename to copy $tempfilename = ($username . (time()+2592000)); $nameholder = $tempfilename; - if(copy($smusercsv, "$data_dir$tempfilename")) { // Set up variable to use in printing status + if(copy($smusercsv, "$attachment_dir$tempfilename")) { // Set up variable to use in printing status $goodcopy = true; } else { $goodcopy = false; @@ -91,7 +96,7 @@ echo " \n"; echo " \n"; echo " "; - if(!$goodcopy && $flag == 0) { // print correct status of file copying + if(!$goodcopy && $flag == 0) { // print correct status of file copying echo _("Failed to create working copy, Please try again."); } else { echo _("Created working copy, continuing with process..."); @@ -104,17 +109,17 @@ echo " ", _("Arrange your data to fit the 5 address book fields. "), _("Do this by inserting the data's field number under the field for which you wish it to be included into the address book. "), _("For example: fields 5, 6, and 7 need to go into the info field 5. "), _("The boxes under field 5 would contain 5, 6, and 7 in seperate boxes. "), "\n"; echo " \n"; echo " ", _("Submit Your reorganized data."), "      ", "\n"; - echo " ", "      \n"; + echo " ", "      \n"; echo " \n"; echo " \n"; echo " \n"; echo " ", _("Erase entries and re-enter field numbers."), "      ", "\n"; - echo " \n"; + echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " ", _("View full set of imported records in their new format."), "      \n"; - echo " \n"; + echo " \n"; echo " "; echo " "; echo " \n"; @@ -127,7 +132,7 @@ echo " \n"; echo " ", _("Final approval. "); echo " ", _("After reviewing the rearranged data for accuracy, click \"Finish\"."), "      \n"; - echo " \n"; + echo " \n"; echo " "; echo " \n"; echo "\n"; @@ -143,9 +148,9 @@ // open the correct filename to work with if($flag <= 1) { // before submit - $fp = fopen("$data_dir$tempfilename", "r"); + $fp = fopen("$attachment_dir$tempfilename", "r"); } elseif($flag >= 2) { // after submit - $fp = fopen("$data_dir$nameholder", "r"); + $fp = fopen("$attachment_dir$nameholder", "r"); } echo "
\n"; // user's data table @@ -153,8 +158,13 @@ // This loop sets up a table of the data they uploaded to save time while the user rearranges it. $row = 0; do { - ($data = fgetcsv($fp, 4096)); - $cols = count($data); + ($data = fgetcsv($fp, 4096)); + if(count($data) >= 5) { + $cols = count($data); + } else { + $cols = 5; + } +// $cols = count($data); $row++; if($flag == 0 && !$finish) { // Table header on initial import @@ -179,28 +189,33 @@ echo " \n"; echo " \n"; echo " \n"; // email isn't an array so no loop needed echo " \n"; echo " \n"; @@ -386,7 +401,7 @@ // Clean up after ourselves. if($finish) { - unlink ("$data_dir$tempfilename"); + unlink ("$attachment_dir$tempfilename"); } ?>
", _("Field Number: "), "0", "
\n"; // number the fields so they know what to put where reset($nickname); while(list($k,$v)=each($nickname)) { // print out the text boxes for this var - echo"
\n"; + echo"
\n"; + $tabindex++; } echo "
", _("Field Number: "), "1", "
\n"; // number the fields so they know what to put where reset($firstname); while(list($k,$v)=each($firstname)) { // print out the text boxes for this var - echo"
\n"; + echo"
\n"; + $tabindex++; } echo "
", _("Field Number: "), "2", "
\n"; // number the fields so they know what to put where reset($lastname); while(list($k,$v)=each($lastname)) { // print out the text boxes for this var - echo"
\n"; + echo"
\n"; + $tabindex++; } echo "
", _("Field Number: "), "3", "
\n"; // number the fields so they know what to put where - echo " \n"; + echo " \n"; + $tabindex++; echo "
", _("Field Number: "), "4", "
\n"; // number the fields so they know what to put where reset($label); while(list($k,$v)=each($label)) { // print out the text boxes for this var - echo"
\n"; + echo"
\n"; + $tabindex++; } echo "