<commit_before><?php
/**
 * 列表页
 *
 * Copyright (c) 2008-2011 <NAME>. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * @author      <NAME> <<EMAIL>>
 * @copyright   <NAME>
 * @license     http://www.opensource.org/licenses/apache2.0.php Apache License
 * @version     $Id$
 * @since       2009-11-24 18:47:32
 */
// 加载语言,脚本和样式文件
$this->minify->add(array(
    $jQuery->getDir() . 'plugins/jqGrid/i18n/grid.locale-en.js',
    $jQuery->loadPlugin('jqGrid'),
));
?>
<div class="ui-jqgrid-top">
<?php $this->trigger('viewGridTop') ?>
</div>
<style type="text/css">
    #gbox_ui-jqgrid-1 {
        border-left: 0;
        border-right: 0;
    }
    #qw-jqgrid-top {
        font-weight: normal;
        border-top: 0;
        padding: 3px 0 0 5px;
        border-left: 0 none;
        border: 0;
        overflow: hidden;
        line-height: 20px;
    }
</style>
<div id="qw-jqgrid-top" class="ui-state-default">
    <a href="#">添加</a> | <a href="#">删除</a>
</div>
<div class="qw-c"></div>
<table id="<?php echo $jqGrid['id'] ?>"></table>
<div id="<?php echo $jqGrid['pager'] ?>"></div>
<script type="text/javascript">
jQuery(function($){
    var jqGrid = <?php echo json_encode($jqGrid)?>;
    // todo 如何在php代码中表示js function
    jqGrid.ondblClickRow = function(){};
    $('#<?php echo $jqGrid['id'] ?>')
        .jqGrid(jqGrid)
        .jqGrid('navGrid', jqGrid.pager,{
            add : false,
            edit : false,
            del : false,
            search : false
        });

    // 样式调整
    var gboxId = '#gbox_<?php echo $jqGrid['id'] ?>';
    //$(gboxId).width($(gboxId).width() - 2).addClass('ui-state-default');
    $('table.ui-jqgrid-htable tr.ui-jqgrid-labels th:last').css('border-right', 'none');
    $('#t_ui-jqgrid-1').append($('#qw-jqgrid-top').html());
    var primaryKey = 'id';
    var jqGridObj = qwin.jqGrid = $('#<?php echo $jqGrid['id'] ?>');

    jqGridObj.jqGrid('setGridParam',{
        ondblClickRow: function(rowId, iRow, iCol, e){
            var rowData = jqGridObj.jqGrid('getRowData', rowId),
                addition = {};
            addition['action'] = 'view';
            addition[primaryKey] = rowData[primaryKey];
            window.location.href = qwin.url.createUrl(qwin.get, addition);
            return false;
    }}).setGridHeight(467)


    if (document.getElementById('ui-box-tab')) {
        jqGridObj.jqGrid('setGridWidth', $('#ui-box-tab').width() - 30);
    }

    // 点击删除按钮
    $('#action-<?php echo $jqGrid['id'] ?>-delete').click(function(){
        var keyList = new Array(),
            rowList = jqGridObj.jqGrid('getGridParam','selarrrow');
        if (rowList.length == 0) {
            alert(qwin.lang.MSG_CHOOSE_AT_LEASE_ONE_ROW);
            return false;
        }
        for (var i in rowList) {
            var rowData = jqGridObj.jqGrid('getRowData', rowList[i]);
            keyList[i] = rowData[primaryKey];
        }
        var addition = {};
        addition['action'] = 'delete';
        addition[primaryKey] = keyList.join(',');

        var message = '';
        if ($(this).find('span').hasClass('ui-icon-trash')) {
            message = qwin.lang.MSG_CONFIRM_TO_DELETE_TO_TRASH;
        } else {
            message = qwin.lang.MSG_CONFIRM_TO_DELETE;
        }
        if (confirm(message)) {
            window.location.href = qwin.url.createUrl(qwin.get, addition);
        }
        return false;
    });

    // 点击复制按钮
    $('#action-<?php echo $jqGrid['id'] ?>-copy').click(function(){
        var rowList = jqGridObj.jqGrid('getGridParam','selarrrow');
        if (rowList.length != 1) {
            alert(qwin.lang.MSG_CHOOSE_ONLY_ONE_ROW);
            return false;
        }
        var rowData = jqGridObj.jqGrid('getRowData', rowList[0]);
        var url = $(this).attr('href') + '&' + primaryKey + '=' + rowData[primaryKey];
        window.location.href = url;
        return false;
    });

    // 根据窗口变化设置jqGrid宽度等
    // 修复360极速浏览器(6.0Chrome内核)宽度不正确的问题
    $(window).load(function() {
        setJqGridWidth();
    }).resize(function(){
        setJqGridWidth();
    });
    qwin.page.splitter.bind('toggle', function(){
        setJqGridWidth();
    });
    function setJqGridWidth() {
        // 窗口宽度 - 左栏宽度 - 分割栏宽度 - 左栏宽度 - 分割栏宽度
        var leftWidth = 'none' == qwin.page.left.css('display') ? 0 : qwin.page.left.width();
        var rightWidth = 'none' == qwin.page.right.css('display') ? 0 : qwin.page.right.width();
        var width = $(window).width() - leftWidth - rightWidth - (2 * qwin.page.splitter.width()) - 5;
        jqGridObj.jqGrid('setGridWidth', width);
    }
});
</script>
<commit_msg>[视图]调整列表视图细节<commit_after><?php
/**
 * 列表页
 *
 * Copyright (c) 2008-2011 <NAME>. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * @author      <NAME> <<EMAIL>>
 * @copyright   <NAME>
 * @license     http://www.opensource.org/licenses/apache2.0.php Apache License
 * @version     $Id$
 * @since       2009-11-24 18:47:32
 */
