fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [7387] Merge 7379:7386 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [7387] Merge 7379:7386 from trunk
Date: Thu, 16 Jun 2011 10:30:40 +0000

Revision: 7387
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7387
Author:   sigurdne
Date:     2011-06-16 10:30:40 +0000 (Thu, 16 Jun 2011)
Log Message:
-----------
Merge 7379:7386 from trunk

Modified Paths:
--------------
    
branches/Version-1_0-branch/activitycalendarfrontend/inc/class.uiactivity.inc.php
    branches/Version-1_0-branch/activitycalendarfrontend/index.php
    branches/Version-1_0-branch/booking/templates/base/group_edit.xsl
    branches/Version-1_0-branch/booking/templates/base/organization_edit.xsl
    branches/Version-1_0-branch/property/inc/class.bolocation.inc.php
    branches/Version-1_0-branch/property/inc/class.uilocation.inc.php
    branches/Version-1_0-branch/property/templates/base/location.xsl

Added Paths:
-----------
    
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_tmp.xml
    branches/Version-1_0-branch/property/inc/class.uiimport.inc.php
    
branches/Version-1_0-branch/property/inc/import/default/cvs_import_kunstoversikt_bkb
    
branches/Version-1_0-branch/property/inc/import/default/cvs_import_vedlikeholdsplan_bkb

Property Changed:
----------------
    branches/Version-1_0-branch/


Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378
   + 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386

Modified: 
branches/Version-1_0-branch/activitycalendarfrontend/inc/class.uiactivity.inc.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendarfrontend/inc/class.uiactivity.inc.php
   2011-06-16 10:15:14 UTC (rev 7386)
+++ 
branches/Version-1_0-branch/activitycalendarfrontend/inc/class.uiactivity.inc.php
   2011-06-16 10:30:40 UTC (rev 7387)
@@ -19,7 +19,7 @@
                 */
                public function add()
                {
-                       $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'activitycalendarfrontend.uiactivity.edit', 'action' => 
'new_activity'));
+                       
$GLOBALS['phpgw']->redirect_link('/activitycalendarfrontend/index.php', 
array('menuaction' => 'activitycalendarfrontend.uiactivity.edit', 'action' => 
'new_activity'));
                }
                
                function view()
@@ -42,6 +42,7 @@
                        
                        $GLOBALS['phpgw_info']['flags']['noframework'] = true;
                        $this->render('activity.php', $data);
+                       //self::render_template('activity_tmp', 
array('activity' => $activity, 'frontend'=>'true'));
                }
 
                function edit()
@@ -178,6 +179,7 @@
                
                function index()
                {
-                       var_dump("inni index");
+                       $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'activitycalendarfrontend.uiactivity.add'));
+                       //var_dump("inni index");
                }
        }

Modified: branches/Version-1_0-branch/activitycalendarfrontend/index.php
===================================================================
--- branches/Version-1_0-branch/activitycalendarfrontend/index.php      
2011-06-16 10:15:14 UTC (rev 7386)
+++ branches/Version-1_0-branch/activitycalendarfrontend/index.php      
2011-06-16 10:30:40 UTC (rev 7387)
@@ -2,9 +2,232 @@
     $GLOBALS['phpgw_info']['flags'] = array(
         'noheader'             => true,
         'nonavbar'             => true,
-        'currentapp'   => 'activitycalendarfrontend'
+        'currentapp'   => 'login'
     );
+    
+    $GLOBALS['phpgw_info']['flags']['session_name'] = 
'activitycalendarfrontendsession';
+       $GLOBALS['phpgw_remote_user_fallback'] = 'sql';
+       include_once('../header.inc.php');
 
