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
3 changes: 2 additions & 1 deletion modules/formulize/admin/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,6 @@
}
}


$i = 1;
$applications = array();
foreach($allApps as $thisApp) {
Expand Down Expand Up @@ -538,6 +537,8 @@
if (count($customElements)>0) {
$adminPage['tabs'][$i]['content']['customElements'] = $customElements;
}
$allElements = createFieldList("", true, false, "", "List of All Elements");
$adminPage['tabs'][$i]['content']['allElements'] = $allElements->render();
$i++;
}

Expand Down
13 changes: 8 additions & 5 deletions modules/formulize/admin/formindex.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ function patch40() {
*
* ====================================== */

$checkThisTable = 'formulize_apikeys';
$checkThisField = false;
$checkThisTable = 'formulize';
$checkThisField = 'ele_parent_id';
$checkThisProperty = false;
$checkPropertyForValue = false;

Expand Down Expand Up @@ -294,7 +294,7 @@ function patch40() {
INDEX i_sid (`sid`)
) ENGINE=MyISAM;";
}

if (!in_array($xoopsDB->prefix("formulize_apikeys"), $existingTables)) {
$sql[] = "CREATE TABLE " . $xoopsDB->prefix("formulize_apikeys") . " (
`key_id` int(11) unsigned NOT NULL auto_increment,
Expand All @@ -306,7 +306,7 @@ function patch40() {
INDEX i_apikey (apikey),
INDEX i_expiry (expiry)
) ENGINE=MyISAM;";
}
}

// if this is a standalone installation, then we want to make sure the session id field in the DB is large enough to store whatever session id we might be working with
if (file_exists(XOOPS_ROOT_PATH."/integration_api.php")) {
Expand Down Expand Up @@ -356,7 +356,8 @@ function patch40() {
$sql['add_pubfilters'] = "ALTER TABLE " . $xoopsDB->prefix("formulize_saved_views") . " ADD `sv_pubfilters` text";
$sql['add_backdrop_group'] = "ALTER TABLE " . $xoopsDB->prefix("formulize_resource_mapping") . " ADD external_id_string text NULL default NULL";
$sql['add_backdrop_group_index'] = "ALTER TABLE ". $xoopsDB->prefix("formulize_resource_mapping") ." ADD INDEX i_external_id_string (external_id_string(10))";

$sql['add_ele_parent_id'] = "ALTER TABLE ". $xoopsDB->prefix("formulize") ." ADD ele_parent_id smallint(5) unsigned NOT NULL default '0'";

foreach($sql as $key=>$thissql) {
if (!$result = $xoopsDB->query($thissql)) {
if ($key === "add_encrypt") {
Expand Down Expand Up @@ -415,6 +416,8 @@ function patch40() {
print "External_id_string already added for resource mapping. result: OK<br>";
} elseif(strstr($key, 'add_backdrop_group_index')) {
print "External_id_string INDEX already added for resource mapping. result: OK<br>";
} elseif($key == "add_ele_parent_id") {
print "Parent ID for element already added for linking elements. result: OK<br>";
} else {
exit("Error patching DB for Formulize 4.0. SQL dump:<br>" . $thissql . "<br>".$xoopsDB->error()."<br>Please contact <a href=mailto:info@formulize.org>info@formulize.org</a> for assistance.");
}
Expand Down
49 changes: 42 additions & 7 deletions modules/formulize/admin/save/form_elements_save.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
foreach($processedElements[$ele_id] as $property=>$value) {
$element->setVar($property,$value);
}

// if there was no display property sent, and there was no custom flag sent, then blank the display settings
if(!isset($processedElements[$ele_id]['ele_display']) AND !isset($_POST['customDisplayFlag'][$ele_id])) {
$element->setVar('ele_display',0);
Expand Down Expand Up @@ -118,7 +118,7 @@
$element->setVar('ele_type', "textarea");
if( !$element_handler->insert($element)) {
print "Error: could not complete conversion of the element";
}
}
} elseif($ele_type=="textarea") {
$ele_value = $element->getVar('ele_value');
$new_ele_value[0] = $ele_value[2]; // cols become width
Expand All @@ -130,7 +130,7 @@
$element->setVar('ele_type', "text");
if( !$element_handler->insert($element)) {
print "Error: could not complete conversion of the element";
}
}
} elseif($ele_type=="radio") {
$element->setVar('ele_type', "checkbox"); // just need to change type, ele_value format is the same
if( !$element_handler->insert($element)) {
Expand All @@ -140,7 +140,7 @@
$data_handler = new formulizeDataHandler($element->getVar('id_form'));
if(!$data_handler->convertRadioDataToCheckbox($element)) {
print "Error: ". _AM_ELE_CHECKBOX_DATA_NOT_READY;
}
}
}
} elseif($ele_type=="checkbox") {
$element->setVar('ele_type', "radio"); // just need to change type, ele_value format is the same
Expand All @@ -151,7 +151,7 @@
$data_handler = new formulizeDataHandler($element->getVar('id_form'));
if(!$data_handler->convertCheckboxDataToRadio($element)) {
print "Error: "._AM_ELE_RADIO_DATA_NOT_READY;
}
}
}
} elseif($ele_type=="select") {
$element->setVar('ele_type', 'checkbox');
Expand All @@ -175,15 +175,17 @@
print "Error: could not complete conversion of the element";
}
}
// TODO: ANISHA - if element has children/parents, convert them too
}

