boolean userSettingsProcessForm(struct userSettings *us)
/* Handle button press in userSettings form. 
 * If this returns TRUE then form is finished processing 
 * and you can call something to make the next page. */
{
struct cart *cart = us->cart;
char *command = cartString(cart, us->formVar);
boolean retVal = TRUE;
char *name = cartNonemptyString(cart, us->nameVar);

command = trimSpaces(command);
if (sameWord(command, "save") && name != NULL)
    {
    char *varName = settingsVarName(us->savePrefix, name);
    saveSettings(us, varName);
    freez(&varName);
    }
else if (startsWith(command, "load") && name != NULL)
    {
    userSettingsUseSelected(us);
    }
else if (startsWith("delete", command))
    {
    char *which = cartOptionalString(cart, us->listDisplayVar);
    if (which != NULL)
        {
	char *varName = settingsVarName(us->savePrefix, which);
	cartRemove(cart, varName);
	userSettingsSaveForm(us);
	retVal = FALSE;
	}
    }
cartRemove(cart, us->formVar);
return retVal;
}
Beispiel #2
0
void doNameCurrentFilters()
/* Put up page to save current filter settings. */
{
userSettingsSaveForm(filUserSettings());
}