function showHtmlAttrStr($str) { return '"' . escapeHtmlAttrStr($str) . '"'; }
function genNewAtomDropDownMenu() { global $allInterfaceObjects; global $selectedRoleNr; // unlike the menu bar, we don't use <a>'s here for navigation, but real click events. This is because the vertical layout may cause a lot of whitespace // which would not be clickable, since <a>'s don't easily stretch. The click events are initialized in initCreateNewMenu (in Ampersand.js). echo '<div id=CreateMenu>'; foreach ($allInterfaceObjects as $interface) { if ($interface['srcConcept'] != 'ONE' && isInterfaceForRole($interface, $selectedRoleNr)) { $interfaceStr = escapeHtmlAttrStr(escapeURI($interface['name'])); $conceptStr = escapeHtmlAttrStr(escapeURI($interface['srcConcept'])); echo "\n<div class=MenuItem interface='{$interfaceStr}' concept='{$conceptStr}'>" . '<div><span class=TextContent>' . htmlSpecialChars($interface['srcConcept']) . ' (' . htmlSpecialChars($interface['name']) . ')</span></div></div>'; // extra div is for renaming menu entries } } echo '</div>'; }
function testRule($ruleName) { global $isDev; global $allRulesSql; if (!$isDev) { echo "<span style=\"color: red\">Rule test unavailable: prototype was not generated with <tt>--dev</tt> option.</span>"; return; } if (!$allRulesSql[$ruleName]) { echo "<span style=\"color: red\">Error: rule \"{$ruleName}\" does not exist.</span>"; return; } echo "<a href=\"../Installer.php\" style=\"float:right\">Reset database</a>"; echo "<h2>Testing rule {$ruleName}</h2>"; $ruleSql = $allRulesSql[$ruleName]; $ruleAdl = escapeHtmlAttrStr($ruleSql['ruleAdl']); echo "<b>ADL:</b> <tt style=\"color:blue\">{$ruleAdl}</tt><h4>Rule SQL</h4><pre>{$ruleSql['contentsSQL']}</pre><h4>results</h4>"; $error = ''; $rows = queryDb($ruleSql['contentsSQL'], $error); printBinaryTable($rows); echo "<h4>Rule violations SQL</h4><pre>{$ruleSql['violationsSQL']}</pre><h4>results</h4>"; $rows = queryDb($ruleSql['violationsSQL'], $error); printBinaryTable($rows); }