Added module area target client switch. Added the custom code placeholder search to modules. Improved the JCB backup feature to only move the zip package to the backup location.

This commit is contained in:
2020-03-13 04:45:08 +02:00
parent aae9ffb6e0
commit 86f671c87c
17 changed files with 403 additions and 181 deletions

View File

@ -99,6 +99,22 @@
message="COM_COMPONENTBUILDER_JOOMLA_MODULE_SYSTEM_NAME_MESSAGE"
hint="COM_COMPONENTBUILDER_JOOMLA_MODULE_SYSTEM_NAME_HINT"
/>
<!-- Target Field. Type: Radio. (joomla) -->
<field
type="radio"
name="target"
label="COM_COMPONENTBUILDER_JOOMLA_MODULE_TARGET_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_MODULE_TARGET_DESCRIPTION"
class="btn-group btn-group-yesno"
default="1"
required="true"
validate="int">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_JOOMLA_MODULE_SITE</option>
<option value="2">
COM_COMPONENTBUILDER_JOOMLA_MODULE_ADMIN</option>
</field>
<!-- Description Field. Type: Textarea. (joomla) -->
<field
type="textarea"
@ -111,6 +127,34 @@
filter="HTML"
hint="COM_COMPONENTBUILDER_JOOMLA_MODULE_DESCRIPTION_HINT"
/>
<!-- Add_php_method_uninstall Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_php_method_uninstall"
label="COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_PHP_METHOD_UNINSTALL_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_JOOMLA_MODULE_YES</option>
<option value="0">
COM_COMPONENTBUILDER_JOOMLA_MODULE_NO</option>
</field>
<!-- Add_php_postflight_update Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_php_postflight_update"
label="COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_PHP_POSTFLIGHT_UPDATE_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_JOOMLA_MODULE_YES</option>
<option value="0">
COM_COMPONENTBUILDER_JOOMLA_MODULE_NO</option>
</field>
<!-- Add_php_postflight_install Field. Type: Radio. (joomla) -->
<field
type="radio"
@ -139,17 +183,76 @@
<option value="0">
COM_COMPONENTBUILDER_JOOMLA_MODULE_NO</option>
</field>
<!-- Update_server Field. Type: Servers. (custom) -->
<!-- Addreadme Field. Type: Radio. (joomla) -->
<field
type="servers"
name="update_server"
label="COM_COMPONENTBUILDER_JOOMLA_MODULE_UPDATE_SERVER_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_MODULE_UPDATE_SERVER_DESCRIPTION"
type="radio"
name="addreadme"
label="COM_COMPONENTBUILDER_JOOMLA_MODULE_ADDREADME_LABEL"
class="btn-group btn-group-yesno"
default="0">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_JOOMLA_MODULE_YES</option>
<option value="0">
COM_COMPONENTBUILDER_JOOMLA_MODULE_NO</option>
</field>
<!-- Note_libraries_options Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_libraries_options" label="COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_LIBRARIES_OPTIONS_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_LIBRARIES_OPTIONS_DESCRIPTION" heading="h4" class="alert alert-info note_libraries_options" />
<!-- Note_linked_to_notice Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_linked_to_notice" label="COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_LINKED_TO_NOTICE_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_LINKED_TO_NOTICE_DESCRIPTION" heading="h4" class="note_linked_to_notice" />
<!-- Not_required Field. Type: Hidden. (joomla) -->
<field
type="hidden"
name="not_required"
default="一_一"
/>
<!-- Note_snippet_usage Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_snippet_usage" label="COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_SNIPPET_USAGE_LABEL" heading="h4" class="snippet-usage note_snippet_usage" />
<!-- Default Field. Type: Editor. (joomla) -->
<field
type="editor"
name="default"
label="COM_COMPONENTBUILDER_JOOMLA_MODULE_DEFAULT_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_MODULE_DEFAULT_DESCRIPTION"
width="100%"
height="500px"
cols="15"
rows="30"
buttons="no"
syntax="html"
editor="codemirror|none"
filter="raw"
validate="code"
/>
<!-- Note_uikit_snippet Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_uikit_snippet" label="COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_UIKIT_SNIPPET_LABEL" heading="h4" class="snippet-code note_uikit_snippet" />
<!-- Snippet Field. Type: Snippets. (custom) -->
<field
type="snippets"
name="snippet"
label="COM_COMPONENTBUILDER_JOOMLA_MODULE_SNIPPET_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_MODULE_SNIPPET_DESCRIPTION"
class="list_class"
multiple="false"
default="0"
required="false"
button="true"
/>
<!-- Note_add_language_string Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_add_language_string" label="COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_ADD_LANGUAGE_STRING_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_ADD_LANGUAGE_STRING_DESCRIPTION" heading="h4" class="note_add_language_string" />
<!-- Add_sql Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_sql"
label="COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_SQL_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_JOOMLA_MODULE_YES</option>
<option value="0">
COM_COMPONENTBUILDER_JOOMLA_MODULE_NO</option>
</field>
<!-- Update_server_target Field. Type: Radio. (joomla) -->
<field
type="radio"
@ -167,108 +270,6 @@
<option value="3">
COM_COMPONENTBUILDER_JOOMLA_MODULE_OTHER</option>
</field>
<!-- Addreadme Field. Type: Radio. (joomla) -->
<field
type="radio"
name="addreadme"
label="COM_COMPONENTBUILDER_JOOMLA_MODULE_ADDREADME_LABEL"
class="btn-group btn-group-yesno"
default="0">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_JOOMLA_MODULE_YES</option>
<option value="0">
COM_COMPONENTBUILDER_JOOMLA_MODULE_NO</option>
</field>
<!-- Add_sql Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_sql"
label="COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_SQL_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_JOOMLA_MODULE_YES</option>
<option value="0">
COM_COMPONENTBUILDER_JOOMLA_MODULE_NO</option>
</field>
<!-- Note_snippet_usage Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_snippet_usage" label="COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_SNIPPET_USAGE_LABEL" heading="h4" class="snippet-usage note_snippet_usage" />
<!-- Note_uikit_snippet Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_uikit_snippet" label="COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_UIKIT_SNIPPET_LABEL" heading="h4" class="snippet-code note_uikit_snippet" />
<!-- Snippet Field. Type: Snippets. (custom) -->
<field
type="snippets"
name="snippet"
label="COM_COMPONENTBUILDER_JOOMLA_MODULE_SNIPPET_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_MODULE_SNIPPET_DESCRIPTION"
class="list_class"
multiple="false"
required="false"
button="true"
/>
<!-- Note_add_language_string Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_add_language_string" label="COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_ADD_LANGUAGE_STRING_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_ADD_LANGUAGE_STRING_DESCRIPTION" heading="h4" class="note_add_language_string" />
<!-- Note_libraries_options Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_libraries_options" label="COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_LIBRARIES_OPTIONS_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_LIBRARIES_OPTIONS_DESCRIPTION" heading="h4" class="alert alert-info note_libraries_options" />
<!-- Libraries Field. Type: Libraries. (custom) -->
<field
type="libraries"
name="libraries"
label="COM_COMPONENTBUILDER_JOOMLA_MODULE_LIBRARIES_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_MODULE_LIBRARIES_DESCRIPTION"
class="list_class"
multiple="true"
default="0"
required="false"
button="true"
/>
<!-- Add_php_postflight_update Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_php_postflight_update"
label="COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_PHP_POSTFLIGHT_UPDATE_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_JOOMLA_MODULE_YES</option>
<option value="0">
COM_COMPONENTBUILDER_JOOMLA_MODULE_NO</option>
</field>
<!-- Add_php_method_uninstall Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_php_method_uninstall"
label="COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_PHP_METHOD_UNINSTALL_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_JOOMLA_MODULE_YES</option>
<option value="0">
COM_COMPONENTBUILDER_JOOMLA_MODULE_NO</option>
</field>
<!-- Default Field. Type: Editor. (joomla) -->
<field
type="editor"
name="default"
label="COM_COMPONENTBUILDER_JOOMLA_MODULE_DEFAULT_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_MODULE_DEFAULT_DESCRIPTION"
width="100%"
height="500px"
cols="15"
rows="30"
buttons="no"
syntax="html"
editor="codemirror|none"
filter="raw"
validate="code"
/>
<!-- Add_sql_uninstall Field. Type: Radio. (joomla) -->
<field
type="radio"
@ -283,8 +284,17 @@
<option value="0">
COM_COMPONENTBUILDER_JOOMLA_MODULE_NO</option>
</field>
<!-- Note_linked_to_notice Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_linked_to_notice" label="COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_LINKED_TO_NOTICE_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_LINKED_TO_NOTICE_DESCRIPTION" heading="h4" class="note_linked_to_notice" />
<!-- Update_server Field. Type: Servers. (custom) -->
<field
type="servers"
name="update_server"
label="COM_COMPONENTBUILDER_JOOMLA_MODULE_UPDATE_SERVER_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_MODULE_UPDATE_SERVER_DESCRIPTION"
class="list_class"
multiple="false"
default="0"
button="true"
/>
<!-- Add_update_server Field. Type: Radio. (joomla) -->
<field
type="radio"
@ -299,11 +309,17 @@
<option value="0">
COM_COMPONENTBUILDER_JOOMLA_MODULE_NO</option>
</field>
<!-- Not_required Field. Type: Hidden. (joomla) -->
<!-- Libraries Field. Type: Libraries. (custom) -->
<field
type="hidden"
name="not_required"
default="一_一"
type="libraries"
name="libraries"
label="COM_COMPONENTBUILDER_JOOMLA_MODULE_LIBRARIES_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_MODULE_LIBRARIES_DESCRIPTION"
class="list_class"
multiple="true"
default="0"
required="false"
button="true"
/>
<!-- Note_update_server_note_zip Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_update_server_note_zip" label="COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_UPDATE_SERVER_NOTE_ZIP_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_UPDATE_SERVER_NOTE_ZIP_DESCRIPTION" heading="h4" class="alert alert-info note_update_server_note_zip" />

