示例#1
0
文件: nav.php 项目: jhawcroft/jx-wui
    public static function app_nav($in_nav_def)
    {
        ?>
<div class="nav-app">
<?php 
        print '<ul>';
        foreach ($in_nav_def as $nav_item) {
            $resource_id = $nav_item['resource'];
            $action_uri = JxWui::base_url() . JxWuiUtil::trim_slashes($resource_id);
            print '<li><a href="' . $action_uri . '"' . ($action_uri == $_SERVER['REQUEST_URI'] ? ' class="current"' : '') . '>' . $nav_item['title'] . '</a></li>';
        }
        print '<li><a href="">Extra Test 1</a></li>';
        print '<li><a href="">Extra Test 2</a></li>';
        print '</ul>';
        ?>
</div><?php 
    }
示例#2
0
文件: init.php 项目: jhawcroft/jx-wui
    private static function error($in_detail)
    {
        JxWuiUtil::http_status(500, 'Internal Server Error');
        ?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>500 Internal Server Error</title>
</head>
<body>
<h1>500 Internal Server Error</h1>
<p><?php 
        print 'JxWUI: ' . $in_detail;
        ?>
</p>
</body>
</html><?php 
        exit;
    }
示例#3
0
文件: rest.php 项目: jhawcroft/jx-wui
    private static function error($in_code, $in_status, $in_details = '')
    {
        JxWuiUtil::http_status($in_code, $in_status);
        ?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><?php 
        print $in_code . ' ' . $in_status;
        ?>
</title>
</head>
<body>
<h1><?php 
        print $in_code . ' ' . $in_status;
        ?>
</h1>
</body>
</html><?php 
        exit;
    }
示例#4
0
    public function generate_module_head()
    {
        ?>
<title><?php 
        print $this->manifest['title'];
        ?>
</title>
<script type="text/javascript">

<?php 
        $container_path = $this->manifest['container-id'];
        print 'var close_uri="' . JxWui::base_url() . JxWuiUtil::trim_slashes($container_path) . '";';
        ?>

function do_close()
{
	location.href = close_uri;
}

function do_save()
{
	document.getElementById('content-form').submit();
}


function toggle_pane(in_value)
{
	document.getElementById('pane-0').style.visibility = 'hidden';
	document.getElementById('pane-1').style.visibility = 'hidden';
	
	document.getElementById('pane-'+in_value).style.visibility = 'visible';
}


</script>
<style type="text/css">

form#content-form
{
	height: 70%;
	margin-bottom: 30px;
	padding: 0;
	margin-top: 10px;
}

textarea#content
{
	width: 100%;
	height: 100%;
	font-family: 'Courier New', monospace;
	font-size: 10pt;
}

div.panes
{
	position: relative;
	width: 100%;
	height: 100%;
}

div.pane
{
	position: absolute;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
}

div.pane:not(:first-child)
{
	visibility: hidden;
}


</style><?php 
    }
示例#5
0
    public function generate_module()
    {
        ?>

<h1><?php 
        print $this->manifest['title'];
        ?>
</h1>

<table class="widget-list">
<thead><tr><?php 
        /* begin configuring the displated columns */
        $column_definitions = $this->manifest['column-definitions'];
        $columns = array();
        $index = 0;
        if ($this->manifest['has-selectors']) {
            $columns[] = ':selector';
            /* a special row selector checkbox */
            $index++;
        }
        /* check if we have a saved column configuration for this screen;
        otherwise, use defaults */
        $nominated = $this->manifest['default-columns'];
        // ought to query configuration here
        // from JxWui - which will itself query the application, via standard REST
        /* index the user-nominated/default set of column definitions in the requested sequence */
        $col_map = array();
        foreach ($nominated as $column_id) {
            $def = $column_definitions[$column_id];
            $def['ui-index'] = $index;
            $def['id'] = $column_id;
            $columns[] = $def;
            $col_map[$column_id] = $index++;
        }
        /* output each column header */
        foreach ($columns as $column) {
            if ($column === ':selector') {
                print '<td width="30"><input type="checkbox"></td>';
            } else {
                print '<td>';
                print $column['caption'];
                print '</td>';
            }
        }
        ?>
</tr></thead>
<tbody><?php 
        /* map the currently displayed column sequence to the order the column
        values are provided in each data row */
        $row_map = $this->data['row-map'];
        $index = 0;
        $resource_id_index = 0;
        foreach ($row_map as $column) {
            if ($column === $this->manifest['resource-id']) {
                $resource_id_index = $index;
            }
            if (isset($col_map[$column])) {
                $col_idx = $col_map[$column];
                $columns[$col_idx]['data-index'] = $index++;
            } else {
                $index++;
            }
        }
        /* output each data row */
        $row_data = $this->data['row-data'];
        foreach ($row_data as $row) {
            print '<tr>';
            foreach ($columns as $col) {
                $action_uri = '';
                if (isset($col['action'])) {
                    switch ($col['action'][0]) {
                        case 'query':
                            $resource_id = $row[$resource_id_index];
                            $action_uri = str_replace(':id', $resource_id, $this->manifest['resource-path']);
                            $action_uri = JxWui::base_url() . JxWuiUtil::trim_slashes($action_uri);
                            break;
                    }
                }
                if ($col === ':selector') {
                    print '<td><input type="checkbox"></td>';
                } else {
                    $value = $row[$col['data-index']];
                    print '<td>';
                    if ($action_uri != '') {
                        print '<a href="' . $action_uri . '">';
                    }
                    print $value;
                    if ($action_uri != '') {
                        print '</a>';
                    }
                    print '</td>';
                }
            }
            print '</tr>';
        }
        ?>
</tbody>
</table>

<!--
<pre>
<?php 
        var_dump($columns);
        ?>
</pre>
-->


<?php 
    }