-    include_once('../header.inc.php');
+       // Make sure we're always logged in
+       if (!phpgw::get_var(session_name()) || 
!$GLOBALS['phpgw']->session->verify())
+       {
+               $login = "bookingguest";
+               $passwd = "bkbooking";
+               $_POST['submitit'] = "";
 
-       $GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction' => 
'activitycalendarfrontend.uiactivity.index'));
+               $GLOBALS['sessionid'] = 
$GLOBALS['phpgw']->session->create($login, $passwd);
+               if(!$GLOBALS['sessionid'])
+               {
+                       $lang_denied = lang('Anonymous access not correctly 
configured');
+                       if($GLOBALS['phpgw']->session->reason)
+                       {
+                               $lang_denied = 
$GLOBALS['phpgw']->session->reason;
+                       }
+                       echo <<<HTML
+                               <div class="error">$lang_denied</div>
+HTML;
+                       $GLOBALS['phpgw']->common->phpgw_exit(True);
+               }
+       }
+       $GLOBALS['phpgw_info']['flags']['currentapp'] = 
'activitycalendarfrontend';
+       
+       
/////////////////////////////////////////////////////////////////////////////
+// BEGIN Stuff copied from functions.inc.php
+/////////////////////////////////////////////////////////////////////////////
+
+               
if(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['lang']) && 
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] !='en')
+               {
+                       
$GLOBALS['phpgw']->translation->set_userlang($GLOBALS['phpgw_info']['user']['preferences']['common']['lang'],
 true);
+               }
+
+               /* A few hacker resistant constants that will be used throught 
the program */
+               define('PHPGW_TEMPLATE_DIR', 
ExecMethod('phpgwapi.phpgw.common.get_tpl_dir', 'phpgwapi'));
+               define('PHPGW_IMAGES_DIR', 
ExecMethod('phpgwapi.phpgw.common.get_image_path', 'phpgwapi'));
+               define('PHPGW_IMAGES_FILEDIR', 
ExecMethod('phpgwapi.phpgw.common.get_image_dir', 'phpgwapi'));
+               define('PHPGW_APP_ROOT', 
ExecMethod('phpgwapi.phpgw.common.get_app_dir'));
+               define('PHPGW_APP_INC', 
ExecMethod('phpgwapi.phpgw.common.get_inc_dir'));
+               define('PHPGW_APP_TPL', 
ExecMethod('phpgwapi.phpgw.common.get_tpl_dir'));
+               define('PHPGW_IMAGES', 
ExecMethod('phpgwapi.phpgw.common.get_image_path'));
+               define('PHPGW_APP_IMAGES_DIR', 
ExecMethod('phpgwapi.phpgw.common.get_image_dir'));
+
+       
/************************************************************************\
+       * Load the menuaction                                                   
 *
+       
\************************************************************************/
+               $GLOBALS['phpgw_info']['menuaction'] = 
phpgw::get_var('menuaction');
+               if(!$GLOBALS['phpgw_info']['menuaction'])
+               {
+                       unset($GLOBALS['phpgw_info']['menuaction']);
+               }
+
+               /********* This sets the user variables *********/
+               $GLOBALS['phpgw_info']['user']['private_dir'] = 
$GLOBALS['phpgw_info']['server']['files_dir']
+                       . '/users/'.$GLOBALS['phpgw_info']['user']['userid'];
+
+               /* This will make sure that a user has the basic default prefs. 
If not it will add them */
+               $GLOBALS['phpgw']->preferences->verify_basic_settings();
+
+               /********* Optional classes, which can be disabled for 
performance increases *********/
+               while ($phpgw_class_name = 
each($GLOBALS['phpgw_info']['flags']))
+               {
+                       if (ereg('enable_', $phpgw_class_name[0]))
+                       {
+                               $enable_class = str_replace('enable_', '', 
$phpgw_class_name[0]);
+                               $enable_class = str_replace('_class', '', 
$enable_class);
+                               $GLOBALS['phpgw']->$enable_class = 
createObject("phpgwapi.{$enable_class}");
+                       }
+               }
+               unset($enable_class);
+               reset($GLOBALS['phpgw_info']['flags']);
+
+               
/*************************************************************************\
+               * These lines load up the templates class                       
          *
+               
\*************************************************************************/
+               if ( 
!isset($GLOBALS['phpgw_info']['flags']['disable_Template_class'])
+                       || 
!$GLOBALS['phpgw_info']['flags']['disable_Template_class'] )
+               {
+                       $GLOBALS['phpgw']->template = 
createObject('phpgwapi.Template',PHPGW_APP_TPL);
+                       $GLOBALS['phpgw']->xslttpl = 
createObject('phpgwapi.xslttemplates',PHPGW_APP_TPL);
+               }
+
+               
/*************************************************************************\
+               * Verify that the users session is still active otherwise kick 
them out   *
+               
\*************************************************************************/
+               if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'home' && 
$GLOBALS['phpgw_info']['flags']['currentapp'] != 'about')
+               {
+                       if (!$GLOBALS['phpgw']->acl->check('run', 
PHPGW_ACL_READ, $GLOBALS['phpgw_info']['flags']['currentapp']))
+                       {
+                               $GLOBALS['phpgw']->common->phpgw_header(true);
+                               
$GLOBALS['phpgw']->log->write(array('text'=>'W-Permissions, Attempted to access 
%1','p1'=>$GLOBALS['phpgw_info']['flags']['currentapp']));
+
+                               $lang_denied = lang('Access not permitted');
+                               echo <<<HTML
+                                       <div class="error">$lang_denied</div>
+
+HTML;
+                               $GLOBALS['phpgw']->common->phpgw_exit(True);
+                       }
+               }
+
+       //  Already called from sessions::verify
+       //      $GLOBALS['phpgw']->applications->read_installed_apps(); // to 
get translated app-titles
+
+               
/*************************************************************************\
+               * Load the header unless the developer turns it off             
          *
+               
\*************************************************************************/
+               if ( !isset($GLOBALS['phpgw_info']['flags']['noheader']) || 
!$GLOBALS['phpgw_info']['flags']['noheader'] )
+               {
+                       $inc_navbar = 
!isset($GLOBALS['phpgw_info']['flags']['nonavbar']) || 
!$GLOBALS['phpgw_info']['flags']['nonavbar'];
+                       $GLOBALS['phpgw']->common->phpgw_header($inc_navbar);
+                       unset($inc_navbar);
+               }
+
+               
/*************************************************************************\
+               * Load the app include files if the exists                      
          *
+               
\*************************************************************************/
+               /* Then the include file */
+               if (! preg_match ("/phpgwapi/i", PHPGW_APP_INC) && 
file_exists(PHPGW_APP_INC . '/functions.inc.php') && 
!isset($GLOBALS['phpgw_info']['menuaction']))
+               {
+                       include_once(PHPGW_APP_INC . '/functions.inc.php');
+               }
+               if (address@hidden'phpgw_info']['flags']['noheader'] &&
+                       address@hidden'phpgw_info']['flags']['noappheader'] &&
+                       file_exists(PHPGW_APP_INC . '/header.inc.php') && 
!isset($GLOBALS['phpgw_info']['menuaction']))
+               {
+                       include_once(PHPGW_APP_INC . '/header.inc.php');
+               }
+
+/////////////////////////////////////////////////////////////////////////////
+// END Stuff copied from functions.inc.php
+/////////////////////////////////////////////////////////////////////////////
+
+       if (isset($_GET['menuaction']))
+       {
+               list($app,$class,$method) = explode('.',$_GET['menuaction']);
+       }
+       else
+       {
+       //      
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction' => 
'activitycalendarfrontend.uiactivity.add'));
+               $app = 'activitycalendarfrontend';
+               $class = 'uiactivity';
+               $method = 'add';
+       }
+       $GLOBALS[$class] = CreateObject("{$app}.{$class}");
+
+       $invalid_data = false; //FIXME consider whether this should be computed 
as in the main index.php
+       if ( !$invalid_data 
+               && is_object($GLOBALS[$class])
+               && isset($GLOBALS[$class]->public_functions) 
+               && is_array($GLOBALS[$class]->public_functions) 
+               && isset($GLOBALS[$class]->public_functions[$method])
+               && $GLOBALS[$class]->public_functions[$method] )
+
+       {
+               if ( phpgw::get_var('X-Requested-With', 'string', 'SERVER') == 
'XMLHttpRequest'
+                        // deprecated
+                       || phpgw::get_var('phpgw_return_as', 'string', 'GET') 
== 'json' )
+               {
+                       // comply with RFC 4627
+                       header('Content-Type: application/json'); 
+                       $return_data = $GLOBALS[$class]->$method();
+                       echo json_encode($return_data);
+                       $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
+                       $GLOBALS['phpgw']->common->phpgw_exit();
+               }
+               else
+               {
+                       $GLOBALS[$class]->$method();    
+                       $GLOBALS['phpgw']->common->phpgw_footer();
+               }
+       }
+       
+       //$GLOBALS['phpgw_info']['flags']['noframework'] = true;
+       
+/*
+       
+       if (isset($_GET['menuaction']))
+       {
+               //list($app,$class,$method) = explode('.',$_GET['menuaction']);
+               $GLOBALS['phpgw']->redirect_link('/index.php',$_GET);
+       }
+       else
+       {
+               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction' => 
'activitycalendarfrontend.uiactivity.index'));
+               //$app = 'activitycalendarfrontend';
+               //$class = 'uiactivity';
+               //$method = 'index';
+       }*/
+       /*
+               $GLOBALS[$class] = CreateObject("{$app}.{$class}");
+
+       $invalid_data = false; //FIXME consider whether this should be computed 
as in the main index.php
+       if ( !$invalid_data 
+               && is_object($GLOBALS[$class])
+               && isset($GLOBALS[$class]->public_functions) 
+               && is_array($GLOBALS[$class]->public_functions) 
+               && isset($GLOBALS[$class]->public_functions[$method])
+               && $GLOBALS[$class]->public_functions[$method] )
+
+       {
+               if ( phpgw::get_var('X-Requested-With', 'string', 'SERVER') == 
'XMLHttpRequest'
+                        // deprecated
+                       || phpgw::get_var('phpgw_return_as', 'string', 'GET') 
== 'json' )
+               {
+                       // comply with RFC 4627
+                       header('Content-Type: application/json'); 
+                       $return_data = $GLOBALS[$class]->$method();
+                       echo json_encode($return_data);
+                       $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
+                       $GLOBALS['phpgw']->common->phpgw_exit();
+               }
+               else
+               {
+                       $GLOBALS[$class]->$method();    
+                       $GLOBALS['phpgw']->common->phpgw_footer();
+               }
+       }*/
+    
+
+//    include_once('../header.inc.php');
+
+       

