[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [16182] more on eventplanner
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [16182] more on eventplanner |
Date: |
Sun, 22 Jan 2017 11:48:31 -0500 (EST) |
Revision: 16182
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16182
Author: sigurdne
Date: 2017-01-22 11:48:30 -0500 (Sun, 22 Jan 2017)
Log Message:
-----------
more on eventplanner
Modified Paths:
--------------
trunk/booking/inc/class.uimetasettings.inc.php
trunk/bookingfrontend/setup/default_records.inc.php
trunk/phpgwapi/inc/class.config.inc.php
trunk/phpgwapi/inc/class.socommon.inc.php
trunk/phpgwapi/inc/class.uicommon.inc.php
trunk/phpgwapi/inc/class.uicommon_jquery.inc.php
trunk/phpgwapi/templates/base/datatable_jquery.xsl
trunk/phpgwapi/templates/bookingfrontend/head.inc.php
Modified: trunk/booking/inc/class.uimetasettings.inc.php
===================================================================
--- trunk/booking/inc/class.uimetasettings.inc.php 2017-01-22 16:47:39 UTC
(rev 16181)
+++ trunk/booking/inc/class.uimetasettings.inc.php 2017-01-22 16:48:30 UTC
(rev 16182)
@@ -22,7 +22,9 @@
public function index()
{
- $config = CreateObject('phpgwapi.config', 'booking');
+ $appname = phpgw::get_var('appname');
+ $appname = $appname ? $appname : 'booking';
+ $config = CreateObject('phpgwapi.config', $appname);
$config->read();
if ($_SERVER['REQUEST_METHOD'] == 'POST')
Modified: trunk/bookingfrontend/setup/default_records.inc.php
===================================================================
--- trunk/bookingfrontend/setup/default_records.inc.php 2017-01-22 16:47:39 UTC
(rev 16181)
+++ trunk/bookingfrontend/setup/default_records.inc.php 2017-01-22 16:48:30 UTC
(rev 16182)
@@ -13,12 +13,14 @@
if (!$GLOBALS['phpgw']->accounts->exists('bookingguest')) // no guest
account already exists
{
+ $passwd = $GLOBALS['phpgw']->common->randomstring(6) . "ABab1!";
+
$GLOBALS['phpgw_info']['server']['password_level'] = '8CHAR';
$account = new phpgwapi_user();
$account->lid = 'bookingguest';
$account->firstname = 'booking';
$account->lastname = 'Guest';
- $account->passwd = 'bkbooking';
+ $account->passwd = $passwd;
$account->enabled = true;
$account->expires = -1;
$bookingguest = $GLOBALS['phpgw']->accounts->create($account,
array(), array(), $modules);
@@ -25,6 +27,12 @@
$preferences = createObject('phpgwapi.preferences');
$preferences->set_account_id($bookingguest);
- $preferences->add('bookingfrontend', 'template_set',
'bkbooking');
+ $preferences->add('common', 'template_set', 'bookingfrontend');
$preferences->save_repository(true, $GLOBALS['type']);
+
+ $config = CreateObject('phpgwapi.config', 'bookingfrontend');
+ $config->read();
+ $config->value('anonymous_user', 'bookingguest');
+ $config->value('anonymous_passwd', $passwd);
+ $config->save_repository();
}
Modified: trunk/phpgwapi/inc/class.config.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.config.inc.php 2017-01-22 16:47:39 UTC (rev
16181)
+++ trunk/phpgwapi/inc/class.config.inc.php 2017-01-22 16:48:30 UTC (rev
16182)
@@ -50,6 +50,12 @@
public $config_data = array();
/**
+ *
+ * @var bool $global_lock to be used in nested transactions
+ */
+ protected $global_lock = false;
+
+ /**
* Constructor
*
* @param string $module the module to store the data for
@@ -115,7 +121,15 @@
if ( is_array($config_data) && count($config_data) )
{
- $this->db->transaction_begin();
+ if ( $this->db->get_transaction() )
+ {
+ $this->global_lock = true;
+ }
+ else
+ {
+ $this->db->transaction_begin();
+ }
+
$this->delete_repository();
foreach ( $config_data as $name => $value )
{
@@ -129,7 +143,11 @@
. "VALUES ('{$this->module}',
'{$name}', '{$value}')";
$this->db->query($query, __LINE__,
__FILE__);
}
- $this->db->transaction_commit();
+
+ if ( !$this->global_lock )
+ {
+ $this->db->transaction_commit();
+ }
}
}
Modified: trunk/phpgwapi/inc/class.socommon.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.socommon.inc.php 2017-01-22 16:47:39 UTC (rev
16181)
+++ trunk/phpgwapi/inc/class.socommon.inc.php 2017-01-22 16:48:30 UTC (rev
16182)
@@ -582,9 +582,17 @@
}
}
}
-// $custom_fields = $object::get_custom_fields();
- $values_attribute =
createObject('phpgwapi.custom_fields')->convert_attribute_save($object->values_attribute);
+ $class_info = explode('_', get_class($object), 2);
+ $appname = $class_info[0];
+
+ $attrib_table =
$GLOBALS['phpgw']->locations->get_attrib_table($appname, $object::acl_location);
+ $values_attribute = array();
+ if($attrib_table)
+ {
+ $values_attribute =
createObject('phpgwapi.custom_fields')->convert_attribute_save($object->values_attribute);
+ }
+
if ( $values_attribute)
{
foreach ($values_attribute as $attrib_id =>
$entry)
@@ -654,8 +662,17 @@
}
}
}
- $values_attribute =
createObject('phpgwapi.custom_fields')->convert_attribute_save($object->values_attribute);
+ $class_info = explode('_', get_class($object), 2);
+ $appname = $class_info[0];
+
+ $attrib_table =
$GLOBALS['phpgw']->locations->get_attrib_table($appname, $object::acl_location);
+ $values_attribute = array();
+ if($attrib_table)
+ {
+ $values_attribute =
createObject('phpgwapi.custom_fields')->convert_attribute_save($object->values_attribute);
+ }
+
if ( $values_attribute)
{
foreach ($values_attribute as $attrib_id =>
$entry)
Modified: trunk/phpgwapi/inc/class.uicommon.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.uicommon.inc.php 2017-01-22 16:47:39 UTC (rev
16181)
+++ trunk/phpgwapi/inc/class.uicommon.inc.php 2017-01-22 16:48:30 UTC (rev
16182)
@@ -40,6 +40,7 @@
'view' => true,
'edit' => true,
'save' => true,
+ 'get_list' => true
);
protected
@@ -210,6 +211,16 @@
}
}
+ private function get_data()
+ {
+ if (empty($this->permissions[PHPGW_ACL_READ]))
+ {
+ phpgw::no_access();
+ }
+ $params = $this->bo->build_default_read_params();
+ return $this->bo->read($params);
+ }
+
/**
* (non-PHPdoc)
* @see eventplanner/inc/eventplanner_uicommon#query()
@@ -216,8 +227,7 @@
*/
public function query()
{
- $params = $this->bo->build_default_read_params();
- $values = $this->bo->read($params);
+ $values = $this->get_data();
array_walk($values["results"], array($this,
"_add_links"),
"{$this->called_class_arr[0]}.{$this->called_class_arr[1]}.edit");
return $this->jquery_results($values);
@@ -224,8 +234,34 @@
}
/**
+ * Returns a minimum for - let say - autocomplete
+ * @param void
+ * @return array An associative array
+ */
+ public function get_list()
+ {
+ $values = $this->get_data();
+
+ $results = array();
+ foreach ($values['results'] as $row)
+ {
+ $results[] = array(
+ 'id' => $row['id'],
+ 'name' =>$row['name'],
+ 'title' =>$row['title']
+ );
+ }
+ $values['results'] = $results;
+ return $this->jquery_results($values);
+ }
+
+ /**
* Called from subclasses
+ * @param type $fakebase
+ * @param type $sub_module
* @param type $id
+ * @return type
+ * @throws Exception
*/
protected function _handle_files( $fakebase, $sub_module, $id )
{
Modified: trunk/phpgwapi/inc/class.uicommon_jquery.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.uicommon_jquery.inc.php 2017-01-22 16:47:39 UTC
(rev 16181)
+++ trunk/phpgwapi/inc/class.uicommon_jquery.inc.php 2017-01-22 16:48:30 UTC
(rev 16182)
@@ -184,6 +184,25 @@
public function link( $data )
{
+ switch ($GLOBALS['phpgw_info']['flags']['currentapp'])
+ {
+ case 'bookingfrontend':
+ $base = '/bookingfrontend/';
+ break;
+ case 'activitycalendarfrontend':
+ $base = '/activitycalendarfrontend/';
+ break;
+ case 'eventplannerfrontend':
+ $base = '/eventplannerfrontend/';
+ break;
+ default:
+ $base = '/index.php/';
+ break;
+ }
+
+ return $GLOBALS['phpgw']->link($base, $data);
+
+/*
if ($GLOBALS['phpgw_info']['flags']['currentapp'] ==
'bookingfrontend')
{
return
$GLOBALS['phpgw']->link('/bookingfrontend/', $data);
@@ -196,6 +215,7 @@
{
return $GLOBALS['phpgw']->link('/index.php',
$data);
}
+ */
}
public function redirect( $link_data )
Modified: trunk/phpgwapi/templates/base/datatable_jquery.xsl
===================================================================
--- trunk/phpgwapi/templates/base/datatable_jquery.xsl 2017-01-22 16:47:39 UTC
(rev 16181)
+++ trunk/phpgwapi/templates/base/datatable_jquery.xsl 2017-01-22 16:48:30 UTC
(rev 16182)
@@ -154,6 +154,8 @@
$(document).ready(function() {
var app = "<xsl:value-of select="app"/>";
app = app || 'booking';
+
var FunctionName = "<xsl:value-of select="function"/>";
+
FunctionName = FunctionName || 'index';
var label_attr = "<xsl:value-of select="label_attr"/>";
label_attr = label_attr || 'name';
var show_id = false;
@@ -179,7 +181,7 @@
if (filter_select != filter_selected){
if (filter_depends) {
<![CDATA[
-
JqueryPortico.autocompleteHelper('index.php?menuaction=' + app +
'.ui'+ui+'.index&filter_'+depends+'_id='+filter_depends+'&',
+
JqueryPortico.autocompleteHelper('index.php?menuaction=' + app + '.ui'+ui+'.' +
FunctionName + '&filter_'+depends+'_id='+filter_depends+'&',
'filter_'+name+'_name',
'filter_'+name+'_id', 'filter_'+name+'_container', label_attr, show_id,
requestGenerator);
]]>
}
@@ -194,7 +196,7 @@
filter_depends = false;
if (!filter_depends) {
<![CDATA[
-
JqueryPortico.autocompleteHelper('index.php?menuaction=' + app +
'.ui'+ui+'.index&',
+
JqueryPortico.autocompleteHelper('index.php?menuaction=' + app + '.ui'+ ui +
'.' + FunctionName +'&',
'filter_'+name+'_name',
'filter_'+name+'_id', 'filter_'+name+'_container', label_attr, show_id,
requestGenerator);
]]>
}
@@ -207,12 +209,12 @@
</xsl:if>
if (filter_depends) {
<![CDATA[
-
JqueryPortico.autocompleteHelper('index.php?menuaction=' + app +
'.ui'+ui+'.index&filter_'+depends+'_id='+filter_depends+'&',
+
JqueryPortico.autocompleteHelper('index.php?menuaction=' + app + '.ui'+ui+'.' +
FunctionName + '&filter_'+depends+'_id='+filter_depends+'&',
'filter_'+name+'_name', 'filter_'+name+'_id',
'filter_'+name+'_container', label_attr, show_id, requestGenerator);
]]>
}else{
<![CDATA[
-
JqueryPortico.autocompleteHelper('index.php?menuaction=' + app +
'.ui'+ui+'.index&',
+
JqueryPortico.autocompleteHelper('index.php?menuaction=' + app + '.ui'+ui+'.' +
FunctionName + '&',
'filter_'+name+'_name', 'filter_'+name+'_id',
'filter_'+name+'_container', label_attr, show_id, requestGenerator);
]]>
}
@@ -982,8 +984,16 @@
* For namespacing the state
*/
var table_url =
JqueryPortico.parseURL(window.location.href);
- var menuaction =
table_url.searchObject.menuaction.replace(/\./g, '_');
+ var menuaction = 'dummy';
+ try
+ {
+ menuaction =
table_url.searchObject.menuaction.replace(/\./g, '_');
+ }
+ catch (e)
+ {
+ }
+
//clear state
var clear_state = false;
if(typeof(table_url.searchObject.clear_state) !=
'undefined' && table_url.searchObject.clear_state == 1)
@@ -1055,13 +1065,14 @@
var retrievedObject =
localStorage.getItem('state_' + menuaction);
if(typeof(retrievedObject) !=
'undefined')
{
+ var params = {};
+
try
{
- var params =
JSON.parse(retrievedObject);
+ params =
JSON.parse(retrievedObject);
}
catch(err)
{
- params = {}
}
}
// console.log(oData);
Modified: trunk/phpgwapi/templates/bookingfrontend/head.inc.php
===================================================================
--- trunk/phpgwapi/templates/bookingfrontend/head.inc.php 2017-01-22
16:47:39 UTC (rev 16181)
+++ trunk/phpgwapi/templates/bookingfrontend/head.inc.php 2017-01-22
16:48:30 UTC (rev 16182)
@@ -10,7 +10,7 @@
$app = $GLOBALS['phpgw_info']['flags']['currentapp'];
- $config_frontend =
CreateObject('phpgwapi.config','bookingfrontend')->read();
+ $config_frontend = CreateObject('phpgwapi.config',$app)->read();
$tracker_id = !empty($config_frontend['tracker_id']) ?
$config_frontend['tracker_id'] : '';
$tracker_code1 = <<<JS
@@ -51,7 +51,7 @@
$stylesheets[] =
"/phpgwapi/templates/pure/css/grids-responsive-min.css";
$stylesheets[] =
"/phpgwapi/js/DataTables/extensions/Responsive/css/responsive.dataTables.min.css";
$stylesheets[] = "/{$app}/templates/base/css/base.css";
- $stylesheets[] = "/bookingfrontend/css/bookingfrontend.css";
+ $stylesheets[] = "/{$app}/css/bookingfrontend.css";
$stylesheets[] = "/phpgwapi/templates/bookingfrontend/css/frontend.css";
if(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['theme']))
@@ -173,7 +173,7 @@
$test = $GLOBALS['phpgw']->common->get_on_events();
$test = str_replace('window.onload =
function()','$(document).ready(function()',$test);
$test = str_replace("\n}\n","\n})\n",$test);
- $app = lang($app);
+
$tpl_vars = array
(
'css' => $GLOBALS['phpgw']->common->get_css(),
@@ -181,7 +181,7 @@
'img_icon' =>
$GLOBALS['phpgw']->common->find_image('phpgwapi', 'favicon.ico'),
'site_title' => $site_title,
'str_base_url' => $GLOBALS['phpgw']->link('/', array(), true),
- 'site_url' => $GLOBALS['phpgw']->link('/bookingfrontend/',
array()),
+ 'site_url' => $GLOBALS['phpgw']->link("/{$app}/", array()),
'webserver_url' =>
$GLOBALS['phpgw_info']['server']['webserver_url'],
'win_on_events' => $test,
'metainfo_author' => $author,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [16182] more on eventplanner,
sigurdne <=