Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add/edit menu item broken for types "custom page" and "custom block" #84

Open
deepend-tildeclub opened this issue Mar 3, 2022 · 5 comments
Labels
bug-v4 Bugs that appear in the original scripts.

Comments

@deepend-tildeclub
Copy link
Contributor

The errors I get in debug mode are:

Notice: Undefined index: menucategory in /home/mysite/public_html/site/members/include/admin/managemenu/edit_item.php on line 139

Notice: Undefined index: sectioninfo in /home/mysite/public_html/site/members/include/admin/managemenu/edit_item.php on line 182

Notice: Trying to access array offset on value of type null in /home/mysite/public_html/site/members/include/admin/managemenu/edit_item.php on line 278

Notice: Trying to access array offset on value of type null in /home/mysite/public_html/site/members/include/admin/managemenu/edit_item.php on line 279

Notice: Trying to access array offset on value of type null in /home/mysite/public_html/site/members/include/admin/managemenu/edit_item.php on line 280

Notice: Trying to access array offset on value of type null in /home/mysite/public_html/site/members/include/admin/managemenu/edit_item.php on line 281

Notice: Undefined index: itemname in /home/mysite/public_html/site/members/include/admin/managemenu/edit_item.php on line 525

The issue I'm having is for example if I am adding a menu item of the "custom page" item type and then I select the page I want the link to be from the other drop down menu.. It always saves as if I selected the middle option. (there are currently 3 options on my custom page drop down).

Similar issue when selecting other menu options as well.. Like "custom block" doesn't save whatever you enter as the code you want.

Not sure which of those errors is most likely to cause the issues or if a few of them are.

@RedDragonWebDesign RedDragonWebDesign added the bug-v4 Bugs that appear in the original scripts. label Mar 3, 2022
@RedDragonWebDesign RedDragonWebDesign changed the title add/edit menu item broken add/edit menu item broken for types "custom page" and "custom block" Mar 3, 2022
@RedDragonWebDesign
Copy link
Owner

RedDragonWebDesign commented Mar 3, 2022

This page has never worked correctly. It just displayed blank in BlueThrust4 before I began my modifications. With my modifications, I got the page to display and I got links working, but I didn't test and fix these other types.

After an hour or two of debugging, it appears the form is not writing some of its data to the database.

image

To be continued...

@RedDragonWebDesign RedDragonWebDesign added bug-v5 Bugs that do not appear in the original scripts, but that are now in v5. and removed bug-v4 Bugs that appear in the original scripts. labels Mar 3, 2022
@RedDragonWebDesign
Copy link
Owner

RedDragonWebDesign commented Mar 6, 2022

There's a form verification function that is returning true

function validateMenuItem_CustomPageTypes($pageName, &$formComponents) {
if($_POST['itemtype'] != $pageName) { return false; }
global $formObj, $menuItemObj;
$textAlign = "textalign_".$pageName;
$targetWindow = "targetwindow_".$pageName;
$formComponents[$pageName]['validate'] = array("RESTRICT_TO_OPTIONS");
$formComponents[$textAlign]['validate'] = array("RESTRICT_TO_OPTIONS");
$formComponents[$targetWindow]['validate'] = array("RESTRICT_TO_OPTIONS");
$setupFormArgs = array(
"name" => "console-".$cID."-".$pageName,
"components" => $formComponents
);
$localFormObj = new Form($setupFormArgs);
if(!$localFormObj->validate()) {
$formObj->errors = array_merge($formObj->errors, $localFormObj->errors);
}
}

and a write to the database function

function saveMenuItem(&$menuComponents, &$saveObj, $arrDBNames, $dbID, $itemType, $saveAdditionalArgs=array(), $saveType="add") {
if($_POST['itemtype'] != $itemType) { return false; }
global $formObj, $menuItemObj;
foreach($arrDBNames as $componentName => $dbName) {
$menuComponents[$componentName]['db_name'] = $dbName;
}
$saveAdditional = array("menuitem_id" => $menuItemObj->get_info("menuitem_id"));
$setupFormArgs = array(
"name" => "console-".$cID."-".$itemType,
"components" => $menuComponents,
"saveObject" => $saveObj,
"saveType" => $saveType,
"saveAdditional" => array_merge($saveAdditional, $saveAdditionalArgs)
);
$localFormObj = new Form($setupFormArgs);
$localFormObj->save();
$menuItemObj->update(array("itemtype_id"), array($saveObj->get_info($dbID)));
}

and also the form itself

array(
"function" => "saveMenuItem",
"args" => array(
&$customPageOptionComponents,
&$menuItemObj->objCustomPage,
array( "custompage" => "custompage_id",
"targetwindow_custompage" => "linktarget",
"textalign_custompage" => "textalign",
"prefix_custompage" => "prefix"),
"menucustompage_id",
"custompage"
)
),

The bug is likely in one of these locations. Next step is to start wrapping my head around how these work.

Test case I was using:

image

@Setman59
Copy link

Did this ever get fixed? I tried to install but still can't make a page.

Thanks in advance

@RedDragonWebDesign RedDragonWebDesign added bug-v4 Bugs that appear in the original scripts. and removed bug-v5 Bugs that do not appear in the original scripts, but that are now in v5. labels Jan 26, 2024
@deepend-tildeclub
Copy link
Contributor Author

Did this ever get fixed? I tried to install but still can't make a page.

I think with the current master it would let you create the page.. But adding the link to the menu is not working as far as I know.

@deepend-tildeclub
Copy link
Contributor Author

I want to do a big run to figure out all the menu item issues. But not sure where to look since there is so many files relating to how this menu system works. Guess I could just go through each file and find syntax issues or stuff like that maybe to start. But the menu system is one of the main things holding this software back at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-v4 Bugs that appear in the original scripts.
Projects
None yet
Development

No branches or pull requests

3 participants