Copied: 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_tmp.xml
 (from rev 7386, trunk/activitycalendarfrontend/templates/base/activity_tmp.xml)
===================================================================
--- 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_tmp.xml
                                (rev 0)
+++ 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_tmp.xml
        2011-06-16 10:30:40 UTC (rev 7387)
@@ -0,0 +1,9 @@
+<xsl:template match="activity" xmlns:php="http://php.net/xsl";>
+tester
+</xsl:template>
+
+<xsl:template match="contract">
+       <xsl:copy-of select="."/>
+       
+</xsl:template>
+

Modified: branches/Version-1_0-branch/booking/templates/base/group_edit.xsl
===================================================================
--- branches/Version-1_0-branch/booking/templates/base/group_edit.xsl   
2011-06-16 10:15:14 UTC (rev 7386)
+++ branches/Version-1_0-branch/booking/templates/base/group_edit.xsl   
2011-06-16 10:30:40 UTC (rev 7387)
@@ -77,7 +77,7 @@
                                        </select>
                                </dd>
                        </xsl:if>
-                       <xsl:if test="not(new_form) and (currentapp = 
'booking')">
+                       <!--<xsl:if test="not(new_form) and (currentapp = 
'booking')">-->
                        <dt><label for="field_show_in_portal"><xsl:value-of 
select="php:function('lang', 'Show in portal')"/></label></dt>
                        <dd>
                           <select id="field_show_in_portal" 
name="show_in_portal">
@@ -95,7 +95,7 @@
                               </option>
                           </select>
                        </dd>
-                       </xsl:if>
+                       <!--</xsl:if>-->
                </dl>
                
                <div style='clear:left; padding:0; margin:0'/>

Modified: 
branches/Version-1_0-branch/booking/templates/base/organization_edit.xsl
===================================================================
--- branches/Version-1_0-branch/booking/templates/base/organization_edit.xsl    
2011-06-16 10:15:14 UTC (rev 7386)
+++ branches/Version-1_0-branch/booking/templates/base/organization_edit.xsl    
2011-06-16 10:30:40 UTC (rev 7387)
@@ -169,7 +169,7 @@
                           </select>
                        </dd>
                        </xsl:if>
-                       <xsl:if test="not(new_form) and (currentapp = 
'booking')">
+                       <!--<xsl:if test="not(new_form) and (currentapp = 
'booking')">-->
                        <dt><label for="field_show_in_portal"><xsl:value-of 
select="php:function('lang', 'Show in portal')"/></label></dt>
                        <dd>
                           <select id="field_show_in_portal" 
name="show_in_portal">
@@ -187,7 +187,7 @@
                               </option>
                           </select>
                        </dd>
-                       </xsl:if>
+                       <!--</xsl:if>-->
                </dl>
 
                <div style='clear:left; padding:0; margin:0'/>

Modified: branches/Version-1_0-branch/property/inc/class.bolocation.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.bolocation.inc.php   
2011-06-16 10:15:14 UTC (rev 7386)
+++ branches/Version-1_0-branch/property/inc/class.bolocation.inc.php   
2011-06-16 10:30:40 UTC (rev 7387)
@@ -89,6 +89,11 @@
                        $allrows                                = 
phpgw::get_var('allrows', 'bool');
                        $location_code                  = 
phpgw::get_var('location_code');
 
+                       if($location_code && !$type_id)
+                       {
+                               $type_id = count(explode('-',$location_code));
+                       }
+
                        $this->start                    = $start ? $start : 0;
                        $this->query                    = isset($query) && 
$query ? $query : '';
                        $this->filter                   = isset($filter) && 
$filter ? $filter : '';

Copied: branches/Version-1_0-branch/property/inc/class.uiimport.inc.php (from 
rev 7386, trunk/property/inc/class.uiimport.inc.php)
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiimport.inc.php             
                (rev 0)
