Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libraries/icms/form/elements/Password.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public function render() {
. "' id='" . $ele_name
. "' size='" . $this->getSize()
. "' maxlength='" . $this->getMaxlength()
. "' aria-describedby='" . $this->getName() . "-help-text'"
. "' aria-describedby='" . $this->getName() . "-help-text"
. "' value='" . $this->getValue() . "'" . $this->getExtra() . " " . ($this->autoComplete ? "" : "autocomplete='off' ")
. "/>";
}
Expand Down
4 changes: 2 additions & 2 deletions libraries/icms/form/elements/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class icms_form_elements_Text extends icms_form_Element {
* @param int $size Size
* @param int $maxlength Maximum length of text
* @param string $value Initial text
* @param bool $autocomplete Whether to use autocomplete functionality in browser. Seems to have no effect in render method.
* @param bool $autocomplete Whether to use autocomplete functionality in browser.
* @param mixed $type Either 'text', 'number', or 'time'.
*/
public function __construct($caption, $name, $size, $maxlength, $value = '', $autocomplete = false, $type = 'text') {
Expand Down Expand Up @@ -130,7 +130,7 @@ public function render() {
. "' size='" . $this->getSize()
. "' maxlength='" . $this->getMaxlength()
. "' aria-describedby='" . $this->getName() . "-help-text"
. "' value='" . $this->getValue() . "'" . $this->getExtra()
. "' value='" . $this->getValue() . "'" . $this->getExtra() . " " . ($this->autoComplete ? "" : "autocomplete='off' ")
. " />";
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
$configSync = new FormulizeConfigSync('/config');
$diff = $configSync->compareConfigurations();

$adminPage['template'] = "db:admin/config-sync.html";
$adminPage['home_tabs'] = getHomeTabs('config-sync');
$adminPage['success'] = [];
$adminPage['failure'] = [];

Expand Down
18 changes: 11 additions & 7 deletions modules/formulize/admin/element.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@
$common['type'] = $ele_type;
$common['typeIsSelect'] = anySelectElementType($ele_type);
$common['uid'] = $xoopsUser->getVar('uid');
$common['isSystemElement'] = $elementObject ? $elementObject->isSystemElement : false;
$common['isUserAccountElement'] = ($elementObject AND substr($elementObject->getVar('ele_type'), 0, 11) == 'userAccount' AND $elementObject->isSystemElement) ? true : false;

$options = array();
$options['ele_delim'] = $ele_delim;
Expand Down Expand Up @@ -308,12 +310,14 @@
$adminPage['tabs'][$tabindex]['template'] = "db:admin/element_names.html";
$adminPage['tabs'][$tabindex]['content'] = $names+$common;

$adminPage['tabs'][++$tabindex]['name'] = "Options";
$adminPage['tabs'][$tabindex]['template'] = "db:admin/element_options.html";
if (count((array) $customValues)>0) {
$adminPage['tabs'][$tabindex]['content'] = $customValues + $options + $common;
} else {
$adminPage['tabs'][$tabindex]['content'] = $options + $common;
if(!$elementObject OR $elementObject->isSystemElement == false OR $ele_type == 'userAccountPhone') {
$adminPage['tabs'][++$tabindex]['name'] = "Options";
$adminPage['tabs'][$tabindex]['template'] = "db:admin/element_options.html";
if (count((array) $customValues)>0) {
$adminPage['tabs'][$tabindex]['content'] = $customValues + $options + $common;
} else {
$adminPage['tabs'][$tabindex]['content'] = $options + $common;
}
}

$adminPage['tabs'][++$tabindex]['name'] = _AM_ELE_DISPLAYSETTINGS;
Expand All @@ -331,7 +335,7 @@
}


if ($advanced['datatypeui'] OR $advanced['ele_encrypt_show']) {
if ($elementObject->isSystemElement == false AND ($advanced['datatypeui'] OR $advanced['ele_encrypt_show'])) {
$adminPage['tabs'][++$tabindex]['name'] = "Advanced";
$adminPage['tabs'][$tabindex]['template'] = "db:admin/element_advanced.html";
$adminPage['tabs'][$tabindex]['content'] = $advanced + $common + $advancedCustomValues;
Expand Down
28 changes: 27 additions & 1 deletion modules/formulize/admin/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
$send_digests = $formObject->getVar('send_digests');
$defaultpi = $formObject->getVar('pi');
$pioptions = array();
$entries_are_users = $formObject->getVar('entries_are_users');
$entries_are_groups = $formObject->getVar('entries_are_groups');

$framework_handler = xoops_getmodulehandler('frameworks', 'formulize');
$connections = $framework_handler->formatFrameworksAsRelationships(null, $fid);
Expand All @@ -82,7 +84,6 @@
$i = 1;
$elementsInRelationshipLinks = getElementsInRelationshipLinks($elementObjects);
foreach($elementObjects as $thisElement) {
if($thisElement->isSystemElement) { continue; }
$elementCaption = trans(strip_tags($thisElement->getVar('ele_caption')));
$colhead = trans(strip_tags($thisElement->getVar('ele_colhead')));
$cleanType = convertTypeToText($thisElement->getVar('ele_type'), $thisElement->getVar('ele_value'));
Expand Down Expand Up @@ -124,6 +125,7 @@
$converttext = "";
$linktype = "";
}
$elements[$i]['content']['isSystemElement'] = $thisElement->isSystemElement;
$elements[$i]['content']['converttext'] = $converttext;
$elements[$i]['content']['linktype'] = $linktype;
$elements[$i]['content']['ele_type'] = $cleanType;
Expand Down Expand Up @@ -465,6 +467,8 @@
$send_digests = 0;
$defaultpi = 0;
$pioptions = array();
$entries_are_users = 0;
$entries_are_groups = 0;
if ($_GET['aid']) {
$formApplications = array(intval($_GET['aid']));
}
Expand Down Expand Up @@ -584,7 +588,29 @@
$settings['store_revisions'] = $store_revisions;
$settings['revisionsDisabled'] = formulizeRevisionsForAllFormsIsOn() ? 'disabled="disabled"' : '';
$settings['istableform'] = ($tableform OR $newtableform) ? true : false;
$settings['entries_are_users'] = $entries_are_users;
$settings['entries_are_groups'] = $entries_are_groups;
$settings['connections'] = $connections[0]['content']; // 0 will be first, ie: primary, relationship. 'content' for that will include all the links, which is what template looks for

// Check if we should show the user mapping UI
// Default to true, and only set to false if conditions indicate we shouldn't show it
$settings['show_user_mapping_ui'] = true;
if($fid != "new" && $entries_are_users == 1) {
// The user account uid element has the handle formulize_user_account_uid_X where X is the form id
$userAccountUidHandle = 'formulize_user_account_uid_' . $fid;

// Single query to check: total entries, and max value in the user account uid field
$checkSql = "SELECT COUNT(*) as total_entries, MAX(`" . $userAccountUidHandle . "`) as max_uid FROM " . $xoopsDB->prefix("formulize_" . $form_handle);
$checkResult = $xoopsDB->query($checkSql);
$checkRow = $xoopsDB->fetchArray($checkResult);
$totalEntries = intval($checkRow['total_entries']);
$maxUid = intval($checkRow['max_uid']);

// Hide UI if there are no entries, OR if entries are already associated with users
if($totalEntries == 0 || $maxUid > 0) {
$settings['show_user_mapping_ui'] = false;
}
}
if (isset($groupsCanEditOptions)) {
$settings['groupsCanEditOptions'] = $groupsCanEditOptions;
$settings['groupsCanEditDefaults'] = $groupsCanEditDefaults;
Expand Down
10 changes: 7 additions & 3 deletions modules/formulize/admin/formindex.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ function patch40() {
*
* IT IS ALSO CRITICAL THAT THE PATCH PROCESS CAN BE RUN OVER AND OVER AGAIN NON-DESTRUCTIVELY */

$checkThisTable = 'formulize';
$checkThisField = 'ele_dynamicdefault_source';
$checkThisTable = 'formulize_id';
$checkThisField = 'entries_are_users';
$checkThisProperty = '';
$checkPropertyForValue = '';

Expand Down Expand Up @@ -513,6 +513,8 @@ function patch40() {
$sql['add_form_top'] = "ALTER TABLE ".$xoopsDB->prefix("formulize_application_form_link"). " ADD `top` varchar(255) NOT NULL default ''";
$sql['add_form_left'] = "ALTER TABLE ".$xoopsDB->prefix("formulize_application_form_link"). " ADD `left` varchar(255) NOT NULL default ''";
$sql['add_pi'] = "ALTER TABLE ".$xoopsDB->prefix("formulize_id"). " ADD `pi` int(5) NOT NULL default 0";
$sql['add_entries_are_users'] = "ALTER TABLE ".$xoopsDB->prefix("formulize_id"). " ADD `entries_are_users` tinyint(1) NOT NULL default 0";
$sql['add_entries_are_groups'] = "ALTER TABLE ".$xoopsDB->prefix("formulize_id"). " ADD `entries_are_groups` tinyint(1) NOT NULL default 0";
$sql['sv_mainform_to_int'] = "ALTER TABLE ".$xoopsDB->prefix("formulize_saved_views"). " CHANGE `sv_mainform` `sv_mainform` int(5) default NULL";
$sql['sv_formframe_to_int'] = "ALTER TABLE ".$xoopsDB->prefix("formulize_saved_views"). " CHANGE `sv_formframe` `sv_formframe` int(5) default NULL";
$sql['form_title'] = "ALTER TABLE ".$xoopsDB->prefix("formulize_id"). " CHANGE `desc_form` `form_title` varchar(255) NOT NULL default ''";
Expand Down Expand Up @@ -665,7 +667,9 @@ function patch40() {
print "Element required already renamed. result: OK<br>";
} elseif($key === "add_dynamicdefault_source" OR $key === "add_dynamicdefault_conditions") {
print "Dynamic defaults already added. result: OK<br>";
}else {
} elseif($key === "add_entries_are_users" OR $key === "add_entries_are_groups") {
print "Entries-are-users/groups options already added. result: OK<br>";
} else {
exit("Error patching DB for Formulize $versionNumber. SQL dump:<br>" . $thissql . "<br>".$xoopsDB->error()."<br>Please contact <a href=mailto:info@formulize.org>info@formulize.org</a> for assistance.");
}
} elseif($key === "on_delete") {
Expand Down
2 changes: 1 addition & 1 deletion modules/formulize/admin/home.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

$adminPage['showBigFormButton'] = $showBigFormButton;
$adminPage['apps'] = $apps;
$adminPage['template'] = "db:admin/home.html";
$adminPage['home_tabs'] = getHomeTabs('home');
$adminPage['pagetitle'] = "Home";
$adminPage['needsave'] = true;

Expand Down
2 changes: 1 addition & 1 deletion modules/formulize/admin/logviewer.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
}
}

$adminPage['template'] = "db:admin/logviewer.html";
$adminPage['home_tabs'] = getHomeTabs('logviewer');

// Breadcrumb
$breadcrumbtrail[1]['url'] = "page=home";
Expand Down
2 changes: 1 addition & 1 deletion modules/formulize/admin/mailusers.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
$adminPage['groupIds'] = $groupIds;
$adminPage['groupNames'] = $groupNames;
$adminPage['groupListSize'] = count((array) $groupNames) < 25 ? count((array) $groupNames) : 25;
$adminPage['template'] = "db:admin/mailusers.html";
$adminPage['home_tabs'] = getHomeTabs('mailusers');

$breadcrumbtrail[1]['url'] = "page=home";
$breadcrumbtrail[1]['text'] = "Home";
Expand Down
2 changes: 1 addition & 1 deletion modules/formulize/admin/managekeys.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
}

$adminPage['keys'] = $allKeys;
$adminPage['template'] = "db:admin/managekeys.html";
$adminPage['home_tabs'] = getHomeTabs('managekeys');

$breadcrumbtrail[1]['url'] = "page=home";
$breadcrumbtrail[1]['text'] = "Home";
Expand Down
2 changes: 1 addition & 1 deletion modules/formulize/admin/managepermissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
}

$adminPage['groups'] = $groupList;
$adminPage['template'] = "db:admin/managepermissions.html";
$adminPage['home_tabs'] = getHomeTabs('managepermissions');

$breadcrumbtrail[1]['url'] = "page=home";
$breadcrumbtrail[1]['text'] = "Home";
Expand Down
2 changes: 1 addition & 1 deletion modules/formulize/admin/managetokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@

$adminPage['groups'] = $groupList;
$adminPage['keys'] = $allKeys;
$adminPage['template'] = "db:admin/managetokens.html";
$adminPage['home_tabs'] = getHomeTabs('managetokens');

$breadcrumbtrail[1]['url'] = "page=home";
$breadcrumbtrail[1]['text'] = "Home";
Expand Down
65 changes: 33 additions & 32 deletions modules/formulize/admin/save/element_display_save.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@
}
}
$element = $element_handler->get($ele_id);
if($element->isSystemElement) {
exit();
}

$fid = $element->getVar('id_form');

Expand All @@ -63,38 +60,42 @@
return;
}

// do not need to serialize this when assigning, since the elements class calls cleanvars from the xoopsobject on all properties prior to insertion, and that intelligently serializes properties that have been declared as arrays
list($parsedFilterSettings, $filterSettingsChanged) = parseSubmittedConditions('elementfilter', 'display-conditionsdelete');
list($parsedDisabledConditions, $disabledConditionsChanged) = parseSubmittedConditions('disabledconditions', 'disabled-conditionsdelete');
$_POST['reload_element_pages'] = ($filterSettingsChanged OR $disabledConditionsChanged) ? true : false;
$element->setVar('ele_filtersettings', $parsedFilterSettings);
$element->setVar('ele_disabledconditions', $parsedDisabledConditions);
if($element->isSystemElement == false) {

// check that the checkboxes have no values, and if so, set them to "" in the processedValues array
if(!isset($_POST['elements-ele_private'])) {
$processedValues['elements']['ele_private'] = "";
}
foreach($processedValues['elements'] as $property=>$value) {
$element->setVar($property, $value);
}
// do not need to serialize this when assigning, since the elements class calls cleanvars from the xoopsobject on all properties prior to insertion, and that intelligently serializes properties that have been declared as arrays
list($parsedFilterSettings, $filterSettingsChanged) = parseSubmittedConditions('elementfilter', 'display-conditionsdelete');
list($parsedDisabledConditions, $disabledConditionsChanged) = parseSubmittedConditions('disabledconditions', 'disabled-conditionsdelete');
$_POST['reload_element_pages'] = ($filterSettingsChanged OR $disabledConditionsChanged) ? true : false;
$element->setVar('ele_filtersettings', $parsedFilterSettings);
$element->setVar('ele_disabledconditions', $parsedDisabledConditions);

// check that the checkboxes have no values, and if so, set them to "" in the processedValues array
if(!isset($_POST['elements-ele_private'])) {
$processedValues['elements']['ele_private'] = "";
}
foreach($processedValues['elements'] as $property=>$value) {
$element->setVar($property, $value);
}

if($_POST['elements_ele_display'][0] == "all") {
$display = 1;
} else if($_POST['elements_ele_display'][0] == "none") {
$display = 0;
} else {
$display = "," . implode(",", $_POST['elements_ele_display']) . ",";
}
$element->setVar('ele_display', $display);

if($_POST['elements_ele_disabled'][0] == "none") {
$disabled = 0;
} else if($_POST['elements_ele_disabled'][0] == "all"){
$disabled = 1;
} else {
$disabled = "," . implode(",", $_POST['elements_ele_disabled']) . ",";
}
$element->setVar('ele_disabled', $disabled);

if($_POST['elements_ele_display'][0] == "all") {
$display = 1;
} else if($_POST['elements_ele_display'][0] == "none") {
$display = 0;
} else {
$display = "," . implode(",", $_POST['elements_ele_display']) . ",";
}
$element->setVar('ele_display', $display);

if($_POST['elements_ele_disabled'][0] == "none") {
$disabled = 0;
} else if($_POST['elements_ele_disabled'][0] == "all"){
$disabled = 1;
} else {
$disabled = "," . implode(",", $_POST['elements_ele_disabled']) . ",";
}
$element->setVar('ele_disabled', $disabled);

// Saving element existence in multi-paged screens
$screen_handler = xoops_getmodulehandler('multiPageScreen', 'formulize');
Expand Down
16 changes: 12 additions & 4 deletions modules/formulize/admin/save/element_names_save.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@
$original_handle = $element->getVar('ele_handle');
}

if($element->isSystemElement) {
exit();
}
if(isset($_POST['orderpref'])) {
$element->setVar('ele_order', figureOutOrder($_POST['orderpref'], $element->getVar('ele_order'), $fid));
}
Expand All @@ -77,6 +74,17 @@
}

