'', 'short_description' => $result->short_description, 'description' => $result->description);
+ // set the headers
+ $field['values_description'] .= ''.JText::_('COM_COMPONENTBUILDER_PROPERTY').' | '.JText::_('COM_COMPONENTBUILDER_EXAMPLE').' | '.JText::_('COM_COMPONENTBUILDER_DESCRIPTION').' |
';
foreach ($properties as $property)
{
- $field['values_description'] .= ''.$property['name'].' '.$property['description'].'';
+ $example = (isset($property['example']) && self::checkString($property['example'])) ? ''.$property['example'].'
' : '';
+ $field['values_description'] .= ''.$property['name'].' | '.$example.' | '.$property['description'].' |
';
if(isset($settings[$property['name']]))
{
$field['values'] .= "\n\t".$property['name'].'="'.$settings[$property['name']].'" ';
@@ -1640,7 +1697,7 @@ abstract class ComponentbuilderHelper
}
}
$field['values'] .= "\n/>";
- $field['values_description'] .= '';
+ $field['values_description'] .= '
';
// return found field options
return $field;
}
@@ -2814,6 +2871,10 @@ abstract class ComponentbuilderHelper
{
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_GET_SNIPPETS'), 'index.php?option=com_componentbuilder&view=get_snippets', $submenu === 'get_snippets');
}
+ if ($user->authorise('validation_rule.access', 'com_componentbuilder') && $user->authorise('validation_rule.submenu', 'com_componentbuilder'))
+ {
+ JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_VALIDATION_RULES'), 'index.php?option=com_componentbuilder&view=validation_rules', $submenu === 'validation_rules');
+ }
if ($user->authorise('field.access', 'com_componentbuilder') && $user->authorise('field.submenu', 'com_componentbuilder'))
{
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_FIELDS'), 'index.php?option=com_componentbuilder&view=fields', $submenu === 'fields');
diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini
index 05b67d0ec..7060bf9d5 100644
--- a/admin/language/en-GB/en-GB.com_componentbuilder.ini
+++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini
@@ -1,5 +1,8 @@
COM_COMPONENTBUILDER="Component Builder"
COM_COMPONENTBUILDER_ABOVE_TABS="Above Tabs"
+COM_COMPONENTBUILDER_ACCEPTS_AN_EMAIL_ADDRESS_SATISFIES_A_BASIC_SYNTAX_CHECK_IN_THE_PATTERN_OF_QUOTXYZZQUOT_WITH_NO_INVALID_CHARACTERS="Accepts an email address satisfies a basic syntax check in the pattern of "x@y.zz", with no invalid characters."
+COM_COMPONENTBUILDER_ACCEPTS_ONLY_EMPTY_VALUES_CONVERTED_TO_ZERO_AND_STRINGS_IN_THE_FORM_RGB_OR_RRGGBB_WHERE_R_G_AND_B_ARE_HEX_VALUES="Accepts only empty values (converted to '#000000') and strings in the form '#RGB' or '#RRGGBB' where R, G, and B are hex values."
+COM_COMPONENTBUILDER_ACCEPTS_ONLY_THE_VALUES_ZERO_ONE_TRUE_OR_FALSE_CASEINSENSITIVE="Accepts only the values '0', '1', 'true' or 'false' (case-insensitive)."
COM_COMPONENTBUILDER_ACCESS_BULK_TOOLS="Access Bulk Tools"
COM_COMPONENTBUILDER_ACCESS_DENIED="Access denied!"
COM_COMPONENTBUILDER_ACTIVE_ONLY_FOUR_TEXT_FIELD="Active (only 4 text_field)"
@@ -3190,9 +3193,8 @@ COM_COMPONENTBUILDER_DASHBOARD_FIELDTYPES="Fieldtypes
"
COM_COMPONENTBUILDER_DASHBOARD_FIELDTYPES_CATID="Category For
Fieldtypes"
COM_COMPONENTBUILDER_DASHBOARD_FIELDTYPE_ADD="Add Fieldtype
"
COM_COMPONENTBUILDER_DASHBOARD_FIELD_ADD="Add Field
"
-COM_COMPONENTBUILDER_DASHBOARD_GETSNIPPETS="Get Snippets
"
+COM_COMPONENTBUILDER_DASHBOARD_GET_SNIPPETS="Get Snippets
"
COM_COMPONENTBUILDER_DASHBOARD_HELP_DOCUMENTS="Help Documents
"
-COM_COMPONENTBUILDER_DASHBOARD_HELP_DOCUMENT_ADD="Add Help Document
"
COM_COMPONENTBUILDER_DASHBOARD_IMPORTJCBPACKAGES="Import JCB Packages
"
COM_COMPONENTBUILDER_DASHBOARD_JOOMLA_COMPONENTS="Joomla Components
"
COM_COMPONENTBUILDER_DASHBOARD_JOOMLA_COMPONENT_ADD="Add Joomla Component
"
@@ -3207,6 +3209,7 @@ COM_COMPONENTBUILDER_DASHBOARD_SITE_VIEW_ADD="Add Site View
"
COM_COMPONENTBUILDER_DASHBOARD_SNIPPETS="Snippets
"
COM_COMPONENTBUILDER_DASHBOARD_TEMPLATES="Templates
"
COM_COMPONENTBUILDER_DASHBOARD_TEMPLATE_ADD="Add Template
"
+COM_COMPONENTBUILDER_DASHBOARD_VALIDATION_RULES="Validation Rules
"
COM_COMPONENTBUILDER_DATE="Date"
COM_COMPONENTBUILDER_DEBUG_LINE_NUMBERS="Debug (line numbers)"
COM_COMPONENTBUILDER_DEFAULT_LINK="Default (link)"
@@ -3559,6 +3562,7 @@ COM_COMPONENTBUILDER_ERROR_THE_SNIPPET_IS_FAULTY_AND_COULD_NOT_BE_SAVED="Error!
COM_COMPONENTBUILDER_ERROR_YOU_DO_NOT_HAVE_ACCESS_TO_THE_SNIPPETS="Error! You do not have access to the snippets."
COM_COMPONENTBUILDER_ERROR_YOU_DO_NOT_HAVE_PERMISSION_TO_CREATE_THE_SNIPPET="Error! You do not have permission to create the snippet."
COM_COMPONENTBUILDER_EXACT_LENGTH_ONLY_FOUR_TEXT_FIELD="Exact Length (only 4 text_field)"
+COM_COMPONENTBUILDER_EXAMPLE="Example"
COM_COMPONENTBUILDER_EXPORTIMPORT_DATA="Export/Import Data"
COM_COMPONENTBUILDER_EXPORT_COMPLETED="Export Completed!"
COM_COMPONENTBUILDER_EXPORT_COMPONENTS="Export Components"
@@ -3813,31 +3817,91 @@ COM_COMPONENTBUILDER_FIELD_NO="No"
COM_COMPONENTBUILDER_FIELD_NONE="None"
COM_COMPONENTBUILDER_FIELD_NONE_SET="None Set"
COM_COMPONENTBUILDER_FIELD_NOTE_FILTER_INFORMATION_DESCRIPTION=""
COM_COMPONENTBUILDER_FIELD_NOTE_WHMCS_ENCRYPTION_DESCRIPTION="When using the WHMCS encryption you need to get a WHMCS key from:
https://www.vdm.io, or your own WHMCS install.
Please note that you will need to enable the add-on in the Joomla Component area (Add WHMCS)->Yes.
You can get more info about the WHMCS licensing add-on at the following links.
Helpful Links:
https://www.whmcs.com/addons/licensing-addon/
@@ -3891,6 +3955,7 @@ COM_COMPONENTBUILDER_FOLDER_BSB_WAS_MOVED_TO_BSB="Folder %s was moved to
COM_COMPONENTBUILDER_FOLDER_BSB_WAS_NOT_MOVE_TO_BSB="Folder %s was not move to %s"
COM_COMPONENTBUILDER_FORCE_LOCAL_UPDATE="Force Local Update"
COM_COMPONENTBUILDER_FULL_WIDTH_IN_TAB="Full Width in Tab"
+COM_COMPONENTBUILDER_FUNCTION_NAME_ALREADY_TAKEN_PLEASE_TRY_AGAIN="Function name already taken, please try again."
COM_COMPONENTBUILDER_GENERAL_OVERVIEW_OF_HOW_THINGS_WORK_BSB="General overview of how things work: %s"
COM_COMPONENTBUILDER_GETTING_AVAILABLE_LIBRARIES="Getting available libraries"
COM_COMPONENTBUILDER_GET_ALL_NEW_SNIPPETS="Get All New Snippets"
@@ -3902,6 +3967,8 @@ COM_COMPONENTBUILDER_GET_SNIPPETS_ACCESS="Get Snippets Access"
COM_COMPONENTBUILDER_GET_SNIPPETS_ACCESS_DESC=" Allows the users in this group to access get snippets."
COM_COMPONENTBUILDER_GET_SNIPPETS_CUSTOM_ADMIN_VIEWS_BUTTON_ACCESS="Get Snippets Custom Admin Views Button Access"
COM_COMPONENTBUILDER_GET_SNIPPETS_CUSTOM_ADMIN_VIEWS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the custom admin views button."
+COM_COMPONENTBUILDER_GET_SNIPPETS_DASHBOARD_LIST="Get Snippets Dashboard List"
+COM_COMPONENTBUILDER_GET_SNIPPETS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the Get Snippets"
COM_COMPONENTBUILDER_GET_SNIPPETS_DESC="The compiler"
COM_COMPONENTBUILDER_GET_SNIPPETS_LAYOUTS_BUTTON_ACCESS="Get Snippets Layouts Button Access"
COM_COMPONENTBUILDER_GET_SNIPPETS_LAYOUTS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the layouts button."
@@ -3911,6 +3978,8 @@ COM_COMPONENTBUILDER_GET_SNIPPETS_SITE_VIEWS_BUTTON_ACCESS="Get Snippets Site Vi
COM_COMPONENTBUILDER_GET_SNIPPETS_SITE_VIEWS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the site views button."
COM_COMPONENTBUILDER_GET_SNIPPETS_SNIPPETS_BUTTON_ACCESS="Get Snippets Snippets Button Access"
COM_COMPONENTBUILDER_GET_SNIPPETS_SNIPPETS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the snippets button."
+COM_COMPONENTBUILDER_GET_SNIPPETS_SUBMENU="Get Snippets Submenu"
+COM_COMPONENTBUILDER_GET_SNIPPETS_SUBMENU_DESC="Allows the users in this group to update the submenu of the Get Snippets"
COM_COMPONENTBUILDER_GET_SNIPPETS_TEMPLATES_BUTTON_ACCESS="Get Snippets Templates Button Access"
COM_COMPONENTBUILDER_GET_SNIPPETS_TEMPLATES_BUTTON_ACCESS_DESC=" Allows the users in this group to access the templates button."
COM_COMPONENTBUILDER_GET_THE_KEY_FROM_BSB_FOR_A_CLASSBTN_BTNPRIMARY_HREFS_TARGET_BLANK_TITLEGET_A_KEY_FROM_SSA="Get the key from %s for %s"
@@ -3918,6 +3987,7 @@ COM_COMPONENTBUILDER_GET_THE_SNIPPET_FROM_GITHUB_AND_INSTALL_IT_LOCALLY="Get the
COM_COMPONENTBUILDER_GET_THE_SNIPPET_FROM_GITHUB_AND_UPDATE_THE_LOCAL_VERSION="Get the snippet from gitHub and update the local version"
COM_COMPONENTBUILDER_GLOBAL="Global"
COM_COMPONENTBUILDER_GREAT_THIS_FUNCTION_NAME_WILL_WORK="Great, this function name will work!"
+COM_COMPONENTBUILDER_GREAT_THIS_VALIDATION_RULE_NAME_S_WILL_WORK="Great, this validation rule name (%s) will work!"
COM_COMPONENTBUILDER_HAS_METADATA="Has Metadata"
COM_COMPONENTBUILDER_HELP_DOCUMENT="Help Document"
COM_COMPONENTBUILDER_HELP_DOCUMENTS="Help Documents"
@@ -3929,8 +3999,6 @@ COM_COMPONENTBUILDER_HELP_DOCUMENTS_BATCH_USE="Help Documents Batch Use"
COM_COMPONENTBUILDER_HELP_DOCUMENTS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch help documents"
COM_COMPONENTBUILDER_HELP_DOCUMENTS_CREATE="Help Documents Create"
COM_COMPONENTBUILDER_HELP_DOCUMENTS_CREATE_DESC="Allows the users in this group to create create help documents"
-COM_COMPONENTBUILDER_HELP_DOCUMENTS_DASHBOARD_ADD="Help Documents Dashboard Add"
-COM_COMPONENTBUILDER_HELP_DOCUMENTS_DASHBOARD_ADD_DESC="Allows the users in this group to update the dashboard add of the help document"
COM_COMPONENTBUILDER_HELP_DOCUMENTS_DASHBOARD_LIST="Help Documents Dashboard List"
COM_COMPONENTBUILDER_HELP_DOCUMENTS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the help document"
COM_COMPONENTBUILDER_HELP_DOCUMENTS_DELETE="Help Documents Delete"
@@ -4081,6 +4149,7 @@ COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_SERVERS="Select the file to import d
COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_SITE_VIEWS="Select the file to import data to site_views."
COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_SNIPPETS="Select the file to import data to snippets."
COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_TEMPLATES="Select the file to import data to templates."
+COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_VALIDATION_RULES="Select the file to import data to validation_rules."
COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_URL="Enter file URL"
COM_COMPONENTBUILDER_IMPORT_SUCCESS="Great! Import successful."
COM_COMPONENTBUILDER_IMPORT_TABLE_COLUMNS="Table Columns"
@@ -4772,6 +4841,7 @@ COM_COMPONENTBUILDER_LAYOUT_ALIAS_DESCRIPTION="Add Name in Code Here"
COM_COMPONENTBUILDER_LAYOUT_ALIAS_HINT="codename"
COM_COMPONENTBUILDER_LAYOUT_ALIAS_LABEL="Name in Code"
COM_COMPONENTBUILDER_LAYOUT_ALIAS_MESSAGE="Error! Please add name in code here."
+COM_COMPONENTBUILDER_LAYOUT_CODE_SNIPPETS="Layout Code Snippets"
COM_COMPONENTBUILDER_LAYOUT_CREATED_BY_DESC="The user that created this Layout."
COM_COMPONENTBUILDER_LAYOUT_CREATED_BY_LABEL="Created By"
COM_COMPONENTBUILDER_LAYOUT_CREATED_DATE_DESC="The date this Layout was created."
@@ -5231,6 +5301,7 @@ COM_COMPONENTBUILDER_MIN_LENGTH_ONLY_FOUR_TEXT_FIELD="Min Length (only 4 text_fi
COM_COMPONENTBUILDER_NAME="Name"
COM_COMPONENTBUILDER_NAME_ASC="Name (Asc)"
COM_COMPONENTBUILDER_NAME_DESC="Name (Desc)"
+COM_COMPONENTBUILDER_NAME_OF_DYNAMICGET="Name of dynamicGet"
COM_COMPONENTBUILDER_NEED_HELP="Need help?"
COM_COMPONENTBUILDER_NEW="New"
COM_COMPONENTBUILDER_NEW_ISSUE="New Issue"
@@ -5253,6 +5324,7 @@ COM_COMPONENTBUILDER_NO_SNIPPETS_WERE_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_A
COM_COMPONENTBUILDER_NO_S_FOUND="No %s Found"
COM_COMPONENTBUILDER_NO_S_HAVE_BEEN_LINKED_TO_THIS_VIEW_SOON_AS_THIS_IS_DONE_IT_WILL_BE_DISPLAYED_HERE="No %s have been linked to this view. Soon as this is done it will be displayed here."
COM_COMPONENTBUILDER_NO_TYPE="No Type"
+COM_COMPONENTBUILDER_NO_VALIDATION_RULES_FOUND="No validation rules found."
COM_COMPONENTBUILDER_OFFICIAL_VDM_PACKAGES="Official VDM Packages"
COM_COMPONENTBUILDER_ON_GITHUB="on Github"
COM_COMPONENTBUILDER_OPEN="Open"
@@ -5274,6 +5346,7 @@ COM_COMPONENTBUILDER_PACKAGE_OWNER_NOT_SET="Package Owner Not Set"
COM_COMPONENTBUILDER_PATH_CODESCODE="Path: %s
"
COM_COMPONENTBUILDER_PATH_TO_THE_ZIPPED_PACKAGE_IS_CODESCODE_BR_S_S="Path to the zipped package is: %s
%s %s"
COM_COMPONENTBUILDER_PERMISSIONS="Permissions"
+COM_COMPONENTBUILDER_PLACES_ACROSS_JCB_WHERE_THIS_S_IS_LINKED="Places across JCB where this %s is linked."
COM_COMPONENTBUILDER_PLEASE_ADD_FILES_TO_S="Please add files to (%s)"
COM_COMPONENTBUILDER_PLEASE_ADD_FOLDERS_TO_S="Please add folders to (%s)"
COM_COMPONENTBUILDER_PLEASE_CHECK_AGAIN_LATTER="Please check again latter."
@@ -5282,6 +5355,7 @@ COM_COMPONENTBUILDER_PLEASE_SELECT_A_COMPONENT_THAT_YOU_WOULD_LIKE_TO_COMPILE="P
COM_COMPONENTBUILDER_PLEASE_TRY_AGAIN_LATER="Please try again later"
COM_COMPONENTBUILDER_PLEASE_WAIT_CLEARING_THE_TMP_FOLDER="Please wait! Clearing the tmp folder"
COM_COMPONENTBUILDER_PLEASE_WAIT_LOADING="Please wait, loading"
+COM_COMPONENTBUILDER_PROPERTY="Property"
COM_COMPONENTBUILDER_PUBLIC_ACCESS="Public Access"
COM_COMPONENTBUILDER_PUBLISHED="Published"
COM_COMPONENTBUILDER_PUBLISHING="Publishing"
@@ -5290,6 +5364,9 @@ COM_COMPONENTBUILDER_READY_TO_COMPILE_A_COMPONENT="Ready to compile a component"
COM_COMPONENTBUILDER_RELEASED_THIS="released this"
COM_COMPONENTBUILDER_RENAME="Rename"
COM_COMPONENTBUILDER_REPORT_AN_ISSUE_BSB="Report an issue: %s"
+COM_COMPONENTBUILDER_REQUIRES_THE_VALUE_ENTERED_BE_ONE_OF_THE_OPTIONS_IN_AN_ELEMENT_OF_TYPEQUOTLISTQUOT_THAT_IS_THAT_THE_ELEMENT_IS_A_SELECT_LIST="Requires the value entered be one of the options in an element of type="list": that is, that the element is a select list."
+COM_COMPONENTBUILDER_REQUIRES_THE_VALUE_TO_BE_A_TELEPHONE_NUMBER_COMPLYING_WITH_THE_STANDARDS_OF_NANPA_ITUT_TRECEONE_HUNDRED_AND_SIXTY_FOUR_OR_IETF_RFCFOUR_THOUSAND_NINE_HUNDRED_AND_THIRTY_THREE="Requires the value to be a Telephone number complying with the standards of nanpa, ITU-T T-REC-E.164 or ietf rfc4933."
+COM_COMPONENTBUILDER_REQUIRES_THE_VALUE_TO_BE_THE_SAME_AS_THAT_HELD_IN_THE_FIELD_NAMED_QUOTFIELDQUOT_EGS="Requires the value to be the same as that held in the field named "field", eg:%s"
COM_COMPONENTBUILDER_RESPOND_TO_THIS_ISSUE_ON_GITHUB="Respond to this issue on Github"
COM_COMPONENTBUILDER_REVERT_ALL_AHEAD_SNIPPETS="Revert All Ahead Snippets"
COM_COMPONENTBUILDER_REVIEW_THIS_ISSUE_ON_GITHUB="Review this issue on Github"
@@ -6117,6 +6194,8 @@ COM_COMPONENTBUILDER_SNIPPET_VERSION_LABEL="Revision"
COM_COMPONENTBUILDER_SOME_BCUSTOM_FILESB_WERE_MOVED_TO_BSB="Some Custom files were moved to %s"
COM_COMPONENTBUILDER_SOME_BIMAGESB_WERE_MOVED_TO_BSB="Some Images were moved to %s"
COM_COMPONENTBUILDER_SORRY_THIS_FUNCTION_NAME_IS_ALREADY_IN_USE="Sorry this function name is already in use!"
+COM_COMPONENTBUILDER_SORRY_THIS_VALIDATION_RULE_NAME_S_ALREADY_EXIST_AS_PART_OF_THE_JOOMLA_CORE_NO_NEED_TO_CREATE_IT_IF_YOU_ARE_ADAPTING_IT_GIVE_IT_YOUR_OWN_UNIQUE_NAME="Sorry this validation rule name (%s) already exist as part of the Joomla core! No need to create it, if you are adapting it give it your own unique name."
+COM_COMPONENTBUILDER_SORRY_THIS_VALIDATION_RULE_NAME_S_ALREADY_EXIST_IN_YOUR_SYSTEM="Sorry this validation rule name (%s) already exist in your system!"
COM_COMPONENTBUILDER_SORTABLE="Sortable"
COM_COMPONENTBUILDER_SUBMENU="Submenu"
COM_COMPONENTBUILDER_SUBMENU_ADMIN_VIEWS="Admin Views"
@@ -6138,6 +6217,7 @@ COM_COMPONENTBUILDER_SUBMENU_SERVERS="Servers"
COM_COMPONENTBUILDER_SUBMENU_SITE_VIEWS="Site Views"
COM_COMPONENTBUILDER_SUBMENU_SNIPPETS="Snippets"
COM_COMPONENTBUILDER_SUBMENU_TEMPLATES="Templates"
+COM_COMPONENTBUILDER_SUBMENU_VALIDATION_RULES="Validation Rules"
COM_COMPONENTBUILDER_SUCCESS_THE_SNIPPET_WAS_SAVED="Success! The snippet was saved."
COM_COMPONENTBUILDER_SUCCESS_THE_SNIPPET_WAS_SAVED_BUT_THE_MODIFIED_DATE_COULD_NOT_BE_ADJUSTED_BR_BR_BTHIS_MEANS_THE_SNIPPETS_WILL_CONTINUE_TO_APPEAR_OUT_OF_DATEB="Success! The snippet was saved. But the modified date could not be adjusted.
This means the snippets will continue to appear out of date."
COM_COMPONENTBUILDER_S_BEING_IMPORTED="%s Being Imported"
@@ -6202,6 +6282,7 @@ COM_COMPONENTBUILDER_TEMPLATE_ALIAS_DESCRIPTION="Add Name in Code Here"
COM_COMPONENTBUILDER_TEMPLATE_ALIAS_HINT="codename"
COM_COMPONENTBUILDER_TEMPLATE_ALIAS_LABEL="Name in Code"
COM_COMPONENTBUILDER_TEMPLATE_ALIAS_MESSAGE="Error! Please add name in code here."
+COM_COMPONENTBUILDER_TEMPLATE_CODE_SNIPPETS="Template Code Snippets"
COM_COMPONENTBUILDER_TEMPLATE_CREATED_BY_DESC="The user that created this Template."
COM_COMPONENTBUILDER_TEMPLATE_CREATED_BY_LABEL="Created By"
COM_COMPONENTBUILDER_TEMPLATE_CREATED_DATE_DESC="The date this Template was created."
@@ -6273,6 +6354,7 @@ COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_IF_THIS_CONTINUES_PLEASE_INFORM_YOU
COM_COMPONENTBUILDER_THERE_WAS_AN_ERROR_GETTING_THE_PACKAGE_INFO="There was an error getting the package info."
COM_COMPONENTBUILDER_THERE_WAS_A_PROBLEM_BNO_VIEW_OR_ID_FOUND_IN_SESSION_OR_VIEW_NOT_ALLOWED_TO_ACCESS_AREAB_WE_COULD_NOT_LOAD_ANY_LINKED_TO_VALUES_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR="There was a problem, no view or id found in session or view not allowed to access area, we could not load any linked to values. Please inform your system administrator!"
COM_COMPONENTBUILDER_THESE_ARE_THE_SAME_PACKAGES_FOUND_ON_A_S_GITHUBA_AND_CAN_BE_IMPORTED_BY_SIMPLY_MAKING_A_SELECTION_AND_THEN_CLICKING_THE_GET_PACKAGE_BUTTONBR_SOME_OF_THESE_PACKAGES_WOULD_REQUIRE_A_KEY_SINCE_THEY_ARE_NOT_FREE_A_S_GET_A_KEY_TODAYA="These are the same packages found on gitHub and can be imported by simply making a selection and then clicking the [Get Package] button.
Some of these packages would require a key, since they are not free. Get a key today!."
+COM_COMPONENTBUILDER_THE_AVAILABLE_VALIDATION_RULES_FOR_THE_VALIDATE_ATTRIBUTE_ARE="The available validation rules for the validate attribute are:"
COM_COMPONENTBUILDER_THE_BPHPSECLIBNETSFTPB_LIBRARYCLASS_IS_NOT_AVAILABLE_THIS_LIBRARYCLASS_SHOULD_HAVE_BEEN_ADDED_TO_YOUR_BLIBRARIESVDM_IOVENDORB_FOLDER_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO="The phpseclib\NET\SFTP library\class is not available! This library\class should have been added to your libraries/vdm_io/vendor folder. Please contact your system administrator for more info"
COM_COMPONENTBUILDER_THE_BSB_FILE_COULD_NOT_BE_MOVED_TO_BSB_PATH_ON_BSB_SERVER="The %s file could not be moved to %s path on %s server."
COM_COMPONENTBUILDER_THE_BSB_FILE_COULD_NOT_BE_MOVED_TO_BSB_SERVER="The %s file could not be moved to %s server."
@@ -6311,6 +6393,7 @@ COM_COMPONENTBUILDER_THIS_PACKAGE_BPASSEDB_CHECKSUM_VALIDATION_PLEASE_VALIDATE_T
COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY="This package has no key."
COM_COMPONENTBUILDER_TITLE="Title"
COM_COMPONENTBUILDER_TOTAL_DOWNLOADS="total downloads"
+COM_COMPONENTBUILDER_TO_ADD_SIMPLY_COPY_AND_PAST_THE_SNIPPET_INTO_YOUR_CODE="To add simply copy and past the snippet into your code."
COM_COMPONENTBUILDER_TO_CHANGE_THE_PACKAGE_OWNER_DEFAULTS_OPEN_THE_BJCB_GLOBAL_OPTIONSB_GO_TO_THE_BCOMPANYB_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE="To change the package owner defaults. Open the JCB Global Options, go to the Company tab and add the correct company details there."
COM_COMPONENTBUILDER_TO_CHANGE_THE_PACKAGE_OWNER_DEFAULTS_OPEN_THE_JCB_GLOBAL_OPTIONS_GO_TO_THE_COMPANY_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE="To change the package owner defaults. Open the JCB Global Options, go to the Company tab and add the correct company details there."
COM_COMPONENTBUILDER_TO_SHARE_THESE_SNIPPETS_WITH_THE_REST_OF_THE_JCB_COMMUNITY="To share these snippets with the rest of the JCB community,"
@@ -6322,6 +6405,7 @@ COM_COMPONENTBUILDER_TYPE="Type"
COM_COMPONENTBUILDER_TYPE_ASC="Type (Asc)"
COM_COMPONENTBUILDER_TYPE_DESC="Type (Desc)"
COM_COMPONENTBUILDER_TYPE_ERROR="Type Error"
+COM_COMPONENTBUILDER_TYPE_NAME="Type - Name"
COM_COMPONENTBUILDER_UNACTIVE_ONLY_FOUR_TEXT_FIELD="Unactive (only 4 text_field)"
COM_COMPONENTBUILDER_UNDERNEATH_TABS="Underneath Tabs"
COM_COMPONENTBUILDER_UPDATE="Update"
@@ -6333,6 +6417,90 @@ COM_COMPONENTBUILDER_USED_IN="used in"
COM_COMPONENTBUILDER_USE_BATCH="Use Batch"
COM_COMPONENTBUILDER_USE_BATCH_DESC=" Allows users in this group to use batch copy/update method."
COM_COMPONENTBUILDER_USE_KEY="Use Key"
+COM_COMPONENTBUILDER_VALIDATE="Validate"
+COM_COMPONENTBUILDER_VALIDATES_THAT_THE_VALUE_DOES_NOT_APPEAR_AS_A_USERNAME_ON_THE_SYSTEM_THAT_IS_THAT_IT_IS_A_VALID_NEW_USERNAME_DOES_NOT_SYNTAX_CHECK_IT_AS_A_VALID_NAME="Validates that the value does NOT appear as a username on the system; that is, that it is a valid new username. Does not syntax check it as a valid name."
+COM_COMPONENTBUILDER_VALIDATES_THAT_THE_VALUE_IS_A_URL_WITH_A_VALID_SCHEME_WHICH_CAN_BE_RESTRICTED_BY_THE_OPTIONAL_COMMASEPARATED_FIELD_SCHEME_AND_PASSES_A_BASIC_SYNTAX_CHECK_EGS="Validates that the value is a URL with a valid scheme (which can be restricted by the optional comma-separated field 'scheme'), and passes a basic syntax check. eg:%s"
+COM_COMPONENTBUILDER_VALIDATION_RULE="Validation Rule"
+COM_COMPONENTBUILDER_VALIDATION_RULES="Validation Rules"
+COM_COMPONENTBUILDER_VALIDATION_RULES_ACCESS="Validation Rules Access"
+COM_COMPONENTBUILDER_VALIDATION_RULES_ACCESS_DESC="Allows the users in this group to access access validation rules"
+COM_COMPONENTBUILDER_VALIDATION_RULES_BATCH_OPTIONS="Batch process the selected Validation Rules"
+COM_COMPONENTBUILDER_VALIDATION_RULES_BATCH_TIP="All changes will be applied to all selected Validation Rules"
+COM_COMPONENTBUILDER_VALIDATION_RULES_BATCH_USE="Validation Rules Batch Use"
+COM_COMPONENTBUILDER_VALIDATION_RULES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch validation rules"
+COM_COMPONENTBUILDER_VALIDATION_RULES_CREATE="Validation Rules Create"
+COM_COMPONENTBUILDER_VALIDATION_RULES_CREATE_DESC="Allows the users in this group to create create validation rules"
+COM_COMPONENTBUILDER_VALIDATION_RULES_DASHBOARD_LIST="Validation Rules Dashboard List"
+COM_COMPONENTBUILDER_VALIDATION_RULES_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the validation rule"
+COM_COMPONENTBUILDER_VALIDATION_RULES_DELETE="Validation Rules Delete"
+COM_COMPONENTBUILDER_VALIDATION_RULES_DELETE_DESC="Allows the users in this group to delete delete validation rules"
+COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT="Validation Rules Edit"
+COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_DESC="Allows the users in this group to edit the validation rule"
+COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_OWN="Validation Rules Edit Own"
+COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_OWN_DESC="Allows the users in this group to edit edit own validation rules created by them"
+COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_STATE="Validation Rules Edit State"
+COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_STATE_DESC="Allows the users in this group to update the state of the validation rule"
+COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_VERSION="Validation Rules Edit Version"
+COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version validation rules"
+COM_COMPONENTBUILDER_VALIDATION_RULES_EXPORT="Validation Rules Export"
+COM_COMPONENTBUILDER_VALIDATION_RULES_EXPORT_DESC="Allows the users in this group to export export validation rules"
+COM_COMPONENTBUILDER_VALIDATION_RULES_IMPORT="Validation Rules Import"
+COM_COMPONENTBUILDER_VALIDATION_RULES_IMPORT_DESC="Allows the users in this group to import import validation rules"
+COM_COMPONENTBUILDER_VALIDATION_RULES_N_ITEMS_ARCHIVED="%s Validation Rules archived."
+COM_COMPONENTBUILDER_VALIDATION_RULES_N_ITEMS_ARCHIVED_1="%s Validation Rule archived."
+COM_COMPONENTBUILDER_VALIDATION_RULES_N_ITEMS_CHECKED_IN_0="No Validation Rule successfully checked in."
+COM_COMPONENTBUILDER_VALIDATION_RULES_N_ITEMS_CHECKED_IN_1="%d Validation Rule successfully checked in."
+COM_COMPONENTBUILDER_VALIDATION_RULES_N_ITEMS_CHECKED_IN_MORE="%d Validation Rules successfully checked in."
+COM_COMPONENTBUILDER_VALIDATION_RULES_N_ITEMS_DELETED="%s Validation Rules deleted."
+COM_COMPONENTBUILDER_VALIDATION_RULES_N_ITEMS_DELETED_1="%s Validation Rule deleted."
+COM_COMPONENTBUILDER_VALIDATION_RULES_N_ITEMS_FEATURED="%s Validation Rules featured."
+COM_COMPONENTBUILDER_VALIDATION_RULES_N_ITEMS_FEATURED_1="%s Validation Rule featured."
+COM_COMPONENTBUILDER_VALIDATION_RULES_N_ITEMS_PUBLISHED="%s Validation Rules published."
+COM_COMPONENTBUILDER_VALIDATION_RULES_N_ITEMS_PUBLISHED_1="%s Validation Rule published."
+COM_COMPONENTBUILDER_VALIDATION_RULES_N_ITEMS_TRASHED="%s Validation Rules trashed."
+COM_COMPONENTBUILDER_VALIDATION_RULES_N_ITEMS_TRASHED_1="%s Validation Rule trashed."
+COM_COMPONENTBUILDER_VALIDATION_RULES_N_ITEMS_UNFEATURED="%s Validation Rules unfeatured."
+COM_COMPONENTBUILDER_VALIDATION_RULES_N_ITEMS_UNFEATURED_1="%s Validation Rule unfeatured."
+COM_COMPONENTBUILDER_VALIDATION_RULES_N_ITEMS_UNPUBLISHED="%s Validation Rules unpublished."
+COM_COMPONENTBUILDER_VALIDATION_RULES_N_ITEMS_UNPUBLISHED_1="%s Validation Rule unpublished."
+COM_COMPONENTBUILDER_VALIDATION_RULES_SUBMENU="Validation Rules Submenu"
+COM_COMPONENTBUILDER_VALIDATION_RULES_SUBMENU_DESC="Allows the users in this group to update the submenu of the validation rule"
+COM_COMPONENTBUILDER_VALIDATION_RULE_CREATED_BY_DESC="The user that created this Validation Rule."
+COM_COMPONENTBUILDER_VALIDATION_RULE_CREATED_BY_LABEL="Created By"
+COM_COMPONENTBUILDER_VALIDATION_RULE_CREATED_DATE_DESC="The date this Validation Rule was created."
+COM_COMPONENTBUILDER_VALIDATION_RULE_CREATED_DATE_LABEL="Created Date"
+COM_COMPONENTBUILDER_VALIDATION_RULE_EDIT="Editing the Validation Rule"
+COM_COMPONENTBUILDER_VALIDATION_RULE_ERROR_UNIQUE_ALIAS="Another Validation Rule has the same alias."
+COM_COMPONENTBUILDER_VALIDATION_RULE_EXTENDS_FORMRULE="Extends FormRule"
+COM_COMPONENTBUILDER_VALIDATION_RULE_ID="Id"
+COM_COMPONENTBUILDER_VALIDATION_RULE_INHERIT="Inherit"
+COM_COMPONENTBUILDER_VALIDATION_RULE_INHERIT_DESCRIPTION="Select an existing validation rule that you would like to adapt."
+COM_COMPONENTBUILDER_VALIDATION_RULE_INHERIT_LABEL="Existing Validation Rules"
+COM_COMPONENTBUILDER_VALIDATION_RULE_MODIFIED_BY_DESC="The last user that modified this Validation Rule."
+COM_COMPONENTBUILDER_VALIDATION_RULE_MODIFIED_BY_LABEL="Modified By"
+COM_COMPONENTBUILDER_VALIDATION_RULE_MODIFIED_DATE_DESC="The date this Validation Rule was modified."
+COM_COMPONENTBUILDER_VALIDATION_RULE_MODIFIED_DATE_LABEL="Modified Date"
+COM_COMPONENTBUILDER_VALIDATION_RULE_NAME="Name"
+COM_COMPONENTBUILDER_VALIDATION_RULE_NAME_ALREADY_TAKEN_PLEASE_TRY_AGAIN="Validation rule name already taken, please try again."
+COM_COMPONENTBUILDER_VALIDATION_RULE_NAME_DESCRIPTION="The name for this validation rule"
+COM_COMPONENTBUILDER_VALIDATION_RULE_NAME_LABEL="Name"
+COM_COMPONENTBUILDER_VALIDATION_RULE_NEW="A New Validation Rule"
+COM_COMPONENTBUILDER_VALIDATION_RULE_ORDERING_LABEL="Ordering"
+COM_COMPONENTBUILDER_VALIDATION_RULE_PERMISSION="Permissions"
+COM_COMPONENTBUILDER_VALIDATION_RULE_PHP="Php"
+COM_COMPONENTBUILDER_VALIDATION_RULE_PHP_DESCRIPTION="Add your PHP here! [Do not add the php tags]"
+COM_COMPONENTBUILDER_VALIDATION_RULE_PHP_HINT="// PHP class methods and fields can be added here"
+COM_COMPONENTBUILDER_VALIDATION_RULE_PHP_LABEL="PHP (class methods)"
+COM_COMPONENTBUILDER_VALIDATION_RULE_PUBLISHING="Publishing"
+COM_COMPONENTBUILDER_VALIDATION_RULE_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Validation Rule to customise the alias."
+COM_COMPONENTBUILDER_VALIDATION_RULE_SHORT_DESCRIPTION="Short Description"
+COM_COMPONENTBUILDER_VALIDATION_RULE_SHORT_DESCRIPTION_DESCRIPTION="Enter short description"
+COM_COMPONENTBUILDER_VALIDATION_RULE_SHORT_DESCRIPTION_HINT="Your Short Description Here"
+COM_COMPONENTBUILDER_VALIDATION_RULE_SHORT_DESCRIPTION_LABEL="Short Description"
+COM_COMPONENTBUILDER_VALIDATION_RULE_SHORT_DESCRIPTION_MESSAGE="Error! Please add some short description here."
+COM_COMPONENTBUILDER_VALIDATION_RULE_STATUS="Status"
+COM_COMPONENTBUILDER_VALIDATION_RULE_VERSION_DESC="A count of the number of times this Validation Rule has been revised."
+COM_COMPONENTBUILDER_VALIDATION_RULE_VERSION_LABEL="Revision"
COM_COMPONENTBUILDER_VDM_NOTICE_BOARD="VDM Notice Board"
COM_COMPONENTBUILDER_VDM_PACKAGES="VDM Packages"
COM_COMPONENTBUILDER_VERSION="Version"
@@ -6361,6 +6529,8 @@ COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_IMPORT_A_COMPONENT_PLEASE_CON
COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_SHARE_THE_SNIPPETS_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP="You do not have permission to share the snippets, please contact your system administrator for more help."
COM_COMPONENTBUILDER_YOU_HAVE_S_S_ADDING_MORE_THEN_FIFTY_S_IS_CONSIDERED_BAD_PRACTICE="You have %s %s. Adding more then 50 %s is considered bad practice."
COM_COMPONENTBUILDER_YOU_HAVE_S_S_ADDING_MORE_THEN_FIFTY_S_IS_CONSIDERED_BAD_PRACTICE_YOUR_S_PAGE_LOAD_IN_JCB_WILL_SLOWDOWN_YOU_SHOULD_CONSIDER_DECOUPLING_SOME_OF_THESE_S="You have %s %s. Adding more then 50 %s is considered bad practice. Your %s page load in JCB will slowdown. You should consider decoupling some of these %s."
+COM_COMPONENTBUILDER_YOU_MUST_ADD_AN_UNIQUE_FUNCTION_NAME="You must add an unique function name."
+COM_COMPONENTBUILDER_YOU_MUST_ADD_AN_UNIQUE_VALIDATION_RULE_NAME="You must add an unique validation rule name."
COM_COMPONENTBUILDER_YOU_MUST_FIRST_LINK_AN_ADMIN_OR_A_CUSTOM_ADMIN_VIEW_TO_THIS_COMPONENT_THEN_YOU_CAN_SELECT_IT_HERE="You must first link an admin or a custom admin view to this component, then you can select it here"
COM_COMPONENTBUILDER_YOU_MUST_SELECT_A_COMPONENT="You must select a component!"
COM_COMPONENTBUILDER_YOU_SHOULD_ADD_THE_CORRECT_OWNER_DETAILS="You should add the correct owner details."
diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.sys.ini b/admin/language/en-GB/en-GB.com_componentbuilder.sys.ini
index 43cb5b05c..1a9103480 100644
--- a/admin/language/en-GB/en-GB.com_componentbuilder.sys.ini
+++ b/admin/language/en-GB/en-GB.com_componentbuilder.sys.ini
@@ -412,6 +412,8 @@ COM_COMPONENTBUILDER_GET_SNIPPETS_ACCESS="Get Snippets Access"
COM_COMPONENTBUILDER_GET_SNIPPETS_ACCESS_DESC=" Allows the users in this group to access get snippets."
COM_COMPONENTBUILDER_GET_SNIPPETS_CUSTOM_ADMIN_VIEWS_BUTTON_ACCESS="Get Snippets Custom Admin Views Button Access"
COM_COMPONENTBUILDER_GET_SNIPPETS_CUSTOM_ADMIN_VIEWS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the custom admin views button."
+COM_COMPONENTBUILDER_GET_SNIPPETS_DASHBOARD_LIST="Get Snippets Dashboard List"
+COM_COMPONENTBUILDER_GET_SNIPPETS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the Get Snippets"
COM_COMPONENTBUILDER_GET_SNIPPETS_LAYOUTS_BUTTON_ACCESS="Get Snippets Layouts Button Access"
COM_COMPONENTBUILDER_GET_SNIPPETS_LAYOUTS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the layouts button."
COM_COMPONENTBUILDER_GET_SNIPPETS_LIBRARIES_BUTTON_ACCESS="Get Snippets Libraries Button Access"
@@ -420,6 +422,8 @@ COM_COMPONENTBUILDER_GET_SNIPPETS_SITE_VIEWS_BUTTON_ACCESS="Get Snippets Site Vi
COM_COMPONENTBUILDER_GET_SNIPPETS_SITE_VIEWS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the site views button."
COM_COMPONENTBUILDER_GET_SNIPPETS_SNIPPETS_BUTTON_ACCESS="Get Snippets Snippets Button Access"
COM_COMPONENTBUILDER_GET_SNIPPETS_SNIPPETS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the snippets button."
+COM_COMPONENTBUILDER_GET_SNIPPETS_SUBMENU="Get Snippets Submenu"
+COM_COMPONENTBUILDER_GET_SNIPPETS_SUBMENU_DESC="Allows the users in this group to update the submenu of the Get Snippets"
COM_COMPONENTBUILDER_GET_SNIPPETS_TEMPLATES_BUTTON_ACCESS="Get Snippets Templates Button Access"
COM_COMPONENTBUILDER_GET_SNIPPETS_TEMPLATES_BUTTON_ACCESS_DESC=" Allows the users in this group to access the templates button."
COM_COMPONENTBUILDER_HELP_DOCUMENTS_ACCESS="Help Documents Access"
@@ -428,8 +432,6 @@ COM_COMPONENTBUILDER_HELP_DOCUMENTS_BATCH_USE="Help Documents Batch Use"
COM_COMPONENTBUILDER_HELP_DOCUMENTS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch help documents"
COM_COMPONENTBUILDER_HELP_DOCUMENTS_CREATE="Help Documents Create"
COM_COMPONENTBUILDER_HELP_DOCUMENTS_CREATE_DESC="Allows the users in this group to create create help documents"
-COM_COMPONENTBUILDER_HELP_DOCUMENTS_DASHBOARD_ADD="Help Documents Dashboard Add"
-COM_COMPONENTBUILDER_HELP_DOCUMENTS_DASHBOARD_ADD_DESC="Allows the users in this group to update the dashboard add of the help document"
COM_COMPONENTBUILDER_HELP_DOCUMENTS_DASHBOARD_LIST="Help Documents Dashboard List"
COM_COMPONENTBUILDER_HELP_DOCUMENTS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the help document"
COM_COMPONENTBUILDER_HELP_DOCUMENTS_DELETE="Help Documents Delete"
@@ -634,6 +636,7 @@ COM_COMPONENTBUILDER_MENU_LIBRARIES="Libraries"
COM_COMPONENTBUILDER_MENU_SITE_VIEWS="Site Views"
COM_COMPONENTBUILDER_MENU_SNIPPETS="Snippets"
COM_COMPONENTBUILDER_MENU_TEMPLATES="Templates"
+COM_COMPONENTBUILDER_MENU_VALIDATION_RULES="Validation Rules"
COM_COMPONENTBUILDER_SERVERS_ACCESS="Servers Access"
COM_COMPONENTBUILDER_SERVERS_ACCESS_DESC="Allows the users in this group to access access servers"
COM_COMPONENTBUILDER_SERVERS_BATCH_USE="Servers Batch Use"
@@ -764,3 +767,27 @@ COM_COMPONENTBUILDER_TEMPLATE_GET_SNIPPETS_BUTTON_ACCESS="Template Get Snippets
COM_COMPONENTBUILDER_TEMPLATE_GET_SNIPPETS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the get snippets button."
COM_COMPONENTBUILDER_USE_BATCH="Use Batch"
COM_COMPONENTBUILDER_USE_BATCH_DESC=" Allows users in this group to use batch copy/update method."
+COM_COMPONENTBUILDER_VALIDATION_RULES_ACCESS="Validation Rules Access"
+COM_COMPONENTBUILDER_VALIDATION_RULES_ACCESS_DESC="Allows the users in this group to access access validation rules"
+COM_COMPONENTBUILDER_VALIDATION_RULES_BATCH_USE="Validation Rules Batch Use"
+COM_COMPONENTBUILDER_VALIDATION_RULES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch validation rules"
+COM_COMPONENTBUILDER_VALIDATION_RULES_CREATE="Validation Rules Create"
+COM_COMPONENTBUILDER_VALIDATION_RULES_CREATE_DESC="Allows the users in this group to create create validation rules"
+COM_COMPONENTBUILDER_VALIDATION_RULES_DASHBOARD_LIST="Validation Rules Dashboard List"
+COM_COMPONENTBUILDER_VALIDATION_RULES_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the validation rule"
+COM_COMPONENTBUILDER_VALIDATION_RULES_DELETE="Validation Rules Delete"
+COM_COMPONENTBUILDER_VALIDATION_RULES_DELETE_DESC="Allows the users in this group to delete delete validation rules"
+COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT="Validation Rules Edit"
+COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_DESC="Allows the users in this group to edit the validation rule"
+COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_OWN="Validation Rules Edit Own"
+COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_OWN_DESC="Allows the users in this group to edit edit own validation rules created by them"
+COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_STATE="Validation Rules Edit State"
+COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_STATE_DESC="Allows the users in this group to update the state of the validation rule"
+COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_VERSION="Validation Rules Edit Version"
+COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version validation rules"
+COM_COMPONENTBUILDER_VALIDATION_RULES_EXPORT="Validation Rules Export"
+COM_COMPONENTBUILDER_VALIDATION_RULES_EXPORT_DESC="Allows the users in this group to export export validation rules"
+COM_COMPONENTBUILDER_VALIDATION_RULES_IMPORT="Validation Rules Import"
+COM_COMPONENTBUILDER_VALIDATION_RULES_IMPORT_DESC="Allows the users in this group to import import validation rules"
+COM_COMPONENTBUILDER_VALIDATION_RULES_SUBMENU="Validation Rules Submenu"
+COM_COMPONENTBUILDER_VALIDATION_RULES_SUBMENU_DESC="Allows the users in this group to update the submenu of the validation rule"
diff --git a/admin/layouts/validation_rule/extends_formrule_above.php b/admin/layouts/validation_rule/extends_formrule_above.php
new file mode 100644
index 000000000..d1c6a5869
--- /dev/null
+++ b/admin/layouts/validation_rule/extends_formrule_above.php
@@ -0,0 +1,41 @@
+
+ @github Joomla Component Builder
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Builds Complex Joomla Components
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+
+defined('_JEXEC') or die('Restricted access');
+
+$form = $displayData->getForm();
+
+$fields = array(
+ 'inherit'
+);
+
+?>
+
diff --git a/admin/layouts/validation_rule/extends_formrule_fullwidth.php b/admin/layouts/validation_rule/extends_formrule_fullwidth.php
new file mode 100644
index 000000000..9414eea85
--- /dev/null
+++ b/admin/layouts/validation_rule/extends_formrule_fullwidth.php
@@ -0,0 +1,48 @@
+
+ @github Joomla Component Builder
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Builds Complex Joomla Components
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+
+defined('_JEXEC') or die('Restricted access');
+
+$form = $displayData->getForm();
+
+$fields = $displayData->get('fields') ?: array(
+ 'php'
+);
+
+?>
+
diff --git a/admin/layouts/validation_rule/extends_formrule_left.php b/admin/layouts/validation_rule/extends_formrule_left.php
new file mode 100644
index 000000000..1fa68e519
--- /dev/null
+++ b/admin/layouts/validation_rule/extends_formrule_left.php
@@ -0,0 +1,54 @@
+
+ @github Joomla Component Builder
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Builds Complex Joomla Components
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+
+defined('_JEXEC') or die('Restricted access');
+
+$form = $displayData->getForm();
+
+$fields = $displayData->get('fields') ?: array(
+ 'name'
+);
+
+$hiddenFields = $displayData->get('hidden_fields') ?: array();
+
+foreach ($fields as $field)
+{
+ $field = is_array($field) ? $field : array($field);
+ foreach ($field as $f)
+ {
+ if ($form->getField($f))
+ {
+ if (in_array($f, $hiddenFields))
+ {
+ $form->setFieldAttribute($f, 'type', 'hidden');
+ }
+
+ echo $form->renderField($f);
+ break;
+ }
+ }
+}
diff --git a/admin/layouts/validation_rule/extends_formrule_right.php b/admin/layouts/validation_rule/extends_formrule_right.php
new file mode 100644
index 000000000..0da93fc26
--- /dev/null
+++ b/admin/layouts/validation_rule/extends_formrule_right.php
@@ -0,0 +1,54 @@
+
+ @github Joomla Component Builder
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Builds Complex Joomla Components
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+
+defined('_JEXEC') or die('Restricted access');
+
+$form = $displayData->getForm();
+
+$fields = $displayData->get('fields') ?: array(
+ 'short_description'
+);
+
+$hiddenFields = $displayData->get('hidden_fields') ?: array();
+
+foreach ($fields as $field)
+{
+ $field = is_array($field) ? $field : array($field);
+ foreach ($field as $f)
+ {
+ if ($form->getField($f))
+ {
+ if (in_array($f, $hiddenFields))
+ {
+ $form->setFieldAttribute($f, 'type', 'hidden');
+ }
+
+ echo $form->renderField($f);
+ break;
+ }
+ }
+}
diff --git a/admin/layouts/validation_rule/index.html b/admin/layouts/validation_rule/index.html
new file mode 100644
index 000000000..fa6d84e80
--- /dev/null
+++ b/admin/layouts/validation_rule/index.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/admin/layouts/validation_rule/publishing.php b/admin/layouts/validation_rule/publishing.php
new file mode 100644
index 000000000..c3aea70c6
--- /dev/null
+++ b/admin/layouts/validation_rule/publishing.php
@@ -0,0 +1,58 @@
+
+ @github Joomla Component Builder
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Builds Complex Joomla Components
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+
+defined('_JEXEC') or die('Restricted access');
+
+$app = JFactory::getApplication();
+$form = $displayData->getForm();
+
+$fields = $displayData->get('fields') ?: array(
+ 'created',
+ 'created_by',
+ 'modified',
+ 'modified_by'
+);
+
+$hiddenFields = $displayData->get('hidden_fields') ?: array();
+
+foreach ($fields as $field)
+{
+ $field = is_array($field) ? $field : array($field);
+ foreach ($field as $f)
+ {
+ if ($form->getField($f))
+ {
+ if (in_array($f, $hiddenFields))
+ {
+ $form->setFieldAttribute($f, 'type', 'hidden');
+ }
+
+ echo $form->renderField($f);
+ break;
+ }
+ }
+}
diff --git a/admin/layouts/validation_rule/publlshing.php b/admin/layouts/validation_rule/publlshing.php
new file mode 100644
index 000000000..753160260
--- /dev/null
+++ b/admin/layouts/validation_rule/publlshing.php
@@ -0,0 +1,60 @@
+
+ @github Joomla Component Builder
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Builds Complex Joomla Components
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+
+defined('_JEXEC') or die('Restricted access');
+
+$app = JFactory::getApplication();
+$form = $displayData->getForm();
+
+$fields = $displayData->get('fields') ?: array(
+ 'published',
+ 'ordering',
+ 'access',
+ 'version',
+ 'hits',
+ 'id'
+);
+
+$hiddenFields = $displayData->get('hidden_fields') ?: array();
+
+foreach ($fields as $field)
+{
+ $field = is_array($field) ? $field : array($field);
+ foreach ($field as $f)
+ {
+ if ($form->getField($f))
+ {
+ if (in_array($f, $hiddenFields))
+ {
+ $form->setFieldAttribute($f, 'type', 'hidden');
+ }
+
+ echo $form->renderField($f);
+ break;
+ }
+ }
+}
diff --git a/admin/models/ajax.php b/admin/models/ajax.php
index 03a0bb78e..3a0120bd6 100644
--- a/admin/models/ajax.php
+++ b/admin/models/ajax.php
@@ -1120,8 +1120,12 @@ class ComponentbuilderModelAjax extends JModelList
// get the linked to
if ($linked = $this->getLinkedTo($values['a_view'], $values['a_id']))
{
- // just return it for now as an unordered list
- return '- ' .implode('
- ', $linked) . '
';
+ // just return it for now a table
+ $table = '';
+ $table .= ''.JText::sprintf('COM_COMPONENTBUILDER_PLACES_ACROSS_JCB_WHERE_THIS_S_IS_LINKED', ComponentbuilderHelper::safeString($values['a_view'], 'w')).'';
+ $table .= ''.JText::_('COM_COMPONENTBUILDER_TYPE_NAME').' |
';
+ $table .= '' .implode(' |
', $linked) . ' |
';
+ return $table;
}
}
}
@@ -1299,66 +1303,69 @@ class ComponentbuilderModelAjax extends JModelList
// Used in template
public function getTemplateDetails($id)
{
+ // set table
+ $table = false;
// Get a db connection.
- $db = JFactory::getDbo();
-
+ $db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.alias','a.template','b.name')));
$query->from($db->quoteName('#__componentbuilder_template', 'a'));
$query->join('LEFT', $db->quoteName('#__componentbuilder_dynamic_get', 'b') . ' ON (' . $db->quoteName('b.id') . ' = ' . $db->quoteName('a.dynamic_get') . ')');
$query->where($db->quoteName('a.id') . ' != '.(int) $id);
- $query->where($db->quoteName('a.published') . ' = 1');
-
+ $query->where($db->quoteName('a.published') . ' = 1');
// Reset the query using our newly populated query object.
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
$results = $db->loadObjectList();
- $templateString = array('Template Code Snippets
";
- return implode("\n",$templateString);
+ // build the table
+ $table = ''.JText::_('COM_COMPONENTBUILDER_TEMPLATE_CODE_SNIPPETS').'
';
+ $table .= ''.JText::_('COM_COMPONENTBUILDER_TO_ADD_SIMPLY_COPY_AND_PAST_THE_SNIPPET_INTO_YOUR_CODE').'';
+ $table .= ''.JText::_('COM_COMPONENTBUILDER_NAME_OF_DYNAMICGET').' | '.JText::_('COM_COMPONENTBUILDER_SNIPPET').' |
';
+ $table .= ''.implode("
",$templateString)."
";
}
- return false;
+ return $table;
}
// Used in layout
public function getLayoutDetails($id)
{
+ // set table
+ $table = false;
// Get a db connection.
- $db = JFactory::getDbo();
-
+ $db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.alias','a.layout','b.getcustom','b.gettype','b.name')));
$query->from($db->quoteName('#__componentbuilder_layout', 'a'));
$query->join('LEFT', $db->quoteName('#__componentbuilder_dynamic_get', 'b') . ' ON (' . $db->quoteName('b.id') . ' = ' . $db->quoteName('a.dynamic_get') . ')');
$query->where($db->quoteName('a.id') . ' != '.(int) $id);
- $query->where($db->quoteName('a.published') . ' = 1');
-
+ $query->where($db->quoteName('a.published') . ' = 1');
// Reset the query using our newly populated query object.
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
$results = $db->loadObjectList();
- $layoutString = array('Layout Code Snippets
";
- return implode("\n",$layoutString);
+ // build the table
+ $table = ''.JText::_('COM_COMPONENTBUILDER_LAYOUT_CODE_SNIPPETS').'
';
+ $table .= ''.JText::_('COM_COMPONENTBUILDER_TO_ADD_SIMPLY_COPY_AND_PAST_THE_SNIPPET_INTO_YOUR_CODE').'';
+ $table .= ''.JText::_('COM_COMPONENTBUILDER_NAME_OF_DYNAMICGET').' | '.JText::_('COM_COMPONENTBUILDER_SNIPPET').' |
';
+ $table .= ''.implode("
",$layoutString)."
";
}
- return false;
+ return $table;
}
// Used in dynamic_get
@@ -2029,6 +2039,126 @@ class ComponentbuilderModelAjax extends JModelList
return false;
}
+ // Used in validation_rule
+ public function getExistingValidationRuleCode($name)
+ {
+ // make sure we have all the exiting rule names
+ if ($names = ComponentbuilderHelper::getExistingValidationRuleNames())
+ {
+ // check that this is a valid rule file
+ if (ComponentbuilderHelper::checkArray($names) && in_array($name, $names))
+ {
+ // get the full path to rule file
+ $path = JPATH_LIBRARIES . '/src/Form/Rule/'.$name.'Rule.php';
+ // get all the code
+ if ($code = ComponentbuilderHelper::getFileContents($path))
+ {
+ // remove the class details and the ending }
+ $codeArray = (array) explode("FormRule\n{\n", $code);
+ if (isset($codeArray[1]))
+ {
+ return array('values' => rtrim(rtrim(rtrim($codeArray[1]),'}')));
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ public function checkRuleName($name, $id)
+ {
+ $name = ComponentbuilderHelper::safeString($name);
+ if ($found = ComponentbuilderHelper::getVar('validation_rule', $name, 'name', 'id'))
+ {
+ if ((int) $id !== (int) $found)
+ {
+ return array (
+ 'message' => JText::sprintf('COM_COMPONENTBUILDER_SORRY_THIS_VALIDATION_RULE_NAME_S_ALREADY_EXIST_IN_YOUR_SYSTEM', $name),
+ 'status' => 'danger',
+ 'timeout' => 6000);
+ }
+ }
+ // now check the existing once
+ if ($names = ComponentbuilderHelper::getExistingValidationRuleNames(true))
+ {
+ if (in_array($name, $names))
+ {
+ return array (
+ 'message' => JText::sprintf('COM_COMPONENTBUILDER_SORRY_THIS_VALIDATION_RULE_NAME_S_ALREADY_EXIST_AS_PART_OF_THE_JOOMLA_CORE_NO_NEED_TO_CREATE_IT_IF_YOU_ARE_ADAPTING_IT_GIVE_IT_YOUR_OWN_UNIQUE_NAME', $name),
+ 'status' => 'danger',
+ 'timeout' => 10000);
+ }
+ }
+ return array (
+ 'name' => $name,
+ 'message' => JText::sprintf('COM_COMPONENTBUILDER_GREAT_THIS_VALIDATION_RULE_NAME_S_WILL_WORK', $name),
+ 'status' => 'success',
+ 'timeout' => 5000);
+ }
+
+ public function getValidationRulesTable($id)
+ {
+ // get all the validation rules
+ if ($rules = $this->getValidationRules())
+ {
+ // build table
+ $table = '';
+ $table .= ''.JText::sprintf('COM_COMPONENTBUILDER_THE_AVAILABLE_VALIDATION_RULES_FOR_THE_VALIDATE_ATTRIBUTE_ARE').'';
+ $table .= ''.JText::_('COM_COMPONENTBUILDER_VALIDATE').' | '.JText::_('COM_COMPONENTBUILDER_DESCRIPTION').' |
';
+ $table .= '';
+ foreach ($rules as $name => $decs)
+ {
+ // just load the values
+ $decs = (ComponentbuilderHelper::checkString($decs) && !is_numeric($decs)) ? $decs : '';
+ $table .= ''.$name.' | '. $decs. ' |
';
+ }
+ return $table.'
';
+ }
+ return false;
+ }
+
+ public function getValidationRules()
+ {
+ // custom rule names
+ $names = array();
+ // make sure we have all the exiting rule names
+ if (!$exitingNames = ComponentbuilderHelper::getExistingValidationRuleNames(true))
+ {
+ // stop (something is wrong)
+ return false;
+ }
+ // convert names to keys
+ $exitingNames = array_flip($exitingNames);
+ // load the descriptions (taken from https://docs.joomla.org/Server-side_form_validation)
+ $exitingNames["boolean"] = JText::_("COM_COMPONENTBUILDER_ACCEPTS_ONLY_THE_VALUES_ZERO_ONE_TRUE_OR_FALSE_CASEINSENSITIVE");
+ $exitingNames["color"] = JText::_("COM_COMPONENTBUILDER_ACCEPTS_ONLY_EMPTY_VALUES_CONVERTED_TO_ZERO_AND_STRINGS_IN_THE_FORM_RGB_OR_RRGGBB_WHERE_R_G_AND_B_ARE_HEX_VALUES");
+ $exitingNames["email"] = JText::_("COM_COMPONENTBUILDER_ACCEPTS_AN_EMAIL_ADDRESS_SATISFIES_A_BASIC_SYNTAX_CHECK_IN_THE_PATTERN_OF_QUOTXYZZQUOT_WITH_NO_INVALID_CHARACTERS");
+ $exitingNames["equals"] = JText::sprintf("COM_COMPONENTBUILDER_REQUIRES_THE_VALUE_TO_BE_THE_SAME_AS_THAT_HELD_IN_THE_FIELD_NAMED_QUOTFIELDQUOT_EGS", '
<input type="text" name="email_check" validate="equals" field="email" />
');
+ $exitingNames["options"] = JText::_("COM_COMPONENTBUILDER_REQUIRES_THE_VALUE_ENTERED_BE_ONE_OF_THE_OPTIONS_IN_AN_ELEMENT_OF_TYPEQUOTLISTQUOT_THAT_IS_THAT_THE_ELEMENT_IS_A_SELECT_LIST");
+ $exitingNames["tel"] = JText::_("COM_COMPONENTBUILDER_REQUIRES_THE_VALUE_TO_BE_A_TELEPHONE_NUMBER_COMPLYING_WITH_THE_STANDARDS_OF_NANPA_ITUT_TRECEONE_HUNDRED_AND_SIXTY_FOUR_OR_IETF_RFCFOUR_THOUSAND_NINE_HUNDRED_AND_THIRTY_THREE");
+ $exitingNames["url"] = JText::sprintf("COM_COMPONENTBUILDER_VALIDATES_THAT_THE_VALUE_IS_A_URL_WITH_A_VALID_SCHEME_WHICH_CAN_BE_RESTRICTED_BY_THE_OPTIONAL_COMMASEPARATED_FIELD_SCHEME_AND_PASSES_A_BASIC_SYNTAX_CHECK_EGS", '
<input type="text" name="link" validate="url" scheme="http,https,mailto" />
');
+ $exitingNames["username"] = JText::_("COM_COMPONENTBUILDER_VALIDATES_THAT_THE_VALUE_DOES_NOT_APPEAR_AS_A_USERNAME_ON_THE_SYSTEM_THAT_IS_THAT_IT_IS_A_VALID_NEW_USERNAME_DOES_NOT_SYNTAX_CHECK_IT_AS_A_VALID_NAME");
+ // now get the custom created rules
+ $db = JFactory::getDbo();
+ // Create a new query object.
+ $query = $db->getQuery(true);
+ $query->select($db->quoteName(array('a.name','a.short_description')));
+ $query->from($db->quoteName('#__componentbuilder_validation_rule','a'));
+ $query->where($db->quoteName('a.published') . ' >= 1');
+ $db->setQuery($query);
+ $db->execute();
+ if ($db->getNumRows())
+ {
+ $names = $db->loadAssocList('name', 'short_description');
+ }
+ // merge the arrays
+ $rules = ComponentbuilderHelper::mergeArrays(array($exitingNames, $names));
+ // sort the array
+ ksort($rules);
+ // return the validation rules
+ return $rules;
+ }
+
// Used in field
public function getFieldOptions($id)
{
diff --git a/admin/models/componentbuilder.php b/admin/models/componentbuilder.php
index edec1b78e..fd9fc4ee5 100644
--- a/admin/models/componentbuilder.php
+++ b/admin/models/componentbuilder.php
@@ -43,12 +43,14 @@ class ComponentbuilderModelComponentbuilder extends JModelList
$icons = array();
// view groups array
$viewGroups = array(
- 'main' => array('png.compiler', 'png.joomla_component.add', 'png.joomla_components', 'png.admin_view.add', 'png.admin_views', 'png||importjcbpackages||index.php?option=com_componentbuilder&view=import_joomla_components&target=smartPackage', 'png.custom_admin_view.add', 'png.custom_admin_views', 'png.site_view.add', 'png.site_views', 'png.template.add', 'png.templates', 'png.layout.add', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.custom_codes', 'png.libraries', 'png.snippets', 'png||getsnippets||index.php?option=com_componentbuilder&view=get_snippets', 'png.field.add', 'png.fields', 'png.fields.catid', 'png.fieldtype.add', 'png.fieldtypes', 'png.fieldtypes.catid', 'png.language_translations', 'png.servers', 'png.help_document.add', 'png.help_documents')
+ 'main' => array('png.compiler', 'png.joomla_component.add', 'png.joomla_components', 'png.admin_view.add', 'png.admin_views', 'png||importjcbpackages||index.php?option=com_componentbuilder&view=import_joomla_components&target=smartPackage', 'png.custom_admin_view.add', 'png.custom_admin_views', 'png.site_view.add', 'png.site_views', 'png.template.add', 'png.templates', 'png.layout.add', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.custom_codes', 'png.libraries', 'png.snippets', 'png.get_snippets', 'png.validation_rules', 'png.field.add', 'png.fields', 'png.fields.catid', 'png.fieldtype.add', 'png.fieldtypes', 'png.fieldtypes.catid', 'png.language_translations', 'png.servers', 'png.help_documents')
);
// view access array
$viewAccess = array(
'compiler.submenu' => 'compiler.submenu',
'compiler.dashboard_list' => 'compiler.dashboard_list',
+ 'get_snippets.submenu' => 'get_snippets.submenu',
+ 'get_snippets.dashboard_list' => 'get_snippets.dashboard_list',
'joomla_component.create' => 'joomla_component.create',
'joomla_components.access' => 'joomla_component.access',
'joomla_component.access' => 'joomla_component.access',
@@ -101,6 +103,11 @@ class ComponentbuilderModelComponentbuilder extends JModelList
'snippet.access' => 'snippet.access',
'snippets.submenu' => 'snippet.submenu',
'snippets.dashboard_list' => 'snippet.dashboard_list',
+ 'validation_rule.create' => 'validation_rule.create',
+ 'validation_rules.access' => 'validation_rule.access',
+ 'validation_rule.access' => 'validation_rule.access',
+ 'validation_rules.submenu' => 'validation_rule.submenu',
+ 'validation_rules.dashboard_list' => 'validation_rule.dashboard_list',
'field.create' => 'field.create',
'fields.access' => 'field.access',
'field.access' => 'field.access',
@@ -132,7 +139,6 @@ class ComponentbuilderModelComponentbuilder extends JModelList
'help_document.access' => 'help_document.access',
'help_documents.submenu' => 'help_document.submenu',
'help_documents.dashboard_list' => 'help_document.dashboard_list',
- 'help_document.dashboard_add' => 'help_document.dashboard_add',
'admin_fields.create' => 'admin_fields.create',
'admins_fields.access' => 'admin_fields.access',
'admin_fields.access' => 'admin_fields.access',
diff --git a/admin/models/fields/existingvalidationrules.php b/admin/models/fields/existingvalidationrules.php
new file mode 100644
index 000000000..d897fe4b9
--- /dev/null
+++ b/admin/models/fields/existingvalidationrules.php
@@ -0,0 +1,165 @@
+
+ @github Joomla Component Builder
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Builds Complex Joomla Components
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+defined('_JEXEC') or die('Restricted access');
+
+// import the list field type
+jimport('joomla.form.helper');
+JFormHelper::loadFieldClass('list');
+
+/**
+ * Existingvalidationrules Form Field class for the Componentbuilder component
+ */
+class JFormFieldExistingvalidationrules extends JFormFieldList
+{
+ /**
+ * The existingvalidationrules field type.
+ *
+ * @var string
+ */
+ public $type = 'existingvalidationrules';
+ /**
+ * Override to add new button
+ *
+ * @return string The field input markup.
+ *
+ * @since 3.2
+ */
+ protected function getInput()
+ {
+ // see if we should add buttons
+ $setButton = $this->getAttribute('button');
+ // get html
+ $html = parent::getInput();
+ // if true set button
+ if ($setButton === 'true')
+ {
+ $button = array();
+ $script = array();
+ $buttonName = $this->getAttribute('name');
+ // get the input from url
+ $app = JFactory::getApplication();
+ $jinput = $app->input;
+ // get the view name & id
+ $values = $jinput->getArray(array(
+ 'id' => 'int',
+ 'view' => 'word'
+ ));
+ // check if new item
+ $ref = '';
+ $refJ = '';
+ if (!is_null($values['id']) && strlen($values['view']))
+ {
+ // only load referal if not new item.
+ $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
+ $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
+ }
+ $user = JFactory::getUser();
+ // only add if user allowed to create validation_rule
+ if ($user->authorise('validation_rule.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
+ {
+ // build Create button
+ $buttonNamee = trim($buttonName);
+ $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
+ $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
+ $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
+ $buttonNamee = ucfirst(strtolower($buttonNamee));
+ $button[] = '
+ ';
+ }
+ // only add if user allowed to edit validation_rule
+ if (($buttonName === 'validation_rule' || $buttonName === 'validation_rules') && $user->authorise('validation_rule.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
+ {
+ // build edit button
+ $buttonNamee = trim($buttonName);
+ $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
+ $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
+ $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
+ $buttonNamee = ucfirst(strtolower($buttonNamee));
+ $button[] = '
+ ';
+ // build script
+ $script[] = "
+ jQuery(document).ready(function() {
+ jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
+ e.preventDefault();
+ var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
+ ".$buttonName."Button(".$buttonName."Value);
+ });
+ var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
+ ".$buttonName."Button(".$buttonName."Value);
+ });
+ function ".$buttonName."Button(value) {
+ if (value > 0) {
+ // hide the create button
+ jQuery('#".$buttonName."Create').hide();
+ // show edit button
+ jQuery('#".$buttonName."Edit').show();
+ var url = 'index.php?option=com_componentbuilder&view=validation_rules&task=validation_rule.edit&id='+value+'".$refJ."';
+ jQuery('#".$buttonName."Edit').attr('href', url);
+ } else {
+ // show the create button
+ jQuery('#".$buttonName."Create').show();
+ // hide edit button
+ jQuery('#".$buttonName."Edit').hide();
+ }
+ }";
+ }
+ // check if button was created for validation_rule field.
+ if (is_array($button) && count($button) > 0)
+ {
+ // Load the needed script.
+ $document = JFactory::getDocument();
+ $document->addScriptDeclaration(implode(' ',$script));
+ // return the button attached to input field.
+ return '' .$html . implode('',$button).'
';
+ }
+ }
+ return $html;
+ }
+
+ /**
+ * Method to get a list of options for a list input.
+ *
+ * @return array An array of JHtml options.
+ */
+ public function getOptions()
+ {
+ // get the existing validation rules names
+ if ($items = ComponentbuilderHelper::getExistingValidationRuleNames())
+ {
+ // load the items
+ $options = array(JHtml::_('select.option', '', 'Select an option'));
+ foreach($items as $item)
+ {
+ $options[] = JHtml::_('select.option', $item, ComponentbuilderHelper::safeString($item, 'Ww'));
+ }
+ return $options;
+ }
+ return array(JHtml::_('select.option', '', JText::_('COM_COMPONENTBUILDER_NO_VALIDATION_RULES_FOUND')));
+ }
+}
diff --git a/admin/models/forms/custom_code.js b/admin/models/forms/custom_code.js
index 75c5c5a46..0d95373e6 100644
--- a/admin/models/forms/custom_code.js
+++ b/admin/models/forms/custom_code.js
@@ -278,12 +278,12 @@ function checkFunctionName(functioName) {
// now start search for where the function is used
usedin(result.name, ide);
} else if(result.message){
- // show notice that functioName is not okay
+ // show notice that functionName is not okay
jQuery.UIkit.notify({message: result.message, timeout: 5000, status: result.status, pos: 'top-right'});
jQuery('#jform_function_name').val('');
} else {
// set an error that message was not send
- jQuery.UIkit.notify({message: 'Function name already taken, please try again.', timeout: 5000, status: 'danger', pos: 'top-right'});
+ jQuery.UIkit.notify({message: Joomla.JText._('COM_COMPONENTBUILDER_FUNCTION_NAME_ALREADY_TAKEN_PLEASE_TRY_AGAIN'), timeout: 5000, status: 'danger', pos: 'top-right'});
jQuery('#jform_function_name').val('');
}
// set custom code placeholder
@@ -291,7 +291,7 @@ function checkFunctionName(functioName) {
});
} else {
// set an error that message was not send
- jQuery.UIkit.notify({message: 'You must add an unique function name.', timeout: 5000, status: 'danger', pos: 'top-right'});
+ jQuery.UIkit.notify({message: Joomla.JText._('COM_COMPONENTBUILDER_YOU_MUST_ADD_AN_UNIQUE_FUNCTION_NAME'), timeout: 5000, status: 'danger', pos: 'top-right'});
jQuery('#jform_function_name').val('');
// set custom code placeholder
setCustomCodePlaceholder();
diff --git a/admin/models/forms/field.js b/admin/models/forms/field.js
index 7923ac583..fea8491b9 100644
--- a/admin/models/forms/field.js
+++ b/admin/models/forms/field.js
@@ -514,6 +514,8 @@ jQuery(document).ready(function()
{
// get the linked details
getLinked();
+ // get the validation rules
+ getValidationRulesTable();
});
function getLinked_server(type){
@@ -562,4 +564,26 @@ function getFieldOptions(id,setValue){
jQuery('.helpNote').append(''+result.description+'
'+result.values_description+'
');
}
})
-}
+}
+
+function getValidationRulesTable_server(){
+ var getUrl = "index.php?option=com_componentbuilder&task=ajax.getValidationRulesTable&format=json";
+ if(token.length > 0){
+ var request = 'token='+token+'&id=1';
+ }
+ return jQuery.ajax({
+ type: 'GET',
+ url: getUrl,
+ dataType: 'jsonp',
+ data: request,
+ jsonp: 'callback'
+ });
+}
+
+function getValidationRulesTable(){
+ getValidationRulesTable_server().done(function(result) {
+ if(result){
+ jQuery('#display_validation_rules').html(result);
+ }
+ });
+}
diff --git a/admin/models/forms/validation_rule.js b/admin/models/forms/validation_rule.js
new file mode 100644
index 000000000..ec91c6bb0
--- /dev/null
+++ b/admin/models/forms/validation_rule.js
@@ -0,0 +1,109 @@
+/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
+ __ __ _ _____ _ _ __ __ _ _ _
+ \ \ / / | | | __ \ | | | | | \/ | | | | | | |
+ \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
+ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
+ \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
+ \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
+ | |
+ |_|
+/-------------------------------------------------------------------------------------------------------------------------------/
+
+ @version 2.7.x
+ @created 30th April, 2015
+ @package Component Builder
+ @subpackage validation_rule.js
+ @author Llewellyn van der Merwe
+ @github Joomla Component Builder
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Builds Complex Joomla Components
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+
+
+
+jQuery(document).ready(function()
+{
+ // get the rule name
+ var ruleName = jQuery('#jform_name').val();
+ // check if this rule name is taken
+ checkRuleName(ruleName);
+
+ // get type value
+ var rulefilename = jQuery("#jform_inherit option:selected").val();
+ if(jQuery('#jform_php').length == 0) {
+ getExistingValidationRuleCode(rulefilename);
+ }
+
+ // load the used in div
+ // jQuery('#usedin').show();
+});
+
+function getExistingValidationRuleCode_server(rulefilename){
+ var getUrl = "index.php?option=com_componentbuilder&task=ajax.getExistingValidationRuleCode&format=json";
+ if(token.length > 0 && rulefilename.length > 0){
+ var request = 'token='+token+'&name='+rulefilename;
+ }
+ return jQuery.ajax({
+ type: 'GET',
+ url: getUrl,
+ dataType: 'jsonp',
+ data: request,
+ jsonp: 'callback'
+ });
+}
+
+function getExistingValidationRuleCode(rulefilename,setValue){
+ getExistingValidationRuleCode_server(rulefilename).done(function(result) {
+ if(result.values){
+ jQuery('textarea#jform_php').val(result.values);
+ }
+ })
+}
+
+function checkRuleName(ruleName) {
+ if (ruleName.length > 2) {
+ var ide = jQuery('#jform_id').val();
+ if (ide == 0) {
+ ide = -1;
+ }
+ checkRuleName_server(ruleName, ide).done(function(result) {
+ if(result.name && result.message){
+ // show notice that functioName is okay
+ jQuery.UIkit.notify({message: result.message, timeout: result.timeout, status: result.status, pos: 'top-right'});
+ jQuery('#jform_name').val(result.name);
+ // now start search for where the function is used
+ usedin(result.name, ide);
+ } else if(result.message){
+ // show notice that ruleName is not okay
+ jQuery.UIkit.notify({message: result.message, timeout: result.timeout, status: result.status, pos: 'top-right'});
+ jQuery('#jform_name').val('');
+ } else {
+ // set an error that message was not send
+ jQuery.UIkit.notify({message: Joomla.JText._('COM_COMPONENTBUILDER_VALIDATION_RULE_NAME_ALREADY_TAKEN_PLEASE_TRY_AGAIN'), timeout: 7000, status: 'danger', pos: 'top-right'});
+ jQuery('#jform_name').val('');
+ }
+ });
+ } else {
+ // set an error that message was not send
+ jQuery.UIkit.notify({message: Joomla.JText._('COM_COMPONENTBUILDER_YOU_MUST_ADD_AN_UNIQUE_VALIDATION_RULE_NAME'), timeout: 5000, status: 'danger', pos: 'top-right'});
+ jQuery('#jform_name').val('');
+ }
+}
+// check Function Name
+function checkRuleName_server(ruleName, ide){
+ var getUrl = "index.php?option=com_componentbuilder&task=ajax.checkRuleName&format=json";
+ if(token.length > 0){
+ var request = 'token='+token+'&name='+ruleName+'&id='+ide;
+ }
+ return jQuery.ajax({
+ type: 'POST',
+ url: getUrl,
+ dataType: 'jsonp',
+ data: request,
+ jsonp: 'callback'
+ });
+}
diff --git a/admin/models/forms/validation_rule.xml b/admin/models/forms/validation_rule.xml
new file mode 100644
index 000000000..e26221aa0
--- /dev/null
+++ b/admin/models/forms/validation_rule.xml
@@ -0,0 +1,160 @@
+
+
\ No newline at end of file
diff --git a/admin/models/import_joomla_components.php b/admin/models/import_joomla_components.php
index 7d5558c76..aa7e25183 100644
--- a/admin/models/import_joomla_components.php
+++ b/admin/models/import_joomla_components.php
@@ -1433,21 +1433,21 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
}
// repeatable fields to update
$updaterR = array(
- // repeatablefield => checker
- 'join_view_table' => 'view_table',
- 'join_db_table' => 'db_table',
- 'order' => 'table_key',
- 'where' => 'table_key',
- 'global' => 'name',
- 'filter' => 'filter_type'
- );
+ // repeatablefield => checker
+ 'join_view_table' => 'view_table',
+ 'join_db_table' => 'db_table',
+ 'order' => 'table_key',
+ 'where' => 'table_key',
+ 'global' => 'name',
+ 'filter' => 'filter_type'
+ );
// update the repeatable fields
$item = ComponentbuilderHelper::convertRepeatableFields($item, $updaterR);
// subform fields to target
$updaterT = array(
- // subformfield => field => type_value
- 'join_view_table' => array('view_table' => 'admin_view')
- );
+ // subformfield => field => type_value
+ 'join_view_table' => array('view_table' => 'admin_view')
+ );
// update the subform ids
$this->updateSubformsIDs($item, 'dynamic_get', $updaterT);
break;
@@ -1470,10 +1470,10 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
$item = $this->setNewID($item, 'snippet', 'snippet', $type);
// repeatable fields to update
$updaterR = array(
- // repeatablefield => checker
- 'ajax_input' => 'value_name',
- 'custom_button' => 'name'
- );
+ // repeatablefield => checker
+ 'ajax_input' => 'value_name',
+ 'custom_button' => 'name'
+ );
// update the repeatable fields
$item = ComponentbuilderHelper::convertRepeatableFields($item, $updaterR);
break;
@@ -1515,14 +1515,14 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
unset($item->addconditions);
// repeatable fields to update
$updaterR = array(
- // repeatablefield => checker
- 'ajax_input' => 'value_name',
- 'custom_button' => 'name',
- 'addtables' => 'table',
- 'addlinked_views' => 'adminview',
- 'addtabs' => 'name',
- 'addpermissions' => 'action'
- );
+ // repeatablefield => checker
+ 'ajax_input' => 'value_name',
+ 'custom_button' => 'name',
+ 'addtables' => 'table',
+ 'addlinked_views' => 'adminview',
+ 'addtabs' => 'name',
+ 'addpermissions' => 'action'
+ );
// update the repeatable fields
$item = ComponentbuilderHelper::convertRepeatableFields($item, $updaterR);
break;
@@ -1646,9 +1646,9 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
}
// repeatable fields to update
$updaterR = array(
- // repeatablefield => checker
- 'addcontributors' => 'name'
- );
+ // repeatablefield => checker
+ 'addcontributors' => 'name'
+ );
// update the repeatable fields
$item = ComponentbuilderHelper::convertRepeatableFields($item, $updaterR);
break;
@@ -1661,16 +1661,16 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
}
// repeatable fields to update
$updaterR = array(
- // repeatablefield => checker
- 'addadmin_views' => 'adminview'
- );
+ // repeatablefield => checker
+ 'addadmin_views' => 'adminview'
+ );
// update the repeatable fields
$item = ComponentbuilderHelper::convertRepeatableFields($item, $updaterR);
// subform fields to target
$updaterT = array(
- // subformfield => array( field => type_value )
- 'addadmin_views' => array('adminview' => 'admin_view')
- );
+ // subformfield => array( field => type_value )
+ 'addadmin_views' => array('adminview' => 'admin_view')
+ );
// update the subform ids
$this->updateSubformsIDs($item, 'component_admin_views', $updaterT);
break;
@@ -1683,16 +1683,16 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
}
// repeatable fields to update
$updaterR = array(
- // repeatablefield => checker
- 'addsite_views' => 'siteview'
- );
+ // repeatablefield => checker
+ 'addsite_views' => 'siteview'
+ );
// update the repeatable fields
$item = ComponentbuilderHelper::convertRepeatableFields($item, $updaterR);
// subform fields to target
$updaterT = array(
- // subformfield => array( field => type_value )
- 'addsite_views' => array('siteview' => 'site_view')
- );
+ // subformfield => array( field => type_value )
+ 'addsite_views' => array('siteview' => 'site_view')
+ );
// update the subform ids
$this->updateSubformsIDs($item, 'component_site_views', $updaterT);
break;
@@ -1705,16 +1705,16 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
}
// repeatable fields to update
$updaterR = array(
- // repeatablefield => checker
- 'addcustom_admin_views' => 'customadminview'
- );
+ // repeatablefield => checker
+ 'addcustom_admin_views' => 'customadminview'
+ );
// update the repeatable fields
$item = ComponentbuilderHelper::convertRepeatableFields($item, $updaterR);
// subform fields to target
$updaterT = array(
- // subformfield => array( field => type_value )
- 'addcustom_admin_views' => array('customadminview' => 'custom_admin_view', 'adminviews' => 'admin_view', 'before' => 'admin_view')
- );
+ // subformfield => array( field => type_value )
+ 'addcustom_admin_views' => array('customadminview' => 'custom_admin_view', 'adminviews' => 'admin_view', 'before' => 'admin_view')
+ );
// update the subform ids
$this->updateSubformsIDs($item, 'component_custom_admin_views', $updaterT);
break;
@@ -1727,9 +1727,9 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
}
// repeatable fields to update
$updaterR = array(
- // repeatablefield => checker
- 'version_update' => 'version'
- );
+ // repeatablefield => checker
+ 'version_update' => 'version'
+ );
// update the repeatable fields
$item = ComponentbuilderHelper::convertRepeatableFields($item, $updaterR);
break;
@@ -1749,9 +1749,9 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
$item = ComponentbuilderHelper::convertRepeatableFields($item, $updaterR);
// subform fields to target
$updaterT = array(
- // subformfield => array( field => type_value )
- 'sql_tweak' => array('adminview' => 'admin_view')
- );
+ // subformfield => array( field => type_value )
+ 'sql_tweak' => array('adminview' => 'admin_view')
+ );
// update the subform ids
$this->updateSubformsIDs($item, 'component_mysql_tweaks', $updaterT);
break;
@@ -1764,16 +1764,16 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
}
// repeatable fields to update
$updaterR = array(
- // repeatablefield => checker
- 'addcustommenus' => 'name'
- );
+ // repeatablefield => checker
+ 'addcustommenus' => 'name'
+ );
// update the repeatable fields
$item = ComponentbuilderHelper::convertRepeatableFields($item, $updaterR);
// subform fields to target
$updaterT = array(
- // subformfield => array( field => type_value )
- 'addcustommenus' => array('before' => 'admin_view')
- );
+ // subformfield => array( field => type_value )
+ 'addcustommenus' => array('before' => 'admin_view')
+ );
// update the subform ids
$this->updateSubformsIDs($item, 'component_custom_admin_menus', $updaterT);
break;
@@ -1786,16 +1786,16 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
}
// repeatable fields to update
$updaterR = array(
- // repeatablefield => checker
- 'addconfig' => 'field'
- );
+ // repeatablefield => checker
+ 'addconfig' => 'field'
+ );
// update the repeatable fields
$item = ComponentbuilderHelper::convertRepeatableFields($item, $updaterR);
// subform fields to target
$updaterT = array(
- // subformfield => array( field => type_value )
- 'addconfig' => array('field' => 'field')
- );
+ // subformfield => array( field => type_value )
+ 'addconfig' => array('field' => 'field')
+ );
// update the subform ids
$this->updateSubformsIDs($item, 'component_config', $updaterT);
break;
@@ -1808,9 +1808,9 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
}
// repeatable fields to update
$updaterR = array(
- // repeatablefield => checker
- 'dashboard_tab' => 'name'
- );
+ // repeatablefield => checker
+ 'dashboard_tab' => 'name'
+ );
// update the repeatable fields
$item = ComponentbuilderHelper::convertRepeatableFields($item, $updaterR);
break;
@@ -1823,10 +1823,10 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
}
// repeatable fields to update
$updaterR = array(
- // repeatablefield => checker
- 'addfiles' => 'file',
- 'addfolders' => 'folder'
- );
+ // repeatablefield => checker
+ 'addfiles' => 'file',
+ 'addfolders' => 'folder'
+ );
// update the repeatable fields
$item = ComponentbuilderHelper::convertRepeatableFields($item, $updaterR);
break;
diff --git a/admin/models/validation_rule.php b/admin/models/validation_rule.php
new file mode 100644
index 000000000..c6b95d2fb
--- /dev/null
+++ b/admin/models/validation_rule.php
@@ -0,0 +1,887 @@
+
+ @github Joomla Component Builder
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Builds Complex Joomla Components
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+defined('_JEXEC') or die('Restricted access');
+
+use Joomla\Registry\Registry;
+
+// import Joomla modelform library
+jimport('joomla.application.component.modeladmin');
+
+/**
+ * Componentbuilder Validation_rule Model
+ */
+class ComponentbuilderModelValidation_rule extends JModelAdmin
+{
+ /**
+ * @var string The prefix to use with controller messages.
+ * @since 1.6
+ */
+ protected $text_prefix = 'COM_COMPONENTBUILDER';
+
+ /**
+ * The type alias for this content type.
+ *
+ * @var string
+ * @since 3.2
+ */
+ public $typeAlias = 'com_componentbuilder.validation_rule';
+
+ /**
+ * Returns a Table object, always creating it
+ *
+ * @param type $type The table type to instantiate
+ * @param string $prefix A prefix for the table class name. Optional.
+ * @param array $config Configuration array for model. Optional.
+ *
+ * @return JTable A database object
+ *
+ * @since 1.6
+ */
+ public function getTable($type = 'validation_rule', $prefix = 'ComponentbuilderTable', $config = array())
+ {
+ return JTable::getInstance($type, $prefix, $config);
+ }
+
+ public function getVDM()
+ {
+ return $this->vastDevMod;
+ }
+
+ /**
+ * Method to get a single record.
+ *
+ * @param integer $pk The id of the primary key.
+ *
+ * @return mixed Object on success, false on failure.
+ *
+ * @since 1.6
+ */
+ public function getItem($pk = null)
+ {
+ if ($item = parent::getItem($pk))
+ {
+ if (!empty($item->params) && !is_array($item->params))
+ {
+ // Convert the params field to an array.
+ $registry = new Registry;
+ $registry->loadString($item->params);
+ $item->params = $registry->toArray();
+ }
+
+ if (!empty($item->metadata))
+ {
+ // Convert the metadata field to an array.
+ $registry = new Registry;
+ $registry->loadString($item->metadata);
+ $item->metadata = $registry->toArray();
+ }
+
+ if (!empty($item->php))
+ {
+ // base64 Decode php.
+ $item->php = base64_decode($item->php);
+ }
+
+
+ if (empty($item->id))
+ {
+ $id = 0;
+ }
+ else
+ {
+ $id = $item->id;
+ }
+ // set the id and view name to session
+ if ($vdm = ComponentbuilderHelper::get('validation_rule__'.$id))
+ {
+ $this->vastDevMod = $vdm;
+ }
+ else
+ {
+ $this->vastDevMod = ComponentbuilderHelper::randomkey(50);
+ ComponentbuilderHelper::set($this->vastDevMod, 'validation_rule__'.$id);
+ ComponentbuilderHelper::set('validation_rule__'.$id, $this->vastDevMod);
+ }
+
+ if (!empty($item->id))
+ {
+ $item->tags = new JHelperTags;
+ $item->tags->getTagIds($item->id, 'com_componentbuilder.validation_rule');
+ }
+ }
+
+ return $item;
+ }
+
+ /**
+ * Method to get the record form.
+ *
+ * @param array $data Data for the form.
+ * @param boolean $loadData True if the form is to load its own data (default case), false if not.
+ *
+ * @return mixed A JForm object on success, false on failure
+ *
+ * @since 1.6
+ */
+ public function getForm($data = array(), $loadData = true)
+ {
+ // Get the form.
+ $form = $this->loadForm('com_componentbuilder.validation_rule', 'validation_rule', array('control' => 'jform', 'load_data' => $loadData));
+
+ if (empty($form))
+ {
+ return false;
+ }
+
+ $jinput = JFactory::getApplication()->input;
+
+ // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first.
+ if ($jinput->get('a_id'))
+ {
+ $id = $jinput->get('a_id', 0, 'INT');
+ }
+ // The back end uses id so we use that the rest of the time and set it to 0 by default.
+ else
+ {
+ $id = $jinput->get('id', 0, 'INT');
+ }
+
+ $user = JFactory::getUser();
+
+ // Check for existing item.
+ // Modify the form based on Edit State access controls.
+ if ($id != 0 && (!$user->authorise('validation_rule.edit.state', 'com_componentbuilder.validation_rule.' . (int) $id))
+ || ($id == 0 && !$user->authorise('validation_rule.edit.state', 'com_componentbuilder')))
+ {
+ // Disable fields for display.
+ $form->setFieldAttribute('ordering', 'disabled', 'true');
+ $form->setFieldAttribute('published', 'disabled', 'true');
+ // Disable fields while saving.
+ $form->setFieldAttribute('ordering', 'filter', 'unset');
+ $form->setFieldAttribute('published', 'filter', 'unset');
+ }
+ // If this is a new item insure the greated by is set.
+ if (0 == $id)
+ {
+ // Set the created_by to this user
+ $form->setValue('created_by', null, $user->id);
+ }
+ // Modify the form based on Edit Creaded By access controls.
+ if (!$user->authorise('core.edit.created_by', 'com_componentbuilder'))
+ {
+ // Disable fields for display.
+ $form->setFieldAttribute('created_by', 'disabled', 'true');
+ // Disable fields for display.
+ $form->setFieldAttribute('created_by', 'readonly', 'true');
+ // Disable fields while saving.
+ $form->setFieldAttribute('created_by', 'filter', 'unset');
+ }
+ // Modify the form based on Edit Creaded Date access controls.
+ if (!$user->authorise('core.edit.created', 'com_componentbuilder'))
+ {
+ // Disable fields for display.
+ $form->setFieldAttribute('created', 'disabled', 'true');
+ // Disable fields while saving.
+ $form->setFieldAttribute('created', 'filter', 'unset');
+ }
+ // Only load these values if no id is found
+ if (0 == $id)
+ {
+ // Set redirected field name
+ $redirectedField = $jinput->get('ref', null, 'STRING');
+ // Set redirected field value
+ $redirectedValue = $jinput->get('refid', 0, 'INT');
+ if (0 != $redirectedValue && $redirectedField)
+ {
+ // Now set the local-redirected field default value
+ $form->setValue($redirectedField, null, $redirectedValue);
+ }
+ }
+
+ return $form;
+ }
+
+ /**
+ * Method to get the script that have to be included on the form
+ *
+ * @return string script files
+ */
+ public function getScript()
+ {
+ return 'administrator/components/com_componentbuilder/models/forms/validation_rule.js';
+ }
+
+ /**
+ * Method to test whether a record can be deleted.
+ *
+ * @param object $record A record object.
+ *
+ * @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
+ *
+ * @since 1.6
+ */
+ protected function canDelete($record)
+ {
+ if (!empty($record->id))
+ {
+ if ($record->published != -2)
+ {
+ return;
+ }
+
+ $user = JFactory::getUser();
+ // The record has been set. Check the record permissions.
+ return $user->authorise('validation_rule.delete', 'com_componentbuilder.validation_rule.' . (int) $record->id);
+ }
+ return false;
+ }
+
+ /**
+ * Method to test whether a record can have its state edited.
+ *
+ * @param object $record A record object.
+ *
+ * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
+ *
+ * @since 1.6
+ */
+ protected function canEditState($record)
+ {
+ $user = JFactory::getUser();
+ $recordId = (!empty($record->id)) ? $record->id : 0;
+
+ if ($recordId)
+ {
+ // The record has been set. Check the record permissions.
+ $permission = $user->authorise('validation_rule.edit.state', 'com_componentbuilder.validation_rule.' . (int) $recordId);
+ if (!$permission && !is_null($permission))
+ {
+ return false;
+ }
+ }
+ // In the absense of better information, revert to the component permissions.
+ return $user->authorise('validation_rule.edit.state', 'com_componentbuilder');
+ }
+
+ /**
+ * Method override to check if you can edit an existing record.
+ *
+ * @param array $data An array of input data.
+ * @param string $key The name of the key for the primary key.
+ *
+ * @return boolean
+ * @since 2.5
+ */
+ protected function allowEdit($data = array(), $key = 'id')
+ {
+ // Check specific edit permission then general edit permission.
+ $user = JFactory::getUser();
+
+ return $user->authorise('validation_rule.edit', 'com_componentbuilder.validation_rule.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('validation_rule.edit', 'com_componentbuilder');
+ }
+
+ /**
+ * Prepare and sanitise the table data prior to saving.
+ *
+ * @param JTable $table A JTable object.
+ *
+ * @return void
+ *
+ * @since 1.6
+ */
+ protected function prepareTable($table)
+ {
+ $date = JFactory::getDate();
+ $user = JFactory::getUser();
+
+ if (isset($table->name))
+ {
+ $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES);
+ }
+
+ if (isset($table->alias) && empty($table->alias))
+ {
+ $table->generateAlias();
+ }
+
+ if (empty($table->id))
+ {
+ $table->created = $date->toSql();
+ // set the user
+ if ($table->created_by == 0 || empty($table->created_by))
+ {
+ $table->created_by = $user->id;
+ }
+ // Set ordering to the last item if not set
+ if (empty($table->ordering))
+ {
+ $db = JFactory::getDbo();
+ $query = $db->getQuery(true)
+ ->select('MAX(ordering)')
+ ->from($db->quoteName('#__componentbuilder_validation_rule'));
+ $db->setQuery($query);
+ $max = $db->loadResult();
+
+ $table->ordering = $max + 1;
+ }
+ }
+ else
+ {
+ $table->modified = $date->toSql();
+ $table->modified_by = $user->id;
+ }
+
+ if (!empty($table->id))
+ {
+ // Increment the items version number.
+ $table->version++;
+ }
+ }
+
+ /**
+ * Method to get the data that should be injected in the form.
+ *
+ * @return mixed The data for the form.
+ *
+ * @since 1.6
+ */
+ protected function loadFormData()
+ {
+ // Check the session for previously entered form data.
+ $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.validation_rule.data', array());
+
+ if (empty($data))
+ {
+ $data = $this->getItem();
+ }
+
+ return $data;
+ }
+
+ /**
+ * Method to get the unique fields of this table.
+ *
+ * @return mixed An array of field names, boolean false if none is set.
+ *
+ * @since 3.0
+ */
+ protected function getUniqeFields()
+ {
+ return false;
+ }
+
+ /**
+ * 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)
+ {
+ if (!parent::delete($pks))
+ {
+ return false;
+ }
+
+ 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)
+ {
+ if (!parent::publish($pks, $value))
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Method to perform batch operations on an item or a set of items.
+ *
+ * @param array $commands An array of commands to perform.
+ * @param array $pks An array of item ids.
+ * @param array $contexts An array of item contexts.
+ *
+ * @return boolean Returns true on success, false on failure.
+ *
+ * @since 12.2
+ */
+ public function batch($commands, $pks, $contexts)
+ {
+ // Sanitize ids.
+ $pks = array_unique($pks);
+ JArrayHelper::toInteger($pks);
+
+ // Remove any values of zero.
+ if (array_search(0, $pks, true))
+ {
+ unset($pks[array_search(0, $pks, true)]);
+ }
+
+ if (empty($pks))
+ {
+ $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
+ return false;
+ }
+
+ $done = false;
+
+ // Set some needed variables.
+ $this->user = JFactory::getUser();
+ $this->table = $this->getTable();
+ $this->tableClassName = get_class($this->table);
+ $this->contentType = new JUcmType;
+ $this->type = $this->contentType->getTypeByTable($this->tableClassName);
+ $this->canDo = ComponentbuilderHelper::getActions('validation_rule');
+ $this->batchSet = true;
+
+ if (!$this->canDo->get('core.batch'))
+ {
+ $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
+ return false;
+ }
+
+ if ($this->type == false)
+ {
+ $type = new JUcmType;
+ $this->type = $type->getTypeByAlias($this->typeAlias);
+ }
+
+ $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags');
+
+ if (!empty($commands['move_copy']))
+ {
+ $cmd = JArrayHelper::getValue($commands, 'move_copy', 'c');
+
+ if ($cmd == 'c')
+ {
+ $result = $this->batchCopy($commands, $pks, $contexts);
+
+ if (is_array($result))
+ {
+ foreach ($result as $old => $new)
+ {
+ $contexts[$new] = $contexts[$old];
+ }
+ $pks = array_values($result);
+ }
+ else
+ {
+ return false;
+ }
+ }
+ elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts))
+ {
+ return false;
+ }
+
+ $done = true;
+ }
+
+ if (!$done)
+ {
+ $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
+
+ return false;
+ }
+
+ // Clear the cache
+ $this->cleanCache();
+
+ return true;
+ }
+
+ /**
+ * Batch copy items to a new category or current.
+ *
+ * @param integer $values The new values.
+ * @param array $pks An array of row IDs.
+ * @param array $contexts An array of item contexts.
+ *
+ * @return mixed An array of new IDs on success, boolean false on failure.
+ *
+ * @since 12.2
+ */
+ protected function batchCopy($values, $pks, $contexts)
+ {
+ if (empty($this->batchSet))
+ {
+ // Set some needed variables.
+ $this->user = JFactory::getUser();
+ $this->table = $this->getTable();
+ $this->tableClassName = get_class($this->table);
+ $this->canDo = ComponentbuilderHelper::getActions('validation_rule');
+ }
+
+ if (!$this->canDo->get('validation_rule.create') && !$this->canDo->get('validation_rule.batch'))
+ {
+ return false;
+ }
+
+ // get list of uniqe fields
+ $uniqeFields = $this->getUniqeFields();
+ // remove move_copy from array
+ unset($values['move_copy']);
+
+ // make sure published is set
+ if (!isset($values['published']))
+ {
+ $values['published'] = 0;
+ }
+ elseif (isset($values['published']) && !$this->canDo->get('validation_rule.edit.state'))
+ {
+ $values['published'] = 0;
+ }
+
+ $newIds = array();
+ // Parent exists so let's proceed
+ while (!empty($pks))
+ {
+ // Pop the first ID off the stack
+ $pk = array_shift($pks);
+
+ $this->table->reset();
+
+ // only allow copy if user may edit this item.
+ if (!$this->user->authorise('validation_rule.edit', $contexts[$pk]))
+ {
+ // Not fatal error
+ $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
+ continue;
+ }
+
+ // Check that the row actually exists
+ if (!$this->table->load($pk))
+ {
+ if ($error = $this->table->getError())
+ {
+ // Fatal error
+ $this->setError($error);
+ return false;
+ }
+ else
+ {
+ // Not fatal error
+ $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
+ continue;
+ }
+ }
+
+ // Only for strings
+ if (ComponentbuilderHelper::checkString($this->table->name) && !is_numeric($this->table->name))
+ {
+ $this->table->name = $this->generateUniqe('name',$this->table->name);
+ }
+
+ // insert all set values
+ if (ComponentbuilderHelper::checkArray($values))
+ {
+ foreach ($values as $key => $value)
+ {
+ if (strlen($value) > 0 && isset($this->table->$key))
+ {
+ $this->table->$key = $value;
+ }
+ }
+ }
+
+ // update all uniqe fields
+ if (ComponentbuilderHelper::checkArray($uniqeFields))
+ {
+ foreach ($uniqeFields as $uniqeField)
+ {
+ $this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField);
+ }
+ }
+
+ // Reset the ID because we are making a copy
+ $this->table->id = 0;
+
+ // TODO: Deal with ordering?
+ // $this->table->ordering = 1;
+
+ // Check the row.
+ if (!$this->table->check())
+ {
+ $this->setError($this->table->getError());
+
+ return false;
+ }
+
+ if (!empty($this->type))
+ {
+ $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
+ }
+
+ // Store the row.
+ if (!$this->table->store())
+ {
+ $this->setError($this->table->getError());
+
+ return false;
+ }
+
+ // Get the new item ID
+ $newId = $this->table->get('id');
+
+ // Add the new ID to the array
+ $newIds[$pk] = $newId;
+ }
+
+ // Clean the cache
+ $this->cleanCache();
+
+ return $newIds;
+ }
+
+ /**
+ * Batch move items to a new category
+ *
+ * @param integer $value The new category ID.
+ * @param array $pks An array of row IDs.
+ * @param array $contexts An array of item contexts.
+ *
+ * @return boolean True if successful, false otherwise and internal error is set.
+ *
+ * @since 12.2
+ */
+ protected function batchMove($values, $pks, $contexts)
+ {
+ if (empty($this->batchSet))
+ {
+ // Set some needed variables.
+ $this->user = JFactory::getUser();
+ $this->table = $this->getTable();
+ $this->tableClassName = get_class($this->table);
+ $this->canDo = ComponentbuilderHelper::getActions('validation_rule');
+ }
+
+ if (!$this->canDo->get('validation_rule.edit') && !$this->canDo->get('validation_rule.batch'))
+ {
+ $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
+ return false;
+ }
+
+ // make sure published only updates if user has the permission.
+ if (isset($values['published']) && !$this->canDo->get('validation_rule.edit.state'))
+ {
+ unset($values['published']);
+ }
+ // remove move_copy from array
+ unset($values['move_copy']);
+
+ // Parent exists so we proceed
+ foreach ($pks as $pk)
+ {
+ if (!$this->user->authorise('validation_rule.edit', $contexts[$pk]))
+ {
+ $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
+ return false;
+ }
+
+ // Check that the row actually exists
+ if (!$this->table->load($pk))
+ {
+ if ($error = $this->table->getError())
+ {
+ // Fatal error
+ $this->setError($error);
+ return false;
+ }
+ else
+ {
+ // Not fatal error
+ $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
+ continue;
+ }
+ }
+
+ // insert all set values.
+ if (ComponentbuilderHelper::checkArray($values))
+ {
+ foreach ($values as $key => $value)
+ {
+ // Do special action for access.
+ if ('access' === $key && strlen($value) > 0)
+ {
+ $this->table->$key = $value;
+ }
+ elseif (strlen($value) > 0 && isset($this->table->$key))
+ {
+ $this->table->$key = $value;
+ }
+ }
+ }
+
+
+ // Check the row.
+ if (!$this->table->check())
+ {
+ $this->setError($this->table->getError());
+
+ return false;
+ }
+
+ if (!empty($this->type))
+ {
+ $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
+ }
+
+ // Store the row.
+ if (!$this->table->store())
+ {
+ $this->setError($this->table->getError());
+
+ return false;
+ }
+ }
+
+ // Clean the cache
+ $this->cleanCache();
+
+ return true;
+ }
+
+ /**
+ * Method to save the form data.
+ *
+ * @param array $data The form data.
+ *
+ * @return boolean True on success.
+ *
+ * @since 1.6
+ */
+ public function save($data)
+ {
+ $input = JFactory::getApplication()->input;
+ $filter = JFilterInput::getInstance();
+
+ // set the metadata to the Item Data
+ if (isset($data['metadata']) && isset($data['metadata']['author']))
+ {
+ $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
+
+ $metadata = new JRegistry;
+ $metadata->loadArray($data['metadata']);
+ $data['metadata'] = (string) $metadata;
+ }
+
+ // Set the php string to base64 string.
+ if (isset($data['php']))
+ {
+ $data['php'] = base64_encode($data['php']);
+ }
+
+ // Set the Params Items to data
+ if (isset($data['params']) && is_array($data['params']))
+ {
+ $params = new JRegistry;
+ $params->loadArray($data['params']);
+ $data['params'] = (string) $params;
+ }
+
+ // Alter the uniqe field for save as copy
+ if ($input->get('task') === 'save2copy')
+ {
+ // Automatic handling of other uniqe fields
+ $uniqeFields = $this->getUniqeFields();
+ if (ComponentbuilderHelper::checkArray($uniqeFields))
+ {
+ foreach ($uniqeFields as $uniqeField)
+ {
+ $data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]);
+ }
+ }
+ }
+
+ if (parent::save($data))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Method to generate a uniqe value.
+ *
+ * @param string $field name.
+ * @param string $value data.
+ *
+ * @return string New value.
+ *
+ * @since 3.0
+ */
+ protected function generateUniqe($field,$value)
+ {
+
+ // set field value uniqe
+ $table = $this->getTable();
+
+ while ($table->load(array($field => $value)))
+ {
+ $value = JString::increment($value);
+ }
+
+ return $value;
+ }
+
+ /**
+ * Method to change the title & alias.
+ *
+ * @param string $title The title.
+ *
+ * @return array Contains the modified title and alias.
+ *
+ */
+ protected function _generateNewTitle($title)
+ {
+
+ // Alter the title
+ $table = $this->getTable();
+
+ while ($table->load(array('title' => $title)))
+ {
+ $title = JString::increment($title);
+ }
+
+ return $title;
+ }
+}
diff --git a/admin/models/validation_rules.php b/admin/models/validation_rules.php
new file mode 100644
index 000000000..27d5ed3aa
--- /dev/null
+++ b/admin/models/validation_rules.php
@@ -0,0 +1,377 @@
+
+ @github Joomla Component Builder
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Builds Complex Joomla Components
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+defined('_JEXEC') or die('Restricted access');
+
+// import the Joomla modellist library
+jimport('joomla.application.component.modellist');
+
+/**
+ * Validation_rules Model
+ */
+class ComponentbuilderModelValidation_rules extends JModelList
+{
+ public function __construct($config = array())
+ {
+ if (empty($config['filter_fields']))
+ {
+ $config['filter_fields'] = array(
+ 'a.id','id',
+ 'a.published','published',
+ 'a.ordering','ordering',
+ 'a.created_by','created_by',
+ 'a.modified_by','modified_by',
+ 'a.name','name',
+ 'a.short_description','short_description'
+ );
+ }
+
+ parent::__construct($config);
+ }
+
+ /**
+ * Method to auto-populate the model state.
+ *
+ * @return void
+ */
+ protected function populateState($ordering = null, $direction = null)
+ {
+ $app = JFactory::getApplication();
+
+ // Adjust the context to support modal layouts.
+ if ($layout = $app->input->get('layout'))
+ {
+ $this->context .= '.' . $layout;
+ }
+ $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name');
+ $this->setState('filter.name', $name);
+
+ $short_description = $this->getUserStateFromRequest($this->context . '.filter.short_description', 'filter_short_description');
+ $this->setState('filter.short_description', $short_description);
+
+ $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
+ $this->setState('filter.sorting', $sorting);
+
+ $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
+ $this->setState('filter.access', $access);
+
+ $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
+ $this->setState('filter.search', $search);
+
+ $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
+ $this->setState('filter.published', $published);
+
+ $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', '');
+ $this->setState('filter.created_by', $created_by);
+
+ $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created');
+ $this->setState('filter.created', $created);
+
+ // List state information.
+ parent::populateState($ordering, $direction);
+ }
+
+ /**
+ * Method to get an array of data items.
+ *
+ * @return mixed An array of data items on success, false on failure.
+ */
+ public function getItems()
+ {
+ // check in items
+ $this->checkInNow();
+
+ // load parent items
+ $items = parent::getItems();
+
+ // set values to display correctly.
+ if (ComponentbuilderHelper::checkArray($items))
+ {
+ // get user object.
+ $user = JFactory::getUser();
+ foreach ($items as $nr => &$item)
+ {
+ $access = ($user->authorise('validation_rule.access', 'com_componentbuilder.validation_rule.' . (int) $item->id) && $user->authorise('validation_rule.access', 'com_componentbuilder'));
+ if (!$access)
+ {
+ unset($items[$nr]);
+ continue;
+ }
+
+ }
+ }
+
+ // return items
+ return $items;
+ }
+
+ /**
+ * Method to build an SQL query to load the list data.
+ *
+ * @return string An SQL query
+ */
+ protected function getListQuery()
+ {
+ // Get the user object.
+ $user = JFactory::getUser();
+ // Create a new query object.
+ $db = JFactory::getDBO();
+ $query = $db->getQuery(true);
+
+ // Select some fields
+ $query->select('a.*');
+
+ // From the componentbuilder_item table
+ $query->from($db->quoteName('#__componentbuilder_validation_rule', 'a'));
+
+ // Filter by published state
+ $published = $this->getState('filter.published');
+ if (is_numeric($published))
+ {
+ $query->where('a.published = ' . (int) $published);
+ }
+ elseif ($published === '')
+ {
+ $query->where('(a.published = 0 OR a.published = 1)');
+ }
+
+ // Join over the asset groups.
+ $query->select('ag.title AS access_level');
+ $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
+ // Filter by access level.
+ if ($access = $this->getState('filter.access'))
+ {
+ $query->where('a.access = ' . (int) $access);
+ }
+ // Implement View Level Access
+ if (!$user->authorise('core.options', 'com_componentbuilder'))
+ {
+ $groups = implode(',', $user->getAuthorisedViewLevels());
+ $query->where('a.access IN (' . $groups . ')');
+ }
+ // Filter by search.
+ $search = $this->getState('filter.search');
+ if (!empty($search))
+ {
+ if (stripos($search, 'id:') === 0)
+ {
+ $query->where('a.id = ' . (int) substr($search, 3));
+ }
+ else
+ {
+ $search = $db->quote('%' . $db->escape($search) . '%');
+ $query->where('(a.name LIKE '.$search.' OR a.short_description LIKE '.$search.')');
+ }
+ }
+
+
+ // Add the list ordering clause.
+ $orderCol = $this->state->get('list.ordering', 'a.id');
+ $orderDirn = $this->state->get('list.direction', 'asc');
+ if ($orderCol != '')
+ {
+ $query->order($db->escape($orderCol . ' ' . $orderDirn));
+ }
+
+ return $query;
+ }
+
+ /**
+ * Method to get list export data.
+ *
+ * @return mixed An array of data items on success, false on failure.
+ */
+ public function getExportData($pks)
+ {
+ // setup the query
+ if (ComponentbuilderHelper::checkArray($pks))
+ {
+ // Set a value to know this is exporting method.
+ $_export = true;
+ // Get the user object.
+ $user = JFactory::getUser();
+ // Create a new query object.
+ $db = JFactory::getDBO();
+ $query = $db->getQuery(true);
+
+ // Select some fields
+ $query->select('a.*');
+
+ // From the componentbuilder_validation_rule table
+ $query->from($db->quoteName('#__componentbuilder_validation_rule', 'a'));
+ $query->where('a.id IN (' . implode(',',$pks) . ')');
+ // Implement View Level Access
+ if (!$user->authorise('core.options', 'com_componentbuilder'))
+ {
+ $groups = implode(',', $user->getAuthorisedViewLevels());
+ $query->where('a.access IN (' . $groups . ')');
+ }
+
+ // Order the results by ordering
+ $query->order('a.ordering ASC');
+
+ // Load the items
+ $db->setQuery($query);
+ $db->execute();
+ if ($db->getNumRows())
+ {
+ $items = $db->loadObjectList();
+
+ // set values to display correctly.
+ if (ComponentbuilderHelper::checkArray($items))
+ {
+ // get user object.
+ $user = JFactory::getUser();
+ foreach ($items as $nr => &$item)
+ {
+ $access = ($user->authorise('validation_rule.access', 'com_componentbuilder.validation_rule.' . (int) $item->id) && $user->authorise('validation_rule.access', 'com_componentbuilder'));
+ if (!$access)
+ {
+ unset($items[$nr]);
+ continue;
+ }
+
+ // decode php
+ $item->php = base64_decode($item->php);
+ // unset the values we don't want exported.
+ unset($item->asset_id);
+ unset($item->checked_out);
+ unset($item->checked_out_time);
+ }
+ }
+ // Add headers to items array.
+ $headers = $this->getExImPortHeaders();
+ if (ComponentbuilderHelper::checkObject($headers))
+ {
+ array_unshift($items,$headers);
+ }
+ return $items;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Method to get header.
+ *
+ * @return mixed An array of data items on success, false on failure.
+ */
+ public function getExImPortHeaders()
+ {
+ // Get a db connection.
+ $db = JFactory::getDbo();
+ // get the columns
+ $columns = $db->getTableColumns("#__componentbuilder_validation_rule");
+ if (ComponentbuilderHelper::checkArray($columns))
+ {
+ // remove the headers you don't import/export.
+ unset($columns['asset_id']);
+ unset($columns['checked_out']);
+ unset($columns['checked_out_time']);
+ $headers = new stdClass();
+ foreach ($columns as $column => $type)
+ {
+ $headers->{$column} = $column;
+ }
+ return $headers;
+ }
+ return false;
+ }
+
+ /**
+ * Method to get a store id based on model configuration state.
+ *
+ * @return string A store id.
+ *
+ */
+ protected function getStoreId($id = '')
+ {
+ // Compile the store id.
+ $id .= ':' . $this->getState('filter.id');
+ $id .= ':' . $this->getState('filter.search');
+ $id .= ':' . $this->getState('filter.published');
+ $id .= ':' . $this->getState('filter.ordering');
+ $id .= ':' . $this->getState('filter.created_by');
+ $id .= ':' . $this->getState('filter.modified_by');
+ $id .= ':' . $this->getState('filter.name');
+ $id .= ':' . $this->getState('filter.short_description');
+
+ return parent::getStoreId($id);
+ }
+
+ /**
+ * Build an SQL query to checkin all items left checked out longer then a set time.
+ *
+ * @return a bool
+ *
+ */
+ protected function checkInNow()
+ {
+ // Get set check in time
+ $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in');
+
+ if ($time)
+ {
+
+ // Get a db connection.
+ $db = JFactory::getDbo();
+ // reset query
+ $query = $db->getQuery(true);
+ $query->select('*');
+ $query->from($db->quoteName('#__componentbuilder_validation_rule'));
+ $db->setQuery($query);
+ $db->execute();
+ if ($db->getNumRows())
+ {
+ // Get Yesterdays date
+ $date = JFactory::getDate()->modify($time)->toSql();
+ // reset query
+ $query = $db->getQuery(true);
+
+ // Fields to update.
+ $fields = array(
+ $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'',
+ $db->quoteName('checked_out') . '=0'
+ );
+
+ // Conditions for which records should be updated.
+ $conditions = array(
+ $db->quoteName('checked_out') . '!=0',
+ $db->quoteName('checked_out_time') . '<\''.$date.'\''
+ );
+
+ // Check table
+ $query->update($db->quoteName('#__componentbuilder_validation_rule'))->set($fields)->where($conditions);
+
+ $db->setQuery($query);
+
+ $db->execute();
+ }
+ }
+
+ return false;
+ }
+}
diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql
index f712ec561..7fffdf017 100644
--- a/admin/sql/install.mysql.utf8.sql
+++ b/admin/sql/install.mysql.utf8.sql
@@ -654,6 +654,34 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_snippet` (
KEY `idx_library` (`library`)
) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
+CREATE TABLE IF NOT EXISTS `#__componentbuilder_validation_rule` (
+ `id` INT(11) NOT NULL AUTO_INCREMENT,
+ `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.',
+ `inherit` CHAR NOT NULL DEFAULT '',
+ `name` VARCHAR(255) NOT NULL DEFAULT '',
+ `php` MEDIUMTEXT NOT NULL,
+ `short_description` VARCHAR(255) NOT NULL DEFAULT '',
+ `params` text NOT NULL DEFAULT '',
+ `published` TINYINT(3) NOT NULL DEFAULT 1,
+ `created_by` INT(10) unsigned NOT NULL DEFAULT 0,
+ `modified_by` INT(10) unsigned NOT NULL DEFAULT 0,
+ `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `checked_out` int(11) unsigned NOT NULL DEFAULT 0,
+ `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `version` INT(10) unsigned NOT NULL DEFAULT 1,
+ `hits` INT(10) unsigned NOT NULL DEFAULT 0,
+ `access` INT(10) unsigned NOT NULL DEFAULT 0,
+ `ordering` INT(11) NOT NULL DEFAULT 0,
+ PRIMARY KEY (`id`),
+ KEY `idx_access` (`access`),
+ KEY `idx_checkout` (`checked_out`),
+ KEY `idx_createdby` (`created_by`),
+ KEY `idx_modifiedby` (`modified_by`),
+ KEY `idx_state` (`published`),
+ KEY `idx_name` (`name`)
+) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
+
CREATE TABLE IF NOT EXISTS `#__componentbuilder_field` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.',
@@ -1476,7 +1504,7 @@ INSERT INTO `#__componentbuilder_fieldtype` (`id`, `catid`, `description`, `name
(11, '', 'The list form field type provides a drop down list or a list box of custom-defined entries. If the field has a saved value this is selected when the page is first loaded. If not, the default value (if any) is selected.', 'List', '{\"properties0\":{\"name\":\"type\",\"example\":\"list\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be list.\"},\"properties1\":{\"name\":\"name\",\"example\":\"mylist\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Select an option\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties13\":{\"name\":\"message\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as error on validation.\"},\"properties4\":{\"name\":\"class\",\"example\":\"list_class\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'inputbox\'.\"},\"properties5\":{\"name\":\"multiple\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) is whether multiple items can be selected at the same time (true or false).\"},\"properties6\":{\"name\":\"filter\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) filter options\"},\"properties7\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties14\":{\"name\":\"validate\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The validation method for the form field. This value will determine which method is used to validate the value for a field.\"},\"properties8\":{\"name\":\"option\",\"example\":\"0|Option 1,1|Option 2,2|Option 1\",\"adjustable\":\"1\",\"description\":\"(mandatory) set the options of this radio. Separate options with commas and use the pipe symbol to separate value from text.\"},\"properties9\":{\"name\":\"default\",\"example\":\"0\",\"adjustable\":\"1\",\"description\":\"(optional) is the default list item value.\"},\"properties10\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) Allows you to hide the field based on the value(s) of another field; for Joomla 3.2.4+\"},\"properties11\":{\"name\":\"onchange\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) HTML equivalent attribute (javascript use)\"}}', 'provides a drop down list of custom-defined entries.', '', 1, 5, '', ''),
(12, '', 'The media form field type provides modal access to the media manager for the choice of an image. Users with appropriate permissions will be able to upload files.', 'Media', '{\"properties0\":{\"name\":\"type\",\"example\":\"media\",\"adjustable\":\"0\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) must be media.\"},\"properties1\":{\"name\":\"name\",\"example\":\"media\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Media\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties4\":{\"name\":\"directory\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) is the directory from which the user will be able to choose a file. This attribute should be relative to the top level \\/images\\/ folder.\"},\"properties5\":{\"name\":\"preview\",\"example\":\"false\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) shows or hides the preview of the currently chosen image. (\\\"true\\\": Show always, \\\"tooltip\\\": Show as tooltip, \\\"false\\\": Show never) (since Joomla! 2.5.5)\"},\"properties6\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) show this field on the bases of the value in another field.\"}}', 'provides modal access to the media manager for insertion of images with upload for users with appropriate permissions.', '', 1, 2, '', ''),
(13, '', 'Provides a meter to show value in a range, updated with jQuery if needed or simply a fixed value.', 'Meter', '{\"properties0\":{\"name\":\"type\",\"example\":\"meter\",\"adjustable\":\"0\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) must be meter.\"},\"properties1\":{\"name\":\"name\",\"example\":\"meter\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Meter\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"width\",\"example\":\"330px\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is the width of meter box\"},\"properties4\":{\"name\":\"color\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) The background color\"},\"properties5\":{\"name\":\"default\",\"example\":\"9\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) (not translatable) is the default value.\"},\"properties6\":{\"name\":\"animated\",\"example\":\"1\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) lets the bar have strips\"},\"properties7\":{\"name\":\"active\",\"example\":\"1\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) lets the strips on the bar move\"},\"properties8\":{\"name\":\"description\",\"example\":\"Enter some description\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties9\":{\"name\":\"class\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'text_area\'.\"},\"properties10\":{\"name\":\"min\",\"example\":\"1\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(mandatory) this value is the min on the meter.\"},\"properties11\":{\"name\":\"max\",\"example\":\"20\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(mandatory) this value is the max on meter.\"},\"properties12\":{\"name\":\"step\",\"example\":\"1\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) each option will be the previous option incremented by this integer, starting with the first value until the last value is reached.\"},\"properties13\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) show this field on the bases of the value in another field.\"}}', 'Provides a meter to show value in a range.', '', 1, 2, '', ''),
-(14, '', 'This form field makes it possible to create titles, texts, descriptions and even alert boxes. It also allows you to bring order in the settings for extensions, by separating them with useful titles. Or adding descriptions for certain settings (without hav', 'Note', '{\"properties0\":{\"name\":\"type\",\"example\":\"note\",\"adjustable\":\"0\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) must be note\"},\"properties1\":{\"name\":\"name\",\"example\":\"note_one\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"The notice\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"1\",\"description\":\"(mandatory or optional if using description) (translatable) is the descriptive title of the note \"},\"properties3\":{\"name\":\"description\",\"example\":\"The notice description\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"1\",\"description\":\"(optional if using label)(translatable) the description\\/text of the note \"},\"properties4\":{\"name\":\"heading\",\"example\":\"h4\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) the type of heading element to use for the label (default: h4)\"},\"properties5\":{\"name\":\"class\",\"example\":\"alert\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) a class name (or class names), like these examples ( alert, alert alert-info, alert alert-success, alert alert-error )\"},\"properties6\":{\"name\":\"close\",\"example\":\"true\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) a value of \'true\' (for alerts) or the value for the data-dismiss of the bootstrap close icon\"},\"properties7\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) Allows you to hide the field based on the value(s) of another field; for Joomla 3.2.4+\"}}', 'supports a one line text field.', '', 1, 3, '', ''),
+(14, '', 'This form field makes it possible to create titles, texts, descriptions and even alert boxes. It also allows you to bring order in the settings for extensions, by separating them with useful titles. Or adding descriptions for certain settings (without having to rely on the tooltips). Or adding any other text you want.', 'Note', '{\"properties0\":{\"name\":\"type\",\"example\":\"note\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be note\"},\"properties1\":{\"name\":\"name\",\"example\":\"note_one\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"The notice\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory or optional if using description) (translatable) is the descriptive title of the note \"},\"properties3\":{\"name\":\"description\",\"example\":\"The notice description\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional if using label)(translatable) the description\\/text of the note \"},\"properties4\":{\"name\":\"heading\",\"example\":\"h4\",\"adjustable\":\"1\",\"description\":\"(optional) the type of heading element to use for the label (default: h4)\"},\"properties5\":{\"name\":\"class\",\"example\":\"alert\",\"adjustable\":\"1\",\"description\":\"(optional) a class name (or class names), like these examples ( alert, alert alert-info, alert alert-success, alert alert-error )\"},\"properties6\":{\"name\":\"close\",\"example\":\"true\",\"adjustable\":\"1\",\"description\":\"(optional) a value of \'true\' (for alerts) or the value for the data-dismiss of the bootstrap close icon\"},\"properties7\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) Allows you to hide the field based on the value(s) of another field; for Joomla 3.2.4+\"}}', 'supports a one line text field.', '', 1, 4, '', ''),
(15, '', 'Provides a one line text box with up-down handles to set a number in the field.', 'Number', '{\"properties0\":{\"name\":\"type\",\"example\":\"number\",\"adjustable\":\"0\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) must be number.\"},\"properties1\":{\"name\":\"name\",\"example\":\"number\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Number\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is the default value.\"},\"properties4\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties5\":{\"name\":\"class\",\"example\":\"text_area\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'text_area\'.\"},\"properties6\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties7\":{\"name\":\"min\",\"example\":\"1\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) this value is the lowest on the list.\"},\"properties8\":{\"name\":\"max\",\"example\":\"40\",\"adjustable\":\"0\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) this value is the highest on the list.\"},\"properties9\":{\"name\":\"step\",\"example\":\"5\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) each option will be the previous option incremented by this integer, starting with the first value until the last value is reached.\"},\"properties10\":{\"name\":\"onchange\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) Javascript that should run on changing of the value.\"},\"properties11\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) show this field on the bases of the value in another field.\"}}', 'Provides a one line text box with up-down handles to set a number in the field.', '', 1, 2, '', ''),
(16, '', 'The password form field type provides a text box for entry of a password. The password characters will be obscured as they are entered. If the field has a saved value this is entered (in obscured form) into the text box. If not, the default value (if any)', 'Password', '{\"properties0\":{\"name\":\"type\",\"example\":\"password\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be password.\"},\"properties1\":{\"name\":\"name\",\"example\":\"mypassword\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Enter A Password\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"size\",\"example\":\"10\",\"adjustable\":\"1\",\"description\":\"(optional) is the width of the text box in characters. If omitted the width is determined by the browser. The value of size does not limit the number of characters that may be entered.\"},\"properties4\":{\"name\":\"default\",\"example\":\"secret\",\"adjustable\":\"1\",\"description\":\"(optional) is the default password.\"},\"properties5\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties11\":{\"name\":\"message\",\"example\":\"Error! Please add password here.\",\"adjustable\":\"1\",\"description\":\"(optional) The error message that will be displayed instead of the default message.\"},\"properties6\":{\"name\":\"class\",\"example\":\"text_area\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'text_area\'.\"},\"properties7\":{\"name\":\"readonly\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value\"},\"properties8\":{\"name\":\"disabled\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value - it will also not submit\"},\"properties9\":{\"name\":\"required\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties17\":{\"name\":\"validate\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The validation method for the form field. This value will determine which method is used to validate the value for a field.\"},\"properties10\":{\"name\":\"filter\",\"example\":\"raw\",\"adjustable\":\"1\",\"description\":\"(optional) allow the system to save certain html tags or raw data.\"},\"properties12\":{\"name\":\"hint\",\"example\":\"Your Password Here\",\"adjustable\":\"1\",\"description\":\"(optional) The placeholder to display inside the text box.\"},\"properties13\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field.\"},\"properties14\":{\"name\":\"onchange\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) HTML equivalent attribute (javascript use)\"}}', 'provides a text box for entry of a password. The password characters will be obscured as they are entered.', '', 1, 5, '', ''),
(17, '', 'The radio form field type provides radio buttons to select different options. If the field has a saved value this is selected when the page is first loaded. If not, the default value (if any) is selected.', 'Radio', '{\"properties0\":{\"name\":\"type\",\"example\":\"radio\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be radio.\"},\"properties1\":{\"name\":\"name\",\"example\":\"myradiovalue\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Select an option\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties4\":{\"name\":\"class\",\"example\":\"btn-group btn-group-yesno\",\"adjustable\":\"1\",\"description\":\"(optional) New in Joomla 3, if set to class=\\\"btn-group btn-group-yesno\\\" will show the nice coloured buttons\"},\"properties5\":{\"name\":\"option\",\"example\":\"1|Yes,0|No\",\"adjustable\":\"1\",\"description\":\"(mandatory) set the options of this radio. Separate options with commas and use the pipe symbol to separate value from text.\"},\"properties6\":{\"name\":\"default\",\"example\":\"0\",\"adjustable\":\"1\",\"description\":\"(optional) is the default radio button item value.\"},\"properties7\":{\"name\":\"message\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as error on validation.\"},\"properties8\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties9\":{\"name\":\"validate\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The validation method for the form field. This value will determine which method is used to validate the value for a field.\"},\"properties14\":{\"name\":\"readonly\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value\"},\"properties10\":{\"name\":\"disabled\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value - it will also not submit\"},\"properties11\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) Allows you to hide the field based on the value(s) of another field; for Joomla 3.2.4+\"},\"properties12\":{\"name\":\"onchange\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) HTML equivalent attribute (javascript use)\"}}', 'provides radio buttons to select different options.', '', 1, 7, '', ''),
@@ -1494,7 +1522,7 @@ INSERT INTO `#__componentbuilder_fieldtype` (`id`, `catid`, `description`, `name
(29, '', 'The usergroup form field type provides a modal select box of user groups.', 'Usergroup', '{\"properties0\":{\"name\":\"type\",\"example\":\"usergroup\",\"adjustable\":\"0\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) must be usergroup.\"},\"properties1\":{\"name\":\"name\",\"example\":\"usergroup\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) is the unique name of the field. This must match the name of the query results column that contains the values that will be shown to the user in the drop-down list, unless a different name is specified in the value_field attribute.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Group\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"Select a group\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties4\":{\"name\":\"class\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is a CSS class name for the HTML form field.\"},\"properties5\":{\"name\":\"size\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is the width of the text box in characters. If omitted the width is determined by the browser. The value of size does not limit the number of characters that may be entered.\"},\"properties6\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is the field required true if yes.\"},\"properties7\":{\"name\":\"multiple\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) If set to multiple then allows more than one usergroup to be selected.\"},\"properties8\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) show this field on the bases of the value in another field.\"}}', 'provides a drop down list of user groups.', '', 1, 2, '', ''),
(30, '', 'The filelist form field type provides a drop down list of files from a specified directory. If the field has a saved value this is selected when the page is first loaded. If not, the default value (if any) is selected.\r\n\r\nBy default, the first item on the', 'Filelist', '{\"properties0\":{\"name\":\"type\",\"example\":\"filelist\",\"adjustable\":\"0\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) must be filelist.\"},\"properties1\":{\"name\":\"name\",\"example\":\"myfile\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Select a file\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"directory\",\"example\":\"images\\/stories\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is the filesystem path to the directory containing the files to be listed. If omitted the directory given by JPATH_ROOT is assumed.\"},\"properties4\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is the default file name.\"},\"properties5\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties6\":{\"name\":\"filter\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is a regular expression string which is used to filter the list of files selected for inclusion in the drop-down list. If omitted, all files in the directory are included. The filter argument expression is applied before the exclude argument expression. For information on constructing regular expressions see Regular expressions in parameter arguments.\"},\"properties7\":{\"name\":\"exclude\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is a regular expression string which is used to exclude files from the list. The exclude argument expression is applied after the filter argument expression. For information on constructing regular expressions see Regular expressions in parameter arguments.\"},\"properties8\":{\"name\":\"stripext\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is a Boolean argument. If true then file name extensions will be stripped from the file names listed. Also note that the file name will be saved without the extension too.\"},\"properties9\":{\"name\":\"hide_none\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is a Boolean argument. If true, the \'- Do not use -\' item is omitted from the drop-down list.\"},\"properties10\":{\"name\":\"hide_default\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is a Boolean argument. If true, the \'- Use default -\' item is omitted from the drop-down list.\"},\"properties11\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) show this field on the bases of the value in another field.\"}}', 'Provides a drop down list of files from a specified directory.', '', 1, 2, '', 1),
(31, '', 'The folderlist form field type provides a drop down list of folders from a specfied directory. If the field has a saved value this is selected when the page is first loaded. If not, the default value (if any) is selected.\r\n\r\nBy default, the first item on ', 'Folderlist', '{\"properties0\":{\"name\":\"type\",\"example\":\"folderlist\",\"adjustable\":\"0\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) must be folderlist.\"},\"properties1\":{\"name\":\"name\",\"example\":\"myfolder\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Select a folder\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"directory\",\"example\":\"images\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) is the filesystem path to the directory containing the folders to be listed.\"},\"properties4\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is the default folder name.\"},\"properties5\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties6\":{\"name\":\"filter\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is a regular expression string which is used to filter the list of folders selected for inclusion in the drop-down list. If omitted, all folders in the directory are included. The filter argument expression is applied before the exclude argument expression. For information on constructing regular expressions see Regular expressions in parameter arguments.\"},\"properties7\":{\"name\":\"exclude\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is a regular expression string which is used to exclude folders from the list. The exclude argument expression is applied after the filter argument expression. For information on constructing regular expressions see Regular expressions in parameter arguments.\"},\"properties8\":{\"name\":\"hide_none\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is a Boolean argument. If true, the \'- Do not use -\' item is omitted from the drop-down list.\"},\"properties9\":{\"name\":\"hide_default\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is a Boolean argument. If true, the \'- Use default -\' item is omitted from the drop-down list.\"},\"properties10\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) show this field on the bases of the value in another field.\"}}', 'Provides a drop down list of folders from a specified directory.', '', 1, 2, '', 2),
-(32, '', 'Note: When using the file input type you should always add the attribute enctype=\"multipart/form-data\" to your form tag. Otherwise, the uploaded files will not be attached correctly. Note 2: You can put a soft limit file size by adding a hidden field with name=\"MAX_FILE_SIZE\" and value the maximum allowed bytes which is handled by php, but you must also handle it in your code with or without it.', 'File', '{\"properties0\":{\"name\":\"type\",\"example\":\"file\",\"adjustable\":\"0\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) must be file.\"},\"properties1\":{\"name\":\"name\",\"example\":\"myfilevalue\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Enter some text\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"Choose an image from your computer with maximum 100KB\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties4\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) (not translatable) is the default value, but doesn\'t mean much for a file.\"},\"properties5\":{\"name\":\"size\",\"example\":\"10\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is the width of the file box in characters.\"},\"properties6\":{\"name\":\"class\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is a CSS class name for the HTML form field.\"},\"properties7\":{\"name\":\"labelclass\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) adds a CSS class for form field\'s label; for Joomla 2.5.4+\"},\"properties8\":{\"name\":\"disabled\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) HTML equivalent attribute\"},\"properties9\":{\"name\":\"onchange\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) HTML equivalent attribute (javascript use)\"},\"properties10\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) For Joomla form validating it to be filled in\"},\"properties11\":{\"name\":\"validate\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) Whether to Joomla validate the field according to rules\"},\"properties12\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) Allows you to hide the field based on the value(s) of another field; for Joomla 3.2.4+\"}}', 'Provides an input field for files', '', 1, 1, '', 3),
+(32, '', 'Note: When using the file input type you should always add the attribute enctype=\"multipart/form-data\" to your form tag. Otherwise, the uploaded files will not be attached correctly.\r\n\r\nNote 2: You can put a soft limit file size by adding a hidden field with name=\"MAX_FILE_SIZE\" and value the maximum allowed bytes which is handled by php, but you must also handle it in your code with or without it.', 'File', '{\"properties0\":{\"name\":\"type\",\"example\":\"file\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be file.\"},\"properties1\":{\"name\":\"name\",\"example\":\"myfilevalue\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Enter some text\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"Choose an image from your computer with maximum 100KB\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties4\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) (not translatable) is the default value, but doesn\'t mean much for a file.\"},\"properties5\":{\"name\":\"size\",\"example\":\"10\",\"adjustable\":\"1\",\"description\":\"(optional) is the width of the file box in characters.\"},\"properties6\":{\"name\":\"accept\",\"example\":\"image\\/*\",\"adjustable\":\"1\",\"description\":\"(optional) Tells the browser what MIME types<\\/a> your form will allow to be uploaded.\"},\"properties7\":{\"name\":\"class\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field.\"},\"properties8\":{\"name\":\"labelclass\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) adds a CSS class for form field\'s label; for Joomla 2.5.4+\"},\"properties9\":{\"name\":\"disabled\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) HTML equivalent attribute\"},\"properties10\":{\"name\":\"onchange\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) HTML equivalent attribute (javascript use)\"},\"properties11\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) For Joomla form validating it to be filled in\"},\"properties12\":{\"name\":\"validate\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) Whether to Joomla validate the field according to rules\"},\"properties13\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) Allows you to hide the field based on the value(s) of another field; for Joomla 3.2.4+\"}}', 'Provides an input field for files', '', 1, 7, '', 3),
(33, '', 'The menuitem form field type provides a drop down grouped list of the available menu items from your Joomla site.', 'menuitem', '{\"properties0\":{\"name\":\"type\",\"example\":\"menuitem\",\"adjustable\":\"0\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) must be menuitem.\"},\"properties1\":{\"name\":\"name\",\"example\":\"mymenuitem\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Select a menu item\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is the default menu item. Note that this is the ItemID number of the menu item.\"},\"properties4\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties5\":{\"name\":\"published\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) determines whether all menu items are listed or only published menu items. If state is \'0\' then all menu items will be listed. If state is \'1\' then only published menu items will be listed.\"},\"properties6\":{\"name\":\"filter\",\"example\":\"int\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(optional) allow the system to save certain html tags or raw data.\"},\"properties7\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) Allows you to hide the field based on the value(s) of another field; for Joomla 3.2.4+\"}}', 'provides a drop down list of the available menu items from your Joomla site.', '', 1, 2, '', 4),
(34, '', 'Remember all views already have [accesslevel] added by default, only add this if you need more custom access selection! Provides a dropdown list of accesslevel options with the current option selected.', 'Accesslevel', '{\"properties0\":{\"name\":\"type\",\"example\":\"accesslevel\",\"adjustable\":\"0\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) must be accesslevel\"},\"properties1\":{\"name\":\"name\",\"example\":\"accesstwo\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) is the unique name of the field. This must match the name of the query results column that contains the values that will be shown to the user in the drop-down list, unless a different name is specified in the value_field attribute. \"},\"properties2\":{\"name\":\"label\",\"example\":\"Access Two\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"Select a access level to this concept.\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties4\":{\"name\":\"class\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is a CSS class name for the HTML form field.\"},\"properties5\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is the field required true if yes.\"},\"properties6\":{\"name\":\"multiple\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) If set to multiple then allows more than one usergroup to be selected.\"},\"properties7\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) show this field on the bases of the value in another field.\"}}', 'List of accesslevels', '', 1, 1, '', 5),
(35, '', 'Provides a form with rows of fields that you specify. As many options can be added as desired. Note this form field has a jQuery based javascript file as a dependency.', 'Subform', '{\"properties0\":{\"name\":\"type\",\"example\":\"subform\",\"description\":\"(mandatory) must be subform.\"},\"properties1\":{\"name\":\"name\",\"example\":\"options\",\"adjustable\":\"1\",\"description\":\"(mandatory) is the unique name of the parameter\"},\"properties2\":{\"name\":\"label\",\"example\":\"The Option List\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"layout\",\"example\":\"joomla.form.field.subform.repeatable-table\",\"adjustable\":\"1\",\"description\":\"(mandatory) The layout for the repeatable table.\"},\"properties4\":{\"name\":\"multiple\",\"example\":\"true\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The rows to be multiple.\"},\"properties5\":{\"name\":\"fields\",\"example\":\"1,2,3\",\"adjustable\":\"1\",\"description\":\"(mandatory) The fields to add to the modal. All fields must first be created in component builder as a field before you can add them here, since you must use the id of the field. Separate the field ids with commas. Do not add custom fields that are not also used in this component.\"},\"properties6\":{\"name\":\"formsource\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) you can add a path to a xml file containing the fields.\"},\"properties7\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) description text for the form field. Displays at the top of the modal with the name as well as in the usual position in the form\"},\"properties8\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The default value for the form field if the field is left empty. Note this has to be a json string compatible with the contents of the form field.\"},\"properties9\":{\"name\":\"icon\",\"example\":\"list\",\"adjustable\":\"1\",\"description\":\"(optional) The icon to show on the select button (is prefixed with \\\"icon-\\\").\"},\"properties10\":{\"name\":\"maximum\",\"example\":\"50\",\"adjustable\":\"1\",\"description\":\"(optional) The maximum number of rows of fields allowed (by default 999 to be effectively infinite)\"},\"properties11\":{\"name\":\"filter\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) Use only if you would like to save raw data, since the default is best.\"},\"properties12\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field.\"}}', 'Allows form fields which can have as many options as the user desires.', '', 1, 9, '', 6);
diff --git a/admin/sql/uninstall.mysql.utf8.sql b/admin/sql/uninstall.mysql.utf8.sql
index 8e7f5563c..9ee07fb83 100644
--- a/admin/sql/uninstall.mysql.utf8.sql
+++ b/admin/sql/uninstall.mysql.utf8.sql
@@ -8,6 +8,7 @@ DROP TABLE IF EXISTS `#__componentbuilder_dynamic_get`;
DROP TABLE IF EXISTS `#__componentbuilder_custom_code`;
DROP TABLE IF EXISTS `#__componentbuilder_library`;
DROP TABLE IF EXISTS `#__componentbuilder_snippet`;
+DROP TABLE IF EXISTS `#__componentbuilder_validation_rule`;
DROP TABLE IF EXISTS `#__componentbuilder_field`;
DROP TABLE IF EXISTS `#__componentbuilder_fieldtype`;
DROP TABLE IF EXISTS `#__componentbuilder_language_translation`;
diff --git a/admin/sql/updates/mysql/2.5.0.sql b/admin/sql/updates/mysql/2.5.0.sql
deleted file mode 100644
index d3f5a12fa..000000000
--- a/admin/sql/updates/mysql/2.5.0.sql
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/admin/sql/updates/mysql/2.5.4.sql b/admin/sql/updates/mysql/2.5.4.sql
deleted file mode 100644
index d3f5a12fa..000000000
--- a/admin/sql/updates/mysql/2.5.4.sql
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/admin/sql/updates/mysql/2.6.0.sql b/admin/sql/updates/mysql/2.6.0.sql
deleted file mode 100644
index d3f5a12fa..000000000
--- a/admin/sql/updates/mysql/2.6.0.sql
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/admin/sql/updates/mysql/2.6.1.sql b/admin/sql/updates/mysql/2.6.1.sql
deleted file mode 100644
index d3f5a12fa..000000000
--- a/admin/sql/updates/mysql/2.6.1.sql
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/admin/sql/updates/mysql/2.6.10.sql b/admin/sql/updates/mysql/2.6.10.sql
deleted file mode 100644
index d3f5a12fa..000000000
--- a/admin/sql/updates/mysql/2.6.10.sql
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/admin/sql/updates/mysql/2.6.15.sql b/admin/sql/updates/mysql/2.6.15.sql
deleted file mode 100644
index d3f5a12fa..000000000
--- a/admin/sql/updates/mysql/2.6.15.sql
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/admin/sql/updates/mysql/2.6.2.sql b/admin/sql/updates/mysql/2.6.2.sql
deleted file mode 100644
index d3f5a12fa..000000000
--- a/admin/sql/updates/mysql/2.6.2.sql
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/admin/sql/updates/mysql/2.6.7.sql b/admin/sql/updates/mysql/2.6.7.sql
deleted file mode 100644
index d3f5a12fa..000000000
--- a/admin/sql/updates/mysql/2.6.7.sql
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/admin/sql/updates/mysql/2.6.8.sql b/admin/sql/updates/mysql/2.6.8.sql
deleted file mode 100644
index d3f5a12fa..000000000
--- a/admin/sql/updates/mysql/2.6.8.sql
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/admin/sql/updates/mysql/2.7.0.sql b/admin/sql/updates/mysql/2.7.0.sql
new file mode 100644
index 000000000..6255f148a
--- /dev/null
+++ b/admin/sql/updates/mysql/2.7.0.sql
@@ -0,0 +1,27 @@
+CREATE TABLE IF NOT EXISTS `#__componentbuilder_validation_rule` (
+ `id` INT(11) NOT NULL AUTO_INCREMENT,
+ `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.',
+ `inherit` CHAR NOT NULL DEFAULT '',
+ `name` VARCHAR(255) NOT NULL DEFAULT '',
+ `php` MEDIUMTEXT NOT NULL,
+ `short_description` VARCHAR(255) NOT NULL DEFAULT '',
+ `params` text NOT NULL DEFAULT '',
+ `published` TINYINT(3) NOT NULL DEFAULT 1,
+ `created_by` INT(10) unsigned NOT NULL DEFAULT 0,
+ `modified_by` INT(10) unsigned NOT NULL DEFAULT 0,
+ `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `checked_out` int(11) unsigned NOT NULL DEFAULT 0,
+ `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `version` INT(10) unsigned NOT NULL DEFAULT 1,
+ `hits` INT(10) unsigned NOT NULL DEFAULT 0,
+ `access` INT(10) unsigned NOT NULL DEFAULT 0,
+ `ordering` INT(11) NOT NULL DEFAULT 0,
+ PRIMARY KEY (`id`),
+ KEY `idx_access` (`access`),
+ KEY `idx_checkout` (`checked_out`),
+ KEY `idx_createdby` (`created_by`),
+ KEY `idx_modifiedby` (`modified_by`),
+ KEY `idx_state` (`published`),
+ KEY `idx_name` (`name`)
+) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
diff --git a/admin/tables/validation_rule.php b/admin/tables/validation_rule.php
new file mode 100644
index 000000000..9771bf185
--- /dev/null
+++ b/admin/tables/validation_rule.php
@@ -0,0 +1,351 @@
+
+ @github Joomla Component Builder
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Builds Complex Joomla Components
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+defined('_JEXEC') or die('Restricted access');
+
+use Joomla\Registry\Registry;
+
+// import Joomla table library
+jimport('joomla.database.table');
+
+/**
+ * Validation_rules Table class
+ */
+class ComponentbuilderTableValidation_rule extends JTable
+{
+ /**
+ * Ensure the params and metadata in json encoded in the bind method
+ *
+ * @var array
+ * @since 3.3
+ */
+ protected $_jsonEncode = array('params', 'metadata');
+
+ /**
+ * Constructor
+ *
+ * @param object Database connector object
+ */
+ function __construct(&$db)
+ {
+ parent::__construct('#__componentbuilder_validation_rule', 'id', $db);
+
+ // Adding History Options
+ JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.validation_rule'));
+ }
+
+ public function bind($array, $ignore = '')
+ {
+
+ if (isset($array['params']) && is_array($array['params']))
+ {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = (string) $registry;
+ }
+
+ if (isset($array['metadata']) && is_array($array['metadata']))
+ {
+ $registry = new JRegistry;
+ $registry->loadArray($array['metadata']);
+ $array['metadata'] = (string) $registry;
+ }
+
+ // Bind the rules.
+ if (isset($array['rules']) && is_array($array['rules']))
+ {
+ $rules = new JAccessRules($array['rules']);
+ $this->setRules($rules);
+ }
+ return parent::bind($array, $ignore);
+ }
+
+ /**
+ * Overload the store method for the Validation_rule table.
+ *
+ * @param boolean Toggle whether null values should be updated.
+ * @return boolean True on success, false on failure.
+ * @since 1.6
+ */
+ public function store($updateNulls = false)
+ {
+ $date = JFactory::getDate();
+ $user = JFactory::getUser();
+
+ if ($this->id)
+ {
+ // Existing item
+ $this->modified = $date->toSql();
+ $this->modified_by = $user->get('id');
+ }
+ else
+ {
+ // New validation_rule. A validation_rule created and created_by field can be set by the user,
+ // so we don't touch either of these if they are set.
+ if (!(int) $this->created)
+ {
+ $this->created = $date->toSql();
+ }
+ if (empty($this->created_by))
+ {
+ $this->created_by = $user->get('id');
+ }
+ }
+
+ if (isset($this->alias))
+ {
+ // Verify that the alias is unique
+ $table = JTable::getInstance('validation_rule', 'ComponentbuilderTable');
+
+ if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
+ {
+ $this->setError(JText::_('COM_COMPONENTBUILDER_VALIDATION_RULE_ERROR_UNIQUE_ALIAS'));
+ return false;
+ }
+ }
+
+ if (isset($this->url))
+ {
+ // Convert IDN urls to punycode
+ $this->url = JStringPunycode::urlToPunycode($this->url);
+ }
+ if (isset($this->website))
+ {
+ // Convert IDN urls to punycode
+ $this->website = JStringPunycode::urlToPunycode($this->website);
+ }
+
+ return parent::store($updateNulls);
+ }
+
+ /**
+ * Overloaded check method to ensure data integrity.
+ *
+ * @return boolean True on success.
+ */
+ public function check()
+ {
+ if (isset($this->alias))
+ {
+ // Generate a valid alias
+ $this->generateAlias();
+
+ $table = JTable::getInstance('validation_rule', 'componentbuilderTable');
+
+ while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
+ {
+ $this->alias = JString::increment($this->alias, 'dash');
+ }
+ }
+
+ /*
+ * Clean up keywords -- eliminate extra spaces between phrases
+ * and cr (\r) and lf (\n) characters from string.
+ * Only process if not empty.
+ */
+ if (!empty($this->metakey))
+ {
+ // Array of characters to remove.
+ $bad_characters = array("\n", "\r", "\"", "<", ">");
+
+ // Remove bad characters.
+ $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey);
+
+ // Create array using commas as delimiter.
+ $keys = explode(',', $after_clean);
+ $clean_keys = array();
+
+ foreach ($keys as $key)
+ {
+ // Ignore blank keywords.
+ if (trim($key))
+ {
+ $clean_keys[] = trim($key);
+ }
+ }
+
+ // Put array back together delimited by ", "
+ $this->metakey = implode(", ", $clean_keys);
+ }
+
+ // Clean up description -- eliminate quotes and <> brackets
+ if (!empty($this->metadesc))
+ {
+ // Only process if not empty
+ $bad_characters = array("\"", "<", ">");
+ $this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc);
+ }
+
+ // If we don't have any access rules set at this point just use an empty JAccessRules class
+ if (!$this->getRules())
+ {
+ $rules = $this->getDefaultAssetValues('com_componentbuilder.validation_rule.'.$this->id);
+ $this->setRules($rules);
+ }
+
+ // Set ordering
+ if ($this->published < 0)
+ {
+ // Set ordering to 0 if state is archived or trashed
+ $this->ordering = 0;
+ }
+
+ return true;
+ }
+
+ /**
+ * Gets the default asset values for a component.
+ *
+ * @param $string $component The component asset name to search for
+ *
+ * @return JAccessRules The JAccessRules object for the asset
+ */
+ protected function getDefaultAssetValues($component, $try = true)
+ {
+ // Need to find the asset id by the name of the component.
+ $db = JFactory::getDbo();
+ $query = $db->getQuery(true)
+ ->select($db->quoteName('id'))
+ ->from($db->quoteName('#__assets'))
+ ->where($db->quoteName('name') . ' = ' . $db->quote($component));
+ $db->setQuery($query);
+ $db->execute();
+ if ($db->loadRowList())
+ {
+ // asset alread set so use saved rules
+ $assetId = (int) $db->loadResult();
+ return JAccess::getAssetRules($assetId);
+ }
+ // try again
+ elseif ($try)
+ {
+ $try = explode('.',$component);
+ $result = $this->getDefaultAssetValues($try[0], false);
+ if ($result instanceof JAccessRules)
+ {
+ if (isset($try[1]))
+ {
+ $_result = (string) $result;
+ $_result = json_decode($_result);
+ foreach ($_result as $name => &$rule)
+ {
+ $v = explode('.', $name);
+ if ($try[1] !== $v[0])
+ {
+ // remove since it is not part of this view
+ unset($_result->$name);
+ }
+ else
+ {
+ // clear the value since we inherit
+ $rule = array();
+ }
+ }
+ // check if there are any view values remaining
+ if (count($_result))
+ {
+ $_result = json_encode($_result);
+ $_result = array($_result);
+ // Instantiate and return the JAccessRules object for the asset rules.
+ $rules = new JAccessRules;
+ $rules->mergeCollection($_result);
+
+ return $rules;
+ }
+ }
+ return $result;
+ }
+ }
+ return JAccess::getAssetRules(0);
+ }
+
+ /**
+ * Method to compute the default name of the asset.
+ * The default name is in the form 'table_name.id'
+ * where id is the value of the primary key of the table.
+ *
+ * @return string
+ * @since 2.5
+ */
+ protected function _getAssetName()
+ {
+ $k = $this->_tbl_key;
+ return 'com_componentbuilder.validation_rule.'.(int) $this->$k;
+ }
+
+ /**
+ * Method to return the title to use for the asset table.
+ *
+ * @return string
+ * @since 2.5
+ */
+ protected function _getAssetTitle()
+ {
+ if (isset($this->title))
+ {
+ return $this->title;
+ }
+ return '';
+ }
+
+ /**
+ * Get the parent asset id for the record
+ *
+ * @return int
+ * @since 2.5
+ */
+ protected function _getAssetParentId(JTable $table = NULL, $id = NULL)
+ {
+ $asset = JTable::getInstance('Asset');
+ $asset->loadByName('com_componentbuilder');
+
+ return $asset->id;
+ }
+
+ /**
+ * Generate a valid alias from title / date.
+ * Remains public to be able to check for duplicated alias before saving
+ *
+ * @return string
+ */
+ public function generateAlias()
+ {
+ if (empty($this->alias))
+ {
+ $this->alias = $this->name;
+ }
+
+ $this->alias = JApplication::stringURLSafe($this->alias);
+
+ if (trim(str_replace('-', '', $this->alias)) == '')
+ {
+ $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s");
+ }
+
+ return $this->alias;
+ }
+
+}
diff --git a/admin/views/custom_code/view.html.php b/admin/views/custom_code/view.html.php
index 398f5b53d..e5ad0d942 100644
--- a/admin/views/custom_code/view.html.php
+++ b/admin/views/custom_code/view.html.php
@@ -208,6 +208,9 @@ class ComponentbuilderViewCustom_code extends JViewLegacy
$this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/uikit.min.js' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
$this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/lightbox.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true);
$this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true);
+ // need to add some language strings
+ JText::script('COM_COMPONENTBUILDER_FUNCTION_NAME_ALREADY_TAKEN_PLEASE_TRY_AGAIN');
+ JText::script('COM_COMPONENTBUILDER_YOU_MUST_ADD_AN_UNIQUE_FUNCTION_NAME');
JText::script('view not acceptable. Error');
}
}
diff --git a/admin/views/field/tmpl/edit.php b/admin/views/field/tmpl/edit.php
index 031a2f9a2..1a68d6621 100644
--- a/admin/views/field/tmpl/edit.php
+++ b/admin/views/field/tmpl/edit.php
@@ -294,9 +294,13 @@ jQuery('#adminForm').on('change', '#jform_add_javascript_views_footer',function
jQuery(function() {
- jQuery("code").click(function() {
- jQuery(this).selText().addClass("selected");
- });
+ setTimeout(
+ function() {
+ // load the on click event
+ jQuery("code").click(function() {
+ jQuery(this).selText().addClass("selected");
+ });
+ }, 2000);
});
jQuery.fn.selText = function() {
diff --git a/admin/views/layout/view.html.php b/admin/views/layout/view.html.php
index 99074acda..b40760787 100644
--- a/admin/views/layout/view.html.php
+++ b/admin/views/layout/view.html.php
@@ -198,7 +198,16 @@ class ComponentbuilderViewLayout extends JViewLegacy
// Add Ajax Token
$this->document->addScriptDeclaration("var token = '".JSession::getFormToken()."';");
$this->document->addScript(JURI::root() . $this->script, (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
- $this->document->addScript(JURI::root() . "administrator/components/com_componentbuilder/views/layout/submitbutton.js", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
+ $this->document->addScript(JURI::root() . "administrator/components/com_componentbuilder/views/layout/submitbutton.js", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
+
+ // add the Uikit v2 style sheets
+ $this->document->addStyleSheet( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/uikit.gradient.min.css' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
+ $this->document->addStyleSheet( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/components/notify.gradient.min.css' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
+
+ // add Uikit v2 JavaScripts
+ $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/uikit.min.js' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
+ $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/lightbox.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true);
+ $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true);
JText::script('view not acceptable. Error');
}
}
diff --git a/admin/views/template/view.html.php b/admin/views/template/view.html.php
index 86aa26c8d..b6530d026 100644
--- a/admin/views/template/view.html.php
+++ b/admin/views/template/view.html.php
@@ -198,7 +198,16 @@ class ComponentbuilderViewTemplate extends JViewLegacy
// Add Ajax Token
$this->document->addScriptDeclaration("var token = '".JSession::getFormToken()."';");
$this->document->addScript(JURI::root() . $this->script, (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
- $this->document->addScript(JURI::root() . "administrator/components/com_componentbuilder/views/template/submitbutton.js", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
+ $this->document->addScript(JURI::root() . "administrator/components/com_componentbuilder/views/template/submitbutton.js", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
+
+ // add the Uikit v2 style sheets
+ $this->document->addStyleSheet( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/uikit.gradient.min.css' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
+ $this->document->addStyleSheet( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/components/notify.gradient.min.css' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
+
+ // add Uikit v2 JavaScripts
+ $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/uikit.min.js' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
+ $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/lightbox.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true);
+ $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true);
JText::script('view not acceptable. Error');
}
}
diff --git a/admin/views/validation_rule/submitbutton.js b/admin/views/validation_rule/submitbutton.js
new file mode 100644
index 000000000..2ad2ca4e3
--- /dev/null
+++ b/admin/views/validation_rule/submitbutton.js
@@ -0,0 +1,49 @@
+/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
+ __ __ _ _____ _ _ __ __ _ _ _
+ \ \ / / | | | __ \ | | | | | \/ | | | | | | |
+ \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
+ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
+ \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
+ \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
+ | |
+ |_|
+/-------------------------------------------------------------------------------------------------------------------------------/
+
+ @version 2.7.x
+ @created 30th April, 2015
+ @package Component Builder
+ @subpackage submitbutton.js
+ @author Llewellyn van der Merwe
+ @github Joomla Component Builder
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Builds Complex Joomla Components
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+Joomla.submitbutton = function(task)
+{
+ if (task == ''){
+ return false;
+ } else {
+ var isValid=true;
+ var action = task.split('.');
+ if (action[1] != 'cancel' && action[1] != 'close'){
+ var forms = $$('form.form-validate');
+ for (var i=0;i
+ @github Joomla Component Builder
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Builds Complex Joomla Components
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+defined('_JEXEC') or die('Restricted access');
+
+JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
+JHtml::_('behavior.tooltip');
+JHtml::_('behavior.formvalidation');
+JHtml::_('formbehavior.chosen', 'select');
+JHtml::_('behavior.keepalive');
+$componentParams = JComponentHelper::getParams('com_componentbuilder');
+?>
+
+
+
+
+
+
diff --git a/admin/views/validation_rule/tmpl/index.html b/admin/views/validation_rule/tmpl/index.html
new file mode 100644
index 000000000..fa6d84e80
--- /dev/null
+++ b/admin/views/validation_rule/tmpl/index.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/admin/views/validation_rule/view.html.php b/admin/views/validation_rule/view.html.php
new file mode 100644
index 000000000..2e928a948
--- /dev/null
+++ b/admin/views/validation_rule/view.html.php
@@ -0,0 +1,218 @@
+
+ @github Joomla Component Builder
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Builds Complex Joomla Components
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+defined('_JEXEC') or die('Restricted access');
+
+// import Joomla view library
+jimport('joomla.application.component.view');
+
+/**
+ * Validation_rule View class
+ */
+class ComponentbuilderViewValidation_rule extends JViewLegacy
+{
+ /**
+ * display method of View
+ * @return void
+ */
+ public function display($tpl = null)
+ {
+ // Assign the variables
+ $this->form = $this->get('Form');
+ $this->item = $this->get('Item');
+ $this->script = $this->get('Script');
+ $this->state = $this->get('State');
+ // get action permissions
+ $this->canDo = ComponentbuilderHelper::getActions('validation_rule',$this->item);
+ // get input
+ $jinput = JFactory::getApplication()->input;
+ $this->ref = $jinput->get('ref', 0, 'word');
+ $this->refid = $jinput->get('refid', 0, 'int');
+ $this->referral = '';
+ if ($this->refid)
+ {
+ // return to the item that refered to this item
+ $this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid;
+ }
+ elseif($this->ref)
+ {
+ // return to the list view that refered to this item
+ $this->referral = '&ref='.(string)$this->ref;
+ }
+
+ // Set the toolbar
+ $this->addToolBar();
+
+ // Check for errors.
+ if (count($errors = $this->get('Errors')))
+ {
+ throw new Exception(implode("\n", $errors), 500);
+ }
+
+ // Display the template
+ parent::display($tpl);
+
+ // Set the document
+ $this->setDocument();
+ }
+
+
+ /**
+ * Setting the toolbar
+ */
+ protected function addToolBar()
+ {
+ JFactory::getApplication()->input->set('hidemainmenu', true);
+ $user = JFactory::getUser();
+ $userId = $user->id;
+ $isNew = $this->item->id == 0;
+
+ JToolbarHelper::title( JText::_($isNew ? 'COM_COMPONENTBUILDER_VALIDATION_RULE_NEW' : 'COM_COMPONENTBUILDER_VALIDATION_RULE_EDIT'), 'pencil-2 article-add');
+ // Built the actions for new and existing records.
+ if ($this->refid || $this->ref)
+ {
+ if ($this->canDo->get('validation_rule.create') && $isNew)
+ {
+ // We can create the record.
+ JToolBarHelper::save('validation_rule.save', 'JTOOLBAR_SAVE');
+ }
+ elseif ($this->canDo->get('validation_rule.edit'))
+ {
+ // We can save the record.
+ JToolBarHelper::save('validation_rule.save', 'JTOOLBAR_SAVE');
+ }
+ if ($isNew)
+ {
+ // Do not creat but cancel.
+ JToolBarHelper::cancel('validation_rule.cancel', 'JTOOLBAR_CANCEL');
+ }
+ else
+ {
+ // We can close it.
+ JToolBarHelper::cancel('validation_rule.cancel', 'JTOOLBAR_CLOSE');
+ }
+ }
+ else
+ {
+ if ($isNew)
+ {
+ // For new records, check the create permission.
+ if ($this->canDo->get('validation_rule.create'))
+ {
+ JToolBarHelper::apply('validation_rule.apply', 'JTOOLBAR_APPLY');
+ JToolBarHelper::save('validation_rule.save', 'JTOOLBAR_SAVE');
+ JToolBarHelper::custom('validation_rule.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
+ };
+ JToolBarHelper::cancel('validation_rule.cancel', 'JTOOLBAR_CANCEL');
+ }
+ else
+ {
+ if ($this->canDo->get('validation_rule.edit'))
+ {
+ // We can save the new record
+ JToolBarHelper::apply('validation_rule.apply', 'JTOOLBAR_APPLY');
+ JToolBarHelper::save('validation_rule.save', 'JTOOLBAR_SAVE');
+ // We can save this record, but check the create permission to see
+ // if we can return to make a new one.
+ if ($this->canDo->get('validation_rule.create'))
+ {
+ JToolBarHelper::custom('validation_rule.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
+ }
+ }
+ $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('validation_rule.version'));
+ if ($this->state->params->get('save_history', 1) && $this->canDo->get('validation_rule.edit') && $canVersion)
+ {
+ JToolbarHelper::versions('com_componentbuilder.validation_rule', $this->item->id);
+ }
+ if ($this->canDo->get('validation_rule.create'))
+ {
+ JToolBarHelper::custom('validation_rule.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
+ }
+ JToolBarHelper::cancel('validation_rule.cancel', 'JTOOLBAR_CLOSE');
+ }
+ }
+ JToolbarHelper::divider();
+ // set help url for this view if found
+ $help_url = ComponentbuilderHelper::getHelpUrl('validation_rule');
+ if (ComponentbuilderHelper::checkString($help_url))
+ {
+ JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url);
+ }
+ }
+
+ /**
+ * Escapes a value for output in a view script.
+ *
+ * @param mixed $var The output to escape.
+ *
+ * @return mixed The escaped value.
+ */
+ public function escape($var)
+ {
+ if(strlen($var) > 30)
+ {
+ // use the helper htmlEscape method instead and shorten the string
+ return ComponentbuilderHelper::htmlEscape($var, $this->_charset, true, 30);
+ }
+ // use the helper htmlEscape method instead.
+ return ComponentbuilderHelper::htmlEscape($var, $this->_charset);
+ }
+
+ /**
+ * Method to set up the document properties
+ *
+ * @return void
+ */
+ protected function setDocument()
+ {
+ $isNew = ($this->item->id < 1);
+ if (!isset($this->document))
+ {
+ $this->document = JFactory::getDocument();
+ }
+ $this->document->setTitle(JText::_($isNew ? 'COM_COMPONENTBUILDER_VALIDATION_RULE_NEW' : 'COM_COMPONENTBUILDER_VALIDATION_RULE_EDIT'));
+ $this->document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/validation_rule.css", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
+ // Add Ajax Token
+ $this->document->addScriptDeclaration("var token = '".JSession::getFormToken()."';");
+ $this->document->addScript(JURI::root() . $this->script, (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
+ $this->document->addScript(JURI::root() . "administrator/components/com_componentbuilder/views/validation_rule/submitbutton.js", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
+
+ // add the Uikit v2 style sheets
+ $this->document->addStyleSheet( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/uikit.gradient.min.css' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
+ $this->document->addStyleSheet( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/components/notify.gradient.min.css' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
+
+ // add Uikit v2 JavaScripts
+ $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/uikit.min.js' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
+ $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/lightbox.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true);
+ $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true);
+ // add var key
+ $this->document->addScriptDeclaration("var vastDevMod = '".$this->get('VDM')."';");
+ // need to add some language strings
+ JText::script('COM_COMPONENTBUILDER_VALIDATION_RULE_NAME_ALREADY_TAKEN_PLEASE_TRY_AGAIN');
+ JText::script('COM_COMPONENTBUILDER_YOU_MUST_ADD_AN_UNIQUE_VALIDATION_RULE_NAME');
+ JText::script('view not acceptable. Error');
+ }
+}
diff --git a/admin/views/validation_rules/index.html b/admin/views/validation_rules/index.html
new file mode 100644
index 000000000..fa6d84e80
--- /dev/null
+++ b/admin/views/validation_rules/index.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/admin/views/validation_rules/tmpl/default.php b/admin/views/validation_rules/tmpl/default.php
new file mode 100644
index 000000000..a3ae84f9a
--- /dev/null
+++ b/admin/views/validation_rules/tmpl/default.php
@@ -0,0 +1,99 @@
+
+ @github Joomla Component Builder
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Builds Complex Joomla Components
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+defined('_JEXEC') or die('Restricted access');
+
+// load tooltip behavior
+JHtml::_('behavior.tooltip');
+JHtml::_('behavior.multiselect');
+JHtml::_('dropdown.init');
+JHtml::_('formbehavior.chosen', 'select');
+
+if ($this->saveOrder)
+{
+ $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=validation_rules.saveOrderAjax&tmpl=component';
+ JHtml::_('sortablelist.sortable', 'validation_ruleList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl);
+}
+
+?>
+
+