function SLAM_makeDashboardSearchHTML($config, $db, $user, $request) { /* Generates the different stages of a multi-category search */ $categories = array_keys($request->categories); /* restrict tables to only those that are specified in the config */ $tables = array_intersect($db->tables, array_keys($config->categories)); $s = "<form name='selectSearchCategories' action='" . $request->makeRequestURL($config, array('category' => array()), true) . "&d_status=select' method='POST'>\n"; $s .= "<div id='dashboardSearchContainer'>\n"; if (!$_REQUEST['d_status'] == 'select') { $s .= SLAM_makeButtonHTML('Multi-category search', "onClick=\"toggleHideBodyId('dashboardSearchReveal')\"", false); } // else // $s.=SLAM_makeButtonHTML('Cancel',"onClick=\"hideBodyId('searchContainer')\"",false); $s .= "<div id='dashboardSearchReveal' style='display:none'>\n"; $s .= "<select name='cat[]' multiple='true'>\n"; foreach ($tables as $category) { $s .= in_array($category, $categories) ? "<option value='{$category}' selected='true'>{$category}</option>\n" : "<option value='{$category}'>{$category}</option>\n"; } $s .= "</select>"; $s .= "<br /><input type='submit' name='action' value='Select' />\n"; $s .= "</div>\n"; $s .= "</div>\n"; $s .= "</form>\n"; if ($_REQUEST['d_status'] == 'select' || !empty($request->search)) { /* make a temporary result containing just the structures of the requested tables */ $result = new SLAMresult(); $result->getStructures($config, $db, $user, $request); $s .= SLAM_makeSearchBoxHTML($config, $db, $user, $request, $result); } return $s; }
function SLAM_makeIdentifierMenuHTML($config, $request, $v, $s, $n) { /* generates a smart identifier menu (or button) for jumping to linked assets $v = value of the field $s = format of the field $n = name of the field */ // get list of linkable identifier elements preg_match_all($config->values['identifier_regex'], $v, $m); $url = "{$config->html['url']}?action=open&rloc={$request->location['return']}&identifier="; $a = array(); foreach ($m[0] as $k => $match) { $a["{$m[1][$k]}{$m[2][$k]}_{$m[3][$k]}"] = $request->makeRequestURL($config, array('identifier' => array("{$m[1][$k]}{$m[2][$k]}_{$m[3][$k]}")), true); } $id = "{$m[1][$k]}{$m[2][$k]}_{$m[3][$k]}"; /* make a smart menu with each linkable identifier we found */ if (count($a) == 1) { return SLAM_makeButtonHTML("{$m[0][0]} →", "name='{$s['name']}_linklist' class='assetIdentifierLinkButton' onClick=\"jumpToIdentifier('" . $request->makeRequestURL($config, array('identifier' => array($id)), true) . "')\" class='linkButton'", false); } elseif (count($a) > 1) { return SLAM_makeMenuHTML('', $a, "name='{$s['name']}_linklist' onChange=\"jumpToIdentifier(this.options[this.selectedIndex].value)\"", true, false); } else { return '<!-- empty -->'; } }