+++ branches/Version-1_0-branch/property/inc/class.uiimport.inc.php     
2011-06-16 10:30:40 UTC (rev 7387)
@@ -0,0 +1,346 @@
+<?php
+
+       class property_uiimport
+       {
+               var $public_functions = array
+               (
+                       'index'         => true
+               );
+
+               const DELIMITER = ";";
+               const ENCLOSING = "'";
+               
+               // List of messages, warnings and errors to be displayed to the 
user after the import
+               protected $messages = array();
+               protected $warnings = array();
+               protected $errors = array();
+               
+               // File system path to import folder on server
+               protected $file;
+               protected $district;
+               protected $csvdata;
+               protected $account;
+               protected $conv_type;
+               protected $import_conversion;
+               
+               // Label on the import button. Changes as we step through the 
import process.
+               protected $import_button_label;
+               
+               protected $defalt_values;
+               
+               public function __construct()
+               {
+                       set_time_limit(10000); //Set the time limit for this 
request oto 3000 seconds
+                       $this->account          = 
(int)$GLOBALS['phpgw_info']['user']['account_id'];
+               }
+               
+
+               /**
+                * Public method. 
+                * 
+                * @return unknown_type
+                */
+               public function index()
+               {
+                       // Set the submit button label to its initial state
+                       $this->import_button_label = "Start import";
+
+                       // If the parameter 'importsubmit' exist (submit button 
in import form), set path
+                       if (phpgw::get_var("importsubmit")) 
+                       {
+                               // Get the path for user input or use a default 
path
+                               
+                               if($this->file = $_FILES['file']['tmp_name'])
+                               {
+                                       $this->csvdata = 
$this->getcsvdata($this->file);
+                               }
+
+                               $this->conv_type        = 
phpgw::get_var('conv_type');
+//_debug_array($this->csvdata);
+                               phpgwapi_cache::session_set('property', 'file', 
$this->file);
+                               phpgwapi_cache::session_set('property', 
'csvdata', $this->csvdata);
+                               phpgwapi_cache::session_set('property', 
'conv_type', $this->conv_type);
+                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'property.uiimport.index', 'importstep' => 'true'));
+                       } 
+                       else if(phpgw::get_var("importstep"))
+                       {
+                               $start_time = time(); // Start time of import
+                               $start = date("G:i:s",$start_time);
+                               echo "<h3>Import started at: {$start}</h3>";
+                               echo "<ul>";
+                               $this->file = 
phpgwapi_cache::session_get('property', 'file');
+                               $this->csvdata = 
phpgwapi_cache::session_get('property', 'csvdata');
+                               $this->conv_type = 
phpgwapi_cache::session_get('property', 'conv_type');
+
+                               if($this->conv_type)
+                               {
+                                       if ( preg_match('/\.\./', 
$this->conv_type) )
+                                       {
+                                               break;
+                                       }
+
+                                       $file = PHPGW_SERVER_ROOT . 
"/property/inc/import/{$GLOBALS['phpgw_info']['user']['domain']}/{$this->conv_type}";
+       
+                                       if ( is_file($file) )
+                                       {
+//_debug_Array($file);die();
+                                               require_once $file;
+                                               $this->import_conversion = new 
import_conversion;
+                                       }
+                               }
+
+                               $result = $this->import(); // Do import step, 
result determines if finished for this area
+                               echo '<li class="info">Aktiviteter: finished 
step ' .$result. '</li>';
+                               while($result != '1')
+                               {
+                                       $result = $this->import();
+                                       echo '<li class="info">Aktiviteter: 
finished step ' .$result. '</li>';
+                                       flush();
+                               }
+
+                               echo "</ul>";
+                               $end_time = time();
+                               $difference = ($end_time - $start_time) / 60;
+                               $end = date("G:i:s",$end_time);
+                               echo "<h3>Import ended at: {$end}. Import 
lasted {$difference} minutes.";
+                               
+                               $this->messages = 
array_merge($this->messages,$this->import_conversion->messages);
+                               $this->warnings = 
array_merge($this->warnings,$this->import_conversion->warnings);
+                               $this->errors = 
array_merge($this->errors,$this->import_conversion->errors);
+
+                               if ($this->errors)
+                               { 
+                                       echo "<ul>";
+                                       foreach ($this->errors as $error)
+                                       {
+                                               echo '<li class="error">Error: 
' . $error . '</li>';
+                                       }
+               
+                                       echo "</ul>";
+                               }
+               
+                               if ($this->warnings)
+                               { 
+                                       echo "<ul>";
+                                       foreach ($this->warnings as $warning)
+                                       {
+                                               echo '<li 
class="warning">Warning: ' . $warning . '</li>';
+                                       }
+                                       echo "</ul>";
+                               }
+               
+                               if ($this->messages)
+                               {
+                                       echo "<ul>";
+               
+                                       foreach ($this->messages as $message)
+                                       {
+                                               echo '<li class="info">' . 
$message . '</li>';
+                                       }
+                                       echo "</ul>";
+                               }
+                       }
+                       else
+                       {
+
+                               $conv_list = 
$this->get_import_conv($this->conv_type);
+                               
+                               $conv_option = '<option value="">' . lang('none 
selected') . '</option>' . "\n";
+                               foreach ( $conv_list as $conv)
+                               {
+                                       $selected = '';
+                                       if ( $conv['selected'])
+                                       {
+                                               $selected = 'selected =  
"selected"';
+                                       }
+
+                                       $conv_option .=  <<<HTML
+                                       <option 
value='{$conv['id']}'{$selected}>{$conv['name']}</option>
+HTML;
+                               }                       
+                               $html = <<<HTML
+                               <h1><img 
src="rental/templates/base/images/32x32/actions/document-save.png" /> 
Importer</h1>
+                               <div id="messageHolder"></div>
+                               <form 
action="index.php?menuaction=property.uiimport.index" method="post" 
enctype="multipart/form-data">
+                                       <fieldset>
+                                               <label for="file">Choose 
file:</label> <input type="file" name="file" id="file" />
+                                               <label for="conv_type">Choose 
conversion:</label>
+                                               <select name="conv_type" 
id="conv_type">
+                                               {$conv_option}
+                                               </select>
+                                               <input type="submit" 
name="importsubmit" value="{$this->import_button_label}"  />
+                                       </fieldset>
+                               </form>
+HTML;
+                               echo $html;
+                       }
+               }
+               
+               /**
+                * Import Facilit data to Portico Estate's rental module
+                * The function assumes CSV files have been uploaded to a 
location on the server reachable by the
+                * web server user.  The CSV files must correspond to the table 
names from Facilit, as exported
+                * from Access. Field should be enclosed in single quotes and 
separated by comma.  The CSV files
+                * must contain the column headers on the first line.
+                * 
+                * @return unknown_type
+                */
+               public function import()
+               {
+                       $steps = 1;
+                       
+                       /* Import logic:
+                        * 
+                        * 1. Do step logic if the session variable is not set
+                        * 2. Set step result on session
+                        * 3. Set label for import button
+                        * 4. Log messages for this step
+                        *  
+                        */
+                       
+                       $this->messages = array();
+                       $this->warnings = array();
+                       $this->errors = array();
+                       
+                       // Import data if not done before and put them on the 
users session
+                       if (!phpgwapi_cache::session_get('property', 
'data_import'))
+                       {
+                               phpgwapi_cache::session_set('property', 
'data_import', $this->import_data()); 
+                $this->log_messages(1);
+                               return '1';
+                       }
+
+                       // We're done with the import, so clear all session 
variables so we're ready for a new one
+                       phpgwapi_cache::session_clear('property', 
'data_import');
+                       phpgwapi_cache::session_clear('property', 'conv_type');
+                       return '1';
+               }
+               
+               protected function import_data()
+               {
+                       $start_time = time();
+                       
+                       $datalines = $this->csvdata;
+                       
+                       $this->messages[] = "Read 'import_all.csv' file in " . 
(time() - $start_time) . " seconds";
+                       $this->messages[] = "'importfile.csv' contained " . 
count($datalines) . " lines";
+                       
+                       $this->db           = & $GLOBALS['phpgw']->db;
+       
+                       $ok = true;
+                       $_ok = false;
+                       $this->db->transaction_begin();
+
+                       //Do your magic...
+                       foreach ($datalines as $data)
+                       {
+                               if(!$_ok = $this->import_conversion->add($data))
+                               {
+                                       $ok = false;
+                               }
+                       }
+                       
+                       if($ok)
+                       {
+                               $this->messages[] = "Imported data. (" . 
(time() - $start_time) . " seconds)";
+                               $this->db->transaction_commit();
+                               return true;
+                       }
+                       else
+                       {
+                               $this->errors[] = "Import of data failed. (" . 
(time() - $start_time) . " seconds)";
+                               $this->db->transaction_abort();
+                               return false;
+                       }
+               }
+
+
+               protected function getcsvdata($path, $skipfirstline = true)
+               {
+                       // Open the csv file
+                       $handle = fopen($path, "r");
+                       
+                       if ($skipfirstline)
+                       {
+                               // Read the first line to get the headers out 
of the way
+                               $this->getcsv($handle);
+                       }
+                       
+                       $result = array();
+                       
+                       while(($data = $this->getcsv($handle)) !== false)
+                       {
+                               $result[] = $data;
+                       }
+                       
+                       fclose($handle);
+                       
+                       return $result;
+               }
+                       
+               
+               /**
+                * Read the next line from the given file handle and parse it 
to CSV according to the rules set up
+                * in the class constants DELIMITER and ENCLOSING.  Returns 
FALSE like getcsv on EOF.
+                * 
+                * @param file-handle $handle
+                * @return array of values from the parsed csv line
+                */
+               protected function getcsv($handle)
+               {
+                       return fgetcsv($handle, 1000, self::DELIMITER, 
self::ENCLOSING);
+               }
+               
+
+               private function log_messages($step)
+        {
+               sort($this->errors);
+               sort($this->warnings);
+               sort($this->messages);
+               
+            $msgs = array_merge(
+               array('----------------Errors--------------------'),
+               $this->errors,
+               array('---------------Warnings-------------------'),
+               $this->warnings,
+               array('---------------Messages-------------------'),
+               $this->messages
+            );
+
+            $path = $GLOBALS['phpgw_info']['server']['temp_dir'];
+            if(is_dir($path.'/logs') || mkdir($path.'/logs'))
+            {
+                file_put_contents("$path/logs/$step.log", implode(PHP_EOL, 
$msgs));
+            }
+        }
+
+               protected function get_import_conv($selected='')
+               {
+                       $dir_handle = @opendir(PHPGW_SERVER_ROOT . 
"/property/inc/import/{$GLOBALS['phpgw_info']['user']['domain']}");
+                       $i=0; $myfilearray = array();
+                       while ($file = readdir($dir_handle))
+                       {
+                               if ((substr($file, 0, 1) != '.') && 
is_file(PHPGW_SERVER_ROOT . 
"/property/inc/import/{$GLOBALS['phpgw_info']['user']['domain']}/{$file}") )
+                               {
+                                       $myfilearray[$i] = $file;
+                                       $i++;
+                               }
+                       }
+                       closedir($dir_handle);
+                       sort($myfilearray);
+
+                       for ($i=0;$i<count($myfilearray);$i++)
+                       {
+                               $fname = preg_replace('/_/',' 
',$myfilearray[$i]);
+
+                               $conv_list[] = array
+                               (
+                                       'id'            => $myfilearray[$i],
+                                       'name'          => $fname,
+                                       'selected'      => 
$myfilearray[$i]==$selected ? 1 : 0
+                               );
+                       }
+
+                       return $conv_list;
+               }
+       }