// 加载语言,脚本和样式文件
$this->minify->add(array(
    $jQuery->getDir() . 'plugins/jqGrid/i18n/grid.locale-en.js',
    $jQuery->loadPlugin('jqGrid'),
));
?>
<div class="ui-jqgrid-top">
<?php //$this->trigger('viewGridTop') ?>
</div>
<style type="text/css">
    #gbox_ui-jqgrid-1 {
        border-left: 0;
        border-right: 0;
    }
    #qw-jqgrid-top {
        font-weight: normal;
        border-top: 0;
        padding: 3px 0 0 5px;
        border-left: 0 none;
        border: 0;
        overflow: hidden;
        line-height: 20px;
    }
</style>
<div id="qw-jqgrid-top" class="ui-state-default">
    <a href="#">添加</a> | <a href="#">删除</a>
</div>
<div class="qw-c"></div>
<table id="<?php echo $jqGrid['id'] ?>"></table>
<div id="<?php echo $jqGrid['pager'] ?>"></div>
<script type="text/javascript">
jQuery(function($){
    var jqGrid = <?php echo json_encode($jqGrid)?>;
    // todo 如何在php代码中表示js function
    jqGrid.ondblClickRow = function(){};
    $('#<?php echo $jqGrid['id'] ?>')
        .jqGrid(jqGrid)
        .jqGrid('navGrid', jqGrid.pager,{
            add : false,
            edit : false,
            del : false,
            search : false
        });

    // 样式调整
    var gboxId = '#gbox_<?php echo $jqGrid['id'] ?>';
    //$(gboxId).width($(gboxId).width() - 2).addClass('ui-state-default');
    $('table.ui-jqgrid-htable tr.ui-jqgrid-labels th:last').css('border-right', 'none');
    $('#t_ui-jqgrid-1').append($('#qw-jqgrid-top').html());
    var primaryKey = 'id';
    var jqGridObj = qwin.jqGrid = $('#<?php echo $jqGrid['id'] ?>');

    jqGridObj.jqGrid('setGridParam',{
        ondblClickRow: function(rowId, iRow, iCol, e){
            var rowData = jqGridObj.jqGrid('getRowData', rowId),
                addition = {};
            addition['action'] = 'view';
            addition[primaryKey] = rowData[primaryKey];
            window.location.href = qwin.url.createUrl(qwin.get, addition);
            return false;
    }}).setGridHeight(467)


    if (document.getElementById('ui-box-tab')) {
        jqGridObj.jqGrid('setGridWidth', $('#ui-box-tab').width() - 30);
    }

    // 点击删除按钮
    $('#action-<?php echo $jqGrid['id'] ?>-delete').click(function(){
        var keyList = new Array(),
            rowList = jqGridObj.jqGrid('getGridParam','selarrrow');
        if (rowList.length == 0) {
            alert(qwin.lang.MSG_CHOOSE_AT_LEASE_ONE_ROW);
            return false;
        }
        for (var i in rowList) {
            var rowData = jqGridObj.jqGrid('getRowData', rowList[i]);
            keyList[i] = rowData[primaryKey];
        }
        var addition = {};
        addition['action'] = 'delete';
        addition[primaryKey] = keyList.join(',');

        var message = '';
        if ($(this).find('span').hasClass('ui-icon-trash')) {
            message = qwin.lang.MSG_CONFIRM_TO_DELETE_TO_TRASH;
        } else {
            message = qwin.lang.MSG_CONFIRM_TO_DELETE;
        }
        if (confirm(message)) {
            window.location.href = qwin.url.createUrl(qwin.get, addition);
        }
        return false;
    });

    // 点击复制按钮
    $('#action-<?php echo $jqGrid['id'] ?>-copy').click(function(){
        var rowList = jqGridObj.jqGrid('getGridParam','selarrrow');
        if (rowList.length != 1) {
            alert(qwin.lang.MSG_CHOOSE_ONLY_ONE_ROW);
            return false;
        }
        var rowData = jqGridObj.jqGrid('getRowData', rowList[0]);
        var url = $(this).attr('href') + '&' + primaryKey + '=' + rowData[primaryKey];
        window.location.href = url;
        return false;
    });

    // 根据窗口变化设置jqGrid宽度等
    // 修复360极速浏览器(6.0Chrome内核)宽度不正确的问题
    $(window).load(function() {
        setJqGridWidth();
    }).resize(function(){
        setJqGridWidth();
    });
    qwin.page.splitter.bind('toggle', function(){
        setJqGridWidth();
    });
    function setJqGridWidth() {
        // 窗口宽度 - 左栏宽度 - 分割栏宽度 - 左栏宽度 - 分割栏宽度
        var leftWidth = 'none' == qwin.page.left.css('display') ? 0 : qwin.page.left.width();
        var rightWidth = 'none' == qwin.page.right.css('display') ? 0 : qwin.page.right.width();
        var width = $(window).width() - leftWidth - rightWidth - (2 * qwin.page.splitter.width()) - 5;
        jqGridObj.jqGrid('setGridWidth', width);
    }
});
</script>

{'fraction_non_alphanumeric': 0.17369292181871288, 'fraction_numerical': 0.011878103397916465, 'mean_word_length': 2.506998975759645, 'pattern_counts': {'":': 0, '<': 69, '<?xml version=': 0, '>': 79, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2855070', 'n_tokens_mistral': 3667, 'n_tokens_neox': 3597, 'n_words': 698}