示例#1
0
文件: interface.php 项目: xtha/salt
function renderRackspaceLocationEditor()
{
    $js = <<<JSTXT
\tfunction locationeditor_showselectbox(e) {
\t\t\$(this).load('index.php', {module: 'ajax', ac: 'get-location-select', locationid: this.id});
\t\t\$(this).unbind('mousedown', locationeditor_showselectbox);
\t}
\t\$(document).ready(function () {
\t\t\$('select.locationlist-popup').bind('mousedown', locationeditor_showselectbox);
\t});
JSTXT;
    addJS($js, TRUE);
    function printNewItemTR()
    {
        printOpFormIntro('addLocation');
        echo '<tr><td>';
        printImageHREF('create', 'Add new location', TRUE);
        echo '</td><td><select name=parent_id tabindex=100>';
        renderLocationSelectTree();
        echo '</td><td><input type=text size=48 name=name tabindex=101></td><td>';
        printImageHREF('create', 'Add new location', TRUE, 102);
        echo "</td></tr></form>\n";
    }
    startPortlet('Locations');
    echo "<table border=0 cellspacing=0 cellpadding=5 align=center class=widetable>\n";
    echo "<tr><th>&nbsp;</th><th>Parent</th><th>Name</th><th>&nbsp;</th></tr>\n";
    if (getConfigVar('ADDNEW_AT_TOP') == 'yes') {
        printNewItemTR();
    }
    $locations = listCells('location');
    renderLocationRowForEditor(treeFromList($locations));
    if (getConfigVar('ADDNEW_AT_TOP') != 'yes') {
        printNewItemTR();
    }
    echo "</table><br>\n";
    finishPortlet();
}
示例#2
0
function renderRackspaceLocationEditor()
{
    addJS(<<<END
function locationeditor_showselectbox(e) {
\t\$(this).load('index.php', {module: 'ajax', ac: 'get-location-select', locationid: this.id});
\t\$(this).unbind('mousedown', locationeditor_showselectbox);
}
\$(document).ready(function () {
\t\$('select.locationlist-popup').bind('mousedown', locationeditor_showselectbox);
});
END
, TRUE);
    function printNewItemTR()
    {
        printOpFormIntro('addLocation');
        echo "<tr><td>";
        printImageHREF('create', 'Add new location', TRUE);
        echo "</td><td><select name=parent_id tabindex=100>";
        echo "<option value=0>-- NONE --</option>";
        foreach (listCells('location') as $location) {
            echo "<option value={$location['id']}>{$location['name']}</option>";
        }
        echo "</select></td>";
        echo "<td><input type=text size=48 name=name tabindex=101></td><td>";
        printImageHREF('create', 'Add new location', TRUE, 102);
        echo "</td></tr></form>\n";
    }
    startPortlet('Locations');
    echo "<table border=0 cellspacing=0 cellpadding=5 align=center class=widetable>\n";
    echo "<tr><th>&nbsp;</th><th>Parent</th><th>Name</th><th>&nbsp;</th></tr>\n";
    if (getConfigVar('ADDNEW_AT_TOP') == 'yes') {
        printNewItemTR();
    }
    renderLocationRowForEditor(treeFromList(listCells('location')));
    if (getConfigVar('ADDNEW_AT_TOP') != 'yes') {
        printNewItemTR();
    }
    echo "</table><br>\n";
    finishPortlet();
}