$isNew = $_POST['formulize_admin_key'] == "new" ? true : false;

if(!$isNew
AND ((
$element->getVar('ele_colhead')
AND $element->getVar('ele_colhead') != $processedValues['elements']['ele_colhead']
) OR (
$element->getVar('ele_caption') != $processedValues['elements']['ele_caption']
))) {
$_POST['reload_names_page'] = 1;
}

foreach ($processedValues['elements'] as $property => $element_handle_name) {
$element->setVar($property, $element_handle_name);
}
Expand All @@ -89,7 +97,7 @@
}

$finalHandle = $element->getVar('ele_handle');
if($finalHandle != $processedValues['elements']['ele_handle']) {
if($element->isSystemElement == false AND $finalHandle != $processedValues['elements']['ele_handle']) {
$_POST['reload_names_page'] = 1;
}

Expand Down
4 changes: 1 addition & 3 deletions modules/formulize/admin/save/element_options_save.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@
}
}
$element = $element_handler->get($ele_id);
if($element->isSystemElement) {
exit();
}

$ele_type = $element->getVar('ele_type');
if(file_exists(XOOPS_ROOT_PATH."/modules/formulize/class/".$ele_type."Element.php")) {
$element_handler = xoops_getmodulehandler($ele_type.'Element','formulize');
Expand Down
Loading