[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [16974] rental: more on application
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [16974] rental: more on application |
Date: |
Sun, 13 Aug 2017 11:04:16 -0400 (EDT) |
Revision: 16974
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16974
Author: sigurdne
Date: 2017-08-13 11:04:15 -0400 (Sun, 13 Aug 2017)
Log Message:
-----------
rental: more on application
Modified Paths:
--------------
trunk/phpgwapi/inc/class.bocommon.inc.php
trunk/rental/inc/class.boapplication.inc.php
trunk/rental/inc/class.uiapplication.inc.php
trunk/rental/inc/model/class.application.inc.php
trunk/rental/js/rental/application.edit.js
trunk/rental/setup/phpgw_no.lang
trunk/rental/templates/base/application.xsl
Modified: trunk/phpgwapi/inc/class.bocommon.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.bocommon.inc.php 2017-08-12 18:02:49 UTC (rev
16973)
+++ trunk/phpgwapi/inc/class.bocommon.inc.php 2017-08-13 15:04:15 UTC (rev
16974)
@@ -125,8 +125,9 @@
*/
public function store_pre_commit( &$object )
{
+ $appname =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$criteria = array(
- 'appname' => 'eventplanner',
+ 'appname' => $appname,
'location' => $this->acl_location,
'pre_commit' => true,
'allrows' => true
@@ -142,7 +143,7 @@
continue;
}
- $file = PHPGW_SERVER_ROOT .
"/eventplanner/inc/custom/{$GLOBALS['phpgw_info']['user']['domain']}/{$entry['file_name']}";
+ $file = PHPGW_SERVER_ROOT .
"/{$appname}/inc/custom/{$GLOBALS['phpgw_info']['user']['domain']}/{$entry['file_name']}";
if ($entry['active'] && is_file($file) &&
!$entry['client_side'] && $entry['pre_commit'])
{
require $file;
@@ -156,8 +157,9 @@
*/
public function store_post_commit( &$object )
{
+ $appname =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$criteria = array(
- 'appname' => 'eventplanner',
+ 'appname' => $appname,
'location' => $this->acl_location,
'allrows' => true
);
@@ -173,7 +175,7 @@
continue;
}
- $file = PHPGW_SERVER_ROOT .
"/eventplanner/inc/custom/{$GLOBALS['phpgw_info']['user']['domain']}/{$entry['file_name']}";
+ $file = PHPGW_SERVER_ROOT .
"/{$appname}/inc/custom/{$GLOBALS['phpgw_info']['user']['domain']}/{$entry['file_name']}";
if ($entry['active'] && is_file($file) &&
!$entry['client_side'] && !$entry['pre_commit'])
{
require $file;
Modified: trunk/rental/inc/class.boapplication.inc.php
===================================================================
--- trunk/rental/inc/class.boapplication.inc.php 2017-08-12 18:02:49 UTC
(rev 16973)
+++ trunk/rental/inc/class.boapplication.inc.php 2017-08-13 15:04:15 UTC
(rev 16974)
@@ -26,21 +26,21 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+ phpgw::import_class('phpgwapi.bocommon');
phpgw::import_class('rental.soapplication');
include_class('rental', 'application', 'inc/model/');
- class rental_boapplication
+ class rental_boapplication extends phpgwapi_bocommon
{
protected static
$bo,
$fields;
- public $acl_location = '.application';
-
public function __construct()
{
$this->fields = rental_application::get_fields();
+ $this->acl_location = rental_application::acl_location;
}
/**
@@ -59,47 +59,9 @@
public function store($object)
{
- $criteria = array(
- 'appname' => 'rental',
- 'location' => $this->bo->acl_location,
- 'allrows' => true
- );
-
- $custom_functions =
$GLOBALS['phpgw']->custom_functions->find($criteria);
-
- foreach ($custom_functions as $entry)
- {
- // prevent path traversal
- if (preg_match('/\.\./', $entry['file_name']))
- {
- continue;
- }
-
- $file = PHPGW_SERVER_ROOT .
"/rental/inc/custom/{$GLOBALS['phpgw_info']['user']['domain']}/{$entry['file_name']}";
- if ($entry['active'] && is_file($file) &&
!$entry['client_side'])
- {
- require $file;
- }
- }
-
+ $this->store_pre_commit($object);
$ret =
rental_soapplication::get_instance()->store($object);
-
- reset($custom_functions);
-
- foreach ($custom_functions as $entry)
- {
- // prevent path traversal
- if (preg_match('/\.\./', $entry['file_name']))
- {
- continue;
- }
-
- $file = PHPGW_SERVER_ROOT .
"/rental/inc/custom/{$GLOBALS['phpgw_info']['user']['domain']}/{$entry['file_name']}";
- if ($entry['active'] && is_file($file) &&
!$entry['client_side'] && !$entry['pre_commit'])
- {
- require $file;
- }
- }
+ $this->store_post_commit($object);
return $ret;
}
@@ -124,29 +86,7 @@
public function build_default_read_params()
{
- $fields = $this->fields;
-
- $search = phpgw::get_var('search');
- $order = phpgw::get_var('order');
- $draw = phpgw::get_var('draw', 'int');
- $columns = phpgw::get_var('columns');
-
- $params = array(
- 'start' => phpgw::get_var('start', 'int',
'REQUEST', 0),
- 'results' => phpgw::get_var('length', 'int',
'REQUEST', 0),
- 'query' => $search['value'],
- 'sort' => $columns[$order[0]['column']]['data'],
- 'dir' => $order[0]['dir'],
- 'allrows' => phpgw::get_var('length', 'int') ==
-1,
- );
-
- foreach ($fields as $field => $_params)
- {
- if (!empty($_REQUEST["filter_$field"]))
- {
- $params['filters'][$field] =
phpgw::get_var("filter_$field", $_params['type']);
- }
- }
+ $params = parent::build_default_read_params();
if (phpgw::get_var('composite_id'))
{
$params['filters']['composite_id'] =
phpgw::get_var('composite_id');
Modified: trunk/rental/inc/class.uiapplication.inc.php
===================================================================
--- trunk/rental/inc/class.uiapplication.inc.php 2017-08-12 18:02:49 UTC
(rev 16973)
+++ trunk/rental/inc/class.uiapplication.inc.php 2017-08-13 15:04:15 UTC
(rev 16974)
@@ -49,25 +49,21 @@
protected
$fields,
$composite_types,
- $payment_methods;
+ $payment_methods,
+ $acl_location;
private $bo;
public function __construct()
{
parent::__construct();
- self::set_active_menu('rental::application');
$GLOBALS['phpgw_info']['flags']['app_header'] .= '::' .
lang('application');
$this->bo = createObject('rental.boapplication');
- $this->acl = & $GLOBALS['phpgw']->acl;
- $this->acl_location = $this->bo->acl_location;
- $this->acl_read =
$this->acl->check($this->acl_location, PHPGW_ACL_READ, 'rental');
- $this->acl_add = $this->acl->check($this->acl_location,
PHPGW_ACL_ADD, 'rental');
- $this->acl_edit =
$this->acl->check($this->acl_location, PHPGW_ACL_EDIT, 'rental');
- $this->acl_delete =
$this->acl->check($this->acl_location, PHPGW_ACL_DELETE, 'rental');
- $this->acl_manage =
$this->acl->check($this->acl_location, PHPGW_ACL_PRIVATE, 'rental'); // manage
+ $this->permissions =
rental_application::get_instance()->get_permission_array();
$this->composite_types =
rental_application::get_composite_types();
$this->payment_methods =
rental_application::get_payment_methods();
$this->fields = rental_application::get_fields();
+ $this->acl_location = rental_application::acl_location;
+ self::set_active_menu('rental::application');
}
private function get_composite_type_options( $selected = 0 )
@@ -254,7 +250,7 @@
{
$active_tab = !empty($values['active_tab']) ?
$values['active_tab'] : phpgw::get_var('active_tab', 'string', 'REQUEST',
'application');
$GLOBALS['phpgw_info']['flags']['app_header'] .= '::' .
lang('edit');
- if (!$this->acl_add)
+ if (empty($this->permissions[PHPGW_ACL_ADD]))
{
phpgw::no_access();
}
@@ -269,7 +265,7 @@
$application =
$this->bo->read_single($application_id);
}
- if (!$this->acl_edit)
+ if (empty($this->permissions[PHPGW_ACL_EDIT]))
{
$step = 1;
}
@@ -610,7 +606,7 @@
public function add()
{
- if (!$this->acl_add)
+ if (empty($this->permissions[PHPGW_ACL_ADD]))
{
phpgw::no_access();
}
@@ -620,7 +616,7 @@
public function save()
{
- if (!$this->acl_add)
+ if (empty($this->permissions[PHPGW_ACL_ADD]))
{
phpgw::no_access();
}
Modified: trunk/rental/inc/model/class.application.inc.php
===================================================================
--- trunk/rental/inc/model/class.application.inc.php 2017-08-12 18:02:49 UTC
(rev 16973)
+++ trunk/rental/inc/model/class.application.inc.php 2017-08-13 15:04:15 UTC
(rev 16974)
@@ -29,9 +29,9 @@
phpgw::import_class('rental.boapplication');
- include_class('rental', 'model', 'inc/model/');
+ include_class('phpgwapi', 'model', 'inc/model/');
- class rental_application extends rental_model
+ class rental_application extends phpgwapi_model
{
const STATUS_REGISTERED = 1;
@@ -38,6 +38,7 @@
const STATUS_PENDING = 2;
const STATUS_REJECTED = 3;
const STATUS_APPROVED = 4;
+ const acl_location = '.application';
protected
$id,
@@ -80,6 +81,16 @@
parent::__construct((int)$id);
}
+ /**
+ * Implementing classes must return an instance of itself.
+ *
+ * @return the class instance.
+ */
+ public static function get_instance()
+ {
+ return new rental_application();
+ }
+
public static function get_composite_types()
{
return array(1 => 'Hybel', 2 => 'Leilighet');
Modified: trunk/rental/js/rental/application.edit.js
===================================================================
--- trunk/rental/js/rental/application.edit.js 2017-08-12 18:02:49 UTC (rev
16973)
+++ trunk/rental/js/rental/application.edit.js 2017-08-13 15:04:15 UTC (rev
16974)
@@ -3,7 +3,7 @@
var strURL = phpGWLink('index.php', oArgs, true);
JqueryPortico.autocompleteHelper(strURL, 'ecodimb_name', 'ecodimb_id',
'ecodimb_container', 'descr');
-composites = new Array();
+var composites = new Array();
$(document).ready(function ()
{
@@ -25,6 +25,44 @@
errorMessage: lang['Name or company is required'],
errorMessageKey: ''
});
+
+
+ validate_submit = function ()
+ {
+ var active_tab = $("#active_tab").val();
+ conf = {
+ // modules: 'date, security, file',
+ validateOnBlur: false,
+ scrollToTopOnError: true,
+ errorMessagePosition: 'top'
+ // language: validateLanguage
+ };
+
+ var test = $('form').isValid(false, conf);
+ if (!test)
+ {
+ return;
+ }
+ var id = $("#application_id").val();
+
+ if (id > 0)
+ {
+ document.form.submit();
+ return;
+ }
+
+ if (active_tab === 'application')
+ {
+ $('#tab-content').responsiveTabs('activate', 1);
+ $("#save_button_bottom").val(lang['save']);
+ $("#active_tab").val('party');
+ }
+ else
+ {
+ document.form.submit();
+ }
+ };
+
});
function set_tab(tab)
@@ -42,7 +80,7 @@
var composite_id = schedule.rental['data']['id'];
var params = {application_id: application_id, composite_id:
composite_id};
-
+
$.post(url, params, function(m)
{
button.disabled = false;
@@ -56,7 +94,7 @@
{
button.disabled = true;
data = JSON.parse(data);
-
+
var url = data['url'];
var application_id = $('#application_id').val();
var composite_id = composites.rental['data']['id'];
@@ -84,7 +122,7 @@
var r = "";
createTableSchedule(container, composites.datasourceUrl, columns, r,
classTable, '', false, "composites.createToolbar");
-}
+};
composites.createToolbar = function ()
{
@@ -93,7 +131,7 @@
container.setAttribute('id', 'composites_toolbar');
container.classList.add('schedule_toolbar');
var id = "$('.rentalCompositesTable .trselected').data('id')";
-
+
$.each(toolbar, function(i, v)
{
var name = v['name'];
@@ -184,13 +222,13 @@
else if (callFunction)
{
button.addEventListener('click', function(event){
- event.preventDefault()
+ event.preventDefault();
self[callFunction['name']](callFunction['args'], this);
});
}
container.appendChild(button);
- })
+ });
return container;
-}
\ No newline at end of file
+};
Modified: trunk/rental/setup/phpgw_no.lang
===================================================================
--- trunk/rental/setup/phpgw_no.lang 2017-08-12 18:02:49 UTC (rev 16973)
+++ trunk/rental/setup/phpgw_no.lang 2017-08-13 15:04:15 UTC (rev 16974)
@@ -55,6 +55,7 @@
available_at rental no Ledig på dato
available_composites rental no Ledige leieobjekt
available_composites rental no Tilgjengelige leieobjekter
+composites rental no Leieobjekt
available_from rental no Tilgjengelig fra
available_parties rental no Tilgjengelige kontraktsparter
available_price_items rental no Tilgjengelige priselementer
Modified: trunk/rental/templates/base/application.xsl
===================================================================
--- trunk/rental/templates/base/application.xsl 2017-08-12 18:02:49 UTC (rev
16973)
+++ trunk/rental/templates/base/application.xsl 2017-08-13 15:04:15 UTC (rev
16974)
@@ -28,7 +28,7 @@
</xsl:variable>
<script type="text/javascript">
- var lang = <xsl:value-of
select="php:function('js_lang', 'Name or company is required')"/>;
+ var lang = <xsl:value-of
select="php:function('js_lang', 'Name or company is required', 'next',
'save')"/>;
</script>
<form id="form" name="form" method="post"
action="{$form_action}" class="pure-form pure-form-aligned">
<div id="tab-content">
@@ -538,13 +538,18 @@
</fieldset>
</div>
</xsl:if>
-
</div>
- <div class="proplist-col">
- <input type="submit" class="pure-button
pure-button-primary" name="save">
+ <div id="submit_group_bottom" class="proplist-col">
+ <xsl:variable name="lang_save">
+ <xsl:value-of
select="php:function('lang', 'next')"/>
+ </xsl:variable>
+ <input type="button" class="pure-button
pure-button-primary" name="save" id="save_button_bottom"
onClick="validate_submit();">
<xsl:attribute name="value">
- <xsl:value-of
select="php:function('lang', 'save')"/>
+ <xsl:value-of
select="$lang_save"/>
</xsl:attribute>
+ <xsl:attribute name="title">
+ <xsl:value-of
select="$lang_save"/>
+ </xsl:attribute>
</input>
<xsl:variable name="cancel_url">
<xsl:value-of select="cancel_url"/>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [16974] rental: more on application,
sigurdne <=