[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [7321] property: integration
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [7321] property: integration |
Date: |
Fri, 27 May 2011 14:13:18 +0000 |
Revision: 7321
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7321
Author: sigurdne
Date: 2011-05-27 14:13:18 +0000 (Fri, 27 May 2011)
Log Message:
-----------
property: integration
Modified Paths:
--------------
trunk/property/inc/class.uientity.inc.php
trunk/property/inc/class.uilocation.inc.php
trunk/property/templates/base/entity.xsl
trunk/property/templates/base/location.xsl
Modified: trunk/property/inc/class.uientity.inc.php
===================================================================
--- trunk/property/inc/class.uientity.inc.php 2011-05-27 10:20:54 UTC (rev
7320)
+++ trunk/property/inc/class.uientity.inc.php 2011-05-27 14:13:18 UTC (rev
7321)
@@ -1641,10 +1641,11 @@
}
*/
}
+// ---- START INTEGRATION -------------------------
$custom_config =
CreateObject('admin.soconfig',$GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type],
$this->acl_location));
- $_integration_config =
isset($custom_config->config_data['integration']) ?
$custom_config->config_data['integration'] : array();
-
+ $_config = isset($custom_config->config_data) &&
$custom_config->config_data ? $custom_config->config_data : array();
+//_debug_array($custom_config->config_data);die();
// required settings:
/*
integration_tab
@@ -1659,20 +1660,24 @@
integration_auth_hash_value
integration_location_data
*/
-
-
- $integration = '';
- if(isset($_integration_config['tab']) && $values['id'])
+ $integration = array();
+ foreach ($_config as $_config_section =>
$_config_section_data)
{
+ if(isset($_config_section_data['tab']) &&
$values['id'])
+ {
+ if(!isset($_config_section_data['url']))
+ {
+
phpgwapi_cache::message_set("'url' is a required setting for integrations,
'{$_config_section}' is disabled", 'error');
+ break;
+ }
- //get session key from remote system
+ //get session key from remote system
+ $arguments =
array($_config_section_data['auth_hash_name'] =>
$_config_section_data['auth_hash_value']);
+ $query = http_build_query($arguments);
+ $auth_url =
$_config_section_data['auth_url'];
+ $request = "{$auth_url}?{$query}";
- $arguments =
array($_integration_config['auth_hash_name'] =>
$_integration_config['auth_hash_value']);
- $query = http_build_query($arguments);
- $auth_url = $_integration_config['auth_url'];
- $request = "{$auth_url}?{$query}";
-
- $aContext = array
+ $aContext = array
(
'http' => array
(
@@ -1680,88 +1685,91 @@
),
);
-
if(isset($GLOBALS['phpgw_info']['server']['httpproxy_server']))
- {
- $aContext['http']['proxy'] =
"{$GLOBALS['phpgw_info']['server']['httpproxy_server']}:{$GLOBALS['phpgw_info']['server']['httpproxy_port']}";
- }
+
if(isset($GLOBALS['phpgw_info']['server']['httpproxy_server']))
+ {
+ $aContext['http']['proxy'] =
"{$GLOBALS['phpgw_info']['server']['httpproxy_server']}:{$GLOBALS['phpgw_info']['server']['httpproxy_port']}";
+ }
+ $cxContext =
stream_context_create($aContext);
+ $response =
trim(file_get_contents($request, False, $cxContext));
- $cxContext = stream_context_create($aContext);
- $response = trim(file_get_contents($request,
False, $cxContext));
+ $integration[] = array('section' =>
$_config_section);
+ $_config_section_data['url']
= htmlspecialchars_decode($_config_section_data['url']);
+ $_config_section_data['parametres']
= htmlspecialchars_decode($_config_section_data['parametres']);
- $integration = true;
- $_integration_config['url'] =
htmlspecialchars_decode($_integration_config['url']);
- $_integration_config['parametres'] =
htmlspecialchars_decode($_integration_config['parametres']);
+
parse_str($_config_section_data['parametres'], $output);
- parse_str($_integration_config['parametres'],
$output);
-
- foreach ($output as $_dummy => $_substitute)
- {
- $_keys[] = $_substitute;
-
- $__value = false;
- if(!$__value =
urlencode($values[trim($_substitute, '_')]))
+ foreach ($output as $_dummy =>
$_substitute)
{
- foreach ($values['attributes']
as $_attribute)
+ $_keys[] = $_substitute;
+
+ $__value = false;
+ if(!$__value =
urlencode($values[trim($_substitute, '_')]))
{
- if(trim($_substitute,
'_') == $_attribute['name'])
+ foreach
($values['attributes'] as $_attribute)
{
- $__value =
urlencode($_attribute['value']);
- break;
+
if(trim($_substitute, '_') == $_attribute['name'])
+ {
+
$__value = urlencode($_attribute['value']);
+ break;
+ }
}
}
- }
- if($__value)
- {
- $_values[] = $__value;
+ if($__value)
+ {
+ $_values[] = $__value;
+ }
}
- }
-
//_debug_array($_integration_config['parametres']);
- //_debug_array($_values);
- unset($output);
- unset($__value);
- $_sep = '?';
- if (stripos($_integration_config['url'],'?'))
- {
- $_sep = '&';
- }
- $_param = str_replace($_keys, $_values,
$_integration_config['parametres']);
- unset($_keys);
- unset($_values);
- //
$integration_src =
phpgw::safe_redirect("{$_integration_config['url']}{$_sep}{$_param}");
- $integration_src =
"{$_integration_config['url']}{$_sep}{$_param}";
- if($_integration_config['action'])
- {
+
//_debug_array($_config_section_data['parametres']);
+ //_debug_array($_values);
+ unset($output);
+ unset($__value);
$_sep = '?';
- if (stripos($integration_src,'?'))
+ if
(stripos($_config_section_data['url'],'?'))
{
$_sep = '&';
}
- $integration_src .=
"{$_sep}{$_integration_config['action']}=" .
$_integration_config["action_{$mode}"];
- }
+ $_param = str_replace($_keys, $_values,
$_config_section_data['parametres']);
+ unset($_keys);
+ unset($_values);
+ // $integration_src =
phpgw::safe_redirect("{$_config_section_data['url']}{$_sep}{$_param}");
+ $integration_src =
"{$_config_section_data['url']}{$_sep}{$_param}";
+ if($_config_section_data['action'])
+ {
+ $_sep = '?';
+ if
(stripos($integration_src,'?'))
+ {
+ $_sep = '&';
+ }
+ $integration_src .=
"{$_sep}{$_config_section_data['action']}=" .
$_config_section_data["action_{$mode}"];
+ }
- $arguments =
array($_integration_config['auth_key_name'] => $response);
+ $arguments =
array($_config_section_data['auth_key_name'] => $response);
- if(isset($_integration_config['location_data'])
&& $_integration_config['location_data'])
- {
- $_integration_config['location_data']
= htmlspecialchars_decode($_integration_config['location_data']);
-
parse_str($_integration_config['location_data'], $output);
- foreach ($output as $_dummy =>
$_substitute)
+
if(isset($_config_section_data['location_data']) &&
$_config_section_data['location_data'])
{
- $_keys[] = $_substitute;
- $_values[] =
urlencode($values['location_data'][trim($_substitute, '_')]);
+
$_config_section_data['location_data'] =
htmlspecialchars_decode($_config_section_data['location_data']);
+
parse_str($_config_section_data['location_data'], $output);
+ foreach ($output as $_dummy =>
$_substitute)
+ {
+ $_keys[] = $_substitute;
+ $_values[] =
urlencode($values['location_data'][trim($_substitute, '_')]);
+ }
+ $integration_src .= '&' .
str_replace($_keys, $_values, $_config_section_data['location_data']);
}
- $integration_src .= '&' .
str_replace($_keys, $_values, $_integration_config['location_data']);
+
+ $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}';");
}
+ }
- $integration_src .=
"&{$_integration_config['auth_key_name']}={$response}";
- //_debug_array($values);
- //_debug_array($integration_src);die();
- $tabs['integration'] = array('label' =>
$_integration_config['tab'], 'link' => '#integration', 'function' =>
"document.getElementById('integration_content').src = '{$integration_src}';");
+// ---- END INTEGRATION -------------------------
- }
+
unset($values['attributes']);
$link_file_data = array
(
@@ -1976,7 +1984,7 @@
'textarearows'
=>
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
&& $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ?
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6,
'tabs'
=> phpgwapi_yui::tabview_generate($tabs, $active_tab),
'integration'
=> $integration,
- 'value_integration_src'
=> $integration_src,
+ // 'value_integration_src'
=> $integration_src,
'base_java_url'
=> "{menuaction:'property.uientity.get_files',".
"id:'{$id}',".
"entity_id:'{$this->entity_id}',".
Modified: trunk/property/inc/class.uilocation.inc.php
===================================================================
--- trunk/property/inc/class.uilocation.inc.php 2011-05-27 10:20:54 UTC (rev
7320)
+++ trunk/property/inc/class.uilocation.inc.php 2011-05-27 14:13:18 UTC (rev
7321)
@@ -2214,11 +2214,140 @@
}
}
}
+
+
+// ---- START INTEGRATION -------------------------
+
+ $custom_config =
CreateObject('admin.soconfig',$GLOBALS['phpgw']->locations->get_id('property',
$this->acl_location));
+ $_config = isset($custom_config->config_data)
&& $custom_config->config_data ? $custom_config->config_data : array();
+//_debug_array($custom_config->config_data);die();
+ // required settings:
+/*
+ integration_tab
+ integration_url
+ integration_parametres
+ integration_action
+ integration_action_view
+ integration_action_edit
+ integration_auth_key_name
+ integration_auth_url
+ integration_auth_hash_name
+ integration_auth_hash_value
+ integration_location_data
+ */
+ $integration = array();
+ foreach ($_config as $_config_section =>
$_config_section_data)
+ {
+ if(isset($_config_section_data['tab']))
+ {
+
if(!isset($_config_section_data['url']))
+ {
+
phpgwapi_cache::message_set("'url' is a required setting for integrations,
'{$_config_section}' is disabled", 'error');
+ break;
+ }
+
+ //get session key from remote
system
+ $arguments =
array($_config_section_data['auth_hash_name'] =>
$_config_section_data['auth_hash_value']);
+ $query =
http_build_query($arguments);
+ $auth_url =
$_config_section_data['auth_url'];
+ $request =
"{$auth_url}?{$query}";
+
+ $aContext = array
+ (
+ 'http' => array
+ (
+
'request_fulluri' => true,
+ ),
+ );
+
+
if(isset($GLOBALS['phpgw_info']['server']['httpproxy_server']))
+ {
+
$aContext['http']['proxy'] =
"{$GLOBALS['phpgw_info']['server']['httpproxy_server']}:{$GLOBALS['phpgw_info']['server']['httpproxy_port']}";
+ }
+
+ $cxContext =
stream_context_create($aContext);
+ $response =
trim(file_get_contents($request, False, $cxContext));
+
+ $integration[] =
array('section' => $_config_section);
+ $_config_section_data['url']
= htmlspecialchars_decode($_config_section_data['url']);
+
$_config_section_data['parametres'] =
htmlspecialchars_decode($_config_section_data['parametres']);
+
+
parse_str($_config_section_data['parametres'], $output);
+
+ foreach ($output as $_dummy =>
$_substitute)
+ {
+ $_keys[] = $_substitute;
+
+ $__value = false;
+ if(!$__value =
urlencode($values[trim($_substitute, '_')]))
+ {
+ foreach
($values['attributes'] as $_attribute)
+ {
+
if(trim($_substitute, '_') == $_attribute['name'])
+ {
+
$__value = urlencode($_attribute['value']);
+
break;
+ }
+ }
+ }
+
+ if($__value)
+ {
+ $_values[] =
$__value;
+ }
+ }
+
+
//_debug_array($_config_section_data['parametres']);
+ //_debug_array($_values);
+ unset($output);
+ unset($__value);
+ $_sep = '?';
+ if
(stripos($_config_section_data['url'],'?'))
+ {
+ $_sep = '&';
+ }
+ $_param = str_replace($_keys,
$_values, $_config_section_data['parametres']);
+ unset($_keys);
+ unset($_values);
+ // $integration_src =
phpgw::safe_redirect("{$_config_section_data['url']}{$_sep}{$_param}");
+ $integration_src =
"{$_config_section_data['url']}{$_sep}{$_param}";
+
if($_config_section_data['action'])
+ {
+ $_sep = '?';
+ if
(stripos($integration_src,'?'))
+ {
+ $_sep = '&';
+ }
+ $integration_src .=
"{$_sep}{$_config_section_data['action']}=" .
$_config_section_data["action_{$mode}"];
+ }
+
+ $arguments =
array($_config_section_data['auth_key_name'] => $response);
+
+
if(isset($_config_section_data['location_data']) &&
$_config_section_data['location_data'])
+ {
+
$_config_section_data['location_data'] =
htmlspecialchars_decode($_config_section_data['location_data']);
+
parse_str($_config_section_data['location_data'], $output);
+ foreach ($output as
$_dummy => $_substitute)
+ {
+ $_keys[] =
$_substitute;
+ $_values[] =
urlencode($values['location_data'][trim($_substitute, '_')]);
+ }
+ $integration_src .= '&'
. str_replace($_keys, $_values, $_config_section_data['location_data']);
+ }
+
+ $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}';");
+ }
+ }
+// ---- END INTEGRATION -------------------------
}
$data = array
(
+ 'integration'
=> $integration,
'roles'
=> $roles,
'edit'
=> $view ? '' : true,
'lang_change_type'
=> lang('Change type'),
Modified: trunk/property/templates/base/entity.xsl
===================================================================
--- trunk/property/templates/base/entity.xsl 2011-05-27 10:20:54 UTC (rev
7320)
+++ trunk/property/templates/base/entity.xsl 2011-05-27 14:13:18 UTC (rev
7321)
@@ -246,6 +246,15 @@
</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>
+
+ <!--
<xsl:choose>
<xsl:when
test="integration!=''">
<div id="integration">
@@ -253,13 +262,14 @@
<p>Your
browser does not support iframes.</p>
</iframe>
</div>
+
<div id="test" >
- <div class="hd"
style="background-color:#000000;color:#FFFFFF; border:0; text-align:center">
Integration </div>
+ <div class="hd"
style="background-color:#000000;color:#FFFFFF; border:0; text-align:center">
Kart </div>
<div class="bd"
style="text-align:center;"> </div>
</div>
</xsl:when>
</xsl:choose>
-
+ -->
<xsl:choose>
<xsl:when test="documents !=
''">
<div id="document">
Modified: trunk/property/templates/base/location.xsl
===================================================================
--- trunk/property/templates/base/location.xsl 2011-05-27 10:20:54 UTC (rev
7320)
+++ trunk/property/templates/base/location.xsl 2011-05-27 14:13:18 UTC (rev
7321)
@@ -558,6 +558,15 @@
</xsl:when>
</xsl:choose>
</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>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [7321] property: integration,
Sigurd Nes <=