Changed alias in site-view and custom-admin-view to codename so we can have views with the same names in different components, added warning notice if custom code can't be added, Bug fixes in the demo content dates

This commit is contained in:
2017-02-04 02:22:17 +02:00
parent e0efef54e9
commit 3497de7c28
307 changed files with 805 additions and 821 deletions

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 94 of this MVC
@build 13th January, 2017
@version @update number 95 of this MVC
@build 3rd February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage admin_view.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 94 of this MVC
@build 13th January, 2017
@version @update number 95 of this MVC
@build 3rd February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage admin_views.php

View File

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

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 80 of this MVC
@build 2nd February, 2017
@version @update number 81 of this MVC
@build 3rd February, 2017
@created 6th May, 2015
@package Component Builder
@subpackage component.php

View File

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

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 80 of this MVC
@build 2nd February, 2017
@version @update number 81 of this MVC
@build 3rd February, 2017
@created 6th May, 2015
@package Component Builder
@subpackage components.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 18 of this MVC
@build 13th January, 2017
@version @update number 22 of this MVC
@build 3rd February, 2017
@created 13th August, 2015
@package Component Builder
@subpackage custom_admin_view.php
@ -763,7 +763,7 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin
}
}
list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name);
$this->table->name = $this->generateUniqe('name',$this->table->name);
// insert all set values
if (ComponentbuilderHelper::checkArray($values))
@ -1043,60 +1043,6 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin
$data['params'] = (string) $params;
}
// Alter the name for save as copy
if ($input->get('task') === 'save2copy')
{
$origTable = clone $this->getTable();
$origTable->load($input->getInt('id'));
if ($data['name'] == $origTable->name)
{
list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']);
$data['name'] = $name;
$data['alias'] = $alias;
}
else
{
if ($data['alias'] == $origTable->alias)
{
$data['alias'] = '';
}
}
$data['published'] = 0;
}
// Automatic handling of alias for empty fields
if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0)
{
if ($data['alias'] == null)
{
if (JFactory::getConfig()->get('unicodeslugs') == 1)
{
$data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']);
}
else
{
$data['alias'] = JFilterOutput::stringURLSafe($data['name']);
}
$table = JTable::getInstance('custom_admin_view', 'componentbuilderTable');
if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0))
{
$msg = JText::_('COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_SAVE_WARNING');
}
list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']);
$data['alias'] = $alias;
if (isset($msg))
{
JFactory::getApplication()->enqueueMessage($msg, 'warning');
}
}
}
// Alter the uniqe field for save as copy
if ($input->get('task') === 'save2copy')
{
@ -1145,24 +1091,22 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin
/**
* Method to change the title & alias.
*
* @param string $alias The alias.
* @param string $title The title.
*
* @return array Contains the modified title and alias.
*
*/
protected function _generateNewTitle($alias, $title)
protected function _generateNewTitle($title)
{
// Alter the title & alias
// Alter the title
$table = $this->getTable();
while ($table->load(array('alias' => $alias)))
while ($table->load(array('title' => $title)))
{
$title = JString::increment($title);
$alias = JString::increment($alias, 'dash');
}
return array($title, $alias);
return $title;
}
}

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 18 of this MVC
@build 13th January, 2017
@version @update number 22 of this MVC
@build 3rd February, 2017
@created 13th August, 2015
@package Component Builder
@subpackage custom_admin_views.php
@ -46,7 +46,7 @@ class ComponentbuilderModelCustom_admin_views extends JModelList
'a.modified_by','modified_by',
'a.system_name','system_name',
'a.name','name',
'a.alias','alias',
'a.codename','codename',
'a.description','description'
);
}
@ -74,8 +74,8 @@ class ComponentbuilderModelCustom_admin_views extends JModelList
$name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name');
$this->setState('filter.name', $name);
$alias = $this->getUserStateFromRequest($this->context . '.filter.alias', 'filter_alias');
$this->setState('filter.alias', $alias);
$codename = $this->getUserStateFromRequest($this->context . '.filter.codename', 'filter_codename');
$this->setState('filter.codename', $codename);
$description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description');
$this->setState('filter.description', $description);
@ -195,7 +195,7 @@ class ComponentbuilderModelCustom_admin_views extends JModelList
else
{
$search = $db->quote('%' . $db->escape($search) . '%');
$query->where('(a.system_name LIKE '.$search.' OR a.name LIKE '.$search.' OR a.alias LIKE '.$search.' OR a.description LIKE '.$search.')');
$query->where('(a.system_name LIKE '.$search.' OR a.name LIKE '.$search.' OR a.codename LIKE '.$search.' OR a.description LIKE '.$search.')');
}
}
@ -348,7 +348,7 @@ class ComponentbuilderModelCustom_admin_views extends JModelList
$id .= ':' . $this->getState('filter.modified_by');
$id .= ':' . $this->getState('filter.system_name');
$id .= ':' . $this->getState('filter.name');
$id .= ':' . $this->getState('filter.alias');
$id .= ':' . $this->getState('filter.codename');
$id .= ':' . $this->getState('filter.description');
return parent::getStoreId($id);

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 36 of this MVC
@build 12th January, 2017
@version @update number 37 of this MVC
@build 3rd February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage field.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 36 of this MVC
@build 12th January, 2017
@version @update number 37 of this MVC
@build 3rd February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage fields.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.2.10
@build 2nd February, 2017
@version 2.3.0
@build 4th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage adminviewfolderlist.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.2.10
@build 2nd February, 2017
@version 2.3.0
@build 4th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage adminviews.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.2.10
@build 2nd February, 2017
@version 2.3.0
@build 4th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage articles.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.2.10
@build 2nd February, 2017
@version 2.3.0
@build 4th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage component.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.2.10
@build 2nd February, 2017
@version 2.3.0
@build 4th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage customadminviews.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.2.10
@build 2nd February, 2017
@version 2.3.0
@build 4th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage customfilelist.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.2.10
@build 2nd February, 2017
@version 2.3.0
@build 4th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage customfolderlist.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.2.10
@build 2nd February, 2017
@version 2.3.0
@build 4th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage customgets.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.2.10
@build 2nd February, 2017
@version 2.3.0
@build 4th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage dbtables.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.2.10
@build 2nd February, 2017
@version 2.3.0
@build 4th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage dynamicgets.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.2.10
@build 2nd February, 2017
@version 2.3.0
@build 4th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage fields.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.2.10
@build 2nd February, 2017
@version 2.3.0
@build 4th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage fieldsmulti.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.2.10
@build 2nd February, 2017
@version 2.3.0
@build 4th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage fieldtypes.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.2.10
@build 2nd February, 2017
@version 2.3.0
@build 4th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage maingets.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.2.10
@build 2nd February, 2017
@version 2.3.0
@build 4th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage siteviewfolderlist.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.2.10
@build 2nd February, 2017
@version 2.3.0
@build 4th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage siteviews.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.2.10
@build 2nd February, 2017
@version 2.3.0
@build 4th February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage snippets.php