Modified: branches/Version-1_0-branch/property/inc/class.uilocation.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uilocation.inc.php   
2011-06-16 10:15:14 UTC (rev 7386)
+++ branches/Version-1_0-branch/property/inc/class.uilocation.inc.php   
2011-06-16 10:30:40 UTC (rev 7387)
@@ -2302,7 +2302,9 @@
                                                $cxContext = 
stream_context_create($aContext);
                                                $response = 
trim(file_get_contents($request, False, $cxContext));
 
-                                               $integration[]  = 
array('section' => $_config_section);
+                                               
+                                               $_config_section_name = 
str_replace(' ', '_',$_config_section);
+                                               $integration[]  = 
array('section' => $_config_section_name);
                                                $_config_section_data['url']    
        = htmlspecialchars_decode($_config_section_data['url']);
                                                
$_config_section_data['parametres']     = 
htmlspecialchars_decode($_config_section_data['parametres']);
 
@@ -2364,7 +2366,7 @@
                                                        foreach ($output as 
$_dummy => $_substitute)
                                                        {
                                                                $_keys[] = 
$_substitute;
-                                                               $_values[] = 
urlencode($values['location_data'][trim($_substitute, '_')]);
+                                                               $_values[] = 
urlencode($values[trim($_substitute, '_')]);
                                                        }
                                                        $integration_src .= '&' 
