[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [15498]
From: |
saul . huanay |
Subject: |
[Fmsystem-commits] [15498] |
Date: |
Mon, 22 Aug 2016 22:48:33 +0000 (UTC) |
Revision: 15498
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15498
Author: psaul
Date: 2016-08-22 22:48:32 +0000 (Mon, 22 Aug 2016)
Log Message:
-----------
Modified Paths:
--------------
branches/dev-syncromind-2/activitycalendar/templates/base/css/base.css
branches/dev-syncromind-2/booking/js/booking/schedule.js
branches/dev-syncromind-2/booking/templates/base/css/base.css
branches/dev-syncromind-2/bookingfrontend/css/bookingfrontend.css
branches/dev-syncromind-2/phpgwapi/js/jquery/common.js
branches/dev-syncromind-2/registration/templates/base/css/base.css
branches/dev-syncromind-2/rental/inc/class.socomposite.inc.php
branches/dev-syncromind-2/rental/js/rental/schedule.js
branches/dev-syncromind-2/rental/templates/base/css/base.css
branches/dev-syncromind-2/rental/templates/base/schedule.xsl
Modified: branches/dev-syncromind-2/activitycalendar/templates/base/css/base.css
===================================================================
--- branches/dev-syncromind-2/activitycalendar/templates/base/css/base.css
2016-08-20 01:52:55 UTC (rev 15497)
+++ branches/dev-syncromind-2/activitycalendar/templates/base/css/base.css
2016-08-22 22:48:32 UTC (rev 15498)
@@ -265,7 +265,7 @@
#week-selector li { display: inline; padding-right: .5em;}
#schedule_container tr td { border-top: 1px solid #ccc; background: white;
white-space: nowrap; }
-#schedule_container tr td:first-child { background: #eee; }
+#schedule_container tbody tr th:first-child { background: #eee; }
#schedule_container tr.time td { border-top: 1px solid #444;}
#schedule_container .color1 { background: #ccf;}
#schedule_container .color2 { background: #cfc;}
Modified: branches/dev-syncromind-2/booking/js/booking/schedule.js
===================================================================
--- branches/dev-syncromind-2/booking/js/booking/schedule.js 2016-08-20
01:52:55 UTC (rev 15497)
+++ branches/dev-syncromind-2/booking/js/booking/schedule.js 2016-08-22
22:48:32 UTC (rev 15498)
@@ -45,7 +45,7 @@
}
var colDefs = [
- {key: 'time', label: date.getFullYear() + '<br/>' +
lang['LBL_TIME']}];
+ {key: 'time', label: date.getFullYear() + '<br/>' +
lang['LBL_TIME'], type: 'th'}];
if (includeResource)
{
colDefs.push({key: 'resource', label: lang['LBL_RESOURCE'],
formatter: 'scheduleResourceColumn'});
Modified: branches/dev-syncromind-2/booking/templates/base/css/base.css
===================================================================
--- branches/dev-syncromind-2/booking/templates/base/css/base.css
2016-08-20 01:52:55 UTC (rev 15497)
+++ branches/dev-syncromind-2/booking/templates/base/css/base.css
2016-08-22 22:48:32 UTC (rev 15498)
@@ -180,7 +180,7 @@
#week-selector li { display: inline; padding-right: .5em;}
#schedule_container tr td { border-top: 1px solid #ccc; background: white;
white-space: nowrap; }
-#schedule_container tr td:first-child { background: #eee; }
+#schedule_container tbody tr th:first-child { background: #eee; }
#schedule_container tr.time td { border-top: 1px solid #444;}
#schedule_container .color1 { background-color: #ccccff;}
#schedule_container .color2 { background-color: #ccffcc;}
Modified: branches/dev-syncromind-2/bookingfrontend/css/bookingfrontend.css
===================================================================
--- branches/dev-syncromind-2/bookingfrontend/css/bookingfrontend.css
2016-08-20 01:52:55 UTC (rev 15497)
+++ branches/dev-syncromind-2/bookingfrontend/css/bookingfrontend.css
2016-08-22 22:48:32 UTC (rev 15498)
@@ -407,7 +407,7 @@
border-top: 1px solid #ccc;
white-space: nowrap;
}
-#schedule_container tr td:first-child {
+#schedule_container tbody tr th:first-child {
background: #eee none repeat scroll 0 0;
}
#schedule_container tr.time td {
Modified: branches/dev-syncromind-2/phpgwapi/js/jquery/common.js
===================================================================
--- branches/dev-syncromind-2/phpgwapi/js/jquery/common.js 2016-08-20
01:52:55 UTC (rev 15497)
+++ branches/dev-syncromind-2/phpgwapi/js/jquery/common.js 2016-08-22
22:48:32 UTC (rev 15498)
@@ -1296,9 +1296,9 @@
});
tableHead.appendChild(tableHeadTr);
xtable.appendChild(tableHead);
-
- var key = c[0].key;
+ var key = c[0].key;
+
var tableBody = document.createElement('tbody');
var tableBodyTr = document.createElement('tr');
var tableBodyTrTd = document.createElement('td');
@@ -1350,9 +1350,10 @@
$.each(c, function (ic, vc)
{
var k = vc.key;
- var colorCell = "";
- var tableBodyTrTdType = (k == key) ?
"th" : "td";
+// var tableBodyTrTdType = (k == key) ?
"th" : "td";
+ var tableBodyTrTdType = (vc['type']) ? (vc['type'] ==
"th") ? "th" : "td" : "td";
+
var tableBodyTrTd =
document.createElement(tableBodyTrTdType);
var classes = "";
@@ -1360,97 +1361,40 @@
if (vc['formatter'])
{
- if (vc['formatter'] ==
"scheduleResourceColumn")
- {
- if (vd[k])
- {
-
tableBodyTr.setAttribute('resource', vd['resource_id']);
- }
- var resourceLink =
(date) ? vd['resource_link'] + "#date=" + date : vd['resource_link'];
- tableBodyTrTdText =
(vd[k]) ? formatGenericLink(vd['resource'], resourceLink) : "";
- }
- else
- {
- if (vd[k])
- {
- var id =
vd[k]['id'];
- var name =
(vd[k]['shortname']) ? formatScheduleShorten(vd[k]['shortname'], 9) :
formatScheduleShorten(vd[k]['name'], 9);
- var type =
vd[k]['type'];
- if
(vc['formatter'] == "seasonDateColumn")
- {
-
tableBodyTrTdText = name;
-
tableBodyTrTd.addEventListener('click', function ()
- {
-
schedule.newAllocationForm({'id': vd[k]['id']})
- });
- }
- if
(vc['formatter'] == "scheduleDateColumn")
- {
-
tableBodyTrTdText = formatGenericLink(name, null);
- }
- if
(vc['formatter'] == "backendScheduleDateColumn")
- {
- var
conflicts = new Array();
- if
(vd[k]['conflicts'])
- {
-
if (vd[k]['conflicts'].length > 0)
-
{
-
conflicts = vd[k]['conflicts'];
-
}
- }
-
tableBodyTrTdText = formatBackendScheduleDateColumn(id, name, type, conflicts);
- classes
+= " " + type;
- }
- if
(vc['formatter'] == "frontendScheduleDateColumn")
- {
- if
(vd[k]['is_public'] == 0)
- {
-
name = formatScheduleShorten('Privat arr.', 9);
- }
-
tableBodyTrTdText = name;
- classes
+= " cellInfo";
- classes
+= " " + type;
-
tableBodyTrTd.addEventListener('click', function ()
- {
-
schedule.showInfo(vd[k]['info_url'], tableBodyTr.getAttribute('resource'))
- },
false);
- }
- colorCell =
formatScheduleCellDateColumn(name, type);
- classes += " "
+ colorCell;
-
tableBodyTrTd.setAttribute('class', classes);
- }
- else
- {
-
tableBodyTrTdText = "free";
- classes += "
free";
-
tableBodyTrTd.setAttribute('class', classes);
- if
(vc['formatter'] == "frontendScheduleDateColumn")
- {
-
tableBodyTrTd.addEventListener('click', function ()
- {
-
schedule.newApplicationForm(vc['date'], vd['_from'], vd['_to'],
tableBodyTr.getAttribute('resource'))
- });
- }
- if
(vc['formatter'] == "backendScheduleDateColumn")
- {
-
tableBodyTrTd.addEventListener('click', function ()
- {
-
schedule.newApplicationForm(vc['date'], vd['_from'], vd['_to'])
- });
- }
- if
(vc['formatter'] == "seasonDateColumn")
- {
-
tableBodyTrTd.addEventListener('click', function ()
- {
-
schedule.newAllocationForm({'_from': vd['_from'], '_to': vd['_to'], 'wday':
vc['key']})
- });
- }
- }
- }
+ //var dataFormat = {};
+ var dataFormat = setFormatter(vc['formatter'], vd, vc,
date)
+
+ if (dataFormat['text'])
+ {
+ tableBodyTrTdText = dataFormat['text'];
+ }
+
+ if (dataFormat['classes'])
+ {
+ classes += " " + dataFormat['classes'];
+ }
+
+ if (dataFormat['trAttributes'])
+ {
+ $.each(dataFormat['trAttributes'], function (i, v)
+ {
+ tableBodyTr.setAttribute(v['attribute'],
v['value']);
+ });
+ }
+
+ if (dataFormat['trFunction'])
+ {
+ $.each(dataFormat['trFunction'], function (i, v)
+ {
+ tableBodyTrTd.addEventListener(v['event'],
v['callFunction'], false);
+ });
+ }
+
+ tableBodyTrTd.setAttribute('class', classes);
}
else
{
- tableBodyTrTdText = (vd[k]) ?
vd[k] : "";
+ tableBodyTrTdText = (vd[k]) ?
(vc['value']) ? vd[k][vc['value']] : (vd[k]) : "";
}
if (k == key)
{
@@ -1475,6 +1419,259 @@
});
}
+function setFormatter (callFunc, data, col, date)
+{
+ return eval(callFunc+'(data,col,date)');
+}
+
+function scheduleResourceColumn (data, col, date)
+{
+ var text = "";
+ var classes = "";
+ var trAttributes = [];
+ var trFunction = [];
+
+ var k = col.key;
+
+ if (data[k])
+ {
+ trAttributes.push( {attribute: 'resource', value: data['resource_id']}
);
+ }
+
+ var resourceLink = (date) ? data['resource_link'] + "#date=" + date :
data['resource_link'];
+ text = (data[k]) ? formatGenericLink(data['resource'], resourceLink) : "";
+
+ var data_return = {
+ text: text,
+ classes: classes,
+ trAttributes: trAttributes,
+ trFunction: trFunction
+ }
+
+ return data_return;
+}
+
+function seasonDateColumn (data, col, date)
+{
+ var text = "";
+ var classes = "";
+ var trAttributes = [];
+ var trFunction = [];
+
+ var k = col.key;
+
+ if (data[k])
+ {
+ var id = data[k]['id'];
+ var name = (data[k]['shortname']) ?
formatScheduleShorten(data[k]['shortname'], 9) :
formatScheduleShorten(data[k]['name'], 9);
+ var type = data[k]['type'];
+ var colorCell = formatScheduleCellDateColumn(name, type);
+
+ text = name;
+ classes = colorCell;
+ trFunction.push(
+ {
+ event: 'click',
+ callFunction: function () {
+// schedule.newAllocationForm({id: data[k]['id']});
+ schedule.newAllocationForm({id: id});
+ }
+
+ }
+ );
+ }
+ else
+ {
+ text = "free";
+ classes = "free";
+ trFunction.push(
+ {
+ event: 'click',
+ callFunction: function () {
+ schedule.newAllocationForm({'_from': data['_from'], '_to':
data['_to'], 'wday': col['key']});
+ }
+
+ }
+ );
+ }
+
+ var data_return = {
+ text: text,
+ classes: classes,
+ trAttributes: trAttributes,
+ trFunction: trFunction
+ }
+
+ return data_return;
+}
+
+function scheduleDateColumn (data, col, date)
+{
+ var text = "";
+ var classes = "";
+ var trAttributes = [];
+ var trFunction = [];
+
+ var k = col.key;
+
+ if (data[k])
+ {
+ var name = (data[k]['shortname']) ?
formatScheduleShorten(data[k]['shortname'], 9) :
formatScheduleShorten(data[k]['name'], 9);
+ var type = data[k]['type'];
+ var colorCell = formatScheduleCellDateColumn(name, type);
+
+ text = formatGenericLink(name, null);
+ classes = colorCell;
+ }
+
+ var data_return = {
+ text: text,
+ classes: classes,
+ trAttributes: trAttributes,
+ trFunction: trFunction
+ }
+
+ return data_return;
+}
+
+function backendScheduleDateColumn (data, col, date)
+{
+ var text = "";
+ var classes = "";
+ var trAttributes = [];
+ var trFunction = [];
+
+ var k = col.key;
+
+ if (data[k])
+ {
+ var id = data[k]['id'];
+ var name = (data[k]['shortname']) ?
formatScheduleShorten(data[k]['shortname'], 9) :
formatScheduleShorten(data[k]['name'], 9);
+ var type = data[k]['type'];
+ var colorCell = formatScheduleCellDateColumn(name, type);
+
+ var conflicts = new Array();
+
+ if (data[k]['conflicts'])
+ {
+ if (data[k]['conflicts'].length > 0)
+ {
+ conflicts = data[k]['conflicts'];
+ }
+ }
+ text = formatBackendScheduleDateColumn(id, name, type, conflicts);
+ classes = colorCell + " " + type;
+ }
+ else
+ {
+ text = "free";
+ classes = "free";
+ trFunction.push(
+ {
+ event: 'click',
+ callFunction: function () {
+ schedule.newApplicationForm(col['date'], data['_from'],
data['_to'])
+ }
+ }
+ )
+ }
+
+ var data_return = {
+ text: text,
+ classes: classes,
+ trAttributes: trAttributes,
+ trFunction: trFunction
+ }
+
+ return data_return;
+}
+
+function frontendScheduleDateColumn (data, col, date)
+{
+ var text = "";
+ var classes = "";
+ var trAttributes = [];
+ var trFunction = [];
+
+ var k = col.key;
+
+ if (data[k])
+ {
+ var name = (data[k]['shortname']) ?
formatScheduleShorten(data[k]['shortname'], 9) :
formatScheduleShorten(data[k]['name'], 9);
+ var type = data[k]['type'];
+ var colorCell = formatScheduleCellDateColumn(name, type);
+
+ if (data[k]['is_public'] == 0)
+ {
+ name = formatScheduleShorten('Privat arr.', 9);
+ }
+ text = name;
+ classes = "cellInfo " + colorCell + " " + type ;
+ trFunction.push(
+ {
+ event: 'click',
+ callFunction: function () {
+ var resource = $(this).parent().attr('resource');
+ schedule.showInfo(data[k]['info_url'], resource);
+ }
+ }
+ );
+ }
+ else
+ {
+ text = "free";
+ classes = "free";
+ trFunction.push(
+ {
+ event: 'click',
+ callFunction: function () {
+ var resource = $(this).parent().attr('resource');
+ schedule.newApplicationForm(col['date'], data['_from'],
data['_to'], resource);
+ }
+ }
+ );
+ }
+
+ var data_return = {
+ text: text,
+ classes: classes,
+ trAttributes: trAttributes,
+ trFunction: trFunction
+ }
+
+ return data_return;
+}
+
+function rentalSchedule (data, col, date)
+{
+ var text = "";
+ var classes = "";
+ var trAttributes = [];
+ var trFunction = [];
+
+ var k = col.key;
+
+ if (data[k])
+ {
+ var contratctLink = (data['contract_link']) ? data['contract_link'] :
null;
+ text = (data[k]['old_contract_id'] ?
formatGenericLink(data[k]['old_contract_id'], contratctLink) : "");
+ }
+ else
+ {
+ text = "free";
+ classes = "free";
+ }
+
+ var data_return = {
+ text: text,
+ classes: classes,
+ trAttributes: trAttributes,
+ trFunction: trFunction
+ }
+
+ return data_return;
+}
+
function restartColors()
{
colors = [
Modified: branches/dev-syncromind-2/registration/templates/base/css/base.css
===================================================================
--- branches/dev-syncromind-2/registration/templates/base/css/base.css
2016-08-20 01:52:55 UTC (rev 15497)
+++ branches/dev-syncromind-2/registration/templates/base/css/base.css
2016-08-22 22:48:32 UTC (rev 15498)
@@ -264,7 +264,7 @@
#week-selector li { display: inline; padding-right: .5em;}
#schedule_container tr td { border-top: 1px solid #ccc; background: white;
white-space: nowrap; }
-#schedule_container tr td:first-child { background: #eee; }
+#schedule_container tbody tr th:first-child { background: #eee; }
#schedule_container tr.time td { border-top: 1px solid #444;}
#schedule_container .color1 { background: #ccf;}
#schedule_container .color2 { background: #cfc;}
Modified: branches/dev-syncromind-2/rental/inc/class.socomposite.inc.php
===================================================================
--- branches/dev-syncromind-2/rental/inc/class.socomposite.inc.php
2016-08-20 01:52:55 UTC (rev 15497)
+++ branches/dev-syncromind-2/rental/inc/class.socomposite.inc.php
2016-08-22 22:48:32 UTC (rev 15498)
@@ -518,24 +518,26 @@
return $uicols;
}
- public function get_schedule ($composite_id, $date) {
+ public function get_schedule ($composite_id, $date)
+ {
//$date = new DateTime('2016-8-24');
//$date = new DateTime(phpgw::get_var('date'));
//$composite_id = (int)phpgw::get_var('id');
-
- if ($date->format('w') != 1) {
+
+ if ($date->format('w') != 1)
+ {
$date->modify('last monday');
}
-
+
$prev_date = clone $date;
$prev_date->modify('-1 week');
$next_date = clone $date;
$next_date->modify('+1 week');
-
+
$composite1['date'] = $date->format('Y-m-d');
$composite1['prev_date'] = $prev_date->format('Y-m-d');
$composite1['next_date'] = $next_date->format('Y-m-d');
-
+
$days = array();
$date_to_array = clone $date;
for ($i = 0; $i < 7; $i++)
@@ -544,7 +546,7 @@
$date_to_array->modify("+1 day");
}
/*----------------------------------------------------------------*/
-
+
$filters = array(
rental_socomposite::get_id_field_name() => $composite_id,
'availability_date_from' => '2010-1-1',
@@ -554,7 +556,7 @@
$composite = null;
$composite_obj = rental_socomposite::get_instance()->get(0, 0, '',
false, '', '', $filters);
-
+
if (count($composite_obj) > 0)
{
$keys = array_keys($composite_obj);
@@ -562,29 +564,18 @@
}
$contracts = $composite->get_contracts();
-
+
$data_contracts = array();
- //foreach ($contracts as $contract) {
- //$contract = $contract->serialize();
- //$contract_date = new DateTime($contract['date_start']);
- //$contract_date = date("d-m-Y",
strtotime($contract['date_start']));
- //$contract_date =
date_format(date_create_from_format('d/m/Y', $contract['date_start']), 'Y-m-d');
- //$data_contracts[date_format($date, 'D')] = $contract_date;
- //}
- //var_dump($contracts);exit();
foreach ($contracts as $contract)
{
$contract = $contract->serialize();
-
- //$contract_date_start = new
DateTime(date_format(date_create_from_format('d/m/Y', $contract['date_start']),
'Y-m-d'));
- //$contract_date_end = new
DateTime(date_format(date_create_from_format('d/m/Y', $contract['date_end']),
'Y-m-d'));
-
+
$contract_date_start = new DateTime(date('Y-m-d',
phpgwapi_datetime::date_to_timestamp($contract['date_start'])));
$contract_date_end = new DateTime(date('Y-m-d',
phpgwapi_datetime::date_to_timestamp($contract['date_end'])));
-
+
$data_contract = array();
-
+
foreach ($days as $day)
{
if ($day >= $contract_date_start && $day <=
$contract_date_end)
@@ -592,20 +583,28 @@
$data_contract[date_format($day, 'D')] = $contract;
}
}
- if ($data_contract) {
+
+ $link = $GLOBALS['phpgw']->link('/index.php', array(
+ 'menuaction' => 'rental.uicontract.view',
+ 'id' => $contract['id']
+ ));
+
+ $data_contract['contract_link'] = $link;
+
+ if ($data_contract)
+ {
$data_contracts[] = $data_contract;
}
-
}
if (!(count($data_contracts) > 0))
{
$data_contracts[] = '';
}
-
+
return array(
'total_records' => count($data_contracts),
'results' => $data_contracts
- );
+ );
}
}
\ No newline at end of file
Modified: branches/dev-syncromind-2/rental/js/rental/schedule.js
===================================================================
--- branches/dev-syncromind-2/rental/js/rental/schedule.js 2016-08-20
01:52:55 UTC (rev 15497)
+++ branches/dev-syncromind-2/rental/js/rental/schedule.js 2016-08-22
22:48:32 UTC (rev 15498)
@@ -50,7 +50,7 @@
}
var colDefs = [
- {key: '', label: ''}
+// {key: '', label: ''}
]
var keys = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
Modified: branches/dev-syncromind-2/rental/templates/base/css/base.css
===================================================================
--- branches/dev-syncromind-2/rental/templates/base/css/base.css
2016-08-20 01:52:55 UTC (rev 15497)
+++ branches/dev-syncromind-2/rental/templates/base/css/base.css
2016-08-22 22:48:32 UTC (rev 15498)
@@ -294,7 +294,7 @@
#week-selector li { display: inline; padding-right: .5em;}
#schedule_container tr td { border-top: 1px solid #ccc; background: white;
white-space: nowrap; }
-#schedule_container tr td:first-child { background: #eee; }
+#schedule_container tbody tr th:first-child { background: #eee; }
#schedule_container tr.time td { border-top: 1px solid #444;}
#schedule_container .color1 { background: #ccf;}
#schedule_container .color2 { background: #cfc;}
Modified: branches/dev-syncromind-2/rental/templates/base/schedule.xsl
===================================================================
--- branches/dev-syncromind-2/rental/templates/base/schedule.xsl
2016-08-20 01:52:55 UTC (rev 15497)
+++ branches/dev-syncromind-2/rental/templates/base/schedule.xsl
2016-08-22 22:48:32 UTC (rev 15498)
@@ -51,7 +51,7 @@
var initialRequest = getUrlData("date") || '<xsl:value-of
select="date"/>';
schedule.includeResource = false;
- schedule.colFormatter = '';
+ schedule.colFormatter = 'rentalSchedule';
var handleHistoryNavigation = function (state) {
schedule.date = parseISO8601(state);
schedule.renderSchedule('schedule_container',
schedule.datasourceUrl, schedule.date, schedule.colFormatter,
schedule.includeResource);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [15498],
saul . huanay <=