View File

@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 94 of this MVC
@build 13th January, 2017
@version @update number 95 of this MVC
@build 3rd February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage admin_view.js

View File

@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 80 of this MVC
@build 2nd February, 2017
@version @update number 81 of this MVC
@build 3rd February, 2017
@created 6th May, 2015
@package Component Builder
@subpackage component.js

View File

@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 18 of this MVC
@build 13th January, 2017
@version @update number 22 of this MVC
@build 3rd February, 2017
@created 13th August, 2015
@package Component Builder
@subpackage custom_admin_view.js

View File

@ -119,18 +119,18 @@
message="Error! Please add name here."
hint="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NAME_HINT"
/>
<!-- Alias Field. Type: Text. (joomla) -->
<!-- Codename Field. Type: Text. (joomla) -->
<field
type="text"
name="alias"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ALIAS_LABEL"
size="40"
maxlength="50"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ALIAS_DESCRIPTION"
name="codename"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_CODENAME_LABEL"
size="80"
maxlength="150"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_CODENAME_DESCRIPTION"
class="text_area"
filter="CMD"
message="Error! Please add name in code here."
hint="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ALIAS_HINT"
hint="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_CODENAME_HINT"
/>
<!-- Description Field. Type: Text. (joomla) -->
<field

View File

@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 36 of this MVC
@build 12th January, 2017
@version @update number 37 of this MVC
@build 3rd February, 2017
@created 30th April, 2015
@package Component Builder
@subpackage field.js

View File

@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 65 of this MVC
@build 18th October, 2016
@version @update number 66 of this MVC
@build 3rd February, 2017
@created 18th May, 2015
@package Component Builder
@subpackage layout.js

View File

@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 44 of this MVC
@build 29th January, 2017
@version @update number 48 of this MVC
@build 3rd February, 2017
@created 29th May, 2015
@package Component Builder
@subpackage site_view.js

View File

@ -119,18 +119,18 @@
message="Error! Please add name here."
hint="COM_COMPONENTBUILDER_SITE_VIEW_NAME_HINT"
/>
<!-- Alias Field. Type: Text. (joomla) -->
<!-- Codename Field. Type: Text. (joomla) -->
<field
type="text"
name="alias"
label="COM_COMPONENTBUILDER_SITE_VIEW_ALIAS_LABEL"
size="40"
maxlength="50"
description="COM_COMPONENTBUILDER_SITE_VIEW_ALIAS_DESCRIPTION"
name="codename"
label="COM_COMPONENTBUILDER_SITE_VIEW_CODENAME_LABEL"
size="80"
maxlength="150"
description="COM_COMPONENTBUILDER_SITE_VIEW_CODENAME_DESCRIPTION"
class="text_area"
filter="CMD"
message="Error! Please add name in code here."
hint="COM_COMPONENTBUILDER_SITE_VIEW_ALIAS_HINT"
hint="COM_COMPONENTBUILDER_SITE_VIEW_CODENAME_HINT"
/>
<!-- Description Field. Type: Text. (joomla) -->
<field

View File

@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 39 of this MVC
@build 18th October, 2016
@version @update number 40 of this MVC
@build 3rd February, 2017
@created 26th May, 2015
@package Component Builder
@subpackage template.js