. str_replace($_keys, $_values, $_config_section_data['location_data']);
                                                }
@@ -2372,13 +2374,13 @@
                                                $integration_src .= 
"&{$_config_section_data['auth_key_name']}={$response}";
                                                //_debug_array($values);
                                                
//_debug_array($integration_src);die();
-                                               $tabs[$_config_section] = 
array('label' => $_config_section_data['tab'], 'link' => "#{$_config_section}", 
'function' => "document.getElementById('{$_config_section}_content').src = 
'{$integration_src}';");
+
+                                               $tabs[$_config_section] = 
array('label' => $_config_section_data['tab'], 'link' => 
"#{$_config_section_name}", 'function' => 
"document.getElementById('{$_config_section_name}_content').src = 
'{$integration_src}';");
                                        }
                                }
 // ---- END INTEGRATION -------------------------
                        }
 
-
                        $data = array
                        (
                                'integration'                                   
=> $integration,

Copied: 
branches/Version-1_0-branch/property/inc/import/default/cvs_import_kunstoversikt_bkb
 (from rev 7386, trunk/property/inc/import/default/cvs_import_kunstoversikt_bkb)
===================================================================
--- 
branches/Version-1_0-branch/property/inc/import/default/cvs_import_kunstoversikt_bkb
                                (rev 0)
+++ 
branches/Version-1_0-branch/property/inc/import/default/cvs_import_kunstoversikt_bkb
        2011-06-16 10:30:40 UTC (rev 7387)
@@ -0,0 +1,122 @@
+<?php
+       class import_conversion
+       {
+               protected $db;
+               public $messages = array();
+               public $warnings = array();
+               public $errors = array();
+
+               public function __construct()
+               {
+                       set_time_limit(10000); //Set the time limit for this 
request
+                       $this->account          = 
(int)$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->db           = & $GLOBALS['phpgw']->db;
+               }
+
+               public function add($data)
+               {
+//                     $debug = true;
+                       $error = false;
+                       $table = 'fm_entity_4_1';
+                       $byggid = $this->decode($data[0]);
+                       $location_code = substr($byggid,0,4) . '-0' . 
substr($byggid,-1);
+//_debug_array($location_code);
+                       $location_data = 
execMethod('property.solocation.read_single', $location_code );
+_debug_array($data);
+//_debug_array($location_data);die();
+                       if(!$location_data)
+                       {
+                               $this->errors[] = "Error importing location: 
{$location_code}";
+                               $error = true;
+                               return false;
+                       }
+
+                       if($location_data['street_name'])
+                       {
+                               $address[]= $location_data['street_name'];
+                               $address[]= $location_data['street_number'];
+                               $address        = 
$this->db->db_addslashes(implode(" ", $address));
+                       }
+
+                       if(!$address)
+                       {
+                               $address = 
$this->db->db_addslashes($location_data['loc1_name']);
+                       }
+
+                       $id = (int)$data[2];
+
+                       $this->messages[] = "Dagens dato er lagt inn som 
registreringsdato for {$id}  (mangler info)";
+                       $entry_date = time();
+
+_debug_array($entry_date_info);
+_debug_array($entry_date);
+                       $value_set = array();
+
+                       $value_set['id']                                        
= $id;
+                       $value_set['num']                                       
= sprintf('%04s',$id);
+               $value_set['loc1']                                      = 
$location_data['loc1'];
+               $value_set['loc2']                                      = 
$location_data['loc2'];
+                       $value_set['user_id']                           = 
$this->account;
+                       $value_set['location_code']                     = 
$location_code;
+                       $value_set['address']                           = 
$address;
+                       $value_set['entry_date']                        = 
$entry_date;
+                       $value_set['museumsnr']                         = 
$this->db->db_addslashes($data[1]);
+                       $value_set['betegnelse']                        = 
$this->db->db_addslashes($data[3]);
+                       $value_set['beskrivelse']                       = 
$this->db->db_addslashes($data[4]);
+                       $value_set['tilstand']                          = 
$this->db->db_addslashes($data[5]);
+
+                       $cols = implode(',', array_keys($value_set));
+                       $values = 
$this->db->validate_insert(array_values($value_set));
+
+                       $sql = "INSERT INTO {$table} ({$cols}) VALUES 
({$values})";
+
+                       if($debug)
+                       {
+                               _debug_array($sql);
+                       }
+                       else
+                       {
+                               $request_ok = 
$this->db->query($sql,__LINE__,__FILE__);
+                       }
+
+                       if(!$error)
+                       {
+                               $this->messages[] = "Successfully imported 
location: Title ({$this->decode($data[1])})";
+                               $ok = true;
+                       }
+                       else
+                       {
+                               $this->errors[] = "Error importing location: 
Title ({$this->decode($data[1])})";
+                               $ok = false;
+                       }
+                       return $ok;
+               }
+
+               /**
+                * Convert from the locale encoding to UTF-8 encoding and 
escape single quotes
+                * 
+                * @param string $value The value to convert
+                * @return string
+                */
+               protected function decode($value)
+               {
+                       $converted = mb_convert_encoding($value, 'UTF-8');
+                       if ($this->is_null(trim($converted)))
+                       {
+                               return null;
+                       }
+                       return stripslashes($converted);
+               }
+               
+               /**
+                * Test a value for null according to several formats that can 
exist in the export.
+                * Returns true if the value is null according to these rules, 
false otherwise.
+                * 
+                * @param string $value The value to test
+                * @return bool
+                */
+               protected function is_null($value)
+               {
+                       return ((trim($value) == "") || ($data == "<NULL>") || 
($data == "''"));
+               }
+       }

Copied: 
branches/Version-1_0-branch/property/inc/import/default/cvs_import_vedlikeholdsplan_bkb
 (from rev 7386, 
trunk/property/inc/import/default/cvs_import_vedlikeholdsplan_bkb)
===================================================================
--- 
branches/Version-1_0-branch/property/inc/import/default/cvs_import_vedlikeholdsplan_bkb
                             (rev 0)
+++ 
branches/Version-1_0-branch/property/inc/import/default/cvs_import_vedlikeholdsplan_bkb
     2011-06-16 10:30:40 UTC (rev 7387)
@@ -0,0 +1,345 @@
+<?php
+       class import_conversion
+       {
+               protected $db;
+               public $messages = array();
+               public $warnings = array();
+               public $errors = array();
+
+               public function __construct()
+               {
+                       set_time_limit(10000); //Set the time limit for this 
request oto 3000 seconds
+                       $this->account          = 
(int)$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->db           = & $GLOBALS['phpgw']->db;
+               }
+
+               public function add($data)
+               {
+
+                       $debug = true;
+                       $error = false;
+                       $type = $this->decode($data[0]);
+                       $location_code = $this->decode($data[1]);
+
+                       $location_data = 
execMethod('property.solocation.read_single', $location_code );
+_debug_array($data);
+//_debug_array($location_data);die();
+                       if(!$location_data)
+                       {
+                               $this->errors[] = "Error importing location: 
{$location_code}";
+                               $error = true;
+                               return false;
+                       }
+
+                       $value_set = array();
+
+               $value_set['loc1'] = $location_data['loc1'];
+               $value_set['loc2'] = $location_data['loc2'];
+
+
+                       if($location_data['street_name'])
+                       {
+                               $address[]= $location_data['street_name'];
+                               $address[]= $location_data['street_number'];
+                               $address        = 
$this->db->db_addslashes(implode(" ", $address));
+                       }
+
+                       if(!$address)
+                       {
+                               $address = 
$this->db->db_addslashes($location_data['loc1_name']);
+                       }
+
+
+                       $this->db->query("SELECT value FROM fm_idgenerator 
WHERE name = 'request'");
+                       $this->db->next_record();
+                       $id = $this->db->f('value')+1;
+
+                       if($data[4])
+                       {
+                               $entry_date_info = explode('/',$data[4]);
+                       }
+                       else if($data[5])
+                       {
+                               $entry_date_info = explode('/',$data[5]);
+                       }
+                       //YYYY/MM/DD
+                       
+                       if(isset($entry_date_info[0]) && 
ctype_digit($entry_date_info[0]))
+                       {
+                               $entry_date = 
strtotime("{$entry_date_info[0]}/06/24");
+                       }
+                       else
+                       {
+                               $this->messages[] = "Dagens dato er lagt inn 
som registreringsdato for {$id}  (mangler info)";
+                               $entry_date = time();
+                       }
+
+//$category = ????;
+//$authorities_demands
+//$building_part
+//$coordinator
+_debug_array($entry_date_info);
+_debug_array($entry_date);
+
+                       $value_set['id']                                        
= $id;
+                       $value_set['title']                                     
= $this->db->db_addslashes("{$data[7]}: {$data[10]}");
+                       $value_set['owner']                                     
= $this->account;
+                       $value_set['category']                          = 
$category;
+                       $value_set['descr']                                     
= $this->db->db_addslashes("{$type}\n{$data[7]}: {$data[10]}");
+                       $value_set['location_code']                     = 
$location_code;
+                       $value_set['address']                           = 
$address;
+                       $value_set['entry_date']                        = 
$entry_date;
+                       $value_set['budget']                            = 
(int)str_replace(',', '', $data[12]);
+                       $value_set['status']                            = 
$data['status'];
+       //              $value_set['branch_id']                         = 
$data['branch_id'];
+       //              $value_set['coordinator']                       = 
$coordinator;
+                       $value_set['authorities_demands']       = 
$authorities_demands;
+                       $value_set['building_part']                     = 
$building_part;
+       //              $value_set['start_date']                        = 
$data['start_date'];
+       //              $value_set['end_date']                          = 
$data['end_date'];
+       //              $value_set['regulations']                       = 
$data['regulations'] ? ',' . implode(',',$data['regulations']) . ',' : '';
+
+                       $cols = implode(',', array_keys($value_set));
+                       $values = 
$this->db->validate_insert(array_values($value_set));
+
+                       $sql = "INSERT INTO fm_request ({$cols}) VALUES 
({$values})";
+
+                       if($debug)
+                       {
+                               _debug_array($sql);
+                       }
+                       else
+                       {
+//                             $request_ok = 
$this->db->query($sql,__LINE__,__FILE__);
+                       }
+
+                       $condition = array();
+                       
+                       if($data[8] || $data[9])
+                       {
+                               $condition[1] = array
+                               (
+                                       'degree'                => 
(int)$data[8],
+                                       'probability'   =>      2,
+                                       'consequence'   =>      (int)$data[9]
+                               );
+                       }
+                       
+                       
+                       foreach ($condition as $condition_type => $value_type)
+                       {
+                               $sql = "INSERT INTO fm_request_condition 
(request_id,condition_type,degree,probability,consequence,user_id,entry_date) "
+                                       . "VALUES ("
+                                       . $id. ","
+                                       . $condition_type . ","
+                                       . $value_type['degree']. ","
+                                       . $value_type['probability']. ","
+                                       . $value_type['consequence']. ","
+                                       . $this->account . ","
+                                       . time() . ")";
+
+                               if($debug)
+                               {
+                                       _debug_array($sql);
+                               }
+                               else
+                               {
+//                                     
$this->db->query($sql,__LINE__,__FILE__);
+                               }
+                       }
+
+/*
+                       $value_set['in_progress_date']  = time();
+                       $value_set['closed_date']               = time();
+                       $value_set['delivered_date']    = time();
+*/
+
+                       for ($i=13; $i<27; $i++)
+                       {
+                               $data[$i] = str_replace(',', '', $data[$i]);
+                       }
+
+                       $consume_data = array();
+                       if($data[13] && ctype_digit($data[13]))
+                       {
+                               $consume_data[] = array
+                               (
+                                        'value' => (int)$data[13],
+                                        'date' => strtotime("2012/06/24")
+                               );
+                       }
+
+                       if($data[14] && ctype_digit($data[14]))
+                       {
+                               $consume_data[] = array
+                               (
+                                        'value' => (int)$data[14],
+                                        'date' => strtotime("2011/06/24")
+                               );
+                       }
+                       if($data[15] && ctype_digit($data[15]))
+                       {
+                               $consume_data[] = array
+                               (
+                                        'value' => (int)$data[15],
+                                        'date' => strtotime("2010/06/24")
+                               );
+                       }
+                       if($data[16] && ctype_digit($data[16]))
+                       {
+                               $consume_data[] = array
+                               (
+                                        'value' => (int)$data[16],
+                                        'date' => strtotime("2009/06/24")
+                               );
+                       }
+                       if($data[17] && ctype_digit($data[17]))
+                       {
+                               $consume_data[] = array
+                               (
+                                        'value' => (int)$data[17],
+                                        'date' => strtotime("2008/06/24")
+                               );
+                       }
+
+                       if($data[18] && ctype_digit($data[18]))
+                       {
+                               $consume_data[] = array
+                               (
+                                        'value' => (int)$data[18],
+                                        'date' => strtotime("2007/06/24")
+                               );
+                       }
+                       if($data[19] && ctype_digit($data[19]))
+                       {
+                               $consume_data[] = array
+                               (
+                                        'value' => (int)$data[19],
+                                        'date' => strtotime("2006/06/24")
+                               );
+                       }
+                       if($data[20] && ctype_digit($data[20]))
+                       {
+                               $consume_data[] = array
+                               (
+                                        'value' => (int)$data[20],
+                                        'date' => strtotime("2005/06/24")
+                               );
+                       }
+                       if($data[21] && ctype_digit($data[21]))
+                       {
+                               $consume_data[] = array
+                               (
+                                        'value' => (int)$data[21],
+                                        'date' => strtotime("2004/06/24")
+                               );
+                       }
+
+                       if($data[22] && ctype_digit($data[22]))
+                       {
+                               $consume_data[] = array
+                               (
+                                        'value' => (int)$data[22],
+                                        'date' => strtotime("2003/06/24")
+                               );
+                       }
+                       if($data[23] && ctype_digit($data[23]))
+                       {
+                               $consume_data[] = array
+                               (
+                                        'value' => (int)$data[23],
+                                        'date' => strtotime("2002/06/24")
+                               );
+                       }
+                       if($data[24] && ctype_digit($data[24]))
+                       {
+                               $consume_data[] = array
+                               (
+                                        'value' => (int)$data[24],
+                                        'date' => strtotime("2001/06/24")
+                               );
+                       }
+
+                       if($data[25] && ctype_digit($data[25]))
+                       {
+                               $consume_data[] = array
+                               (
+                                        'value' => (int)$data[25],
+                                        'date' => strtotime("2000/06/24")
+                               );
+                       }
+
+                       if($data[26] && ctype_digit($data[26]))
+                       {
+                               $consume_data[] = array
+                               (
+                                        'value' => (int)$data[26],
+                                        'date' => strtotime("1999/06/24")
+                               );
+                       }
+
+
+                       foreach ($consume_data as $consume)
+                       {
+                               $sql = "INSERT INTO fm_request_consume 
(request_id,amount,date,user_id,entry_date) "
+                                       . "VALUES ("
+                                       . $id . ","
+                                       . (int)$consume['value'] . ","
+                                       . (int)$consume['date'] . ","
+                                       . $this->account . ","
+                                       . time() . ")";
+                               if($debug)
+                               {
+                                       _debug_array($sql);
+                               }
+                               else
+                               {
+//                                     
$this->db->query($sql,__LINE__,__FILE__);
+                               }
+                       }
+
+
+//                     $this->db->query("UPDATE fm_idgenerator set value = 
value + 1 where name = 'request'");
+
+
+                       if(!$error)
+                       {
+                               $this->messages[] = "Successfully imported 
location: Title ({$this->decode($data[1])})";
+                               $ok = true;
+                       }
+                       else
+                       {
+                               $this->errors[] = "Error importing location: 
Title ({$this->decode($data[1])})";
+                               $ok = false;
+                       }
+                       return $ok;
+               }
+
+               /**
+                * Convert from the locale encoding to UTF-8 encoding and 
escape single quotes
+                * 
+                * @param string $value The value to convert
+                * @return string
+                */
+               protected function decode($value)
+               {
+                       $converted = mb_convert_encoding($value, 'UTF-8');
+                       if ($this->is_null(trim($converted)))
+                       {
+                               return null;
+                       }
+                       return stripslashes($converted);
+               }
+               
+               /**
+                * Test a value for null according to several formats that can 
exist in the export.
+                * Returns true if the value is null according to these rules, 
false otherwise.
+                * 
+                * @param string $value The value to test
+                * @return bool
+                */
+               protected function is_null($value)
+               {
+                       return ((trim($value) == "") || ($data == "<NULL>") || 
($data == "''"));
+               }
+       }

Modified: branches/Version-1_0-branch/property/templates/base/location.xsl
===================================================================
--- branches/Version-1_0-branch/property/templates/base/location.xsl    
2011-06-16 10:15:14 UTC (rev 7386)
+++ branches/Version-1_0-branch/property/templates/base/location.xsl    
2011-06-16 10:30:40 UTC (rev 7387)
@@ -557,16 +557,15 @@
                                                        </div>
                                                </xsl:when>
                                        </xsl:choose>
+                                       <xsl:for-each select="integration">
+                                               <div id="{section}">
+                                                       <iframe id = 
"{section}_content" width="100%" height="500">
+                                                               <p>Your browser 
does not support iframes.</p>
+                                                       </iframe>
+                                               </div>
+                               </xsl:for-each>
                                </div>
 
-                               <xsl:for-each select="integration">
-                                       <div id="{section}">
-                                               <iframe id = 
"{section}_content" width="100%" height="500">
-                                                       <p>Your browser does 
not support iframes.</p>
-                                               </iframe>
-                                       </div>
-                               </xsl:for-each>
-
                                <table cellpadding="2" cellspacing="2" 
width="80%" align="center">
                                        <tr height="50">
                                                <xsl:choose>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]