View File

@ -131,16 +131,14 @@ class ComponentbuilderModelJoomla_components extends JModelList
{
// set custom folder path
$this->customPath = $this->params->get('custom_folder_path', JPATH_COMPONENT_ADMINISTRATOR.'/custom');
// set the backup paths
$comConfig = JFactory::getConfig();
$this->backupPath = $comConfig->get('tmp_path');
// check what type of export or backup this is
if ('backup' === $this->activeType || 'manualBackup' === $this->activeType)
{
// set the paths
if (!$this->backupPath = $this->params->get('cronjob_backup_folder_path', null))
{
// set the paths
$comConfig = JFactory::getConfig();
$this->backupPath = $comConfig->get('tmp_path');
}
// set the zip path
$this->zipPath = $this->params->get('cronjob_backup_folder_path', $this->backupPath);
// check what backup type we are working with here
$this->backupType = $this->params->get('cronjob_backup_type', 1); // 1 = local folder; 2 = remote server (default is local)
// if remote server get the ID
@ -162,9 +160,8 @@ class ComponentbuilderModelJoomla_components extends JModelList
}
else
{
// set the paths
$comConfig = JFactory::getConfig();
$this->backupPath = $comConfig->get('tmp_path');
// set the zip path
$this->zipPath = $this->backupPath;
// set the package name
if (count($items) == 1)
{
@ -177,7 +174,7 @@ class ComponentbuilderModelJoomla_components extends JModelList
}
// set the package path
$this->packagePath = rtrim($this->backupPath, '/') . '/' . $this->packageName;
$this->zipPath = $this->packagePath .'.zip';
$this->zipPath = rtrim($this->zipPath, '/') . '/' . $this->packageName .'.zip';
if (JFolder::exists($this->packagePath))
{
// remove if old folder is found
@ -187,7 +184,7 @@ class ComponentbuilderModelJoomla_components extends JModelList
JFolder::create($this->packagePath);
// Get the basic encryption.
$basickey = ComponentbuilderHelper::getCryptKey('basic');
// Get the encription object.
// Get the encryption object.
if ($basickey)
{
$basic = new FOFEncryptAes($basickey, 128);

View File

@ -45,7 +45,8 @@ class ComponentbuilderModelJoomla_module extends JModelAdmin
),
'above' => array(
'system_name',
'module_version'
'module_version',
'target'
)
),
'script_file' => array(
@ -66,19 +67,6 @@ class ComponentbuilderModelJoomla_module extends JModelAdmin
'php_method_uninstall'
)
),
'dynamic_integration' => array(
'left' => array(
'add_update_server',
'update_server_url',
'update_server_target',
'note_update_server_note_ftp',
'note_update_server_note_zip',
'note_update_server_note_other',
'update_server',
'add_sales_server',
'sales_server'
)
),
'readme' => array(
'left' => array(
'addreadme',
@ -93,6 +81,19 @@ class ComponentbuilderModelJoomla_module extends JModelAdmin
'sql_uninstall'
)
),
'dynamic_integration' => array(
'left' => array(
'add_update_server',
'update_server_url',
'update_server_target',
'note_update_server_note_ftp',
'note_update_server_note_zip',
'note_update_server_note_other',
'update_server',
'add_sales_server',
'sales_server'
)
),
'code' => array(
'left' => array(
'custom_get'

View File

@ -28,7 +28,8 @@ class ComponentbuilderModelJoomla_modules extends JModelList
'a.created_by','created_by',
'a.modified_by','modified_by',
'a.system_name','system_name',
'a.description','description'
'a.description','description',
'a.target','target'
);
}
@ -53,7 +54,10 @@ class ComponentbuilderModelJoomla_modules extends JModelList
$this->setState('filter.system_name', $system_name);
$description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description');
$this->setState('filter.description', $description);
$this->setState('filter.description', $description);
$target = $this->getUserStateFromRequest($this->context . '.filter.target', 'filter_target');
$this->setState('filter.target', $target);
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
$this->setState('filter.sorting', $sorting);
@ -109,10 +113,44 @@ class ComponentbuilderModelJoomla_modules extends JModelList
}
}
}
}
// set selection value to a translatable value
if (ComponentbuilderHelper::checkArray($items))
{
foreach ($items as $nr => &$item)
{
// convert target
$item->target = $this->selectionTranslation($item->target, 'target');
}
}
// return items
return $items;
}
/**
* Method to convert selection values to translatable string.
*
* @return translatable string
*/
public function selectionTranslation($value,$name)
{
// Array of target language strings
if ($name === 'target')
{
$targetArray = array(
1 => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_SITE',
2 => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_ADMIN'
);
// Now check if value is found in this array
if (isset($targetArray[$value]) && ComponentbuilderHelper::checkString($targetArray[$value]))
{
return $targetArray[$value];
}
}
return $value;
}
/**
@ -174,6 +212,11 @@ class ComponentbuilderModelJoomla_modules extends JModelList
}
}
// Filter by Target.
if ($target = $this->getState('filter.target'))
{
$query->where('a.target = ' . $db->quote($db->escape($target)));
}
// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id');
@ -202,7 +245,8 @@ class ComponentbuilderModelJoomla_modules extends JModelList
$id .= ':' . $this->getState('filter.created_by');
$id .= ':' . $this->getState('filter.modified_by');
$id .= ':' . $this->getState('filter.system_name');
$id .= ':' . $this->getState('filter.description');
$id .= ':' . $this->getState('filter.description');
$id .= ':' . $this->getState('filter.target');
return parent::getStoreId($id);
}