View File

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

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 65 of this MVC
@build 18th October, 2016
@version @update number 66 of this MVC
@build 3rd February, 2017
@created 18th May, 2015
@package Component Builder
@subpackage layout.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 65 of this MVC
@build 18th October, 2016
@version @update number 66 of this MVC
@build 3rd February, 2017
@created 18th May, 2015
@package Component Builder
@subpackage layouts.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 44 of this MVC
@build 29th January, 2017
@version @update number 48 of this MVC
@build 3rd February, 2017
@created 29th May, 2015
@package Component Builder
@subpackage site_view.php
@ -769,7 +769,7 @@ class ComponentbuilderModelSite_view extends JModelAdmin
}
}
list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name);
$this->table->name = $this->generateUniqe('name',$this->table->name);
// insert all set values
if (ComponentbuilderHelper::checkArray($values))
@ -1055,60 +1055,6 @@ class ComponentbuilderModelSite_view extends JModelAdmin
$data['params'] = (string) $params;
}
// Alter the name for save as copy
if ($input->get('task') === 'save2copy')
{
$origTable = clone $this->getTable();
$origTable->load($input->getInt('id'));
if ($data['name'] == $origTable->name)
{
list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']);
$data['name'] = $name;
$data['alias'] = $alias;
}
else
{
if ($data['alias'] == $origTable->alias)
{
$data['alias'] = '';
}
}
$data['published'] = 0;
}
// Automatic handling of alias for empty fields
if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0)
{
if ($data['alias'] == null)
{
if (JFactory::getConfig()->get('unicodeslugs') == 1)
{
$data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']);
}
else
{
$data['alias'] = JFilterOutput::stringURLSafe($data['name']);
}
$table = JTable::getInstance('site_view', 'componentbuilderTable');
if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0))
{
$msg = JText::_('COM_COMPONENTBUILDER_SITE_VIEW_SAVE_WARNING');
}
list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']);
$data['alias'] = $alias;
if (isset($msg))
{
JFactory::getApplication()->enqueueMessage($msg, 'warning');
}
}
}
// Alter the uniqe field for save as copy
if ($input->get('task') === 'save2copy')
{
@ -1157,24 +1103,22 @@ class ComponentbuilderModelSite_view extends JModelAdmin
/**
* Method to change the title & alias.
*
* @param string $alias The alias.
* @param string $title The title.
*
* @return array Contains the modified title and alias.
*
*/
protected function _generateNewTitle($alias, $title)
protected function _generateNewTitle($title)
{
// Alter the title & alias
// Alter the title
$table = $this->getTable();
while ($table->load(array('alias' => $alias)))
while ($table->load(array('title' => $title)))
{
$title = JString::increment($title);
$alias = JString::increment($alias, 'dash');
}
return array($title, $alias);
return $title;
}
}

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 44 of this MVC
@build 29th January, 2017
@version @update number 48 of this MVC
@build 3rd February, 2017
@created 29th May, 2015
@package Component Builder
@subpackage site_views.php
@ -46,7 +46,7 @@ class ComponentbuilderModelSite_views extends JModelList
'a.modified_by','modified_by',
'a.system_name','system_name',
'a.name','name',
'a.alias','alias',
'a.codename','codename',
'a.description','description'
);
}
@ -74,8 +74,8 @@ class ComponentbuilderModelSite_views extends JModelList
$name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name');
$this->setState('filter.name', $name);
$alias = $this->getUserStateFromRequest($this->context . '.filter.alias', 'filter_alias');
$this->setState('filter.alias', $alias);
$codename = $this->getUserStateFromRequest($this->context . '.filter.codename', 'filter_codename');
$this->setState('filter.codename', $codename);
$description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description');
$this->setState('filter.description', $description);
@ -195,7 +195,7 @@ class ComponentbuilderModelSite_views extends JModelList
else
{
$search = $db->quote('%' . $db->escape($search) . '%');
$query->where('(a.system_name LIKE '.$search.' OR a.name LIKE '.$search.' OR a.alias LIKE '.$search.' OR a.description LIKE '.$search.')');
$query->where('(a.system_name LIKE '.$search.' OR a.name LIKE '.$search.' OR a.codename LIKE '.$search.' OR a.description LIKE '.$search.')');
}
}
@ -350,7 +350,7 @@ class ComponentbuilderModelSite_views extends JModelList
$id .= ':' . $this->getState('filter.modified_by');
$id .= ':' . $this->getState('filter.system_name');
$id .= ':' . $this->getState('filter.name');
$id .= ':' . $this->getState('filter.alias');
$id .= ':' . $this->getState('filter.codename');
$id .= ':' . $this->getState('filter.description');
return parent::getStoreId($id);

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 39 of this MVC
@build 18th October, 2016
@version @update number 40 of this MVC
@build 3rd February, 2017
@created 26th May, 2015
@package Component Builder
@subpackage template.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 39 of this MVC
@build 18th October, 2016
@version @update number 40 of this MVC
@build 3rd February, 2017
@created 26th May, 2015
@package Component Builder
@subpackage templates.php