+var toggle_disabled_part_pkg_list = undefined;
+function toggle_disabled_part_pkg (id,showdisabled,noload) {
+ // remove link text, only put it back if this works
+ var trigger = document.getElementById(id+'_switch');
+ trigger.innerHTML = '';
+ // if needed, load pkg_list before trying again
+ var pkg_list = toggle_disabled_part_pkg_list;
+ if (!pkg_list && !noload) {
+ load_part_pkg(
+ function (result) {
+ result = JSON.parse(result);
+ if (result) {
+ toggle_disabled_part_pkg_list = result;
+ toggle_disabled_part_pkg(id,showdisabled,true);
+ } else {
+ console.log('Error loading pkg list');
+ }
+ }
+ );
+ return;
+ }
+ if (!(pkg_list && pkg_list.length)) {
+ console.log('Cannot load pkg list, or pkg list empty');
+ return;
+ }
+ // remove all existing options, tracking which are selected