Fixes #39 to ensure components are build even if created and modified dates are not set. Improved #37 #issuecomment-278372267 to avoid one line error in windows.

This commit is contained in:
Llewellyn van der Merwe 2017-02-09 18:11:10 +02:00
parent 3497de7c28
commit 5b5599575b
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
253 changed files with 20214 additions and 16025 deletions

View File

@ -1,4 +1,4 @@
# Component Builder (2.3.0)
# Component Builder (2.3.1)
This is a [Joomla 3.x](http://www.joomla.org/) component.
@ -8,7 +8,7 @@ The Component Builder for [Joomla](http://www.joomla.org/) that is highly advanc
Whether you're a seasoned [Joomla](http://www.joomla.org/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.3.0) with **ALL** its features and **ALL** concepts totally open-source and free!
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.3.1) with **ALL** its features and **ALL** concepts totally open-source and free!
Once installed upgrades are quick and easy via the default Joomla upgrade area.
@ -104,12 +104,12 @@ Component Builder is mapped as a component in itself on my local development env
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](http://vdm.bz/component-builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 4th February, 2017
+ *Version*: 2.3.0
+ *Last Build*: 9th February, 2017
+ *Version*: 2.3.1
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+ *Line count*: **91058**
+ *File count*: **589**
+ *Line count*: **91404**
+ *File count*: **591**
+ *Folder count*: **105**
> This **component** was build with a Joomla [Automated Component Builder](http://vdm.bz/component-builder).

View File

@ -1,4 +1,4 @@
# Component Builder (2.3.0)
# Component Builder (2.3.1)
This is a [Joomla 3.x](http://www.joomla.org/) component.
@ -8,7 +8,7 @@ The Component Builder for [Joomla](http://www.joomla.org/) that is highly advanc
Whether you're a seasoned [Joomla](http://www.joomla.org/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.3.0) with **ALL** its features and **ALL** concepts totally open-source and free!
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.3.1) with **ALL** its features and **ALL** concepts totally open-source and free!
Once installed upgrades are quick and easy via the default Joomla upgrade area.
@ -104,12 +104,12 @@ Component Builder is mapped as a component in itself on my local development env
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](http://vdm.bz/component-builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 4th February, 2017
+ *Version*: 2.3.0
+ *Last Build*: 9th February, 2017
+ *Version*: 2.3.1
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+ *Line count*: **91058**
+ *File count*: **589**
+ *Line count*: **91404**
+ *File count*: **591**
+ *Folder count*: **105**
> This **component** was build with a Joomla [Automated Component Builder](http://vdm.bz/component-builder).

View File

@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage admin.css

View File

@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 14 of this MVC
@build 31st January, 2017
@version @update number 28 of this MVC
@build 9th February, 2017
@created 11th October, 2016
@package Component Builder
@subpackage custom_code.css

View File

@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 14 of this MVC
@build 31st January, 2017
@version @update number 28 of this MVC
@build 9th February, 2017
@created 11th October, 2016
@package Component Builder
@subpackage custom_codes.css

View File

@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage dashboard.css

View File

@ -67,7 +67,7 @@ class ###Component###Model###View### extends JModelAdmin
public function getTable($type = '###view###', $prefix = '###Component###Table', $config = array())
{
return JTable::getInstance($type, $prefix, $config);
}
}###ADMIN_CUSTOM_BUTTONS_METHOD###
/**
* Method to get a single record.
@ -248,6 +248,45 @@ class ###Component###Model###View### extends JModelAdmin
return $data;
}###VALIDATIONFIX### ###UNIQUEFIELDS###
/**
* Method to delete one or more records.
*
* @param array &$pks An array of record primary keys.
*
* @return boolean True if successful, false if an error occurs.
*
* @since 12.2
*/
public function delete(&$pks)
{###JMODELADMIN_BEFORE_DELETE###
if (!parent::delete($pks))
{
return false;
}###JMODELADMIN_AFTER_DELETE###
return true;
}
/**
* Method to change the published state of one or more records.
*
* @param array &$pks A list of the primary keys to change.
* @param integer $value The value of the published state.
*
* @return boolean True on success.
*
* @since 12.2
*/
public function publish(&$pks, $value = 1)
{###JMODELADMIN_BEFORE_PUBLISH###
if (!parent::publish($pks, $value))
{
return false;
}###JMODELADMIN_AFTER_PUBLISH###
return true;
}
/**
* Method to perform batch operations on an item or a set of items.

View File

@ -139,11 +139,11 @@ class ###Component###Router extends JComponentRouterBase
return $vars;
}
protected function getVar($table, $where = null, $whereString = 'user', $what = 'id', $category = false, $operator = '=', $main = '###component###')
protected function getVar($table, $where = null, $whereString = null, $what = null, $category = false, $operator = '=', $main = '###component###')
{
if(!$where)
if(!$where || !$what || !$whereString)
{
$where = JFactory::getUser()->id;
return false;
}
// Get a db connection.
$db = JFactory::getDbo();
@ -153,19 +153,42 @@ class ###Component###Router extends JComponentRouterBase
$query->select($db->quoteName(array($what)));
if ('categories' == $table || 'category' == $table || $category)
{
$query->from($db->quoteName('#__categories'));
$getTable = '#__categories';
$query->from($db->quoteName($getTable));
}
else
{
$query->from($db->quoteName('#__'.$main.'_'.$table));
// we must check if the table exist (TODO not ideal)
$tables = $db->getTableList();
$app = JFactory::getApplication();
$prefix = $app->get('dbprefix');
$check = $prefix.$main.'_'.$table;
if (in_array($check, $tables))
{
$getTable = '#__'.$main.'_'.$table;
$query->from($db->quoteName($getTable));
}
else
{
return false;
}
}
if (is_numeric($where))
{
$query->where($db->quoteName($whereString) . ' '.$operator.' '.(int) $where);
return false;
}
elseif (is_string($where))
elseif ($this->checkString($where))
{
$query->where($db->quoteName($whereString) . ' '.$operator.' '. $db->quote((string)$where));
// we must first check if this table has the column
$columns = $db->getTableColumns($getTable);
if (isset($columns[$whereString]))
{
$query->where($db->quoteName($whereString) . ' '.$operator.' '. $db->quote((string)$where));
}
else
{
return false;
}
}
else
{
@ -179,6 +202,15 @@ class ###Component###Router extends JComponentRouterBase
}
return false;
}
protected function checkString($string)
{
if (isset($string) && is_string($string) && strlen($string) > 0)
{
return true;
}
return false;
}
}
function ###Component###BuildRoute(&$query)

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage componentbuilder.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage controller.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage ajax.json.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage componentbuilder.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 14 of this MVC
@build 31st January, 2017
@version @update number 28 of this MVC
@build 9th February, 2017
@created 11th October, 2016
@package Component Builder
@subpackage custom_code.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 14 of this MVC
@build 31st January, 2017
@version @update number 28 of this MVC
@build 9th February, 2017
@created 11th October, 2016
@package Component Builder
@subpackage custom_codes.php

View File

@ -60,33 +60,14 @@ class ComponentbuilderControllerField extends JControllerForm
*/
protected function allowAdd($data = array())
{
// get the user object
$user = JFactory::getUser();
// Access check.
$access = $user->authorise('field.access', 'com_componentbuilder');
$access = JFactory::getUser()->authorise('field.access', 'com_componentbuilder');
if (!$access)
{
return false;
}
$categoryId = JArrayHelper::getValue($data, 'catid', $this->input->getInt('filter_category_id'), 'int');
$allow = null;
if ($categoryId)
{
// If the category has been passed in the URL check it.
$allow = $user->authorise('core.create', $this->option . '.fields.category.' . $categoryId);
}
if ($allow === null)
{
// In the absense of better information, revert to the component permissions.
return $user->authorise('field.create', $this->option);
}
else
{
return $allow;
}
// In the absense of better information, revert to the component permissions.
return JFactory::getUser()->authorise('field.create', $this->option);
}
/**
@ -146,18 +127,6 @@ class ComponentbuilderControllerField extends JControllerForm
}
return false;
}
$categoryId = (int) isset($data['catid']) ? $data['catid']: $this->getModel()->getItem($recordId)->catid;
if ($categoryId)
{
// The category has been set. Check the category permissions.
$catpermission = $user->authorise('core.edit', $this->option . '.fields.category.' . $categoryId);
if (!$catpermission && !is_null($catpermission))
{
return false;
}
}
}
// Since there is no permission, revert to the component permissions.
return $user->authorise('field.edit', $this->option);

View File

@ -60,33 +60,14 @@ class ComponentbuilderControllerFieldtype extends JControllerForm
*/
protected function allowAdd($data = array())
{
// get the user object
$user = JFactory::getUser();
// Access check.
$access = $user->authorise('fieldtype.access', 'com_componentbuilder');
$access = JFactory::getUser()->authorise('fieldtype.access', 'com_componentbuilder');
if (!$access)
{
return false;
}
$categoryId = JArrayHelper::getValue($data, 'catid', $this->input->getInt('filter_category_id'), 'int');
$allow = null;
if ($categoryId)
{
// If the category has been passed in the URL check it.
$allow = $user->authorise('core.create', $this->option . '.fieldtypes.category.' . $categoryId);
}
if ($allow === null)
{
// In the absense of better information, revert to the component permissions.
return $user->authorise('fieldtype.create', $this->option);
}
else
{
return $allow;
}
// In the absense of better information, revert to the component permissions.
return JFactory::getUser()->authorise('fieldtype.create', $this->option);
}
/**
@ -146,18 +127,6 @@ class ComponentbuilderControllerFieldtype extends JControllerForm
}
return false;
}
$categoryId = (int) isset($data['catid']) ? $data['catid']: $this->getModel()->getItem($recordId)->catid;
if ($categoryId)
{
// The category has been set. Check the category permissions.
$catpermission = $user->authorise('core.edit', $this->option . '.fieldtypes.category.' . $categoryId);
if (!$catpermission && !is_null($catpermission))
{
return false;
}
}
}
// Since there is no permission, revert to the component permissions.
return $user->authorise('fieldtype.edit', $this->option);

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage help.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage import.php

View File

@ -1,169 +1,175 @@
/*
* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
* @version 3.0.6
* @link http://fooplugins.com
* @copyright Steven Usher & Brad Vincent 2015
* @license Released under the GPLv3 license.
*/
table.footable,
table.footable-details {
position: relative;
width: 100%;
border-spacing: 0;
border-collapse: collapse;
}
table.footable-details {
margin-bottom: 0;
}
table > tbody > tr > td > span.footable-toggle {
margin-right: 8px;
opacity: 0.3;
}
table > tbody > tr > td > span.footable-toggle.last-column {
margin-left: 8px;
float: right;
}
table.table-condensed > tbody > tr > td > span.footable-toggle {
margin-right: 5px;
}
table.footable-details > tbody > tr > th:nth-child(1) {
min-width: 40px;
width: 120px;
}
table.footable-details > tbody > tr > td:nth-child(2) {
word-break: break-all;
}
table.footable-details > thead > tr:first-child > th,
table.footable-details > thead > tr:first-child > td,
table.footable-details > tbody > tr:first-child > th,
table.footable-details > tbody > tr:first-child > td,
table.footable-details > tfoot > tr:first-child > th,
table.footable-details > tfoot > tr:first-child > td {
border-top-width: 0;
}
table.footable-details.table-bordered > thead > tr:first-child > th,
table.footable-details.table-bordered > thead > tr:first-child > td,
table.footable-details.table-bordered > tbody > tr:first-child > th,
table.footable-details.table-bordered > tbody > tr:first-child > td,
table.footable-details.table-bordered > tfoot > tr:first-child > th,
table.footable-details.table-bordered > tfoot > tr:first-child > td {
border-top-width: 1px;
}
div.footable-loader {
vertical-align: middle;
text-align: center;
height: 300px;
position: relative;
}
div.footable-loader > span.fooicon {
display: inline-block;
opacity: 0.3;
font-size: 30px;
line-height: 32px;
width: 32px;
height: 32px;
margin-top: -16px;
margin-left: -16px;
position: absolute;
top: 50%;
left: 50%;
-webkit-animation: fooicon-spin-r 2s infinite linear;
animation: fooicon-spin-r 2s infinite linear;
}
table.footable > tbody > tr.footable-empty > td {
vertical-align: middle;
text-align: center;
font-size: 30px;
}
table.footable > tbody > tr > td,
table.footable > tbody > tr > th {
display: none;
}
table.footable > tbody > tr.footable-empty > td,
table.footable > tbody > tr.footable-empty > th,
table.footable > tbody > tr.footable-detail-row > td,
table.footable > tbody > tr.footable-detail-row > th {
display: table-cell;
}
@-webkit-keyframes fooicon-spin-r {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(359deg);
transform: rotate(359deg);
}
}
@keyframes fooicon-spin-r {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(359deg);
transform: rotate(359deg);
}
}
.fooicon {
position: relative;
top: 1px;
display: inline-block;
font-family: 'Glyphicons Halflings' !important;
font-style: normal;
font-weight: 400;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.fooicon:before,
.fooicon:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.fooicon-loader:before {
content: "\e030";
}
.fooicon-plus:before {
content: "\2b";
}
.fooicon-minus:before {
content: "\2212";
}
.fooicon-search:before {
content: "\e003";
}
.fooicon-remove:before {
content: "\e014";
}
.fooicon-sort:before {
content: "\e150";
}
.fooicon-sort-asc:before {
content: "\e155";
}
.fooicon-sort-desc:before {
content: "\e156";
}
.fooicon-pencil:before {
content: "\270f";
}
.fooicon-trash:before {
content: "\e020";
}
.fooicon-eye-close:before {
content: "\e106";
}
.fooicon-flash:before {
content: "\e162";
}
.fooicon-cog:before {
content: "\e019";
}
/*
* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
* @version 3.1.4
* @link http://fooplugins.com
* @copyright Steven Usher & Brad Vincent 2015
* @license Released under the GPLv3 license.
*/
table.footable,
table.footable-details {
position: relative;
width: 100%;
border-spacing: 0;
border-collapse: collapse;
}
table.footable-details {
margin-bottom: 0;
}
table.footable-hide-fouc {
display: none;
}
table > tbody > tr > td > span.footable-toggle {
margin-right: 8px;
opacity: 0.3;
}
table > tbody > tr > td > span.footable-toggle.last-column {
margin-left: 8px;
float: right;
}
table.table-condensed > tbody > tr > td > span.footable-toggle {
margin-right: 5px;
}
table.footable-details > tbody > tr > th:nth-child(1) {
min-width: 40px;
width: 120px;
}
table.footable-details > tbody > tr > td:nth-child(2) {
word-break: break-all;
}
table.footable-details > thead > tr:first-child > th,
table.footable-details > thead > tr:first-child > td,
table.footable-details > tbody > tr:first-child > th,
table.footable-details > tbody > tr:first-child > td,
table.footable-details > tfoot > tr:first-child > th,
table.footable-details > tfoot > tr:first-child > td {
border-top-width: 0;
}
table.footable-details.table-bordered > thead > tr:first-child > th,
table.footable-details.table-bordered > thead > tr:first-child > td,
table.footable-details.table-bordered > tbody > tr:first-child > th,
table.footable-details.table-bordered > tbody > tr:first-child > td,
table.footable-details.table-bordered > tfoot > tr:first-child > th,
table.footable-details.table-bordered > tfoot > tr:first-child > td {
border-top-width: 1px;
}
div.footable-loader {
vertical-align: middle;
text-align: center;
height: 300px;
position: relative;
}
div.footable-loader > span.fooicon {
display: inline-block;
opacity: 0.3;
font-size: 30px;
line-height: 32px;
width: 32px;
height: 32px;
margin-top: -16px;
margin-left: -16px;
position: absolute;
top: 50%;
left: 50%;
-webkit-animation: fooicon-spin-r 2s infinite linear;
animation: fooicon-spin-r 2s infinite linear;
}
table.footable > tbody > tr.footable-empty > td {
vertical-align: middle;
text-align: center;
font-size: 30px;
}
table.footable > tbody > tr > td,
table.footable > tbody > tr > th {
display: none;
}
table.footable > tbody > tr.footable-empty > td,
table.footable > tbody > tr.footable-empty > th,
table.footable > tbody > tr.footable-detail-row > td,
table.footable > tbody > tr.footable-detail-row > th {
display: table-cell;
}
@-webkit-keyframes fooicon-spin-r {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(359deg);
transform: rotate(359deg);
}
}
@keyframes fooicon-spin-r {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(359deg);
transform: rotate(359deg);
}
}
.fooicon {
position: relative;
top: 1px;
display: inline-block;
font-family: 'Glyphicons Halflings' !important;
font-style: normal;
font-weight: 400;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.fooicon:before,
.fooicon:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.fooicon-loader:before {
content: "\e030";
}
.fooicon-plus:before {
content: "\2b";
}
.fooicon-minus:before {
content: "\2212";
}
.fooicon-search:before {
content: "\e003";
}
.fooicon-remove:before {
content: "\e014";
}
.fooicon-sort:before {
content: "\e150";
}
.fooicon-sort-asc:before {
content: "\e155";
}
.fooicon-sort-desc:before {
content: "\e156";
}
.fooicon-pencil:before {
content: "\270f";
}
.fooicon-trash:before {
content: "\e020";
}
.fooicon-eye-close:before {
content: "\e106";
}
.fooicon-flash:before {
content: "\e162";
}
.fooicon-cog:before {
content: "\e019";
}
.fooicon-stats:before {
content: "\e185";
}

View File

@ -0,0 +1 @@
table.footable,table.footable-details{position:relative;width:100%;border-spacing:0;border-collapse:collapse}table.footable-details{margin-bottom:0}table.footable-hide-fouc{display:none}table>tbody>tr>td>span.footable-toggle{margin-right:8px;opacity:.3}table>tbody>tr>td>span.footable-toggle.last-column{margin-left:8px;float:right}table.table-condensed>tbody>tr>td>span.footable-toggle{margin-right:5px}table.footable-details>tbody>tr>th:nth-child(1){min-width:40px;width:120px}table.footable-details>tbody>tr>td:nth-child(2){word-break:break-all}table.footable-details>tbody>tr:first-child>td,table.footable-details>tbody>tr:first-child>th,table.footable-details>tfoot>tr:first-child>td,table.footable-details>tfoot>tr:first-child>th,table.footable-details>thead>tr:first-child>td,table.footable-details>thead>tr:first-child>th{border-top-width:0}table.footable-details.table-bordered>tbody>tr:first-child>td,table.footable-details.table-bordered>tbody>tr:first-child>th,table.footable-details.table-bordered>tfoot>tr:first-child>td,table.footable-details.table-bordered>tfoot>tr:first-child>th,table.footable-details.table-bordered>thead>tr:first-child>td,table.footable-details.table-bordered>thead>tr:first-child>th{border-top-width:1px}div.footable-loader{vertical-align:middle;text-align:center;height:300px;position:relative}div.footable-loader>span.fooicon{display:inline-block;opacity:.3;font-size:30px;line-height:32px;width:32px;height:32px;margin-top:-16px;margin-left:-16px;position:absolute;top:50%;left:50%;-webkit-animation:fooicon-spin-r 2s infinite linear;animation:fooicon-spin-r 2s infinite linear}table.footable>tbody>tr.footable-empty>td{vertical-align:middle;text-align:center;font-size:30px}table.footable>tbody>tr>td,table.footable>tbody>tr>th{display:none}table.footable>tbody>tr.footable-detail-row>td,table.footable>tbody>tr.footable-detail-row>th,table.footable>tbody>tr.footable-empty>td,table.footable>tbody>tr.footable-empty>th{display:table-cell}@-webkit-keyframes fooicon-spin-r{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fooicon-spin-r{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fooicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings'!important;font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fooicon:after,.fooicon:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.fooicon-loader:before{content:"\e030"}.fooicon-plus:before{content:"\2b"}.fooicon-minus:before{content:"\2212"}.fooicon-search:before{content:"\e003"}.fooicon-remove:before{content:"\e014"}.fooicon-sort:before{content:"\e150"}.fooicon-sort-asc:before{content:"\e155"}.fooicon-sort-desc:before{content:"\e156"}.fooicon-pencil:before{content:"\270f"}.fooicon-trash:before{content:"\e020"}.fooicon-eye-close:before{content:"\e106"}.fooicon-flash:before{content:"\e162"}.fooicon-cog:before{content:"\e019"}.fooicon-stats:before{content:"\e185"}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,50 @@
/*
* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
* @version 3.1.4
* @link http://fooplugins.com
* @copyright Steven Usher & Brad Vincent 2015
* @license Released under the GPLv3 license.
*/
td.footable-editing {
width: 90px;
max-width: 90px;
}
table.footable-editing-no-edit td.footable-editing,
table.footable-editing-no-delete td.footable-editing,
table.footable-editing-no-view td.footable-editing {
width: 70px;
max-width: 70px;
}
table.footable-editing-no-edit.footable-editing-no-delete td.footable-editing,
table.footable-editing-no-edit.footable-editing-no-view td.footable-editing,
table.footable-editing-no-delete.footable-editing-no-view td.footable-editing {
width: 50px;
max-width: 50px;
}
table.footable-editing-no-edit.footable-editing-no-delete.footable-editing-no-view td.footable-editing,
table.footable-editing-no-edit.footable-editing-no-delete.footable-editing-no-view th.footable-editing {
width: 0;
max-width: 0;
display: none !important;
}
table.footable-editing-right td.footable-editing,
table.footable-editing-right tr.footable-editing {
text-align: right;
}
table.footable-editing-left td.footable-editing,
table.footable-editing-left tr.footable-editing {
text-align: left;
}
table.footable-editing button.footable-add,
table.footable-editing button.footable-hide,
table.footable-editing-show button.footable-show,
table.footable-editing.footable-editing-always-show button.footable-show,
table.footable-editing.footable-editing-always-show button.footable-hide,
table.footable-editing.footable-editing-always-show.footable-editing-no-add tr.footable-editing {
display: none;
}
table.footable-editing.footable-editing-show button.footable-add,
table.footable-editing.footable-editing-show button.footable-hide,
table.footable-editing.footable-editing-always-show button.footable-add {
display: inline-block;
}

View File

@ -0,0 +1 @@
td.footable-editing{width:90px;max-width:90px}table.footable-editing-no-delete td.footable-editing,table.footable-editing-no-edit td.footable-editing,table.footable-editing-no-view td.footable-editing{width:70px;max-width:70px}table.footable-editing-no-delete.footable-editing-no-view td.footable-editing,table.footable-editing-no-edit.footable-editing-no-delete td.footable-editing,table.footable-editing-no-edit.footable-editing-no-view td.footable-editing{width:50px;max-width:50px}table.footable-editing-no-edit.footable-editing-no-delete.footable-editing-no-view td.footable-editing,table.footable-editing-no-edit.footable-editing-no-delete.footable-editing-no-view th.footable-editing{width:0;max-width:0;display:none!important}table.footable-editing-right td.footable-editing,table.footable-editing-right tr.footable-editing{text-align:right}table.footable-editing-left td.footable-editing,table.footable-editing-left tr.footable-editing{text-align:left}table.footable-editing button.footable-add,table.footable-editing button.footable-hide,table.footable-editing-show button.footable-show,table.footable-editing.footable-editing-always-show button.footable-hide,table.footable-editing.footable-editing-always-show button.footable-show,table.footable-editing.footable-editing-always-show.footable-editing-no-add tr.footable-editing{display:none}table.footable-editing.footable-editing-always-show button.footable-add,table.footable-editing.footable-editing-show button.footable-add,table.footable-editing.footable-editing-show button.footable-hide{display:inline-block}

View File

@ -1,55 +1,55 @@
/*
* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
* @version 3.0.6
* @link http://fooplugins.com
* @copyright Steven Usher & Brad Vincent 2015
* @license Released under the GPLv3 license.
*/
table.footable > thead > tr.footable-filtering > th {
border-bottom-width: 1px;
font-weight: normal;
}
table.footable > thead > tr.footable-filtering > th,
table.footable.footable-filtering-right > thead > tr.footable-filtering > th {
text-align: right;
}
table.footable.footable-filtering-left > thead > tr.footable-filtering > th {
text-align: left;
}
table.footable.footable-filtering-center > thead > tr.footable-filtering > th {
text-align: center;
}
table.footable > thead > tr.footable-filtering > th div.form-group {
margin-bottom: 0;
}
table.footable > thead > tr.footable-filtering > th div.form-group+div.form-group {
margin-top: 5px;
}
table.footable > thead > tr.footable-filtering > th div.input-group {
width: 100%;
}
table.footable > thead > tr.footable-filtering > th ul.dropdown-menu > li > a.checkbox {
margin: 0;
display: block;
position: relative;
}
table.footable > thead > tr.footable-filtering > th ul.dropdown-menu > li > a.checkbox > label {
display: block;
padding-left: 20px;
}
table.footable > thead > tr.footable-filtering > th ul.dropdown-menu > li > a.checkbox input[type="checkbox"] {
position: absolute;
margin-left: -20px;
}
@media (min-width: 768px) {
table.footable > thead > tr.footable-filtering > th div.input-group {
width: auto;
}
table.footable > thead > tr.footable-filtering > th div.form-group {
margin-left: 2px;
margin-right: 2px;
}
table.footable > thead > tr.footable-filtering > th div.form-group+div.form-group {
margin-top: 0;
}
/*
* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
* @version 3.1.4
* @link http://fooplugins.com
* @copyright Steven Usher & Brad Vincent 2015
* @license Released under the GPLv3 license.
*/
table.footable > thead > tr.footable-filtering > th {
border-bottom-width: 1px;
font-weight: normal;
}
table.footable > thead > tr.footable-filtering > th,
table.footable.footable-filtering-right > thead > tr.footable-filtering > th {
text-align: right;
}
table.footable.footable-filtering-left > thead > tr.footable-filtering > th {
text-align: left;
}
table.footable.footable-filtering-center > thead > tr.footable-filtering > th {
text-align: center;
}
table.footable > thead > tr.footable-filtering > th div.form-group {
margin-bottom: 0;
}
table.footable > thead > tr.footable-filtering > th div.form-group+div.form-group {
margin-top: 5px;
}
table.footable > thead > tr.footable-filtering > th div.input-group {
width: 100%;
}
table.footable > thead > tr.footable-filtering > th ul.dropdown-menu > li > a.checkbox {
margin: 0;
display: block;
position: relative;
}
table.footable > thead > tr.footable-filtering > th ul.dropdown-menu > li > a.checkbox > label {
display: block;
padding-left: 20px;
}
table.footable > thead > tr.footable-filtering > th ul.dropdown-menu > li > a.checkbox input[type="checkbox"] {
position: absolute;
margin-left: -20px;
}
@media (min-width: 768px) {
table.footable > thead > tr.footable-filtering > th div.input-group {
width: auto;
}
table.footable > thead > tr.footable-filtering > th div.form-group {
margin-left: 2px;
margin-right: 2px;
}
table.footable > thead > tr.footable-filtering > th div.form-group+div.form-group {
margin-top: 0;
}
}

View File

@ -1,31 +1,31 @@
/*
* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
* @version 3.0.6
* @link http://fooplugins.com
* @copyright Steven Usher & Brad Vincent 2015
* @license Released under the GPLv3 license.
*/
table.footable > tfoot > tr.footable-paging > td > ul.pagination {
margin: 10px 0 0 0;
}
table.footable > tfoot > tr.footable-paging > td > span.label {
display: inline-block;
margin: 0 0 10px 0;
padding: 4px 10px;
}
table.footable > tfoot > tr.footable-paging > td,
table.footable-paging-center > tfoot > tr.footable-paging > td {
text-align: center;
}
table.footable-paging-left > tfoot > tr.footable-paging > td {
text-align: left;
}
table.footable-paging-right > tfoot > tr.footable-paging > td {
text-align: right;
}
ul.pagination > li.footable-page {
display: none;
}
ul.pagination > li.footable-page.visible {
display: inline;
/*
* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
* @version 3.1.4
* @link http://fooplugins.com
* @copyright Steven Usher & Brad Vincent 2015
* @license Released under the GPLv3 license.
*/
table.footable > tfoot > tr.footable-paging > td > ul.pagination {
margin: 10px 0 0 0;
}
table.footable > tfoot > tr.footable-paging > td > span.label {
display: inline-block;
margin: 0 0 10px 0;
padding: 4px 10px;
}
table.footable > tfoot > tr.footable-paging > td,
table.footable-paging-center > tfoot > tr.footable-paging > td {
text-align: center;
}
table.footable-paging-left > tfoot > tr.footable-paging > td {
text-align: left;
}
table.footable-paging-right > tfoot > tr.footable-paging > td {
text-align: right;
}
ul.pagination > li.footable-page {
display: none;
}
ul.pagination > li.footable-page.visible {
display: inline;
}

View File

@ -1,32 +1,46 @@
/*
* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
* @version 3.0.6
* @link http://fooplugins.com
* @copyright Steven Usher & Brad Vincent 2015
* @license Released under the GPLv3 license.
*/
td.footable-sortable,
th.footable-sortable {
position: relative;
padding-right: 30px;
cursor: pointer;
}
td.footable-sortable > span.fooicon,
th.footable-sortable > span.fooicon {
position: absolute;
right: 6px;
top: 50%;
margin-top: -7px;
opacity: 0;
transition: opacity 0.3s ease-in;
}
td.footable-sortable:hover > span.fooicon,
th.footable-sortable:hover > span.fooicon {
opacity: 1;
}
td.footable-sortable.footable-asc > span.fooicon,
th.footable-sortable.footable-asc > span.fooicon,
td.footable-sortable.footable-desc > span.fooicon,
th.footable-sortable.footable-desc > span.fooicon {
opacity: 1;
/*
* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
* @version 3.1.4
* @link http://fooplugins.com
* @copyright Steven Usher & Brad Vincent 2015
* @license Released under the GPLv3 license.
*/
table.footable > thead > tr > td.footable-sortable,
table.footable > thead > tr > th.footable-sortable,
table.footable > tbody > tr > td.footable-sortable,
table.footable > tbody > tr > th.footable-sortable,
table.footable > tfoot > tr > td.footable-sortable,
table.footable > tfoot > tr > th.footable-sortable {
position: relative;
padding-right: 30px;
cursor: pointer;
}
td.footable-sortable > span.fooicon,
th.footable-sortable > span.fooicon {
position: absolute;
right: 6px;
top: 50%;
margin-top: -7px;
opacity: 0;
transition: opacity 0.3s ease-in;
}
td.footable-sortable:hover > span.fooicon,
th.footable-sortable:hover > span.fooicon {
opacity: 1;
}
td.footable-sortable.footable-asc > span.fooicon,
th.footable-sortable.footable-asc > span.fooicon,
td.footable-sortable.footable-desc > span.fooicon,
th.footable-sortable.footable-desc > span.fooicon {
opacity: 1;
}
/* hides the sort icons when sorting is not allowed */
table.footable-sorting-disabled td.footable-sortable.footable-asc > span.fooicon,
table.footable-sorting-disabled td.footable-sortable.footable-desc > span.fooicon,
table.footable-sorting-disabled td.footable-sortable:hover > span.fooicon,
table.footable-sorting-disabled th.footable-sortable.footable-asc > span.fooicon,
table.footable-sorting-disabled th.footable-sortable.footable-desc > span.fooicon,
table.footable-sorting-disabled th.footable-sortable:hover > span.fooicon {
opacity: 0;
visibility: hidden;
}

View File

@ -1 +1 @@
td.footable-sortable,th.footable-sortable{position:relative;padding-right:30px;cursor:pointer}td.footable-sortable>span.fooicon,th.footable-sortable>span.fooicon{position:absolute;right:6px;top:50%;margin-top:-7px;opacity:0;transition:opacity .3s ease-in}td.footable-sortable.footable-asc>span.fooicon,td.footable-sortable.footable-desc>span.fooicon,td.footable-sortable:hover>span.fooicon,th.footable-sortable.footable-asc>span.fooicon,th.footable-sortable.footable-desc>span.fooicon,th.footable-sortable:hover>span.fooicon{opacity:1}
table.footable>tbody>tr>td.footable-sortable,table.footable>tbody>tr>th.footable-sortable,table.footable>tfoot>tr>td.footable-sortable,table.footable>tfoot>tr>th.footable-sortable,table.footable>thead>tr>td.footable-sortable,table.footable>thead>tr>th.footable-sortable{position:relative;padding-right:30px;cursor:pointer}td.footable-sortable>span.fooicon,th.footable-sortable>span.fooicon{position:absolute;right:6px;top:50%;margin-top:-7px;opacity:0;transition:opacity .3s ease-in}td.footable-sortable.footable-asc>span.fooicon,td.footable-sortable.footable-desc>span.fooicon,td.footable-sortable:hover>span.fooicon,th.footable-sortable.footable-asc>span.fooicon,th.footable-sortable.footable-desc>span.fooicon,th.footable-sortable:hover>span.fooicon{opacity:1}table.footable-sorting-disabled td.footable-sortable.footable-asc>span.fooicon,table.footable-sorting-disabled td.footable-sortable.footable-desc>span.fooicon,table.footable-sorting-disabled td.footable-sortable:hover>span.fooicon,table.footable-sorting-disabled th.footable-sortable.footable-asc>span.fooicon,table.footable-sorting-disabled th.footable-sortable.footable-desc>span.fooicon,table.footable-sorting-disabled th.footable-sortable:hover>span.fooicon{opacity:0;visibility:hidden}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,802 @@
/*
* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
* @version 3.1.4
* @link http://fooplugins.com
* @copyright Steven Usher & Brad Vincent 2015
* @license Released under the GPLv3 license.
*/
(function($, F){
F.Editing = F.Component.extend(/** @lends FooTable.Editing */{
/**
* The editing component adds a column with edit and delete buttons to each row as well as a single add row button in the footer.
* @constructs
* @extends FooTable.Component
* @param {FooTable.Table} table - The parent {@link FooTable.Table} object for the component.
* @returns {FooTable.Editing}
*/
construct: function(table){
// call the base constructor
this._super(table, table.o.editing.enabled);
/**
* Whether or not to automatically page to a new row when it is added to the table.
* @type {boolean}
*/
this.pageToNew = table.o.editing.pageToNew;
/**
* Whether or not the editing column and add row button are always visible.
* @type {boolean}
*/
this.alwaysShow = table.o.editing.alwaysShow;
/**
* The options for the editing column. @see {@link FooTable.EditingColumn} for more info.
* @type {object}
* @prop {string} classes="footable-editing" - A space separated string of class names to apply to all cells in the column.
* @prop {string} name="editing" - The name of the column.
* @prop {string} title="" - The title displayed in the header row of the table for the column.
* @prop {boolean} filterable=false - Whether or not the column should be filterable when using the filtering component.
* @prop {boolean} sortable=false - Whether or not the column should be sortable when using the sorting component.
*/
this.column = $.extend(true, {}, table.o.editing.column, {visible: this.alwaysShow});
/**
* The position of the editing column in the table as well as the alignment of the buttons.
* @type {string}
*/
this.position = table.o.editing.position;
/**
* The text that appears in the show button. This can contain HTML.
* @type {string}
*/
this.showText = table.o.editing.showText;
/**
* The text that appears in the hide button. This can contain HTML.
* @type {string}
*/
this.hideText = table.o.editing.hideText;
/**
* The text that appears in the add button. This can contain HTML.
* @type {string}
*/
this.addText = table.o.editing.addText;
/**
* The text that appears in the edit button. This can contain HTML.
* @type {string}
*/
this.editText = table.o.editing.editText;
/**
* The text that appears in the delete button. This can contain HTML.
* @type {string}
*/
this.deleteText = table.o.editing.deleteText;
/**
* The text that appears in the view button. This can contain HTML.
* @type {string}
*/
this.viewText = table.o.editing.viewText;
/**
* Whether or not to show the Add Row button.
* @type {boolean}
*/
this.allowAdd = table.o.editing.allowAdd;
/**
* Whether or not to show the Edit Row button.
* @type {boolean}
*/
this.allowEdit = table.o.editing.allowEdit;
/**
* Whether or not to show the Delete Row button.
* @type {boolean}
*/
this.allowDelete = table.o.editing.allowDelete;
/**
* Whether or not to show the View Row button.
* @type {boolean}
*/
this.allowView = table.o.editing.allowView;
/**
* Caches the row button elements to help with performance.
* @type {(null|jQuery)}
* @private
*/
this._$buttons = null;
/**
* This object is used to contain the callbacks for the add, edit and delete row buttons.
* @type {object}
* @prop {function} addRow
* @prop {function} editRow
* @prop {function} deleteRow
* @prop {function} viewRow
*/
this.callbacks = {
addRow: F.checkFnValue(this, table.o.editing.addRow),
editRow: F.checkFnValue(this, table.o.editing.editRow),
deleteRow: F.checkFnValue(this, table.o.editing.deleteRow),
viewRow: F.checkFnValue(this, table.o.editing.viewRow)
};
},
/* PROTECTED */
/**
* Checks the supplied data and options for the editing component.
* @instance
* @protected
* @param {object} data - The jQuery data object from the parent table.
* @fires FooTable.Editing#"preinit.ft.editing"
*/
preinit: function(data){
var self = this;
/**
* The preinit.ft.editing event is raised before the UI is created and provides the tables jQuery data object for additional options parsing.
* Calling preventDefault on this event will disable the component.
* @event FooTable.Editing#"preinit.ft.editing"
* @param {jQuery.Event} e - The jQuery.Event object for the event.
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
* @param {object} data - The jQuery data object of the table raising the event.
*/
this.ft.raise('preinit.ft.editing', [data]).then(function(){
if (self.ft.$el.hasClass('footable-editing'))
self.enabled = true;
self.enabled = F.is.boolean(data.editing)
? data.editing
: self.enabled;
if (!self.enabled) return;
self.pageToNew = F.is.boolean(data.editingPageToNew) ? data.editingPageToNew : self.pageToNew;
self.alwaysShow = F.is.boolean(data.editingAlwaysShow) ? data.editingAlwaysShow : self.alwaysShow;
self.position = F.is.string(data.editingPosition) ? data.editingPosition : self.position;
self.showText = F.is.string(data.editingShowText) ? data.editingShowText : self.showText;
self.hideText = F.is.string(data.editingHideText) ? data.editingHideText : self.hideText;
self.addText = F.is.string(data.editingAddText) ? data.editingAddText : self.addText;
self.editText = F.is.string(data.editingEditText) ? data.editingEditText : self.editText;
self.deleteText = F.is.string(data.editingDeleteText) ? data.editingDeleteText : self.deleteText;
self.viewText = F.is.string(data.editingViewText) ? data.editingViewText : self.viewText;
self.allowAdd = F.is.boolean(data.editingAllowAdd) ? data.editingAllowAdd : self.allowAdd;
self.allowEdit = F.is.boolean(data.editingAllowEdit) ? data.editingAllowEdit : self.allowEdit;
self.allowDelete = F.is.boolean(data.editingAllowDelete) ? data.editingAllowDelete : self.allowDelete;
self.allowView = F.is.boolean(data.editingAllowView) ? data.editingAllowView : self.allowView;
self.column = new F.EditingColumn(self.ft, self, $.extend(true, {}, self.column, data.editingColumn, {visible: self.alwaysShow}));
if (self.ft.$el.hasClass('footable-editing-left'))
self.position = 'left';
if (self.ft.$el.hasClass('footable-editing-right'))
self.position = 'right';
if (self.position === 'right'){
self.column.index = self.ft.columns.array.length;
} else {
self.column.index = 0;
for (var i = 0, len = self.ft.columns.array.length; i < len; i++){
self.ft.columns.array[i].index += 1;
}
}
self.ft.columns.array.push(self.column);
self.ft.columns.array.sort(function(a, b){ return a.index - b.index; });
self.callbacks.addRow = F.checkFnValue(self, data.editingAddRow, self.callbacks.addRow);
self.callbacks.editRow = F.checkFnValue(self, data.editingEditRow, self.callbacks.editRow);
self.callbacks.deleteRow = F.checkFnValue(self, data.editingDeleteRow, self.callbacks.deleteRow);
self.callbacks.viewRow = F.checkFnValue(self, data.editingViewRow, self.callbacks.viewRow);
}, function(){
self.enabled = false;
});
},
/**
* Initializes the editing component for the plugin using the supplied table and options.
* @instance
* @protected
* @fires FooTable.Editing#"init.ft.editing"
*/
init: function(){
/**
* The init.ft.editing event is raised before its UI is generated.
* Calling preventDefault on this event will disable the component.
* @event FooTable.Editing#"init.ft.editing"
* @param {jQuery.Event} e - The jQuery.Event object for the event.
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
*/
var self = this;
this.ft.raise('init.ft.editing').then(function(){
self.$create();
}, function(){
self.enabled = false;
});
},
/**
* Destroys the editing component removing any UI generated from the table.
* @instance
* @protected
* @fires FooTable.Editing#"destroy.ft.editing"
*/
destroy: function () {
/**
* The destroy.ft.editing event is raised before its UI is removed.
* Calling preventDefault on this event will prevent the component from being destroyed.
* @event FooTable.Editing#"destroy.ft.editing"
* @param {jQuery.Event} e - The jQuery.Event object for the event.
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
*/
var self = this;
this.ft.raise('destroy.ft.editing').then(function(){
self.ft.$el.removeClass('footable-editing footable-editing-always-show footable-editing-no-add footable-editing-no-edit footable-editing-no-delete footable-editing-no-view')
.off('click.ft.editing').find('tfoot > tr.footable-editing').remove();
});
},
/**
* Creates the editing UI from the current options setting the various jQuery properties of this component.
* @instance
* @protected
*/
$create: function(){
var self = this, position = self.position === 'right' ? 'footable-editing-right' : 'footable-editing-left';
self.ft.$el.addClass('footable-editing').addClass(position)
.on('click.ft.editing', '.footable-show', {self: self}, self._onShowClick)
.on('click.ft.editing', '.footable-hide', {self: self}, self._onHideClick)
.on('click.ft.editing', '.footable-edit', {self: self}, self._onEditClick)
.on('click.ft.editing', '.footable-delete', {self: self}, self._onDeleteClick)
.on('click.ft.editing', '.footable-view', {self: self}, self._onViewClick)
.on('click.ft.editing', '.footable-add', {self: self}, self._onAddClick);
self.$cell = $('<td/>').attr('colspan', self.ft.columns.visibleColspan).append(self.$buttonShow());
if (self.allowAdd){
self.$cell.append(self.$buttonAdd());
}
self.$cell.append(self.$buttonHide());
if (self.alwaysShow){
self.ft.$el.addClass('footable-editing-always-show');
}
if (!self.allowAdd) self.ft.$el.addClass('footable-editing-no-add');
if (!self.allowEdit) self.ft.$el.addClass('footable-editing-no-edit');
if (!self.allowDelete) self.ft.$el.addClass('footable-editing-no-delete');
if (!self.allowView) self.ft.$el.addClass('footable-editing-no-view');
var $tfoot = self.ft.$el.children('tfoot');
if ($tfoot.length == 0){
$tfoot = $('<tfoot/>');
self.ft.$el.append($tfoot);
}
self.$row = $('<tr/>', { 'class': 'footable-editing' }).append(self.$cell).appendTo($tfoot);
},
/**
* Creates the show button for the editing component.
* @instance
* @protected
* @returns {(string|HTMLElement|jQuery)}
*/
$buttonShow: function(){
return '<button type="button" class="btn btn-primary footable-show">' + this.showText + '</button>';
},
/**
* Creates the hide button for the editing component.
* @instance
* @protected
* @returns {(string|HTMLElement|jQuery)}
*/
$buttonHide: function(){
return '<button type="button" class="btn btn-default footable-hide">' + this.hideText + '</button>';
},
/**
* Creates the add button for the editing component.
* @instance
* @protected
* @returns {(string|HTMLElement|jQuery)}
*/
$buttonAdd: function(){
return '<button type="button" class="btn btn-primary footable-add">' + this.addText + '</button> ';
},
/**
* Creates the edit button for the editing component.
* @instance
* @protected
* @returns {(string|HTMLElement|jQuery)}
*/
$buttonEdit: function(){
return '<button type="button" class="btn btn-default footable-edit">' + this.editText + '</button> ';
},
/**
* Creates the delete button for the editing component.
* @instance
* @protected
* @returns {(string|HTMLElement|jQuery)}
*/
$buttonDelete: function(){
return '<button type="button" class="btn btn-default footable-delete">' + this.deleteText + '</button>';
},
/**
* Creates the view button for the editing component.
* @instance
* @protected
* @returns {(string|HTMLElement|jQuery)}
*/
$buttonView: function(){
return '<button type="button" class="btn btn-default footable-view">' + this.viewText + '</button> ';
},
/**
* Creates the button group for the row buttons.
* @instance
* @protected
* @returns {(string|HTMLElement|jQuery)}
*/
$rowButtons: function(){
if (F.is.jq(this._$buttons)) return this._$buttons.clone();
this._$buttons = $('<div class="btn-group btn-group-xs" role="group"></div>');
if (this.allowView) this._$buttons.append(this.$buttonView());
if (this.allowEdit) this._$buttons.append(this.$buttonEdit());
if (this.allowDelete) this._$buttons.append(this.$buttonDelete());
return this._$buttons;
},
/**
* Performs the drawing of the component.
*/
draw: function(){
this.$cell.attr('colspan', this.ft.columns.visibleColspan);
},
/**
* Handles the edit button click event.
* @instance
* @private
* @param {jQuery.Event} e - The jQuery.Event object for the event.
* @fires FooTable.Editing#"edit.ft.editing"
*/
_onEditClick: function(e){
e.preventDefault();
var self = e.data.self, row = $(this).closest('tr').data('__FooTableRow__');
if (row instanceof F.Row){
/**
* The edit.ft.editing event is raised before its callback is executed.
* Calling preventDefault on this event will prevent the callback from being executed.
* @event FooTable.Editing#"edit.ft.editing"
* @param {jQuery.Event} e - The jQuery.Event object for the event.
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
* @param {FooTable.Row} row - The row to be edited.
*/
self.ft.raise('edit.ft.editing', [row]).then(function(){
self.callbacks.editRow.call(self.ft, row);
});
}
},
/**
* Handles the delete button click event.
* @instance
* @private
* @param {jQuery.Event} e - The jQuery.Event object for the event.
* @fires FooTable.Editing#"delete.ft.editing"
*/
_onDeleteClick: function(e){
e.preventDefault();
var self = e.data.self, row = $(this).closest('tr').data('__FooTableRow__');
if (row instanceof F.Row){
/**
* The delete.ft.editing event is raised before its callback is executed.
* Calling preventDefault on this event will prevent the callback from being executed.
* @event FooTable.Editing#"delete.ft.editing"
* @param {jQuery.Event} e - The jQuery.Event object for the event.
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
* @param {FooTable.Row} row - The row to be deleted.
*/
self.ft.raise('delete.ft.editing', [row]).then(function(){
self.callbacks.deleteRow.call(self.ft, row);
});
}
},
/**
* Handles the view button click event.
* @instance
* @private
* @param {jQuery.Event} e - The jQuery.Event object for the event.
* @fires FooTable.Editing#"view.ft.editing"
*/
_onViewClick: function(e){
e.preventDefault();
var self = e.data.self, row = $(this).closest('tr').data('__FooTableRow__');
if (row instanceof F.Row){
/**
* The view.ft.editing event is raised before its callback is executed.
* Calling preventDefault on this event will prevent the callback from being executed.
* @event FooTable.Editing#"view.ft.editing"
* @param {jQuery.Event} e - The jQuery.Event object for the event.
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
* @param {FooTable.Row} row - The row to be viewed.
*/
self.ft.raise('view.ft.editing', [row]).then(function(){
self.callbacks.viewRow.call(self.ft, row);
});
}
},
/**
* Handles the add button click event.
* @instance
* @private
* @param {jQuery.Event} e - The jQuery.Event object for the event.
* @fires FooTable.Editing#"add.ft.editing"
*/
_onAddClick: function(e){
e.preventDefault();
var self = e.data.self;
/**
* The add.ft.editing event is raised before its callback is executed.
* Calling preventDefault on this event will prevent the callback from being executed.
* @event FooTable.Editing#"add.ft.editing"
* @param {jQuery.Event} e - The jQuery.Event object for the event.
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
*/
self.ft.raise('add.ft.editing').then(function(){
self.callbacks.addRow.call(self.ft);
});
},
/**
* Handles the show button click event.
* @instance
* @private
* @param {jQuery.Event} e - The jQuery.Event object for the event.
* @fires FooTable.Editing#"show.ft.editing"
*/
_onShowClick: function(e){
e.preventDefault();
var self = e.data.self;
/**
* The show.ft.editing event is raised before its callback is executed.
* Calling preventDefault on this event will prevent the callback from being executed.
* @event FooTable.Editing#"show.ft.editing"
* @param {jQuery.Event} e - The jQuery.Event object for the event.
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
*/
self.ft.raise('show.ft.editing').then(function(){
self.ft.$el.addClass('footable-editing-show');
self.column.visible = true;
self.ft.draw();
});
},
/**
* Handles the hide button click event.
* @instance
* @private
* @param {jQuery.Event} e - The jQuery.Event object for the event.
* @fires FooTable.Editing#"show.ft.editing"
*/
_onHideClick: function(e){
e.preventDefault();
var self = e.data.self;
/**
* The hide.ft.editing event is raised before its callback is executed.
* Calling preventDefault on this event will prevent the callback from being executed.
* @event FooTable.Editing#"hide.ft.editing"
* @param {jQuery.Event} e - The jQuery.Event object for the event.
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
*/
self.ft.raise('hide.ft.editing').then(function(){
self.ft.$el.removeClass('footable-editing-show');
self.column.visible = false;
self.ft.draw();
});
}
});
F.components.register('editing', F.Editing, 850);
})(jQuery, FooTable);
(function($, F){
F.EditingColumn = F.Column.extend(/** @lends FooTable.EditingColumn */{
/**
* The Editing column class is used to create the column containing the editing buttons.
* @constructs
* @extends FooTable.Column
* @param {FooTable.Table} instance - The parent {@link FooTable.Table} this column belongs to.
* @param {FooTable.Editing} editing - The parent {@link FooTable.Editing} component this column is used with.
* @param {object} definition - An object containing all the properties to set for the column.
* @returns {FooTable.EditingColumn}
*/
construct: function(instance, editing, definition){
this._super(instance, definition, 'editing');
this.editing = editing;
},
/**
* After the column has been defined this ensures that the $el property is a jQuery object by either creating or updating the current value.
* @instance
* @protected
* @this FooTable.Column
*/
$create: function(){
(this.$el = !this.virtual && F.is.jq(this.$el) ? this.$el : $('<th/>', {'class': 'footable-editing'})).html(this.title);
},
/**
* This is supplied either the cell value or jQuery object to parse. Any value can be returned from this method and
* will be provided to the {@link FooTable.EditingColumn#format} function
* to generate the cell contents.
* @instance
* @protected
* @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
* @returns {(jQuery)}
*/
parser: function(valueOrElement){
if (F.is.string(valueOrElement)) valueOrElement = $($.trim(valueOrElement));
if (F.is.element(valueOrElement)) valueOrElement = $(valueOrElement);
if (F.is.jq(valueOrElement)){
var tagName = valueOrElement.prop('tagName').toLowerCase();
if (tagName == 'td' || tagName == 'th') return valueOrElement.data('value') || valueOrElement.contents();
return valueOrElement;
}
return null;
},
/**
* Creates a cell to be used in the supplied row for this column.
* @param {FooTable.Row} row - The row to create the cell for.
* @returns {FooTable.Cell}
*/
createCell: function(row){
var $buttons = this.editing.$rowButtons(), $cell = $('<td/>').append($buttons);
if (F.is.jq(row.$el)){
if (this.index === 0){
$cell.prependTo(row.$el);
} else {
$cell.insertAfter(row.$el.children().eq(this.index-1));
}
}
return new F.Cell(this.ft, row, this, $cell || $cell.html());
}
});
F.columns.register('editing', F.EditingColumn);
})(jQuery, FooTable);
(function($, F) {
/**
* An object containing the editing options for the plugin. Added by the {@link FooTable.Editing} component.
* @type {object}
* @prop {boolean} enabled=false - Whether or not to allow editing on the table.
* @prop {boolean} pageToNew=true - Whether or not to automatically page to a new row when it is added to the table.
* @prop {string} position="right" - The position of the editing column in the table as well as the alignment of the buttons.
* @prop {boolean} alwaysShow=false - Whether or not the editing column and add row button are always visible.
* @prop {function} addRow - The callback function to execute when the add row button is clicked.
* @prop {function} editRow - The callback function to execute when the edit row button is clicked.
* @prop {function} deleteRow - The callback function to execute when the delete row button is clicked.
* @prop {function} viewRow - The callback function to execute when the view row button is clicked.
* @prop {string} showText - The text that appears in the show button. This can contain HTML.
* @prop {string} hideText - The text that appears in the hide button. This can contain HTML.
* @prop {string} addText - The text that appears in the add button. This can contain HTML.
* @prop {string} editText - The text that appears in the edit button. This can contain HTML.
* @prop {string} deleteText - The text that appears in the delete button. This can contain HTML.
* @prop {string} viewText - The text that appears in the view button. This can contain HTML.
* @prop {boolean} allowAdd - Whether or not to show the Add Row button.
* @prop {boolean} allowEdit - Whether or not to show the Edit Row button.
* @prop {boolean} allowDelete - Whether or not to show the Delete Row button.
* @prop {boolean} allowView - Whether or not to show the View Row button.
* @prop {object} column - The options for the editing column. @see {@link FooTable.EditingColumn} for more info.
* @prop {string} column.classes="footable-editing" - A space separated string of class names to apply to all cells in the column.
* @prop {string} column.name="editing" - The name of the column.
* @prop {string} column.title="" - The title displayed in the header row of the table for the column.
* @prop {boolean} column.filterable=false - Whether or not the column should be filterable when using the filtering component.
* @prop {boolean} column.sortable=false - Whether or not the column should be sortable when using the sorting component.
*/
F.Defaults.prototype.editing = {
enabled: false,
pageToNew: true,
position: 'right',
alwaysShow: false,
addRow: function(){},
editRow: function(row){},
deleteRow: function(row){},
viewRow: function(row){},
showText: '<span class="fooicon fooicon-pencil" aria-hidden="true"></span> Edit rows',
hideText: 'Cancel',
addText: 'New row',
editText: '<span class="fooicon fooicon-pencil" aria-hidden="true"></span>',
deleteText: '<span class="fooicon fooicon-trash" aria-hidden="true"></span>',
viewText: '<span class="fooicon fooicon-stats" aria-hidden="true"></span>',
allowAdd: true,
allowEdit: true,
allowDelete: true,
allowView: false,
column: {
classes: 'footable-editing',
name: 'editing',
title: '',
filterable: false,
sortable: false
}
};
})(jQuery, FooTable);
(function($, F){
if (F.is.defined(F.Paging)){
/**
* Holds a shallow clone of the un-paged {@link FooTable.Rows#array} value before paging occurs and superfluous rows are removed. Added by the {@link FooTable.Editing} component.
* @instance
* @public
* @type {Array<FooTable.Row>}
*/
F.Paging.prototype.unpaged = [];
// override the default predraw method with one that sets the unpaged property.
F.Paging.extend('predraw', function(){
this.unpaged = this.ft.rows.array.slice(0); // create a shallow clone for later use
this._super(); // call the original method
});
}
})(jQuery, FooTable);
(function($, F){
/**
* Adds the row to the table.
* @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
* can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
* @returns {jQuery.Deferred}
*/
F.Row.prototype.add = function(redraw){
redraw = F.is.boolean(redraw) ? redraw : true;
var self = this;
return $.Deferred(function(d){
var index = self.ft.rows.all.push(self) - 1;
if (redraw){
return self.ft.draw().then(function(){
d.resolve(index);
});
} else {
d.resolve(index);
}
});
};
/**
* Removes the row from the table.
* @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
* can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
* @returns {jQuery.Deferred}
*/
F.Row.prototype.delete = function(redraw){
redraw = F.is.boolean(redraw) ? redraw : true;
var self = this;
return $.Deferred(function(d){
var index = self.ft.rows.all.indexOf(self);
if (F.is.number(index) && index >= 0 && index < self.ft.rows.all.length){
self.ft.rows.all.splice(index, 1);
if (redraw){
return self.ft.draw().then(function(){
d.resolve(self);
});
}
}
d.resolve(self);
});
};
if (F.is.defined(F.Paging)){
// override the default add method with one that supports paging
F.Row.extend('add', function(redraw){
redraw = F.is.boolean(redraw) ? redraw : true;
var self = this,
added = this._super(redraw),
editing = self.ft.use(F.Editing),
paging;
if (editing && editing.pageToNew && (paging = self.ft.use(F.Paging)) && redraw){
return added.then(function(){
var index = paging.unpaged.indexOf(self); // find this row in the unpaged array (this array will be sorted and filtered)
var page = Math.ceil((index + 1) / paging.size); // calculate the page the new row is on
if (paging.current !== page){ // goto the page if we need to
return paging.goto(page);
}
});
}
return added;
});
}
if (F.is.defined(F.Sorting)){
// override the default val method with one that supports sorting and paging
F.Row.extend('val', function(data, redraw){
redraw = F.is.boolean(redraw) ? redraw : true;
var result = this._super(data);
if (!F.is.hash(data)){
return result;
}
var self = this;
if (redraw){
self.ft.draw().then(function(){
var editing = self.ft.use(F.Editing), paging;
if (F.is.defined(F.Paging) && editing && editing.pageToNew && (paging = self.ft.use(F.Paging))){
var index = paging.unpaged.indexOf(self); // find this row in the unpaged array (this array will be sorted and filtered)
var page = Math.ceil((index + 1) / paging.size); // calculate the page the new row is on
if (paging.current !== page){ // goto the page if we need to
return paging.goto(page);
}
}
});
}
return result;
});
}
})(jQuery, FooTable);
(function(F){
/**
* Adds a row to the underlying {@link FooTable.Rows#all} array.
* @param {(object|FooTable.Row)} dataOrRow - A hash containing the row values or an actual {@link FooTable.Row} object.
* @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
* can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
*/
F.Rows.prototype.add = function(dataOrRow, redraw){
var row = dataOrRow;
if (F.is.hash(dataOrRow)){
row = new FooTable.Row(this.ft, this.ft.columns.array, dataOrRow);
}
if (row instanceof FooTable.Row){
row.add(redraw);
}
};
/**
* Updates a row in the underlying {@link FooTable.Rows#all} array.
* @param {(number|FooTable.Row)} indexOrRow - The index to update or the actual {@link FooTable.Row} object.
* @param {object} data - A hash containing the new row values.
* @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
* can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
*/
F.Rows.prototype.update = function(indexOrRow, data, redraw){
var len = this.ft.rows.all.length,
row = indexOrRow;
if (F.is.number(indexOrRow) && indexOrRow >= 0 && indexOrRow < len){
row = this.ft.rows.all[indexOrRow];
}
if (row instanceof FooTable.Row && F.is.hash(data)){
row.val(data, redraw);
}
};
/**
* Deletes a row from the underlying {@link FooTable.Rows#all} array.
* @param {(number|FooTable.Row)} indexOrRow - The index to delete or the actual {@link FooTable.Row} object.
* @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
* can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
*/
F.Rows.prototype.delete = function(indexOrRow, redraw){
var len = this.ft.rows.all.length,
row = indexOrRow;
if (F.is.number(indexOrRow) && indexOrRow >= 0 && indexOrRow < len){
row = this.ft.rows.all[indexOrRow];
}
if (row instanceof FooTable.Row){
row.delete(redraw);
}
};
})(FooTable);

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,435 +1,490 @@
/*
* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
* @version 3.0.6
* @link http://fooplugins.com
* @copyright Steven Usher & Brad Vincent 2015
* @license Released under the GPLv3 license.
*/
(function($, F){
F.Sorter = F.Class.extend(/** @lends FooTable.Sorter */{
/**
* The sorter object contains the column and direction to sort by.
* @constructs
* @extends FooTable.Class
* @param {FooTable.Column} column - The column to sort.
* @param {string} direction - The direction to sort by.
* @returns {FooTable.Sorter}
*/
construct: function(column, direction){
/**
* The column to sort.
* @type {FooTable.Column}
*/
this.column = column;
/**
* The direction to sort by.
* @type {string}
*/
this.direction = direction;
}
});
})(jQuery, FooTable);
(function ($, F) {
F.Sorting = F.Component.extend(/** @lends FooTable.Sorting */{
/**
* The sorting component adds a small sort button to specified column headers allowing users to sort those columns in the table.
* @constructs
* @extends FooTable.Component
* @param {FooTable.Table} table - The parent {@link FooTable.Table} object for the component.
* @returns {FooTable.Sorting}
*/
construct: function (table) {
// call the constructor of the base class
this._super(table, table.o.sorting.enabled);
/* PROTECTED */
/**
* This provides a shortcut to the {@link FooTable.Table#options}.[sorting]{@link FooTable.Defaults#sorting} object.
* @instance
* @protected
* @type {object}
*/
this.o = table.o.sorting;
/**
* The current sorted column.
* @instance
* @type {FooTable.Column}
*/
this.column = null;
/* PRIVATE */
/**
* Sets a flag indicating whether or not the sorting has changed. When set to true the {@link FooTable.Sorting#sorting_changing} and {@link FooTable.Sorting#sorting_changed} events
* will be raised during the drawing operation.
* @private
* @type {boolean}
*/
this._changed = false;
},
/* PROTECTED */
/**
* Checks the supplied data and options for the sorting component.
* @instance
* @protected
* @param {object} data - The jQuery data object from the parent table.
* @fires FooTable.Sorting#"preinit.ft.sorting"
* @this FooTable.Sorting
*/
preinit: function(data){
var self = this;
/**
* The preinit.ft.sorting event is raised before the UI is created and provides the tables jQuery data object for additional options parsing.
* Calling preventDefault on this event will disable the component.
* @event FooTable.Sorting#"preinit.ft.sorting"
* @param {jQuery.Event} e - The jQuery.Event object for the event.
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
* @param {object} data - The jQuery data object of the table raising the event.
*/
this.ft.raise('preinit.ft.sorting', [data]).then(function(){
if (self.ft.$el.hasClass('footable-sorting'))
self.enabled = true;
self.enabled = F.is.boolean(data.sorting)
? data.sorting
: self.enabled;
if (!self.enabled) return;
self.column = F.arr.first(self.ft.columns.array, function(col){ return col.sorted; });
}, function(){
self.enabled = false;
});
},
/**
* Initializes the sorting component for the plugin using the supplied table and options.
* @instance
* @protected
* @fires FooTable.Sorting#"init.ft.sorting"
* @this FooTable.Sorting
*/
init: function () {
/**
* The init.ft.sorting event is raised before its UI is generated.
* Calling preventDefault on this event will disable the component.
* @event FooTable.Sorting#"init.ft.sorting"
* @param {jQuery.Event} e - The jQuery.Event object for the event.
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
*/
var self = this;
this.ft.raise('init.ft.sorting').then(function(){
F.arr.each(self.ft.columns.array, function(col){
if (col.sortable){
col.$el.addClass('footable-sortable').append($('<span/>', {'class': 'fooicon fooicon-sort'}));
}
});
self.ft.$el.on('click.footable', '.footable-sortable', { self: self }, self._onSortClicked);
}, function(){
self.enabled = false;
});
},
/**
* Destroys the sorting component removing any UI generated from the table.
* @instance
* @protected
* @fires FooTable.Sorting#"destroy.ft.sorting"
*/
destroy: function () {
/**
* The destroy.ft.sorting event is raised before its UI is removed.
* Calling preventDefault on this event will prevent the component from being destroyed.
* @event FooTable.Sorting#"destroy.ft.sorting"
* @param {jQuery.Event} e - The jQuery.Event object for the event.
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
*/
var self = this;
this.ft.raise('destroy.ft.paging').then(function(){
self.ft.$el.off('click.footable', '.footable-sortable', self._onSortClicked);
self.ft.$el.children('thead').children('tr.footable-header')
.children('.footable-sortable').removeClass('footable-sortable')
.find('span.fooicon').remove();
});
},
/**
* Performs the actual sorting against the {@link FooTable.Rows#current} array.
* @instance
* @protected
*/
predraw: function () {
if (!this.column) return;
var self = this, col = self.column;
//self.ft.rows.array.sort(function (a, b) {
// return col.direction == 'ASC'
// ? col.sorter(a.cells[col.index].value, b.cells[col.index].value)
// : col.sorter(b.cells[col.index].value, a.cells[col.index].value);
//});
self.ft.rows.array.sort(function (a, b) {
return col.direction == 'ASC'
? col.sorter(a.cells[col.index].sortValue, b.cells[col.index].sortValue)
: col.sorter(b.cells[col.index].sortValue, a.cells[col.index].sortValue);
});
},
/**
* Updates the sorting UI setting the state of the sort buttons.
* @instance
* @protected
*/
draw: function () {
if (!this.column) return;
var self = this,
$sortable = self.ft.$el.find('thead > tr > .footable-sortable'),
$active = self.column.$el;
$sortable.removeClass('footable-asc footable-desc').children('.fooicon').removeClass('fooicon-sort fooicon-sort-asc fooicon-sort-desc');
$sortable.not($active).children('.fooicon').addClass('fooicon-sort');
$active.addClass(self.column.direction == 'ASC' ? 'footable-asc' : 'footable-desc')
.children('.fooicon').addClass(self.column.direction == 'ASC' ? 'fooicon-sort-asc' : 'fooicon-sort-desc');
},
/* PUBLIC */
/**
* Sets the sorting options and calls the {@link FooTable.Table#draw} method to perform the actual sorting.
* @instance
* @param {(string|number|FooTable.Column)} column - The column name, index or the actual {@link FooTable.Column} object to sort by.
* @param {string} [direction="ASC"] - The direction to sort by, either ASC or DESC.
* @returns {jQuery.Promise}
* @fires FooTable.Sorting#"before.ft.sorting"
* @fires FooTable.Sorting#"after.ft.sorting"
*/
sort: function(column, direction){
return this._sort(column, direction);
},
/* PRIVATE */
/**
* Performs the required steps to handle sorting including the raising of the {@link FooTable.Sorting#"before.ft.sorting"} and {@link FooTable.Sorting#"after.ft.sorting"} events.
* @instance
* @private
* @param {(string|number|FooTable.Column)} column - The column name, index or the actual {@link FooTable.Column} object to sort by.
* @param {string} [direction="ASC"] - The direction to sort by, either ASC or DESC.
* @returns {jQuery.Promise}
* @fires FooTable.Sorting#"before.ft.sorting"
* @fires FooTable.Sorting#"after.ft.sorting"
*/
_sort: function(column, direction){
var self = this;
var sorter = new F.Sorter(self.ft.columns.get(column), F.Sorting.dir(direction));
/**
* The before.ft.sorting event is raised before a sort is applied and allows listeners to modify the sorter or cancel it completely by calling preventDefault on the jQuery.Event object.
* @event FooTable.Sorting#"before.ft.sorting"
* @param {jQuery.Event} e - The jQuery.Event object for the event.
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
* @param {FooTable.Sorter} sorter - The sorter that is about to be applied.
*/
return self.ft.raise('before.ft.sorting', [sorter]).then(function(){
F.arr.each(self.ft.columns.array, function(col){
if (col != self.column) col.direction = null;
});
self.column = self.ft.columns.get(sorter.column);
if (self.column) self.column.direction = F.Sorting.dir(sorter.direction);
return self.ft.draw().then(function(){
/**
* The after.ft.sorting event is raised after a sorter has been applied.
* @event FooTable.Sorting#"after.ft.sorting"
* @param {jQuery.Event} e - The jQuery.Event object for the event.
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
* @param {FooTable.Sorter} sorter - The sorter that has been applied.
*/
self.ft.raise('after.ft.sorting', [sorter]);
});
});
},
/**
* Handles the sort button clicked event.
* @instance
* @private
* @param {jQuery.Event} e - The event object for the event.
*/
_onSortClicked: function (e) {
e.preventDefault();
var self = e.data.self, $header = $(this).closest('th,td'),
direction = $header.is('.footable-asc, .footable-desc')
? ($header.hasClass('footable-desc') ? 'ASC' : 'DESC')
: 'ASC';
self._sort($header.index(), direction);
}
});
/**
* Checks the supplied string is a valid direction and if not returns ASC as default.
* @static
* @protected
* @param {string} str - The string to check.
*/
F.Sorting.dir = function(str){
return F.is.string(str) && (str == 'ASC' || str == 'DESC') ? str : 'ASC';
};
F.components.core.register('sorting', F.Sorting, 5);
})(jQuery, FooTable);
(function(F){
/**
* The value used by the sorting component during sort operations. Can be set using the data-sort-value attribute on the cell itself.
* If this is not supplied it is set to the result of the toString method called on the value for the cell. Added by the {@link FooTable.Sorting} component.
* @type {string}
* @default null
*/
F.Cell.prototype.sortValue = null;
// this is used to define the sorting specific properties on cell creation
F.Cell.prototype.__sorting_define__ = function(valueOrElement){
this.sortValue = this.column.sortValue.call(this.column, valueOrElement);
};
// this is used to update the sortValue property whenever the cell value is changed
F.Cell.prototype.__sorting_val__ = function(value){
if (F.is.defined(value)){
// set only
this.sortValue = this.column.sortValue.call(this.column, value);
}
};
// overrides the public define method and replaces it with our own
F.Cell.extend('define', function(valueOrElement){
this._super(valueOrElement);
this.__sorting_define__(valueOrElement);
});
// overrides the public val method and replaces it with our own
F.Cell.extend('val', function(value){
var val = this._super(value);
this.__sorting_val__(value);
return val;
});
})(FooTable);
(function($, F){
/**
* The direction to sort if the {@link FooTable.Column#sorted} property is set to true. Can be "ASC", "DESC" or NULL. Added by the {@link FooTable.Sorting} component.
* @type {string}
* @default null
*/
F.Column.prototype.direction = null;
/**
* Whether or not the column can be sorted. Added by the {@link FooTable.Sorting} component.
* @type {boolean}
* @default true
*/
F.Column.prototype.sortable = true;
/**
* Whether or not the column is sorted. Added by the {@link FooTable.Sorting} component.
* @type {boolean}
* @default false
*/
F.Column.prototype.sorted = false;
/**
* This is supplied two values from the column for a comparison to be made and the result returned. Added by the {@link FooTable.Sorting} component.
* @param {*} a - The first value to be compared.
* @param {*} b - The second value to compare to the first.
* @returns {number}
* @example <caption>This example shows using pseudo code what a sort function would look like.</caption>
* "sorter": function(a, b){
* if (a is less than b by some ordering criterion) {
* return -1;
* }
* if (a is greater than b by the ordering criterion) {
* return 1;
* }
* // a must be equal to b
* return 0;
* }
*/
F.Column.prototype.sorter = function(a, b){
if (typeof a === 'string') a = a.toLowerCase();
if (typeof b === 'string') b = b.toLowerCase();
if (a === b) return 0;
if (a < b) return -1;
return 1;
};
/**
* This is supplied either the cell value or jQuery object to parse. A value must be returned from this method and will be used during sorting operations.
* @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
* @returns {*}
* @this FooTable.Column
*/
F.Column.prototype.sortValue = function(valueOrElement){
// if we have an element or a jQuery object use jQuery to get the value
if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)) return $(valueOrElement).data('sortValue') || this.parser(valueOrElement);
// if options are supplied with the value
if (F.is.hash(valueOrElement) && F.is.hash(valueOrElement.options)){
if (F.is.string(valueOrElement.options.sortValue)) return valueOrElement.options.sortValue;
if (F.is.defined(valueOrElement.value)) valueOrElement = valueOrElement.value;
}
if (F.is.defined(valueOrElement) && valueOrElement != null) return valueOrElement;
return null;
};
// this is used to define the sorting specific properties on column creation
F.Column.prototype.__sorting_define__ = function(definition){
this.sorter = F.checkFnValue(this, definition.sorter, this.sorter);
this.direction = F.is.type(definition.direction, 'string') ? F.Sorting.dir(definition.direction) : null;
this.sortable = F.is.boolean(definition.sortable) ? definition.sortable : true;
this.sorted = F.is.boolean(definition.sorted) ? definition.sorted : false;
};
// overrides the public define method and replaces it with our own
F.Column.extend('define', function(definition){
this._super(definition);
this.__sorting_define__(definition);
});
})(jQuery, FooTable);
(function(F){
/**
* An object containing the sorting options for the plugin. Added by the {@link FooTable.Sorting} component.
* @type {object}
* @prop {boolean} enabled=false - Whether or not to allow sorting on the table.
*/
F.Defaults.prototype.sorting = {
enabled: false
};
})(FooTable);
(function($, F){
F.HTMLColumn.extend('__sorting_define__', function(definition){
this._super(definition);
this.sortUse = F.is.string(definition.sortUse) && $.inArray(definition.sortUse, ['html','text']) !== -1 ? definition.sortUse : 'html';
});
/**
* This is supplied either the cell value or jQuery object to parse. A value must be returned from this method and will be used during sorting operations.
* @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
* @returns {*}
* @this FooTable.HTMLColumn
*/
F.HTMLColumn.prototype.sortValue = function(valueOrElement){
// if we have an element or a jQuery object use jQuery to get the data value or pass it off to the parser
if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
return $(valueOrElement).data('sortValue') || $.trim($(valueOrElement)[this.sortUse]());
}
// if options are supplied with the value
if (F.is.hash(valueOrElement) && F.is.hash(valueOrElement.options)){
if (F.is.string(valueOrElement.options.sortValue)) return valueOrElement.options.sortValue;
if (F.is.defined(valueOrElement.value)) valueOrElement = valueOrElement.value;
}
if (F.is.defined(valueOrElement) && valueOrElement != null) return valueOrElement;
return null;
};
})(jQuery, FooTable);
(function(F){
/**
* Sort the table using the specified column and direction. Added by the {@link FooTable.Sorting} component.
* @instance
* @param {(string|number|FooTable.Column)} column - The column name, index or the actual {@link FooTable.Column} object to sort by.
* @param {string} [direction="ASC"] - The direction to sort by, either ASC or DESC.
* @returns {jQuery.Promise}
* @fires FooTable.Sorting#"change.ft.sorting"
* @fires FooTable.Sorting#"changed.ft.sorting"
* @see FooTable.Sorting#sort
*/
F.Table.prototype.sort = function(column, direction){
return this.use(F.Sorting).sort(column, direction);
};
/*
* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
* @version 3.1.4
* @link http://fooplugins.com
* @copyright Steven Usher & Brad Vincent 2015
* @license Released under the GPLv3 license.
*/
(function($, F){
F.Sorter = F.Class.extend(/** @lends FooTable.Sorter */{
/**
* The sorter object contains the column and direction to sort by.
* @constructs
* @extends FooTable.Class
* @param {FooTable.Column} column - The column to sort.
* @param {string} direction - The direction to sort by.
* @returns {FooTable.Sorter}
*/
construct: function(column, direction){
/**
* The column to sort.
* @type {FooTable.Column}
*/
this.column = column;
/**
* The direction to sort by.
* @type {string}
*/
this.direction = direction;
}
});
})(jQuery, FooTable);
(function ($, F) {
F.Sorting = F.Component.extend(/** @lends FooTable.Sorting */{
/**
* The sorting component adds a small sort button to specified column headers allowing users to sort those columns in the table.
* @constructs
* @extends FooTable.Component
* @param {FooTable.Table} table - The parent {@link FooTable.Table} object for the component.
* @returns {FooTable.Sorting}
*/
construct: function (table) {
// call the constructor of the base class
this._super(table, table.o.sorting.enabled);
/* PROTECTED */
/**
* This provides a shortcut to the {@link FooTable.Table#options}.[sorting]{@link FooTable.Defaults#sorting} object.
* @instance
* @protected
* @type {object}
*/
this.o = table.o.sorting;
/**
* The current sorted column.
* @instance
* @type {FooTable.Column}
*/
this.column = null;
/**
* Whether or not to allow sorting to occur, should be set using the {@link FooTable.Sorting#toggleAllowed} method.
* @instance
* @type {boolean}
*/
this.allowed = true;
/**
* The initial sort state of the table, this value is used for determining if the sorting has occurred or to reset the state to default.
* @instance
* @type {{isset: boolean, rows: Array.<FooTable.Row>, column: string, direction: ?string}}
*/
this.initial = null;
},
/* PROTECTED */
/**
* Checks the supplied data and options for the sorting component.
* @instance
* @protected
* @param {object} data - The jQuery data object from the parent table.
* @fires FooTable.Sorting#"preinit.ft.sorting"
* @this FooTable.Sorting
*/
preinit: function(data){
var self = this;
/**
* The preinit.ft.sorting event is raised before the UI is created and provides the tables jQuery data object for additional options parsing.
* Calling preventDefault on this event will disable the component.
* @event FooTable.Sorting#"preinit.ft.sorting"
* @param {jQuery.Event} e - The jQuery.Event object for the event.
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
* @param {object} data - The jQuery data object of the table raising the event.
*/
this.ft.raise('preinit.ft.sorting', [data]).then(function(){
if (self.ft.$el.hasClass('footable-sorting'))
self.enabled = true;
self.enabled = F.is.boolean(data.sorting)
? data.sorting
: self.enabled;
if (!self.enabled) return;
self.column = F.arr.first(self.ft.columns.array, function(col){ return col.sorted; });
}, function(){
self.enabled = false;
});
},
/**
* Initializes the sorting component for the plugin using the supplied table and options.
* @instance
* @protected
* @fires FooTable.Sorting#"init.ft.sorting"
* @this FooTable.Sorting
*/
init: function () {
/**
* The init.ft.sorting event is raised before its UI is generated.
* Calling preventDefault on this event will disable the component.
* @event FooTable.Sorting#"init.ft.sorting"
* @param {jQuery.Event} e - The jQuery.Event object for the event.
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
*/
var self = this;
this.ft.raise('init.ft.sorting').then(function(){
if (!self.initial){
var isset = !!self.column;
self.initial = {
isset: isset,
// grab a shallow copy of the rows array prior to sorting - allows us to reset without an initial sort
rows: self.ft.rows.all.slice(0),
// if there is a sorted column store its name and direction
column: isset ? self.column.name : null,
direction: isset ? self.column.direction : null
}
}
F.arr.each(self.ft.columns.array, function(col){
if (col.sortable){
col.$el.addClass('footable-sortable').append($('<span/>', {'class': 'fooicon fooicon-sort'}));
}
});
self.ft.$el.on('click.footable', '.footable-sortable', { self: self }, self._onSortClicked);
}, function(){
self.enabled = false;
});
},
/**
* Destroys the sorting component removing any UI generated from the table.
* @instance
* @protected
* @fires FooTable.Sorting#"destroy.ft.sorting"
*/
destroy: function () {
/**
* The destroy.ft.sorting event is raised before its UI is removed.
* Calling preventDefault on this event will prevent the component from being destroyed.
* @event FooTable.Sorting#"destroy.ft.sorting"
* @param {jQuery.Event} e - The jQuery.Event object for the event.
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
*/
var self = this;
this.ft.raise('destroy.ft.paging').then(function(){
self.ft.$el.off('click.footable', '.footable-sortable', self._onSortClicked);
self.ft.$el.children('thead').children('tr.footable-header')
.children('.footable-sortable').removeClass('footable-sortable footable-asc footable-desc')
.find('span.fooicon').remove();
});
},
/**
* Performs the actual sorting against the {@link FooTable.Rows#current} array.
* @instance
* @protected
*/
predraw: function () {
if (!this.column) return;
var self = this, col = self.column;
self.ft.rows.array.sort(function (a, b) {
return col.direction == 'DESC'
? col.sorter(b.cells[col.index].sortValue, a.cells[col.index].sortValue)
: col.sorter(a.cells[col.index].sortValue, b.cells[col.index].sortValue);
});
},
/**
* Updates the sorting UI setting the state of the sort buttons.
* @instance
* @protected
*/
draw: function () {
if (!this.column) return;
var self = this,
$sortable = self.ft.$el.find('thead > tr > .footable-sortable'),
$active = self.column.$el;
$sortable.removeClass('footable-asc footable-desc').children('.fooicon').removeClass('fooicon-sort fooicon-sort-asc fooicon-sort-desc');
$sortable.not($active).children('.fooicon').addClass('fooicon-sort');
$active.addClass(self.column.direction == 'DESC' ? 'footable-desc' : 'footable-asc')
.children('.fooicon').addClass(self.column.direction == 'DESC' ? 'fooicon-sort-desc' : 'fooicon-sort-asc');
},
/* PUBLIC */
/**
* Sets the sorting options and calls the {@link FooTable.Table#draw} method to perform the actual sorting.
* @instance
* @param {(string|number|FooTable.Column)} column - The column name, index or the actual {@link FooTable.Column} object to sort by.
* @param {string} [direction="ASC"] - The direction to sort by, either ASC or DESC.
* @returns {jQuery.Promise}
* @fires FooTable.Sorting#"before.ft.sorting"
* @fires FooTable.Sorting#"after.ft.sorting"
*/
sort: function(column, direction){
return this._sort(column, direction);
},
/**
* Toggles whether or not sorting is currently allowed.
* @param {boolean} [state] - You can optionally specify the state you want it to be, if not supplied the current value is flipped.
*/
toggleAllowed: function(state){
state = F.is.boolean(state) ? state : !this.allowed;
this.allowed = state;
this.ft.$el.toggleClass('footable-sorting-disabled', !this.allowed);
},
/**
* Checks whether any sorting has occurred for the table.
* @returns {boolean}
*/
hasChanged: function(){
return !(!this.initial || !this.column ||
(this.column.name === this.initial.column &&
(this.column.direction === this.initial.direction || (this.initial.direction === null && this.column.direction === 'ASC')))
);
},
/**
* Resets the table sorting to the initial state recorded in the components init method.
*/
reset: function(){
if (!!this.initial){
if (this.initial.isset){
// if the initial value specified a column, sort by it
this.sort(this.initial.column, this.initial.direction);
} else {
// if there was no initial column then we need to reset the rows to there original order
if (!!this.column){
// if there is a currently sorted column remove the asc/desc classes and set it to null.
this.column.$el.removeClass('footable-asc footable-desc');
this.column = null;
}
// replace the current all rows array with the one stored in the initial value
this.ft.rows.all = this.initial.rows;
// force the table to redraw itself using the updated rows array
this.ft.draw();
}
}
},
/* PRIVATE */
/**
* Performs the required steps to handle sorting including the raising of the {@link FooTable.Sorting#"before.ft.sorting"} and {@link FooTable.Sorting#"after.ft.sorting"} events.
* @instance
* @private
* @param {(string|number|FooTable.Column)} column - The column name, index or the actual {@link FooTable.Column} object to sort by.
* @param {string} [direction="ASC"] - The direction to sort by, either ASC or DESC.
* @returns {jQuery.Promise}
* @fires FooTable.Sorting#"before.ft.sorting"
* @fires FooTable.Sorting#"after.ft.sorting"
*/
_sort: function(column, direction){
if (!this.allowed) return $.Deferred().reject('sorting disabled');
var self = this;
var sorter = new F.Sorter(self.ft.columns.get(column), F.Sorting.dir(direction));
/**
* The before.ft.sorting event is raised before a sort is applied and allows listeners to modify the sorter or cancel it completely by calling preventDefault on the jQuery.Event object.
* @event FooTable.Sorting#"before.ft.sorting"
* @param {jQuery.Event} e - The jQuery.Event object for the event.
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
* @param {FooTable.Sorter} sorter - The sorter that is about to be applied.
*/
return self.ft.raise('before.ft.sorting', [sorter]).then(function(){
F.arr.each(self.ft.columns.array, function(col){
if (col != self.column) col.direction = null;
});
self.column = self.ft.columns.get(sorter.column);
if (self.column) self.column.direction = F.Sorting.dir(sorter.direction);
return self.ft.draw().then(function(){
/**
* The after.ft.sorting event is raised after a sorter has been applied.
* @event FooTable.Sorting#"after.ft.sorting"
* @param {jQuery.Event} e - The jQuery.Event object for the event.
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
* @param {FooTable.Sorter} sorter - The sorter that has been applied.
*/
self.ft.raise('after.ft.sorting', [sorter]);
});
});
},
/**
* Handles the sort button clicked event.
* @instance
* @private
* @param {jQuery.Event} e - The event object for the event.
*/
_onSortClicked: function (e) {
var self = e.data.self, $header = $(this).closest('th,td'),
direction = $header.is('.footable-asc, .footable-desc')
? ($header.hasClass('footable-desc') ? 'ASC' : 'DESC')
: 'ASC';
self._sort($header.index(), direction);
}
});
/**
* Checks the supplied string is a valid direction and if not returns ASC as default.
* @static
* @protected
* @param {string} str - The string to check.
*/
F.Sorting.dir = function(str){
return F.is.string(str) && (str == 'ASC' || str == 'DESC') ? str : 'ASC';
};
F.components.register('sorting', F.Sorting, 600);
})(jQuery, FooTable);
(function(F){
/**
* The value used by the sorting component during sort operations. Can be set using the data-sort-value attribute on the cell itself.
* If this is not supplied it is set to the result of the toString method called on the value for the cell. Added by the {@link FooTable.Sorting} component.
* @type {string}
* @default null
*/
F.Cell.prototype.sortValue = null;
// this is used to define the sorting specific properties on cell creation
F.Cell.prototype.__sorting_define__ = function(valueOrElement){
this.sortValue = this.column.sortValue.call(this.column, valueOrElement);
};
// this is used to update the sortValue property whenever the cell value is changed
F.Cell.prototype.__sorting_val__ = function(value){
if (F.is.defined(value)){
// set only
this.sortValue = this.column.sortValue.call(this.column, value);
}
};
// overrides the public define method and replaces it with our own
F.Cell.extend('define', function(valueOrElement){
this._super(valueOrElement);
this.__sorting_define__(valueOrElement);
});
// overrides the public val method and replaces it with our own
F.Cell.extend('val', function(value){
var val = this._super(value);
this.__sorting_val__(value);
return val;
});
})(FooTable);
(function($, F){
/**
* The direction to sort if the {@link FooTable.Column#sorted} property is set to true. Can be "ASC", "DESC" or NULL. Added by the {@link FooTable.Sorting} component.
* @type {string}
* @default null
*/
F.Column.prototype.direction = null;
/**
* Whether or not the column can be sorted. Added by the {@link FooTable.Sorting} component.
* @type {boolean}
* @default true
*/
F.Column.prototype.sortable = true;
/**
* Whether or not the column is sorted. Added by the {@link FooTable.Sorting} component.
* @type {boolean}
* @default false
*/
F.Column.prototype.sorted = false;
/**
* This is supplied two values from the column for a comparison to be made and the result returned. Added by the {@link FooTable.Sorting} component.
* @param {*} a - The first value to be compared.
* @param {*} b - The second value to compare to the first.
* @returns {number}
* @example <caption>This example shows using pseudo code what a sort function would look like.</caption>
* "sorter": function(a, b){
* if (a is less than b by some ordering criterion) {
* return -1;
* }
* if (a is greater than b by the ordering criterion) {
* return 1;
* }
* // a must be equal to b
* return 0;
* }
*/
F.Column.prototype.sorter = function(a, b){
if (typeof a === 'string') a = a.toLowerCase();
if (typeof b === 'string') b = b.toLowerCase();
if (a === b) return 0;
if (a < b) return -1;
return 1;
};
/**
* This is supplied either the cell value or jQuery object to parse. A value must be returned from this method and will be used during sorting operations.
* @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
* @returns {*}
* @this FooTable.Column
*/
F.Column.prototype.sortValue = function(valueOrElement){
// if we have an element or a jQuery object use jQuery to get the value
if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
var data = $(valueOrElement).data('sortValue');
return F.is.defined(data) ? data : this.parser(valueOrElement);
}
// if options are supplied with the value
if (F.is.hash(valueOrElement) && F.is.hash(valueOrElement.options)){
if (F.is.string(valueOrElement.options.sortValue)) return valueOrElement.options.sortValue;
if (F.is.defined(valueOrElement.value)) valueOrElement = valueOrElement.value;
}
if (F.is.defined(valueOrElement) && valueOrElement != null) return valueOrElement;
return null;
};
// this is used to define the sorting specific properties on column creation
F.Column.prototype.__sorting_define__ = function(definition){
this.sorter = F.checkFnValue(this, definition.sorter, this.sorter);
this.direction = F.is.type(definition.direction, 'string') ? F.Sorting.dir(definition.direction) : null;
this.sortable = F.is.boolean(definition.sortable) ? definition.sortable : true;
this.sorted = F.is.boolean(definition.sorted) ? definition.sorted : false;
this.sortValue = F.checkFnValue(this, definition.sortValue, this.sortValue);
};
// overrides the public define method and replaces it with our own
F.Column.extend('define', function(definition){
this._super(definition);
this.__sorting_define__(definition);
});
})(jQuery, FooTable);
(function(F){
/**
* An object containing the sorting options for the plugin. Added by the {@link FooTable.Sorting} component.
* @type {object}
* @prop {boolean} enabled=false - Whether or not to allow sorting on the table.
*/
F.Defaults.prototype.sorting = {
enabled: false
};
})(FooTable);
(function($, F){
F.HTMLColumn.extend('__sorting_define__', function(definition){
this._super(definition);
this.sortUse = F.is.string(definition.sortUse) && $.inArray(definition.sortUse, ['html','text']) !== -1 ? definition.sortUse : 'html';
});
/**
* This is supplied either the cell value or jQuery object to parse. A value must be returned from this method and will be used during sorting operations.
* @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
* @returns {*}
* @this FooTable.HTMLColumn
*/
F.HTMLColumn.prototype.sortValue = function(valueOrElement){
// if we have an element or a jQuery object use jQuery to get the data value or pass it off to the parser
if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
var data = $(valueOrElement).data('sortValue');
return F.is.defined(data) ? data : $.trim($(valueOrElement)[this.sortUse]());
}
// if options are supplied with the value
if (F.is.hash(valueOrElement) && F.is.hash(valueOrElement.options)){
if (F.is.string(valueOrElement.options.sortValue)) return valueOrElement.options.sortValue;
if (F.is.defined(valueOrElement.value)) valueOrElement = valueOrElement.value;
}
if (F.is.defined(valueOrElement) && valueOrElement != null) return valueOrElement;
return null;
};
})(jQuery, FooTable);
(function(F){
/**
* Sort the table using the specified column and direction. Added by the {@link FooTable.Sorting} component.
* @instance
* @param {(string|number|FooTable.Column)} column - The column name, index or the actual {@link FooTable.Column} object to sort by.
* @param {string} [direction="ASC"] - The direction to sort by, either ASC or DESC.
* @returns {jQuery.Promise}
* @fires FooTable.Sorting#"change.ft.sorting"
* @fires FooTable.Sorting#"changed.ft.sorting"
* @see FooTable.Sorting#sort
*/
F.Table.prototype.sort = function(column, direction){
return this.use(F.Sorting).sort(column, direction);
};
})(FooTable);

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,362 @@
/*
* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
* @version 3.1.4
* @link http://fooplugins.com
* @copyright Steven Usher & Brad Vincent 2015
* @license Released under the GPLv3 license.
*/
(function($, F){
// global int to use if the table has no ID
var _uid = 0,
// a hash value for the current url
_url_hash = (function(str){
var i, l, hval = 0x811c9dc5;
for (i = 0, l = str.length; i < l; i++) {
hval ^= str.charCodeAt(i);
hval += (hval << 1) + (hval << 4) + (hval << 7) + (hval << 8) + (hval << 24);
}
return hval >>> 0;
})(location.origin + location.pathname);
F.State = F.Component.extend(/** @lends FooTable.State */{
/**
* The state component adds the ability for the table to remember its basic state for filtering, paging and sorting.
* @constructs
* @extends FooTable.Component
* @param {FooTable.Table} table - The parent {@link FooTable.Table} object for the component.
* @returns {FooTable.State}
*/
construct: function(table){
// call the constructor of the base class
this._super(table, table.o.state.enabled);
// Change this value if an update to this component requires any stored data to be reset
this._key = '1';
/**
* The key to use to store the state for this table.
* @type {(null|string)}
*/
this.key = this._key + (F.is.string(table.o.state.key) ? table.o.state.key : this._uid());
/**
* Whether or not to allow the filtering component to store it's state.
* @type {boolean}
*/
this.filtering = F.is.boolean(table.o.state.filtering) ? table.o.state.filtering : true;
/**
* Whether or not to allow the paging component to store it's state.
* @type {boolean}
*/
this.paging = F.is.boolean(table.o.state.paging) ? table.o.state.paging : true;
/**
* Whether or not to allow the sorting component to store it's state.
* @type {boolean}
*/
this.sorting = F.is.boolean(table.o.state.sorting) ? table.o.state.sorting : true;
},
/* PROTECTED */
/**
* Checks the supplied data and options for the state component.
* @instance
* @protected
* @param {object} data - The jQuery data object from the parent table.
* @fires FooTable.State#"preinit.ft.state"
* @this FooTable.State
*/
preinit: function(data){
var self = this;
/**
* The preinit.ft.state event is raised before the UI is created and provides the tables jQuery data object for additional options parsing.
* Calling preventDefault on this event will disable the component.
* @event FooTable.State#"preinit.ft.state"
* @param {jQuery.Event} e - The jQuery.Event object for the event.
* @param {FooTable.Table} ft - The instance of the plugin raising the event.
* @param {object} data - The jQuery data object of the table raising the event.
*/
this.ft.raise('preinit.ft.state', [data]).then(function(){
self.enabled = F.is.boolean(data.state)
? data.state
: self.enabled;
if (!self.enabled) return;
self.key = self._key + (F.is.string(data.stateKey) ? data.stateKey : self.key);
self.filtering = F.is.boolean(data.stateFiltering) ? data.stateFiltering : self.filtering;
self.paging = F.is.boolean(data.statePaging) ? data.statePaging : self.paging;
self.sorting = F.is.boolean(data.stateSorting) ? data.stateSorting : self.sorting;
}, function(){
self.enabled = false;
});
},
/**
* Gets the state value for the specified key for this table.
* @instance
* @param {string} key - The key to get the value for.
* @returns {(*|null)}
*/
get: function(key){
return JSON.parse(localStorage.getItem(this.key + ':' + key));
},
/**
* Sets the state value for the specified key for this table.
* @instance
* @param {string} key - The key to set the value for.
* @param {*} data - The value to store for the key. This value must be JSON.stringify friendly.
*/
set: function(key, data){
localStorage.setItem(this.key + ':' + key, JSON.stringify(data));
},
/**
* Clears the state value for the specified key for this table.
* @instance
* @param {string} key - The key to clear the value for.
*/
remove: function(key){
localStorage.removeItem(this.key + ':' + key);
},
/**
* Executes the {@link FooTable.Component#readState} function on all components.
* @instance
*/
read: function(){
this.ft.execute(false, true, 'readState');
},
/**
* Executes the {@link FooTable.Component#writeState} function on all components.
* @instance
*/
write: function(){
this.ft.execute(false, true, 'writeState');
},
/**
* Executes the {@link FooTable.Component#clearState} function on all components.
* @instance
*/
clear: function(){
this.ft.execute(false, true, 'clearState');
},
/**
* Generates a unique identifier for the current {@link FooTable.Table} if one is not supplied through the options.
* This value is a combination of the url hash and either the element ID or an incremented global int value.
* @instance
* @returns {*}
* @private
*/
_uid: function(){
var id = this.ft.$el.attr('id');
return _url_hash + '_' + (F.is.string(id) ? id : ++_uid);
}
});
F.components.register('state', F.State, 700);
})(jQuery, FooTable);
(function(F){
/**
* This method is called from the {@link FooTable.State#read} method and allows a component to retrieve its' stored state.
* @instance
* @protected
* @function
*/
F.Component.prototype.readState = function(){};
/**
* This method is called from the {@link FooTable.State#write} method and allows a component to write its' current state to the store.
* @instance
* @protected
* @function
*/
F.Component.prototype.writeState = function(){};
/**
* This method is called from the {@link FooTable.State#clear} method and allows a component to clear any stored state.
* @instance
* @protected
* @function
*/
F.Component.prototype.clearState = function(){};
})(FooTable);
(function(F){
/**
* An object containing the state options for the plugin. Added by the {@link FooTable.State} component.
* @type {object}
* @prop {boolean} enabled=false - Whether or not to allow state to be stored for the table. This overrides the individual component enable options.
* @prop {boolean} filtering=true - Whether or not to allow the filtering state to be stored.
* @prop {boolean} paging=true - Whether or not to allow the filtering state to be stored.
* @prop {boolean} sorting=true - Whether or not to allow the filtering state to be stored.
* @prop {string} key=null - The unique key to use to store the table's data.
*/
F.Defaults.prototype.state = {
enabled: false,
filtering: true,
paging: true,
sorting: true,
key: null
};
})(FooTable);
(function(F){
if (!F.Filtering) return;
/**
* Allows the filtering component to retrieve its' stored state.
*/
F.Filtering.prototype.readState = function(){
if (this.ft.state.filtering){
var state = this.ft.state.get('filtering');
if (F.is.hash(state) && !F.is.emptyArray(state.filters)){
this.filters = this.ensure(state.filters);
}
}
};
/**
* Allows the filtering component to write its' current state to the store.
*/
F.Filtering.prototype.writeState = function(){
if (this.ft.state.filtering) {
var filters = F.arr.map(this.filters, function (f) {
return {
name: f.name,
query: f.query instanceof F.Query ? f.query.val() : f.query,
columns: F.arr.map(f.columns, function (c) {
return c.name;
}),
hidden: f.hidden,
space: f.space,
connectors: f.connectors,
ignoreCase: f.ignoreCase
};
});
this.ft.state.set('filtering', {filters: filters});
}
};
/**
* Allows the filtering component to clear any stored state.
*/
F.Filtering.prototype.clearState = function(){
if (this.ft.state.filtering) {
this.ft.state.remove('filtering');
}
};
})(FooTable);
(function(F){
if (!F.Paging) return;
/**
* Allows the paging component to retrieve its' stored state.
*/
F.Paging.prototype.readState = function(){
if (this.ft.state.paging) {
var state = this.ft.state.get('paging');
if (F.is.hash(state)) {
this.current = state.current;
this.size = state.size;
}
}
};
/**
* Allows the paging component to write its' current state to the store.
*/
F.Paging.prototype.writeState = function(){
if (this.ft.state.paging) {
this.ft.state.set('paging', {
current: this.current,
size: this.size
});
}
};
/**
* Allows the paging component to clear any stored state.
*/
F.Paging.prototype.clearState = function(){
if (this.ft.state.paging) {
this.ft.state.remove('paging');
}
};
})(FooTable);
(function(F){
if (!F.Sorting) return;
/**
* Allows the sorting component to retrieve its' stored state.
*/
F.Sorting.prototype.readState = function(){
if (this.ft.state.sorting) {
var state = this.ft.state.get('sorting');
if (F.is.hash(state)) {
var column = this.ft.columns.get(state.column);
if (column instanceof F.Column) {
this.column = column;
this.column.direction = state.direction;
}
}
}
};
/**
* Allows the sorting component to write its' current state to the store.
*/
F.Sorting.prototype.writeState = function(){
if (this.ft.state.sorting && this.column instanceof F.Column){
this.ft.state.set('sorting', {
column: this.column.name,
direction: this.column.direction
});
}
};
/**
* Allows the sorting component to clear any stored state.
*/
F.Sorting.prototype.clearState = function(){
if (this.ft.state.sorting) {
this.ft.state.remove('sorting');
}
};
})(FooTable);
(function(F){
// hook into the _construct method so we can add the state property to the table.
F.Table.extend('_construct', function(ready){
this.state = this.use(FooTable.State);
this._super(ready);
});
// hook into the _preinit method so we can trigger a plugin wide read state operation.
F.Table.extend('_preinit', function(){
var self = this;
return self._super().then(function(){
if (self.state.enabled){
self.state.read();
}
});
});
// hook into the draw method so we can trigger a plugin wide write state operation.
F.Table.extend('draw', function(){
var self = this;
return self._super().then(function(){
if (self.state.enabled){
self.state.write();
}
});
});
})(FooTable);

View File

@ -0,0 +1,8 @@
/*
* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
* @version 3.1.4
* @link http://fooplugins.com
* @copyright Steven Usher & Brad Vincent 2015
* @license Released under the GPLv3 license.
*/
!function(a,b){var c=0,d=function(a){var b,c,d=2166136261;for(b=0,c=a.length;c>b;b++)d^=a.charCodeAt(b),d+=(d<<1)+(d<<4)+(d<<7)+(d<<8)+(d<<24);return d>>>0}(location.origin+location.pathname);b.State=b.Component.extend({construct:function(a){this._super(a,a.o.state.enabled),this._key="1",this.key=this._key+(b.is.string(a.o.state.key)?a.o.state.key:this._uid()),this.filtering=b.is["boolean"](a.o.state.filtering)?a.o.state.filtering:!0,this.paging=b.is["boolean"](a.o.state.paging)?a.o.state.paging:!0,this.sorting=b.is["boolean"](a.o.state.sorting)?a.o.state.sorting:!0},preinit:function(a){var c=this;this.ft.raise("preinit.ft.state",[a]).then(function(){c.enabled=b.is["boolean"](a.state)?a.state:c.enabled,c.enabled&&(c.key=c._key+(b.is.string(a.stateKey)?a.stateKey:c.key),c.filtering=b.is["boolean"](a.stateFiltering)?a.stateFiltering:c.filtering,c.paging=b.is["boolean"](a.statePaging)?a.statePaging:c.paging,c.sorting=b.is["boolean"](a.stateSorting)?a.stateSorting:c.sorting)},function(){c.enabled=!1})},get:function(a){return JSON.parse(localStorage.getItem(this.key+":"+a))},set:function(a,b){localStorage.setItem(this.key+":"+a,JSON.stringify(b))},remove:function(a){localStorage.removeItem(this.key+":"+a)},read:function(){this.ft.execute(!1,!0,"readState")},write:function(){this.ft.execute(!1,!0,"writeState")},clear:function(){this.ft.execute(!1,!0,"clearState")},_uid:function(){var a=this.ft.$el.attr("id");return d+"_"+(b.is.string(a)?a:++c)}}),b.components.register("state",b.State,700)}(jQuery,FooTable),function(a){a.Component.prototype.readState=function(){},a.Component.prototype.writeState=function(){},a.Component.prototype.clearState=function(){}}(FooTable),function(a){a.Defaults.prototype.state={enabled:!1,filtering:!0,paging:!0,sorting:!0,key:null}}(FooTable),function(a){a.Filtering&&(a.Filtering.prototype.readState=function(){if(this.ft.state.filtering){var b=this.ft.state.get("filtering");a.is.hash(b)&&!a.is.emptyArray(b.filters)&&(this.filters=this.ensure(b.filters))}},a.Filtering.prototype.writeState=function(){if(this.ft.state.filtering){var b=a.arr.map(this.filters,function(b){return{name:b.name,query:b.query instanceof a.Query?b.query.val():b.query,columns:a.arr.map(b.columns,function(a){return a.name}),hidden:b.hidden,space:b.space,connectors:b.connectors,ignoreCase:b.ignoreCase}});this.ft.state.set("filtering",{filters:b})}},a.Filtering.prototype.clearState=function(){this.ft.state.filtering&&this.ft.state.remove("filtering")})}(FooTable),function(a){a.Paging&&(a.Paging.prototype.readState=function(){if(this.ft.state.paging){var b=this.ft.state.get("paging");a.is.hash(b)&&(this.current=b.current,this.size=b.size)}},a.Paging.prototype.writeState=function(){this.ft.state.paging&&this.ft.state.set("paging",{current:this.current,size:this.size})},a.Paging.prototype.clearState=function(){this.ft.state.paging&&this.ft.state.remove("paging")})}(FooTable),function(a){a.Sorting&&(a.Sorting.prototype.readState=function(){if(this.ft.state.sorting){var b=this.ft.state.get("sorting");if(a.is.hash(b)){var c=this.ft.columns.get(b.column);c instanceof a.Column&&(this.column=c,this.column.direction=b.direction)}}},a.Sorting.prototype.writeState=function(){this.ft.state.sorting&&this.column instanceof a.Column&&this.ft.state.set("sorting",{column:this.column.name,direction:this.column.direction})},a.Sorting.prototype.clearState=function(){this.ft.state.sorting&&this.ft.state.remove("sorting")})}(FooTable),function(a){a.Table.extend("_construct",function(a){this.state=this.use(FooTable.State),this._super(a)}),a.Table.extend("_preinit",function(){var a=this;return a._super().then(function(){a.state.enabled&&a.state.read()})}),a.Table.extend("draw",function(){var a=this;return a._super().then(function(){a.state.enabled&&a.state.write()})})}(FooTable);

View File

@ -10,7 +10,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.2.0
@version 2.3.0
@created 30th April, 2015
@package Component Builder
@subpackage compiler.php
@ -46,6 +46,7 @@ class Compiler extends Infusion
protected $dynamicIntegration = false;
protected $backupPath = false;
protected $gitPath = false;
protected $addCustomCodeAt = array();
/**
* Constructor
@ -101,6 +102,13 @@ class Compiler extends Infusion
}
// check if we have custom code to add
$this->getCustomCode();
// now add the other custom code by placeholder
if (ComponentbuilderHelper::checkArray($this->addCustomCodeAt))
{
// load error messages incase code can not be added
$app = JFactory::getApplication();
$this->addCustomCodeViaPlaceholders($app);
}
// now insert into the new files
if (ComponentbuilderHelper::checkArray($this->customCode))
{
@ -166,12 +174,16 @@ class Compiler extends Infusion
{
list($wast,$code) = explode('###BOM###',$string);
$answer = str_replace(array_keys($this->fileContentStatic),array_values($this->fileContentStatic),$php.$bom.$code);
// add custom Code by placeholder if found
$this->getPlaceHolderKeys($static['path'], $answer);
// add to zip array
$this->writeFile($static['path'],$answer);
}
else
{
$answer = str_replace(array_keys($this->fileContentStatic),array_values($this->fileContentStatic),$string);
// add custom Code by placeholder if found
$this->getPlaceHolderKeys($static['path'], $answer);
// add to zip array
$this->writeFile($static['path'],$answer);
}
@ -203,6 +215,8 @@ class Compiler extends Infusion
list($bin,$code) = explode('###BOM###',$string);
$answer = str_replace(array_keys($this->fileContentStatic),array_values($this->fileContentStatic),$php.$bom.$code);
$answer = str_replace(array_keys($this->fileContentDynamic[$view]),array_values($this->fileContentDynamic[$view]),$answer);
// add custom Code by placeholder if found
$this->getPlaceHolderKeys($file['path'], $answer, $view);
// add to zip array
$this->writeFile($file['path'],$answer);
}
@ -210,6 +224,8 @@ class Compiler extends Infusion
{
$answer = str_replace(array_keys($this->fileContentStatic),array_values($this->fileContentStatic),$string);
$answer = str_replace(array_keys($this->fileContentDynamic[$view]),array_values($this->fileContentDynamic[$view]),$answer);
// add custom Code by placeholder if found
$this->getPlaceHolderKeys($file['path'], $answer, $view);
// add to zip array
$this->writeFile($file['path'],$answer);
}
@ -241,6 +257,29 @@ class Compiler extends Infusion
}
return false;
}
protected function getPlaceHolderKeys(&$file, &$content, &$view = '')
{
// check if line has custom code place holder
if (strpos($content, '[CUSTO'.'MCODE=') !== false)
{
if (!isset($this->addCustomCodeAt[$file]))
{
$this->addCustomCodeAt[$file] = array();
$this->addCustomCodeAt[$file]['ids'] = array();
$this->addCustomCodeAt[$file]['replace'] = array();
$this->addCustomCodeAt[$file]['view'] = $view;
}
$found = ComponentbuilderHelper::getAllBetween($content, '[CUSTO'.'MCODE=', ']');
if (ComponentbuilderHelper::checkArray($found))
{
foreach ($found as $id)
{
$this->addCustomCodeAt[$file]['ids'][$id] = $id;
}
}
}
}
protected function freeMemory()
{
@ -591,6 +630,63 @@ class Compiler extends Infusion
return false;
}
protected function addCustomCodeViaPlaceholders($app)
{
// reset all these
unset($this->placeholders['###view###']);
unset($this->placeholders['###VIEW###']);
unset($this->placeholders['###View###']);
unset($this->placeholders['[[[view]]]']);
unset($this->placeholders['[[[VIEW]]]']);
unset($this->placeholders['[[[View]]]']);
unset($this->placeholders['###views###']);
unset($this->placeholders['###VIEWS###']);
unset($this->placeholders['###Views###']);
unset($this->placeholders['[[[views]]]']);
unset($this->placeholders['[[[VIEWS]]]']);
unset($this->placeholders['[[[Views]]]']);
unset($this->placeholders['###SView###']);
unset($this->placeholders['###sview###']);
unset($this->placeholders['###SVIEW###']);
unset($this->placeholders['[[[SView]]]']);
unset($this->placeholders['[[[sview]]]']);
unset($this->placeholders['[[[SVIEW]]]']);
unset($this->placeholders['###SViews###']);
unset($this->placeholders['###sviews###']);
unset($this->placeholders['###SVIEWS###']);
unset($this->placeholders['[[[SViews]]]']);
unset($this->placeholders['[[[sviews]]]']);
unset($this->placeholders['[[[SVIEWS]]]']);
foreach ($this->addCustomCodeAt as $path => $item)
{
if (ComponentbuilderHelper::checkString($item['view']))
{
$this->placeholders['[[[view]]]'] = $item['view'];
}
elseif (isset($this->placeholders['[[[view]]]']))
{
unset($this->placeholders['[[[view]]]']);
}
if ($this->getCustomCode($item['ids']))
{
$code = array();
foreach($this->customCode as $item)
{
$placeholder = $this->getPlaceHolder(2, $item['id']);
$code['[CUSTOM'.'CODE='.$item['id'].']'] = $placeholder['start'] . PHP_EOL . str_replace(array_keys($this->placeholders),array_values($this->placeholders),$item['code']) . $placeholder['end'];
}
// now update the file
$string = JFile::read($path);
$answer = str_replace(array_keys($code),array_values($code),$string);
$this->writeFile($path,$answer);
}
else
{
$app->enqueueMessage(JText::sprintf('Custom code could not be added to <b>%s</b> <br />Since there where no publish code returned from the database.', $path), 'warning');
}
}
}
protected function addCustomCode($app)
{
foreach($this->customCode as $nr => $target)
@ -687,7 +783,7 @@ class Compiler extends Infusion
if ($found)
{
$placeholder = $this->getPlaceHolder($target['type'], $target['id']);
$data = $placeholder['start'] . "\n" . $target['code'] . $placeholder['end'];
$data = $placeholder['start'] . PHP_EOL . $target['code'] . $placeholder['end'];
if ($target['type'] == 2)
{
// found it now add code from the next line
@ -696,20 +792,20 @@ class Compiler extends Infusion
elseif ($target['type'] == 1 && $foundEnd)
{
// found it now add code from the next line
$this->addDataToFile($file, $data . "\n", $bites, (int) array_sum($replace));
$this->addDataToFile($file, $data . PHP_EOL, $bites, (int) array_sum($replace));
}
else
{
// Load escaped code since the target endhash has changed
$this->loadEscapedCode($file, $target, $lineBites);
$app->enqueueMessage(JText::sprintf('Custom code could not be added to <b>%s</b> please review the file at line %s. This could be due to a change to lines below the custom code.', $target['path'], $target['from_line']), 'warning');
$app->enqueueMessage(JText::sprintf('Custom code could not be added to <b>%s</b> please review the file at <b>line %s</b>. This could be due to a change to lines below the custom code.', $target['path'], $target['from_line']), 'warning');
}
}
else
{
// Load escaped code since the target hash has changed
$this->loadEscapedCode($file, $target, $lineBites);
$app->enqueueMessage(JText::sprintf('Custom code could not be added to <b>%s</b> please review the file at line %s. This could be due to a change to lines above the custom code.', $target['path'], $target['from_line']), 'warning');
$app->enqueueMessage(JText::sprintf('Custom code could not be added to <b>%s</b> please review the file at <b>line %s</b>. This could be due to a change to lines above the custom code.', $target['path'], $target['from_line']), 'warning');
}
}
else
@ -724,12 +820,12 @@ class Compiler extends Infusion
protected function loadEscapedCode($file, $target, $lineBites)
{
// escape the code
$code = explode("\n", $target['code']);
$code = "\n// " .implode("\n// ",$code). "\n";
$code = explode(PHP_EOL, $target['code']);
$code = PHP_EOL."// " .implode(PHP_EOL."// ",$code). PHP_EOL;
// get place holders
$placeholder = $this->getPlaceHolder($target['type'], $target['id']);
// build the data
$data = $placeholder['start'] . $code . $placeholder['end']. "\n";
$data = $placeholder['start'] . $code . $placeholder['end']. PHP_EOL;
// get the bites before insertion
$bitBucket = array();
foreach($lineBites as $line => $value)

View File

@ -10,7 +10,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.2.0
@version 2.3.0
@created 30th April, 2015
@package Component Builder
@subpackage compiler.php
@ -95,6 +95,13 @@ class Get
*/
protected $newCustomCode = array();
/**
* The index of code already loaded
*
* @var array
*/
protected $codeAreadyDone = array();
/**
* The Language prefix
*
@ -706,7 +713,7 @@ class Get
if ($component->add_php_helper_admin == 1)
{
$this->lang = 'admin';
$this->customScriptBuilder['component_php_helper_admin'] = "\n\n".$this->setCustomContentLang(base64_decode($component->php_helper_admin));
$this->customScriptBuilder['component_php_helper_admin'] = PHP_EOL.PHP_EOL.$this->setCustomContentLang(base64_decode($component->php_helper_admin));
}
else
{
@ -728,7 +735,7 @@ class Get
if ($component->add_php_helper_both == 1)
{
$this->lang = 'both';
$this->customScriptBuilder['component_php_helper_both'] = "\n\n".$this->setCustomContentLang(base64_decode($component->php_helper_both));
$this->customScriptBuilder['component_php_helper_both'] = PHP_EOL.PHP_EOL.$this->setCustomContentLang(base64_decode($component->php_helper_both));
}
else
{
@ -738,7 +745,7 @@ class Get
if ($component->add_php_helper_site == 1)
{
$this->lang = 'site';
$this->customScriptBuilder['component_php_helper_site'] = "\n\n".$this->setCustomContentLang(base64_decode($component->php_helper_site));
$this->customScriptBuilder['component_php_helper_site'] = PHP_EOL.PHP_EOL.$this->setCustomContentLang(base64_decode($component->php_helper_site));
}
else
{
@ -1535,7 +1542,7 @@ class Get
$this->_fieldData[$id]->javascript_view_footer = $this->setCustomContentLang(base64_decode($this->_fieldData[$id]->javascript_view_footer));
$this->_fieldData[$id]->javascript_view_footer_decoded = true;
}
$this->customScriptBuilder['view_footer'][$name_single] .= "\n".$this->_fieldData[$id]->javascript_view_footer;
$this->customScriptBuilder['view_footer'][$name_single] .= PHP_EOL.$this->_fieldData[$id]->javascript_view_footer;
if (strpos($this->_fieldData[$id]->javascript_view_footer,"token") !== false && strpos($this->_fieldData[$id]->javascript_view_footer,"task=ajax") !== false)
{
if (!isset($this->customScriptBuilder['token'][$name_single]) || !$this->customScriptBuilder['token'][$name_single])
@ -1565,7 +1572,7 @@ class Get
$this->_fieldData[$id]->css_view = base64_decode($this->_fieldData[$id]->css_view);
$this->_fieldData[$id]->css_view_decoded = true;
}
$this->customScriptBuilder['css_view'][$name_single] .= "\n".$this->_fieldData[$id]->css_view;
$this->customScriptBuilder['css_view'][$name_single] .= PHP_EOL.$this->_fieldData[$id]->css_view;
}
// add this only once to view.
@ -1674,7 +1681,7 @@ class Get
{
$this->customScriptBuilder[$this->target.'_php_before_getitem'][$view_code] = '';
}
$this->customScriptBuilder[$this->target.'_php_before_getitem'][$view_code] .= "\n\n".base64_decode($result->php_before_getitem);
$this->customScriptBuilder[$this->target.'_php_before_getitem'][$view_code] .= PHP_EOL.PHP_EOL.base64_decode($result->php_before_getitem);
unset($result->php_before_getitem);
}
// add php custom scripting (php_after_getitem)
@ -1684,7 +1691,7 @@ class Get
{
$this->customScriptBuilder[$this->target.'_php_after_getitem'][$view_code] = '';
}
$this->customScriptBuilder[$this->target.'_php_after_getitem'][$view_code] .= "\n\n".base64_decode($result->php_after_getitem);
$this->customScriptBuilder[$this->target.'_php_after_getitem'][$view_code] .= PHP_EOL.PHP_EOL.base64_decode($result->php_after_getitem);
unset($result->php_after_getitem);
}
// add php custom scripting (php_before_getitems)
@ -1694,7 +1701,7 @@ class Get
{
$this->customScriptBuilder[$this->target.'_php_before_getitems'][$view_code] = '';
}
$this->customScriptBuilder[$this->target.'_php_before_getitems'][$view_code] .= "\n\n".base64_decode($result->php_before_getitems);
$this->customScriptBuilder[$this->target.'_php_before_getitems'][$view_code] .= PHP_EOL.PHP_EOL.base64_decode($result->php_before_getitems);
unset($result->php_before_getitems);
}
// add php custom scripting (php_after_getitems)
@ -1704,7 +1711,7 @@ class Get
{
$this->customScriptBuilder[$this->target.'_php_after_getitems'][$view_code] = '';
}
$this->customScriptBuilder[$this->target.'_php_after_getitems'][$view_code] .= "\n\n".base64_decode($result->php_after_getitems);
$this->customScriptBuilder[$this->target.'_php_after_getitems'][$view_code] .= PHP_EOL.PHP_EOL.base64_decode($result->php_after_getitems);
unset($result->php_after_getitems);
}
// add php custom scripting (php_getlistquery)
@ -1714,7 +1721,7 @@ class Get
{
$this->customScriptBuilder[$this->target.'_php_getlistquery'][$view_code] = '';
}
$this->customScriptBuilder[$this->target.'_php_getlistquery'][$view_code] .= "\n".base64_decode($result->php_getlistquery);
$this->customScriptBuilder[$this->target.'_php_getlistquery'][$view_code] .= PHP_EOL.base64_decode($result->php_getlistquery);
unset($result->php_getlistquery);
}
// set the getmethod code name
@ -2256,7 +2263,7 @@ class Get
}
if (ComponentbuilderHelper::checkArray($gets) && ComponentbuilderHelper::checkArray($keys))
{
$querySelect = '$query->select($db->quoteName('."\n\t\t\t".'array('.implode(',',$gets).'),'."\n\t\t\t".'array('.implode(',',$keys).')));';
$querySelect = '$query->select($db->quoteName('.PHP_EOL."\t\t\t".'array('.implode(',',$gets).'),'.PHP_EOL."\t\t\t".'array('.implode(',',$keys).')));';
$queryFrom = '$db->quoteName('.$db->quote($table).', '.$db->quote($as).')';
// return the select query
return array('select' => $querySelect, 'from' => $queryFrom, 'name' => $queryName, 'table' => $table, 'type' => $type, 'select_gets' => $gets, 'select_keys' => $keys);
@ -2390,9 +2397,9 @@ class Get
$data = $db->loadObjectList();
// start building the MySql dump
$dump = "--";
$dump .= "\n-- Dumping data for table `#__[[[component]]]_".$view."`";
$dump .= "\n--";
$dump .= "\n\nINSERT INTO `#__[[[component]]]_".$view."` (";
$dump .= PHP_EOL."-- Dumping data for table `#__[[[component]]]_".$view."`";
$dump .= PHP_EOL."--";
$dump .= PHP_EOL.PHP_EOL."INSERT INTO `#__[[[component]]]_".$view."` (";
foreach ($data as $line)
{
$comaSet = 0;
@ -2416,11 +2423,11 @@ class Get
{
if ($coma == 0)
{
$dump .= "\n(";
$dump .= PHP_EOL."(";
}
else
{
$dump .= ",\n(";
$dump .= ",".PHP_EOL."(";
}
$comaSet = 0;
foreach($line as $fieldName => $fieldValue)
@ -2596,17 +2603,27 @@ class Get
* @return void
*
*/
public function getCustomCode()
public function getCustomCode($ids = null)
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.code','a.component','a.from_line','a.hashtarget','a.hashendtarget','a.path','a.to_line','a.type')));
$query->from($db->quoteName('#__componentbuilder_custom_code','a'));
$query->where($db->quoteName('a.component') . ' = '. (int) $this->componentData->id);
if ($ids)
{
$query->select($db->quoteName(array('a.id','a.code')));
$query->where($db->quoteName('a.id') . ' IN (' . implode(',',$ids) . ')');
$query->where($db->quoteName('a.target') . ' = 2'); // <--- to load the correct target
}
else
{
$query->select($db->quoteName(array('a.id','a.code','a.component','a.from_line','a.hashtarget','a.hashendtarget','a.path','a.to_line','a.type')));
$query->where($db->quoteName('a.component') . ' = '. (int) $this->componentData->id);
$query->where($db->quoteName('a.target') . ' = 1'); // <--- to load the correct target
$query->order($db->quoteName('a.from_line') . ' ASC'); // <--- insrue we always add code from top of file
}
$query->where($db->quoteName('a.published') . ' >= 1');
$query->order($db->quoteName('a.from_line') . ' ASC'); // <--- insrue we always add code from top of file
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
@ -2616,12 +2633,16 @@ class Get
foreach($this->customCode as $nr => &$customCode)
{
$customCode['code'] = base64_decode($customCode['code']);
$customCode['hashtarget'] = explode("__", $customCode['hashtarget']);
if ($customCode['type'] == 1 && strpos($customCode['hashendtarget'], '__') !== false)
if (isset($customCode['hashtarget']))
{
$customCode['hashendtarget'] = explode("__", $customCode['hashendtarget']);
$customCode['hashtarget'] = explode("__", $customCode['hashtarget']);
if ($customCode['type'] == 1 && strpos($customCode['hashendtarget'], '__') !== false)
{
$customCode['hashendtarget'] = explode("__", $customCode['hashendtarget']);
}
}
}
return true;
}
return false;
}
@ -2642,12 +2663,20 @@ class Get
// Create a new query object.
$query = $db->getQuery(true);
// Insert columns.
$columns = array('path','type','component','published','created','created_by','version','access','hashtarget','from_line','to_line','code','hashendtarget');
$columns = array('path','type','target','component','published','created','created_by','version','access','hashtarget','from_line','to_line','code','hashendtarget');
// Prepare the insert query.
$query->insert($db->quoteName('#__componentbuilder_custom_code'));
$query->columns($db->quoteName($columns));
foreach($this->newCustomCode as $values){
$query->values(implode(',', $values));
foreach($this->newCustomCode as $values)
{
if (count($values) == 14)
{
$query->values(implode(',', $values));
}
else
{
// TODO line mismatch... should not happen
}
}
// clear the values array
$this->newCustomCode = array();
@ -2759,7 +2788,17 @@ class Get
$pointer = array();
$reading = array();
$reader = 0;
$path = $target . '/' . str_replace('./', '', $file);
// make sure we have the path correct (the script file is not in admin path for example)
// there may be more... will nead to keep our eye on this... since files could be moved during install
$file = str_replace('./', '', $file);
if ($file !== 'script.php')
{
$path = $target . '/' . $file;
}
else
{
$path = $file;
}
foreach (new SplFileObject($file) as $lineNumber => $lineContent)
{
// we musk keep last few lines to dynamic find target entry later
@ -2771,8 +2810,8 @@ class Get
}
foreach ($placeholders as $type => $placeholder)
{
$i = (int) ($type === 3 ||$type === 4) ? 2 : 1;
$_type = (int) ($type === 1 || $type === 3) ? 1 : 2;
$i = (int) ($type == 3 ||$type == 4) ? 2 : 1;
$_type = (int) ($type == 1 || $type == 3) ? 1 : 2;
if ($reader === 0 || $reader === $i)
{
$targetKey = $type;
@ -2793,6 +2832,7 @@ class Get
// activate fingerPrint for replacement end target
$loadEndFingerPrint = true;
$backupTargetKey = $targetKey;
$backupI = $i;
}
// all new records we can do a bulk insert
if ($i === 1)
@ -2826,12 +2866,12 @@ class Get
if ($i === 1)
{
// load the last value
$this->newCustomCode[$pointer[$backupTargetKey]][] = $db->quote($hashendtarget); // 'hashendtarget'
$this->newCustomCode[$pointer[$targetKey]][] = $db->quote($hashendtarget); // 'hashendtarget'
}
// the record already exist so we must use module to update
elseif ($i === 2)
{
$this->existingCustomCode[$pointer[$backupTargetKey]]['fields'][] = $db->quoteName('hashendtarget') . ' = ' . $db->quote($hashendtarget);
$this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $db->quoteName('hashendtarget') . ' = ' . $db->quote($hashendtarget);
}
// reset the needed values
$endFingerPrint = array();
@ -2847,6 +2887,20 @@ class Get
// check if the starting place holder was found
if((!isset($reading[$targetKey]) || !$reading[$targetKey]) && (($i === 1 && trim($lineContent) === $start) || strpos($lineContent, $start) !== false))
{
if ($i === 2)
{
$id = $this->getSystemID($lineContent, $start);
}
if ($i === 2 && $id > 0)
{
// make sure we update it only once even if found again.
if (isset($this->codeAreadyDone[$id]))
{
continue;
}
// store the id to avoid duplication
$this->codeAreadyDone[$id] = (int) $id;
}
// set active reader (to lock out other search)
$reader = $i;
// set pointer
@ -2863,10 +2917,6 @@ class Get
$hashtarget = $hasleng.'__'.md5(implode('',$hasharray));
// do a quick check to insure we have an id
$id = false;
if ($i === 2)
{
$id = $this->getSystemID($lineContent, $start);
}
// all new records we can do a buldk insert
if ($i === 1 || !$id)
{
@ -2874,6 +2924,7 @@ class Get
$this->newCustomCode[$pointer[$targetKey]] = array();
$this->newCustomCode[$pointer[$targetKey]][] = $db->quote($path); // 'path'
$this->newCustomCode[$pointer[$targetKey]][] = $db->quote((int) $_type); // 'type'
$this->newCustomCode[$pointer[$targetKey]][] = $db->quote(1); // 'target'
$this->newCustomCode[$pointer[$targetKey]][] = $db->quote((int) $this->componentData->id); // 'component'
$this->newCustomCode[$pointer[$targetKey]][] = $db->quote(1); // 'published'
$this->newCustomCode[$pointer[$targetKey]][] = $db->quote($today); // 'created'
@ -2900,6 +2951,13 @@ class Get
$this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $db->quoteName('modified_by') . ' = ' . $db->quote($userId);
$this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $db->quoteName('hashtarget') . ' = ' . $db->quote($hashtarget);
}
else // this should actualy never happen
{
// de activate the reader
$reading[$targetKey] = false;
$reader = 0;
}
// update the counter
$counter[$i]++;
}
@ -2924,13 +2982,13 @@ class Get
$hashendtarget = 0;
}
// all new records we can do a buldk insert
if ($i === 1)
if ($backupI === 1)
{
// load the last value
$this->newCustomCode[$pointer[$backupTargetKey]][] = $db->quote($hashendtarget); // 'hashendtarget'
}
// the record already exist so we must use module to update
elseif ($i === 2)
elseif ($backupI === 2)
{
$this->existingCustomCode[$pointer[$backupTargetKey]]['fields'][] = $db->quoteName('hashendtarget') . ' = ' . $db->quote($hashendtarget);
}
@ -2970,7 +3028,7 @@ class Get
* @return array on success
*
*/
public function getPlaceHolder(&$type, &$id)
public function getPlaceHolder($type, &$id)
{
switch ($type)
{
@ -2985,8 +3043,8 @@ class Get
else
{
return array(
'start' => "\t\t//////////////////////////////////////////",
'end' => "\t\t//////////////////////////////////////////");
'start' => "/*////////////////////////////////////////*/",
'end' => "/*////////////////////////////////////////*/");
}
break;
case 2:
@ -3000,8 +3058,8 @@ class Get
else
{
return array(
'start' => "\t\t//////////////////////////////////////////",
'end' => "\t\t//////////////////////////////////////////");
'start' => "/*////////////////////////////////////////*/",
'end' => "/*////////////////////////////////////////*/");
}
break;
}

View File

@ -10,7 +10,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.2.0
@version 2.3.0
@created 30th April, 2015
@package Component Builder
@subpackage compiler.php
@ -513,14 +513,14 @@ class Structure extends Get
{
// set list view$view
$target = array('custom_admin' => $view['settings']->code);
$config = array('###CREATIONDATE###' => $created, '###BUILDDATE###' => JFactory::getDate($view['settings']->modified)->format('jS F, Y'),'###VERSION###' => $view['settings']->version);
$config = array('###CREATIONDATE###' => $created, '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version);
$this->buildDynamique($target,'list', false, $config);
}
elseif ($view['settings']->main_get->gettype == 1)
{
// set single view
$target = array('custom_admin' => $view['settings']->code);
$config = array('###CREATIONDATE###' => $created, '###BUILDDATE###' => JFactory::getDate($view['settings']->modified)->format('jS F, Y'),'###VERSION###' => $view['settings']->version);
$config = array('###CREATIONDATE###' => $created, '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version);
$this->buildDynamique($target, 'single', false, $config);
}
}
@ -811,7 +811,7 @@ class Structure extends Get
}
if (count($pathArray) == 1 && $firstFolder === 'media')
{
$this->fileContentStatic['###EXSTRA_MEDIA_FOLDERS###'] .= "\n\t\t<folder>".$lastFolder."</folder>";
$this->fileContentStatic['###EXSTRA_MEDIA_FOLDERS###'] .= PHP_EOL."\t\t<folder>".$lastFolder."</folder>";
}
// check if we sould add it to the site xml list
if (!isset($this->fileContentStatic['###EXSTRA_SITE_FOLDERS###']))
@ -820,7 +820,7 @@ class Structure extends Get
}
if (count($pathArray) == 1 && $firstFolder === 'site')
{
$this->fileContentStatic['###EXSTRA_SITE_FOLDERS###'] .= "\n\t\t<folder>".$lastFolder."</folder>";
$this->fileContentStatic['###EXSTRA_SITE_FOLDERS###'] .= PHP_EOL."\t\t<folder>".$lastFolder."</folder>";
}
// check if we sould add it to the admin xml list
if (!isset($this->fileContentStatic['###EXSTRA_ADMIN_FOLDERS###']))
@ -829,7 +829,7 @@ class Structure extends Get
}
if (count($pathArray) == 1 && $firstFolder === 'admin')
{
$this->fileContentStatic['###EXSTRA_ADMIN_FOLDERS###'] .= "\n\t\t\t<folder>".$lastFolder."</folder>";
$this->fileContentStatic['###EXSTRA_ADMIN_FOLDERS###'] .= PHP_EOL."\t\t\t<folder>".$lastFolder."</folder>";
}
// make we have not duplicates
$key_pointer = ComponentbuilderHelper::safeString($custom['folder']).'_f'.$pointer_tracker;