if($_POST['deleteelement']) {
$element = $element_handler->get($_POST['deleteelement']);
$ele_type = $element->getVar('ele_type');
$element_handler->delete($element);
if($ele_type != "areamodif" AND $ele_type != "ib" AND $ele_type != "sep" AND $ele_type != "subform" AND $ele_type != "grid") {
$element_handler->deleteData($element); //added aug 14 2005 by jwe
$element_handler->deleteData($element); //added aug 14 2005 by jwe
}
// TODO: ANISHA - if element has children, unlink children?
}

if($_POST['cloneelement']) {
Expand Down Expand Up @@ -212,10 +214,43 @@
$fieldStateData = $xoopsDB->fetchArray($fieldStateRes);
$dataType = $fieldStateData['Type'];
}
$form_handler->insertElementField($thisElementObject, $dataType);
$form_handler->insertElementField($thisElementObject, $dataType);
print "/* eval */ window.location = '".XOOPS_URL."/modules/formulize/admin/ui.php?page=element&ele_id=$ele_id&aid=".intval($_POST['aid'])."';";
}

if($_POST['linkedelement']) {
global $xoopsDB;

$old_ele_id = $_POST['linkedelement'];
$thisElementObject = $element_handler->get($_POST['linkedelement']);
$thisElementObject->setVar('ele_id', 0);
$thisElementObject->setVar('id_form', $fid);

$parent_id = $thisElementObject->getVar('ele_parent_id');
if ($parent_id == 0) {
$thisElementObject->setVar('ele_parent_id', $old_ele_id);
$parent_id = $thisElementObject->getVar('ele_parent_id');
}

$sql = "SELECT max(ele_order) as new_order FROM ".$xoopsDB->prefix("formulize")." WHERE id_form = $fid";
$res = $xoopsDB->query($sql);
$array = $xoopsDB->fetchArray($res);
$thisElementObject->setVar('ele_order', $array['new_order'] + 1);

$element_handler->insert($thisElementObject);
$ele_id = $thisElementObject->getVar('ele_id');
$fieldStateSQL = "SHOW COLUMNS FROM " . $xoopsDB->prefix("formulize_" . $thisElementObject->getVar('form_handle')) ." LIKE '$oldHandle'"; // note very odd use of LIKE as a clause of its own in SHOW statements, very strange, but that's what MySQL does
if(!$fieldStateRes = $xoopsDB->query($fieldStateSQL)) {
$dataType = "text";
} else {
$fieldStateData = $xoopsDB->fetchArray($fieldStateRes);
$dataType = $fieldStateData['Type'];
}
$form_handler->insertElementField($thisElementObject, $dataType);

print "/* eval */ window.location = '".XOOPS_URL."/modules/formulize/admin/ui.php?page=element&parent_id=$parent_id&ele_id=$ele_id&aid=".intval($_POST['aid'])."';";
}

if($_POST['reload_elements']) {
print "/* eval */ reloadWithScrollPosition();";
}
Expand Down
Loading