{= # # set_and_save_node.cfv # # This is called from the client. It sets and saves the given node(s). # Client parameters # v.fp.main_node_name: The main node name which becomes saved. # v.fp.new_nodes: Arbitrary node name/value pairs to be set and saved. include "templates.util.base_util"; include "templates.util.rbac.rbac_util"; debug_message("\n\n#### before_you_start.cfv \n\n"); string session_id = volatile.session_id; string active_page = v.fp.active_page; string page_token = v.fp.page_token; # debug_message("#### session_id: " . session_id . "\n"); # debug_message("#### page_token: " . page_token . "\n"); if (get_is_valid_page_token(session_id, active_page, page_token)) then ( string main_node_name = v.fp.main_node_name; # Type of main_node is string because node may not yet exist. node main_node; node new_nodes = "v.fp.new_nodes"; if (main_node_name eq "system") then ( main_node = "system"; ) else if (main_node_name eq "users_cache_preferences") then ( string user_node_name = node_name(volatile.authenticated_user_node_path); # Make sure the preferences node exists if (!?("users_cache." . user_node_name . ".preferences")) then ( "users_cache." . user_node_name . ".preferences" = ""; ); main_node = "users_cache." . user_node_name . ".preferences"; ); overlay_node(main_node, new_nodes); save_node(main_node); ) else ( # No permission to view this resource (URL) display_no_permission_html(); ); =}