View File

@ -11,7 +11,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.2.0
@version 2.3.0
@created 30th April, 2015
@package Component Builder
@subpackage compiler.php
@ -382,7 +382,7 @@ class Fields extends Structure
$readOnly = "";
if ($view['settings']->type == 2)
{
$readOnly = "\t\t\t" . 'readonly="true"' . "\n\t\t\t" . 'disabled="true"';
$readOnly = "\t\t\t" . 'readonly="true"' . PHP_EOL."\t\t\t" . 'disabled="true"';
}
// main lang prefix
$langView = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($view['settings']->name_single, 'U');
@ -601,7 +601,7 @@ class Fields extends Structure
// check if metadata is added to this view
if (isset($this->metadataBuilder[$viewName]) && ComponentbuilderHelper::checkString($this->metadataBuilder[$viewName]))
{
$fieldSet[] = "\n\t<!--" . $this->setLine(__LINE__) . " Metadata Fields. -->";
$fieldSet[] = PHP_EOL."\t<!--" . $this->setLine(__LINE__) . " Metadata Fields. -->";
$fieldSet[] = "\t<fields" . ' name="metadata" label="JGLOBAL_FIELDSET_METADATA_OPTIONS">';
$fieldSet[] = "\t\t" . '<fieldset name="vdmmetadata"';
$fieldSet[] = "\t\t\t" . 'label="JGLOBAL_FIELDSET_METADATA_OPTIONS">';
@ -634,7 +634,7 @@ class Fields extends Structure
$fieldSet[] = "\t</fields>";
}
// retunr the set
return implode("\n", $fieldSet);
return implode(PHP_EOL, $fieldSet);
}
return '';
}
@ -797,14 +797,14 @@ class Fields extends Structure
if ($setType === 'option')
{
// now add to the field set
$fieldSet .= "\n\t" . $taber . "\t<!--" . $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". (joomla) -->";
$fieldSet .= "\n\t" . $taber . "\t<field";
$fieldSet .= PHP_EOL."\t" . $taber . "\t<!--" . $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". (joomla) -->";
$fieldSet .= PHP_EOL."\t" . $taber . "\t<field";
$optionSet = '';
foreach ($fieldAttributes as $property => $value)
{
if ($property != 'option')
{
$fieldSet .= "\n\t\t" . $taber . "\t" . $property . '="' . $value . '"';
$fieldSet .= PHP_EOL."\t\t" . $taber . "\t" . $property . '="' . $value . '"';
}
elseif ($property === 'option')
{
@ -823,7 +823,7 @@ class Fields extends Structure
// add to lang array
$this->langContent[$this->lang][$langValue] = $t;
// no add to option set
$optionSet .= "\n\t" . $taber . "\t\t" . '<option value="' . $v . '">' . "\n\t" . $taber . "\t\t\t" . $langValue . '</option>';
$optionSet .= PHP_EOL."\t" . $taber . "\t\t" . '<option value="' . $v . '">' . PHP_EOL."\t" . $taber . "\t\t\t" . $langValue . '</option>';
$optionArray[$v] = $langValue;
}
else
@ -833,7 +833,7 @@ class Fields extends Structure
// add to lang array
$this->langContent[$this->lang][$langValue] = $option;
// no add to option set
$optionSet .= "\n\t\t" . $taber . "\t" . '<option value="' . $option . '">' . "\n\t\t" . $taber . "\t\t" . $langValue . '</option>';
$optionSet .= PHP_EOL."\t\t" . $taber . "\t" . '<option value="' . $option . '">' . PHP_EOL."\t\t" . $taber . "\t\t" . $langValue . '</option>';
$optionArray[$option] = $langValue;
}
}
@ -849,7 +849,7 @@ class Fields extends Structure
// add to lang array
$this->langContent[$this->lang][$langValue] = $t;
// no add to option set
$optionSet .= "\n\t\t" . $taber . "\t" . '<option value="' . $v . '">' . "\n\t\t" . $taber . "\t\t" . $langValue . '</option>';
$optionSet .= PHP_EOL."\t\t" . $taber . "\t" . '<option value="' . $v . '">' . PHP_EOL."\t\t" . $taber . "\t\t" . $langValue . '</option>';
$optionArray[$v] = $langValue;
}
else
@ -859,7 +859,7 @@ class Fields extends Structure
// add to lang array
$this->langContent[$this->lang][$langValue] = $value;
// no add to option set
$optionSet .= "\n\t\t" . $taber . "\t" . '<option value="' . $value . '">' . "\n\t\t" . $taber . "\t\t" . $langValue . '</option>';
$optionSet .= PHP_EOL."\t\t" . $taber . "\t" . '<option value="' . $value . '">' . PHP_EOL."\t\t" . $taber . "\t\t" . $langValue . '</option>';
$optionArray[$value] = $langValue;
}
}
@ -868,41 +868,41 @@ class Fields extends Structure
if (ComponentbuilderHelper::checkString($optionSet))
{
$fieldSet .= '>';
$fieldSet .= "\n\t\t\t" . $taber . "<!--" . $this->setLine(__LINE__) . " Option Set. -->";
$fieldSet .= PHP_EOL."\t\t\t" . $taber . "<!--" . $this->setLine(__LINE__) . " Option Set. -->";
$fieldSet .= $optionSet;
$fieldSet .= "\n\t\t" . $taber . "</field>";
$fieldSet .= PHP_EOL."\t\t" . $taber . "</field>";
}
elseif ($typeName === 'sql')
{
$optionArray = false;
$fieldSet .= "\n\t\t" . $taber . "/>";
$fieldSet .= PHP_EOL."\t\t" . $taber . "/>";
}
else
{
$optionArray = false;
$fieldSet .= "\n\t\t\t" . $taber . "<!--" . $this->setLine(__LINE__) . " No Manual Options Were Added In Field Settings. -->";
$fieldSet .= "\n\t\t" . $taber . "/>";
$fieldSet .= PHP_EOL."\t\t\t" . $taber . "<!--" . $this->setLine(__LINE__) . " No Manual Options Were Added In Field Settings. -->";
$fieldSet .= PHP_EOL."\t\t" . $taber . "/>";
}
}
elseif ($setType === 'plain')
{
// now add to the field set
$fieldSet .= "\n\t\t" . $taber . "<!--" . $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". (joomla) -->";
$fieldSet .= "\n\t\t" . $taber . "<field";
$fieldSet .= PHP_EOL."\t\t" . $taber . "<!--" . $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". (joomla) -->";
$fieldSet .= PHP_EOL."\t\t" . $taber . "<field";
foreach ($fieldAttributes as $property => $value)
{
if ($property != 'option')
{
$fieldSet .= "\n\t\t" . $taber . "\t" . $property . '="' . $value . '"';
$fieldSet .= PHP_EOL."\t\t" . $taber . "\t" . $property . '="' . $value . '"';
}
}
$fieldSet .= "\n\t\t" . $taber . "/>";
$fieldSet .= PHP_EOL."\t\t" . $taber . "/>";
}
elseif ($setType === 'spacer')
{
// now add to the field set
$fieldSet .= "\n\t\t<!--" . $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". A None Database Field. (joomla) -->";
$fieldSet .= "\n\t\t<field";
$fieldSet .= PHP_EOL."\t\t<!--" . $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". A None Database Field. (joomla) -->";
$fieldSet .= PHP_EOL."\t\t<field";
foreach ($fieldAttributes as $property => $value)
{
if ($property != 'option')
@ -918,19 +918,19 @@ class Fields extends Structure
if ($typeName === 'repeatable')
{
// now add to the field set
$fieldSet .= "\n\t\t<!--" . $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". (joomla) -->";
$fieldSet .= "\n\t\t<field";
$fieldSet .= PHP_EOL."\t\t<!--" . $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". (joomla) -->";
$fieldSet .= PHP_EOL."\t\t<field";
$fieldsSet = array();
foreach ($fieldAttributes as $property => $value)
{
if ($property != 'fields')
{
$fieldSet .= "\n\t\t\t" . $property . '="' . $value . '"';
$fieldSet .= PHP_EOL."\t\t\t" . $property . '="' . $value . '"';
}
}
$fieldSet .= ">";
$fieldSet .= "\n\t\t\t" . '<fields name="' . $fieldAttributes['name'] . '_fields" label="">';
$fieldSet .= "\n\t\t\t\t" . '<fieldset hidden="true" name="' . $fieldAttributes['name'] . '_modal" repeat="true">';
$fieldSet .= PHP_EOL."\t\t\t" . '<fields name="' . $fieldAttributes['name'] . '_fields" label="">';
$fieldSet .= PHP_EOL."\t\t\t\t" . '<fieldset hidden="true" name="' . $fieldAttributes['name'] . '_modal" repeat="true">';
if (strpos($fieldAttributes['fields'], ',') !== false)
{
// mulitpal fields
@ -999,24 +999,24 @@ class Fields extends Structure
}
}
}
$fieldSet .= "\n\t\t\t\t</fieldset>";
$fieldSet .= "\n\t\t\t</fields>";
$fieldSet .= "\n\t\t</field>";
$fieldSet .= PHP_EOL."\t\t\t\t</fieldset>";
$fieldSet .= PHP_EOL."\t\t\t</fields>";
$fieldSet .= PHP_EOL."\t\t</field>";
}
}
elseif ($setType === 'custom')
{
// now add to the field set
$fieldSet .= "\n\t\t" . $taber . "<!--" . $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". (custom) -->";
$fieldSet .= "\n\t\t" . $taber . "<field";
$fieldSet .= PHP_EOL."\t\t" . $taber . "<!--" . $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". (custom) -->";
$fieldSet .= PHP_EOL."\t\t" . $taber . "<field";
foreach ($fieldAttributes as $property => $value)
{
if ($property != 'option')
{
$fieldSet .= "\n\t\t" . $taber . "\t" . $property . '="' . $value . '"';
$fieldSet .= PHP_EOL."\t\t" . $taber . "\t" . $property . '="' . $value . '"';
}
}
$fieldSet .= "\n\t\t" . $taber . "/>";
$fieldSet .= PHP_EOL."\t\t" . $taber . "/>";
// incase the field is in the config and has not been set
if ('config' === $viewName && 'configs' === $listViewName)
{
@ -1791,7 +1791,7 @@ class Fields extends Structure
// set tab and break replacements
$tabBreak = array(
'\t' => "\t",
'\n' => "\n"
'\n' => PHP_EOL
);
// make field dynamic
$replace = array(
@ -1822,7 +1822,7 @@ class Fields extends Structure
}
else
{
$phpCode .= "\n\t\t".str_replace(array_keys($tabBreak),array_values($tabBreak),$code);
$phpCode .= PHP_EOL."\t\t".str_replace(array_keys($tabBreak),array_values($tabBreak),$code);
}
}
}
@ -1855,7 +1855,7 @@ class Fields extends Structure
}
else
{
$phpxCode .= "\n\t\t".str_replace(array_keys($tabBreak),array_values($tabBreak),$code);
$phpxCode .= PHP_EOL."\t\t".str_replace(array_keys($tabBreak),array_values($tabBreak),$code);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -10,7 +10,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.2.0
@version 2.3.0
@created 30th April, 2015
@package Component Builder
@subpackage compiler.php
@ -173,22 +173,22 @@ class Infusion extends Interpretation
if ($this->componentData->add_admin_event == 1)
{
// ###ADMIN_GLOBAL_EVENT###
$this->fileContentStatic['###ADMIN_GLOBAL_EVENT###'] = "\n\n".'// Triger the Global Admin Event';
$this->fileContentStatic['###ADMIN_GLOBAL_EVENT###'] .= "\n".$this->fileContentStatic['###Component###'].'Helper::globalEvent($document);';
$this->fileContentStatic['###ADMIN_GLOBAL_EVENT###'] = PHP_EOL.PHP_EOL.'// Triger the Global Admin Event';
$this->fileContentStatic['###ADMIN_GLOBAL_EVENT###'] .= PHP_EOL.$this->fileContentStatic['###Component###'].'Helper::globalEvent($document);';
// ###ADMIN_GLOBAL_EVENT_HELPER###
$this->fileContentStatic['###ADMIN_GLOBAL_EVENT_HELPER###'] = "\n\n\t".'/**';
$this->fileContentStatic['###ADMIN_GLOBAL_EVENT_HELPER###'] .= "\n\t".'* The Global Admin Event Method.';
$this->fileContentStatic['###ADMIN_GLOBAL_EVENT_HELPER###'] .= "\n\t".'**/';
$this->fileContentStatic['###ADMIN_GLOBAL_EVENT_HELPER###'] .= "\n\t".'public static function globalEvent($document)';
$this->fileContentStatic['###ADMIN_GLOBAL_EVENT_HELPER###'] .= "\n\t".'{';
$this->fileContentStatic['###ADMIN_GLOBAL_EVENT_HELPER###'] .= "\n".str_replace(array_keys($this->placeholders),array_values($this->placeholders),$this->customScriptBuilder['component_php_admin_event']);
$this->fileContentStatic['###ADMIN_GLOBAL_EVENT_HELPER###'] .= "\n\t".'}';
$this->fileContentStatic['###ADMIN_GLOBAL_EVENT_HELPER###'] = PHP_EOL.PHP_EOL."\t".'/**';
$this->fileContentStatic['###ADMIN_GLOBAL_EVENT_HELPER###'] .= PHP_EOL."\t".'* The Global Admin Event Method.';
$this->fileContentStatic['###ADMIN_GLOBAL_EVENT_HELPER###'] .= PHP_EOL."\t".'**/';
$this->fileContentStatic['###ADMIN_GLOBAL_EVENT_HELPER###'] .= PHP_EOL."\t".'public static function globalEvent($document)';
$this->fileContentStatic['###ADMIN_GLOBAL_EVENT_HELPER###'] .= PHP_EOL."\t".'{';
$this->fileContentStatic['###ADMIN_GLOBAL_EVENT_HELPER###'] .= PHP_EOL.str_replace(array_keys($this->placeholders),array_values($this->placeholders),$this->customScriptBuilder['component_php_admin_event']);
$this->fileContentStatic['###ADMIN_GLOBAL_EVENT_HELPER###'] .= PHP_EOL."\t".'}';
}
// now load the readme file if needed
if ($this->componentData->addreadme == 1)
{
$this->fileContentStatic['###EXSTRA_ADMIN_FILES###'] .= "\n\t\t\t<filename>README.txt</filename>";
$this->fileContentStatic['###EXSTRA_ADMIN_FILES###'] .= PHP_EOL."\t\t\t<filename>README.txt</filename>";
}
// ###HELPER_CREATEUSER###
@ -254,6 +254,9 @@ class Infusion extends Interpretation
$this->placeholders['###view###'] = $viewName_single;
$this->placeholders['###VIEW###'] = $viewName_u;
$this->placeholders['###View###'] = $viewName_f;
$this->placeholders['[[[view]]]'] = $viewName_single;
$this->placeholders['[[[VIEW]]]'] = $viewName_u;
$this->placeholders['[[[View]]]'] = $viewName_f;
// set license per view if needed
$this->setLockLicensePer($viewName_single, $this->target);
@ -287,7 +290,7 @@ class Infusion extends Interpretation
{
// ###DOCUMENT_CUSTOM_PHP### <<<DYNAMIC>>>
$this->fileContentDynamic[$viewName_single]['###DOCUMENT_CUSTOM_PHP###']
= "\n".str_replace(array_keys($this->placeholders),array_values($this->placeholders),$this->customScriptBuilder['php_document'][$viewName_single]);
= PHP_EOL.str_replace(array_keys($this->placeholders),array_values($this->placeholders),$this->customScriptBuilder['php_document'][$viewName_single]);
// clear some memory
unset($this->customScriptBuilder['php_document'][$viewName_single]);
}
@ -324,16 +327,16 @@ class Infusion extends Interpretation
$this->fileContentDynamic[$viewName_single]['###LINKEDVIEWMETHODS###'] = '';
// ###JMODELADMIN_BEFORE_DELETE### <<<DYNAMIC>>>
$this->fileContentDynamic[$viewName_single]['###JMODELADMIN_BEFORE_DELETE###'] = $this->getCustomScriptBuilder('php_before_delete', $viewName_single, "\n");
$this->fileContentDynamic[$viewName_single]['###JMODELADMIN_BEFORE_DELETE###'] = $this->getCustomScriptBuilder('php_before_delete', $viewName_single, PHP_EOL);
// ###JMODELADMIN_AFTER_DELETE### <<<DYNAMIC>>>
$this->fileContentDynamic[$viewName_single]['###JMODELADMIN_AFTER_DELETE###'] = $this->getCustomScriptBuilder('php_after_delete', $viewName_single, "\n\n");
$this->fileContentDynamic[$viewName_single]['###JMODELADMIN_AFTER_DELETE###'] = $this->getCustomScriptBuilder('php_after_delete', $viewName_single, PHP_EOL.PHP_EOL);
// ###JMODELADMIN_BEFORE_DELETE### <<<DYNAMIC>>>
$this->fileContentDynamic[$viewName_single]['###JMODELADMIN_BEFORE_PUBLISH###'] = $this->getCustomScriptBuilder('php_before_publish', $viewName_single, "\n");
$this->fileContentDynamic[$viewName_single]['###JMODELADMIN_BEFORE_PUBLISH###'] = $this->getCustomScriptBuilder('php_before_publish', $viewName_single, PHP_EOL);
// ###JMODELADMIN_AFTER_DELETE### <<<DYNAMIC>>>
$this->fileContentDynamic[$viewName_single]['###JMODELADMIN_AFTER_PUBLISH###'] = $this->getCustomScriptBuilder('php_after_publish', $viewName_single, "\n\n");
$this->fileContentDynamic[$viewName_single]['###JMODELADMIN_AFTER_PUBLISH###'] = $this->getCustomScriptBuilder('php_after_publish', $viewName_single, PHP_EOL.PHP_EOL);
// ###CHECKBOX_SAVE### <<<DYNAMIC>>>
$this->fileContentDynamic[$viewName_single]['###CHECKBOX_SAVE###'] = $this->setCheckboxSave($viewName_single);
@ -342,7 +345,7 @@ class Infusion extends Interpretation
$this->fileContentDynamic[$viewName_single]['###METHOD_ITEM_SAVE###'] = $this->setMethodItemSave($viewName_single);
// ###POSTSAVEHOOK### <<<DYNAMIC>>>
$this->fileContentDynamic[$viewName_single]['###POSTSAVEHOOK###'] = $this->getCustomScriptBuilder('php_postsavehook', $viewName_single, "\n", null, true, "\n\t\treturn;", "\n\n\t\treturn;");
$this->fileContentDynamic[$viewName_single]['###POSTSAVEHOOK###'] = $this->getCustomScriptBuilder('php_postsavehook', $viewName_single, PHP_EOL, null, true, PHP_EOL."\t\treturn;", PHP_EOL.PHP_EOL."\t\treturn;");
if (isset($this->customScriptBuilder['css_view'][$viewName_single]) && ComponentbuilderHelper::checkString($this->customScriptBuilder['css_view'][$viewName_single]))
{
@ -387,6 +390,9 @@ class Infusion extends Interpretation
$this->placeholders['###views###'] = $viewName_list;
$this->placeholders['###VIEWS###'] = $viewsName_u;
$this->placeholders['###Views###'] = $viewsName_f;
$this->placeholders['[[[views]]]'] = $viewName_list;
$this->placeholders['[[[VIEWS]]]'] = $viewsName_u;
$this->placeholders['[[[Views]]]'] = $viewsName_f;
// set the export/import option
if ($view['port'])
@ -424,7 +430,7 @@ class Infusion extends Interpretation
$this->fileContentDynamic[$viewName_list]['###GET_ITEMS_METHOD_STRING_FIX###'] = $this->setGetItemsMethodStringFix($viewName_single,$this->fileContentStatic['###Component###']);
// ###GET_ITEMS_METHOD_AFTER_ALL### <<<DYNAMIC>>>
$this->fileContentDynamic[$viewName_list]['###GET_ITEMS_METHOD_AFTER_ALL###'] = $this->getCustomScriptBuilder('php_getitems_after_all', $viewName_single, "\n");
$this->fileContentDynamic[$viewName_list]['###GET_ITEMS_METHOD_AFTER_ALL###'] = $this->getCustomScriptBuilder('php_getitems_after_all', $viewName_single, PHP_EOL);
// ###SELECTIONTRANSLATIONFIX### <<<DYNAMIC>>>
$this->fileContentDynamic[$viewName_list]['###SELECTIONTRANSLATIONFIX###'] = $this->setSelectionTranslationFix($viewName_list,$this->fileContentStatic['###Component###']);
@ -554,7 +560,7 @@ class Infusion extends Interpretation
if ($view['edit_create_site_view'])
{
// add needed router stuff for front edit views
$this->fileContentStatic['###ROUTER_PARSE_SWITCH###'] .= $this->routerParseSwitch($viewName_single);
$this->fileContentStatic['###ROUTER_PARSE_SWITCH###'] .= $this->routerParseSwitch($viewName_single, null, false);
$this->fileContentStatic['###ROUTER_BUILD_VIEWS###'] .= $this->routerBuildViews($viewName_single);
}
@ -661,7 +667,7 @@ class Infusion extends Interpretation
{
// ###CUSTOM_ADMIN_CUSTOM_BEFORE_LIST_QUERY### <<<DYNAMIC>>>
$this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_CUSTOM_BEFORE_LIST_QUERY###']
= "\n".str_replace(array_keys($this->placeholders),array_values($this->placeholders),$this->customScriptBuilder[$this->target.'_php_getlistquery'][$view['settings']->code]);
= PHP_EOL.str_replace(array_keys($this->placeholders),array_values($this->placeholders),$this->customScriptBuilder[$this->target.'_php_getlistquery'][$view['settings']->code]);
// clear some memory
unset($this->customScriptBuilder[$this->target.'_php_getlistquery'][$view['settings']->code]);
}
@ -676,7 +682,7 @@ class Infusion extends Interpretation
{
// ###CUSTOM_ADMIN_BEFORE_GET_ITEMS### <<<DYNAMIC>>>
$this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_BEFORE_GET_ITEMS###']
= "\n".str_replace(array_keys($this->placeholders),array_values($this->placeholders),$this->customScriptBuilder[$this->target.'_php_before_getitems'][$view['settings']->code]);
= PHP_EOL.str_replace(array_keys($this->placeholders),array_values($this->placeholders),$this->customScriptBuilder[$this->target.'_php_before_getitems'][$view['settings']->code]);
// clear some memory
unset($this->customScriptBuilder[$this->target.'_php_before_getitems'][$view['settings']->code]);
}
@ -694,7 +700,7 @@ class Infusion extends Interpretation
{
// ###CUSTOM_ADMIN_AFTER_GET_ITEMS### <<<DYNAMIC>>>
$this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_AFTER_GET_ITEMS###']
= "\n".str_replace(array_keys($this->placeholders),array_values($this->placeholders),$this->customScriptBuilder[$this->target.'_php_after_getitems'][$view['settings']->code]);
= PHP_EOL.str_replace(array_keys($this->placeholders),array_values($this->placeholders),$this->customScriptBuilder[$this->target.'_php_after_getitems'][$view['settings']->code]);
// clear some memory
unset($this->customScriptBuilder[$this->target.'_php_after_getitems'][$view['settings']->code]);
}
@ -730,10 +736,10 @@ class Infusion extends Interpretation
}
// ###VIEWARRAY###
$this->fileContentStatic['###VIEWARRAY###'] = "\n".implode(",\n",$viewarray);
$this->fileContentStatic['###VIEWARRAY###'] = PHP_EOL.implode(",".PHP_EOL,$viewarray);
// ###CUSTOM_ADMIN_EDIT_VIEW_ARRAY###
$this->fileContentStatic['###SITE_EDIT_VIEW_ARRAY###'] = "\n".implode(",\n",$site_edit_view_array);
$this->fileContentStatic['###SITE_EDIT_VIEW_ARRAY###'] = PHP_EOL.implode(",".PHP_EOL,$site_edit_view_array);
// ###MAINMENUS###
$this->fileContentStatic['###MAINMENUS###'] = $this->setMainMenus();
@ -930,7 +936,7 @@ class Infusion extends Interpretation
{
// ###SITE_BEFORE_GET_ITEMS### <<<DYNAMIC>>>
$this->fileContentDynamic[$view['settings']->code]['###SITE_BEFORE_GET_ITEMS###']
= "\n".str_replace(array_keys($this->placeholders),array_values($this->placeholders),$this->customScriptBuilder[$this->target.'_php_before_getitems'][$view['settings']->code]);
= PHP_EOL.str_replace(array_keys($this->placeholders),array_values($this->placeholders),$this->customScriptBuilder[$this->target.'_php_before_getitems'][$view['settings']->code]);
// clear some memory
unset($this->customScriptBuilder[$this->target.'_php_before_getitems'][$view['settings']->code]);
}
@ -948,7 +954,7 @@ class Infusion extends Interpretation
{
// ###SITE_AFTER_GET_ITEMS### <<<DYNAMIC>>>
$this->fileContentDynamic[$view['settings']->code]['###SITE_AFTER_GET_ITEMS###']
= "\n".str_replace(array_keys($this->placeholders),array_values($this->placeholders),$this->customScriptBuilder[$this->target.'_php_after_getitems'][$view['settings']->code]);
= PHP_EOL.str_replace(array_keys($this->placeholders),array_values($this->placeholders),$this->customScriptBuilder[$this->target.'_php_after_getitems'][$view['settings']->code]);
// clear some memory
unset($this->customScriptBuilder[$this->target.'_php_after_getitems'][$view['settings']->code]);
}
@ -994,16 +1000,16 @@ class Infusion extends Interpretation
// now load the data for the global event if needed
if ($this->componentData->add_site_event == 1)
{
$this->fileContentStatic['###SITE_GLOBAL_EVENT###'] = "\n\n".'// Triger the Global Site Event';
$this->fileContentStatic['###SITE_GLOBAL_EVENT###'] .= "\n".$this->fileContentStatic['###Component###'].'Helper::globalEvent($document);';
$this->fileContentStatic['###SITE_GLOBAL_EVENT###'] = PHP_EOL.PHP_EOL.'// Triger the Global Site Event';
$this->fileContentStatic['###SITE_GLOBAL_EVENT###'] .= PHP_EOL.$this->fileContentStatic['###Component###'].'Helper::globalEvent($document);';
// ###SITE_GLOBAL_EVENT_HELPER###
$this->fileContentStatic['###SITE_GLOBAL_EVENT_HELPER###'] = "\n\n\t".'/**';
$this->fileContentStatic['###SITE_GLOBAL_EVENT_HELPER###'] .= "\n\t".'* The Global Site Event Method.';
$this->fileContentStatic['###SITE_GLOBAL_EVENT_HELPER###'] .= "\n\t".'**/';
$this->fileContentStatic['###SITE_GLOBAL_EVENT_HELPER###'] .= "\n\t".'public static function globalEvent($document)';
$this->fileContentStatic['###SITE_GLOBAL_EVENT_HELPER###'] .= "\n\t".'{';
$this->fileContentStatic['###SITE_GLOBAL_EVENT_HELPER###'] .= "\n".str_replace(array_keys($this->placeholders),array_values($this->placeholders),$this->customScriptBuilder['component_php_site_event']);
$this->fileContentStatic['###SITE_GLOBAL_EVENT_HELPER###'] .= "\n\t".'}';
$this->fileContentStatic['###SITE_GLOBAL_EVENT_HELPER###'] = PHP_EOL.PHP_EOL."\t".'/**';
$this->fileContentStatic['###SITE_GLOBAL_EVENT_HELPER###'] .= PHP_EOL."\t".'* The Global Site Event Method.';
$this->fileContentStatic['###SITE_GLOBAL_EVENT_HELPER###'] .= PHP_EOL."\t".'**/';
$this->fileContentStatic['###SITE_GLOBAL_EVENT_HELPER###'] .= PHP_EOL."\t".'public static function globalEvent($document)';
$this->fileContentStatic['###SITE_GLOBAL_EVENT_HELPER###'] .= PHP_EOL."\t".'{';
$this->fileContentStatic['###SITE_GLOBAL_EVENT_HELPER###'] .= PHP_EOL.str_replace(array_keys($this->placeholders),array_values($this->placeholders),$this->customScriptBuilder['component_php_site_event']);
$this->fileContentStatic['###SITE_GLOBAL_EVENT_HELPER###'] .= PHP_EOL."\t".'}';
}
// setup the layouts
$this->setCustomViewLayouts();
@ -1027,10 +1033,10 @@ class Infusion extends Interpretation
$this->fileContentStatic['###LANG_SITE_SYS###'] = $this->setLangSiteSys();
// ###PREINSTALLSCRIPT###
$this->fileContentStatic['###PREINSTALLSCRIPT###'] = $this->getCustomScriptBuilder('php_preflight', 'install', "\n", null, true);
$this->fileContentStatic['###PREINSTALLSCRIPT###'] = $this->getCustomScriptBuilder('php_preflight', 'install', PHP_EOL, null, true);
// ###PREUPDATESCRIPT###
$this->fileContentStatic['###PREUPDATESCRIPT###'] = $this->getCustomScriptBuilder('php_preflight', 'update', "\n", null, true);
$this->fileContentStatic['###PREUPDATESCRIPT###'] = $this->getCustomScriptBuilder('php_preflight', 'update', PHP_EOL, null, true);
// ###POSTINSTALLSCRIPT###
$this->fileContentStatic['###POSTINSTALLSCRIPT###'] = $this->setPostInstallScript();
@ -1045,7 +1051,7 @@ class Infusion extends Interpretation
$this->fileContentStatic['###HELPER_UIKIT###'] = $this->setUikitHelperMethods();
// ###CONFIG_FIELDSETS###
$this->fileContentStatic['###CONFIG_FIELDSETS###'] = implode("\n",$this->configFieldSets);
$this->fileContentStatic['###CONFIG_FIELDSETS###'] = implode(PHP_EOL,$this->configFieldSets);
// check if this has been set
if (!isset($this->fileContentStatic['###ROUTER_BUILD_VIEWS###']) || !ComponentbuilderHelper::checkString($this->fileContentStatic['###ROUTER_BUILD_VIEWS###']))

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage componentbuilder.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage headercheck.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage batch_.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage indenter.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage js.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage minify.php

View File

@ -1928,13 +1928,18 @@ COM_COMPONENTBUILDER_CUSTOM_CODE_HASHTARGET="Hashtarget"
COM_COMPONENTBUILDER_CUSTOM_CODE_HASHTARGET_DESCRIPTION="The start hash target to help insert the code at the correct place, if the line position change. This hash is the md5 of a few lines above the custom code"
COM_COMPONENTBUILDER_CUSTOM_CODE_HASHTARGET_HINT="autogenerated md5 hash"
COM_COMPONENTBUILDER_CUSTOM_CODE_HASHTARGET_LABEL="Start Hash Target"
COM_COMPONENTBUILDER_CUSTOM_CODE_HASH_AUTOMATION="Hash (automation)"
COM_COMPONENTBUILDER_CUSTOM_CODE_ID="Id"
COM_COMPONENTBUILDER_CUSTOM_CODE_INSERTION="Insertion"
COM_COMPONENTBUILDER_CUSTOM_CODE_JCB_MANUAL="JCB (manual)"
COM_COMPONENTBUILDER_CUSTOM_CODE_MODIFIED_BY_DESC="The last user that modified this Custom Code."
COM_COMPONENTBUILDER_CUSTOM_CODE_MODIFIED_BY_LABEL="Modified By"
COM_COMPONENTBUILDER_CUSTOM_CODE_MODIFIED_DATE_DESC="The date this Custom Code was modified."
COM_COMPONENTBUILDER_CUSTOM_CODE_MODIFIED_DATE_LABEL="Modified Date"
COM_COMPONENTBUILDER_CUSTOM_CODE_NEW="A New Custom Code"
COM_COMPONENTBUILDER_CUSTOM_CODE_NOTE_JCB_PLACEHOLDER_DESCRIPTION="<span id='jcb-placeholder'><code>[save to see]</code></span>"
COM_COMPONENTBUILDER_CUSTOM_CODE_NOTE_JCB_PLACEHOLDER_LABEL="Use This Place Holder"
COM_COMPONENTBUILDER_CUSTOM_CODE_NOT_REQUIRED="Not Required"
COM_COMPONENTBUILDER_CUSTOM_CODE_ORDERING_LABEL="Ordering"
COM_COMPONENTBUILDER_CUSTOM_CODE_PATH="Path"
COM_COMPONENTBUILDER_CUSTOM_CODE_PATH_DESCRIPTION="File path of where this code should be added."
@ -1945,6 +1950,9 @@ COM_COMPONENTBUILDER_CUSTOM_CODE_PUBLISHING="Publishing"
COM_COMPONENTBUILDER_CUSTOM_CODE_REPLACEMENT="Replacement"
COM_COMPONENTBUILDER_CUSTOM_CODE_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Custom Code to customise the alias."
COM_COMPONENTBUILDER_CUSTOM_CODE_STATUS="Status"
COM_COMPONENTBUILDER_CUSTOM_CODE_TARGET="Target"
COM_COMPONENTBUILDER_CUSTOM_CODE_TARGET_DESCRIPTION="Set the way this code will be added to the component.<br />Hash automation means it is added using the hash target of the lines surrounding the code.<br />JCB manual means you add a place-holder in Component Builder User Interface area in one of the custom code blocks manually, and this code is added in at those place holders in any component."
COM_COMPONENTBUILDER_CUSTOM_CODE_TARGET_LABEL="Target"
COM_COMPONENTBUILDER_CUSTOM_CODE_TO_LINE="To Line"
COM_COMPONENTBUILDER_CUSTOM_CODE_TO_LINE_DESCRIPTION="The line to where the code must be replaced."
COM_COMPONENTBUILDER_CUSTOM_CODE_TO_LINE_HINT="Only Numbers"

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage css_fullwidth.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage custom_buttons_fullwidth.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage custom_buttons_left.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage custom_import_fullwidth.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage fields_fullwidth.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage javascript_fullwidth.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage linked_components_fullwidth.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage mysql_fullwidth.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage mysql_left.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage php_fullwidth.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage publishing.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage publlshing.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage settings_above.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage settings_left.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage settings_right.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage settings_under.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage batchselection.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage admin_views_fullwidth.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage custom_admin_views_fullwidth.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage details_above.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage details_left.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage details_right.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage details_under.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage dynamic_build_beta_fullwidth.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage dynamic_integration_fullwidth.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage libs_helpers_fullwidth.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage mysql_fullwidth.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage php_fullwidth.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage publishing.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage publlshing.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage readme_left.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage readme_right.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage settings_left.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage settings_right.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage site_views_fullwidth.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage custom_buttons_fullwidth.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage custom_buttons_left.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage custom_script_fullwidth.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage details_above.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage details_fullwidth.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage details_left.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage details_right.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage details_rightside.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage details_under.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage linked_components_fullwidth.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage publishing.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@build 4th February, 2017
@version 2.3.1
@build 9th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage publlshing.php

Some files were not shown because too many files have changed in this diff Show More