mirror of https://github.com/apache/nifi.git
NIFI-27:
- Upgrading jQuery, jQuery UI, jqGrid. - Replacing deprecated functionality.
This commit is contained in:
parent
a016bf47bd
commit
d7b1113a86
|
@ -23,7 +23,7 @@
|
|||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
|
||||
<link rel="shortcut icon" href="images/nifi16.ico"/>
|
||||
|
||||
<link rel="stylesheet" href="../nifi/js/jquery/css/smoothness/jquery-ui-1.8.10.custom.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../nifi/js/jquery/ui-smoothness/jquery-ui-1.10.4.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../nifi/js/jquery/modal/jquery.modal.css" type="text/css" />
|
||||
|
||||
<link rel="stylesheet" href="js/jquery/jqgrid/css/ui.jqgrid.css" type="text/css" />
|
||||
|
@ -33,8 +33,8 @@
|
|||
|
||||
<link rel="stylesheet" href="css/threshold_styles.css" type="text/css" />
|
||||
|
||||
<script type="text/javascript" src="../nifi/js/jquery/jquery-1.7.min.js"></script>
|
||||
<script type="text/javascript" src="../nifi/js/jquery/jquery-ui-1.8.10.custom.min.js"></script>
|
||||
<script type="text/javascript" src="../nifi/js/jquery/jquery-2.1.1.min.js"></script>
|
||||
<script type="text/javascript" src="../nifi/js/jquery/ui-smoothness/jquery-ui-1.10.4.min.js"></script>
|
||||
<script type="text/javascript" src="../nifi/js/jquery/jquery.center.js"></script>
|
||||
<script type="text/javascript" src="../nifi/js/jquery/modal/jquery.modal.js"></script>
|
||||
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You 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.
|
||||
-->
|
||||
<bindings
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<binding id="ellipsis">
|
||||
<content>
|
||||
<xul:window><!-- xul:window tag required for FF2 -->
|
||||
<xul:description crop="end" xbl:inherits="value=xbl:text">
|
||||
<children/>
|
||||
</xul:description>
|
||||
</xul:window>
|
||||
</content>
|
||||
</binding>
|
||||
</bindings>
|
249
nar-bundles/monitor-threshold-bundle/ui/src/main/webapp/js/jquery/jqgrid/css/ui.jqgrid.css
Executable file → Normal file
249
nar-bundles/monitor-threshold-bundle/ui/src/main/webapp/js/jquery/jqgrid/css/ui.jqgrid.css
Executable file → Normal file
|
@ -1,181 +1,120 @@
|
|||
/*Grid*/
|
||||
.ui-jqgrid {position: relative; font-size:11px;}
|
||||
.ui-jqgrid .ui-jqgrid-view {position: relative;left:0px; top: 0px; padding: .0em;}
|
||||
|
||||
.ui-jqgrid {position: relative;}
|
||||
.ui-jqgrid .ui-jqgrid-view {position: relative;left:0; top: 0; padding: 0; font-size:11px;}
|
||||
/* caption*/
|
||||
.ui-jqgrid .ui-jqgrid-titlebar {padding: .3em .2em .2em .3em; position: relative; border-left: 0px none;border-right: 0px none; border-top: 0px none;}
|
||||
.ui-jqgrid .ui-jqgrid-title { float: left; margin: .1em 0 .2em; }
|
||||
.ui-jqgrid .ui-jqgrid-titlebar-close { position: absolute;top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height:18px;}.ui-jqgrid .ui-jqgrid-titlebar-close span { display: block; margin: 1px; }
|
||||
.ui-jqgrid .ui-jqgrid-titlebar {padding: .3em .2em .2em .3em; position: relative; font-size: 12px; border-left: 0 none;border-right: 0 none; border-top: 0 none;}
|
||||
.ui-jqgrid .ui-jqgrid-caption {text-align: left;}
|
||||
.ui-jqgrid .ui-jqgrid-title { margin: .1em 0 .2em; }
|
||||
.ui-jqgrid .ui-jqgrid-titlebar-close { position: absolute;top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height:18px; cursor:pointer;}
|
||||
.ui-jqgrid .ui-jqgrid-titlebar-close span { display: block; margin: 1px; }
|
||||
.ui-jqgrid .ui-jqgrid-titlebar-close:hover { padding: 0; }
|
||||
|
||||
/* header*/
|
||||
/*.ui-jqgrid .ui-jqgrid-hdiv {position: relative; margin: 0em;padding: 0em; overflow-x: hidden; overflow-y: auto; border-left: 0px none !important; border-top : 0px none !important; border-right : 0px none !important;}*/
|
||||
.ui-jqgrid .ui-jqgrid-hdiv {
|
||||
position: relative;
|
||||
margin: 0em;
|
||||
padding: 0em;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
border-left: 0px none !important;
|
||||
border-top : 0px none !important;
|
||||
border-right : 0px none !important;
|
||||
border-bottom: 1px solid #666;
|
||||
background-image: url(../../../../images/bgTableHeader.png);
|
||||
background-repeat: repeat-x;
|
||||
}
|
||||
|
||||
.ui-jqgrid .ui-jqgrid-hdiv {position: relative; margin: 0;padding: 0; overflow-x: hidden; border-left: 0 none !important; border-top : 0 none !important; border-right : 0 none !important;}
|
||||
.ui-jqgrid .ui-jqgrid-hbox {float: left; padding-right: 20px;}
|
||||
.ui-jqgrid .ui-jqgrid-htable {table-layout:fixed;margin:0em;}
|
||||
/*.ui-jqgrid .ui-jqgrid-htable th {height:22px;padding: 0 2px 0 2px;}*/
|
||||
.ui-jqgrid .ui-jqgrid-htable th {
|
||||
height: 26px;
|
||||
padding: 0 2px;
|
||||
border-right: 1px solid #172B31;
|
||||
border-bottom: 1px solid #365C6A;
|
||||
background-image: url(../../../../images/bgTableHeader.png);
|
||||
background-repeat: repeat-x;
|
||||
}
|
||||
/*.ui-jqgrid .ui-jqgrid-htable th div {overflow: hidden; position:relative; height:17px;}*/
|
||||
.ui-jqgrid .ui-jqgrid-htable th div {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
padding-top: 8px;
|
||||
left: 4px;
|
||||
height: 17px;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
}
|
||||
/*.ui-th-column, .ui-jqgrid .ui-jqgrid-htable th.ui-th-column {overflow: hidden;white-space: nowrap;text-align:center;border-top : 0px none;border-bottom : 0px none;}*/
|
||||
.ui-th-column, .ui-jqgrid .ui-jqgrid-htable th.ui-th-column {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
border-top: 0px none;
|
||||
border-bottom: 0px none;
|
||||
}
|
||||
.ui-th-ltr, .ui-jqgrid .ui-jqgrid-htable th.ui-th-ltr {border-left : 0px none;}
|
||||
.ui-th-rtl, .ui-jqgrid .ui-jqgrid-htable th.ui-th-rtl {border-right : 0px none;}
|
||||
.ui-jqgrid .ui-jqgrid-htable {table-layout:fixed;margin:0;}
|
||||
.ui-jqgrid .ui-jqgrid-htable th {height:22px;padding: 0 2px 0 2px;}
|
||||
.ui-jqgrid .ui-jqgrid-htable th div {overflow: hidden; position:relative; height:17px;}
|
||||
.ui-th-column, .ui-jqgrid .ui-jqgrid-htable th.ui-th-column {overflow: hidden;white-space: nowrap;text-align:center;border-top : 0 none;border-bottom : 0 none;}
|
||||
.ui-th-ltr, .ui-jqgrid .ui-jqgrid-htable th.ui-th-ltr {border-left : 0 none;}
|
||||
.ui-th-rtl, .ui-jqgrid .ui-jqgrid-htable th.ui-th-rtl {border-right : 0 none;}
|
||||
.ui-first-th-ltr {border-right: 1px solid; }
|
||||
.ui-first-th-rtl {border-left: 1px solid; }
|
||||
.ui-jqgrid .ui-th-div-ie {white-space: nowrap; zoom :1; height:17px;}
|
||||
/*.ui-jqgrid .ui-jqgrid-resize {height:20px !important;position: relative; cursor :e-resize;display: inline;overflow: hidden;}*/
|
||||
.ui-jqgrid .ui-jqgrid-resize {
|
||||
height: 26px !important;
|
||||
position: relative;
|
||||
cursor: e-resize;
|
||||
display: inline;
|
||||
overflow: hidden;
|
||||
z-index: 1;
|
||||
}
|
||||
.ui-jqgrid .ui-jqgrid-resize {height:20px !important;position: relative; cursor :e-resize;display: inline;overflow: hidden;}
|
||||
.ui-jqgrid .ui-grid-ico-sort {overflow:hidden;position:absolute;display:inline; cursor: pointer !important;}
|
||||
/*.ui-jqgrid .ui-icon-asc {margin-top:-3px; height:12px;}*/
|
||||
.ui-jqgrid .ui-icon-asc {
|
||||
margin-left: 5px;
|
||||
margin-top: -5px;
|
||||
height: 12px;
|
||||
}
|
||||
/*.ui-jqgrid .ui-icon-desc {margin-top:3px;height:12px;}*/
|
||||
.ui-jqgrid .ui-icon-desc {
|
||||
height: 12px;
|
||||
margin-top: 2px;
|
||||
margin-left: 4px;
|
||||
}
|
||||
.ui-jqgrid .ui-i-asc {margin-top:0px;height:16px;}
|
||||
.ui-jqgrid .ui-i-desc {margin-top:0px;margin-left:13px;height:16px;}
|
||||
.ui-jqgrid .ui-icon-asc {margin-top:-3px; height:12px;}
|
||||
.ui-jqgrid .ui-icon-desc {margin-top:3px;height:12px;}
|
||||
.ui-jqgrid .ui-i-asc {margin-top:0;height:16px;}
|
||||
.ui-jqgrid .ui-i-desc {margin-top:0;margin-left:13px;height:16px;}
|
||||
.ui-jqgrid .ui-jqgrid-sortable {cursor:pointer;}
|
||||
.ui-jqgrid tr.ui-search-toolbar th { border-top-width: 1px !important; border-top-color: inherit !important; border-top-style: ridge !important }
|
||||
tr.ui-search-toolbar input {margin: 1px 0px 0px 0px}
|
||||
tr.ui-search-toolbar select {margin: 1px 0px 0px 0px}
|
||||
|
||||
tr.ui-search-toolbar input {margin: 1px 0 0 0}
|
||||
tr.ui-search-toolbar select {margin: 1px 0 0 0}
|
||||
/* body */
|
||||
.ui-jqgrid .ui-jqgrid-bdiv {position: relative; margin: 0em; padding:0; overflow: auto; text-align:left;}
|
||||
.ui-jqgrid .ui-jqgrid-btable {table-layout:fixed; margin:0em;}
|
||||
/*.ui-jqgrid tr.jqgrow td {font-weight: normal; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}*/
|
||||
.ui-jqgrid tr.jqgrow td {
|
||||
font-weight: normal;
|
||||
overflow: hidden;
|
||||
padding: 2px;
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-color: #aaa;
|
||||
border-bottom-style: solid;
|
||||
}
|
||||
/*.ui-jqgrid tr.ui-row-ltr td {text-align:left;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;}*/
|
||||
.ui-jqgrid tr.ui-row-ltr td {
|
||||
vertical-align: middle;
|
||||
padding: 6px 3px 4px 2px;
|
||||
text-align: left;
|
||||
}
|
||||
.ui-jqgrid .ui-jqgrid-bdiv {position: relative; margin: 0; padding:0; overflow: auto; text-align:left;}
|
||||
.ui-jqgrid .ui-jqgrid-btable {table-layout:fixed; margin:0; outline-style: none; }
|
||||
.ui-jqgrid tr.jqgrow { outline-style: none; }
|
||||
.ui-jqgrid tr.jqgroup { outline-style: none; }
|
||||
.ui-jqgrid tr.jqgrow td {font-weight: normal; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
|
||||
.ui-jqgrid tr.jqgfirstrow td {padding: 0 2px 0 2px;border-right-width: 1px; border-right-style: solid;}
|
||||
.ui-jqgrid tr.jqgroup td {font-weight: normal; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
|
||||
.ui-jqgrid tr.jqfoot td {font-weight: bold; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
|
||||
.ui-jqgrid tr.ui-row-ltr td {text-align:left;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;}
|
||||
.ui-jqgrid tr.ui-row-rtl td {text-align:right;border-left-width: 1px; border-left-color: inherit; border-left-style: solid;}
|
||||
.ui-jqgrid td.jqgrid-rownum { padding: 0 2px 0 2px; margin: 0px; border: 0px none;}
|
||||
.ui-jqgrid .ui-jqgrid-resize-mark { width:2px; left:0; background-color:#777; cursor: e-resize; cursor: col-resize; position:absolute; top:0; height:100px; overflow:hidden; display:none; border:0 none;}
|
||||
|
||||
.ui-jqgrid td.jqgrid-rownum { padding: 0 2px 0 2px; margin: 0; border: 0 none;}
|
||||
.ui-jqgrid .ui-jqgrid-resize-mark { width:2px; left:0; background-color:#777; cursor: e-resize; cursor: col-resize; position:absolute; top:0; height:100px; overflow:hidden; display:none; border:0 none; z-index: 99999;}
|
||||
/* footer */
|
||||
.ui-jqgrid .ui-jqgrid-sdiv {position: relative; margin: 0em;padding: 0em; overflow: hidden; border-left: 0px none !important; border-top : 0px none !important; border-right : 0px none !important;}
|
||||
.ui-jqgrid .ui-jqgrid-ftable {table-layout:fixed; margin-bottom:0em;}
|
||||
.ui-jqgrid .ui-jqgrid-sdiv {position: relative; margin: 0;padding: 0; overflow: hidden; border-left: 0 none !important; border-top : 0 none !important; border-right : 0 none !important;}
|
||||
.ui-jqgrid .ui-jqgrid-ftable {table-layout:fixed; margin-bottom:0;}
|
||||
.ui-jqgrid tr.footrow td {font-weight: bold; overflow: hidden; white-space:nowrap; height: 21px;padding: 0 2px 0 2px;border-top-width: 1px; border-top-color: inherit; border-top-style: solid;}
|
||||
.ui-jqgrid tr.footrow-ltr td {text-align:left;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;}
|
||||
.ui-jqgrid tr.footrow-rtl td {text-align:right;border-left-width: 1px; border-left-color: inherit; border-left-style: solid;}
|
||||
|
||||
/* Pager*/
|
||||
.ui-jqgrid .ui-jqgrid-pager { border-left: 0px none !important;border-right: 0px none !important; border-bottom: 0px none !important; margin: 0px !important; padding: 0px !important; position: relative; height: 25px;white-space: nowrap;overflow: hidden;}
|
||||
.ui-jqgrid .ui-jqgrid-pager { border-left: 0 none !important;border-right: 0 none !important; border-bottom: 0 none !important; margin: 0 !important; padding: 0 !important; position: relative; height: 25px;white-space: nowrap;overflow: hidden;font-size:11px;}
|
||||
.ui-jqgrid .ui-pager-control {position: relative;}
|
||||
.ui-jqgrid .ui-pg-table {position: relative; padding-bottom:2px; width:auto; margin: 0em;}
|
||||
.ui-jqgrid .ui-pg-table {position: relative; padding-bottom:2px; width:auto; margin: 0;}
|
||||
.ui-jqgrid .ui-pg-table td {font-weight:normal; vertical-align:middle; padding:1px;}
|
||||
.ui-jqgrid .ui-pg-button { height:19px !important;}
|
||||
.ui-jqgrid .ui-pg-button span { display: block; margin: 1px; float:left;}
|
||||
/*.ui-jqgrid .ui-pg-button:hover { padding: 0px; }*/
|
||||
.ui-jqgrid .ui-pg-button:hover {
|
||||
padding: 1px;
|
||||
}
|
||||
.ui-jqgrid .ui-pg-button:hover { padding: 0; }
|
||||
.ui-jqgrid .ui-state-disabled:hover {padding:1px;}
|
||||
.ui-jqgrid .ui-pg-input { height:13px;font-size:.8em; margin: 0em;}
|
||||
.ui-jqgrid .ui-pg-selbox {font-size:.8em; line-height:18px; display:block; height:18px; margin: 0em;}
|
||||
.ui-jqgrid .ui-pg-input { height:13px;font-size:.8em; margin: 0;}
|
||||
.ui-jqgrid .ui-pg-selbox {font-size:.8em; line-height:18px; display:block; height:18px; margin: 0;}
|
||||
.ui-jqgrid .ui-separator {height: 18px; border-left: 1px solid #ccc ; border-right: 1px solid #ccc ; margin: 1px; float: right;}
|
||||
.ui-jqgrid .ui-paging-info {font-weight: normal;height:19px; margin-top:3px;margin-right:4px;}
|
||||
.ui-jqgrid .ui-jqgrid-pager .ui-pg-div {padding:1px 0;float:left;list-style-image:none;list-style-position:outside;list-style-type:none;position:relative;}
|
||||
.ui-jqgrid .ui-jqgrid-pager .ui-pg-div {padding:1px 0;float:left;position:relative;}
|
||||
.ui-jqgrid .ui-jqgrid-pager .ui-pg-button { cursor:pointer; }
|
||||
.ui-jqgrid .ui-jqgrid-pager .ui-pg-div span.ui-icon {float:left;margin:0 2px;}
|
||||
.ui-jqgrid td input, .ui-jqgrid td select .ui-jqgrid td textarea { margin: 0em;}
|
||||
.ui-jqgrid td input, .ui-jqgrid td select .ui-jqgrid td textarea { margin: 0;}
|
||||
.ui-jqgrid td textarea {width:auto;height:auto;}
|
||||
.ui-jqgrid .ui-jqgrid-toppager {border-left: 0px none !important;border-right: 0px none !important; border-top: 0px none !important; margin: 0px !important; padding: 0px !important; position: relative; height: 25px !important;white-space: nowrap;overflow: hidden;}
|
||||
|
||||
/* subgrid */
|
||||
.ui-jqgrid .ui-jqgrid-toppager {border-left: 0 none !important;border-right: 0 none !important; border-top: 0 none !important; margin: 0 !important; padding: 0 !important; position: relative; height: 25px !important;white-space: nowrap;overflow: hidden;}
|
||||
.ui-jqgrid .ui-jqgrid-toppager .ui-pg-div {padding:1px 0;float:left;position:relative;}
|
||||
.ui-jqgrid .ui-jqgrid-toppager .ui-pg-button { cursor:pointer; }
|
||||
.ui-jqgrid .ui-jqgrid-toppager .ui-pg-div span.ui-icon {float:left;margin:0 2px;}
|
||||
/*subgrid*/
|
||||
.ui-jqgrid .ui-jqgrid-btable .ui-sgcollapsed span {display: block;}
|
||||
.ui-jqgrid .ui-subgrid {margin:0em;padding:0em; width:100%;}
|
||||
.ui-jqgrid .ui-subgrid {margin:0;padding:0; width:100%;}
|
||||
.ui-jqgrid .ui-subgrid table {table-layout: fixed;}
|
||||
.ui-jqgrid .ui-subgrid tr.ui-subtblcell td {height:18px;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
|
||||
.ui-jqgrid .ui-subgrid td.subgrid-data {border-top: 0px none !important;}
|
||||
.ui-jqgrid .ui-subgrid td.subgrid-cell {border-width: 0px 0px 1px 0px;}
|
||||
.ui-jqgrid .ui-subgrid td.subgrid-data {border-top: 0 none !important;}
|
||||
.ui-jqgrid .ui-subgrid td.subgrid-cell {border-width: 0 0 1px 0;}
|
||||
.ui-jqgrid .ui-th-subgrid {height:20px;}
|
||||
|
||||
/* loading */
|
||||
.ui-jqgrid .loading {position: absolute; top: 45%;left: 45%;width: auto;z-index:101;padding: 6px; margin: 5px;text-align: center;font-weight: bold;display: none;border-width: 2px !important;}
|
||||
.ui-jqgrid .loading {position: absolute; top: 45%;left: 45%;width: auto;z-index:101;padding: 6px; margin: 5px;text-align: center;font-weight: bold;display: none;border-width: 2px !important; font-size:11px;}
|
||||
.ui-jqgrid .jqgrid-overlay {display:none;z-index:100;}
|
||||
* html .jqgrid-overlay {width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');}
|
||||
* .jqgrid-overlay iframe {position:absolute;top:0;left:0;z-index:-1;width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');}
|
||||
/* IE * html .jqgrid-overlay {width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');} */
|
||||
* .jqgrid-overlay iframe {position:absolute;top:0;left:0;z-index:-1;}
|
||||
/* IE width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');}*/
|
||||
/* end loading div */
|
||||
|
||||
/* toolbar */
|
||||
.ui-jqgrid .ui-userdata {border-left: 0px none; border-right: 0px none; height : 21px;overflow: hidden; }
|
||||
|
||||
.ui-jqgrid .ui-userdata {border-left: 0 none; border-right: 0 none; height : 21px;overflow: hidden; }
|
||||
/*Modal Window */
|
||||
.ui-jqdialog { display: none; width: 300px; position: absolute; padding: .2em; font-size:11px; overflow:visible;}
|
||||
.ui-jqdialog .ui-jqdialog-titlebar { padding: .3em .2em; position: relative; }
|
||||
.ui-jqdialog .ui-jqdialog-title { margin: .1em 0 .2em; }
|
||||
.ui-jqdialog .ui-jqdialog-titlebar-close { position: absolute; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
|
||||
.ui-jqdialog .ui-jqdialog-titlebar-close { position: absolute; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; cursor:pointer;}
|
||||
|
||||
.ui-jqdialog .ui-jqdialog-titlebar-close span { display: block; margin: 1px; }
|
||||
.ui-jqdialog .ui-jqdialog-titlebar-close:hover, .ui-jqdialog .ui-jqdialog-titlebar-close:focus { padding: 0; }
|
||||
.ui-jqdialog-content, .ui-jqdialog .ui-jqdialog-content { border: 0; padding: .3em .2em; background: none; height:auto;}
|
||||
.ui-jqdialog .ui-jqconfirm {padding: .4em 1em; border-width:3px;position:absolute;bottom:10px;right:10px;overflow:visible;display:none;height:80px;width:220px;text-align:center;}
|
||||
.ui-jqdialog>.ui-resizable-se { bottom: -3px; right: -3px}
|
||||
.ui-jqgrid>.ui-resizable-se { bottom: -3px; right: -3px }
|
||||
/* end Modal window*/
|
||||
|
||||
/* Form edit */
|
||||
.ui-jqdialog-content .FormGrid {margin: 0px;}
|
||||
.ui-jqdialog-content .EditTable { width: 100%; margin-bottom:0em;}
|
||||
.ui-jqdialog-content .DelTable { width: 100%; margin-bottom:0em;}
|
||||
.EditTable td input, .EditTable td select, .EditTable td textarea {margin: 0em;}
|
||||
.ui-jqdialog-content .FormGrid {margin: 0;}
|
||||
.ui-jqdialog-content .EditTable { width: 100%; margin-bottom:0;}
|
||||
.ui-jqdialog-content .DelTable { width: 100%; margin-bottom:0;}
|
||||
.EditTable td input, .EditTable td select, .EditTable td textarea {margin: 0;}
|
||||
.EditTable td textarea { width:auto; height:auto;}
|
||||
.ui-jqdialog-content td.EditButton {text-align: right;border-top: 0px none;border-left: 0px none;border-right: 0px none; padding-bottom:5px; padding-top:5px;}
|
||||
.ui-jqdialog-content td.navButton {text-align: center; border-left: 0px none;border-top: 0px none;border-right: 0px none; padding-bottom:5px; padding-top:5px;}
|
||||
.ui-jqdialog-content .CaptionTD {text-align: left; vertical-align: top;border-left: 0px none;border-right: 0px none; border-bottom: 0px none; padding: 1px;white-space: nowrap;}
|
||||
.ui-jqdialog-content .DataTD {padding: 1px;border-left: 0px none;border-right: 0px none; border-bottom: 0px none; vertical-align: top;}
|
||||
.ui-jqdialog-content td.EditButton {text-align: right;border-top: 0 none;border-left: 0 none;border-right: 0 none; padding-bottom:5px; padding-top:5px;}
|
||||
.ui-jqdialog-content td.navButton {text-align: center; border-left: 0 none;border-top: 0 none;border-right: 0 none; padding-bottom:5px; padding-top:5px;}
|
||||
.ui-jqdialog-content input.FormElement {padding:.3em}
|
||||
.ui-jqdialog-content select.FormElement {padding:.3em}
|
||||
.ui-jqdialog-content .data-line {padding-top:.1em;border: 0 none;}
|
||||
|
||||
.ui-jqdialog-content .CaptionTD {vertical-align: middle;border: 0 none; padding: 2px;white-space: nowrap;}
|
||||
.ui-jqdialog-content .DataTD {padding: 2px; border: 0 none; vertical-align: top;}
|
||||
.ui-jqdialog-content .form-view-data {white-space:pre}
|
||||
.fm-button { display: inline-block; margin:0 4px 0 0; padding: .4em .5em; text-decoration:none !important; cursor:pointer; position: relative; text-align: center; zoom: 1; }
|
||||
.fm-button-icon-left { padding-left: 1.9em; }
|
||||
|
@ -184,29 +123,49 @@ tr.ui-search-toolbar select {margin: 1px 0px 0px 0px}
|
|||
.fm-button-icon-right .ui-icon { left: auto; right: .2em; margin-left: 0; position: absolute; top: 50%; margin-top: -8px;}
|
||||
#nData, #pData { float: left; margin:3px;padding: 0; width: 15px; }
|
||||
/* End Eorm edit */
|
||||
|
||||
/*.ui-jqgrid .edit-cell {}*/
|
||||
.ui-jqgrid .selected-row, div.ui-jqgrid .selected-row td {font-style : normal;border-left: 0px none;}
|
||||
|
||||
.ui-jqgrid .selected-row, div.ui-jqgrid .selected-row td {font-style : normal;border-left: 0 none;}
|
||||
/* inline edit actions button*/
|
||||
.ui-inline-del.ui-state-hover span, .ui-inline-edit.ui-state-hover span,
|
||||
.ui-inline-save.ui-state-hover span, .ui-inline-cancel.ui-state-hover span {
|
||||
margin: -1px;
|
||||
}
|
||||
/* Tree Grid */
|
||||
.ui-jqgrid .tree-wrap {float: left; position: relative;height: 18px;white-space: nowrap;overflow: hidden;}
|
||||
.ui-jqgrid .tree-minus {position: absolute; height: 18px; width: 18px; overflow: hidden;}
|
||||
.ui-jqgrid .tree-plus {position: absolute; height: 18px; width: 18px; overflow: hidden;}
|
||||
.ui-jqgrid .tree-leaf {position: absolute; height: 18px; width: 18px;overflow: hidden;}
|
||||
.ui-jqgrid .treeclick {cursor: pointer;}
|
||||
|
||||
/* moda dialog */
|
||||
.jqmOverlay { background-color: #000; }
|
||||
* iframe.jqm {position:absolute;top:0;left:0;z-index:-1;width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');}
|
||||
* iframe.jqm {position:absolute;top:0;left:0;z-index:-1;}
|
||||
/* width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');}*/
|
||||
.ui-jqgrid-dnd tr td {border-right-width: 1px; border-right-color: inherit; border-right-style: solid; height:20px}
|
||||
|
||||
/* RTL Support */
|
||||
.ui-jqgrid .ui-jqgrid-title-rtl {float:right;margin: .1em 0 .2em; }
|
||||
.ui-jqgrid .ui-jqgrid-caption-rtl {text-align: right;}
|
||||
.ui-jqgrid .ui-jqgrid-hbox-rtl {float: right; padding-left: 20px;}
|
||||
.ui-jqgrid .ui-jqgrid-resize-ltr {float: right;margin: -2px -2px -2px 0px;}
|
||||
.ui-jqgrid .ui-jqgrid-resize-rtl {float: left;margin: -2px 0px -1px -3px;}
|
||||
.ui-jqgrid .ui-sort-rtl {left:0px;}
|
||||
.ui-jqgrid .ui-jqgrid-resize-ltr {float: right;margin: -2px -2px -2px 0;}
|
||||
.ui-jqgrid .ui-jqgrid-resize-rtl {float: left;margin: -2px 0 -1px -3px;}
|
||||
.ui-jqgrid .ui-sort-rtl {left:0;}
|
||||
.ui-jqgrid .tree-wrap-ltr {float: left;}
|
||||
.ui-jqgrid .tree-wrap-rtl {float: right;}
|
||||
.ui-jqgrid .ui-ellipsis {text-overflow:ellipsis; -moz-binding:url('ellipsis-xbl.xml#ellipsis');}
|
||||
.ui-jqgrid .ui-ellipsis {-moz-text-overflow:ellipsis;text-overflow:ellipsis;}
|
||||
|
||||
/* Toolbar Search Menu */
|
||||
.ui-search-menu { position: absolute; padding: 2px 5px;}
|
||||
.ui-jqgrid .ui-search-table { padding: 0; border: 0 none; height:20px; width:100%;}
|
||||
.ui-jqgrid .ui-search-table .ui-search-oper { width:20px; }
|
||||
a.g-menu-item, a.soptclass, a.clearsearchclass { cursor: pointer; }
|
||||
.ui-jqgrid .ui-search-table .ui-search-input>input,
|
||||
.ui-jqgrid .ui-search-table .ui-search-input>select
|
||||
{
|
||||
display: block;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.ui-jqgrid .ui-jqgrid-view input,
|
||||
.ui-jqgrid .ui-jqgrid-view select,
|
||||
.ui-jqgrid .ui-jqgrid-view textarea,
|
||||
.ui-jqgrid .ui-jqgrid-view button {
|
||||
font-size: 11px
|
||||
}
|
||||
|
|
173
nar-bundles/monitor-threshold-bundle/ui/src/main/webapp/js/jquery/jqgrid/js/i18n/grid.locale-en.js
Executable file → Normal file
173
nar-bundles/monitor-threshold-bundle/ui/src/main/webapp/js/jquery/jqgrid/js/i18n/grid.locale-en.js
Executable file → Normal file
|
@ -1,5 +1,170 @@
|
|||
(function (a) {
|
||||
a.jgrid = {defaults: {recordtext: "View {0} - {1} of {2}", emptyrecords: "No records to view", loadtext: "Loading...", pgtext: "Page {0} of {1}"}, search: {caption: "Search...", Find: "Find", Reset: "Reset", odata: ["equal", "not equal", "less", "less or equal", "greater", "greater or equal", "begins with", "does not begin with", "is in", "is not in", "ends with", "does not end with", "contains", "does not contain"], groupOps: [{op: "AND", text: "all"}, {op: "OR", text: "any"}], matchText: " match", rulesText: " rules"}, edit: {addCaption: "Add Record", editCaption: "Edit Record", bSubmit: "Submit", bCancel: "Cancel", bClose: "Close", saveData: "Data has been changed! Save changes?", bYes: "Yes", bNo: "No", bExit: "Cancel", msg: {required: "Field is required", number: "Please, enter valid number", minValue: "value must be greater than or equal to ", maxValue: "value must be less than or equal to", email: "is not a valid e-mail", integer: "Please, enter valid integer value", date: "Please, enter valid date value", url: "is not a valid URL. Prefix required ('http://' or 'https://')", nodefined: " is not defined!", novalue: " return value is required!", customarray: "Custom function should return array!", customfcheck: "Custom function should be present in case of custom checking!"}}, view: {caption: "View Record", bClose: "Close"}, del: {caption: "Delete", msg: "Delete selected record(s)?", bSubmit: "Delete", bCancel: "Cancel"}, nav: {edittext: "", edittitle: "Edit selected row", addtext: "", addtitle: "Add new row", deltext: "", deltitle: "Delete selected row", searchtext: "", searchtitle: "Find records", refreshtext: "", refreshtitle: "Reload Grid", alertcap: "Warning", alerttext: "Please, select row", viewtext: "", viewtitle: "View selected row"}, col: {caption: "Select columns", bSubmit: "Ok", bCancel: "Cancel"}, errors: {errcap: "Error", nourl: "No url is set", norecords: "No records to process", model: "Length of colNames <> colModel!"}, formatter: {integer: {thousandsSeparator: " ", defaultValue: "0"}, number: {decimalSeparator: ".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: "0.00"}, currency: {decimalSeparator: ".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix: "", defaultValue: "0.00"}, date: {dayNames: ["Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], monthNames: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], AmPm: ["am", "pm", "AM", "PM"], S: function (b) {
|
||||
return b < 11 || b > 13 ? ["st", "nd", "rd", "th"][Math.min((b - 1) % 10, 3)] : "th"
|
||||
}, srcformat: "Y-m-d", newformat: "d/m/Y", masks: {ISO8601Long: "Y-m-d H:i:s", ISO8601Short: "Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y"}, reformatAfterEdit: false}, baseLinkUrl: "", showAction: "", target: "", checkbox: {disabled: true}, idName: "id"}}
|
||||
;(function($){
|
||||
/**
|
||||
* jqGrid English Translation
|
||||
* Tony Tomov tony@trirand.com
|
||||
* http://trirand.com/blog/
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
**/
|
||||
$.jgrid = $.jgrid || {};
|
||||
$.extend($.jgrid,{
|
||||
defaults : {
|
||||
recordtext: "View {0} - {1} of {2}",
|
||||
emptyrecords: "No records to view",
|
||||
loadtext: "Loading...",
|
||||
pgtext : "Page {0} of {1}"
|
||||
},
|
||||
search : {
|
||||
caption: "Search...",
|
||||
Find: "Find",
|
||||
Reset: "Reset",
|
||||
odata: [{ oper:'eq', text:'equal'},{ oper:'ne', text:'not equal'},{ oper:'lt', text:'less'},{ oper:'le', text:'less or equal'},{ oper:'gt', text:'greater'},{ oper:'ge', text:'greater or equal'},{ oper:'bw', text:'begins with'},{ oper:'bn', text:'does not begin with'},{ oper:'in', text:'is in'},{ oper:'ni', text:'is not in'},{ oper:'ew', text:'ends with'},{ oper:'en', text:'does not end with'},{ oper:'cn', text:'contains'},{ oper:'nc', text:'does not contain'},{ oper:'nu', text:'is null'},{ oper:'nn', text:'is not null'}],
|
||||
groupOps: [{ op: "AND", text: "all" },{ op: "OR", text: "any" }],
|
||||
operandTitle : "Click to select search operation.",
|
||||
resetTitle : "Reset Search Value"
|
||||
},
|
||||
edit : {
|
||||
addCaption: "Add Record",
|
||||
editCaption: "Edit Record",
|
||||
bSubmit: "Submit",
|
||||
bCancel: "Cancel",
|
||||
bClose: "Close",
|
||||
saveData: "Data has been changed! Save changes?",
|
||||
bYes : "Yes",
|
||||
bNo : "No",
|
||||
bExit : "Cancel",
|
||||
msg: {
|
||||
required:"Field is required",
|
||||
number:"Please, enter valid number",
|
||||
minValue:"value must be greater than or equal to ",
|
||||
maxValue:"value must be less than or equal to",
|
||||
email: "is not a valid e-mail",
|
||||
integer: "Please, enter valid integer value",
|
||||
date: "Please, enter valid date value",
|
||||
url: "is not a valid URL. Prefix required ('http://' or 'https://')",
|
||||
nodefined : " is not defined!",
|
||||
novalue : " return value is required!",
|
||||
customarray : "Custom function should return array!",
|
||||
customfcheck : "Custom function should be present in case of custom checking!"
|
||||
|
||||
}
|
||||
},
|
||||
view : {
|
||||
caption: "View Record",
|
||||
bClose: "Close"
|
||||
},
|
||||
del : {
|
||||
caption: "Delete",
|
||||
msg: "Delete selected record(s)?",
|
||||
bSubmit: "Delete",
|
||||
bCancel: "Cancel"
|
||||
},
|
||||
nav : {
|
||||
edittext: "",
|
||||
edittitle: "Edit selected row",
|
||||
addtext:"",
|
||||
addtitle: "Add new row",
|
||||
deltext: "",
|
||||
deltitle: "Delete selected row",
|
||||
searchtext: "",
|
||||
searchtitle: "Find records",
|
||||
refreshtext: "",
|
||||
refreshtitle: "Reload Grid",
|
||||
alertcap: "Warning",
|
||||
alerttext: "Please, select row",
|
||||
viewtext: "",
|
||||
viewtitle: "View selected row"
|
||||
},
|
||||
col : {
|
||||
caption: "Select columns",
|
||||
bSubmit: "Ok",
|
||||
bCancel: "Cancel"
|
||||
},
|
||||
errors : {
|
||||
errcap : "Error",
|
||||
nourl : "No url is set",
|
||||
norecords: "No records to process",
|
||||
model : "Length of colNames <> colModel!"
|
||||
},
|
||||
formatter : {
|
||||
integer : {thousandsSeparator: ",", defaultValue: '0'},
|
||||
number : {decimalSeparator:".", thousandsSeparator: ",", decimalPlaces: 2, defaultValue: '0.00'},
|
||||
currency : {decimalSeparator:".", thousandsSeparator: ",", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
|
||||
date : {
|
||||
dayNames: [
|
||||
"Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat",
|
||||
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
|
||||
],
|
||||
monthNames: [
|
||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
|
||||
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
|
||||
],
|
||||
AmPm : ["am","pm","AM","PM"],
|
||||
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th';},
|
||||
srcformat: 'Y-m-d',
|
||||
newformat: 'n/j/Y',
|
||||
parseRe : /[#%\\\/:_;.,\t\s-]/,
|
||||
masks : {
|
||||
// see http://php.net/manual/en/function.date.php for PHP format used in jqGrid
|
||||
// and see http://docs.jquery.com/UI/Datepicker/formatDate
|
||||
// and https://github.com/jquery/globalize#dates for alternative formats used frequently
|
||||
// one can find on https://github.com/jquery/globalize/tree/master/lib/cultures many
|
||||
// information about date, time, numbers and currency formats used in different countries
|
||||
// one should just convert the information in PHP format
|
||||
ISO8601Long:"Y-m-d H:i:s",
|
||||
ISO8601Short:"Y-m-d",
|
||||
// short date:
|
||||
// n - Numeric representation of a month, without leading zeros
|
||||
// j - Day of the month without leading zeros
|
||||
// Y - A full numeric representation of a year, 4 digits
|
||||
// example: 3/1/2012 which means 1 March 2012
|
||||
ShortDate: "n/j/Y", // in jQuery UI Datepicker: "M/d/yyyy"
|
||||
// long date:
|
||||
// l - A full textual representation of the day of the week
|
||||
// F - A full textual representation of a month
|
||||
// d - Day of the month, 2 digits with leading zeros
|
||||
// Y - A full numeric representation of a year, 4 digits
|
||||
LongDate: "l, F d, Y", // in jQuery UI Datepicker: "dddd, MMMM dd, yyyy"
|
||||
// long date with long time:
|
||||
// l - A full textual representation of the day of the week
|
||||
// F - A full textual representation of a month
|
||||
// d - Day of the month, 2 digits with leading zeros
|
||||
// Y - A full numeric representation of a year, 4 digits
|
||||
// g - 12-hour format of an hour without leading zeros
|
||||
// i - Minutes with leading zeros
|
||||
// s - Seconds, with leading zeros
|
||||
// A - Uppercase Ante meridiem and Post meridiem (AM or PM)
|
||||
FullDateTime: "l, F d, Y g:i:s A", // in jQuery UI Datepicker: "dddd, MMMM dd, yyyy h:mm:ss tt"
|
||||
// month day:
|
||||
// F - A full textual representation of a month
|
||||
// d - Day of the month, 2 digits with leading zeros
|
||||
MonthDay: "F d", // in jQuery UI Datepicker: "MMMM dd"
|
||||
// short time (without seconds)
|
||||
// g - 12-hour format of an hour without leading zeros
|
||||
// i - Minutes with leading zeros
|
||||
// A - Uppercase Ante meridiem and Post meridiem (AM or PM)
|
||||
ShortTime: "g:i A", // in jQuery UI Datepicker: "h:mm tt"
|
||||
// long time (with seconds)
|
||||
// g - 12-hour format of an hour without leading zeros
|
||||
// i - Minutes with leading zeros
|
||||
// s - Seconds, with leading zeros
|
||||
// A - Uppercase Ante meridiem and Post meridiem (AM or PM)
|
||||
LongTime: "g:i:s A", // in jQuery UI Datepicker: "h:mm:ss tt"
|
||||
SortableDateTime: "Y-m-d\\TH:i:s",
|
||||
UniversalSortableDateTime: "Y-m-d H:i:sO",
|
||||
// month with year
|
||||
// Y - A full numeric representation of a year, 4 digits
|
||||
// F - A full textual representation of a month
|
||||
YearMonth: "F, Y" // in jQuery UI Datepicker: "MMMM, yyyy"
|
||||
},
|
||||
reformatAfterEdit : false
|
||||
},
|
||||
baseLinkUrl: '',
|
||||
showAction: '',
|
||||
target: '',
|
||||
checkbox : {disabled:true},
|
||||
idName : 'id'
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
959
nar-bundles/monitor-threshold-bundle/ui/src/main/webapp/js/jquery/jqgrid/js/jquery.jqGrid.min.js
vendored
Executable file → Normal file
959
nar-bundles/monitor-threshold-bundle/ui/src/main/webapp/js/jquery/jqgrid/js/jquery.jqGrid.min.js
vendored
Executable file → Normal file
|
@ -1,416 +1,545 @@
|
|||
/*
|
||||
* jqGrid 3.6.5 - jQuery Grid
|
||||
* Copyright (c) 2008, Tony Tomov, tony@trirand.com
|
||||
* Dual licensed under the MIT and GPL licenses
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl-2.0.html
|
||||
* Date:2010-05-05
|
||||
* Modules: grid.base.js; jquery.fmatter.js; grid.custom.js; grid.common.js; grid.formedit.js; jquery.searchFilter.js; grid.inlinedit.js; grid.celledit.js; jqModal.js; jqDnR.js; grid.subgrid.js; grid.treegrid.js; grid.import.js; JsonXml.js; grid.setcolumns.js; grid.postext.js; grid.tbltogrid.js; grid.jqueryui.js;
|
||||
*/
|
||||
(function(b){b.jgrid = b.jgrid || {}; b.extend(b.jgrid, {htmlDecode:function(f){if (f == " " || f == " " || f.length == 1 && f.charCodeAt(0) == 160)return""; return!f?f:String(f).replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<").replace(/"/g, '"')}, htmlEncode:function(f){return!f?f:String(f).replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<").replace(/\"/g, """)}, format:function(f){var k = b.makeArray(arguments).slice(1); if (f === undefined)f = ""; return f.replace(/\{(\d+)\}/g, function(i,
|
||||
h){return k[h]})}, getCellIndex:function(f){f = b(f); f = (!f.is("td") && !f.is("th")?f.closest("td,th"):f)[0]; if (b.browser.msie)return b.inArray(f, f.parentNode.cells); return f.cellIndex}, stripHtml:function(f){f += ""; var k = /<("[^"]*"|'[^']*'|[^'">])*>/gi; if (f)return(f = f.replace(k, "")) && f !== " " && f !== " "?f.replace(/\"/g, "'"):""; else return f}, stringToDoc:function(f){var k; if (typeof f !== "string")return f; try{k = (new DOMParser).parseFromString(f, "text/xml")} catch (i){k = new ActiveXObject("Microsoft.XMLDOM");
|
||||
k.async = false; k.loadXML(f)}return k && k.documentElement && k.documentElement.tagName != "parsererror"?k:null}, parse:function(f){f = f; if (f.substr(0, 9) == "while(1);")f = f.substr(9); if (f.substr(0, 2) == "/*")f = f.substr(2, f.length - 4); f || (f = "{}"); return b.jgrid.useJSON === true && typeof JSON === "object" && typeof JSON.parse === "function"?JSON.parse(f):eval("(" + f + ")")}, jqID:function(f){f += ""; return f.replace(/([\.\:\[\]])/g, "\\$1")}, ajaxOptions:{}, extend:function(f){b.extend(b.fn.jqGrid, f); this.no_legacy_api || b.fn.extend(f)}});
|
||||
b.fn.jqGrid = function(f){if (typeof f == "string"){var k = b.fn.jqGrid[f]; if (!k)throw"jqGrid - No such method: " + f; var i = b.makeArray(arguments).slice(1); return k.apply(this, i)}return this.each(function(){if (!this.grid){var h = b.extend(true, {url:"", height:150, page:1, rowNum:20, records:0, pager:"", pgbuttons:true, pginput:true, colModel:[], rowList:[], colNames:[], sortorder:"asc", sortname:"", datatype:"xml", mtype:"GET", altRows:false, selarrrow:[], savedRow:[], shrinkToFit:true, xmlReader:{}, jsonReader:{}, subGrid:false,
|
||||
subGridModel:[], reccount:0, lastpage:0, lastsort:0, selrow:null, beforeSelectRow:null, onSelectRow:null, onSortCol:null, ondblClickRow:null, onRightClickRow:null, onPaging:null, onSelectAll:null, loadComplete:null, gridComplete:null, loadError:null, loadBeforeSend:null, afterInsertRow:null, beforeRequest:null, onHeaderClick:null, viewrecords:false, loadonce:false, multiselect:false, multikey:false, editurl:null, search:false, caption:"", hidegrid:true, hiddengrid:false, postData:{}, userData:{}, treeGrid:false, treeGridModel:"nested",
|
||||
treeReader:{}, treeANode: - 1, ExpandColumn:null, tree_root_level:0, prmNames:{page:"page", rows:"rows", sort:"sidx", order:"sord", search:"_search", nd:"nd", id:"id", oper:"oper", editoper:"edit", addoper:"add", deloper:"del", subgridid:"id", npage:null}, forceFit:false, gridstate:"visible", cellEdit:false, cellsubmit:"remote", nv:0, loadui:"enable", toolbar:[false, ""], scroll:false, multiboxonly:false, deselectAfterSort:true, scrollrows:false, autowidth:false, scrollOffset:18, cellLayout:5, subGridWidth:20, multiselectWidth:20,
|
||||
gridview:false, rownumWidth:25, rownumbers:false, pagerpos:"center", recordpos:"right", footerrow:false, userDataOnFooter:false, hoverrows:true, altclass:"ui-priority-secondary", viewsortcols:[false, "vertical", true], resizeclass:"", autoencode:false, remapColumns:[], ajaxGridOptions:{}, direction:"ltr", toppager:false, headertitles:false, scrollTimeout:200}, b.jgrid.defaults, f || {}), g = {headers:[], cols:[], footers:[], dragStart:function(c, d, e){this.resizing = {idx:c, startX:d.clientX, sOL:e[0]}; this.hDiv.style.cursor = "col-resize";
|
||||
this.curGbox = b("#rs_m" + h.id, "#gbox_" + h.id); this.curGbox.css({display:"block", left:e[0], top:e[1], height:e[2]}); b.isFunction(h.resizeStart) && h.resizeStart.call(this, d, c); document.onselectstart = function(){return false}}, dragMove:function(c){if (this.resizing){var d = c.clientX - this.resizing.startX; c = this.headers[this.resizing.idx]; var e = h.direction === "ltr"?c.width + d:c.width - d, l; if (e > 33){this.curGbox.css({left:this.resizing.sOL + d}); if (h.forceFit === true){l = this.headers[this.resizing.idx + h.nv]; d = h.direction ===
|
||||
"ltr"?l.width - d:l.width + d; if (d > 33){c.newWidth = e; l.newWidth = d}} else{this.newWidth = h.direction === "ltr"?h.tblwidth + d:h.tblwidth - d; c.newWidth = e}}}}, dragEnd:function(){this.hDiv.style.cursor = "default"; if (this.resizing){var c = this.resizing.idx, d = this.headers[c].newWidth || this.headers[c].width; d = parseInt(d, 10); this.resizing = false; b("#rs_m" + h.id).css("display", "none"); h.colModel[c].width = d; this.headers[c].width = d; this.headers[c].el.style.width = d + "px"; if (this.cols.length > 0)this.cols[c].style.width = d + "px";
|
||||
if (this.footers.length > 0)this.footers[c].style.width = d + "px"; if (h.forceFit === true){d = this.headers[c + h.nv].newWidth || this.headers[c + h.nv].width; this.headers[c + h.nv].width = d; this.headers[c + h.nv].el.style.width = d + "px"; if (this.cols.length > 0)this.cols[c + h.nv].style.width = d + "px"; if (this.footers.length > 0)this.footers[c + h.nv].style.width = d + "px"; h.colModel[c + h.nv].width = d} else{h.tblwidth = this.newWidth || h.tblwidth; b("table:first", this.bDiv).css("width", h.tblwidth + "px"); b("table:first", this.hDiv).css("width",
|
||||
h.tblwidth + "px"); this.hDiv.scrollLeft = this.bDiv.scrollLeft; if (h.footerrow){b("table:first", this.sDiv).css("width", h.tblwidth + "px"); this.sDiv.scrollLeft = this.bDiv.scrollLeft}}b.isFunction(h.resizeStop) && h.resizeStop.call(this, d, c)}this.curGbox = null; document.onselectstart = function(){return true}}, populateVisible:function(){g.timer && clearTimeout(g.timer); g.timer = null; var c = b(g.bDiv).height(); if (c){var d = b("table:first", g.bDiv), e = b("> tbody > tr:visible:first", d).outerHeight() || g.prevRowHeight; if (e){g.prevRowHeight =
|
||||
e; var l = h.rowNum, n = g.scrollTop = g.bDiv.scrollTop, o = Math.round(d.position().top) - n, p = o + d.height(); e = e * l; var w, y, s; if (o <= 0 && (h.lastpage === undefined || parseInt((p + n + e - 1) / e, 10) <= h.lastpage)){y = parseInt((c - p + e - 1) / e, 10); if (p >= 0 || y < 2 || h.scroll === true){w = Math.round((p + n) / e) + 1; o = - 1} else o = 1}if (o > 0){w = parseInt(n / e, 10) + 1; y = parseInt((n + c) / e, 10) + 2 - w; s = true}if (y)if (!(h.lastpage && w > h.lastpage))if (g.hDiv.loading)g.timer = setTimeout(g.populateVisible, h.scrollTimeout); else{h.page = w; if (s){g.selectionPreserver(d[0]); g.emptyRows(g.bDiv,
|
||||
false)}g.populate(y)}}}}, scrollGrid:function(){if (h.scroll){var c = g.bDiv.scrollTop; if (c != g.scrollTop){g.scrollTop = c; g.timer && clearTimeout(g.timer); g.timer = setTimeout(g.populateVisible, 200)}}g.hDiv.scrollLeft = g.bDiv.scrollLeft; if (h.footerrow)g.sDiv.scrollLeft = g.bDiv.scrollLeft}, selectionPreserver:function(c){var d = c.p, e = d.selrow, l = d.selarrrow?b.makeArray(d.selarrrow):null, n = c.grid.bDiv.scrollLeft, o = d.gridComplete; d.gridComplete = function(){d.selrow = null; d.selarrrow = []; if (d.multiselect && l && l.length >
|
||||
0)for (var p = 0; p < l.length; p++)l[p] != e && b(c).jqGrid("setSelection", l[p], false); e && b(c).jqGrid("setSelection", e, false); c.grid.bDiv.scrollLeft = n; d.gridComplete = o; d.gridComplete && o()}}}; this.p = h; var j, m, a; if (this.p.colNames.length === 0)for (j = 0; j < this.p.colModel.length; j++)this.p.colNames[j] = this.p.colModel[j].label || this.p.colModel[j].name; if (this.p.colNames.length !== this.p.colModel.length)alert(b.jgrid.errors.model); else{var q = b("<div class='ui-jqgrid-view'></div>"), t, x = b.browser.msie?true:false, C = b.browser.safari?
|
||||
true:false; a = this; a.p.direction = b.trim(a.p.direction.toLowerCase()); if (b.inArray(a.p.direction, ["ltr", "rtl"]) == - 1)a.p.direction = "ltr"; m = a.p.direction; b(q).insertBefore(this); b(this).appendTo(q).removeClass("scroll"); var K = b("<div class='ui-jqgrid ui-widget ui-widget-content ui-corner-all'></div>"); b(K).insertBefore(q).attr({id:"gbox_" + this.id, dir:m}); b(q).appendTo(K).attr("id", "gview_" + this.id); t = x && b.browser.version <= 6?'<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>':
|
||||
""; b("<div class='ui-widget-overlay jqgrid-overlay' id='lui_" + this.id + "'></div>").append(t).insertBefore(q); b("<div class='loading ui-state-default ui-state-active' id='load_" + this.id + "'>" + this.p.loadtext + "</div>").insertBefore(q); b(this).attr({cellSpacing:"0", cellPadding:"0", border:"0", role:"grid", "aria-multiselectable":!!this.p.multiselect, "aria-labelledby":"gbox_" + this.id}); var J = function(c, d){c = parseInt(c, 10); return isNaN(c)?d?d:0:c}, F = function(c, d, e){var l = a.p.colModel[c], n = l.align, o = 'style="',
|
||||
p = l.classes, w = l.name; if (n)o += "text-align:" + n + ";"; if (l.hidden === true)o += "display:none;"; if (d === 0)o += "width: " + g.headers[c].width + "px;"; o += '"' + (p !== undefined?' class="' + p + '"':"") + (l.title && e?' title="' + b.jgrid.stripHtml(e) + '"':""); o += ' aria-describedby="' + a.p.id + "_" + w + '"'; return o}, Q = function(c){return c === undefined || c === null || c === ""?" ":a.p.autoencode?b.jgrid.htmlEncode(c):c + ""}, M = function(c, d, e, l, n){e = a.p.colModel[e]; if (typeof e.formatter !== "undefined"){c = {rowId:c, colModel:e, gid:a.p.id}; d = b.isFunction(e.formatter)?
|
||||
e.formatter.call(a, d, c, l, n):b.fmatter?b.fn.fmatter(e.formatter, d, c, l, n):Q(d)} else d = Q(d); return d}, R = function(c, d, e, l, n){c = M(c, d, e, n, "add"); return'<td role="gridcell" ' + F(e, l, c) + ">" + c + "</td>"}, u = function(c, d, e){c = '<input role="checkbox" type="checkbox" id="jqg_' + c + '" class="cbox" name="jqg_' + c + '"/>'; d = F(d, e, ""); return'<td role="gridcell" aria-describedby="' + a.p.id + '_cb" ' + d + ">" + c + "</td>"}, la = function(c, d, e, l){e = (parseInt(e, 10) - 1) * parseInt(l, 10) + 1 + d; c = F(c, d, ""); return'<td role="gridcell" aria-describedby="' +
|
||||
a.p.id + '_rn" class="ui-state-default jqgrid-rownum" ' + c + ">" + e + "</td>"}, ca = function(c){var d, e = [], l = 0, n; for (n = 0; n < a.p.colModel.length; n++){d = a.p.colModel[n]; if (d.name !== "cb" && d.name !== "subgrid" && d.name !== "rn"){e[l] = c == "xml"?d.xmlmap || d.name:d.jsonmap || d.name; l++}}return e}, fa = function(c){var d = a.p.remapColumns; if (!d || !d.length)d = b.map(a.p.colModel, function(e, l){return l}); if (c)d = b.map(d, function(e){return e < c?null:e - c}); return d}, aa = function(c, d){a.p.deepempty?b("tbody:first tr", c).remove():b("tbody:first",
|
||||
c).empty(); if (d && a.p.scroll){b(">div:first", c).css({height:"auto"}).children("div:first").css({height:0, display:"none"}); c.scrollTop = 0}}, U = function(c, d){var e, l, n, o; if (typeof d === "function")return d(c); e = c[d]; if (e === undefined){if (typeof d === "string")n = d.split("."); try{if (o = n.length)for (e = c; e && o--; ){l = n.shift(); e = e[l]}} catch (p){}}return e}, ia = function(c, d, e, l, n){var o = new Date; a.p.reccount = 0; if (b.isXMLDoc(c)){if (a.p.treeANode === - 1 && !a.p.scroll){aa(d, false); e = 0} else e = e > 0?e:0; var p, w = 0, y, s, r = 0, v = 0,
|
||||
z = 0, D, N, L = [], P, G = {}, da = a.rows.length, E, W, B = [], S = 0, ga = a.p.altRows === true?" " + a.p.altclass:""; a.p.xmlReader.repeatitems || (L = ca("xml")); D = a.p.keyIndex === false?a.p.xmlReader.id:a.p.keyIndex; if (L.length > 0 && !isNaN(D)){if (a.p.remapColumns && a.p.remapColumns.length)D = b.inArray(D, a.p.remapColumns); D = L[D]}N = (D + "").indexOf("[") === - 1?L.length?function(X, V){return b(D, X).text() || V}:function(X, V){return b(a.p.xmlReader.cell, X).eq(D).text() || V}:function(X, V){return X.getAttribute(D.replace(/[\[\]]/g, "")) || V}; a.p.userData =
|
||||
{}; b(a.p.xmlReader.page, c).each(function(){a.p.page = this.textContent || this.text || 0}); b(a.p.xmlReader.total, c).each(function(){a.p.lastpage = this.textContent || this.text; if (a.p.lastpage === undefined)a.p.lastpage = 1}); b(a.p.xmlReader.records, c).each(function(){a.p.records = this.textContent || this.text || 0}); b(a.p.xmlReader.userdata, c).each(function(){a.p.userData[this.getAttribute("name")] = this.textContent || this.text}); c = b(a.p.xmlReader.root + " " + a.p.xmlReader.row, c); var ha = c.length, O = 0; if (c && ha){var ma = parseInt(a.p.rowNum,
|
||||
10), wa = a.p.scroll?(parseInt(a.p.page, 10) - 1) * ma + 1:1; if (n)ma *= n + 1; for (n = b.isFunction(a.p.afterInsertRow); O < ha; ){E = c[O]; W = N(E, wa + O); p = e === 0?0:e + 1; p = (p + O) % 2 == 1?ga:""; B[S++] = '<tr id="' + W + '" role="row" class ="ui-widget-content jqgrow ui-row-' + a.p.direction + "" + p + '">'; if (a.p.rownumbers === true){B[S++] = la(0, O, a.p.page, a.p.rowNum); z = 1}if (a.p.multiselect === true){B[S++] = u(W, z, O); r = 1}if (a.p.subGrid === true){B[S++] = b(a).jqGrid("addSubGridCell", r + z, O + e); v = 1}if (a.p.xmlReader.repeatitems){P || (P = fa(r + v + z)); var za = b(a.p.xmlReader.cell,
|
||||
E); b.each(P, function(X){var V = za[this]; if (!V)return false; y = V.textContent || V.text; G[a.p.colModel[X + r + v + z].name] = y; B[S++] = R(W, y, X + r + v + z, O + e, E)})} else for (p = 0; p < L.length; p++){y = b(L[p], E).text(); G[a.p.colModel[p + r + v + z].name] = y; B[S++] = R(W, y, p + r + v + z, O + e, E)}B[S++] = "</tr>"; if (a.p.gridview === false){if (a.p.treeGrid === true){p = a.p.treeANode >= - 1?a.p.treeANode:0; s = b(B.join(""))[0]; try{b(a).jqGrid("setTreeNode", G, s)} catch (Fa){}da === 0?b("tbody:first", d).append(s):b(a.rows[O + p + e]).after(s)} else b("tbody:first", d).append(B.join(""));
|
||||
if (a.p.subGrid === true)try{b(a).jqGrid("addSubGrid", a.rows[a.rows.length - 1], r + z)} catch (Ga){}n && a.p.afterInsertRow.call(a, W, G, E); B = []; S = 0}G = {}; w++; O++; if (w == ma)break}}a.p.gridview === true && b("tbody:first", d).append(B.join("")); a.p.totaltime = new Date - o; if (w > 0){a.grid.cols = a.rows[0].cells; if (a.p.records === 0)a.p.records = ha}B = null; if (!a.p.treeGrid && !a.p.scroll)a.grid.bDiv.scrollTop = 0; a.p.reccount = w; a.p.treeANode = - 1; a.p.userDataOnFooter && b(a).jqGrid("footerData", "set", a.p.userData, true); l || na(false, true)}},
|
||||
ra = function(c, d, e, l, n){var o = new Date; a.p.reccount = 0; if (c){if (a.p.treeANode === - 1 && !a.p.scroll){aa(d, false); e = 0} else e = e > 0?e:0; var p = 0, w, y, s, r = [], v, z = 0, D = 0, N = 0, L, P, G, da = {}, E, W = a.rows.length, B; s = []; E = 0; var S = a.p.altRows === true?" " + a.p.altclass:""; a.p.page = U(c, a.p.jsonReader.page) || 0; G = U(c, a.p.jsonReader.total); a.p.lastpage = G === undefined?1:G; a.p.records = U(c, a.p.jsonReader.records) || 0; a.p.userData = U(c, a.p.jsonReader.userdata) || {}; a.p.jsonReader.repeatitems || (v = r = ca("json")); G = a.p.keyIndex === false?a.p.jsonReader.id:
|
||||
a.p.keyIndex; if (r.length > 0 && !isNaN(G)){if (a.p.remapColumns && a.p.remapColumns.length)G = b.inArray(G, a.p.remapColumns); G = r[G]}if (P = U(c, a.p.jsonReader.root)){L = P.length; c = 0; var ga = parseInt(a.p.rowNum, 10), ha = a.p.scroll?(parseInt(a.p.page, 10) - 1) * ga + 1:1; if (n)ga *= n + 1; for (var O = b.isFunction(a.p.afterInsertRow); c < L; ){n = P[c]; B = U(n, G); if (B === undefined){B = ha + c; if (r.length === 0)if (a.p.jsonReader.cell)B = n[a.p.jsonReader.cell][G] || B}w = e === 0?0:e + 1; w = (w + c) % 2 == 1?S:""; s[E++] = '<tr id="' + B + '" role="row" class= "ui-widget-content jqgrow ui-row-' +
|
||||
a.p.direction + "" + w + '">'; if (a.p.rownumbers === true){s[E++] = la(0, c, a.p.page, a.p.rowNum); N = 1}if (a.p.multiselect){s[E++] = u(B, N, c); z = 1}if (a.p.subGrid){s[E++] = b(a).jqGrid("addSubGridCell", z + N, c + e); D = 1}if (a.p.jsonReader.repeatitems){if (a.p.jsonReader.cell)n = U(n, a.p.jsonReader.cell); v || (v = fa(z + D + N))}for (y = 0; y < v.length; y++){w = U(n, v[y]); s[E++] = R(B, w, y + z + D + N, c + e, n); da[a.p.colModel[y + z + D + N].name] = w}s[E++] = "</tr>"; if (a.p.gridview === false){if (a.p.treeGrid === true){E = a.p.treeANode >= - 1?a.p.treeANode:0; s = b(s.join(""))[0];
|
||||
try{b(a).jqGrid("setTreeNode", da, s)} catch (ma){}W === 0?b("tbody:first", d).append(s):b(a.rows[c + E + e]).after(s)} else b("tbody:first", d).append(s.join("")); if (a.p.subGrid === true)try{b(a).jqGrid("addSubGrid", a.rows[a.rows.length - 1], z + N)} catch (wa){}O && a.p.afterInsertRow.call(a, B, da, n); s = []; E = 0}da = {}; p++; c++; if (p == ga)break}a.p.gridview === true && b("tbody:first", d).append(s.join("")); a.p.totaltime = new Date - o; if (p > 0){a.grid.cols = a.rows[0].cells; if (a.p.records === 0)a.p.records = L}}if (!a.p.treeGrid && !a.p.scroll)a.grid.bDiv.scrollTop =
|
||||
0; a.p.reccount = p; a.p.treeANode = - 1; a.p.userDataOnFooter && b(a).jqGrid("footerData", "set", a.p.userData, true); l || na(false, true)}}, na = function(c, d){var e, l, n, o, p, w, y, s = ""; n = parseInt(a.p.page, 10) - 1; if (n < 0)n = 0; n *= parseInt(a.p.rowNum, 10); p = n + a.p.reccount; if (a.p.scroll){e = b("tbody:first > tr", a.grid.bDiv); n = p - e.length; if (l = e.outerHeight()){e = n * l; l = parseInt(a.p.records, 10) * l; b(">div:first", a.grid.bDiv).css({height:l}).children("div:first").css({height:e, display:e?"":"none"})}}s = a.p.pager?a.p.pager:""; s += a.p.toppager?
|
||||
s?"," + a.p.toppager:a.p.toppager:""; if (s){y = b.jgrid.formatter.integer || {}; if (a.p.loadonce){e = l = 1; a.p.lastpage = a.page = 1; b(".selbox", s).attr("disabled", true)} else{e = J(a.p.page); l = J(a.p.lastpage); b(".selbox", s).attr("disabled", false)}if (a.p.pginput === true){b(".ui-pg-input", s).val(a.p.page); b("#sp_1", s).html(b.fmatter?b.fmatter.util.NumberFormat(a.p.lastpage, y):a.p.lastpage)}if (a.p.viewrecords)if (a.p.reccount === 0)b(".ui-paging-info", s).html(a.p.emptyrecords); else{o = n + 1; w = a.p.records; if (b.fmatter){o = b.fmatter.util.NumberFormat(o,
|
||||
y); p = b.fmatter.util.NumberFormat(p, y); w = b.fmatter.util.NumberFormat(w, y)}b(".ui-paging-info", s).html(b.jgrid.format(a.p.recordtext, o, p, w))}if (a.p.pgbuttons === true){if (e <= 0)e = l = 0; if (e == 1 || e === 0){b("#first, #prev", a.p.pager).addClass("ui-state-disabled").removeClass("ui-state-hover"); a.p.toppager && b("#first_t, #prev_t", a.p.toppager).addClass("ui-state-disabled").removeClass("ui-state-hover")} else{b("#first, #prev", a.p.pager).removeClass("ui-state-disabled"); a.p.toppager && b("#first_t, #prev_t", a.p.toppager).removeClass("ui-state-disabled")}if (e ==
|
||||
l || e === 0){b("#next, #last", a.p.pager).addClass("ui-state-disabled").removeClass("ui-state-hover"); a.p.toppager && b("#next_t, #last_t", a.p.toppager).addClass("ui-state-disabled").removeClass("ui-state-hover")} else{b("#next, #last", a.p.pager).removeClass("ui-state-disabled"); a.p.toppager && b("#next_t, #last_t", a.p.toppager).removeClass("ui-state-disabled")}}}c === true && a.p.rownumbers === true && b("td.jqgrid-rownum", a.rows).each(function(r){b(this).html(n + 1 + r)}); d && a.p.jqgdnd && b(a).jqGrid("gridDnD", "updateDnD");
|
||||
b.isFunction(a.p.gridComplete) && a.p.gridComplete.call(a)}, Y = function(c){if (!a.grid.hDiv.loading){var d = a.p.scroll && c === false, e = {}, l, n = a.p.prmNames; if (a.p.page <= 0)a.p.page = 1; if (n.search !== null)e[n.search] = a.p.search; if (n.nd !== null)e[n.nd] = (new Date).getTime(); if (n.rows !== null)e[n.rows] = a.p.rowNum; if (n.page !== null)e[n.page] = a.p.page; if (n.sort !== null)e[n.sort] = a.p.sortname; if (n.order !== null)e[n.order] = a.p.sortorder; var o = a.p.loadComplete, p = b.isFunction(o); p || (o = null); var w = 0; c = c || 1; if (c > 1)if (n.npage !==
|
||||
null){e[n.npage] = c; w = c - 1; c = 1} else o = function(s){p && a.p.loadComplete.call(a, s); a.grid.hDiv.loading = false; a.p.page++; Y(c - 1)}; else n.npage !== null && delete a.p.postData[n.npage]; b.extend(a.p.postData, e); var y = !a.p.scroll?0:a.rows.length - 1; if (b.isFunction(a.p.datatype))a.p.datatype.call(a, a.p.postData, "load_" + a.p.id); else{b.isFunction(a.p.beforeRequest) && a.p.beforeRequest.call(a); l = a.p.datatype.toLowerCase(); switch (l){case "json":case "jsonp":case "xml":case "script":b.ajax(b.extend({url:a.p.url, type:a.p.mtype,
|
||||
dataType:l, data:b.isFunction(a.p.serializeGridData)?a.p.serializeGridData.call(a, a.p.postData):a.p.postData, success:function(s){l === "xml"?ia(s, a.grid.bDiv, y, c > 1, w):ra(s, a.grid.bDiv, y, c > 1, w); o && o.call(a, s); d && a.grid.populateVisible(); if (a.p.loadonce || a.p.treeGrid)a.p.datatype = "local"; ja()}, error:function(s, r, v){b.isFunction(a.p.loadError) && a.p.loadError.call(a, s, r, v); ja()}, beforeSend:function(s){oa(); b.isFunction(a.p.loadBeforeSend) && a.p.loadBeforeSend.call(a, s)}}, b.jgrid.ajaxOptions, a.p.ajaxGridOptions));
|
||||
break; case "xmlstring":oa(); e = b.jgrid.stringToDoc(a.p.datastr); p && a.p.loadComplete.call(a, e); ia(e, a.grid.bDiv); a.p.datatype = "local"; a.p.datastr = null; ja(); break; case "jsonstring":oa(); e = typeof a.p.datastr == "string"?b.jgrid.parse(a.p.datastr):a.p.datastr; p && a.p.loadComplete.call(a, e); ra(e, a.grid.bDiv); a.p.datatype = "local"; a.p.datastr = null; ja(); break; case "local":case "clientside":oa(); a.p.datatype = "local"; p && a.p.loadComplete.call(a, ""); Aa(); na(true, true); ja(); break}}}}, oa = function(){a.grid.hDiv.loading =
|
||||
true; if (!a.p.hiddengrid)switch (a.p.loadui){case "disable":break; case "enable":b("#load_" + a.p.id).show(); break; case "block":b("#lui_" + a.p.id).show(); b("#load_" + a.p.id).show(); break}}, ja = function(){a.grid.hDiv.loading = false; switch (a.p.loadui){case "disable":break; case "enable":b("#load_" + a.p.id).hide(); break; case "block":b("#lui_" + a.p.id).hide(); b("#load_" + a.p.id).hide(); break}}, Aa = function(){var c = /[\$,%]/g, d = [], e = 0, l, n, o, p = a.p.sortorder == "asc"?1: - 1, w = false, y; b.each(a.p.colModel, function(r){if (this.index ==
|
||||
a.p.sortname || this.name == a.p.sortname){if (a.p.lastsort == r)w = true; e = r; l = this.sorttype; return false}}); o = l == "float" || l == "number" || l == "currency"?function(r){r = parseFloat(r.replace(c, "")); return isNaN(r)?0:r}:l == "int" || l == "integer"?function(r){return J(r.replace(c, ""), 0)}:l == "date" || l == "datetime"?function(r){return Ba(a.p.colModel[e].datefmt || "Y-m-d", r).getTime()}:b.isFunction(l)?l:function(r){return b.trim(r.toUpperCase())}; y = a.p.colModel[e]; b.each(a.rows, function(r, v){try{n = b.unformat(b(v).children("td").eq(e),
|
||||
{rowId:v.id, colModel:y}, e, true)} catch (z){n = b(v).children("td").eq(e).text()}v.sortKey = o(n); d[r] = this}); if (a.p.treeGrid)b(a).jqGrid("SortTree", p); else{w?d.reverse():d.sort(function(r, v){if (r.sortKey < v.sortKey)return - p; if (r.sortKey > v.sortKey)return p; return 0}); if (d[0]){b("td", d[0]).each(function(r){b(this).css("width", g.headers[r].width + "px")}); a.grid.cols = d[0].cells}var s = ""; if (a.p.altRows)s = a.p.altclass; b.each(d, function(r, v){if (s)r % 2 == 1?b(v).addClass(s):b(v).removeClass(s); b("tbody", a.grid.bDiv).append(v);
|
||||
v.sortKey = null})}a.grid.bDiv.scrollTop = 0}, Ba = function(c, d){var e = {m:1, d:1, y:1970, h:0, i:0, s:0}, l, n, o; if (d = b.trim(d)){d = d.split(/[\\\/:_;.\t\T\s-]/); c = c.split(/[\\\/:_;.\t\T\s-]/); var p = b.jgrid.formatter.date.monthNames, w = b.jgrid.formatter.date.AmPm, y = function(s, r){if (s === 0){if (r == 12)r = 0} else if (r != 12)r += 12; return r}; l = 0; for (n = c.length; l < n; l++){if (c[l] == "M"){o = b.inArray(d[l], p); if (o !== - 1 && o < 12)d[l] = o + 1}if (c[l] == "F"){o = b.inArray(d[l], p); if (o !== - 1 && o > 11)d[l] = o + 1 - 12}if (c[l] == "a"){o = b.inArray(d[l], w); if (o !==
|
||||
- 1 && o < 2 && d[l] == w[o]){d[l] = o; e.h = y(d[l], e.h)}}if (c[l] == "A"){o = b.inArray(d[l], w); if (o !== - 1 && o > 1 && d[l] == w[o]){d[l] = o - 2; e.h = y(d[l], e.h)}}e[c[l].toLowerCase()] = parseInt(d[l], 10)}e.m = parseInt(e.m, 10) - 1; c = e.y; if (c >= 70 && c <= 99)e.y = 1900 + e.y; else if (c >= 0 && c <= 69)e.y = 2E3 + e.y}return new Date(e.y, e.m, e.d, e.h, e.i, e.s, 0)}; t = function(c, d){var e = "", l = "<table cellspacing='0' cellpadding='0' border='0' style='table-layout:auto;' class='ui-pg-table'><tbody><tr>", n = "", o, p, w, y, s = function(r){var v; if (b.isFunction(a.p.onPaging))v =
|
||||
a.p.onPaging.call(a, r); a.p.selrow = null; if (a.p.multiselect){a.p.selarrrow = []; b("#cb_" + b.jgrid.jqID(a.p.id), a.grid.hDiv).attr("checked", false)}a.p.savedRow = []; if (v == "stop")return false; return true}; c = c.substr(1); o = "pg_" + c; p = c + "_left"; w = c + "_center"; y = c + "_right"; b("#" + c).append("<div id='" + o + "' class='ui-pager-control' role='group'><table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table' style='width:100%;table-layout:fixed;' role='row'><tbody><tr><td id='" + p + "' align='left'></td><td id='" +
|
||||
w + "' align='center' style='white-space:pre;'></td><td id='" + y + "' align='right'></td></tr></tbody></table></div>").attr("dir", "ltr"); if (a.p.rowList.length > 0){n = "<td dir='" + m + "'>"; n += "<select class='ui-pg-selbox' role='listbox'>"; for (p = 0; p < a.p.rowList.length; p++)n += "<option role='option' value='" + a.p.rowList[p] + "'" + (a.p.rowNum == a.p.rowList[p]?" selected":"") + ">" + a.p.rowList[p] + "</option>"; n += "</select></td>"}if (m == "rtl")l += n; if (a.p.pginput === true)e = "<td dir='" + m + "'>" + b.jgrid.format(a.p.pgtext || "", "<input class='ui-pg-input' type='text' size='2' maxlength='7' value='0' role='textbox'/>",
|
||||
"<span id='sp_1'></span>") + "</td>"; if (a.p.pgbuttons === true){p = ["first" + d, "prev" + d, "next" + d, "last" + d]; m == "rtl" && p.reverse(); l += "<td id='" + p[0] + "' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-first'></span></td>"; l += "<td id='" + p[1] + "' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-prev'></span></td>"; l += e != ""?"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>" + e + "<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>":
|
||||
""; l += "<td id='" + p[2] + "' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-next'></span></td>"; l += "<td id='" + p[3] + "' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-end'></span></td>"} else if (e != "")l += e; if (m == "ltr")l += n; l += "</tr></tbody></table>"; a.p.viewrecords === true && b("td#" + c + "_" + a.p.recordpos, "#" + o).append("<div dir='" + m + "' style='text-align:" + a.p.recordpos + "' class='ui-paging-info'></div>"); b("td#" + c + "_" + a.p.pagerpos, "#" + o).append(l); n = b(".ui-jqgrid").css("font-size") ||
|
||||
"11px"; b("body").append("<div id='testpg' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:" + n + ";visibility:hidden;' ></div>"); l = b(l).clone().appendTo("#testpg").width(); b("#testpg").remove(); if (l > 0){if (e != "")l += 50; b("td#" + c + "_" + a.p.pagerpos, "#" + o).width(l)}a.p._nvtd = []; a.p._nvtd[0] = l?Math.floor((a.p.width - l) / 2):Math.floor(a.p.width / 3); a.p._nvtd[1] = 0; l = null; b(".ui-pg-selbox", "#" + o).bind("change", function(){a.p.page = Math.round(a.p.rowNum * (a.p.page - 1) / this.value - 0.5) + 1; a.p.rowNum = this.value;
|
||||
if (d)b(".ui-pg-selbox", a.p.pager).val(this.value); else a.p.toppager && b(".ui-pg-selbox", a.p.toppager).val(this.value); if (!s("records"))return false; Y(); return false}); if (a.p.pgbuttons === true){b(".ui-pg-button", "#" + o).hover(function(){if (b(this).hasClass("ui-state-disabled"))this.style.cursor = "default"; else{b(this).addClass("ui-state-hover"); this.style.cursor = "pointer"}}, function(){if (!b(this).hasClass("ui-state-disabled")){b(this).removeClass("ui-state-hover"); this.style.cursor = "default"}}); b("#first" +
|
||||
d + ", #prev" + d + ", #next" + d + ", #last" + d, "#" + c).click(function(){var r = J(a.p.page, 1), v = J(a.p.lastpage, 1), z = false, D = true, N = true, L = true, P = true; if (v === 0 || v === 1)P = L = N = D = false; else if (v > 1 && r >= 1)if (r === 1)N = D = false; else{if (!(r > 1 && r < v))if (r === v)P = L = false} else if (v > 1 && r === 0){P = L = false; r = v - 1}if (this.id === "first" + d && D){a.p.page = 1; z = true}if (this.id === "prev" + d && N){a.p.page = r - 1; z = true}if (this.id === "next" + d && L){a.p.page = r + 1; z = true}if (this.id === "last" + d && P){a.p.page = v; z = true}if (z){if (!s(this.id))return false; Y()}return false})}a.p.pginput ===
|
||||
true && b("input.ui-pg-input", "#" + o).keypress(function(r){if ((r.charCode?r.charCode:r.keyCode?r.keyCode:0) == 13){a.p.page = b(this).val() > 0?b(this).val():a.p.page; if (!s("user"))return false; Y(); return false}return this})}; var xa = function(c, d, e, l){if (a.p.colModel[d].sortable)if (!(a.p.savedRow.length > 0)){if (!e){if (a.p.lastsort == d)if (a.p.sortorder == "asc")a.p.sortorder = "desc"; else{if (a.p.sortorder == "desc")a.p.sortorder = "asc"} else a.p.sortorder = a.p.colModel[d].firstsortorder || "asc"; a.p.page = 1}if (l)if (a.p.lastsort ==
|
||||
d && a.p.sortorder == l && !e)return; else a.p.sortorder = l; e = b("thead:first", a.grid.hDiv).get(0); b("tr th:eq(" + a.p.lastsort + ") span.ui-grid-ico-sort", e).addClass("ui-state-disabled"); b("tr th:eq(" + a.p.lastsort + ")", e).attr("aria-selected", "false"); b("tr th:eq(" + d + ") span.ui-icon-" + a.p.sortorder, e).removeClass("ui-state-disabled"); b("tr th:eq(" + d + ")", e).attr("aria-selected", "true"); if (!a.p.viewsortcols[0])if (a.p.lastsort != d){b("tr th:eq(" + a.p.lastsort + ") span.s-ico", e).hide(); b("tr th:eq(" + d + ") span.s-ico",
|
||||
e).show()}c = c.substring(5); a.p.sortname = a.p.colModel[d].index || c; e = a.p.sortorder; if (b.isFunction(a.p.onSortCol))if (a.p.onSortCol.call(a, c, d, e) == "stop"){a.p.lastsort = d; return}if (a.p.datatype == "local")a.p.deselectAfterSort && b(a).jqGrid("resetSelection"); else{a.p.selrow = null; a.p.multiselect && b("#cb_" + b.jgrid.jqID(a.p.id), a.grid.hDiv).attr("checked", false); a.p.selarrrow = []; a.p.savedRow = []; a.p.scroll && aa(a.grid.bDiv, true)}a.p.subGrid && a.p.datatype == "local" && b("td.sgexpanded", "#" + a.p.id).each(function(){b(this).trigger("click")});
|
||||
Y(); a.p.lastsort = d; if (a.p.sortname != c && d)a.p.lastsort = d}}, Ca = function(c){var d = c, e; for (e = c + 1; e < a.p.colModel.length; e++)if (a.p.colModel[e].hidden !== true){d = e; break}return d - c}, Da = function(c){var d, e = {}, l = C?0:a.p.cellLayout; for (d = e[0] = e[1] = e[2] = 0; d <= c; d++)if (a.p.colModel[d].hidden === false)e[0] += a.p.colModel[d].width + l; if (a.p.direction == "rtl")e[0] = a.p.width - e[0]; e[0] -= a.grid.bDiv.scrollLeft; if (b(a.grid.cDiv).is(":visible"))e[1] += b(a.grid.cDiv).height() + parseInt(b(a.grid.cDiv).css("padding-top"), 10) +
|
||||
parseInt(b(a.grid.cDiv).css("padding-bottom"), 10); if (a.p.toolbar[0] === true && (a.p.toolbar[1] == "top" || a.p.toolbar[1] == "both"))e[1] += b(a.grid.uDiv).height() + parseInt(b(a.grid.uDiv).css("border-top-width"), 10) + parseInt(b(a.grid.uDiv).css("border-bottom-width"), 10); if (a.p.toppager)e[1] += b(a.grid.topDiv).height() + parseInt(b(a.grid.topDiv).css("border-bottom-width"), 10); e[2] += b(a.grid.bDiv).height() + b(a.grid.hDiv).height(); return e}; this.p.id = this.id; if (b.inArray(a.p.multikey, ["shiftKey", "altKey", "ctrlKey"]) ==
|
||||
- 1)a.p.multikey = false; a.p.keyIndex = false; for (j = 0; j < a.p.colModel.length; j++)if (a.p.colModel[j].key === true){a.p.keyIndex = j; break}a.p.sortorder = a.p.sortorder.toLowerCase(); if (this.p.treeGrid === true)try{b(this).jqGrid("setTreeGrid")} catch (Ha){}if (this.p.subGrid)try{b(a).jqGrid("setSubGrid")} catch (Ia){}if (this.p.multiselect){this.p.colNames.unshift("<input role='checkbox' id='cb_" + this.p.id + "' class='cbox' type='checkbox'/>"); this.p.colModel.unshift({name:"cb", width:C?a.p.multiselectWidth + a.p.cellLayout:
|
||||
a.p.multiselectWidth, sortable:false, resizable:false, hidedlg:true, search:false, align:"center", fixed:true})}if (this.p.rownumbers){this.p.colNames.unshift(""); this.p.colModel.unshift({name:"rn", width:a.p.rownumWidth, sortable:false, resizable:false, hidedlg:true, search:false, align:"center", fixed:true})}a.p.xmlReader = b.extend(true, {root:"rows", row:"row", page:"rows>page", total:"rows>total", records:"rows>records", repeatitems:true, cell:"cell", id:"[id]", userdata:"userdata", subgrid:{root:"rows", row:"row", repeatitems:true,
|
||||
cell:"cell"}}, a.p.xmlReader); a.p.jsonReader = b.extend(true, {root:"rows", page:"page", total:"total", records:"records", repeatitems:true, cell:"cell", id:"id", userdata:"userdata", subgrid:{root:"rows", repeatitems:true, cell:"cell"}}, a.p.jsonReader); if (a.p.scroll){a.p.pgbuttons = false; a.p.pginput = false; a.p.rowList = []}var H = "<thead><tr class='ui-jqgrid-labels' role='rowheader'>", ya, ba, sa, ka, pa, I, A, ea; ba = ea = ""; if (a.p.shrinkToFit === true && a.p.forceFit === true)for (j = a.p.colModel.length - 1; j >= 0; j--)if (!a.p.colModel[j].hidden){a.p.colModel[j].resizable =
|
||||
false; break}if (a.p.viewsortcols[1] == "horizontal"){ea = " ui-i-asc"; ba = " ui-i-desc"}ya = x?"class='ui-th-div-ie'":""; ea = "<span class='s-ico' style='display:none'><span sort='asc' class='ui-grid-ico-sort ui-icon-asc" + ea + " ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-" + m + "'></span>"; ea += "<span sort='desc' class='ui-grid-ico-sort ui-icon-desc" + ba + " ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-" + m + "'></span></span>"; for (j = 0; j < this.p.colNames.length; j++){ba = a.p.headertitles?' title="' + b.jgrid.stripHtml(a.p.colNames[j]) +
|
||||
'"':""; H += "<th id='" + a.p.id + "_" + a.p.colModel[j].name + "' role='columnheader' class='ui-state-default ui-th-column ui-th-" + m + "'" + ba + ">"; ba = a.p.colModel[j].index || a.p.colModel[j].name; H += "<div id='jqgh_" + a.p.colModel[j].name + "' " + ya + ">" + a.p.colNames[j]; a.p.colModel[j].width = a.p.colModel[j].width?parseInt(a.p.colModel[j].width, 10):150; if (typeof a.p.colModel[j].title !== "boolean")a.p.colModel[j].title = true; if (ba == a.p.sortname)a.p.lastsort = j; H += ea + "</div></th>"}H += "</tr></thead>"; b(this).append(H); b("thead tr:first th",
|
||||
this).hover(function(){b(this).addClass("ui-state-hover")}, function(){b(this).removeClass("ui-state-hover")}); if (this.p.multiselect){var ta = [], qa; b("#cb_" + b.jgrid.jqID(a.p.id), this).bind("click", function(){if (this.checked){b("[id^=jqg_]", a.rows).attr("checked", true); b(a.rows).each(function(c){if (!b(this).hasClass("subgrid")){b(this).addClass("ui-state-highlight").attr("aria-selected", "true"); a.p.selarrrow[c] = a.p.selrow = this.id}}); qa = true; ta = []} else{b("[id^=jqg_]", a.rows).attr("checked", false); b(a.rows).each(function(c){if (!b(this).hasClass("subgrid")){b(this).removeClass("ui-state-highlight").attr("aria-selected",
|
||||
"false"); ta[c] = this.id}}); a.p.selarrrow = []; a.p.selrow = null; qa = false}if (b.isFunction(a.p.onSelectAll))a.p.onSelectAll.call(a, qa?a.p.selarrrow:ta, qa)})}if (a.p.autowidth === true){H = b(K).innerWidth(); a.p.width = H > 0?H:"nw"}(function(){var c = 0, d = a.p.cellLayout, e = 0, l, n = a.p.scrollOffset, o, p = false, w, y = 0, s = 0, r = 0, v; if (C)d = 0; b.each(a.p.colModel, function(){if (typeof this.hidden === "undefined")this.hidden = false; if (this.hidden === false){c += J(this.width, 0); if (this.fixed){y += this.width; s += this.width + d} else e++; r++}});
|
||||
if (isNaN(a.p.width))a.p.width = g.width = c; else g.width = a.p.width; a.p.tblwidth = c; if (a.p.shrinkToFit === false && a.p.forceFit === true)a.p.forceFit = false; if (a.p.shrinkToFit === true && e > 0){w = g.width - d * e - s; if (!isNaN(a.p.height)){w -= n; p = true}c = 0; b.each(a.p.colModel, function(z){if (this.hidden === false && !this.fixed){this.width = o = Math.round(w * this.width / (a.p.tblwidth - y)); c += o; l = z}}); v = 0; if (p){if (g.width - s - (c + d * e) !== n)v = g.width - s - (c + d * e) - n} else if (!p && Math.abs(g.width - s - (c + d * e)) !== 1)v = g.width - s - (c + d * e); a.p.colModel[l].width +=
|
||||
v; a.p.tblwidth = c + v + y + r * d; if (a.p.tblwidth > a.p.width){a.p.colModel[l].width -= a.p.tblwidth - parseInt(a.p.width, 10); a.p.tblwidth = a.p.width}}})(); b(K).css("width", g.width + "px").append("<div class='ui-jqgrid-resize-mark' id='rs_m" + a.p.id + "'> </div>"); b(q).css("width", g.width + "px"); H = b("thead:first", a).get(0); var ua = "<table role='grid' style='width:" + a.p.tblwidth + "px' class='ui-jqgrid-ftable' cellspacing='0' cellpadding='0' border='0'><tbody><tr role='row' class='ui-widget-content footrow footrow-" +
|
||||
m + "'>"; q = b("tr:first", H); a.p.disableClick = false; b("th", q).each(function(c){sa = a.p.colModel[c].width; if (typeof a.p.colModel[c].resizable === "undefined")a.p.colModel[c].resizable = true; if (a.p.colModel[c].resizable){ka = document.createElement("span"); b(ka).html(" ").addClass("ui-jqgrid-resize ui-jqgrid-resize-" + m); b.browser.opera || b(ka).css("cursor", "col-resize"); b(this).addClass(a.p.resizeclass)} else ka = ""; b(this).css("width", sa + "px").prepend(ka); a.p.colModel[c].hidden && b(this).css("display", "none");
|
||||
g.headers[c] = {width:sa, el:this}; pa = a.p.colModel[c].sortable; if (typeof pa !== "boolean")pa = a.p.colModel[c].sortable = true; var d = a.p.colModel[c].name; d == "cb" || d == "subgrid" || d == "rn" || a.p.viewsortcols[2] && b("div", this).addClass("ui-jqgrid-sortable"); if (pa)if (a.p.viewsortcols[0]){b("div span.s-ico", this).show(); c == a.p.lastsort && b("div span.ui-icon-" + a.p.sortorder, this).removeClass("ui-state-disabled")} else if (c == a.p.lastsort){b("div span.s-ico", this).show(); b("div span.ui-icon-" + a.p.sortorder, this).removeClass("ui-state-disabled")}ua +=
|
||||
"<td role='gridcell' " + F(c, 0, "") + "> </td>"}).mousedown(function(c){if (b(c.target).closest("th>span.ui-jqgrid-resize").length == 1){var d = b.jgrid.getCellIndex(this); if (a.p.forceFit === true)a.p.nv = Ca(d); g.dragStart(d, c, Da(d)); return false}}).click(function(c){if (a.p.disableClick)return a.p.disableClick = false; var d = "th>div.ui-jqgrid-sortable", e, l; a.p.viewsortcols[2] || (d = "th>div>span>span.ui-grid-ico-sort"); c = b(c.target).closest(d); if (c.length == 1){d = b.jgrid.getCellIndex(this); if (!a.p.viewsortcols[2]){e =
|
||||
true; l = c.attr("sort")}xa(b("div", this)[0].id, d, e, l); return false}}); if (a.p.sortable && b.fn.sortable)try{b(a).jqGrid("sortableColumns", q)} catch (Ja){}ua += "</tr></tbody></table>"; this.appendChild(document.createElement("tbody")); b(this).addClass("ui-jqgrid-btable"); q = b("<table class='ui-jqgrid-htable' style='width:" + a.p.tblwidth + "px' role='grid' aria-labelledby='gbox_" + this.id + "' cellspacing='0' cellpadding='0' border='0'></table>").append(H); var T = a.p.caption && a.p.hiddengrid === true?true:false; H = b("<div class='ui-jqgrid-hbox" +
|
||||
(m == "rtl"?"-rtl":"") + "'></div>"); g.hDiv = document.createElement("div"); b(g.hDiv).css({width:g.width + "px"}).addClass("ui-state-default ui-jqgrid-hdiv").append(H); b(H).append(q); T && b(g.hDiv).hide(); if (a.p.pager){if (typeof a.p.pager == "string"){if (a.p.pager.substr(0, 1) != "#")a.p.pager = "#" + a.p.pager} else a.p.pager = "#" + b(a.p.pager).attr("id"); b(a.p.pager).css({width:g.width + "px"}).appendTo(K).addClass("ui-state-default ui-jqgrid-pager ui-corner-bottom"); T && b(a.p.pager).hide(); t(a.p.pager, "")}a.p.cellEdit ===
|
||||
false && a.p.hoverrows === true && b(a).bind("mouseover", function(c){A = b(c.target).closest("tr.jqgrow"); b(A).attr("class") !== "subgrid" && b(A).addClass("ui-state-hover"); return false}).bind("mouseout", function(c){A = b(c.target).closest("tr.jqgrow"); b(A).removeClass("ui-state-hover"); return false}); var Z, $; b(a).before(g.hDiv).click(function(c){I = c.target; var d = b(I).hasClass("cbox"); A = b(I, a.rows).closest("tr.jqgrow"); if (b(A).length === 0)return this; var e = true; if (b.isFunction(a.p.beforeSelectRow))e = a.p.beforeSelectRow.call(a,
|
||||
A[0].id, c); if (I.tagName == "A" || (I.tagName == "INPUT" || I.tagName == "TEXTAREA" || I.tagName == "OPTION" || I.tagName == "SELECT") && !d)return this; if (e === true){if (a.p.cellEdit === true)if (a.p.multiselect && d)b(a).jqGrid("setSelection", A[0].id, true); else{Z = A[0].rowIndex; $ = b.jgrid.getCellIndex(I); try{b(a).jqGrid("editCell", Z, $, true)} catch (l){}} else if (a.p.multikey)if (c[a.p.multikey])b(a).jqGrid("setSelection", A[0].id, true); else{if (a.p.multiselect && d){d = b("[id^=jqg_]", A).attr("checked"); b("[id^=jqg_]", A).attr("checked",
|
||||
!d)}} else{if (a.p.multiselect && a.p.multiboxonly)if (!d){b(a.p.selarrrow).each(function(n, o){n = a.rows.namedItem(o); b(n).removeClass("ui-state-highlight"); b("#jqg_" + b.jgrid.jqID(o), n).attr("checked", false)}); a.p.selarrrow = []; b("#cb_" + b.jgrid.jqID(a.p.id), a.grid.hDiv).attr("checked", false)}b(a).jqGrid("setSelection", A[0].id, true)}if (b.isFunction(a.p.onCellSelect)){Z = A[0].id; $ = b.jgrid.getCellIndex(I); a.p.onCellSelect.call(a, Z, $, b(I).html(), c)}c.stopPropagation()} else return this}).bind("reloadGrid", function(c,
|
||||
d){if (a.p.treeGrid === true)a.p.datatype = a.p.treedatatype; d && d.current && a.grid.selectionPreserver(a); if (a.p.datatype == "local")b(a).jqGrid("resetSelection"); else if (!a.p.treeGrid){a.p.selrow = null; if (a.p.multiselect){a.p.selarrrow = []; b("#cb_" + b.jgrid.jqID(a.p.id), a.grid.hDiv).attr("checked", false)}a.p.savedRow = []; a.p.scroll && aa(a.grid.bDiv, true)}if (d && d.page){c = d.page; if (c > a.p.lastpage)c = a.p.lastpage; if (c < 1)c = 1; a.p.page = c; a.grid.bDiv.scrollTop = a.grid.prevRowHeight?(c - 1) * a.grid.prevRowHeight * a.p.rowNum:
|
||||
0}if (a.grid.prevRowHeight && a.p.scroll){delete a.p.lastpage; a.grid.populateVisible()} else a.grid.populate(); return false}); b.isFunction(this.p.ondblClickRow) && b(this).dblclick(function(c){I = c.target; A = b(I, a.rows).closest("tr.jqgrow"); if (b(A).length === 0)return false; Z = A[0].rowIndex; $ = b.jgrid.getCellIndex(I); a.p.ondblClickRow.call(a, b(A).attr("id"), Z, $, c); return false}); b.isFunction(this.p.onRightClickRow) && b(this).bind("contextmenu", function(c){I = c.target; A = b(I, a.rows).closest("tr.jqgrow"); if (b(A).length ===
|
||||
0)return false; a.p.multiselect || b(a).jqGrid("setSelection", A[0].id, true); Z = A[0].rowIndex; $ = b.jgrid.getCellIndex(I); a.p.onRightClickRow.call(a, b(A).attr("id"), Z, $, c); return false}); g.bDiv = document.createElement("div"); b(g.bDiv).append(b('<div style="position:relative;' + (x && b.browser.version < 8?"height:0.01%;":"") + '"></div>').append("<div></div>").append(this)).addClass("ui-jqgrid-bdiv").css({height:a.p.height + (isNaN(a.p.height)?"":"px"), width:g.width + "px"}).scroll(g.scrollGrid); b("table:first", g.bDiv).css({width:a.p.tblwidth +
|
||||
"px"}); if (x){b("tbody", this).size() == 2 && b("tbody:first", this).remove(); a.p.multikey && b(g.bDiv).bind("selectstart", function(){return false})} else a.p.multikey && b(g.bDiv).bind("mousedown", function(){return false}); T && b(g.bDiv).hide(); g.cDiv = document.createElement("div"); var va = a.p.hidegrid === true?b("<a role='link' href='javascript:void(0)'/>").addClass("ui-jqgrid-titlebar-close HeaderButton").hover(function(){va.addClass("ui-state-hover")}, function(){va.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-circle-triangle-n'></span>").css(m ==
|
||||
"rtl"?"left":"right", "0px"):""; b(g.cDiv).append(va).append("<span class='ui-jqgrid-title" + (m == "rtl"?"-rtl":"") + "'>" + a.p.caption + "</span>").addClass("ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix"); b(g.cDiv).insertBefore(g.hDiv); if (a.p.toolbar[0]){g.uDiv = document.createElement("div"); if (a.p.toolbar[1] == "top")b(g.uDiv).insertBefore(g.hDiv); else a.p.toolbar[1] == "bottom" && b(g.uDiv).insertAfter(g.hDiv); if (a.p.toolbar[1] == "both"){g.ubDiv = document.createElement("div"); b(g.uDiv).insertBefore(g.hDiv).addClass("ui-userdata ui-state-default").attr("id",
|
||||
"t_" + this.id); b(g.ubDiv).insertAfter(g.hDiv).addClass("ui-userdata ui-state-default").attr("id", "tb_" + this.id); T && b(g.ubDiv).hide()} else b(g.uDiv).width(g.width).addClass("ui-userdata ui-state-default").attr("id", "t_" + this.id); T && b(g.uDiv).hide()}if (a.p.toppager){a.p.toppager = a.p.id + "_toppager"; g.topDiv = b("<div id='" + a.p.toppager + "'></div>")[0]; a.p.toppager = "#" + a.p.toppager; b(g.topDiv).insertBefore(g.hDiv).addClass("ui-state-default ui-jqgrid-toppager").width(g.width); t(a.p.toppager, "_t")}if (a.p.footerrow){g.sDiv =
|
||||
b("<div class='ui-jqgrid-sdiv'></div>")[0]; H = b("<div class='ui-jqgrid-hbox" + (m == "rtl"?"-rtl":"") + "'></div>"); b(g.sDiv).append(H).insertAfter(g.hDiv).width(g.width); b(H).append(ua); g.footers = b(".ui-jqgrid-ftable", g.sDiv)[0].rows[0].cells; if (a.p.rownumbers)g.footers[0].className = "ui-state-default jqgrid-rownum"; T && b(g.sDiv).hide()}if (a.p.caption){var Ea = a.p.datatype; if (a.p.hidegrid === true){b(".ui-jqgrid-titlebar-close", g.cDiv).click(function(c){var d = b.isFunction(a.p.onHeaderClick); if (a.p.gridstate ==
|
||||
"visible"){b(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv", "#gview_" + a.p.id).slideUp("fast"); a.p.pager && b(a.p.pager).slideUp("fast"); a.p.toppager && b(a.p.toppager).slideUp("fast"); if (a.p.toolbar[0] === true){a.p.toolbar[1] == "both" && b(g.ubDiv).slideUp("fast"); b(g.uDiv).slideUp("fast")}a.p.footerrow && b(".ui-jqgrid-sdiv", "#gbox_" + a.p.id).slideUp("fast"); b("span", this).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s"); a.p.gridstate = "hidden"; b("#gbox_" + a.p.id).hasClass("ui-resizable") &&
|
||||
b(".ui-resizable-handle", "#gbox_" + a.p.id).hide(); if (d)T || a.p.onHeaderClick.call(a, a.p.gridstate, c)} else if (a.p.gridstate == "hidden"){b(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv", "#gview_" + a.p.id).slideDown("fast"); a.p.pager && b(a.p.pager).slideDown("fast"); a.p.toppager && b(a.p.toppager).slideDown("fast"); if (a.p.toolbar[0] === true){a.p.toolbar[1] == "both" && b(g.ubDiv).slideDown("fast"); b(g.uDiv).slideDown("fast")}a.p.footerrow && b(".ui-jqgrid-sdiv", "#gbox_" + a.p.id).slideDown("fast"); b("span", this).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");
|
||||
if (T){a.p.datatype = Ea; Y(); T = false}a.p.gridstate = "visible"; b("#gbox_" + a.p.id).hasClass("ui-resizable") && b(".ui-resizable-handle", "#gbox_" + a.p.id).show(); d && a.p.onHeaderClick.call(a, a.p.gridstate, c)}return false}); if (T){a.p.datatype = "local"; b(".ui-jqgrid-titlebar-close", g.cDiv).trigger("click")}}} else b(g.cDiv).hide(); b(g.hDiv).after(g.bDiv).mousemove(function(c){if (g.resizing){g.dragMove(c); return false}}); b(".ui-jqgrid-labels", g.hDiv).bind("selectstart", function(){return false}); b(document).mouseup(function(){if (g.resizing){g.dragEnd();
|
||||
return false}return true}); this.updateColumns = function(){var c = this.rows[0], d = this; if (c){b("td", c).each(function(e){b(this).css("width", d.grid.headers[e].width + "px")}); this.grid.cols = c.cells}return this}; a.formatCol = F; a.sortData = xa; a.updatepager = na; a.formatter = function(c, d, e, l, n){return M(c, d, e, l, n)}; b.extend(g, {populate:Y, emptyRows:aa}); this.grid = g; a.addXmlData = function(c){ia(c, a.grid.bDiv)}; a.addJSONData = function(c){ra(c, a.grid.bDiv)}; Y(); a.p.hiddengrid = false; b(window).unload(function(){a = null})}}})};
|
||||
b.jgrid.extend({getGridParam:function(f){var k = this[0]; if (k.grid)return f?typeof k.p[f] != "undefined"?k.p[f]:null:k.p}, setGridParam:function(f){return this.each(function(){this.grid && typeof f === "object" && b.extend(true, this.p, f)})}, getDataIDs:function(){var f = [], k = 0, i; this.each(function(){if ((i = this.rows.length) && i > 0)for (; k < i; ){f[k] = this.rows[k].id; k++}}); return f}, setSelection:function(f, k){return this.each(function(){function i(a){var q = b(h.grid.bDiv)[0].clientHeight, t = b(h.grid.bDiv)[0].scrollTop,
|
||||
x = h.rows[a].offsetTop; a = h.rows[a].clientHeight; if (x + a >= q + t)b(h.grid.bDiv)[0].scrollTop = x - (q + t) + a + t; else if (x < q + t)if (x < t)b(h.grid.bDiv)[0].scrollTop = x}var h = this, g, j, m; if (f !== undefined){k = k === false?false:true; if (j = h.rows.namedItem(f + "")){if (h.p.scrollrows === true){g = h.rows.namedItem(f).rowIndex; g >= 0 && i(g)}if (h.p.multiselect){h.p.selrow = j.id; m = b.inArray(h.p.selrow, h.p.selarrrow); if (m === - 1){j.className !== "ui-subgrid" && b(j).addClass("ui-state-highlight").attr("aria-selected", "true"); g = true; b("#jqg_" + b.jgrid.jqID(h.p.selrow),
|
||||
h.rows[j.rowIndex]).attr("checked", g); h.p.selarrrow.push(h.p.selrow); h.p.onSelectRow && k && h.p.onSelectRow.call(h, h.p.selrow, g)} else{j.className !== "ui-subgrid" && b(j).removeClass("ui-state-highlight").attr("aria-selected", "false"); g = false; b("#jqg_" + b.jgrid.jqID(h.p.selrow), h.rows[j.rowIndex]).attr("checked", g); h.p.selarrrow.splice(m, 1); h.p.onSelectRow && k && h.p.onSelectRow.call(h, h.p.selrow, g); j = h.p.selarrrow[0]; h.p.selrow = j === undefined?null:j}} else if (j.className !== "ui-subgrid"){h.p.selrow && b(h.rows.namedItem(h.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected",
|
||||
"false"); h.p.selrow = j.id; b(j).addClass("ui-state-highlight").attr("aria-selected", "true"); h.p.onSelectRow && k && h.p.onSelectRow.call(h, h.p.selrow, true)}}}})}, resetSelection:function(){return this.each(function(){var f = this, k; if (f.p.multiselect){b(f.p.selarrrow).each(function(i, h){k = f.rows.namedItem(h); b(k).removeClass("ui-state-highlight").attr("aria-selected", "false"); b("#jqg_" + b.jgrid.jqID(h), k).attr("checked", false)}); b("#cb_" + b.jgrid.jqID(f.p.id), f.grid.hDiv).attr("checked", false); f.p.selarrrow =
|
||||
[]} else if (f.p.selrow){b("tr#" + b.jgrid.jqID(f.p.selrow), f.grid.bDiv).removeClass("ui-state-highlight").attr("aria-selected", "false"); f.p.selrow = null}f.p.savedRow = []})}, getRowData:function(f){var k = {}, i, h = false, g, j = 0; this.each(function(){var m = this, a, q; if (typeof f == "undefined"){h = true; i = []; g = m.rows.length} else{q = m.rows.namedItem(f); if (!q)return k; g = 1}for (; j < g; ){if (h)q = m.rows[j]; b("td", q).each(function(t){a = m.p.colModel[t].name; if (a !== "cb" && a !== "subgrid")if (m.p.treeGrid === true && a == m.p.ExpandColumn)k[a] =
|
||||
b.jgrid.htmlDecode(b("span:first", this).html()); else try{k[a] = b.unformat(this, {rowId:q.id, colModel:m.p.colModel[t]}, t)} catch (x){k[a] = b.jgrid.htmlDecode(b(this).html())}}); j++; if (h){i.push(k); k = {}}}}); return i?i:k}, delRowData:function(f){var k = false, i, h, g; this.each(function(){var j = this; if (i = j.rows.namedItem(f)){g = i.rowIndex; b(i).remove(); j.p.records--; j.p.reccount--; j.updatepager(true, false); k = true; if (j.p.multiselect){h = b.inArray(f, j.p.selarrrow); h != - 1 && j.p.selarrrow.splice(h, 1)}if (f == j.p.selrow)j.p.selrow =
|
||||
null} else return false; g === 0 && k && j.updateColumns(); if (j.p.altRows === true && k){var m = j.p.altclass; b(j.rows).each(function(a){a % 2 == 1?b(this).addClass(m):b(this).removeClass(m)})}}); return k}, setRowData:function(f, k, i){var h, g = false, j; this.each(function(){var m = this, a, q, t = typeof i; if (!m.grid)return false; q = m.rows.namedItem(f); if (!q)return false; k && b(this.p.colModel).each(function(x){h = this.name; if (k[h] !== undefined){a = m.formatter(f, k[h], x, k, "edit"); j = this.title?{title:b.jgrid.stripHtml(a)}:{}; m.p.treeGrid ===
|
||||
true && h == m.p.ExpandColumn?b("td:eq(" + x + ") > span:first", q).html(a).attr(j):b("td:eq(" + x + ")", q).html(a).attr(j); g = true}}); if (t === "string")b(q).addClass(i); else t === "object" && b(q).css(i)}); return g}, addRowData:function(f, k, i, h){i || (i = "last"); var g = false, j, m, a, q, t, x, C, K, J = "", F, Q, M, R; if (k){if (b.isArray(k)){F = true; i = "last"; Q = f} else{k = [k]; F = false}this.each(function(){var u = this, la = k.length; t = u.p.rownumbers === true?1:0; a = u.p.multiselect === true?1:0; q = u.p.subGrid === true?1:0; if (!F)if (typeof f != "undefined")f +=
|
||||
""; else{f = u.p.records + 1 + ""; if (u.p.keyIndex !== false){Q = u.p.colModel[u.p.keyIndex + a + q + t].name; if (typeof k[0][Q] != "undefined")f = k[0][Q]}}M = u.p.altclass; for (var ca = 0, fa = "", aa = b.isFunction(u.p.afterInsertRow)?true:false; ca < la; ){R = k[ca]; m = ""; if (F){try{f = R[Q]} catch (U){f = u.p.records + 1}fa = u.p.altRows === true?(u.rows.length - 1) % 2 === 0?M:"":""}if (t){J = u.formatCol(t, 1, ""); m += '<td role="gridcell" aria-describedby="' + u.p.id + '_rn" class="ui-state-default jqgrid-rownum" ' + J + ">0</td>"}if (a){K = '<input role="checkbox" type="checkbox" id="jqg_' +
|
||||
f + '" class="cbox"/>'; J = u.formatCol(t, 1, ""); m += '<td role="gridcell" aria-describedby="' + u.p.id + '_cb" ' + J + ">" + K + "</td>"}if (q)m += b(u).jqGrid("addSubGridCell", a + t, 1); for (C = a + q + t; C < this.p.colModel.length; C++){j = this.p.colModel[C].name; K = u.formatter(f, R[j], C, R, "add"); J = u.formatCol(C, 1, K); m += '<td role="gridcell" aria-describedby="' + u.p.id + "_" + j + '" ' + J + ">" + K + "</td>"}m = '<tr id="' + f + '" role="row" class="ui-widget-content jqgrow ui-row-' + u.p.direction + " " + fa + '">' + m + "</tr>"; if (u.p.subGrid === true){m = b(m)[0]; b(u).jqGrid("addSubGrid",
|
||||
m, a + t)}if (u.rows.length === 0)b("table:first", u.grid.bDiv).append(m); else switch (i){case "last":b(u.rows[u.rows.length - 1]).after(m); break; case "first":b(u.rows[0]).before(m); break; case "after":if (x = u.rows.namedItem(h))b(u.rows[x.rowIndex + 1]).hasClass("ui-subgrid")?b(u.rows[x.rowIndex + 1]).after(m):b(x).after(m); break; case "before":if (x = u.rows.namedItem(h)){b(x).before(m); x = x.rowIndex}break}u.p.records++; u.p.reccount++; if (!u.grid.cols || !u.grid.cols.length)u.grid.cols = u.rows[0].cells; if (i === "first" || i ===
|
||||
"before" && x <= 1 || u.rows.length === 1)u.updateColumns(); aa && u.p.afterInsertRow.call(u, f, R, R); ca++}if (u.p.altRows === true && !F)if (i == "last")(u.rows.length - 1) % 2 == 1 && b(u.rows[u.rows.length - 1]).addClass(M); else b(u.rows).each(function(ia){ia % 2 == 1?b(this).addClass(M):b(this).removeClass(M)}); u.updatepager(true, true); g = true})}return g}, footerData:function(f, k, i){function h(q){for (var t in q)if (q.hasOwnProperty(t))return false; return true}var g, j = false, m = {}, a; if (typeof f == "undefined")f = "get"; if (typeof i != "boolean")i =
|
||||
true; f = f.toLowerCase(); this.each(function(){var q = this, t; if (!q.grid || !q.p.footerrow)return false; if (f == "set")if (h(k))return false; j = true; b(this.p.colModel).each(function(x){g = this.name; if (f == "set"){if (k[g] !== undefined){t = i?q.formatter("", k[g], x, k, "edit"):k[g]; a = this.title?{title:b.jgrid.stripHtml(t)}:{}; b("tr.footrow td:eq(" + x + ")", q.grid.sDiv).html(t).attr(a); j = true}} else if (f == "get")m[g] = b("tr.footrow td:eq(" + x + ")", q.grid.sDiv).html()})}); return f == "get"?m:j}, ShowHideCol:function(f, k){return this.each(function(){var i =
|
||||
this, h = false; if (i.grid){if (typeof f === "string")f = [f]; k = k != "none"?"":"none"; var g = k == ""?true:false; b(this.p.colModel).each(function(j){if (b.inArray(this.name, f) !== - 1 && this.hidden === g){b("tr", i.grid.hDiv).each(function(){b("th:eq(" + j + ")", this).css("display", k)}); b(i.rows).each(function(m){b("td:eq(" + j + ")", i.rows[m]).css("display", k)}); i.p.footerrow && b("td:eq(" + j + ")", i.grid.sDiv).css("display", k); if (k == "none")i.p.tblwidth -= this.width; else i.p.tblwidth += this.width; this.hidden = !g; h = true}}); if (h === true){b("table:first",
|
||||
i.grid.hDiv).width(i.p.tblwidth); b("table:first", i.grid.bDiv).width(i.p.tblwidth); i.grid.hDiv.scrollLeft = i.grid.bDiv.scrollLeft; if (i.p.footerrow){b("table:first", i.grid.sDiv).width(i.p.tblwidth); i.grid.sDiv.scrollLeft = i.grid.bDiv.scrollLeft}}}})}, hideCol:function(f){return this.each(function(){b(this).jqGrid("ShowHideCol", f, "none")})}, showCol:function(f){return this.each(function(){b(this).jqGrid("ShowHideCol", f, "")})}, remapColumns:function(f, k, i){function h(m){var a; a = m.length?b.makeArray(m):b.extend({},
|
||||
m); b.each(f, function(q){m[q] = a[this]})}function g(m, a){b(">tr" + (a || ""), m).each(function(){var q = this, t = b.makeArray(q.cells); b.each(f, function(){var x = t[this]; x && q.appendChild(x)})})}var j = this.get(0); h(j.p.colModel); h(j.p.colNames); h(j.grid.headers); g(b("thead:first", j.grid.hDiv), i && ":not(.ui-jqgrid-labels)"); k && g(b("tbody:first", j.grid.bDiv), ".jqgrow"); j.p.footerrow && g(b("tbody:first", j.grid.sDiv)); if (j.p.remapColumns)if (j.p.remapColumns.length)h(j.p.remapColumns); else j.p.remapColumns = b.makeArray(f);
|
||||
j.p.lastsort = b.inArray(j.p.lastsort, f); if (j.p.treeGrid)j.p.expColInd = b.inArray(j.p.expColInd, f)}, setGridWidth:function(f, k){return this.each(function(){var i = this, h, g = 0, j = i.p.cellLayout, m, a = 0, q = false, t = i.p.scrollOffset, x, C = 0, K = 0, J = 0, F; if (i.grid){if (typeof k != "boolean")k = i.p.shrinkToFit; if (!isNaN(f)){f = parseInt(f, 10); i.grid.width = i.p.width = f; b("#gbox_" + i.p.id).css("width", f + "px"); b("#gview_" + i.p.id).css("width", f + "px"); b(i.grid.bDiv).css("width", f + "px"); b(i.grid.hDiv).css("width", f + "px"); i.p.pager &&
|
||||
b(i.p.pager).css("width", f + "px"); i.p.toppager && b(i.p.toppager).css("width", f + "px"); if (i.p.toolbar[0] === true){b(i.grid.uDiv).css("width", f + "px"); i.p.toolbar[1] == "both" && b(i.grid.ubDiv).css("width", f + "px")}i.p.footerrow && b(i.grid.sDiv).css("width", f + "px"); if (k === false && i.p.forceFit === true)i.p.forceFit = false; if (k === true){if (b.browser.safari)j = 0; b.each(i.p.colModel, function(){if (this.hidden === false){g += parseInt(this.width, 10); if (this.fixed){K += this.width; C += this.width + j} else a++; J++}}); if (a !== 0){i.p.tblwidth =
|
||||
g; x = f - j * a - C; if (!isNaN(i.p.height))q = true; x -= t; g = 0; var Q = i.grid.cols.length > 0; b.each(i.p.colModel, function(M){if (this.hidden === false && !this.fixed){h = Math.round(x * this.width / (i.p.tblwidth - K)); if (!(h < 0)){this.width = h; g += h; i.grid.headers[M].width = h; i.grid.headers[M].el.style.width = h + "px"; if (i.p.footerrow)i.grid.footers[M].style.width = h + "px"; if (Q)i.grid.cols[M].style.width = h + "px"; m = M}}}); F = 0; if (q){if (f - C - (g + j * a) !== t)F = f - C - (g + j * a) - t} else if (Math.abs(f -
|
||||
C - (g + j * a)) !== 1)F = f - C - (g + j * a); i.p.colModel[m].width += F; i.p.tblwidth = g + F + K + j * J; if (i.p.tblwidth > f){q = i.p.tblwidth - parseInt(f, 10); i.p.tblwidth = f; h = i.p.colModel[m].width -= q} else h = i.p.colModel[m].width; i.grid.headers[m].width = h; i.grid.headers[m].el.style.width = h + "px"; if (Q)i.grid.cols[m].style.width = h + "px"; b("table:first", i.grid.bDiv).css("width", i.p.tblwidth + "px"); b("table:first", i.grid.hDiv).css("width", i.p.tblwidth + "px"); i.grid.hDiv.scrollLeft = i.grid.bDiv.scrollLeft; if (i.p.footerrow){i.grid.footers[m].style.width =
|
||||
h + "px"; b("table:first", i.grid.sDiv).css("width", i.p.tblwidth + "px")}}}}}})}, setGridHeight:function(f){return this.each(function(){var k = this; if (k.grid){b(k.grid.bDiv).css({height:f + (isNaN(f)?"":"px")}); k.p.height = f; k.p.scroll && k.grid.populateVisible()}})}, setCaption:function(f){return this.each(function(){this.p.caption = f; b("span.ui-jqgrid-title", this.grid.cDiv).html(f); b(this.grid.cDiv).show()})}, setLabel:function(f, k, i, h){return this.each(function(){var g = this, j = - 1; if (g.grid){if (isNaN(f))b(g.p.colModel).each(function(q){if (this.name ==
|
||||
f){j = q; return false}}); else j = parseInt(f, 10); if (j >= 0){var m = b("tr.ui-jqgrid-labels th:eq(" + j + ")", g.grid.hDiv); if (k){var a = b(".s-ico", m); b("[id^=jqgh_]", m).empty().html(k).append(a); g.p.colNames[j] = k}if (i)typeof i === "string"?b(m).addClass(i):b(m).css(i); typeof h === "object" && b(m).attr(h)}}})}, setCell:function(f, k, i, h, g, j){return this.each(function(){var m = this, a = - 1, q, t; if (m.grid){if (isNaN(k))b(m.p.colModel).each(function(C){if (this.name == k){a = C; return false}}); else a = parseInt(k, 10); if (a >= 0)if (q = m.rows.namedItem(f)){var x =
|
||||
b("td:eq(" + a + ")", q); if (i !== "" || j === true){q = m.formatter(f, i, a, q, "edit"); t = m.p.colModel[a].title?{title:b.jgrid.stripHtml(q)}:{}; m.p.treeGrid && b(".tree-wrap", b(x)).length > 0?b("span", b(x)).html(q).attr(t):b(x).html(q).attr(t)}if (typeof h === "string")b(x).addClass(h); else h && b(x).css(h); typeof g === "object" && b(x).attr(g)}}})}, getCell:function(f, k){var i = false; this.each(function(){var h = this, g = - 1; if (h.grid){if (isNaN(k))b(h.p.colModel).each(function(a){if (this.name === k){g = a; return false}}); else g = parseInt(k,
|
||||
10); if (g >= 0){var j = h.rows.namedItem(f); if (j)try{i = b.unformat(b("td:eq(" + g + ")", j), {rowId:j.id, colModel:h.p.colModel[g]}, g)} catch (m){i = b.jgrid.htmlDecode(b("td:eq(" + g + ")", j).html())}}}}); return i}, getCol:function(f, k, i){var h = [], g, j = 0; k = typeof k != "boolean"?false:k; if (typeof i == "undefined")i = false; this.each(function(){var m = this, a = - 1; if (m.grid){if (isNaN(f))b(m.p.colModel).each(function(C){if (this.name === f){a = C; return false}}); else a = parseInt(f, 10); if (a >= 0){var q = m.rows.length, t = 0; if (q && q > 0){for (; t < q; ){try{g =
|
||||
b.unformat(b(m.rows[t].cells[a]), {rowId:m.rows[t].id, colModel:m.p.colModel[a]}, a)} catch (x){g = b.jgrid.htmlDecode(m.rows[t].cells[a].innerHTML)}if (i)j += parseFloat(g); else if (k)h.push({id:m.rows[t].id, value:g}); else h[t] = g; t++}if (i)switch (i.toLowerCase()){case "sum":h = j; break; case "avg":h = j / q; break; case "count":h = q; break}}}}}); return h}, clearGridData:function(f){return this.each(function(){var k = this; if (k.grid){if (typeof f != "boolean")f = false; b("tbody:first tr", k.grid.bDiv).remove(); k.p.footerrow && f &&
|
||||
b(".ui-jqgrid-ftable td", k.grid.sDiv).html(" "); k.p.selrow = null; k.p.selarrrow = []; k.p.savedRow = []; k.p.records = 0; k.p.page = "0"; k.p.lastpage = "0"; k.p.reccount = 0; k.updatepager(true, false)}})}, getInd:function(f, k){var i = false, h; this.each(function(){if (h = this.rows.namedItem(f))i = k === true?h:h.rowIndex}); return i}})})(jQuery);
|
||||
(function(c){function u(a, b, d, e, g){var h = b; if (c.fn.fmatter[a])h = c.fn.fmatter[a](b, d, e, g); return h}c.fmatter = {}; c.fn.fmatter = function(a, b, d, e, g){d = c.extend({}, c.jgrid.formatter, d); return u(a, b, d, e, g)}; c.fmatter.util = {NumberFormat:function(a, b){isNumber(a) || (a *= 1); if (isNumber(a)){var d = a < 0, e = a + "", g = b.decimalSeparator?b.decimalSeparator:"."; if (isNumber(b.decimalPlaces)){var h = b.decimalPlaces; e = Math.pow(10, h); e = Math.round(a * e) / e + ""; a = e.lastIndexOf("."); if (h > 0){if (a < 0){e += g; a = e.length - 1} else if (g !== ".")e =
|
||||
e.replace(".", g); for (; e.length - 1 - a < h; )e += "0"}}if (b.thousandsSeparator){h = b.thousandsSeparator; a = e.lastIndexOf(g); a = a > - 1?a:e.length; g = e.substring(a); for (var f = - 1, i = a; i > 0; i--){f++; if (f % 3 === 0 && i !== a && (!d || i > 1))g = h + g; g = e.charAt(i - 1) + g}e = g}e = b.prefix?b.prefix + e:e; return e = b.suffix?e + b.suffix:e} else return a}, DateFormat:function(a, b, d, e){var g = function(m, r){m = String(m); for (r = parseInt(r, 10) || 2; m.length < r; )m = "0" + m; return m}, h = {m:1, d:1, y:1970, h:0, i:0, s:0, u:0}, f = 0, i, k, j = ["i18n"]; j.i18n = {dayNames:e.dayNames,
|
||||
monthNames:e.monthNames}; if (a in e.masks)a = e.masks[a]; if (b.constructor === Date)f = b; else{b = b.split(/[\\\/:_;.\t\T\s-]/); a = a.split(/[\\\/:_;.\t\T\s-]/); i = 0; for (k = a.length; i < k; i++){if (a[i] == "M"){f = c.inArray(b[i], j.i18n.monthNames); if (f !== - 1 && f < 12)b[i] = f + 1}if (a[i] == "F"){f = c.inArray(b[i], j.i18n.monthNames); if (f !== - 1 && f > 11)b[i] = f + 1 - 12}h[a[i].toLowerCase()] = parseInt(b[i], 10)}h.m = parseInt(h.m, 10) - 1; f = h.y; if (f >= 70 && f <= 99)h.y = 1900 + h.y; else if (f >= 0 && f <= 69)h.y = 2E3 + h.y; f = new Date(h.y, h.m, h.d, h.h, h.i, h.s, h.u)}if (d in
|
||||
e.masks)d = e.masks[d]; else d || (d = "Y-m-d"); h = f.getHours(); a = f.getMinutes(); b = f.getDate(); i = f.getMonth() + 1; k = f.getTimezoneOffset(); var l = f.getSeconds(), o = f.getMilliseconds(), n = f.getDay(), p = f.getFullYear(), q = (n + 6) % 7 + 1, s = (new Date(p, i - 1, b) - new Date(p, 0, 1)) / 864E5, t = {d:g(b), D:j.i18n.dayNames[n], j:b, l:j.i18n.dayNames[n + 7], N:q, S:e.S(b), w:n, z:s, W:q < 5?Math.floor((s + q - 1) / 7) + 1:Math.floor((s + q - 1) / 7) || (((new Date(p - 1, 0, 1)).getDay() + 6) % 7 < 4?53:52), F:j.i18n.monthNames[i - 1 + 12], m:g(i), M:j.i18n.monthNames[i - 1], n:i, t:"?",
|
||||
L:"?", o:"?", Y:p, y:String(p).substring(2), a:h < 12?e.AmPm[0]:e.AmPm[1], A:h < 12?e.AmPm[2]:e.AmPm[3], B:"?", g:h % 12 || 12, G:h, h:g(h % 12 || 12), H:g(h), i:g(a), s:g(l), u:o, e:"?", I:"?", O:(k > 0?"-":"+") + g(Math.floor(Math.abs(k) / 60) * 100 + Math.abs(k) % 60, 4), P:"?", T:(String(f).match(/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g) || [""]).pop().replace(/[^-+\dA-Z]/g, ""), Z:"?", c:"?", r:"?", U:Math.floor(f / 1E3)}; return d.replace(/\\.|[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/g,
|
||||
function(m){return m in t?t[m]:m.substring(1)})}}; c.fn.fmatter.defaultFormat = function(a, b){return isValue(a) && a !== ""?a:b.defaultValue?b.defaultValue:" "}; c.fn.fmatter.email = function(a, b){return isEmpty(a)?c.fn.fmatter.defaultFormat(a, b):'<a href="mailto:' + a + '">' + a + "</a>"}; c.fn.fmatter.checkbox = function(a, b){var d = c.extend({}, b.checkbox); isUndefined(b.colModel.formatoptions) || (d = c.extend({}, d, b.colModel.formatoptions)); b = d.disabled === true?"disabled":""; if (isEmpty(a) || isUndefined(a))a = c.fn.fmatter.defaultFormat(a,
|
||||
d); a += ""; a = a.toLowerCase(); return'<input type="checkbox" ' + (a.search(/(false|0|no|off)/i) < 0?" checked='checked' ":"") + ' value="' + a + '" offval="no" ' + b + "/>"}; c.fn.fmatter.link = function(a, b){var d = {target:b.target}, e = ""; isUndefined(b.colModel.formatoptions) || (d = c.extend({}, d, b.colModel.formatoptions)); if (d.target)e = "target=" + d.target; return isEmpty(a)?c.fn.fmatter.defaultFormat(a, b):"<a " + e + ' href="' + a + '">' + a + "</a>"}; c.fn.fmatter.showlink = function(a, b){var d = {baseLinkUrl:b.baseLinkUrl, showAction:b.showAction,
|
||||
addParam:b.addParam || "", target:b.target, idName:b.idName}, e = ""; isUndefined(b.colModel.formatoptions) || (d = c.extend({}, d, b.colModel.formatoptions)); if (d.target)e = "target=" + d.target; d = d.baseLinkUrl + d.showAction + "?" + d.idName + "=" + b.rowId + d.addParam; return isString(a)?"<a " + e + ' href="' + d + '">' + a + "</a>":c.fn.fmatter.defaultFormat(a, b)}; c.fn.fmatter.integer = function(a, b){var d = c.extend({}, b.integer); isUndefined(b.colModel.formatoptions) || (d = c.extend({}, d, b.colModel.formatoptions)); if (isEmpty(a))return d.defaultValue;
|
||||
return c.fmatter.util.NumberFormat(a, d)}; c.fn.fmatter.number = function(a, b){var d = c.extend({}, b.number); isUndefined(b.colModel.formatoptions) || (d = c.extend({}, d, b.colModel.formatoptions)); if (isEmpty(a))return d.defaultValue; return c.fmatter.util.NumberFormat(a, d)}; c.fn.fmatter.currency = function(a, b){var d = c.extend({}, b.currency); isUndefined(b.colModel.formatoptions) || (d = c.extend({}, d, b.colModel.formatoptions)); if (isEmpty(a))return d.defaultValue; return c.fmatter.util.NumberFormat(a, d)}; c.fn.fmatter.date =
|
||||
function(a, b, d, e){d = c.extend({}, b.date); isUndefined(b.colModel.formatoptions) || (d = c.extend({}, d, b.colModel.formatoptions)); return!d.reformatAfterEdit && e == "edit"?c.fn.fmatter.defaultFormat(a, b):isEmpty(a)?c.fn.fmatter.defaultFormat(a, b):c.fmatter.util.DateFormat(d.srcformat, a, d.newformat, d)}; c.fn.fmatter.select = function(a, b){a += ""; var d = false, e = []; if (!isUndefined(b.colModel.editoptions))d = b.colModel.editoptions.value; if (d){var g = b.colModel.editoptions.multiple === true?true:false, h = [], f; if (g){h = a.split(",");
|
||||
h = c.map(h, function(l){return c.trim(l)})}if (isString(d))for (var i = d.split(";"), k = 0, j = 0; j < i.length; j++){f = i[j].split(":"); if (f.length > 2)f[1] = jQuery.map(f, function(l, o){if (o > 0)return l}).join(":"); if (g){if (jQuery.inArray(f[0], h) > - 1){e[k] = f[1]; k++}} else if (c.trim(f[0]) == c.trim(a)){e[0] = f[1]; break}} else if (isObject(d))if (g)e = jQuery.map(h, function(l){return d[l]}); else e[0] = d[a] || ""}a = e.join(", "); return a == ""?c.fn.fmatter.defaultFormat(a, b):a}; c.fn.fmatter.rowactions = function(a, b, d, e){switch (d){case "edit":d =
|
||||
function(){c("tr#" + a + " div.ui-inline-edit, tr#" + a + " div.ui-inline-del", "#" + b).show(); c("tr#" + a + " div.ui-inline-save, tr#" + a + " div.ui-inline-cancel", "#" + b).hide()}; c("#" + b).jqGrid("editRow", a, e, null, null, null, {oper:"edit"}, d, null, d); c("tr#" + a + " div.ui-inline-edit, tr#" + a + " div.ui-inline-del", "#" + b).hide(); c("tr#" + a + " div.ui-inline-save, tr#" + a + " div.ui-inline-cancel", "#" + b).show(); break; case "save":c("#" + b).jqGrid("saveRow", a, null, null); c("tr#" + a + " div.ui-inline-edit, tr#" + a + " div.ui-inline-del", "#" +
|
||||
b).show(); c("tr#" + a + " div.ui-inline-save, tr#" + a + " div.ui-inline-cancel", "#" + b).hide(); break; case "cancel":c("#" + b).jqGrid("restoreRow", a); c("tr#" + a + " div.ui-inline-edit, tr#" + a + " div.ui-inline-del", "#" + b).show(); c("tr#" + a + " div.ui-inline-save, tr#" + a + " div.ui-inline-cancel", "#" + b).hide(); break}}; c.fn.fmatter.actions = function(a, b){a = {keys:false, editbutton:true, delbutton:true}; isUndefined(b.colModel.formatoptions) || (a = c.extend(a, b.colModel.formatoptions)); var d = b.rowId, e = "", g; if (typeof d == "undefined" ||
|
||||
isEmpty(d))return""; if (a.editbutton){g = "onclick=$.fn.fmatter.rowactions('" + d + "','" + b.gid + "','edit'," + a.keys + ");"; e = e + "<div style='margin-left:8px;'><div title='" + c.jgrid.nav.edittitle + "' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' " + g + "><span class='ui-icon ui-icon-pencil'></span></div>"}if (a.delbutton){g = "onclick=jQuery('#" + b.gid + "').jqGrid('delGridRow','" + d + "');"; e = e + "<div title='" + c.jgrid.nav.deltitle + "' style='float:left;margin-left:5px;' class='ui-pg-div ui-inline-del' " +
|
||||
g + "><span class='ui-icon ui-icon-trash'></span></div>"}g = "onclick=$.fn.fmatter.rowactions('" + d + "','" + b.gid + "','save',false);"; e = e + "<div title='" + c.jgrid.edit.bSubmit + "' style='float:left;display:none' class='ui-pg-div ui-inline-save'><span class='ui-icon ui-icon-disk' " + g + "></span></div>"; g = "onclick=$.fn.fmatter.rowactions('" + d + "','" + b.gid + "','cancel',false);"; return e = e + "<div title='" + c.jgrid.edit.bCancel + "' style='float:left;display:none;margin-left:5px;' class='ui-pg-div ui-inline-cancel'><span class='ui-icon ui-icon-cancel' " +
|
||||
g + "></span></div></div>"}; c.unformat = function(a, b, d, e){var g, h = b.colModel.formatter, f = b.colModel.formatoptions || {}, i = /([\.\*\_\'\(\)\{\}\+\?\\])/g; unformatFunc = b.colModel.unformat || c.fn.fmatter[h] && c.fn.fmatter[h].unformat; if (typeof unformatFunc !== "undefined" && isFunction(unformatFunc))g = unformatFunc(c(a).text(), b, a); else if (typeof h !== "undefined" && isString(h)){g = c.jgrid.formatter || {}; switch (h){case "integer":f = c.extend({}, g.integer, f); b = f.thousandsSeparator.replace(i, "\\$1"); b = new RegExp(b, "g"); g =
|
||||
c(a).text().replace(b, ""); break; case "number":f = c.extend({}, g.number, f); b = f.thousandsSeparator.replace(i, "\\$1"); b = new RegExp(b, "g"); g = c(a).text().replace(b, "").replace(f.decimalSeparator, "."); break; case "currency":f = c.extend({}, g.currency, f); b = f.thousandsSeparator.replace(i, "\\$1"); b = new RegExp(b, "g"); g = c(a).text().replace(b, "").replace(f.decimalSeparator, ".").replace(f.prefix, "").replace(f.suffix, ""); break; case "checkbox":f = b.colModel.editoptions?b.colModel.editoptions.value.split(":"):["Yes", "No"];
|
||||
g = c("input", a).attr("checked")?f[0]:f[1]; break; case "select":g = c.unformat.select(a, b, d, e); break; case "actions":return""; default:g = c(a).text()}}return g?g:e === true?c(a).text():c.jgrid.htmlDecode(c(a).html())}; c.unformat.select = function(a, b, d, e){d = []; a = c(a).text(); if (e === true)return a; b = c.extend({}, b.colModel.editoptions); if (b.value){var g = b.value; b = b.multiple === true?true:false; e = []; var h; if (b){e = a.split(","); e = c.map(e, function(j){return c.trim(j)})}if (isString(g))for (var f = g.split(";"), i = 0, k = 0; k < f.length; k++){h =
|
||||
f[k].split(":"); if (b){if (jQuery.inArray(h[1], e) > - 1){d[i] = h[0]; i++}} else if (c.trim(h[1]) == c.trim(a)){d[0] = h[0]; break}} else if (isObject(g)){b || (e[0] = a); d = jQuery.map(e, function(j){var l; c.each(g, function(o, n){if (n == j){l = o; return false}}); if (l)return l})}return d.join(", ")} else return a || ""}; isValue = function(a){return isObject(a) || isString(a) || isNumber(a) || isBoolean(a)}; isBoolean = function(a){return typeof a === "boolean"}; isNull = function(a){return a === null}; isNumber = function(a){return typeof a === "number" &&
|
||||
isFinite(a)}; isString = function(a){return typeof a === "string"}; isEmpty = function(a){if (!isString(a) && isValue(a))return false; else if (!isValue(a))return true; a = c.trim(a).replace(/\ \;/ig, "").replace(/\ \;/ig, ""); return a === ""}; isUndefined = function(a){return typeof a === "undefined"}; isObject = function(a){return a && (typeof a === "object" || isFunction(a)) || false}; isFunction = function(a){return typeof a === "function"}})(jQuery);
|
||||
(function(a){a.jgrid.extend({getColProp:function(g){var d = {}, b = this[0]; if (b.grid){b = b.p.colModel; for (var n = 0; n < b.length; n++)if (b[n].name == g){d = b[n]; break}return d}}, setColProp:function(g, d){return this.each(function(){if (this.grid)if (d)for (var b = this.p.colModel, n = 0; n < b.length; n++)if (b[n].name == g){a.extend(this.p.colModel[n], d); break}})}, sortGrid:function(g, d, b){return this.each(function(){var n = this, s = - 1; if (n.grid){if (!g)g = n.p.sortname; for (var q = 0; q < n.p.colModel.length; q++)if (n.p.colModel[q].index ==
|
||||
g || n.p.colModel[q].name == g){s = q; break}if (s != - 1){q = n.p.colModel[s].sortable; if (typeof q !== "boolean")q = true; if (typeof d !== "boolean")d = false; q && n.sortData("jqgh_" + g, s, d, b)}}})}, GridDestroy:function(){return this.each(function(){if (this.grid){this.p.pager && a(this.p.pager).remove(); var g = this.id; try{a("#gbox_" + g).remove()} catch (d){}}})}, GridUnload:function(){return this.each(function(){if (this.grid){var g = {id:a(this).attr("id"), cl:a(this).attr("class")}; this.p.pager && a(this.p.pager).empty().removeClass("ui-state-default ui-jqgrid-pager corner-bottom");
|
||||
var d = document.createElement("table"); a(d).attr({id:g.id}); d.className = g.cl; g = this.id; a(d).removeClass("ui-jqgrid-btable"); if (a(this.p.pager).parents("#gbox_" + g).length === 1){a(d).insertBefore("#gbox_" + g).show(); a(this.p.pager).insertBefore("#gbox_" + g)} else a(d).insertBefore("#gbox_" + g).show(); a("#gbox_" + g).remove()}})}, setGridState:function(g){return this.each(function(){if (this.grid){var d = this; if (g == "hidden"){a(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv", "#gview_" + d.p.id).slideUp("fast"); d.p.pager && a(d.p.pager).slideUp("fast");
|
||||
d.p.toppager && a(d.p.toppager).slideUp("fast"); if (d.p.toolbar[0] === true){d.p.toolbar[1] == "both" && a(d.grid.ubDiv).slideUp("fast"); a(d.grid.uDiv).slideUp("fast")}d.p.footerrow && a(".ui-jqgrid-sdiv", "#gbox_" + d.p.id).slideUp("fast"); a(".ui-jqgrid-titlebar-close span", d.grid.cDiv).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s"); d.p.gridstate = "hidden"} else if (g == "visible"){a(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv", "#gview_" + d.p.id).slideDown("fast"); d.p.pager && a(d.p.pager).slideDown("fast");
|
||||
d.p.toppager && a(d.p.toppager).slideDown("fast"); if (d.p.toolbar[0] === true){d.p.toolbar[1] == "both" && a(d.grid.ubDiv).slideDown("fast"); a(d.grid.uDiv).slideDown("fast")}d.p.footerrow && a(".ui-jqgrid-sdiv", "#gbox_" + d.p.id).slideDown("fast"); a(".ui-jqgrid-titlebar-close span", d.grid.cDiv).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n"); d.p.gridstate = "visible"}}})}, updateGridRows:function(g, d, b){var n, s = false, q; this.each(function(){var h = this, l, o, c, f; if (!h.grid)return false;
|
||||
d || (d = "id"); g && g.length > 0 && a(g).each(function(){c = this; if (o = h.rows.namedItem(c[d])){f = c[d]; if (b === true)if (h.p.jsonReader.repeatitems === true){if (h.p.jsonReader.cell)c = c[h.p.jsonReader.cell]; for (var e = 0; e < c.length; e++){l = h.formatter(f, c[e], e, c, "edit"); q = h.p.colModel[e].title?{title:a.jgrid.stripHtml(l)}:{}; h.p.treeGrid === true && n == h.p.ExpandColumn?a("td:eq(" + e + ") > span:first", o).html(l).attr(q):a("td:eq(" + e + ")", o).html(l).attr(q)}return s = true}a(h.p.colModel).each(function(m){n = b === true?this.jsonmap ||
|
||||
this.name:this.name; if (c[n] !== undefined){l = h.formatter(f, c[n], m, c, "edit"); q = this.title?{title:a.jgrid.stripHtml(l)}:{}; h.p.treeGrid === true && n == h.p.ExpandColumn?a("td:eq(" + m + ") > span:first", o).html(l).attr(q):a("td:eq(" + m + ")", o).html(l).attr(q); s = true}})}})}); return s}, filterGrid:function(g, d){d = a.extend({gridModel:false, gridNames:false, gridToolbar:false, filterModel:[], formtype:"horizontal", autosearch:true, formclass:"filterform", tableclass:"filtertable", buttonclass:"filterbutton", searchButton:"Search",
|
||||
clearButton:"Clear", enableSearch:false, enableClear:false, beforeSearch:null, afterSearch:null, beforeClear:null, afterClear:null, url:"", marksearched:true}, d || {}); return this.each(function(){var b = this; this.p = d; if (this.p.filterModel.length === 0 && this.p.gridModel === false)alert("No filter is set"); else if (g){this.p.gridid = g.indexOf("#") != - 1?g:"#" + g; var n = a(this.p.gridid).jqGrid("getGridParam", "colModel"); if (n){if (this.p.gridModel === true){var s = a(this.p.gridid)[0], q; a.each(n, function(f){var e = []; this.search =
|
||||
this.search === false?false:true; q = this.editrules && this.editrules.searchhidden === true?true:this.hidden === true?false:true; if (this.search === true && q === true){e.label = b.p.gridNames === true?s.p.colNames[f]:""; e.name = this.name; e.index = this.index || this.name; e.stype = this.edittype || "text"; if (e.stype != "select")e.stype = "text"; e.defval = this.defval || ""; e.surl = this.surl || ""; e.sopt = this.editoptions || {}; e.width = this.width; b.p.filterModel.push(e)}})} else a.each(b.p.filterModel, function(){for (var f = 0; f < n.length; f++)if (this.name ==
|
||||
n[f].name){this.index = n[f].index || this.name; break}if (!this.index)this.index = this.name}); var h = function(){var f = {}, e = 0, m, i = a(b.p.gridid)[0], k; i.p.searchdata = {}; a.isFunction(b.p.beforeSearch) && b.p.beforeSearch(); a.each(b.p.filterModel, function(){k = this.index; switch (this.stype){case "select":if (m = a("select[name=" + k + "]", b).val()){f[k] = m; b.p.marksearched && a("#jqgh_" + this.name, i.grid.hDiv).addClass("dirty-cell"); e++} else{b.p.marksearched && a("#jqgh_" + this.name, i.grid.hDiv).removeClass("dirty-cell"); try{delete i.p.postData[this.index]} catch (r){}}break;
|
||||
default:if (m = a("input[name=" + k + "]", b).val()){f[k] = m; b.p.marksearched && a("#jqgh_" + this.name, i.grid.hDiv).addClass("dirty-cell"); e++} else{b.p.marksearched && a("#jqgh_" + this.name, i.grid.hDiv).removeClass("dirty-cell"); try{delete i.p.postData[this.index]} catch (u){}}}}); var p = e > 0?true:false; a.extend(i.p.postData, f); var j; if (b.p.url){j = a(i).jqGrid("getGridParam", "url"); a(i).jqGrid("setGridParam", {url:b.p.url})}a(i).jqGrid("setGridParam", {search:p}).trigger("reloadGrid", [{page:1}]); j && a(i).jqGrid("setGridParam",
|
||||
{url:j}); a.isFunction(b.p.afterSearch) && b.p.afterSearch()}, l = function(){var f = {}, e, m = 0, i = a(b.p.gridid)[0], k; a.isFunction(b.p.beforeClear) && b.p.beforeClear(); a.each(b.p.filterModel, function(){k = this.index; e = this.defval?this.defval:""; if (!this.stype)this.stype = "text"; switch (this.stype){case "select":var r; a("select[name=" + k + "] option", b).each(function(v){if (v === 0)this.selected = true; if (a(this).text() == e){this.selected = true; r = a(this).val(); return false}}); if (r){f[k] = r; b.p.marksearched && a("#jqgh_" + this.name,
|
||||
i.grid.hDiv).addClass("dirty-cell"); m++} else{b.p.marksearched && a("#jqgh_" + this.name, i.grid.hDiv).removeClass("dirty-cell"); try{delete i.p.postData[this.index]} catch (u){}}break; case "text":a("input[name=" + k + "]", b).val(e); if (e){f[k] = e; b.p.marksearched && a("#jqgh_" + this.name, i.grid.hDiv).addClass("dirty-cell"); m++} else{b.p.marksearched && a("#jqgh_" + this.name, i.grid.hDiv).removeClass("dirty-cell"); try{delete i.p.postData[this.index]} catch (t){}}break}}); var p = m > 0?true:false; a.extend(i.p.postData, f); var j;
|
||||
if (b.p.url){j = a(i).jqGrid("getGridParam", "url"); a(i).jqGrid("setGridParam", {url:b.p.url})}a(i).jqGrid("setGridParam", {search:p}).trigger("reloadGrid", [{page:1}]); j && a(i).jqGrid("setGridParam", {url:j}); a.isFunction(b.p.afterClear) && b.p.afterClear()}, o = a("<form name='SearchForm' style=display:inline;' class='" + this.p.formclass + "'></form>"), c = a("<table class='" + this.p.tableclass + "' cellspacing='0' cellpading='0' border='0'><tbody></tbody></table>"); a(o).append(c); (function(){var f = document.createElement("tr"),
|
||||
e, m, i, k; b.p.formtype == "horizontal" && a(c).append(f); a.each(b.p.filterModel, function(p){i = document.createElement("td"); a(i).append("<label for='" + this.name + "'>" + this.label + "</label>"); k = document.createElement("td"); var j = this; if (!this.stype)this.stype = "text"; switch (this.stype){case "select":if (this.surl)a(k).load(this.surl, function(){j.defval && a("select", this).val(j.defval); a("select", this).attr({name:j.index || j.name, id:"sg_" + j.name}); j.sopt && a("select", this).attr(j.sopt); b.p.gridToolbar === true && j.width &&
|
||||
a("select", this).width(j.width); b.p.autosearch === true && a("select", this).change(function(){h(); return false})}); else if (j.sopt.value){var r = j.sopt.value, u = document.createElement("select"); a(u).attr({name:j.index || j.name, id:"sg_" + j.name}).attr(j.sopt); var t; if (typeof r === "string"){p = r.split(";"); for (var v = 0; v < p.length; v++){r = p[v].split(":"); t = document.createElement("option"); t.value = r[0]; t.innerHTML = r[1]; if (r[1] == j.defval)t.selected = "selected"; u.appendChild(t)}} else if (typeof r === "object")for (v in r)if (r.hasOwnProperty(v)){p++;
|
||||
t = document.createElement("option"); t.value = v; t.innerHTML = r[v]; if (r[v] == j.defval)t.selected = "selected"; u.appendChild(t)}b.p.gridToolbar === true && j.width && a(u).width(j.width); a(k).append(u); b.p.autosearch === true && a(u).change(function(){h(); return false})}break; case "text":u = this.defval?this.defval:""; a(k).append("<input type='text' name='" + (this.index || this.name) + "' id='sg_" + this.name + "' value='" + u + "'/>"); j.sopt && a("input", k).attr(j.sopt); if (b.p.gridToolbar === true && j.width)a.browser.msie?a("input", k).width(j.width -
|
||||
4):a("input", k).width(j.width - 2); b.p.autosearch === true && a("input", k).keypress(function(w){if ((w.charCode?w.charCode:w.keyCode?w.keyCode:0) == 13){h(); return false}return this}); break}if (b.p.formtype == "horizontal"){b.p.gridToolbar === true && b.p.gridNames === false?a(f).append(k):a(f).append(i).append(k); a(f).append(k)} else{e = document.createElement("tr"); a(e).append(i).append(k); a(c).append(e)}}); k = document.createElement("td"); if (b.p.enableSearch === true){m = "<input type='button' id='sButton' class='" + b.p.buttonclass +
|
||||
"' value='" + b.p.searchButton + "'/>"; a(k).append(m); a("input#sButton", k).click(function(){h(); return false})}if (b.p.enableClear === true){m = "<input type='button' id='cButton' class='" + b.p.buttonclass + "' value='" + b.p.clearButton + "'/>"; a(k).append(m); a("input#cButton", k).click(function(){l(); return false})}if (b.p.enableClear === true || b.p.enableSearch === true)if (b.p.formtype == "horizontal")a(f).append(k); else{e = document.createElement("tr"); a(e).append("<td> </td>").append(k); a(c).append(e)}})(); a(this).append(o);
|
||||
this.triggerSearch = h; this.clearSearch = l} else alert("Could not get grid colModel")} else alert("No target grid is set!")})}, filterToolbar:function(g){g = a.extend({autosearch:true, searchOnEnter:true, beforeSearch:null, afterSearch:null, beforeClear:null, afterClear:null, searchurl:"", stringResult:false, groupOp:"AND"}, g || {}); return this.each(function(){function d(h, l){var o = a(h); o[0] && jQuery.each(l, function(){this.data !== undefined?o.bind(this.type, this.data, this.fn):o.bind(this.type, this.fn)})}var b = this, n =
|
||||
function(){var h = {}, l = 0, o, c, f = {}; a.each(b.p.colModel, function(){c = this.index || this.name; var j = this.searchoptions && this.searchoptions.sopt?this.searchoptions.sopt[0]:"bw"; switch (this.stype){case "select":if (o = a("select[name=" + c + "]", b.grid.hDiv).val()){h[c] = o; f[c] = j; l++} else try{delete b.p.postData[c]} catch (r){}break; case "text":if (o = a("input[name=" + c + "]", b.grid.hDiv).val()){h[c] = o; f[c] = j; l++} else try{delete b.p.postData[c]} catch (u){}break}}); var e = l > 0?true:false; if (g.stringResult){var m = '{"groupOp":"' +
|
||||
g.groupOp + '","rules":[', i = 0; a.each(h, function(j, r){if (i > 0)m += ","; m += '{"field":"' + j + '",'; m += '"op":"' + f[j] + '",'; m += '"data":"' + r + '"}'; i++}); m += "]}"; a.extend(b.p.postData, {filters:m})} else a.extend(b.p.postData, h); var k; if (b.p.searchurl){k = b.p.url; a(b).jqGrid("setGridParam", {url:b.p.searchurl})}var p = false; if (a.isFunction(g.beforeSearch))p = g.beforeSearch.call(b); p || a(b).jqGrid("setGridParam", {search:e}).trigger("reloadGrid", [{page:1}]); k && a(b).jqGrid("setGridParam", {url:k}); a.isFunction(g.afterSearch) &&
|
||||
g.afterSearch()}, s = a("<tr class='ui-search-toolbar' role='rowheader'></tr>"), q; a.each(b.p.colModel, function(){var h = this, l, o, c, f; o = a("<th role='columnheader' class='ui-state-default ui-th-column ui-th-" + b.p.direction + "'></th>"); l = a("<div style='width:100%;position:relative;height:100%;padding-right:0.3em;'></div>"); this.hidden === true && a(o).css("display", "none"); this.search = this.search === false?false:true; if (typeof this.stype == "undefined")this.stype = "text"; c = a.extend({}, this.searchoptions || {}); if (this.search)switch (this.stype){case "select":if (f =
|
||||
this.surl || c.dataUrl)a.ajax(a.extend({url:f, dataType:"html", complete:function(p){if (c.buildSelect !== undefined)(p = c.buildSelect(p)) && a(l).append(p); else a(l).append(p.responseText); c.defaultValue && a("select", l).val(c.defaultValue); a("select", l).attr({name:h.index || h.name, id:"gs_" + h.name}); c.attr && a("select", l).attr(c.attr); a("select", l).css({width:"100%"}); c.dataInit !== undefined && c.dataInit(a("select", l)[0]); c.dataEvents !== undefined && d(a("select", l)[0], c.dataEvents); g.autosearch === true && a("select",
|
||||
l).change(function(){n(); return false}); p = null}}, a.jgrid.ajaxOptions, b.p.ajaxSelectOptions || {})); else{var e; if (h.searchoptions && h.searchoptions.value)e = h.searchoptions.value; else if (h.editoptions && h.editoptions.value)e = h.editoptions.value; if (e){f = document.createElement("select"); f.style.width = "100%"; a(f).attr({name:h.index || h.name, id:"gs_" + h.name}); var m, i; if (typeof e === "string"){e = e.split(";"); for (var k = 0; k < e.length; k++){m = e[k].split(":"); i = document.createElement("option"); i.value = m[0]; i.innerHTML =
|
||||
m[1]; f.appendChild(i)}} else if (typeof e === "object")for (m in e)if (e.hasOwnProperty(m)){i = document.createElement("option"); i.value = m; i.innerHTML = e[m]; f.appendChild(i)}c.defaultValue && a(f).val(c.defaultValue); c.attr && a(f).attr(c.attr); c.dataInit !== undefined && c.dataInit(f); c.dataEvents !== undefined && d(f, c.dataEvents); a(l).append(f); g.autosearch === true && a(f).change(function(){n(); return false})}}break; case "text":f = c.defaultValue?c.defaultValue:""; a(l).append("<input type='text' style='width:95%;padding:0px;' name='" +
|
||||
(h.index || h.name) + "' id='gs_" + h.name + "' value='" + f + "'/>"); c.attr && a("input", l).attr(c.attr); c.dataInit !== undefined && c.dataInit(a("input", l)[0]); c.dataEvents !== undefined && d(a("input", l)[0], c.dataEvents); if (g.autosearch === true)g.searchOnEnter?a("input", l).keypress(function(p){if ((p.charCode?p.charCode:p.keyCode?p.keyCode:0) == 13){n(); return false}return this}):a("input", l).keydown(function(p){switch (p.which){case 9:case 16:case 37:case 38:case 39:case 40:case 27:break; default:q && clearTimeout(q); q = setTimeout(function(){n()},
|
||||
500)}}); break}a(o).append(l); a(s).append(o)}); a("table thead", b.grid.hDiv).append(s); this.triggerToolbar = n; this.clearToolbar = function(h){var l = {}, o, c = 0, f; h = typeof h != "boolean"?true:h; a.each(b.p.colModel, function(){o = this.searchoptions && this.searchoptions.defaultValue?this.searchoptions.defaultValue:""; f = this.index || this.name; switch (this.stype){case "select":var j; a("select[name=" + f + "] option", b.grid.hDiv).each(function(t){if (t === 0)this.selected = true; if (a(this).text() == o){this.selected = true; j = a(this).val();
|
||||
return false}}); if (j){l[f] = j; c++} else try{delete b.p.postData[f]} catch (r){}break; case "text":a("input[name=" + f + "]", b.grid.hDiv).val(o); if (o){l[f] = o; c++} else try{delete b.p.postData[f]} catch (u){}break}}); var e = c > 0?true:false; if (g.stringResult){var m = '{"groupOp":"' + g.groupOp + '","rules":[', i = 0; a.each(l, function(j, r){if (i > 0)m += ","; m += '{"field":"' + j + '",'; m += '"op":"eq",'; m += '"data":"' + r + '"}'; i++}); m += "]}"; a.extend(b.p.postData, {filters:m})} else a.extend(b.p.postData, l); var k; if (b.p.searchurl){k = b.p.url;
|
||||
a(b).jqGrid("setGridParam", {url:b.p.searchurl})}var p = false; if (a.isFunction(g.beforeClear))p = g.beforeClear.call(b); p || h && a(b).jqGrid("setGridParam", {search:e}).trigger("reloadGrid", [{page:1}]); k && a(b).jqGrid("setGridParam", {url:k}); a.isFunction(g.afterClear) && g.afterClear()}; this.toggleToolbar = function(){var h = a("tr.ui-search-toolbar", b.grid.hDiv); h.css("display") == "none"?h.show():h.hide()}})}})})(jQuery);
|
||||
var showModal = function(a){a.w.show()}, closeModal = function(a){a.w.hide().attr("aria-hidden", "true"); a.o && a.o.remove()}, hideModal = function(a, b){b = jQuery.extend({jqm:true, gb:""}, b || {}); if (b.onClose){var c = b.onClose(a); if (typeof c == "boolean" && !c)return}if (jQuery.fn.jqm && b.jqm === true)jQuery(a).attr("aria-hidden", "true").jqmHide(); else{if (b.gb != "")try{jQuery(".jqgrid-overlay:first", b.gb).hide()} catch (e){}jQuery(a).hide().attr("aria-hidden", "true")}};
|
||||
function findPos(a){var b = 0, c = 0; if (a.offsetParent){do{b += a.offsetLeft; c += a.offsetTop}while (a = a.offsetParent)}return[b, c]}
|
||||
var createModal = function(a, b, c, e, f, h){var d = document.createElement("div"), g; g = jQuery(c.gbox).attr("dir") == "rtl"?true:false; d.className = "ui-widget ui-widget-content ui-corner-all ui-jqdialog"; d.id = a.themodal; var i = document.createElement("div"); i.className = "ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix"; i.id = a.modalhead; jQuery(i).append("<span class='ui-jqdialog-title'>" + c.caption + "</span>"); var j = jQuery("<a href='javascript:void(0)' class='ui-jqdialog-titlebar-close ui-corner-all'></a>").hover(function(){j.addClass("ui-state-hover")},
|
||||
function(){j.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-closethick'></span>"); jQuery(i).append(j); if (g){d.dir = "rtl"; jQuery(".ui-jqdialog-title", i).css("float", "right"); jQuery(".ui-jqdialog-titlebar-close", i).css("left", "0.3em")} else{d.dir = "ltr"; jQuery(".ui-jqdialog-title", i).css("float", "left"); jQuery(".ui-jqdialog-titlebar-close", i).css("right", "0.3em")}var l = document.createElement("div"); jQuery(l).addClass("ui-jqdialog-content ui-widget-content").attr("id", a.modalcontent);
|
||||
jQuery(l).append(b); d.appendChild(l); jQuery(d).prepend(i); h === true?jQuery("body").append(d):jQuery(d).insertBefore(e); if (typeof c.jqModal === "undefined")c.jqModal = true; b = {}; if (jQuery.fn.jqm && c.jqModal === true){if (c.left === 0 && c.top === 0){e = []; e = findPos(f); c.left = e[0] + 4; c.top = e[1] + 4}b.top = c.top + "px"; b.left = c.left} else if (c.left !== 0 || c.top !== 0){b.left = c.left; b.top = c.top + "px"}jQuery("a.ui-jqdialog-titlebar-close", i).click(function(){var n = jQuery("#" + a.themodal).data("onClose") || c.onClose, k = jQuery("#" + a.themodal).data("gbox") ||
|
||||
c.gbox; hideModal("#" + a.themodal, {gb:k, jqm:c.jqModal, onClose:n}); return false}); if (c.width === 0 || !c.width)c.width = 300; if (c.height === 0 || !c.height)c.height = 200; if (!c.zIndex)c.zIndex = 950; f = 0; if (g && b.left && !h){f = jQuery(c.gbox).width() - (!isNaN(c.width)?parseInt(c.width, 10):0) - 8; b.left = parseInt(b.left, 10) + parseInt(f, 10)}if (b.left)b.left += "px"; jQuery(d).css(jQuery.extend({width:isNaN(c.width)?"auto":c.width + "px", height:isNaN(c.height)?"auto":c.height + "px", zIndex:c.zIndex, overflow:"hidden"}, b)).attr({tabIndex:"-1",
|
||||
role:"dialog", "aria-labelledby":a.modalhead, "aria-hidden":"true"}); if (typeof c.drag == "undefined")c.drag = true; if (typeof c.resize == "undefined")c.resize = true; if (c.drag){jQuery(i).css("cursor", "move"); if (jQuery.fn.jqDrag)jQuery(d).jqDrag(i); else try{jQuery(d).draggable({handle:jQuery("#" + i.id)})} catch (q){}}if (c.resize)if (jQuery.fn.jqResize){jQuery(d).append("<div class='jqResize ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se ui-icon-grip-diagonal-se'></div>"); jQuery("#" + a.themodal).jqResize(".jqResize",
|
||||
a.scrollelm?"#" + a.scrollelm:false)} else try{jQuery(d).resizable({handles:"se, sw", alsoResize:a.scrollelm?"#" + a.scrollelm:false})} catch (o){}c.closeOnEscape === true && jQuery(d).keydown(function(n){if (n.which == 27){n = jQuery("#" + a.themodal).data("onClose") || c.onClose; hideModal(this, {gb:c.gbox, jqm:c.jqModal, onClose:n})}})}, viewModal = function(a, b){b = jQuery.extend({toTop:true, overlay:10, modal:false, onShow:showModal, onHide:closeModal, gbox:"", jqm:true, jqM:true}, b || {}); if (jQuery.fn.jqm && b.jqm === true)b.jqM?jQuery(a).attr("aria-hidden",
|
||||
"false").jqm(b).jqmShow():jQuery(a).attr("aria-hidden", "false").jqmShow(); else{if (b.gbox != ""){jQuery(".jqgrid-overlay:first", b.gbox).show(); jQuery(a).data("gbox", b.gbox)}jQuery(a).show().attr("aria-hidden", "false"); try{jQuery(":input:visible", a)[0].focus()} catch (c){}}};
|
||||
function info_dialog(a, b, c, e){var f = {width:290, height:"auto", dataheight:"auto", drag:true, resize:false, caption:"<b>" + a + "</b>", left:250, top:170, zIndex:1E3, jqModal:true, modal:false, closeOnEscape:true, align:"center", buttonalign:"center", buttons:[]}; jQuery.extend(f, e || {}); var h = f.jqModal; if (jQuery.fn.jqm && !h)h = false; a = ""; if (f.buttons.length > 0)for (e = 0; e < f.buttons.length; e++){if (typeof f.buttons[e].id == "undefined")f.buttons[e].id = "info_button_" + e; a += "<a href='javascript:void(0)' id='" + f.buttons[e].id + "' class='fm-button ui-state-default ui-corner-all'>" +
|
||||
f.buttons[e].text + "</a>"}e = isNaN(f.dataheight)?f.dataheight:f.dataheight + "px"; var d = "<div id='info_id'>"; d += "<div id='infocnt' style='margin:0px;padding-bottom:1em;width:100%;overflow:auto;position:relative;height:" + e + ";" + ("text-align:" + f.align + ";") + "'>" + b + "</div>"; d += c?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:" + f.buttonalign + ";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'><a href='javascript:void(0)' id='closedialog' class='fm-button ui-state-default ui-corner-all'>" +
|
||||
c + "</a>" + a + "</div>":a != ""?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:" + f.buttonalign + ";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'>" + a + "</div>":""; d += "</div>"; try{jQuery("#info_dialog").attr("aria-hidden") == "false" && hideModal("#info_dialog", {jqm:h}); jQuery("#info_dialog").remove()} catch (g){}createModal({themodal:"info_dialog", modalhead:"info_head", modalcontent:"info_content", scrollelm:"infocnt"}, d, f, "", "", true); a && jQuery.each(f.buttons,
|
||||
function(j){jQuery("#" + this.id, "#info_id").bind("click", function(){f.buttons[j].onClick.call(jQuery("#info_dialog")); return false})}); jQuery("#closedialog", "#info_id").click(function(j){hideModal("#info_dialog", {jqm:h}); return false}); jQuery(".fm-button", "#info_dialog").hover(function(){jQuery(this).addClass("ui-state-hover")}, function(){jQuery(this).removeClass("ui-state-hover")}); viewModal("#info_dialog", {onHide:function(j){j.w.hide().remove(); j.o && j.o.remove()}, modal:f.modal, jqm:h}); try{$("#info_dialog").focus()} catch (i){}}
|
||||
function createEl(a, b, c, e, f){function h(k, m){if (jQuery.isFunction(m.dataInit)){k.id = m.id; m.dataInit(k); delete m.id; delete m.dataInit}if (m.dataEvents){jQuery.each(m.dataEvents, function(){this.data !== undefined?jQuery(k).bind(this.type, this.data, this.fn):jQuery(k).bind(this.type, this.fn)}); delete m.dataEvents}return m}var d = ""; b.defaultValue && delete b.defaultValue; switch (a){case "textarea":d = document.createElement("textarea"); if (e)b.cols || jQuery(d).css({width:"98%"}); else if (!b.cols)b.cols = 20; if (!b.rows)b.rows =
|
||||
2; if (c == " " || c == " " || c.length == 1 && c.charCodeAt(0) == 160)c = ""; d.value = c; b = h(d, b); jQuery(d).attr(b).attr({role:"textbox", multiline:"true"}); break; case "checkbox":d = document.createElement("input"); d.type = "checkbox"; if (b.value){var g = b.value.split(":"); if (c === g[0]){d.checked = true; d.defaultChecked = true}d.value = g[0]; jQuery(d).attr("offval", g[1]); try{delete b.value} catch (i){}} else{g = c.toLowerCase(); if (g.search(/(false|0|no|off|undefined)/i) < 0 && g !== ""){d.checked = true; d.defaultChecked = true; d.value =
|
||||
c} else d.value = "on"; jQuery(d).attr("offval", "off")}b = h(d, b); jQuery(d).attr(b).attr("role", "checkbox"); break; case "select":d = document.createElement("select"); d.setAttribute("role", "select"); var j, l = []; if (b.multiple === true){j = true; d.multiple = "multiple"; $(d).attr("aria-multiselectable", "true")} else j = false; if (typeof b.dataUrl != "undefined")jQuery.ajax(jQuery.extend({url:b.dataUrl, type:"GET", complete:function(k, m){try{delete b.dataUrl; delete b.value} catch (r){}if (typeof b.buildSelect != "undefined"){k = b.buildSelect(k);
|
||||
k = jQuery(k).html(); delete b.buildSelect} else k = jQuery(k.responseText).html(); if (k){jQuery(d).append(k); b = h(d, b); if (typeof b.size === "undefined")b.size = j?3:1; if (j){l = c.split(","); l = jQuery.map(l, function(p){return jQuery.trim(p)})} else l[0] = jQuery.trim(c); jQuery(d).attr(b); setTimeout(function(){jQuery("option", d).each(function(p){if (p === 0)this.selected = ""; $(this).attr("role", "option"); if (jQuery.inArray(jQuery.trim(jQuery(this).text()), l) > - 1 || jQuery.inArray(jQuery.trim(jQuery(this).val()), l) > - 1){this.selected =
|
||||
"selected"; if (!j)return false}})}, 0)}}}, f || {})); else if (b.value){if (j){l = c.split(","); l = jQuery.map(l, function(k){return jQuery.trim(k)}); if (typeof b.size === "undefined")b.size = 3} else b.size = 1; if (typeof b.value === "function")b.value = b.value(); if (typeof b.value === "string"){e = b.value.split(";"); for (g = 0; g < e.length; g++){f = e[g].split(":"); if (f.length > 2)f[1] = jQuery.map(f, function(k, m){if (m > 0)return k}).join(":"); a = document.createElement("option"); a.setAttribute("role", "option"); a.value = f[0]; a.innerHTML = f[1];
|
||||
if (!j && (jQuery.trim(f[0]) == jQuery.trim(c) || jQuery.trim(f[1]) == jQuery.trim(c)))a.selected = "selected"; if (j && (jQuery.inArray(jQuery.trim(f[1]), l) > - 1 || jQuery.inArray(jQuery.trim(f[0]), l) > - 1))a.selected = "selected"; d.appendChild(a)}} else if (typeof b.value === "object"){e = b.value; for (g in e)if (e.hasOwnProperty(g)){a = document.createElement("option"); a.setAttribute("role", "option"); a.value = g; a.innerHTML = e[g]; if (!j && (jQuery.trim(g) == jQuery.trim(c) || jQuery.trim(e[g]) == jQuery.trim(c)))a.selected = "selected"; if (j &&
|
||||
(jQuery.inArray(jQuery.trim(e[g]), l) > - 1 || jQuery.inArray(jQuery.trim(g), l) > - 1))a.selected = "selected"; d.appendChild(a)}}b = h(d, b); try{delete b.value} catch (q){}jQuery(d).attr(b)}break; case "text":case "password":case "button":g = a == "button"?"button":"textbox"; d = document.createElement("input"); d.type = a; d.value = c; b = h(d, b); if (a != "button")if (e)b.size || jQuery(d).css({width:"98%"}); else if (!b.size)b.size = 20; jQuery(d).attr(b).attr("role", g); break; case "image":case "file":d = document.createElement("input"); d.type =
|
||||
a; b = h(d, b); jQuery(d).attr(b); break; case "custom":d = document.createElement("span"); try{if (jQuery.isFunction(b.custom_element)){var o = b.custom_element.call(this, c, b); if (o){o = jQuery(o).addClass("customelement").attr({id:b.id, name:b.name}); jQuery(d).empty().append(o)} else throw"e2"; } else throw"e1"; } catch (n){n == "e1" && info_dialog(jQuery.jgrid.errors.errcap, "function 'custom_element' " + jQuery.jgrid.edit.msg.nodefined, jQuery.jgrid.edit.bClose); n == "e2"?info_dialog(jQuery.jgrid.errors.errcap, "function 'custom_element' " +
|
||||
jQuery.jgrid.edit.msg.novalue, jQuery.jgrid.edit.bClose):info_dialog(jQuery.jgrid.errors.errcap, n.message, jQuery.jgrid.edit.bClose)}break}return d}function daysInFebruary(a){return a % 4 === 0 && (a % 100 !== 0 || a % 400 === 0)?29:28}function DaysArray(a){for (var b = 1; b <= a; b++){this[b] = 31; if (b == 4 || b == 6 || b == 9 || b == 11)this[b] = 30; if (b == 2)this[b] = 29}return this}
|
||||
function checkDate(a, b){var c = {}, e; a = a.toLowerCase(); e = a.indexOf("/") != - 1?"/":a.indexOf("-") != - 1?"-":a.indexOf(".") != - 1?".":"/"; a = a.split(e); b = b.split(e); if (b.length != 3)return false; e = - 1; for (var f, h = - 1, d = - 1, g = 0; g < a.length; g++){f = isNaN(b[g])?0:parseInt(b[g], 10); c[a[g]] = f; f = a[g]; if (f.indexOf("y") != - 1)e = g; if (f.indexOf("m") != - 1)d = g; if (f.indexOf("d") != - 1)h = g}f = a[e] == "y" || a[e] == "yyyy"?4:a[e] == "yy"?2: - 1; g = DaysArray(12); var i; if (e === - 1)return false; else{i = c[a[e]].toString(); if (f == 2 && i.length == 1)f = 1; if (i.length !=
|
||||
f || c[a[e]] === 0 && b[e] != "00")return false}if (d === - 1)return false; else{i = c[a[d]].toString(); if (i.length < 1 || c[a[d]] < 1 || c[a[d]] > 12)return false}if (h === - 1)return false; else{i = c[a[h]].toString(); if (i.length < 1 || c[a[h]] < 1 || c[a[h]] > 31 || c[a[d]] == 2 && c[a[h]] > daysInFebruary(c[a[e]]) || c[a[h]] > g[c[a[d]]])return false}return true}function isEmpty(a){return a.match(/^s+$/) || a == ""?true:false}
|
||||
function checkTime(a){var b = /^(\d{1,2}):(\d{2})([ap]m)?$/; if (!isEmpty(a))if (a = a.match(b)){if (a[3]){if (a[1] < 1 || a[1] > 12)return false} else if (a[1] > 23)return false; if (a[2] > 59)return false} else return false; return true}
|
||||
function checkValues(a, b, c){var e, f, h; if (typeof b == "string"){f = 0; for (len = c.p.colModel.length; f < len; f++)if (c.p.colModel[f].name == b){e = c.p.colModel[f].editrules; b = f; try{h = c.p.colModel[f].formoptions.label} catch (d){}break}} else if (b >= 0)e = c.p.colModel[b].editrules; if (e){h || (h = c.p.colNames[b]); if (e.required === true)if (a.match(/^s+$/) || a == "")return[false, h + ": " + jQuery.jgrid.edit.msg.required, ""]; f = e.required === false?false:true; if (e.number === true)if (!(f === false && isEmpty(a)))if (isNaN(a))return[false, h + ": " +
|
||||
jQuery.jgrid.edit.msg.number, ""]; if (typeof e.minValue != "undefined" && !isNaN(e.minValue))if (parseFloat(a) < parseFloat(e.minValue))return[false, h + ": " + jQuery.jgrid.edit.msg.minValue + " " + e.minValue, ""]; if (typeof e.maxValue != "undefined" && !isNaN(e.maxValue))if (parseFloat(a) > parseFloat(e.maxValue))return[false, h + ": " + jQuery.jgrid.edit.msg.maxValue + " " + e.maxValue, ""]; var g; if (e.email === true)if (!(f === false && isEmpty(a))){g = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i;
|
||||
if (!g.test(a))return[false, h + ": " + jQuery.jgrid.edit.msg.email, ""]}if (e.integer === true)if (!(f === false && isEmpty(a))){if (isNaN(a))return[false, h + ": " + jQuery.jgrid.edit.msg.integer, ""]; if (a % 1 !== 0 || a.indexOf(".") != - 1)return[false, h + ": " + jQuery.jgrid.edit.msg.integer, ""]}if (e.date === true)if (!(f === false && isEmpty(a))){b = c.p.colModel[b].datefmt || "Y-m-d"; if (!checkDate(b, a))return[false, h + ": " + jQuery.jgrid.edit.msg.date + " - " + b, ""]}if (e.time === true)if (!(f === false && isEmpty(a)))if (!checkTime(a))return[false, h +
|
||||
": " + jQuery.jgrid.edit.msg.date + " - hh:mm (am/pm)", ""]; if (e.url === true)if (!(f === false && isEmpty(a))){g = /^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i; if (!g.test(a))return[false, h + ": " + jQuery.jgrid.edit.msg.url, ""]}if (e.custom === true)if (!(f === false && isEmpty(a)))if (jQuery.isFunction(e.custom_func)){a = e.custom_func.call(c, a, h); return jQuery.isArray(a)?a:[false, jQuery.jgrid.edit.msg.customarray, ""]} else return[false, jQuery.jgrid.edit.msg.customfcheck,
|
||||
""]}return[true, "", ""]};
|
||||
(function(a){var c = null; a.jgrid.extend({searchGrid:function(d){d = a.extend({recreateFilter:false, drag:true, sField:"searchField", sValue:"searchString", sOper:"searchOper", sFilter:"filters", loadDefaults:true, beforeShowSearch:null, afterShowSearch:null, onInitializeSearch:null, closeAfterSearch:false, closeAfterReset:false, closeOnEscape:false, multipleSearch:false, cloneSearchRowOnAdd:true, sopt:null, stringResult:undefined, onClose:null, useDataProxy:false, overlay:true}, a.jgrid.search, d || {}); return this.each(function(){function b(o,
|
||||
s){s = o.p.postData[s.sFilter]; if (typeof s == "string")s = a.jgrid.parse(s); if (s){s.groupOp && o.SearchFilter.setGroupOp(s.groupOp); if (s.rules){var y, J = 0, k = s.rules.length; for (y = false; J < k; J++){y = s.rules[J]; if (y.field !== undefined && y.op !== undefined && y.data !== undefined)(y = o.SearchFilter.setFilter({sfref:o.SearchFilter.$.find(".sf:last"), filter:a.extend({}, y)})) && o.SearchFilter.add()}}}}function q(o){var s = o !== undefined, y = a("#" + z.p.id), J = {}; if (d.multipleSearch === false){J[d.sField] = o.rules[0].field; J[d.sValue] =
|
||||
o.rules[0].data; J[d.sOper] = o.rules[0].op} else J[d.sFilter] = o; y[0].p.search = s; a.extend(y[0].p.postData, J); y.trigger("reloadGrid", [{page:1}]); d.closeAfterSearch && t(a("#" + h))}function D(o){o = o !== undefined; var s = a("#" + z.p.id), y = []; s[0].p.search = o; if (d.multipleSearch === false)y[d.sField] = y[d.sValue] = y[d.sOper] = ""; else y[d.sFilter] = ""; a.extend(s[0].p.postData, y); s.trigger("reloadGrid", [{page:1}]); d.closeAfterReset && t(a("#" + h))}function t(o){if (d.onClose){var s = d.onClose(o); if (typeof s == "boolean" && !s)return}o.hide();
|
||||
d.overlay === true && a(".jqgrid-overlay:first", "#gbox_" + z.p.id).hide()}function F(){var o = a(".ui-searchFilter").length; if (o > 1){var s = a("#" + h).css("zIndex"); a("#" + h).css({zIndex:parseInt(s, 10) + o})}a("#" + h).show(); d.overlay === true && a(".jqgrid-overlay:first", "#gbox_" + z.p.id).show(); try{a(":input:visible", "#" + h)[0].focus()} catch (y){}}var z = this; if (z.grid)if (a.fn.searchFilter){var h = "fbox_" + z.p.id; d.recreateFilter === true && a("#" + h).remove(); if (a("#" + h).html() != null){a.isFunction(d.beforeShowSearch) && d.beforeShowSearch(a("#" +
|
||||
h)); F(); a.isFunction(d.afterShowSearch) && d.afterShowSearch(a("#" + h))} else{var p = [], H = a("#" + z.p.id).jqGrid("getGridParam", "colNames"), f = a("#" + z.p.id).jqGrid("getGridParam", "colModel"), l = ["eq", "ne", "lt", "le", "gt", "ge", "bw", "bn", "in", "ni", "ew", "en", "cn", "nc"], e, j, m, u = []; if (d.sopt !== null)for (e = m = 0; e < d.sopt.length; e++){if ((j = a.inArray(d.sopt[e], l)) != - 1){u[m] = {op:d.sopt[e], text:d.odata[j]}; m++}} else for (e = 0; e < l.length; e++)u[e] = {op:l[e], text:d.odata[e]}; a.each(f, function(o, s){var y = typeof s.search === "undefined"?
|
||||
true:s.search, J = s.hidden === true; o = a.extend({}, {text:H[o], itemval:s.index || s.name}, this.searchoptions); s = o.searchhidden === true; if (typeof o.sopt !== "undefined"){m = 0; o.ops = []; if (o.sopt.length > 0)for (e = 0; e < o.sopt.length; e++)if ((j = a.inArray(o.sopt[e], l)) != - 1){o.ops[m] = {op:o.sopt[e], text:d.odata[j]}; m++}}if (typeof this.stype === "undefined")this.stype = "text"; if (this.stype == "select")if (o.dataUrl === undefined){var k; if (o.value)k = o.value; else if (this.editoptions)k = this.editoptions.value; if (k){o.dataValues = []; if (typeof k ===
|
||||
"string"){k = k.split(";"); var i; for (e = 0; e < k.length; e++){i = k[e].split(":"); o.dataValues[e] = {value:i[0], text:i[1]}}} else if (typeof k === "object"){e = 0; for (i in k)if (k.hasOwnProperty(i)){o.dataValues[e] = {value:i, text:k[i]}; e++}}}}if (s && y || y && !J)p.push(o)}); if (p.length > 0){a("<div id='" + h + "' role='dialog' tabindex='-1'></div>").insertBefore("#gview_" + z.p.id); if (d.stringResult === undefined)d.stringResult = d.multipleSearch; z.SearchFilter = a("#" + h).searchFilter(p, {groupOps:d.groupOps, operators:u, onClose:t, resetText:d.Reset,
|
||||
searchText:d.Find, windowTitle:d.caption, rulesText:d.rulesText, matchText:d.matchText, onSearch:q, onReset:D, stringResult:d.stringResult, ajaxSelectOptions:a.extend({}, a.jgrid.ajaxOptions, z.p.ajaxSelectOptions || {}), clone:d.cloneSearchRowOnAdd}); a(".ui-widget-overlay", "#" + h).remove(); z.p.direction == "rtl" && a(".ui-closer", "#" + h).css("float", "left"); if (d.drag === true){a("#" + h + " table thead tr:first td:first").css("cursor", "move"); if (jQuery.fn.jqDrag)a("#" + h).jqDrag(a("#" + h + " table thead tr:first td:first"));
|
||||
else try{a("#" + h).draggable({handle:a("#" + h + " table thead tr:first td:first")})} catch (Q){}}if (d.multipleSearch === false){a(".ui-del, .ui-add, .ui-del, .ui-add-last, .matchText, .rulesText", "#" + h).hide(); a("select[name='groupOp']", "#" + h).hide()}d.multipleSearch === true && d.loadDefaults === true && b(z, d); a.isFunction(d.onInitializeSearch) && d.onInitializeSearch(a("#" + h)); a.isFunction(d.beforeShowSearch) && d.beforeShowSearch(a("#" + h)); F(); a.isFunction(d.afterShowSearch) && d.afterShowSearch(a("#" + h)); d.closeOnEscape ===
|
||||
true && a("#" + h).keydown(function(o){o.which == 27 && t(a("#" + h))})}}}})}, editGridRow:function(d, b){c = b = a.extend({top:0, left:0, width:300, height:"auto", dataheight:"auto", modal:false, drag:true, resize:true, url:null, mtype:"POST", clearAfterAdd:true, closeAfterEdit:false, reloadAfterSubmit:true, onInitializeForm:null, beforeInitData:null, beforeShowForm:null, afterShowForm:null, beforeSubmit:null, afterSubmit:null, onclickSubmit:null, afterComplete:null, onclickPgButtons:null, afterclickPgButtons:null, editData:{}, recreateForm:false,
|
||||
jqModal:true, closeOnEscape:false, addedrow:"first", topinfo:"", bottominfo:"", saveicon:[], closeicon:[], savekey:[false, 13], navkeys:[false, 38, 40], checkOnSubmit:false, checkOnUpdate:false, _savedData:{}, processing:false, onClose:null, ajaxEditOptions:{}, serializeEditData:null, viewPagerButtons:true}, a.jgrid.edit, b || {}); return this.each(function(){function q(g, n){g === 0?a("#pData", "#" + j + "_2").addClass("ui-state-disabled"):a("#pData", "#" + j + "_2").removeClass("ui-state-disabled"); g == n?a("#nData", "#" + j + "_2").addClass("ui-state-disabled"):
|
||||
a("#nData", "#" + j + "_2").removeClass("ui-state-disabled")}function D(){var g = a(f).jqGrid("getDataIDs"), n = a("#id_g", "#" + j).val(); return[a.inArray(n, g), g]}function t(){var g = true; a("#FormError", "#" + j).hide(); if (c.checkOnUpdate){k = {}; i = {}; F(); w = a.extend({}, k, i); if (O = H(w, c._savedData)){a("#" + e).data("disabled", true); a(".confirm", "#" + m.themodal).show(); g = false}}return g}function F(){a(".FormElement", "#" + j).each(function(){var g = a(".customelement", this); if (g.length){var n = g[0].name; a.each(f.p.colModel, function(){if (this.name ==
|
||||
n && this.editoptions && a.isFunction(this.editoptions.custom_value)){try{k[n] = this.editoptions.custom_value(a("#" + n, "#" + j), "get"); if (k[n] === undefined)throw"e1"; } catch (r){r == "e1"?info_dialog(jQuery.jgrid.errors.errcap, "function 'custom_value' " + a.jgrid.edit.msg.novalue, jQuery.jgrid.edit.bClose):info_dialog(jQuery.jgrid.errors.errcap, r.message, jQuery.jgrid.edit.bClose)}return true}})} else{switch (a(this).get(0).type){case "checkbox":if (a(this).attr("checked"))k[this.name] = a(this).val(); else{g = a(this).attr("offval");
|
||||
k[this.name] = g}break; case "select-one":k[this.name] = a("option:selected", this).val(); i[this.name] = a("option:selected", this).text(); break; case "select-multiple":k[this.name] = a(this).val(); k[this.name] = k[this.name]?k[this.name].join(","):""; var v = []; a("option:selected", this).each(function(r, E){v[r] = a(E).text()}); i[this.name] = v.join(","); break; case "password":case "text":case "textarea":case "button":k[this.name] = a(this).val(); break}if (f.p.autoencode)k[this.name] = a.jgrid.htmlEncode(k[this.name])}}); return true}
|
||||
function z(g, n, v, r){for (var E, A, B, M = 0, x, P, C, T = [], G = false, V = "", R = 1; R <= r; R++)V += "<td class='CaptionTD ui-widget-content'> </td><td class='DataTD ui-widget-content' style='white-space:pre'> </td>"; if (g != "_empty")G = a(n).jqGrid("getInd", g); a(n.p.colModel).each(function(U){E = this.name; P = (A = this.editrules && this.editrules.edithidden === true?false:this.hidden === true?true:false)?"style='display:none'":""; if (E !== "cb" && E !== "subgrid" && this.editable === true && E !== "rn"){if (G === false)x = ""; else if (E == n.p.ExpandColumn &&
|
||||
n.p.treeGrid === true)x = a("td:eq(" + U + ")", n.rows[G]).text(); else try{x = a.unformat(a("td:eq(" + U + ")", n.rows[G]), {rowId:g, colModel:this}, U)} catch (ca){x = a("td:eq(" + U + ")", n.rows[G]).html()}var W = a.extend({}, this.editoptions || {}, {id:E, name:E}), X = a.extend({}, {elmprefix:"", elmsuffix:"", rowabove:false, rowcontent:""}, this.formoptions || {}), ba = parseInt(X.rowpos, 10) || M + 1, da = parseInt((parseInt(X.colpos, 10) || 1) * 2, 10); if (g == "_empty" && W.defaultValue)x = a.isFunction(W.defaultValue)?W.defaultValue():W.defaultValue; if (!this.edittype)this.edittype =
|
||||
"text"; if (f.p.autoencode)x = a.jgrid.htmlDecode(x); C = createEl(this.edittype, W, x, false, a.extend({}, a.jgrid.ajaxOptions, n.p.ajaxSelectOptions || {})); if (x == "" && this.edittype == "checkbox")x = a(C).attr("offval"); if (x == "" && this.edittype == "select")x = a("option:eq(0)", C).text(); if (c.checkOnSubmit || c.checkOnUpdate)c._savedData[E] = x; a(C).addClass("FormElement"); B = a(v).find("tr[rowpos=" + ba + "]"); if (X.rowabove){W = a("<tr><td class='contentinfo' colspan='" + r * 2 + "'>" + X.rowcontent + "</td></tr>"); a(v).append(W); W[0].rp = ba}if (B.length ===
|
||||
0){B = a("<tr " + P + " rowpos='" + ba + "'></tr>").addClass("FormData").attr("id", "tr_" + E); a(B).append(V); a(v).append(B); B[0].rp = ba}a("td:eq(" + (da - 2) + ")", B[0]).html(typeof X.label === "undefined"?n.p.colNames[U]:X.label); a("td:eq(" + (da - 1) + ")", B[0]).append(X.elmprefix).append(C).append(X.elmsuffix); T[M] = U; M++}}); if (M > 0){R = a("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='" + (r * 2 - 1) + "' class='DataTD'><input class='FormElement' id='id_g' type='text' name='" + n.p.id + "_id' value='" +
|
||||
g + "'/></td></tr>"); R[0].rp = M + 999; a(v).append(R); if (c.checkOnSubmit || c.checkOnUpdate)c._savedData[n.p.id + "_id"] = g}return T}function h(g, n, v){var r, E = 0, A, B, M, x, P; if (c.checkOnSubmit || c.checkOnUpdate){c._savedData = {}; c._savedData[n.p.id + "_id"] = g}var C = n.p.colModel; if (g == "_empty"){a(C).each(function(){r = this.name; M = a.extend({}, this.editoptions || {}); B = a("#" + a.jgrid.jqID(r), "#" + v); if (B[0] != null){x = ""; if (M.defaultValue){x = a.isFunction(M.defaultValue)?M.defaultValue():M.defaultValue; if (B[0].type == "checkbox"){P =
|
||||
x.toLowerCase(); if (P.search(/(false|0|no|off|undefined)/i) < 0 && P !== ""){B[0].checked = true; B[0].defaultChecked = true; B[0].value = x} else B.attr({checked:"", defaultChecked:""})} else B.val(x)} else if (B[0].type == "checkbox"){B[0].checked = false; B[0].defaultChecked = false; x = a(B).attr("offval")} else if (B[0].type.substr(0, 6) == "select")B[0].selectedIndex = 0; else B.val(x); if (c.checkOnSubmit === true || c.checkOnUpdate)c._savedData[r] = x}}); a("#id_g", "#" + v).val(g)} else{var T = a(n).jqGrid("getInd", g, true); if (T){a("td", T).each(function(G){r =
|
||||
C[G].name; if (r !== "cb" && r !== "subgrid" && r !== "rn" && C[G].editable === true){if (r == n.p.ExpandColumn && n.p.treeGrid === true)A = a(this).text(); else try{A = a.unformat(this, {rowId:g, colModel:C[G]}, G)} catch (V){A = a(this).html()}if (f.p.autoencode)A = a.jgrid.htmlDecode(A); if (c.checkOnSubmit === true || c.checkOnUpdate)c._savedData[r] = A; r = a.jgrid.jqID(r); switch (C[G].edittype){case "password":case "text":case "button":case "image":a("#" + r, "#" + v).val(A); break; case "textarea":if (A == " " || A == " " || A.length == 1 && A.charCodeAt(0) ==
|
||||
160)A = ""; a("#" + r, "#" + v).val(A); break; case "select":var R = A.split(","); R = a.map(R, function(ca){return a.trim(ca)}); a("#" + r + " option", "#" + v).each(function(){this.selected = !C[G].editoptions.multiple && (R[0] == a.trim(a(this).text()) || R[0] == a.trim(a(this).val()))?true:C[G].editoptions.multiple?a.inArray(a.trim(a(this).text()), R) > - 1 || a.inArray(a.trim(a(this).val()), R) > - 1?true:false:false}); break; case "checkbox":A += ""; if (C[G].editoptions && C[G].editoptions.value)if (C[G].editoptions.value.split(":")[0] == A){a("#" +
|
||||
r, "#" + v).attr("checked", true); a("#" + r, "#" + v).attr("defaultChecked", true)} else{a("#" + r, "#" + v).attr("checked", false); a("#" + r, "#" + v).attr("defaultChecked", "")} else{A = A.toLowerCase(); if (A.search(/(false|0|no|off|undefined)/i) < 0 && A !== ""){a("#" + r, "#" + v).attr("checked", true); a("#" + r, "#" + v).attr("defaultChecked", true)} else{a("#" + r, "#" + v).attr("checked", false); a("#" + r, "#" + v).attr("defaultChecked", "")}}break; case "custom":try{if (C[G].editoptions && a.isFunction(C[G].editoptions.custom_value))C[G].editoptions.custom_value(a("#" +
|
||||
r, "#" + v), "set", A); else throw"e1"; } catch (U){U == "e1"?info_dialog(jQuery.jgrid.errors.errcap, "function 'custom_value' " + a.jgrid.edit.msg.nodefined, jQuery.jgrid.edit.bClose):info_dialog(jQuery.jgrid.errors.errcap, U.message, jQuery.jgrid.edit.bClose)}break}E++}}); E > 0 && a("#id_g", "#" + j).val(g)}}}function p(){var g, n = [true, "", ""], v = {}, r = f.p.prmNames, E, A; if (a.isFunction(c.beforeCheckValues)){var B = c.beforeCheckValues(k, a("#" + e), k[f.p.id + "_id"] == "_empty"?r.addoper:r.editoper); if (B && typeof B === "object")k = B}for (var M in k)if (k.hasOwnProperty(M)){n =
|
||||
checkValues(k[M], M, f); if (n[0] === false)break}if (n[0]){if (a.isFunction(c.onclickSubmit))v = c.onclickSubmit(c, k) || {}; if (a.isFunction(c.beforeSubmit))n = c.beforeSubmit(k, a("#" + e))}if (n[0] && !c.processing){c.processing = true; a("#sData", "#" + j + "_2").addClass("ui-state-active"); A = r.oper; E = r.id; k[A] = a.trim(k[f.p.id + "_id"]) == "_empty"?r.addoper:r.editoper; if (k[A] != r.addoper)k[E] = k[f.p.id + "_id"]; else if (k[E] === undefined)k[E] = k[f.p.id + "_id"]; delete k[f.p.id + "_id"]; k = a.extend(k, c.editData, v); v = a.extend({url:c.url?
|
||||
c.url:a(f).jqGrid("getGridParam", "editurl"), type:c.mtype, data:a.isFunction(c.serializeEditData)?c.serializeEditData(k):k, complete:function(x, P){if (P != "success"){n[0] = false; n[1] = a.isFunction(c.errorTextFormat)?c.errorTextFormat(x):P + " Status: '" + x.statusText + "'. Error code: " + x.status} else if (a.isFunction(c.afterSubmit))n = c.afterSubmit(x, k); if (n[0] === false){a("#FormError>td", "#" + j).html(n[1]); a("#FormError", "#" + j).show()} else{a.each(f.p.colModel, function(){if (i[this.name] && this.formatter && this.formatter ==
|
||||
"select")try{delete i[this.name]} catch (G){}}); k = a.extend(k, i); f.p.autoencode && a.each(k, function(G, V){k[G] = a.jgrid.htmlDecode(V)}); if (k[A] == r.addoper){n[2] || (n[2] = parseInt(f.p.records, 10) + 1); k[E] = n[2]; if (c.closeAfterAdd){if (c.reloadAfterSubmit)a(f).trigger("reloadGrid"); else{a(f).jqGrid("addRowData", n[2], k, b.addedrow); a(f).jqGrid("setSelection", n[2])}hideModal("#" + m.themodal, {gb:"#gbox_" + l, jqm:b.jqModal, onClose:c.onClose})} else if (c.clearAfterAdd){c.reloadAfterSubmit?a(f).trigger("reloadGrid"):a(f).jqGrid("addRowData",
|
||||
n[2], k, b.addedrow); h("_empty", f, e)} else c.reloadAfterSubmit?a(f).trigger("reloadGrid"):a(f).jqGrid("addRowData", n[2], k, b.addedrow)} else{if (c.reloadAfterSubmit){a(f).trigger("reloadGrid"); c.closeAfterEdit || setTimeout(function(){a(f).jqGrid("setSelection", k[E])}, 1E3)} else f.p.treeGrid === true?a(f).jqGrid("setTreeRow", k[E], k):a(f).jqGrid("setRowData", k[E], k); c.closeAfterEdit && hideModal("#" + m.themodal, {gb:"#gbox_" + l, jqm:b.jqModal, onClose:c.onClose})}if (a.isFunction(c.afterComplete)){g = x; setTimeout(function(){c.afterComplete(g,
|
||||
k, a("#" + e)); g = null}, 500)}}c.processing = false; if (c.checkOnSubmit || c.checkOnUpdate){a("#" + e).data("disabled", false); if (c._savedData[f.p.id + "_id"] != "_empty")for (var C in c._savedData)if (k[C])c._savedData[C] = k[C]}a("#sData", "#" + j + "_2").removeClass("ui-state-active"); try{a(":input:visible", "#" + e)[0].focus()} catch (T){}}, error:function(x, P, C){a("#FormError>td", "#" + j).html(P + " : " + C); a("#FormError", "#" + j).show(); c.processing = false; a("#" + e).data("disabled", false); a("#sData", "#" + j + "_2").removeClass("ui-state-active")}},
|
||||
a.jgrid.ajaxOptions, c.ajaxEditOptions); if (!v.url && !c.useDataProxy)if (a.isFunction(f.p.dataProxy))c.useDataProxy = true; else{n[0] = false; n[1] += " " + a.jgrid.errors.nourl}if (n[0])c.useDataProxy?f.p.dataProxy.call(f, v, "set_" + f.p.id):a.ajax(v)}if (n[0] === false){a("#FormError>td", "#" + j).html(n[1]); a("#FormError", "#" + j).show()}}function H(g, n){var v = false, r; for (r in g)if (g[r] != n[r]){v = true; break}return v}var f = this; if (f.grid && d){var l = f.p.id, e = "FrmGrid_" + l, j = "TblGrid_" + l, m = {themodal:"editmod" + l, modalhead:"edithd" +
|
||||
l, modalcontent:"editcnt" + l, scrollelm:e}, u = a.isFunction(c.beforeShowForm)?c.beforeShowForm:false, Q = a.isFunction(c.afterShowForm)?c.afterShowForm:false, o = a.isFunction(c.beforeInitData)?c.beforeInitData:false, s = a.isFunction(c.onInitializeForm)?c.onInitializeForm:false, y = 1, J = 0, k, i, w, O; if (d == "new"){d = "_empty"; b.caption = b.addCaption} else b.caption = b.editCaption; b.recreateForm === true && a("#" + m.themodal).html() != null && a("#" + m.themodal).remove(); var S = true; if (b.checkOnUpdate && b.jqModal && !b.modal)S = false; if (a("#" +
|
||||
m.themodal).html() != null){a(".ui-jqdialog-title", "#" + m.modalhead).html(b.caption); a("#FormError", "#" + j).hide(); if (c.topinfo){a(".topinfo", "#" + j + "_2").html(c.topinfo); a(".tinfo", "#" + j + "_2").show()} else a(".tinfo", "#" + j + "_2").hide(); if (c.bottominfo){a(".bottominfo", "#" + j + "_2").html(c.bottominfo); a(".binfo", "#" + j + "_2").show()} else a(".binfo", "#" + j + "_2").hide(); o && o(a("#" + e)); h(d, f, e); d == "_empty" || !c.viewPagerButtons?a("#pData, #nData", "#" + j + "_2").hide():a("#pData, #nData", "#" + j + "_2").show(); if (c.processing ===
|
||||
true){c.processing = false; a("#sData", "#" + j + "_2").removeClass("ui-state-active")}if (a("#" + e).data("disabled") === true){a(".confirm", "#" + m.themodal).hide(); a("#" + e).data("disabled", false)}u && u(a("#" + e)); a("#" + m.themodal).data("onClose", c.onClose); viewModal("#" + m.themodal, {gbox:"#gbox_" + l, jqm:b.jqModal, jqM:false, closeoverlay:S, modal:b.modal}); S || a(".jqmOverlay").click(function(){if (!t())return false; hideModal("#" + m.themodal, {gb:"#gbox_" + l, jqm:b.jqModal, onClose:c.onClose}); return false}); Q && Q(a("#" + e))} else{a(f.p.colModel).each(function(){var g =
|
||||
this.formoptions; y = Math.max(y, g?g.colpos || 0:0); J = Math.max(J, g?g.rowpos || 0:0)}); var I = isNaN(b.dataheight)?b.dataheight:b.dataheight + "px", K; I = a("<form name='FormPost' id='" + e + "' class='FormGrid' onSubmit='return false;' style='width:100%;overflow:auto;position:relative;height:" + I + ";'></form>").data("disabled", false); var L = a("<table id='" + j + "' class='EditTable' cellspacing='0' cellpading='0' border='0'><tbody></tbody></table>"); a(I).append(L); K = a("<tr id='FormError' style='display:none'><td class='ui-state-error' colspan='" +
|
||||
y * 2 + "'></td></tr>"); K[0].rp = 0; a(L).append(K); K = a("<tr style='display:none' class='tinfo'><td class='topinfo' colspan='" + y * 2 + "'>" + c.topinfo + "</td></tr>"); K[0].rp = 0; a(L).append(K); o && o(a("#" + e)); K = (o = f.p.direction == "rtl"?true:false)?"nData":"pData"; var N = o?"pData":"nData"; z(d, f, L, y); K = "<a href='javascript:void(0)' id='" + K + "' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></div>"; N = "<a href='javascript:void(0)' id='" + N + "' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></div>";
|
||||
var Z = "<a href='javascript:void(0)' id='sData' class='fm-button ui-state-default ui-corner-all'>" + b.bSubmit + "</a>", $ = "<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>" + b.bCancel + "</a>"; K = "<table border='0' class='EditTable' id='" + j + "_2'><tbody><tr id='Act_Buttons'><td class='navButton ui-widget-content'>" + (o?N + K:K + N) + "</td><td class='EditButton ui-widget-content'>" + Z + $ + "</td></tr>"; K += "<tr style='display:none' class='binfo'><td class='bottominfo' colspan='2'>" +
|
||||
c.bottominfo + "</td></tr>"; K += "</tbody></table>"; if (J > 0){var aa = []; a.each(a(L)[0].rows, function(g, n){aa[g] = n}); aa.sort(function(g, n){if (g.rp > n.rp)return 1; if (g.rp < n.rp)return - 1; return 0}); a.each(aa, function(g, n){a("tbody", L).append(n)})}b.gbox = "#gbox_" + l; var Y = false; if (b.closeOnEscape === true){b.closeOnEscape = false; Y = true}I = a("<span></span>").append(I).append(K); createModal(m, I, b, "#gview_" + f.p.id, a("#gview_" + f.p.id)[0]); if (o){a("#pData, #nData", "#" + j + "_2").css("float", "right"); a(".EditButton", "#" + j +
|
||||
"_2").css("text-align", "left")}c.topinfo && a(".tinfo", "#" + j + "_2").show(); c.bottominfo && a(".binfo", "#" + j + "_2").show(); K = I = null; a("#" + m.themodal).keydown(function(g){var n = g.target; if (a("#" + e).data("disabled") === true)return false; if (c.savekey[0] === true && g.which == c.savekey[1])if (n.tagName != "TEXTAREA"){a("#sData", "#" + j + "_2").trigger("click"); return false}if (g.which === 27){if (!t())return false; Y && hideModal(this, {gb:b.gbox, jqm:b.jqModal, onClose:c.onClose}); return false}if (c.navkeys[0] === true){if (a("#id_g",
|
||||
"#" + j).val() == "_empty")return true; if (g.which == c.navkeys[1]){a("#pData", "#" + j + "_2").trigger("click"); return false}if (g.which == c.navkeys[2]){a("#nData", "#" + j + "_2").trigger("click"); return false}}}); if (b.checkOnUpdate){a("a.ui-jqdialog-titlebar-close span", "#" + m.themodal).removeClass("jqmClose"); a("a.ui-jqdialog-titlebar-close", "#" + m.themodal).unbind("click").click(function(){if (!t())return false; hideModal("#" + m.themodal, {gb:"#gbox_" + l, jqm:b.jqModal, onClose:c.onClose}); return false})}b.saveicon = a.extend([true,
|
||||
"left", "ui-icon-disk"], b.saveicon); b.closeicon = a.extend([true, "left", "ui-icon-close"], b.closeicon); if (b.saveicon[0] === true)a("#sData", "#" + j + "_2").addClass(b.saveicon[1] == "right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon " + b.saveicon[2] + "'></span>"); if (b.closeicon[0] === true)a("#cData", "#" + j + "_2").addClass(b.closeicon[1] == "right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon " + b.closeicon[2] + "'></span>"); if (c.checkOnSubmit || c.checkOnUpdate){Z =
|
||||
"<a href='javascript:void(0)' id='sNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>" + b.bYes + "</a>"; N = "<a href='javascript:void(0)' id='nNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>" + b.bNo + "</a>"; $ = "<a href='javascript:void(0)' id='cNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>" + b.bExit + "</a>"; I = b.zIndex || 999; I++; a("<div class='ui-widget-overlay jqgrid-overlay confirm' style='z-index:" + I + ";display:none;'> " +
|
||||
(a.browser.msie && a.browser.version == 6?'<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>':"") + "</div><div class='confirm ui-widget-content ui-jqconfirm' style='z-index:" + (I + 1) + "'>" + b.saveData + "<br/><br/>" + Z + N + $ + "</div>").insertAfter("#" + e); a("#sNew", "#" + m.themodal).click(function(){p(); a("#" + e).data("disabled", false); a(".confirm", "#" + m.themodal).hide(); return false}); a("#nNew", "#" + m.themodal).click(function(){a(".confirm", "#" +
|
||||
m.themodal).hide(); a("#" + e).data("disabled", false); setTimeout(function(){a(":input", "#" + e)[0].focus()}, 0); return false}); a("#cNew", "#" + m.themodal).click(function(){a(".confirm", "#" + m.themodal).hide(); a("#" + e).data("disabled", false); hideModal("#" + m.themodal, {gb:"#gbox_" + l, jqm:b.jqModal, onClose:c.onClose}); return false})}s && s(a("#" + e)); d == "_empty" || !c.viewPagerButtons?a("#pData,#nData", "#" + j + "_2").hide():a("#pData,#nData", "#" + j + "_2").show(); u && u(a("#" + e)); a("#" + m.themodal).data("onClose", c.onClose);
|
||||
viewModal("#" + m.themodal, {gbox:"#gbox_" + l, jqm:b.jqModal, closeoverlay:S, modal:b.modal}); S || a(".jqmOverlay").click(function(){if (!t())return false; hideModal("#" + m.themodal, {gb:"#gbox_" + l, jqm:b.jqModal, onClose:c.onClose}); return false}); Q && Q(a("#" + e)); a(".fm-button", "#" + m.themodal).hover(function(){a(this).addClass("ui-state-hover")}, function(){a(this).removeClass("ui-state-hover")}); a("#sData", "#" + j + "_2").click(function(){k = {}; i = {}; a("#FormError", "#" + j).hide(); F(); if (k[f.p.id + "_id"] == "_empty")p(); else if (b.checkOnSubmit ===
|
||||
true){w = a.extend({}, k, i); if (O = H(w, c._savedData)){a("#" + e).data("disabled", true); a(".confirm", "#" + m.themodal).show()} else p()} else p(); return false}); a("#cData", "#" + j + "_2").click(function(){if (!t())return false; hideModal("#" + m.themodal, {gb:"#gbox_" + l, jqm:b.jqModal, onClose:c.onClose}); return false}); a("#nData", "#" + j + "_2").click(function(){if (!t())return false; a("#FormError", "#" + j).hide(); var g = D(); g[0] = parseInt(g[0], 10); if (g[0] != - 1 && g[1][g[0] + 1]){a.isFunction(b.onclickPgButtons) && b.onclickPgButtons("next",
|
||||
a("#" + e), g[1][g[0]]); h(g[1][g[0] + 1], f, e); a(f).jqGrid("setSelection", g[1][g[0] + 1]); a.isFunction(b.afterclickPgButtons) && b.afterclickPgButtons("next", a("#" + e), g[1][g[0] + 1]); q(g[0] + 1, g[1].length - 1)}return false}); a("#pData", "#" + j + "_2").click(function(){if (!t())return false; a("#FormError", "#" + j).hide(); var g = D(); if (g[0] != - 1 && g[1][g[0] - 1]){a.isFunction(b.onclickPgButtons) && b.onclickPgButtons("prev", a("#" + e), g[1][g[0]]); h(g[1][g[0] - 1], f, e); a(f).jqGrid("setSelection", g[1][g[0] - 1]); a.isFunction(b.afterclickPgButtons) &&
|
||||
b.afterclickPgButtons("prev", a("#" + e), g[1][g[0] - 1]); q(g[0] - 1, g[1].length - 1)}return false})}u = D(); q(u[0], u[1].length - 1)}})}, viewGridRow:function(d, b){b = a.extend({top:0, left:0, width:0, height:"auto", dataheight:"auto", modal:false, drag:true, resize:true, jqModal:true, closeOnEscape:false, labelswidth:"30%", closeicon:[], navkeys:[false, 38, 40], onClose:null, beforeShowForm:null, viewPagerButtons:true}, a.jgrid.view, b || {}); return this.each(function(){function q(){if (b.closeOnEscape === true || b.navkeys[0] === true)setTimeout(function(){a(".ui-jqdialog-titlebar-close",
|
||||
"#" + l.modalhead).focus()}, 0)}function D(i, w){i === 0?a("#pData", "#" + f + "_2").addClass("ui-state-disabled"):a("#pData", "#" + f + "_2").removeClass("ui-state-disabled"); i == w?a("#nData", "#" + f + "_2").addClass("ui-state-disabled"):a("#nData", "#" + f + "_2").removeClass("ui-state-disabled")}function t(){var i = a(h).jqGrid("getDataIDs"), w = a("#id_g", "#" + f).val(); return[a.inArray(w, i), i]}function F(i, w, O, S){for (var I, K, L, N = 0, Z, $, aa = [], Y = false, g = "<td class='CaptionTD form-view-label ui-widget-content' width='" + b.labelswidth +
|
||||
"'> </td><td class='DataTD form-view-data ui-helper-reset ui-widget-content'> </td>", n = "", v = ["integer", "number", "currency"], r = 0, E = 0, A, B, M, x = 1; x <= S; x++)n += x == 1?g:"<td class='CaptionTD form-view-label ui-widget-content'> </td><td class='DataTD form-view-data ui-widget-content'> </td>"; a(w.p.colModel).each(function(){K = this.editrules && this.editrules.edithidden === true?false:this.hidden === true?true:false; if (!K && this.align === "right")if (this.formatter && a.inArray(this.formatter, v) !== - 1)r =
|
||||
Math.max(r, parseInt(this.width, 10)); else E = Math.max(E, parseInt(this.width, 10))}); A = r !== 0?r:E !== 0?E:0; Y = a(w).jqGrid("getInd", i); a(w.p.colModel).each(function(P){I = this.name; B = false; $ = (K = this.editrules && this.editrules.edithidden === true?false:this.hidden === true?true:false)?"style='display:none'":""; M = typeof this.viewable != "boolean"?true:this.viewable; if (I !== "cb" && I !== "subgrid" && I !== "rn" && M){Z = Y === false?"":I == w.p.ExpandColumn && w.p.treeGrid === true?a("td:eq(" + P + ")", w.rows[Y]).text():a("td:eq(" + P + ")", w.rows[Y]).html();
|
||||
B = this.align === "right" && A !== 0?true:false; a.extend({}, this.editoptions || {}, {id:I, name:I}); var C = a.extend({}, {rowabove:false, rowcontent:""}, this.formoptions || {}), T = parseInt(C.rowpos, 10) || N + 1, G = parseInt((parseInt(C.colpos, 10) || 1) * 2, 10); if (C.rowabove){var V = a("<tr><td class='contentinfo' colspan='" + S * 2 + "'>" + C.rowcontent + "</td></tr>"); a(O).append(V); V[0].rp = T}L = a(O).find("tr[rowpos=" + T + "]"); if (L.length === 0){L = a("<tr " + $ + " rowpos='" + T + "'></tr>").addClass("FormData").attr("id", "trv_" + I); a(L).append(n); a(O).append(L);
|
||||
L[0].rp = T}a("td:eq(" + (G - 2) + ")", L[0]).html("<b>" + (typeof C.label === "undefined"?w.p.colNames[P]:C.label) + "</b>"); a("td:eq(" + (G - 1) + ")", L[0]).append("<span>" + Z + "</span>").attr("id", "v_" + I); B && a("td:eq(" + (G - 1) + ") span", L[0]).css({"text-align":"right", width:A + "px"}); aa[N] = P; N++}}); if (N > 0){i = a("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='" + (S * 2 - 1) + "' class='DataTD'><input class='FormElement' id='id_g' type='text' name='id' value='" + i + "'/></td></tr>"); i[0].rp = N + 99; a(O).append(i)}return aa}
|
||||
function z(i, w){var O, S, I = 0, K, L; if (L = a(w).jqGrid("getInd", i, true)){a("td", L).each(function(N){O = w.p.colModel[N].name; S = w.p.colModel[N].editrules && w.p.colModel[N].editrules.edithidden === true?false:w.p.colModel[N].hidden === true?true:false; if (O !== "cb" && O !== "subgrid" && O !== "rn"){K = O == w.p.ExpandColumn && w.p.treeGrid === true?a(this).text():a(this).html(); a.extend({}, w.p.colModel[N].editoptions || {}); O = a.jgrid.jqID("v_" + O); a("#" + O + " span", "#" + f).html(K); S && a("#" + O, "#" + f).parents("tr:first").hide(); I++}}); I >
|
||||
0 && a("#id_g", "#" + f).val(i)}}var h = this; if (h.grid && d){if (!b.imgpath)b.imgpath = h.p.imgpath; var p = h.p.id, H = "ViewGrid_" + p, f = "ViewTbl_" + p, l = {themodal:"viewmod" + p, modalhead:"viewhd" + p, modalcontent:"viewcnt" + p, scrollelm:H}, e = 1, j = 0; if (a("#" + l.themodal).html() != null){a(".ui-jqdialog-title", "#" + l.modalhead).html(b.caption); a("#FormError", "#" + f).hide(); z(d, h); a.isFunction(b.beforeShowForm) && b.beforeShowForm(a("#" + H)); viewModal("#" + l.themodal, {gbox:"#gbox_" + p, jqm:b.jqModal, jqM:false, modal:b.modal}); q()} else{a(h.p.colModel).each(function(){var i =
|
||||
this.formoptions; e = Math.max(e, i?i.colpos || 0:0); j = Math.max(j, i?i.rowpos || 0:0)}); var m = isNaN(b.dataheight)?b.dataheight:b.dataheight + "px", u = a("<form name='FormPost' id='" + H + "' class='FormGrid' style='width:100%;overflow:auto;position:relative;height:" + m + ";'></form>"), Q = a("<table id='" + f + "' class='EditTable' cellspacing='1' cellpading='2' border='0' style='table-layout:fixed'><tbody></tbody></table>"); a(u).append(Q); F(d, h, Q, e); m = h.p.direction == "rtl"?true:false; var o = "<a href='javascript:void(0)' id='" +
|
||||
(m?"nData":"pData") + "' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></div>", s = "<a href='javascript:void(0)' id='" + (m?"pData":"nData") + "' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></div>", y = "<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>" + b.bClose + "</a>"; if (j > 0){var J = []; a.each(a(Q)[0].rows, function(i, w){J[i] = w}); J.sort(function(i, w){if (i.rp > w.rp)return 1;
|
||||
if (i.rp < w.rp)return - 1; return 0}); a.each(J, function(i, w){a("tbody", Q).append(w)})}b.gbox = "#gbox_" + p; var k = false; if (b.closeOnEscape === true){b.closeOnEscape = false; k = true}u = a("<span></span>").append(u).append("<table border='0' class='EditTable' id='" + f + "_2'><tbody><tr id='Act_Buttons'><td class='navButton ui-widget-content' width='" + b.labelswidth + "'>" + (m?s + o:o + s) + "</td><td class='EditButton ui-widget-content'>" + y + "</td></tr></tbody></table>"); createModal(l, u, b, "#gview_" + h.p.id, a("#gview_" + h.p.id)[0]);
|
||||
if (m){a("#pData, #nData", "#" + f + "_2").css("float", "right"); a(".EditButton", "#" + f + "_2").css("text-align", "left")}b.viewPagerButtons || a("#pData, #nData", "#" + f + "_2").hide(); u = null; a("#" + l.themodal).keydown(function(i){if (i.which === 27){k && hideModal(this, {gb:b.gbox, jqm:b.jqModal, onClose:b.onClose}); return false}if (b.navkeys[0] === true){if (i.which === b.navkeys[1]){a("#pData", "#" + f + "_2").trigger("click"); return false}if (i.which === b.navkeys[2]){a("#nData", "#" + f + "_2").trigger("click"); return false}}}); b.closeicon =
|
||||
a.extend([true, "left", "ui-icon-close"], b.closeicon); if (b.closeicon[0] === true)a("#cData", "#" + f + "_2").addClass(b.closeicon[1] == "right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon " + b.closeicon[2] + "'></span>"); a.isFunction(b.beforeShowForm) && b.beforeShowForm(a("#" + H)); viewModal("#" + l.themodal, {gbox:"#gbox_" + p, jqm:b.jqModal, modal:b.modal}); a(".fm-button:not(.ui-state-disabled)", "#" + f + "_2").hover(function(){a(this).addClass("ui-state-hover")}, function(){a(this).removeClass("ui-state-hover")});
|
||||
q(); a("#cData", "#" + f + "_2").click(function(){hideModal("#" + l.themodal, {gb:"#gbox_" + p, jqm:b.jqModal, onClose:b.onClose}); return false}); a("#nData", "#" + f + "_2").click(function(){a("#FormError", "#" + f).hide(); var i = t(); i[0] = parseInt(i[0], 10); if (i[0] != - 1 && i[1][i[0] + 1]){a.isFunction(b.onclickPgButtons) && b.onclickPgButtons("next", a("#" + H), i[1][i[0]]); z(i[1][i[0] + 1], h); a(h).jqGrid("setSelection", i[1][i[0] + 1]); a.isFunction(b.afterclickPgButtons) && b.afterclickPgButtons("next", a("#" + H), i[1][i[0] + 1]); D(i[0] + 1, i[1].length -
|
||||
1)}q(); return false}); a("#pData", "#" + f + "_2").click(function(){a("#FormError", "#" + f).hide(); var i = t(); if (i[0] != - 1 && i[1][i[0] - 1]){a.isFunction(b.onclickPgButtons) && b.onclickPgButtons("prev", a("#" + H), i[1][i[0]]); z(i[1][i[0] - 1], h); a(h).jqGrid("setSelection", i[1][i[0] - 1]); a.isFunction(b.afterclickPgButtons) && b.afterclickPgButtons("prev", a("#" + H), i[1][i[0] - 1]); D(i[0] - 1, i[1].length - 1)}q(); return false})}m = t(); D(m[0], m[1].length - 1)}})}, delGridRow:function(d, b){c = b = a.extend({top:0, left:0, width:240, height:"auto",
|
||||
dataheight:"auto", modal:false, drag:true, resize:true, url:"", mtype:"POST", reloadAfterSubmit:true, beforeShowForm:null, afterShowForm:null, beforeSubmit:null, onclickSubmit:null, afterSubmit:null, jqModal:true, closeOnEscape:false, delData:{}, delicon:[], cancelicon:[], onClose:null, ajaxDelOptions:{}, processing:false, serializeDelData:null, useDataProxy:false}, a.jgrid.del, b || {}); return this.each(function(){var q = this; if (q.grid)if (d){var D = typeof b.beforeShowForm === "function"?true:false, t = typeof b.afterShowForm ===
|
||||
"function"?true:false, F = q.p.id, z = {}, h = "DelTbl_" + F, p, H, f, l, e = {themodal:"delmod" + F, modalhead:"delhd" + F, modalcontent:"delcnt" + F, scrollelm:h}; if (jQuery.isArray(d))d = d.join(); if (a("#" + e.themodal).html() != null){a("#DelData>td", "#" + h).text(d); a("#DelError", "#" + h).hide(); if (c.processing === true){c.processing = false; a("#dData", "#" + h).removeClass("ui-state-active")}D && b.beforeShowForm(a("#" + h)); viewModal("#" + e.themodal, {gbox:"#gbox_" + F, jqm:b.jqModal, jqM:false, modal:b.modal})} else{var j = isNaN(b.dataheight)?b.dataheight:
|
||||
b.dataheight + "px"; j = "<div id='" + h + "' class='formdata' style='width:100%;overflow:auto;position:relative;height:" + j + ";'>"; j += "<table class='DelTable'><tbody>"; j += "<tr id='DelError' style='display:none'><td class='ui-state-error'></td></tr>"; j += "<tr id='DelData' style='display:none'><td >" + d + "</td></tr>"; j += '<tr><td class="delmsg" style="white-space:pre;">' + b.msg + "</td></tr><tr><td > </td></tr>"; j += "</tbody></table></div>"; j += "<table cellspacing='0' cellpadding='0' border='0' class='EditTable' id='" +
|
||||
h + "_2'><tbody><tr><td class='DataTD ui-widget-content'></td></tr><tr style='display:block;height:3px;'><td></td></tr><tr><td class='DelButton EditButton'>" + ("<a href='javascript:void(0)' id='dData' class='fm-button ui-state-default ui-corner-all'>" + b.bSubmit + "</a>") + " " + ("<a href='javascript:void(0)' id='eData' class='fm-button ui-state-default ui-corner-all'>" + b.bCancel + "</a>") + "</td></tr></tbody></table>"; b.gbox = "#gbox_" + F; createModal(e, j, b, "#gview_" + q.p.id, a("#gview_" + q.p.id)[0]); a(".fm-button",
|
||||
"#" + h + "_2").hover(function(){a(this).addClass("ui-state-hover")}, function(){a(this).removeClass("ui-state-hover")}); b.delicon = a.extend([true, "left", "ui-icon-scissors"], b.delicon); b.cancelicon = a.extend([true, "left", "ui-icon-cancel"], b.cancelicon); if (b.delicon[0] === true)a("#dData", "#" + h + "_2").addClass(b.delicon[1] == "right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon " + b.delicon[2] + "'></span>"); if (b.cancelicon[0] === true)a("#eData", "#" + h + "_2").addClass(b.cancelicon[1] ==
|
||||
"right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon " + b.cancelicon[2] + "'></span>"); a("#dData", "#" + h + "_2").click(function(){var m = [true, ""]; z = {}; var u = a("#DelData>td", "#" + h).text(); if (typeof b.onclickSubmit === "function")z = b.onclickSubmit(c, u) || {}; if (typeof b.beforeSubmit === "function")m = b.beforeSubmit(u); if (m[0] && !c.processing){c.processing = true; a(this).addClass("ui-state-active"); f = q.p.prmNames; p = a.extend({}, c.delData, z); l = f.oper; p[l] = f.deloper; H = f.id; p[H] = u; var Q = a.extend({url:c.url?
|
||||
c.url:a(q).jqGrid("getGridParam", "editurl"), type:b.mtype, data:a.isFunction(b.serializeDelData)?b.serializeDelData(p):p, complete:function(o, s){if (s != "success"){m[0] = false; m[1] = a.isFunction(c.errorTextFormat)?c.errorTextFormat(o):s + " Status: '" + o.statusText + "'. Error code: " + o.status} else if (typeof c.afterSubmit === "function")m = c.afterSubmit(o, p); if (m[0] === false){a("#DelError>td", "#" + h).html(m[1]); a("#DelError", "#" + h).show()} else{if (c.reloadAfterSubmit)a(q).trigger("reloadGrid"); else{s = []; s = u.split(",");
|
||||
if (q.p.treeGrid === true)try{a(q).jqGrid("delTreeNode", s[0])} catch (y){} else for (var J = 0; J < s.length; J++)a(q).jqGrid("delRowData", s[J]); q.p.selrow = null; q.p.selarrrow = []}a.isFunction(c.afterComplete) && setTimeout(function(){c.afterComplete(o, u)}, 500)}c.processing = false; a("#dData", "#" + h + "_2").removeClass("ui-state-active"); m[0] && hideModal("#" + e.themodal, {gb:"#gbox_" + F, jqm:b.jqModal, onClose:c.onClose})}, error:function(o, s, y){a("#DelError>td", "#" + h).html(s + " : " + y); a("#DelError", "#" + h).show(); c.processing =
|
||||
false; a("#dData", "#" + h + "_2").removeClass("ui-state-active")}}, a.jgrid.ajaxOptions, b.ajaxDelOptions); if (!Q.url && !c.useDataProxy)if (a.isFunction(q.p.dataProxy))c.useDataProxy = true; else{m[0] = false; m[1] += " " + a.jgrid.errors.nourl}if (m[0])c.useDataProxy?q.p.dataProxy.call(q, Q, "del_" + q.p.id):a.ajax(Q)}if (m[0] === false){a("#DelError>td", "#" + h).html(m[1]); a("#DelError", "#" + h).show()}return false}); a("#eData", "#" + h + "_2").click(function(){hideModal("#" + e.themodal, {gb:"#gbox_" + F, jqm:b.jqModal, onClose:c.onClose});
|
||||
return false}); D && b.beforeShowForm(a("#" + h)); viewModal("#" + e.themodal, {gbox:"#gbox_" + F, jqm:b.jqModal, modal:b.modal})}t && b.afterShowForm(a("#" + h)); b.closeOnEscape === true && setTimeout(function(){a(".ui-jqdialog-titlebar-close", "#" + e.modalhead).focus()}, 0)}})}, navGrid:function(d, b, q, D, t, F, z){b = a.extend({edit:true, editicon:"ui-icon-pencil", add:true, addicon:"ui-icon-plus", del:true, delicon:"ui-icon-trash", search:true, searchicon:"ui-icon-search", refresh:true, refreshicon:"ui-icon-refresh", refreshstate:"firstpage",
|
||||
view:false, viewicon:"ui-icon-document", position:"left", closeOnEscape:true, beforeRefresh:null, afterRefresh:null, cloneToTop:false}, a.jgrid.nav, b || {}); return this.each(function(){var h = {themodal:"alertmod", modalhead:"alerthd", modalcontent:"alertcnt"}, p = this, H, f, l; if (!(!p.grid || typeof d != "string")){if (a("#" + h.themodal).html() === null){if (typeof window.innerWidth != "undefined"){H = window.innerWidth; f = window.innerHeight} else if (typeof document.documentElement != "undefined" && typeof document.documentElement.clientWidth !=
|
||||
"undefined" && document.documentElement.clientWidth !== 0){H = document.documentElement.clientWidth; f = document.documentElement.clientHeight} else{H = 1024; f = 768}createModal(h, "<div>" + b.alerttext + "</div><span tabindex='0'><span tabindex='-1' id='jqg_alrt'></span></span>", {gbox:"#gbox_" + p.p.id, jqModal:true, drag:true, resize:true, caption:b.alertcap, top:f / 2 - 25, left:H / 2 - 100, width:200, height:"auto", closeOnEscape:b.closeOnEscape}, "", "", true)}H = 1; if (b.cloneToTop && p.p.toppager)H = 2; for (f = 0; f < H; f++){var e = a("<table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table navtable' style='float:left;table-layout:auto;'><tbody><tr></tr></tbody></table>"),
|
||||
j, m; if (f === 0){j = d; m = p.p.id; if (j == p.p.toppager){m += "_top"; H = 1}} else{j = p.p.toppager; m = p.p.id + "_top"}p.p.direction == "rtl" && a(e).attr("dir", "rtl").css("float", "right"); if (b.add){D = D || {}; l = a("<td class='ui-pg-button ui-corner-all'></td>"); a(l).append("<div class='ui-pg-div'><span class='ui-icon " + b.addicon + "'></span>" + b.addtext + "</div>"); a("tr", e).append(l); a(l, e).attr({title:b.addtitle || "", id:D.id || "add_" + m}).click(function(){a(this).hasClass("ui-state-disabled") || (typeof b.addfunc == "function"?b.addfunc():
|
||||
a(p).jqGrid("editGridRow", "new", D)); return false}).hover(function(){a(this).hasClass("ui-state-disabled") || a(this).addClass("ui-state-hover")}, function(){a(this).removeClass("ui-state-hover")}); l = null}if (b.edit){l = a("<td class='ui-pg-button ui-corner-all'></td>"); q = q || {}; a(l).append("<div class='ui-pg-div'><span class='ui-icon " + b.editicon + "'></span>" + b.edittext + "</div>"); a("tr", e).append(l); a(l, e).attr({title:b.edittitle || "", id:q.id || "edit_" + m}).click(function(){if (!a(this).hasClass("ui-state-disabled")){var u =
|
||||
p.p.selrow; if (u)typeof b.editfunc == "function"?b.editfunc(u):a(p).jqGrid("editGridRow", u, q); else{viewModal("#" + h.themodal, {gbox:"#gbox_" + p.p.id, jqm:true}); a("#jqg_alrt").focus()}}return false}).hover(function(){a(this).hasClass("ui-state-disabled") || a(this).addClass("ui-state-hover")}, function(){a(this).removeClass("ui-state-hover")}); l = null}if (b.view){l = a("<td class='ui-pg-button ui-corner-all'></td>"); z = z || {}; a(l).append("<div class='ui-pg-div'><span class='ui-icon " + b.viewicon + "'></span>" + b.viewtext +
|
||||
"</div>"); a("tr", e).append(l); a(l, e).attr({title:b.viewtitle || "", id:z.id || "view_" + m}).click(function(){if (!a(this).hasClass("ui-state-disabled")){var u = p.p.selrow; if (u)a(p).jqGrid("viewGridRow", u, z); else{viewModal("#" + h.themodal, {gbox:"#gbox_" + p.p.id, jqm:true}); a("#jqg_alrt").focus()}}return false}).hover(function(){a(this).hasClass("ui-state-disabled") || a(this).addClass("ui-state-hover")}, function(){a(this).removeClass("ui-state-hover")}); l = null}if (b.del){l = a("<td class='ui-pg-button ui-corner-all'></td>");
|
||||
t = t || {}; a(l).append("<div class='ui-pg-div'><span class='ui-icon " + b.delicon + "'></span>" + b.deltext + "</div>"); a("tr", e).append(l); a(l, e).attr({title:b.deltitle || "", id:t.id || "del_" + m}).click(function(){if (!a(this).hasClass("ui-state-disabled")){var u; if (p.p.multiselect){u = p.p.selarrrow; if (u.length === 0)u = null} else u = p.p.selrow; if (u)"function" == typeof b.delfunc?b.delfunc(u):a(p).jqGrid("delGridRow", u, t); else{viewModal("#" + h.themodal, {gbox:"#gbox_" + p.p.id, jqm:true}); a("#jqg_alrt").focus()}}return false}).hover(function(){a(this).hasClass("ui-state-disabled") ||
|
||||
a(this).addClass("ui-state-hover")}, function(){a(this).removeClass("ui-state-hover")}); l = null}if (b.add || b.edit || b.del || b.view)a("tr", e).append("<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>"); if (b.search){l = a("<td class='ui-pg-button ui-corner-all'></td>"); F = F || {}; a(l).append("<div class='ui-pg-div'><span class='ui-icon " + b.searchicon + "'></span>" + b.searchtext + "</div>"); a("tr", e).append(l); a(l, e).attr({title:b.searchtitle || "", id:F.id || "search_" +
|
||||
m}).click(function(){a(this).hasClass("ui-state-disabled") || a(p).jqGrid("searchGrid", F); return false}).hover(function(){a(this).hasClass("ui-state-disabled") || a(this).addClass("ui-state-hover")}, function(){a(this).removeClass("ui-state-hover")}); l = null}if (b.refresh){l = a("<td class='ui-pg-button ui-corner-all'></td>"); a(l).append("<div class='ui-pg-div'><span class='ui-icon " + b.refreshicon + "'></span>" + b.refreshtext + "</div>"); a("tr", e).append(l); a(l, e).attr({title:b.refreshtitle || "", id:"refresh_" + m}).click(function(){if (!a(this).hasClass("ui-state-disabled")){a.isFunction(b.beforeRefresh) &&
|
||||
b.beforeRefresh(); p.p.search = false; try{a("#fbox_" + p.p.id).searchFilter().reset(); a.isFunction(p.clearToolbar) && p.clearToolbar(false)} catch (u){}switch (b.refreshstate){case "firstpage":a(p).trigger("reloadGrid", [{page:1}]); break; case "current":a(p).trigger("reloadGrid", [{current:true}]); break}a.isFunction(b.afterRefresh) && b.afterRefresh()}return false}).hover(function(){a(this).hasClass("ui-state-disabled") || a(this).addClass("ui-state-hover")}, function(){a(this).removeClass("ui-state-hover")}); l = null}l =
|
||||
a(".ui-jqgrid").css("font-size") || "11px"; a("body").append("<div id='testpg2' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:" + l + ";visibility:hidden;' ></div>"); l = a(e).clone().appendTo("#testpg2").width(); a("#testpg2").remove(); a(j + "_" + b.position, j).append(e); if (p.p._nvtd){if (l > p.p._nvtd[0]){a(j + "_" + b.position, j).width(l); p.p._nvtd[0] = l}p.p._nvtd[1] = l}e = l = l = null}}})}, navButtonAdd:function(d, b){b = a.extend({caption:"newButton", title:"", buttonicon:"ui-icon-newwin", onClickButton:null, position:"last",
|
||||
cursor:"pointer"}, b || {}); return this.each(function(){if (this.grid){if (d.indexOf("#") !== 0)d = "#" + d; var q = a(".navtable", d)[0], D = this; if (q){var t = a("<td></td>"); b.buttonicon.toString().toUpperCase() == "NONE"?a(t).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'>" + b.caption + "</div>"):a(t).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'><span class='ui-icon " + b.buttonicon + "'></span>" + b.caption + "</div>"); b.id && a(t).attr("id", b.id); if (b.position == "first")q.rows[0].cells.length ===
|
||||
0?a("tr", q).append(t):a("tr td:eq(0)", q).before(t); else a("tr", q).append(t); a(t, q).attr("title", b.title || "").click(function(F){a(this).hasClass("ui-state-disabled") || a.isFunction(b.onClickButton) && b.onClickButton.call(D, F); return false}).hover(function(){a(this).hasClass("ui-state-disabled") || a(this).addClass("ui-state-hover")}, function(){a(this).removeClass("ui-state-hover")})}}})}, navSeparatorAdd:function(d, b){b = a.extend({sepclass:"ui-separator", sepcontent:""}, b || {}); return this.each(function(){if (this.grid){if (d.indexOf("#") !==
|
||||
0)d = "#" + d; var q = a(".navtable", d)[0]; if (q){var D = "<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='" + b.sepclass + "'></span>" + b.sepcontent + "</td>"; a("tr", q).append(D)}}})}, GridToForm:function(d, b){return this.each(function(){var q = this; if (q.grid){var D = a(q).jqGrid("getRowData", d); if (D)for (var t in D)a("[name=" + t + "]", b).is("input:radio") || a("[name=" + t + "]", b).is("input:checkbox")?a("[name=" + t + "]", b).each(function(){a(this).val() == D[t]?a(this).attr("checked", "checked"):a(this).attr("checked",
|
||||
"")}):a("[name=" + t + "]", b).val(D[t])}})}, FormToGrid:function(d, b, q, D){return this.each(function(){var t = this; if (t.grid){q || (q = "set"); D || (D = "first"); var F = a(b).serializeArray(), z = {}; a.each(F, function(h, p){z[p.name] = p.value}); if (q == "add")a(t).jqGrid("addRowData", d, z, D); else q == "set" && a(t).jqGrid("setRowData", d, z)}})}})})(jQuery);
|
||||
jQuery.fn.searchFilter = function(k, H){function I(e, l, v){this.$ = e; this.add = function(a){a == null?e.find(".ui-add-last").click():e.find(".sf:eq(" + a + ") .ui-add").click(); return this}; this.del = function(a){a == null?e.find(".sf:last .ui-del").click():e.find(".sf:eq(" + a + ") .ui-del").click(); return this}; this.search = function(){e.find(".ui-search").click(); return this}; this.reset = function(){e.find(".ui-reset").click(); return this}; this.close = function(){e.find(".ui-closer").click(); return this}; if (l != null){function C(){jQuery(this).toggleClass("ui-state-hover");
|
||||
return false}function D(a){jQuery(this).toggleClass("ui-state-active", a.type == "mousedown"); return false}function m(a, b){return"<option value='" + a + "'>" + b + "</option>"}function w(a, b, d){return"<select class='" + a + "'" + (d?" style='display:none;'":"") + ">" + b + "</select>"}function E(a, b){a = e.find("tr.sf td.data " + a); a[0] != null && b(a)}function F(a, b){var d = e.find("tr.sf td.data " + a); d[0] != null && jQuery.each(b, function(){this.data != null?d.bind(this.type, this.data, this.fn):d.bind(this.type, this.fn)})}var f = jQuery.extend({},
|
||||
jQuery.fn.searchFilter.defaults, v), n = - 1, r = ""; jQuery.each(f.groupOps, function(){r += m(this.op, this.text)}); r = "<select name='groupOp'>" + r + "</select>"; e.html("").addClass("ui-searchFilter").append("<div class='ui-widget-overlay' style='z-index: -1'> </div><table class='ui-widget-content ui-corner-all'><thead><tr><td colspan='5' class='ui-widget-header ui-corner-all' style='line-height: 18px;'><div class='ui-closer ui-state-default ui-corner-all ui-helper-clearfix' style='float: right;'><span class='ui-icon ui-icon-close'></span></div>" +
|
||||
f.windowTitle + "</td></tr></thead><tbody><tr class='sf'><td class='fields'></td><td class='ops'></td><td class='data'></td><td><div class='ui-del ui-state-default ui-corner-all'><span class='ui-icon ui-icon-minus'></span></div></td><td><div class='ui-add ui-state-default ui-corner-all'><span class='ui-icon ui-icon-plus'></span></div></td></tr><tr><td colspan='5' class='divider'><div> </div></td></tr></tbody><tfoot><tr><td colspan='3'><span class='ui-reset ui-state-default ui-corner-all' style='display: inline-block; float: left;'><span class='ui-icon ui-icon-arrowreturnthick-1-w' style='float: left;'></span><span style='line-height: 18px; padding: 0 7px 0 3px;'>" +
|
||||
f.resetText + "</span></span><span class='ui-search ui-state-default ui-corner-all' style='display: inline-block; float: right;'><span class='ui-icon ui-icon-search' style='float: left;'></span><span style='line-height: 18px; padding: 0 7px 0 3px;'>" + f.searchText + "</span></span><span class='matchText'>" + f.matchText + "</span> " + r + " <span class='rulesText'>" + f.rulesText + "</span></td><td> </td><td><div class='ui-add-last ui-state-default ui-corner-all'><span class='ui-icon ui-icon-plusthick'></span></div></td></tr></tfoot></table>");
|
||||
var x = e.find("tr.sf"), G = x.find("td.fields"), y = x.find("td.ops"), o = x.find("td.data"), s = ""; jQuery.each(f.operators, function(){s += m(this.op, this.text)}); s = w("default", s, true); y.append(s); o.append("<input type='text' class='default' style='display:none;' />"); var t = "", z = false, p = false; jQuery.each(l, function(a){t += m(this.itemval, this.text); if (this.ops != null){z = true; var b = ""; jQuery.each(this.ops, function(){b += m(this.op, this.text)}); b = w("field" + a, b, true); y.append(b)}if (this.dataUrl != null){if (a > n)n = a; p = true;
|
||||
var d = this.dataEvents, c = this.dataInit, g = this.buildSelect; jQuery.ajax(jQuery.extend({url:this.dataUrl, complete:function(h){h = g != null?jQuery("<div />").append(g(h)):jQuery("<div />").append(h.responseText); h.find("select").addClass("field" + a).hide(); o.append(h.html()); c && E(".field" + a, c); d && F(".field" + a, d); a == n && e.find("tr.sf td.fields select[name='field']").change()}}, f.ajaxSelectOptions))} else if (this.dataValues != null){p = true; var i = ""; jQuery.each(this.dataValues, function(){i += m(this.value, this.text)});
|
||||
i = w("field" + a, i, true); o.append(i)} else if (this.dataEvents != null || this.dataInit != null){p = true; i = "<input type='text' class='field" + a + "' />"; o.append(i)}this.dataInit != null && a != n && E(".field" + a, this.dataInit); this.dataEvents != null && a != n && F(".field" + a, this.dataEvents)}); t = "<select name='field'>" + t + "</select>"; G.append(t); l = G.find("select[name='field']"); z?l.change(function(a){var b = a.target.selectedIndex; a = jQuery(a.target).parents("tr.sf").find("td.ops"); a.find("select").removeAttr("name").hide(); b = a.find(".field" +
|
||||
b); if (b[0] == null)b = a.find(".default"); b.attr("name", "op").show()}):y.find(".default").attr("name", "op").show(); p?l.change(function(a){var b = a.target.selectedIndex; a = jQuery(a.target).parents("tr.sf").find("td.data"); a.find("select,input").removeClass("vdata").hide(); b = a.find(".field" + b); if (b[0] == null)b = a.find(".default"); b.show().addClass("vdata")}):o.find(".default").show().addClass("vdata"); if (z || p)l.change(); e.find(".ui-state-default").hover(C, C).mousedown(D).mouseup(D); e.find(".ui-closer").click(function(){f.onClose(jQuery(e.selector));
|
||||
return false}); e.find(".ui-del").click(function(a){a = jQuery(a.target).parents(".sf"); if (a.siblings(".sf").length > 0){f.datepickerFix === true && jQuery.fn.datepicker !== undefined && a.find(".hasDatepicker").datepicker("destroy"); a.remove()} else{a.find("select[name='field']")[0].selectedIndex = 0; a.find("select[name='op']")[0].selectedIndex = 0; a.find(".data input").val(""); a.find(".data select").each(function(){this.selectedIndex = 0}); a.find("select[name='field']").change()}return false}); e.find(".ui-add").click(function(a){a =
|
||||
jQuery(a.target).parents(".sf"); var b = a.clone(true).insertAfter(a); b.find(".ui-state-default").removeClass("ui-state-hover ui-state-active"); if (f.clone){b.find("select[name='field']")[0].selectedIndex = a.find("select[name='field']")[0].selectedIndex; if (b.find("select[name='op']")[0] != null)b.find("select[name='op']").focus()[0].selectedIndex = a.find("select[name='op']")[0].selectedIndex; var d = b.find("select.vdata"); if (d[0] != null)d[0].selectedIndex = a.find("select.vdata")[0].selectedIndex} else{b.find(".data input").val("");
|
||||
b.find("select[name='field']").focus()}f.datepickerFix === true && jQuery.fn.datepicker !== undefined && a.find(".hasDatepicker").each(function(){var c = jQuery.data(this, "datepicker").settings; b.find("#" + this.id).unbind().removeAttr("id").removeClass("hasDatepicker").datepicker(c)}); b.find("select[name='field']").change(); return false}); e.find(".ui-search").click(function(){var a = jQuery(e.selector), b, d = a.find("select[name='groupOp'] :selected").val(); b = f.stringResult?'{"groupOp":"' + d + '","rules":[':{groupOp:d,
|
||||
rules:[]}; a.find(".sf").each(function(c){var g = jQuery(this).find("select[name='field'] :selected").val(), i = jQuery(this).find("select[name='op'] :selected").val(), h = jQuery(this).find("input.vdata,select.vdata :selected").val(); h += ""; h = h.replace(/\\/g, "\\\\").replace(/\"/g, '\\"'); if (f.stringResult){if (c > 0)b += ","; b += '{"field":"' + g + '",'; b += '"op":"' + i + '",'; b += '"data":"' + h + '"}'} else b.rules.push({field:g, op:i, data:h})}); if (f.stringResult)b += "]}"; f.onSearch(b); return false}); e.find(".ui-reset").click(function(){var a =
|
||||
jQuery(e.selector); a.find(".ui-del").click(); a.find("select[name='groupOp']")[0].selectedIndex = 0; f.onReset(); return false}); e.find(".ui-add-last").click(function(){var a = jQuery(e.selector + " .sf:last"), b = a.clone(true).insertAfter(a); b.find(".ui-state-default").removeClass("ui-state-hover ui-state-active"); b.find(".data input").val(""); b.find("select[name='field']").focus(); f.datepickerFix === true && jQuery.fn.datepicker !== undefined && a.find(".hasDatepicker").each(function(){var d = jQuery.data(this, "datepicker").settings;
|
||||
b.find("#" + this.id).unbind().removeAttr("id").removeClass("hasDatepicker").datepicker(d)}); b.find("select[name='field']").change(); return false}); this.setGroupOp = function(a){selDOMobj = this.$.find("select[name='groupOp']")[0]; var b = {}, d = selDOMobj.options.length, c; for (c = 0; c < d; c++)b[selDOMobj.options[c].value] = c; selDOMobj.selectedIndex = b[a]; $(selDOMobj).change()}; this.setFilter = function(a){var b = a.sfref; a = a.filter; var d = [], c, g, i, h, j = {}; selDOMobj = b.find("select[name='field']")[0]; c = 0; for (i = selDOMobj.options.length; c <
|
||||
i; c++){j[selDOMobj.options[c].value] = {index:c, ops:{}}; d.push(selDOMobj.options[c].value)}c = 0; for (i = d.length; c < i; c++){if (selDOMobj = b.find(".ops > select[class='field" + c + "']")[0]){g = 0; for (h = selDOMobj.options.length; g < h; g++)j[d[c]].ops[selDOMobj.options[g].value] = g}if (selDOMobj = b.find(".data > select[class='field" + c + "']")[0]){j[d[c]].data = {}; g = 0; for (h = selDOMobj.options.length; g < h; g++)j[d[c]].data[selDOMobj.options[g].value] = g}}var u, q, A, B; d = a.field; if (j[d])u = j[d].index; if (u != null){q = j[d].ops[a.op]; if (q ===
|
||||
undefined){c = 0; for (i = v.operators.length; c < i; c++)if (v.operators[c].op == a.op){q = c; break}}A = a.data; B = j[d].data == null? - 1:j[d].data[A]}if (u != null && q != null && B != null){b.find("select[name='field']")[0].selectedIndex = u; b.find("select[name='field']").change(); b.find("select[name='op']")[0].selectedIndex = q; b.find("input.vdata").val(A); if (b = b.find("select.vdata")[0])b.selectedIndex = B; return true} else return false}}}return new I(this, k, H)}; jQuery.fn.searchFilter.version = "1.2.9";
|
||||
jQuery.fn.searchFilter.defaults = {clone:true, datepickerFix:true, onReset:function(k){alert("Reset Clicked. Data Returned: " + k)}, onSearch:function(k){alert("Search Clicked. Data Returned: " + k)}, onClose:function(k){k.hide()}, groupOps:[{op:"AND", text:"all"}, {op:"OR", text:"any"}], operators:[{op:"eq", text:"is equal to"}, {op:"ne", text:"is not equal to"}, {op:"lt", text:"is less than"}, {op:"le", text:"is less or equal to"}, {op:"gt", text:"is greater than"}, {op:"ge", text:"is greater or equal to"}, {op:"in", text:"is in"},
|
||||
{op:"ni", text:"is not in"}, {op:"bw", text:"begins with"}, {op:"bn", text:"does not begin with"}, {op:"ew", text:"ends with"}, {op:"en", text:"does not end with"}, {op:"cn", text:"contains"}, {op:"nc", text:"does not contain"}], matchText:"match", rulesText:"rules", resetText:"Reset", searchText:"Search", stringResult:true, windowTitle:"Search Rules", ajaxSelectOptions:{}};
|
||||
(function(a){a.jgrid.extend({editRow:function(d, t, i, n, o, u, s, c, f){return this.each(function(){var b = this, k, l, r = 0, p = null, q = {}, h, g; if (b.grid){h = a(b).jqGrid("getInd", d, true); if (h !== false)if ((a(h).attr("editable") || "0") == "0" && !a(h).hasClass("not-editable-row")){g = b.p.colModel; a("td", h).each(function(j){k = g[j].name; var v = b.p.treeGrid === true && k == b.p.ExpandColumn; if (v)l = a("span:first", this).html(); else try{l = a.unformat(this, {rowId:d, colModel:g[j]}, j)} catch (m){l = a(this).html()}if (k != "cb" && k != "subgrid" && k !=
|
||||
"rn"){if (b.p.autoencode)l = a.jgrid.htmlDecode(l); q[k] = l; if (g[j].editable === true){if (p === null)p = j; v?a("span:first", this).html(""):a(this).html(""); var e = a.extend({}, g[j].editoptions || {}, {id:d + "_" + k, name:k}); if (!g[j].edittype)g[j].edittype = "text"; e = createEl(g[j].edittype, e, l, true, a.extend({}, a.jgrid.ajaxOptions, b.p.ajaxSelectOptions || {})); a(e).addClass("editable"); v?a("span:first", this).append(e):a(this).append(e); g[j].edittype == "select" && g[j].editoptions.multiple === true && a.browser.msie && a(e).width(a(e).width());
|
||||
r++}}}); if (r > 0){q.id = d; b.p.savedRow.push(q); a(h).attr("editable", "1"); a("td:eq(" + p + ") input", h).focus(); t === true && a(h).bind("keydown", function(j){j.keyCode === 27 && a(b).jqGrid("restoreRow", d, f); if (j.keyCode === 13){if (j.target.tagName == "TEXTAREA")return true; a(b).jqGrid("saveRow", d, n, o, u, s, c, f); return false}j.stopPropagation()}); a.isFunction(i) && i(d)}}}})}, saveRow:function(d, t, i, n, o, u, s){return this.each(function(){var c = this, f, b = {}, k = {}, l, r, p, q; if (c.grid){q = a(c).jqGrid("getInd", d, true); if (q !== false){l =
|
||||
a(q).attr("editable"); i = i?i:c.p.editurl; if (l === "1"){var h; a("td", q).each(function(m){h = c.p.colModel[m]; f = h.name; if (f != "cb" && f != "subgrid" && h.editable === true && f != "rn"){switch (h.edittype){case "checkbox":var e = ["Yes", "No"]; if (h.editoptions)e = h.editoptions.value.split(":"); b[f] = a("input", this).attr("checked")?e[0]:e[1]; break; case "text":case "password":case "textarea":case "button":b[f] = a("input, textarea", this).val(); break; case "select":if (h.editoptions.multiple){e = a("select", this); var x = []; b[f] = a(e).val();
|
||||
b[f] = b[f]?b[f].join(","):""; a("select > option:selected", this).each(function(y, z){x[y] = a(z).text()}); k[f] = x.join(",")} else{b[f] = a("select>option:selected", this).val(); k[f] = a("select>option:selected", this).text()}if (h.formatter && h.formatter == "select")k = {}; break; case "custom":try{if (h.editoptions && a.isFunction(h.editoptions.custom_value)){b[f] = h.editoptions.custom_value(a(".customelement", this), "get"); if (b[f] === undefined)throw"e2"; } else throw"e1"; } catch (w){w == "e1" && info_dialog(jQuery.jgrid.errors.errcap,
|
||||
"function 'custom_value' " + a.jgrid.edit.msg.nodefined, jQuery.jgrid.edit.bClose); w == "e2"?info_dialog(jQuery.jgrid.errors.errcap, "function 'custom_value' " + a.jgrid.edit.msg.novalue, jQuery.jgrid.edit.bClose):info_dialog(jQuery.jgrid.errors.errcap, w.message, jQuery.jgrid.edit.bClose)}break}p = checkValues(b[f], m, c); if (p[0] === false){p[1] = b[f] + " " + p[1]; return false}if (c.p.autoencode)b[f] = a.jgrid.htmlEncode(b[f])}}); if (p[0] === false)try{var g = findPos(a("#" + d)[0]); info_dialog(a.jgrid.errors.errcap, p[1], a.jgrid.edit.bClose,
|
||||
{left:g[0], top:g[1]})} catch (j){alert(p[1])} else{if (b){var v; g = c.p.prmNames; v = g.oper; l = g.id; b[v] = g.editoper; b[l] = d; if (typeof c.p.inlineData == "undefined")c.p.inlineData = {}; if (typeof n == "undefined")n = {}; b = a.extend({}, b, c.p.inlineData, n)}if (i == "clientArray"){b = a.extend({}, b, k); c.p.autoencode && a.each(b, function(m, e){b[m] = a.jgrid.htmlDecode(e)}); l = a(c).jqGrid("setRowData", d, b); a(q).attr("editable", "0"); for (g = 0; g < c.p.savedRow.length; g++)if (c.p.savedRow[g].id == d){r = g; break}r >= 0 && c.p.savedRow.splice(r, 1);
|
||||
a.isFunction(o) && o(d, l)} else{a("#lui_" + c.p.id).show(); a.ajax(a.extend({url:i, data:a.isFunction(c.p.serializeRowData)?c.p.serializeRowData(b):b, type:"POST", complete:function(m, e){a("#lui_" + c.p.id).hide(); if (e === "success")if ((a.isFunction(t)?t(m):true) === true){c.p.autoencode && a.each(b, function(x, w){b[x] = a.jgrid.htmlDecode(w)}); b = a.extend({}, b, k); a(c).jqGrid("setRowData", d, b); a(q).attr("editable", "0"); for (e = 0; e < c.p.savedRow.length; e++)if (c.p.savedRow[e].id == d){r = e; break}r >= 0 && c.p.savedRow.splice(r, 1);
|
||||
a.isFunction(o) && o(d, m)} else a(c).jqGrid("restoreRow", d, s)}, error:function(m, e){a("#lui_" + c.p.id).hide(); a.isFunction(u)?u(d, m, e):alert("Error Row: " + d + " Result: " + m.status + ":" + m.statusText + " Status: " + e)}}, a.jgrid.ajaxOptions, c.p.ajaxRowOptions || {}))}a(q).unbind("keydown")}}}}})}, restoreRow:function(d, t){return this.each(function(){var i = this, n, o, u = {}; if (i.grid){o = a(i).jqGrid("getInd", d, true); if (o !== false){for (var s = 0; s < i.p.savedRow.length; s++)if (i.p.savedRow[s].id == d){n = s; break}if (n >= 0){if (a.isFunction(a.fn.datepicker))try{a("input.hasDatepicker",
|
||||
"#" + o.id).datepicker("hide")} catch (c){}a.each(i.p.colModel, function(){if (this.editable === true && this.name in i.p.savedRow[n])u[this.name] = i.p.savedRow[n][this.name]}); a(i).jqGrid("setRowData", d, u); a(o).attr("editable", "0").unbind("keydown"); i.p.savedRow.splice(n, 1)}a.isFunction(t) && t(d)}}})}})})(jQuery);
|
||||
(function(b){b.jgrid.extend({editCell:function(d, e, a){return this.each(function(){var c = this, h, f, g; if (!(!c.grid || c.p.cellEdit !== true)){e = parseInt(e, 10); c.p.selrow = c.rows[d].id; c.p.knv || b(c).jqGrid("GridNav"); if (c.p.savedRow.length > 0){if (a === true)if (d == c.p.iRow && e == c.p.iCol)return; b(c).jqGrid("saveCell", c.p.savedRow[0].id, c.p.savedRow[0].ic)} else window.setTimeout(function(){b("#" + c.p.knv).attr("tabindex", "-1").focus()}, 0); h = c.p.colModel[e].name; if (!(h == "subgrid" || h == "cb" || h == "rn")){g = b("td:eq(" + e +
|
||||
")", c.rows[d]); if (c.p.colModel[e].editable === true && a === true && !g.hasClass("not-editable-cell")){if (parseInt(c.p.iCol, 10) >= 0 && parseInt(c.p.iRow, 10) >= 0){b("td:eq(" + c.p.iCol + ")", c.rows[c.p.iRow]).removeClass("edit-cell ui-state-highlight"); b(c.rows[c.p.iRow]).removeClass("selected-row ui-state-hover")}b(g).addClass("edit-cell ui-state-highlight"); b(c.rows[d]).addClass("selected-row ui-state-hover"); try{f = b.unformat(g, {rowId:c.rows[d].id, colModel:c.p.colModel[e]}, e)} catch (k){f = b(g).html()}if (c.p.autoencode)f =
|
||||
b.jgrid.htmlDecode(f); if (!c.p.colModel[e].edittype)c.p.colModel[e].edittype = "text"; c.p.savedRow.push({id:d, ic:e, name:h, v:f}); if (b.isFunction(c.p.formatCell)){var j = c.p.formatCell(c.rows[d].id, h, f, d, e); if (j !== undefined)f = j}j = b.extend({}, c.p.colModel[e].editoptions || {}, {id:d + "_" + h, name:h}); var i = createEl(c.p.colModel[e].edittype, j, f, true, b.extend({}, b.jgrid.ajaxOptions, c.p.ajaxSelectOptions || {})); b.isFunction(c.p.beforeEditCell) && c.p.beforeEditCell(c.rows[d].id, h, f, d, e); b(g).html("").append(i).attr("tabindex",
|
||||
"0"); window.setTimeout(function(){b(i).focus()}, 0); b("input, select, textarea", g).bind("keydown", function(l){if (l.keyCode === 27)if (b("input.hasDatepicker", g).length > 0)b(".ui-datepicker").is(":hidden")?b(c).jqGrid("restoreCell", d, e):b("input.hasDatepicker", g).datepicker("hide"); else b(c).jqGrid("restoreCell", d, e); l.keyCode === 13 && b(c).jqGrid("saveCell", d, e); if (l.keyCode == 9)if (c.grid.hDiv.loading)return false; else l.shiftKey?b(c).jqGrid("prevCell", d, e):b(c).jqGrid("nextCell", d, e); l.stopPropagation()});
|
||||
b.isFunction(c.p.afterEditCell) && c.p.afterEditCell(c.rows[d].id, h, f, d, e)} else{if (parseInt(c.p.iCol, 10) >= 0 && parseInt(c.p.iRow, 10) >= 0){b("td:eq(" + c.p.iCol + ")", c.rows[c.p.iRow]).removeClass("edit-cell ui-state-highlight"); b(c.rows[c.p.iRow]).removeClass("selected-row ui-state-hover")}g.addClass("edit-cell ui-state-highlight"); b(c.rows[d]).addClass("selected-row ui-state-hover"); if (b.isFunction(c.p.onSelectCell)){f = g.html().replace(/\ \;/ig, ""); c.p.onSelectCell(c.rows[d].id, h, f, d, e)}}c.p.iCol = e; c.p.iRow =
|
||||
d}}})}, saveCell:function(d, e){return this.each(function(){var a = this, c; if (!(!a.grid || a.p.cellEdit !== true)){c = a.p.savedRow.length >= 1?0:null; if (c !== null){var h = b("td:eq(" + e + ")", a.rows[d]), f, g, k = a.p.colModel[e], j = k.name, i = b.jgrid.jqID(j); switch (k.edittype){case "select":if (k.editoptions.multiple){i = b("#" + d + "_" + i, a.rows[d]); var l = []; if (f = b(i).val())f.join(","); else f = ""; b("option:selected", i).each(function(m, p){l[m] = b(p).text()}); g = l.join(",")} else{f = b("#" + d + "_" + i + ">option:selected", a.rows[d]).val();
|
||||
g = b("#" + d + "_" + i + ">option:selected", a.rows[d]).text()}if (k.formatter)g = f; break; case "checkbox":var n = ["Yes", "No"]; if (k.editoptions)n = k.editoptions.value.split(":"); g = f = b("#" + d + "_" + i, a.rows[d]).attr("checked")?n[0]:n[1]; break; case "password":case "text":case "textarea":case "button":g = f = b("#" + d + "_" + i, a.rows[d]).val(); break; case "custom":try{if (k.editoptions && b.isFunction(k.editoptions.custom_value)){f = k.editoptions.custom_value(b(".customelement", h), "get"); if (f === undefined)throw"e2"; else g = f} else throw"e1";
|
||||
} catch (q){q == "e1" && info_dialog(jQuery.jgrid.errors.errcap, "function 'custom_value' " + b.jgrid.edit.msg.nodefined, jQuery.jgrid.edit.bClose); q == "e2"?info_dialog(jQuery.jgrid.errors.errcap, "function 'custom_value' " + b.jgrid.edit.msg.novalue, jQuery.jgrid.edit.bClose):info_dialog(jQuery.jgrid.errors.errcap, q.message, jQuery.jgrid.edit.bClose)}break}if (g != a.p.savedRow[c].v){if (b.isFunction(a.p.beforeSaveCell))if (c = a.p.beforeSaveCell(a.rows[d].id, j, f, d, e))f = c; var r = checkValues(f, e, a); if (r[0] === true){c = {};
|
||||
if (b.isFunction(a.p.beforeSubmitCell))(c = a.p.beforeSubmitCell(a.rows[d].id, j, f, d, e)) || (c = {}); b("input.hasDatepicker", h).length > 0 && b("input.hasDatepicker", h).datepicker("hide"); if (a.p.cellsubmit == "remote")if (a.p.cellurl){var o = {}; if (a.p.autoencode)f = b.jgrid.htmlEncode(f); o[j] = f; n = a.p.prmNames; k = n.id; i = n.oper; o[k] = a.rows[d].id; o[i] = n.editoper; o = b.extend(c, o); b("#lui_" + a.p.id).show(); a.grid.hDiv.loading = true; b.ajax(b.extend({url:a.p.cellurl, data:b.isFunction(a.p.serializeCellData)?a.p.serializeCellData(o):
|
||||
o, type:"POST", complete:function(m, p){b("#lui_" + a.p.id).hide(); a.grid.hDiv.loading = false; if (p == "success")if (b.isFunction(a.p.afterSubmitCell)){m = a.p.afterSubmitCell(m, o.id, j, f, d, e); if (m[0] === true){b(h).empty(); b(a).jqGrid("setCell", a.rows[d].id, e, g, false, false, true); b(h).addClass("dirty-cell"); b(a.rows[d]).addClass("edited"); b.isFunction(a.p.afterSaveCell) && a.p.afterSaveCell(a.rows[d].id, j, f, d, e); a.p.savedRow.splice(0, 1)} else{info_dialog(b.jgrid.errors.errcap, m[1], b.jgrid.edit.bClose); b(a).jqGrid("restoreCell",
|
||||
d, e)}} else{b(h).empty(); b(a).jqGrid("setCell", a.rows[d].id, e, g, false, false, true); b(h).addClass("dirty-cell"); b(a.rows[d]).addClass("edited"); b.isFunction(a.p.afterSaveCell) && a.p.afterSaveCell(a.rows[d].id, j, f, d, e); a.p.savedRow.splice(0, 1)}}, error:function(m, p){b("#lui_" + a.p.id).hide(); a.grid.hDiv.loading = false; b.isFunction(a.p.errorCell)?a.p.errorCell(m, p):info_dialog(b.jgrid.errors.errcap, m.status + " : " + m.statusText + "<br/>" + p, b.jgrid.edit.bClose); b(a).jqGrid("restoreCell", d, e)}}, b.jgrid.ajaxOptions,
|
||||
a.p.ajaxCellOptions || {}))} else try{info_dialog(b.jgrid.errors.errcap, b.jgrid.errors.nourl, b.jgrid.edit.bClose); b(a).jqGrid("restoreCell", d, e)} catch (s){}if (a.p.cellsubmit == "clientArray"){b(h).empty(); b(a).jqGrid("setCell", a.rows[d].id, e, g, false, false, true); b(h).addClass("dirty-cell"); b(a.rows[d]).addClass("edited"); b.isFunction(a.p.afterSaveCell) && a.p.afterSaveCell(a.rows[d].id, j, f, d, e); a.p.savedRow.splice(0, 1)}} else try{window.setTimeout(function(){info_dialog(b.jgrid.errors.errcap, f + " " + r[1], b.jgrid.edit.bClose)},
|
||||
100); b(a).jqGrid("restoreCell", d, e)} catch (t){}} else b(a).jqGrid("restoreCell", d, e)}b.browser.opera?b("#" + a.p.knv).attr("tabindex", "-1").focus():window.setTimeout(function(){b("#" + a.p.knv).attr("tabindex", "-1").focus()}, 0)}})}, restoreCell:function(d, e){return this.each(function(){var a = this, c; if (!(!a.grid || a.p.cellEdit !== true)){c = a.p.savedRow.length >= 1?0:null; if (c !== null){var h = b("td:eq(" + e + ")", a.rows[d]); if (b.isFunction(b.fn.datepicker))try{b("input.hasDatepicker", h).datepicker("hide")} catch (f){}b(h).empty().attr("tabindex",
|
||||
"-1"); b(a).jqGrid("setCell", a.rows[d].id, e, a.p.savedRow[c].v, false, false, true); a.p.savedRow.splice(0, 1)}window.setTimeout(function(){b("#" + a.p.knv).attr("tabindex", "-1").focus()}, 0)}})}, nextCell:function(d, e){return this.each(function(){var a = this, c = false; if (!(!a.grid || a.p.cellEdit !== true)){for (var h = e + 1; h < a.p.colModel.length; h++)if (a.p.colModel[h].editable === true){c = h; break}if (c !== false)b(a).jqGrid("editCell", d, c, true); else a.p.savedRow.length > 0 && b(a).jqGrid("saveCell", d, e)}})}, prevCell:function(d,
|
||||
e){return this.each(function(){var a = this, c = false; if (!(!a.grid || a.p.cellEdit !== true)){for (var h = e - 1; h >= 0; h--)if (a.p.colModel[h].editable === true){c = h; break}if (c !== false)b(a).jqGrid("editCell", d, c, true); else a.p.savedRow.length > 0 && b(a).jqGrid("saveCell", d, e)}})}, GridNav:function(){return this.each(function(){function d(g, k, j){if (j.substr(0, 1) == "v"){var i = b(a.grid.bDiv)[0].clientHeight, l = b(a.grid.bDiv)[0].scrollTop, n = a.rows[g].offsetTop + a.rows[g].clientHeight, q = a.rows[g].offsetTop; if (j == "vd")if (n >= i)b(a.grid.bDiv)[0].scrollTop =
|
||||
b(a.grid.bDiv)[0].scrollTop + a.rows[g].clientHeight; if (j == "vu")if (q < l)b(a.grid.bDiv)[0].scrollTop = b(a.grid.bDiv)[0].scrollTop - a.rows[g].clientHeight}if (j == "h"){j = b(a.grid.bDiv)[0].clientWidth; i = b(a.grid.bDiv)[0].scrollLeft; l = a.rows[g].cells[k].offsetLeft; if (a.rows[g].cells[k].offsetLeft + a.rows[g].cells[k].clientWidth >= j + parseInt(i, 10))b(a.grid.bDiv)[0].scrollLeft = b(a.grid.bDiv)[0].scrollLeft + a.rows[g].cells[k].clientWidth; else if (l < i)b(a.grid.bDiv)[0].scrollLeft = b(a.grid.bDiv)[0].scrollLeft - a.rows[g].cells[k].clientWidth}}
|
||||
function e(g, k){var j, i; if (k == "lft"){j = g + 1; for (i = g; i >= 0; i--)if (a.p.colModel[i].hidden !== true){j = i; break}}if (k == "rgt"){j = g - 1; for (i = g; i < a.p.colModel.length; i++)if (a.p.colModel[i].hidden !== true){j = i; break}}return j}var a = this; if (!(!a.grid || a.p.cellEdit !== true)){a.p.knv = a.p.id + "_kn"; var c = b("<span style='width:0px;height:0px;background-color:black;' tabindex='0'><span tabindex='-1' style='width:0px;height:0px;background-color:grey' id='" + a.p.knv + "'></span></span>"), h, f; b(c).insertBefore(a.grid.cDiv);
|
||||
b("#" + a.p.knv).focus().keydown(function(g){f = g.keyCode; if (a.p.direction == "rtl")if (f == 37)f = 39; else if (f == 39)f = 37; switch (f){case 38:if (a.p.iRow - 1 >= 0){d(a.p.iRow - 1, a.p.iCol, "vu"); b(a).jqGrid("editCell", a.p.iRow - 1, a.p.iCol, false)}break; case 40:if (a.p.iRow + 1 <= a.rows.length - 1){d(a.p.iRow + 1, a.p.iCol, "vd"); b(a).jqGrid("editCell", a.p.iRow + 1, a.p.iCol, false)}break; case 37:if (a.p.iCol - 1 >= 0){h = e(a.p.iCol - 1, "lft"); d(a.p.iRow, h, "h"); b(a).jqGrid("editCell", a.p.iRow, h, false)}break; case 39:if (a.p.iCol + 1 <= a.p.colModel.length -
|
||||
1){h = e(a.p.iCol + 1, "rgt"); d(a.p.iRow, h, "h"); b(a).jqGrid("editCell", a.p.iRow, h, false)}break; case 13:parseInt(a.p.iCol, 10) >= 0 && parseInt(a.p.iRow, 10) >= 0 && b(a).jqGrid("editCell", a.p.iRow, a.p.iCol, true); break}return false})}})}, getChangedCells:function(d){var e = []; d || (d = "all"); this.each(function(){var a = this, c; !a.grid || a.p.cellEdit !== true || b(a.rows).each(function(h){var f = {}; if (b(this).hasClass("edited")){b("td", this).each(function(g){c = a.p.colModel[g].name; if (c !== "cb" && c !== "subgrid")if (d == "dirty"){if (b(this).hasClass("dirty-cell"))try{f[c] =
|
||||
b.unformat(this, {rowId:a.rows[h].id, colModel:a.p.colModel[g]}, g)} catch (k){f[c] = b.jgrid.htmlDecode(b(this).html())}} else try{f[c] = b.unformat(this, {rowId:a.rows[h].id, colModel:a.p.colModel[g]}, g)} catch (j){f[c] = b.jgrid.htmlDecode(b(this).html())}}); f.id = this.id; e.push(f)}})}); return e}})})(jQuery);
|
||||
(function(b){b.fn.jqm = function(a){var f = {overlay:50, closeoverlay:true, overlayClass:"jqmOverlay", closeClass:"jqmClose", trigger:".jqModal", ajax:e, ajaxText:"", target:e, modal:e, toTop:e, onShow:e, onHide:e, onLoad:e}; return this.each(function(){if (this._jqm)return i[this._jqm].c = b.extend({}, i[this._jqm].c, a); l++; this._jqm = l; i[l] = {c:b.extend(f, b.jqm.params, a), a:e, w:b(this).addClass("jqmID" + l), s:l}; f.trigger && b(this).jqmAddTrigger(f.trigger)})}; b.fn.jqmAddClose = function(a){return o(this, a, "jqmHide")}; b.fn.jqmAddTrigger =
|
||||
function(a){return o(this, a, "jqmShow")}; b.fn.jqmShow = function(a){return this.each(function(){b.jqm.open(this._jqm, a)})}; b.fn.jqmHide = function(a){return this.each(function(){b.jqm.close(this._jqm, a)})}; b.jqm = {hash:{}, open:function(a, f){var c = i[a], d = c.c, h = "." + d.closeClass, g = parseInt(c.w.css("z-index")); g = g > 0?g:3E3; var j = b("<div></div>").css({height:"100%", width:"100%", position:"fixed", left:0, top:0, "z-index":g - 1, opacity:d.overlay / 100}); if (c.a)return e; c.t = f; c.a = true; c.w.css("z-index", g); if (d.modal){k[0] ||
|
||||
setTimeout(function(){p("bind")}, 1); k.push(a)} else if (d.overlay > 0)d.closeoverlay && c.w.jqmAddClose(j); else j = e; c.o = j?j.addClass(d.overlayClass).prependTo("body"):e; if (q){b("html,body").css({height:"100%", width:"100%"}); if (j){j = j.css({position:"absolute"})[0]; for (var m in{Top:1, Left:1})j.style.setExpression(m.toLowerCase(), "(_=(document.documentElement.scroll" + m + " || document.body.scroll" + m + "))+'px'")}}if (d.ajax){a = d.target || c.w; g = d.ajax; a = typeof a == "string"?b(a, c.w):b(a); g = g.substr(0, 1) == "@"?b(f).attr(g.substring(1)):
|
||||
g; a.html(d.ajaxText).load(g, function(){d.onLoad && d.onLoad.call(this, c); h && c.w.jqmAddClose(b(h, c.w)); r(c)})} else h && c.w.jqmAddClose(b(h, c.w)); d.toTop && c.o && c.w.before('<span id="jqmP' + c.w[0]._jqm + '"></span>').insertAfter(c.o); d.onShow?d.onShow(c):c.w.show(); r(c); return e}, close:function(a){a = i[a]; if (!a.a)return e; a.a = e; if (k[0]){k.pop(); k[0] || p("unbind")}a.c.toTop && a.o && b("#jqmP" + a.w[0]._jqm).after(a.w).remove(); if (a.c.onHide)a.c.onHide(a); else{a.w.hide(); a.o && a.o.remove()}return e}, params:{}}; var l =
|
||||
0, i = b.jqm.hash, k = [], q = b.browser.msie && b.browser.version == "6.0", e = false, r = function(a){var f = b('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}); if (q)if (a.o)a.o.html('<p style="width:100%;height:100%"/>').prepend(f); else b("iframe.jqm", a.w)[0] || a.w.prepend(f); s(a)}, s = function(a){try{b(":input:visible", a.w)[0].focus()} catch (f){}}, p = function(a){b(document)[a]("keypress", n)[a]("keydown", n)[a]("mousedown", n)}, n = function(a){var f = i[k[k.length - 1]]; (a = !b(a.target).parents(".jqmID" +
|
||||
f.s)[0]) && s(f); return!a}, o = function(a, f, c){return a.each(function(){var d = this._jqm; b(f).each(function(){if (!this[c]){this[c] = []; b(this).click(function(){for (var h in{jqmShow:1, jqmHide:1})for (var g in this[h])i[this[h][g]] && i[this[h][g]].w[h](this); return e})}this[c].push(d)})})}})(jQuery);
|
||||
(function(b){b.fn.jqDrag = function(a){return l(this, a, "d")}; b.fn.jqResize = function(a, e){return l(this, a, "r", e)}; b.jqDnR = {dnr:{}, e:0, drag:function(a){if (c.k == "d")d.css({left:c.X + a.pageX - c.pX, top:c.Y + a.pageY - c.pY}); else{d.css({width:Math.max(a.pageX - c.pX + c.W, 0), height:Math.max(a.pageY - c.pY + c.H, 0)}); M1 && f.css({width:Math.max(a.pageX - M1.pX + M1.W, 0), height:Math.max(a.pageY - M1.pY + M1.H, 0)})}return false}, stop:function(){b(document).unbind("mousemove", i.drag).unbind("mouseup", i.stop)}}; var i = b.jqDnR, c = i.dnr,
|
||||
d = i.e, f, l = function(a, e, n, m){return a.each(function(){e = e?b(e, a):a; e.bind("mousedown", {e:a, k:n}, function(g){var j = g.data, h = {}; d = j.e; f = m?b(m):false; if (d.css("position") != "relative")try{d.position(h)} catch (o){}c = {X:h.left || k("left") || 0, Y:h.top || k("top") || 0, W:k("width") || d[0].scrollWidth || 0, H:k("height") || d[0].scrollHeight || 0, pX:g.pageX, pY:g.pageY, k:j.k}; M1 = f && j.k != "d"?{X:h.left || f1("left") || 0, Y:h.top || f1("top") || 0, W:f[0].offsetWidth || f1("width") || 0, H:f[0].offsetHeight || f1("height") || 0, pX:g.pageX, pY:g.pageY,
|
||||
k:j.k}:false; b(document).mousemove(b.jqDnR.drag).mouseup(b.jqDnR.stop); return false})})}, k = function(a){return parseInt(d.css(a)) || false}; f1 = function(a){return parseInt(f.css(a)) || false}})(jQuery);
|
||||
(function(a){a.jgrid.extend({setSubGrid:function(){return this.each(function(){var e = this; e.p.colNames.unshift(""); e.p.colModel.unshift({name:"subgrid", width:a.browser.safari?e.p.subGridWidth + e.p.cellLayout:e.p.subGridWidth, sortable:false, resizable:false, hidedlg:true, search:false, fixed:true}); e = e.p.subGridModel; if (e[0]){e[0].align = a.extend([], e[0].align || []); for (var c = 0; c < e[0].name.length; c++)e[0].align[c] = e[0].align[c] || "left"}})}, addSubGridCell:function(e, c){var b = "", n, k; this.each(function(){b =
|
||||
this.formatCol(e, c); n = this.p.gridview; k = this.p.id}); return n === false?'<td role="grid" aria-describedby="' + k + '_subgrid" class="ui-sgcollapsed sgcollapsed" ' + b + "><a href='javascript:void(0);'><span class='ui-icon ui-icon-plus'></span></a></td>":'<td role="grid" aria-describedby="' + k + '_subgrid" ' + b + "></td>"}, addSubGrid:function(e, c){return this.each(function(){var b = this; if (b.grid){var n, k, p, t, s, u, o; a("td:eq(" + c + ")", e).click(function(){if (a(this).hasClass("sgcollapsed")){p = b.p.id; n = a(this).parent();
|
||||
t = c >= 1?"<td colspan='" + c + "'> </td>":""; k = a(n).attr("id"); o = true; if (a.isFunction(b.p.subGridBeforeExpand))o = b.p.subGridBeforeExpand(p + "_" + k, k); if (o === false)return false; s = 0; a.each(b.p.colModel, function(){if (this.hidden === true || this.name == "rn" || this.name == "cb")s++}); u = "<tr role='row' class='ui-subgrid'>" + t + "<td class='ui-widget-content subgrid-cell'><span class='ui-icon ui-icon-carat-1-sw'/></td><td colspan='" + parseInt(b.p.colNames.length - 1 - s, 10) + "' class='ui-widget-content subgrid-data'><div id=" +
|
||||
p + "_" + k + " class='tablediv'>"; a(this).parent().after(u + "</div></td></tr>"); a.isFunction(b.p.subGridRowExpanded)?b.p.subGridRowExpanded(p + "_" + k, k):x(n); a(this).html("<a href='javascript:void(0);'><span class='ui-icon ui-icon-minus'></span></a>").removeClass("sgcollapsed").addClass("sgexpanded")} else if (a(this).hasClass("sgexpanded")){o = true; if (a.isFunction(b.p.subGridRowColapsed)){n = a(this).parent(); k = a(n).attr("id"); o = b.p.subGridRowColapsed(p + "_" + k, k)}if (o === false)return false; a(this).parent().next().remove(".ui-subgrid");
|
||||
a(this).html("<a href='javascript:void(0);'><span class='ui-icon ui-icon-plus'></span></a>").removeClass("sgexpanded").addClass("sgcollapsed")}return false}); var x = function(g){var j, f, d, h; j = a(g).attr("id"); f = {nd_:(new Date).getTime()}; f[b.p.prmNames.subgridid] = j; if (!b.p.subGridModel[0])return false; if (b.p.subGridModel[0].params)for (h = 0; h < b.p.subGridModel[0].params.length; h++)for (d = 0; d < b.p.colModel.length; d++)if (b.p.colModel[d].name == b.p.subGridModel[0].params[h])f[b.p.colModel[d].name] = a("td:eq(" +
|
||||
d + ")", g).text().replace(/\ \;/ig, ""); if (!b.grid.hDiv.loading){b.grid.hDiv.loading = true; a("#load_" + b.p.id).show(); if (!b.p.subgridtype)b.p.subgridtype = b.p.datatype; if (a.isFunction(b.p.subgridtype))b.p.subgridtype(f); else b.p.subgridtype = b.p.subgridtype.toLowerCase(); switch (b.p.subgridtype){case "xml":case "json":a.ajax(a.extend({type:b.p.mtype, url:b.p.subGridUrl, dataType:b.p.subgridtype, data:a.isFunction(b.p.serializeSubGridData)?b.p.serializeSubGridData(f):f, complete:function(i){b.p.subgridtype ==
|
||||
"xml"?v(i.responseXML, j):w(a.jgrid.parse(i.responseText), j)}}, a.jgrid.ajaxOptions, b.p.ajaxSubgridOptions || {})); break}}return false}, r = function(g, j, f){j = a("<td align='" + b.p.subGridModel[0].align[f] + "'></td>").html(j); a(g).append(j)}, v = function(g, j){var f, d, h, i = a("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"), l = a("<tr></tr>"); for (d = 0; d < b.p.subGridModel[0].name.length; d++){f = a("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-" + b.p.direction + "'></th>"); a(f).html(b.p.subGridModel[0].name[d]);
|
||||
a(f).width(b.p.subGridModel[0].width[d]); a(l).append(f)}a(i).append(l); if (g){h = b.p.xmlReader.subgrid; a(h.root + " " + h.row, g).each(function(){l = a("<tr class='ui-widget-content ui-subtblcell'></tr>"); if (h.repeatitems === true)a(h.cell, this).each(function(q){r(l, a(this).text() || " ", q)}); else{var m = b.p.subGridModel[0].mapping || b.p.subGridModel[0].name; if (m)for (d = 0; d < m.length; d++)r(l, a(m[d], this).text() || " ", d)}a(i).append(l)})}g = a("table:first", b.grid.bDiv).attr("id") + "_"; a("#" + g + j).append(i); b.grid.hDiv.loading =
|
||||
false; a("#load_" + b.p.id).hide(); return false}, w = function(g, j){var f, d, h, i, l = a("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"), m = a("<tr></tr>"); for (d = 0; d < b.p.subGridModel[0].name.length; d++){f = a("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-" + b.p.direction + "'></th>"); a(f).html(b.p.subGridModel[0].name[d]); a(f).width(b.p.subGridModel[0].width[d]); a(m).append(f)}a(l).append(m); if (g){f = b.p.jsonReader.subgrid; g = g[f.root]; if (typeof g !== "undefined")for (d = 0; d <
|
||||
g.length; d++){h = g[d]; m = a("<tr class='ui-widget-content ui-subtblcell'></tr>"); if (f.repeatitems === true){if (f.cell)h = h[f.cell]; for (i = 0; i < h.length; i++)r(m, h[i] || " ", i)} else{var q = b.p.subGridModel[0].mapping || b.p.subGridModel[0].name; if (q.length)for (i = 0; i < q.length; i++)r(m, h[q[i]] || " ", i)}a(l).append(m)}}d = a("table:first", b.grid.bDiv).attr("id") + "_"; a("#" + d + j).append(l); b.grid.hDiv.loading = false; a("#load_" + b.p.id).hide(); return false}; b.subGridXml = function(g, j){v(g, j)}; b.subGridJson = function(g,
|
||||
j){w(g, j)}}})}, expandSubGridRow:function(e){return this.each(function(){var c = this; if (c.grid || e)if (c.p.subGrid === true)if (c = a(this).jqGrid("getInd", e, true))(c = a("td.sgcollapsed", c)[0]) && a(c).trigger("click")})}, collapseSubGridRow:function(e){return this.each(function(){var c = this; if (c.grid || e)if (c.p.subGrid === true)if (c = a(this).jqGrid("getInd", e, true))(c = a("td.sgexpanded", c)[0]) && a(c).trigger("click")})}, toggleSubGridRow:function(e){return this.each(function(){var c = this; if (c.grid || e)if (c.p.subGrid ===
|
||||
true)if (c = a(this).jqGrid("getInd", e, true)){var b = a("td.sgcollapsed", c)[0]; if (b)a(b).trigger("click"); else(b = a("td.sgexpanded", c)[0]) && a(b).trigger("click")}})}})})(jQuery);
|
||||
(function(d){d.jgrid.extend({setTreeNode:function(a, c){return this.each(function(){var b = this; if (b.grid && b.p.treeGrid){var e = b.p.expColInd, f = b.p.treeReader.expanded_field, j = b.p.treeReader.leaf_field, k = b.p.treeReader.level_field; c.level = a[k]; if (b.p.treeGridModel == "nested"){c.lft = a[b.p.treeReader.left_field]; c.rgt = a[b.p.treeReader.right_field]; a[j] || (a[j] = parseInt(c.rgt, 10) === parseInt(c.lft, 10) + 1?"true":"false")} else c.parent_id = a[b.p.treeReader.parent_id_field]; var g = parseInt(c.level, 10), i; if (b.p.tree_root_level ===
|
||||
0){i = g + 1; g = g} else{i = g; g = g - 1}i = "<div class='tree-wrap tree-wrap-" + b.p.direction + "' style='width:" + i * 18 + "px;'>"; i += "<div style='" + (b.p.direction == "rtl"?"right:":"left:") + g * 18 + "px;' class='ui-icon "; if (a[j] == "true" || a[j] === true){i += b.p.treeIcons.leaf + " tree-leaf'"; c.isLeaf = true} else{if (a[f] == "true" || a[f] === true){i += b.p.treeIcons.minus + " tree-minus treeclick'"; c.expanded = true} else{i += b.p.treeIcons.plus + " tree-plus treeclick'"; c.expanded = false}c.isLeaf = false}i += "</div></div>"; if (parseInt(a[k], 10) !== parseInt(b.p.tree_root_level,
|
||||
10))d(b).jqGrid("isVisibleNode", c) || d(c).css("display", "none"); d("td:eq(" + e + ")", c).wrapInner("<span></span>").prepend(i); d(".treeclick", c).bind("click", function(h){h = d(h.target || h.srcElement, b.rows).parents("tr.jqgrow")[0].rowIndex; if (!b.rows[h].isLeaf)if (b.rows[h].expanded){d(b).jqGrid("collapseRow", b.rows[h]); d(b).jqGrid("collapseNode", b.rows[h])} else{d(b).jqGrid("expandRow", b.rows[h]); d(b).jqGrid("expandNode", b.rows[h])}return false}); b.p.ExpandColClick === true && d("span", c).css("cursor", "pointer").bind("click",
|
||||
function(h){h = d(h.target || h.srcElement, b.rows).parents("tr.jqgrow")[0].rowIndex; if (!b.rows[h].isLeaf)if (b.rows[h].expanded){d(b).jqGrid("collapseRow", b.rows[h]); d(b).jqGrid("collapseNode", b.rows[h])} else{d(b).jqGrid("expandRow", b.rows[h]); d(b).jqGrid("expandNode", b.rows[h])}d(b).jqGrid("setSelection", b.rows[h].id); return false})}})}, setTreeGrid:function(){return this.each(function(){var a = this, c = 0; if (a.p.treeGrid){a.p.treedatatype || d.extend(a.p, {treedatatype:a.p.datatype}); a.p.subGrid = false; a.p.altRows =
|
||||
false; a.p.pgbuttons = false; a.p.pginput = false; a.p.multiselect = false; a.p.rowList = []; a.p.treeIcons = d.extend({plus:"ui-icon-triangle-1-" + (a.p.direction == "rtl"?"w":"e"), minus:"ui-icon-triangle-1-s", leaf:"ui-icon-radio-off"}, a.p.treeIcons || {}); if (a.p.treeGridModel == "nested")a.p.treeReader = d.extend({level_field:"level", left_field:"lft", right_field:"rgt", leaf_field:"isLeaf", expanded_field:"expanded"}, a.p.treeReader); else if (a.p.treeGridModel == "adjacency")a.p.treeReader = d.extend({level_field:"level", parent_id_field:"parent",
|
||||
leaf_field:"isLeaf", expanded_field:"expanded"}, a.p.treeReader); for (var b in a.p.colModel)if (a.p.colModel.hasOwnProperty(b)){if (a.p.colModel[b].name == a.p.ExpandColumn){a.p.expColInd = c; break}c++}if (!a.p.expColInd)a.p.expColInd = 0; d.each(a.p.treeReader, function(e, f){if (f){a.p.colNames.push(f); a.p.colModel.push({name:f, width:1, hidden:true, sortable:false, resizable:false, hidedlg:true, editable:true, search:false})}})}})}, expandRow:function(a){this.each(function(){var c = this; if (c.grid && c.p.treeGrid){var b =
|
||||
d(c).jqGrid("getNodeChildren", a); d(b).each(function(){d(this).css("display", ""); this.expanded && d(c).jqGrid("expandRow", this)})}})}, collapseRow:function(a){this.each(function(){var c = this; if (c.grid && c.p.treeGrid){var b = d(c).jqGrid("getNodeChildren", a); d(b).each(function(){d(this).css("display", "none"); this.expanded && d(c).jqGrid("collapseRow", this)})}})}, getRootNodes:function(){var a = []; this.each(function(){var c = this; if (c.grid && c.p.treeGrid)switch (c.p.treeGridModel){case "nested":var b = c.p.treeReader.level_field;
|
||||
d(c.rows).each(function(){parseInt(this[b], 10) === parseInt(c.p.tree_root_level, 10) && a.push(this)}); break; case "adjacency":d(c.rows).each(function(){if (this.parent_id === null || String(this.parent_id).toLowerCase() == "null")a.push(this)}); break}}); return a}, getNodeDepth:function(a){var c = null; this.each(function(){var b = this; if (this.grid && this.p.treeGrid)switch (b.p.treeGridModel){case "nested":c = parseInt(a.level, 10) - parseInt(this.p.tree_root_level, 10); break; case "adjacency":c = d(b).jqGrid("getNodeAncestors",
|
||||
a).length; break}}); return c}, getNodeParent:function(a){var c = null; this.each(function(){var b = this; if (b.grid && b.p.treeGrid)switch (b.p.treeGridModel){case "nested":var e = parseInt(a.lft, 10), f = parseInt(a.rgt, 10), j = parseInt(a.level, 10); d(this.rows).each(function(){if (parseInt(this.level, 10) === j - 1 && parseInt(this.lft, 10) < e && parseInt(this.rgt, 10) > f){c = this; return false}}); break; case "adjacency":d(this.rows).each(function(){if (this.id == a.parent_id){c = this; return false}}); break}}); return c}, getNodeChildren:function(a){var c =
|
||||
[]; this.each(function(){var b = this; if (b.grid && b.p.treeGrid)switch (b.p.treeGridModel){case "nested":var e = parseInt(a.lft, 10), f = parseInt(a.rgt, 10), j = parseInt(a.level, 10); d(this.rows).each(function(){parseInt(this.level, 10) === j + 1 && parseInt(this.lft, 10) > e && parseInt(this.rgt, 10) < f && c.push(this)}); break; case "adjacency":d(this.rows).each(function(){this.parent_id == a.id && c.push(this)}); break}}); return c}, getFullTreeNode:function(a){var c = []; this.each(function(){var b = this, e; if (b.grid && b.p.treeGrid)switch (b.p.treeGridModel){case "nested":var f =
|
||||
parseInt(a.lft, 10), j = parseInt(a.rgt, 10), k = parseInt(a.level, 10); d(this.rows).each(function(){parseInt(this.level, 10) >= k && parseInt(this.lft, 10) >= f && parseInt(this.lft, 10) <= j && c.push(this)}); break; case "adjacency":c.push(a); d(this.rows).each(function(g){e = c.length; for (g = 0; g < e; g++)if (c[g].id == this.parent_id){c.push(this); break}}); break}}); return c}, getNodeAncestors:function(a){var c = []; this.each(function(){if (this.grid && this.p.treeGrid)for (var b = d(this).jqGrid("getNodeParent", a); b; ){c.push(b); b = d(this).jqGrid("getNodeParent",
|
||||
b)}}); return c}, isVisibleNode:function(a){var c = true; this.each(function(){var b = this; if (b.grid && b.p.treeGrid){b = d(b).jqGrid("getNodeAncestors", a); d(b).each(function(){c = c && this.expanded; if (!c)return false})}}); return c}, isNodeLoaded:function(a){var c; this.each(function(){var b = this; if (b.grid && b.p.treeGrid)c = a.loaded !== undefined?a.loaded:a.isLeaf || d(b).jqGrid("getNodeChildren", a).length > 0?true:false}); return c}, expandNode:function(a){return this.each(function(){if (this.grid && this.p.treeGrid)if (!a.expanded)if (d(this).jqGrid("isNodeLoaded",
|
||||
a)){a.expanded = true; d("div.treeclick", a).removeClass(this.p.treeIcons.plus + " tree-plus").addClass(this.p.treeIcons.minus + " tree-minus")} else{a.expanded = true; d("div.treeclick", a).removeClass(this.p.treeIcons.plus + " tree-plus").addClass(this.p.treeIcons.minus + " tree-minus"); this.p.treeANode = a.rowIndex; this.p.datatype = this.p.treedatatype; this.p.treeGridModel == "nested"?d(this).jqGrid("setGridParam", {postData:{nodeid:a.id, n_left:a.lft, n_right:a.rgt, n_level:a.level}}):d(this).jqGrid("setGridParam", {postData:{nodeid:a.id,
|
||||
parentid:a.parent_id, n_level:a.level}}); d(this).trigger("reloadGrid"); this.p.treeGridModel == "nested"?d(this).jqGrid("setGridParam", {postData:{nodeid:"", n_left:"", n_right:"", n_level:""}}):d(this).jqGrid("setGridParam", {postData:{nodeid:"", parentid:"", n_level:""}})}})}, collapseNode:function(a){return this.each(function(){if (this.grid && this.p.treeGrid)if (a.expanded){a.expanded = false; d("div.treeclick", a).removeClass(this.p.treeIcons.minus + " tree-minus").addClass(this.p.treeIcons.plus + " tree-plus")}})},
|
||||
SortTree:function(a){return this.each(function(){if (this.grid && this.p.treeGrid){var c, b, e, f = [], j = this, k = d(this).jqGrid("getRootNodes"); k.sort(function(g, i){if (g.sortKey < i.sortKey)return - a; if (g.sortKey > i.sortKey)return a; return 0}); if (k[0]){d("td", k[0]).each(function(g){d(this).css("width", j.grid.headers[g].width + "px")}); j.grid.cols = k[0].cells}c = 0; for (b = k.length; c < b; c++){e = k[c]; f.push(e); d(this).jqGrid("collectChildrenSortTree", f, e, a)}d.each(f, function(g, i){d("tbody", j.grid.bDiv).append(i); i.sortKey =
|
||||
null})}})}, collectChildrenSortTree:function(a, c, b){return this.each(function(){if (this.grid && this.p.treeGrid){var e, f, j, k = d(this).jqGrid("getNodeChildren", c); k.sort(function(g, i){if (g.sortKey < i.sortKey)return - b; if (g.sortKey > i.sortKey)return b; return 0}); e = 0; for (f = k.length; e < f; e++){j = k[e]; a.push(j); d(this).jqGrid("collectChildrenSortTree", a, j, b)}}})}, setTreeRow:function(a, c){var b = false; this.each(function(){var e = this; if (e.grid && e.p.treeGrid)b = d(e).jqGrid("setRowData", a, c)}); return b}, delTreeNode:function(a){return this.each(function(){var c =
|
||||
this; if (c.grid && c.p.treeGrid){var b = d(c).jqGrid("getInd", a, true); if (b){var e = d(c).jqGrid("getNodeChildren", b); if (e.length > 0)for (var f = 0; f < e.length; f++)d(c).jqGrid("delRowData", e[f].id); d(c).jqGrid("delRowData", b.id)}}})}})})(jQuery);
|
||||
(function(b){b.jgrid.extend({jqGridImport:function(a){a = b.extend({imptype:"xml", impstring:"", impurl:"", mtype:"GET", impData:{}, xmlGrid:{config:"roots>grid", data:"roots>rows"}, jsonGrid:{config:"grid", data:"data"}, ajaxOptions:{}}, a || {}); return this.each(function(){var e = this, c = function(d, g){var f = b(g.xmlGrid.config, d)[0]; g = b(g.xmlGrid.data, d)[0]; var k; if (xmlJsonClass.xml2json && b.jgrid.parse){f = xmlJsonClass.xml2json(f, " "); f = b.jgrid.parse(f); for (var h in f)if (f.hasOwnProperty(h))k = f[h]; if (g){h = f.grid.datatype;
|
||||
f.grid.datatype = "xmlstring"; f.grid.datastr = d; b(e).jqGrid(k).jqGrid("setGridParam", {datatype:h})} else b(e).jqGrid(k)} else alert("xml2json or parse are not present")}, i = function(d, g){if (d && typeof d == "string"){var f = b.jgrid.parse(d); d = f[g.jsonGrid.config]; if (g = f[g.jsonGrid.data]){f = d.datatype; d.datatype = "jsonstring"; d.datastr = g; b(e).jqGrid(d).jqGrid("setGridParam", {datatype:f})} else b(e).jqGrid(d)}}; switch (a.imptype){case "xml":b.ajax(b.extend({url:a.impurl, type:a.mtype, data:a.impData, dataType:"xml",
|
||||
complete:function(d, g){if (g == "success"){c(d.responseXML, a); b.isFunction(a.importComplete) && a.importComplete(d)}}}, a.ajaxOptions)); break; case "xmlstring":if (a.impstring && typeof a.impstring == "string"){var j = b.jgrid.stringToDoc(a.impstring); if (j){c(j, a); b.isFunction(a.importComplete) && a.importComplete(j); a.impstring = null}j = null}break; case "json":b.ajax(b.extend({url:a.impurl, type:a.mtype, data:a.impData, dataType:"json", complete:function(d, g){if (g == "success"){i(d.responseText, a); b.isFunction(a.importComplete) &&
|
||||
a.importComplete(d)}}}, a.ajaxOptions)); break; case "jsonstring":if (a.impstring && typeof a.impstring == "string"){i(a.impstring, a); b.isFunction(a.importComplete) && a.importComplete(a.impstring); a.impstring = null}break}})}, jqGridExport:function(a){a = b.extend({exptype:"xmlstring", root:"grid", ident:"\t"}, a || {}); var e = null; this.each(function(){if (this.grid){var c = b.extend({}, b(this).jqGrid("getGridParam")); if (c.rownumbers){c.colNames.splice(0, 1); c.colModel.splice(0, 1)}if (c.multiselect){c.colNames.splice(0, 1);
|
||||
c.colModel.splice(0, 1)}if (c.subGrid){c.colNames.splice(0, 1); c.colModel.splice(0, 1)}c.knv = null; if (c.treeGrid)for (var i in c.treeReader)if (c.treeReader.hasOwnProperty(i)){c.colNames.splice(c.colNames.length - 1); c.colModel.splice(c.colModel.length - 1)}switch (a.exptype){case "xmlstring":e = "<" + a.root + ">" + xmlJsonClass.json2xml(c, a.ident) + "</" + a.root + ">"; break; case "jsonstring":e = "{" + xmlJsonClass.toJson(c, a.root, a.ident) + "}"; if (c.postData.filters !== undefined){e = e.replace(/filters":"/, 'filters":'); e = e.replace(/}]}"/,
|
||||
"}]}")}break}}}); return e}, excelExport:function(a){a = b.extend({exptype:"remote", url:null, oper:"oper", tag:"excel", exportOptions:{}}, a || {}); return this.each(function(){$t = this; if (this.grid)if (a.exptype == "remote"){var e = b.extend({}, this.p.postData); e[a.oper] = a.tag; e = jQuery.param(e); window.location = a.url + "?" + e}})}})})(jQuery);
|
||||
var xmlJsonClass = {xml2json:function(a, b){if (a.nodeType === 9)a = a.documentElement; a = this.toJson(this.toObj(this.removeWhite(a)), a.nodeName, "\t"); return"{\n" + b + (b?a.replace(/\t/g, b):a.replace(/\t|\n/g, "")) + "\n}"}, json2xml:function(a, b){var g = function(d, c, j){var i = "", k, h; if (d instanceof Array)if (d.length === 0)i += j + "<" + c + ">__EMPTY_ARRAY_</" + c + ">\n"; else{k = 0; for (h = d.length; k < h; k += 1){var l = j + g(d[k], c, j + "\t") + "\n"; i += l}} else if (typeof d === "object"){k = false; i += j + "<" + c; for (h in d)if (d.hasOwnProperty(h))if (h.charAt(0) ===
|
||||
"@")i += " " + h.substr(1) + '="' + d[h].toString() + '"'; else k = true; i += k?">":"/>"; if (k){for (h in d)if (d.hasOwnProperty(h))if (h === "#text")i += d[h]; else if (h === "#cdata")i += "<![CDATA[" + d[h] + "]]\>"; else if (h.charAt(0) !== "@")i += g(d[h], h, j + "\t"); i += (i.charAt(i.length - 1) === "\n"?j:"") + "</" + c + ">"}} else i += typeof d === "function"?j + "<" + c + "><![CDATA[" + d + "]]\></" + c + ">":d.toString() === '""' || d.toString().length === 0?j + "<" + c + ">__EMPTY_STRING_</" + c + ">":j + "<" + c + ">" + d.toString() + "</" + c + ">"; return i}, e = "", f; for (f in a)if (a.hasOwnProperty(f))e +=
|
||||
g(a[f], f, ""); return b?e.replace(/\t/g, b):e.replace(/\t|\n/g, "")}, toObj:function(a){var b = {}, g = /function/i; if (a.nodeType === 1){if (a.attributes.length){var e; for (e = 0; e < a.attributes.length; e += 1)b["@" + a.attributes[e].nodeName] = (a.attributes[e].nodeValue || "").toString()}if (a.firstChild){var f = e = 0, d = false, c; for (c = a.firstChild; c; c = c.nextSibling)if (c.nodeType === 1)d = true; else if (c.nodeType === 3 && c.nodeValue.match(/[^ \f\n\r\t\v]/))e += 1; else if (c.nodeType === 4)f += 1; if (d)if (e < 2 && f < 2){this.removeWhite(a); for (c =
|
||||
a.firstChild; c; c = c.nextSibling)if (c.nodeType === 3)b["#text"] = this.escape(c.nodeValue); else if (c.nodeType === 4)if (g.test(c.nodeValue))b[c.nodeName] = [b[c.nodeName], c.nodeValue]; else b["#cdata"] = this.escape(c.nodeValue); else if (b[c.nodeName])if (b[c.nodeName]instanceof Array)b[c.nodeName][b[c.nodeName].length] = this.toObj(c); else b[c.nodeName] = [b[c.nodeName], this.toObj(c)]; else b[c.nodeName] = this.toObj(c)} else if (a.attributes.length)b["#text"] = this.escape(this.innerXml(a)); else b = this.escape(this.innerXml(a));
|
||||
else if (e)if (a.attributes.length)b["#text"] = this.escape(this.innerXml(a)); else{b = this.escape(this.innerXml(a)); if (b === "__EMPTY_ARRAY_")b = "[]"; else if (b === "__EMPTY_STRING_")b = ""} else if (f)if (f > 1)b = this.escape(this.innerXml(a)); else for (c = a.firstChild; c; c = c.nextSibling)if (g.test(a.firstChild.nodeValue)){b = a.firstChild.nodeValue; break} else b["#cdata"] = this.escape(c.nodeValue)}if (!a.attributes.length && !a.firstChild)b = null} else if (a.nodeType === 9)b = this.toObj(a.documentElement); else alert("unhandled node type: " +
|
||||
a.nodeType); return b}, toJson:function(a, b, g){var e = b?'"' + b + '"':""; if (a === "[]")e += b?":[]":"[]"; else if (a instanceof Array){var f, d, c = []; d = 0; for (f = a.length; d < f; d += 1)c[d] = this.toJson(a[d], "", g + "\t"); e += (b?":[":"[") + (c.length > 1?"\n" + g + "\t" + c.join(",\n" + g + "\t") + "\n" + g:c.join("")) + "]"} else if (a === null)e += (b && ":") + "null"; else if (typeof a === "object"){f = []; for (d in a)if (a.hasOwnProperty(d))f[f.length] = this.toJson(a[d], d, g + "\t"); e += (b?":{":"{") + (f.length > 1?"\n" + g + "\t" + f.join(",\n" + g + "\t") + "\n" + g:f.join("")) +
|
||||
"}"} else if (typeof a === "string"){g = /function/i; f = a.toString(); e += /(^-?\d+\.?\d*$)/.test(f) || g.test(f) || f === "false" || f === "true"?(b && ":") + f:(b && ":") + '"' + a + '"'} else e += (b && ":") + a.toString(); return e}, innerXml:function(a){var b = ""; if ("innerHTML"in a)b = a.innerHTML; else{var g = function(e){var f = "", d; if (e.nodeType === 1){f += "<" + e.nodeName; for (d = 0; d < e.attributes.length; d += 1)f += " " + e.attributes[d].nodeName + '="' + (e.attributes[d].nodeValue || "").toString() + '"'; if (e.firstChild){f += ">"; for (d = e.firstChild; d; d = d.nextSibling)f +=
|
||||
g(d); f += "</" + e.nodeName + ">"} else f += "/>"} else if (e.nodeType === 3)f += e.nodeValue; else if (e.nodeType === 4)f += "<![CDATA[" + e.nodeValue + "]]\>"; return f}; for (a = a.firstChild; a; a = a.nextSibling)b += g(a)}return b}, escape:function(a){return a.replace(/[\\]/g, "\\\\").replace(/[\"]/g, '\\"').replace(/[\n]/g, "\\n").replace(/[\r]/g, "\\r")}, removeWhite:function(a){a.normalize(); var b; for (b = a.firstChild; b; )if (b.nodeType === 3)if (b.nodeValue.match(/[^ \f\n\r\t\v]/))b = b.nextSibling; else{var g = b.nextSibling; a.removeChild(b);
|
||||
b = g} else{b.nodeType === 1 && this.removeWhite(b); b = b.nextSibling}return a}};
|
||||
(function(b){b.jgrid.extend({setColumns:function(a){a = b.extend({top:0, left:0, width:200, height:"auto", dataheight:"auto", modal:false, drag:true, beforeShowForm:null, afterShowForm:null, afterSubmitForm:null, closeOnEscape:true, ShrinkToFit:false, jqModal:false, saveicon:[true, "left", "ui-icon-disk"], closeicon:[true, "left", "ui-icon-close"], onClose:null, colnameview:true, closeAfterSubmit:true, updateAfterCheck:false, recreateForm:false}, b.jgrid.col, a || {}); return this.each(function(){var c = this; if (c.grid){var j = typeof a.beforeShowForm ===
|
||||
"function"?true:false, k = typeof a.afterShowForm === "function"?true:false, l = typeof a.afterSubmitForm === "function"?true:false, e = c.p.id, d = "ColTbl_" + e, f = {themodal:"colmod" + e, modalhead:"colhd" + e, modalcontent:"colcnt" + e, scrollelm:d}; a.recreateForm === true && b("#" + f.themodal).html() != null && b("#" + f.themodal).remove(); if (b("#" + f.themodal).html() != null){j && a.beforeShowForm(b("#" + d)); viewModal("#" + f.themodal, {gbox:"#gbox_" + e, jqm:a.jqModal, jqM:false, modal:a.modal})} else{var g = isNaN(a.dataheight)?a.dataheight:a.dataheight +
|
||||
"px"; g = "<div id='" + d + "' class='formdata' style='width:100%;overflow:auto;position:relative;height:" + g + ";'>"; g += "<table class='ColTable' cellspacing='1' cellpading='2' border='0'><tbody>"; for (i = 0; i < this.p.colNames.length; i++)c.p.colModel[i].hidedlg || (g += "<tr><td style='white-space: pre;'><input type='checkbox' style='margin-right:5px;' id='col_" + this.p.colModel[i].name + "' class='cbox' value='T' " + (this.p.colModel[i].hidden === false?"checked":"") + "/><label for='col_" + this.p.colModel[i].name + "'>" + this.p.colNames[i] +
|
||||
(a.colnameview?" (" + this.p.colModel[i].name + ")":"") + "</label></td></tr>"); g += "</tbody></table></div>"; g += "<table border='0' class='EditTable' id='" + d + "_2'><tbody><tr style='display:block;height:3px;'><td></td></tr><tr><td class='DataTD ui-widget-content'></td></tr><tr><td class='ColButton EditButton'>" + (!a.updateAfterCheck?"<a href='javascript:void(0)' id='dData' class='fm-button ui-state-default ui-corner-all'>" + a.bSubmit + "</a>":"") + " " + ("<a href='javascript:void(0)' id='eData' class='fm-button ui-state-default ui-corner-all'>" +
|
||||
a.bCancel + "</a>") + "</td></tr></tbody></table>"; a.gbox = "#gbox_" + e; createModal(f, g, a, "#gview_" + c.p.id, b("#gview_" + c.p.id)[0]); if (a.saveicon[0] == true)b("#dData", "#" + d + "_2").addClass(a.saveicon[1] == "right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon " + a.saveicon[2] + "'></span>"); if (a.closeicon[0] == true)b("#eData", "#" + d + "_2").addClass(a.closeicon[1] == "right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon " + a.closeicon[2] + "'></span>"); a.updateAfterCheck?
|
||||
b(":input", "#" + d).click(function(){var h = this.id.substr(4); if (h){this.checked?b(c).jqGrid("showCol", h):b(c).jqGrid("hideCol", h); a.ShrinkToFit === true && b(c).jqGrid("setGridWidth", c.grid.width - 0.0010, true)}return this}):b("#dData", "#" + d + "_2").click(function(){for (i = 0; i < c.p.colModel.length; i++)if (!c.p.colModel[i].hidedlg){var h = c.p.colModel[i].name.replace(".", "\\."); if (b("#col_" + h, "#" + d).attr("checked")){b(c).jqGrid("showCol", c.p.colModel[i].name); b("#col_" + h, "#" + d).attr("defaultChecked", true)} else{b(c).jqGrid("hideCol",
|
||||
c.p.colModel[i].name); b("#col_" + h, "#" + d).attr("defaultChecked", "")}}a.ShrinkToFit === true && b(c).jqGrid("setGridWidth", c.grid.width - 0.0010, true); a.closeAfterSubmit && hideModal("#" + f.themodal, {gb:"#gbox_" + e, jqm:a.jqModal, onClose:a.onClose}); l && a.afterSubmitForm(b("#" + d)); return false}); b("#eData", "#" + d + "_2").click(function(){hideModal("#" + f.themodal, {gb:"#gbox_" + e, jqm:a.jqModal, onClose:a.onClose}); return false}); b("#dData, #eData", "#" + d + "_2").hover(function(){b(this).addClass("ui-state-hover")}, function(){b(this).removeClass("ui-state-hover")});
|
||||
j && a.beforeShowForm(b("#" + d)); viewModal("#" + f.themodal, {gbox:"#gbox_" + e, jqm:a.jqModal, jqM:true, modal:a.modal})}k && a.afterShowForm(b("#" + d))}})}})})(jQuery);
|
||||
(function(c){c.jgrid.extend({getPostData:function(){var a = this[0]; if (a.grid)return a.p.postData}, setPostData:function(a){var b = this[0]; if (b.grid)if (typeof a === "object")b.p.postData = a; else alert("Error: cannot add a non-object postData value. postData unchanged.")}, appendPostData:function(a){var b = this[0]; if (b.grid)typeof a === "object"?c.extend(b.p.postData, a):alert("Error: cannot append a non-object postData value. postData unchanged.")}, setPostDataItem:function(a, b){var d = this[0]; if (d.grid)d.p.postData[a] =
|
||||
b}, getPostDataItem:function(a){var b = this[0]; if (b.grid)return b.p.postData[a]}, removePostDataItem:function(a){var b = this[0]; b.grid && delete b.p.postData[a]}, getUserData:function(){var a = this[0]; if (a.grid)return a.p.userData}, getUserDataItem:function(a){var b = this[0]; if (b.grid)return b.p.userData[a]}})})(jQuery);
|
||||
function tableToGrid(o, p){jQuery(o).each(function(){if (!this.grid){jQuery(this).width("99%"); var a = jQuery(this).width(), f = jQuery("input[type=checkbox]:first", jQuery(this)), l = jQuery("input[type=radio]:first", jQuery(this)), b = f.length > 0, q = !b && l.length > 0, m = b || q; f = f.attr("name") || l.attr("name"); var c = [], g = []; jQuery("th", jQuery(this)).each(function(){if (c.length === 0 && m){c.push({name:"__selection__", index:"__selection__", width:0, hidden:true}); g.push("__selection__")} else{c.push({name:jQuery(this).attr("id") ||
|
||||
jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"), index:jQuery(this).attr("id") || jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"), width:jQuery(this).width() || 150}); g.push(jQuery(this).html())}}); var e = [], h = [], i = []; jQuery("tbody > tr", jQuery(this)).each(function(){var j = {}, d = 0; jQuery("td", jQuery(this)).each(function(){if (d === 0 && m){var k = jQuery("input", jQuery(this)), n = k.attr("value"); h.push(n || e.length); k.attr("checked") && i.push(n); j[c[d].name] =
|
||||
k.attr("value")} else j[c[d].name] = jQuery(this).html(); d++}); d > 0 && e.push(j)}); jQuery(this).empty(); jQuery(this).addClass("scroll"); jQuery(this).jqGrid($.extend({datatype:"local", width:a, colNames:g, colModel:c, multiselect:b}, p || {})); for (a = 0; a < e.length; a++){b = null; if (h.length > 0)if ((b = h[a]) && b.replace)b = encodeURIComponent(b).replace(/[.\-%]/g, "_"); if (b === null)b = a + 1; jQuery(this).jqGrid("addRowData", b, e[a])}for (a = 0; a < i.length; a++)jQuery(this).jqGrid("setSelection", i[a])}})};
|
||||
(function(a){if (a.browser.msie && a.browser.version == 8)a.expr[":"].hidden = function(b){return b.offsetWidth === 0 || b.offsetHeight === 0 || b.style.display == "none"}; a.jgrid._multiselect = false; if (a.ui)if (a.ui.multiselect){if (a.ui.multiselect.prototype._setSelected){var q = a.ui.multiselect.prototype._setSelected; a.ui.multiselect.prototype._setSelected = function(b, i){b = q.call(this, b, i); if (i && this.selectedList){var c = this.element; this.selectedList.find("li").each(function(){a(this).data("optionLink") && a(this).data("optionLink").remove().appendTo(c)})}return b}}if (a.ui.multiselect.prototype.destroy)a.ui.multiselect.prototype.destroy =
|
||||
function(){this.element.show(); this.container.remove(); a.Widget === undefined?a.widget.prototype.destroy.apply(this, arguments):a.Widget.prototype.destroy.apply(this, arguments)}; a.jgrid._multiselect = true}a.jgrid.extend({sortableColumns:function(b){return this.each(function(){function i(){c.p.disableClick = true}var c = this, g = {tolerance:"pointer", axis:"x", scrollSensitivity:"1", items:">th:not(:has(#jqgh_cb,#jqgh_rn,#jqgh_subgrid),:hidden)", placeholder:{element:function(e){return a(document.createElement(e[0].nodeName)).addClass(e[0].className +
|
||||
" ui-sortable-placeholder ui-state-highlight").removeClass("ui-sortable-helper")[0]}, update:function(e, h){h.height(e.currentItem.innerHeight() - parseInt(e.currentItem.css("paddingTop") || 0, 10) - parseInt(e.currentItem.css("paddingBottom") || 0, 10)); h.width(e.currentItem.innerWidth() - parseInt(e.currentItem.css("paddingLeft") || 0, 10) - parseInt(e.currentItem.css("paddingRight") || 0, 10))}}, update:function(e, h){e = a(h.item).parent(); e = a(">th", e); var j = {}; a.each(c.p.colModel, function(m){j[this.name] = m}); var l = [];
|
||||
e.each(function(){var m = a(">div", this).get(0).id.replace(/^jqgh_/, ""); m in j && l.push(j[m])}); a(c).jqGrid("remapColumns", l, true, true); a.isFunction(c.p.sortable.update) && c.p.sortable.update(l); setTimeout(function(){c.p.disableClick = false}, 50)}}; if (c.p.sortable.options)a.extend(g, c.p.sortable.options); else if (a.isFunction(c.p.sortable))c.p.sortable = {update:c.p.sortable}; if (g.start){var d = g.start; g.start = function(e, h){i(); d.call(this, e, h)}} else g.start = i; if (c.p.sortable.exclude)g.items += ":not(" + c.p.sortable.exclude +
|
||||
")"; b.sortable(g).data("sortable").floating = true})}, columnChooser:function(b){function i(f, k, p){if (k >= 0){var o = f.slice(), r = o.splice(k, Math.max(f.length - k, k)); if (k > f.length)k = f.length; o[k] = p; return o.concat(r)}}function c(f, k){if (f)if (typeof f == "string")a.fn[f] && a.fn[f].apply(k, a.makeArray(arguments).slice(2)); else a.isFunction(f) && f.apply(k, a.makeArray(arguments).slice(2))}var g = this; if (!a("#colchooser_" + g[0].p.id).length){var d = a('<div id="colchooser_' + g[0].p.id + '" style="position:relative;overflow:hidden"><div><select multiple="multiple"></select></div></div>'),
|
||||
e = a("select", d); b = a.extend({width:420, height:240, classname:null, done:function(f){f && g.jqGrid("remapColumns", f, true)}, msel:"multiselect", dlog:"dialog", dlog_opts:function(f){var k = {}; k[f.bSubmit] = function(){f.apply_perm(); f.cleanup(false)}; k[f.bCancel] = function(){f.cleanup(true)}; return{buttons:k, close:function(){f.cleanup(true)}, modal:false, resizable:false, width:f.width + 20}}, apply_perm:function(){a("option", e).each(function(){this.selected?g.jqGrid("showCol", h[this.value].name):g.jqGrid("hideCol",
|
||||
h[this.value].name)}); var f = []; a("option[selected]", e).each(function(){f.push(parseInt(this.value, 10))}); a.each(f, function(){delete l[h[parseInt(this, 10)].name]}); a.each(l, function(){var k = parseInt(this, 10); f = i(f, k, k)}); b.done && b.done.call(g, f)}, cleanup:function(f){c(b.dlog, d, "destroy"); c(b.msel, e, "destroy"); d.remove(); f && b.done && b.done.call(g)}, msel_opts:{}}, a.jgrid.col, b || {}); if (a.ui)if (a.ui.multiselect)if (b.msel == "multiselect"){if (!a.jgrid._multiselect){alert("Multiselect plugin loaded after jqGrid. Please load the plugin before the jqGrid!");
|
||||
return}b.msel_opts = a.extend(a.ui.multiselect.defaults, b.msel_opts)}b.caption && d.attr("title", b.caption); if (b.classname){d.addClass(b.classname); e.addClass(b.classname)}if (b.width){a(">div", d).css({width:b.width, margin:"0 auto"}); e.css("width", b.width)}if (b.height){a(">div", d).css("height", b.height); e.css("height", b.height - 10)}var h = g.jqGrid("getGridParam", "colModel"), j = g.jqGrid("getGridParam", "colNames"), l = {}, m = []; e.empty(); a.each(h, function(f){l[this.name] = f; if (this.hidedlg)this.hidden || m.push(f);
|
||||
else e.append("<option value='" + f + "' " + (this.hidden?"":"selected='selected'") + ">" + j[f] + "</option>")}); var n = a.isFunction(b.dlog_opts)?b.dlog_opts.call(g, b):b.dlog_opts; c(b.dlog, d, n); n = a.isFunction(b.msel_opts)?b.msel_opts.call(g, b):b.msel_opts; c(b.msel, e, n)}}, sortableRows:function(b){return this.each(function(){var i = this; if (i.grid)if (!i.p.treeGrid)if (a.fn.sortable){b = a.extend({cursor:"move", axis:"y", items:".jqgrow"}, b || {}); if (b.start && a.isFunction(b.start)){b._start_ = b.start; delete b.start} else b._start_ =
|
||||
false; if (b.update && a.isFunction(b.update)){b._update_ = b.update; delete b.update} else b._update_ = false; b.start = function(c, g){a(g.item).css("border-width", "0px"); a("td", g.item).each(function(h){this.style.width = i.grid.cols[h].style.width}); if (i.p.subGrid){var d = a(g.item).attr("id"); try{a(i).jqGrid("collapseSubGridRow", d)} catch (e){}}b._start_ && b._start_.apply(this, [c, g])}; b.update = function(c, g){a(g.item).css("border-width", ""); i.updateColumns(); i.p.rownumbers === true && a("td.jqgrid-rownum", i.rows).each(function(d){a(this).html(d +
|
||||
1)}); b._update_ && b._update_.apply(this, [c, g])}; a("tbody:first", i).sortable(b); a("tbody:first", i).disableSelection()}})}, gridDnD:function(b){return this.each(function(){function i(){var d = a.data(c, "dnd"); a("tr.jqgrow:not(.ui-draggable)", c).draggable(a.isFunction(d.drag)?d.drag.call(a(c), d):d.drag)}var c = this; if (c.grid)if (!c.p.treeGrid)if (a.fn.draggable && a.fn.droppable){a("#jqgrid_dnd").html() === null && a("body").append("<table id='jqgrid_dnd' class='ui-jqgrid-dnd'></table>"); if (typeof b == "string" && b ==
|
||||
"updateDnD" && c.p.jqgdnd === true)i(); else{b = a.extend({drag:function(d){return a.extend({start:function(e, h){if (c.p.subGrid){var j = a(h.helper).attr("id"); try{a(c).jqGrid("collapseSubGridRow", j)} catch (l){}}for (j = 0; j < a.data(c, "dnd").connectWith.length; j++)a(a.data(c, "dnd").connectWith[j]).jqGrid("getGridParam", "reccount") == "0" && a(a.data(c, "dnd").connectWith[j]).jqGrid("addRowData", "jqg_empty_row", {}); h.helper.addClass("ui-state-highlight"); a("td", h.helper).each(function(m){this.style.width = c.grid.headers[m].width +
|
||||
"px"}); d.onstart && a.isFunction(d.onstart) && d.onstart.call(a(c), e, h)}, stop:function(e, h){if (h.helper.dropped){var j = a(h.helper).attr("id"); a(c).jqGrid("delRowData", j)}for (j = 0; j < a.data(c, "dnd").connectWith.length; j++)a(a.data(c, "dnd").connectWith[j]).jqGrid("delRowData", "jqg_empty_row"); d.onstop && a.isFunction(d.onstop) && d.onstop.call(a(c), e, h)}}, d.drag_opts || {})}, drop:function(d){return a.extend({accept:function(e){var h = a(e).closest("table.ui-jqgrid-btable"); if (a.data(h[0], "dnd") !== undefined){e = a.data(h[0],
|
||||
"dnd").connectWith; return a.inArray("#" + this.id, e) != - 1?true:false}return e}, drop:function(e, h){var j = a(h.draggable).attr("id"); j = a("#" + c.id).jqGrid("getRowData", j); if (!d.dropbyname){var l = 0, m = {}, n, f = a("#" + this.id).jqGrid("getGridParam", "colModel"); try{for (var k in j){if (j.hasOwnProperty(k) && f[l]){n = f[l].name; m[n] = j[k]}l++}j = m} catch (p){}}h.helper.dropped = true; if (d.beforedrop && a.isFunction(d.beforedrop)){n = d.beforedrop.call(this, e, h, j, a("#" + c.id), a(this)); if (typeof n != "undefined" && n !== null && typeof n ==
|
||||
"object")j = n}if (h.helper.dropped){var o; if (d.autoid)if (a.isFunction(d.autoid))o = d.autoid.call(this, j); else{o = Math.ceil(Math.random() * 1E3); o = d.autoidprefix + o}a("#" + this.id).jqGrid("addRowData", o, j, d.droppos)}d.ondrop && a.isFunction(d.ondrop) && d.ondrop.call(this, e, h, j)}}, d.drop_opts || {})}, onstart:null, onstop:null, beforedrop:null, ondrop:null, drop_opts:{activeClass:"ui-state-active", hoverClass:"ui-state-hover"}, drag_opts:{revert:"invalid", helper:"clone", cursor:"move", appendTo:"#jqgrid_dnd", zIndex:5E3},
|
||||
dropbyname:false, droppos:"first", autoid:true, autoidprefix:"dnd_"}, b || {}); if (b.connectWith){b.connectWith = b.connectWith.split(","); b.connectWith = a.map(b.connectWith, function(d){return a.trim(d)}); a.data(c, "dnd", b); c.p.reccount != "0" && !c.p.jqgdnd && i(); c.p.jqgdnd = true; for (var g = 0; g < b.connectWith.length; g++)a(b.connectWith[g]).droppable(a.isFunction(b.drop)?b.drop.call(a(c), b):b.drop)}}}})}, gridResize:function(b){return this.each(function(){var i = this; if (i.grid && a.fn.resizable){b = a.extend({}, b || {}); if (b.alsoResize){b._alsoResize_ =
|
||||
b.alsoResize; delete b.alsoResize} else b._alsoResize_ = false; if (b.stop && a.isFunction(b.stop)){b._stop_ = b.stop; delete b.stop} else b._stop_ = false; b.stop = function(c, g){a(i).jqGrid("setGridParam", {height:a("#gview_" + i.p.id + " .ui-jqgrid-bdiv").height()}); a(i).jqGrid("setGridWidth", g.size.width, b.shrinkToFit); b._stop_ && b._stop_.call(i, c, g)}; b.alsoResize = b._alsoResize_?eval("(" + ("{'#gview_" + i.p.id + " .ui-jqgrid-bdiv':true,'" + b._alsoResize_ + "':true}") + ")"):a(".ui-jqgrid-bdiv", "#gview_" + i.p.id); delete b._alsoResize_;
|
||||
a("#gbox_" + i.p.id).resizable(b)}})}})})(jQuery);
|
||||
* jqGrid 4.6.0 - jQuery Grid
|
||||
* Copyright (c) 2008, Tony Tomov, tony@trirand.com
|
||||
* Dual licensed under the MIT or GPL licenses
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl-2.0.html
|
||||
* Date:2014-02-20
|
||||
* Modules: grid.base.js; jquery.fmatter.js; grid.custom.js; grid.common.js; grid.formedit.js; grid.filter.js; grid.inlinedit.js; grid.celledit.js; jqModal.js; jqDnR.js; grid.subgrid.js; grid.grouping.js; grid.treegrid.js; grid.pivot.js; grid.import.js; JsonXml.js; grid.tbltogrid.js; grid.jqueryui.js;
|
||||
*/
|
||||
(function(b){b.jgrid=b.jgrid||{};b.extend(b.jgrid,{version:"4.6.0",htmlDecode:function(b){return b&&(" "===b||" "===b||1===b.length&&160===b.charCodeAt(0))?"":b?String(b).replace(/>/g,">").replace(/</g,"<").replace(/"/g,'"').replace(/&/g,"&"):b},htmlEncode:function(b){return b?String(b).replace(/&/g,"&").replace(/\"/g,""").replace(/</g,"<").replace(/>/g,">"):b},format:function(e){var f=b.makeArray(arguments).slice(1);null==e&&(e="");return e.replace(/\{(\d+)\}/g,
|
||||
function(b,d){return f[d]})},msie:"Microsoft Internet Explorer"===navigator.appName,msiever:function(){var b=-1;null!=/MSIE ([0-9]{1,}[.0-9]{0,})/.exec(navigator.userAgent)&&(b=parseFloat(RegExp.$1));return b},getCellIndex:function(e){e=b(e);if(e.is("tr"))return-1;e=(e.is("td")||e.is("th")?e:e.closest("td,th"))[0];return b.jgrid.msie?b.inArray(e,e.parentNode.cells):e.cellIndex},stripHtml:function(b){b=String(b);var f=/<("[^"]*"|'[^']*'|[^'">])*>/gi;return b?(b=b.replace(f,""))&&" "!==b&&" "!==
|
||||
b?b.replace(/\"/g,"'"):"":b},stripPref:function(e,f){var c=b.type(e);if("string"===c||"number"===c)e=String(e),f=""!==e?String(f).replace(String(e),""):f;return f},parse:function(e){"while(1);"===e.substr(0,9)&&(e=e.substr(9));"/*"===e.substr(0,2)&&(e=e.substr(2,e.length-4));e||(e="{}");return!0===b.jgrid.useJSON&&"object"===typeof JSON&&"function"===typeof JSON.parse?JSON.parse(e):eval("("+e+")")},parseDate:function(e,f,c,d){var a=/^\/Date\((([-+])?[0-9]+)(([-+])([0-9]{2})([0-9]{2}))?\)\/$/,l="string"===
|
||||
typeof f?f.match(a):null,a=function(a,b){a=String(a);for(b=parseInt(b,10)||2;a.length<b;)a="0"+a;return a},g={m:1,d:1,y:1970,h:0,i:0,s:0,u:0},h=0,k,n,h=function(a,b){0===a?12===b&&(b=0):12!==b&&(b+=12);return b};void 0===d&&(d=b.jgrid.formatter.date);void 0===d.parseRe&&(d.parseRe=/[#%\\\/:_;.,\t\s-]/);d.masks.hasOwnProperty(e)&&(e=d.masks[e]);if(f&&null!=f)if(isNaN(f-0)||"u"!==String(e).toLowerCase())if(f.constructor===Date)h=f;else if(null!==l){if(h=new Date(parseInt(l[1],10)),l[3]){var m=60*Number(l[5])+
|
||||
Number(l[6]),m=m*("-"===l[4]?1:-1),m=m-h.getTimezoneOffset();h.setTime(Number(Number(h)+6E4*m))}}else{m=0;"ISO8601Long"===d.srcformat&&"Z"===f.charAt(f.length-1)&&(m-=(new Date).getTimezoneOffset());f=String(f).replace(/\T/g,"#").replace(/\t/,"%").split(d.parseRe);e=e.replace(/\T/g,"#").replace(/\t/,"%").split(d.parseRe);k=0;for(n=e.length;k<n;k++)"M"===e[k]&&(l=b.inArray(f[k],d.monthNames),-1!==l&&12>l&&(f[k]=l+1,g.m=f[k])),"F"===e[k]&&(l=b.inArray(f[k],d.monthNames,12),-1!==l&&11<l&&(f[k]=l+1-12,
|
||||
g.m=f[k])),"a"===e[k]&&(l=b.inArray(f[k],d.AmPm),-1!==l&&2>l&&f[k]===d.AmPm[l]&&(f[k]=l,g.h=h(f[k],g.h))),"A"===e[k]&&(l=b.inArray(f[k],d.AmPm),-1!==l&&1<l&&f[k]===d.AmPm[l]&&(f[k]=l-2,g.h=h(f[k],g.h))),"g"===e[k]&&(g.h=parseInt(f[k],10)),void 0!==f[k]&&(g[e[k].toLowerCase()]=parseInt(f[k],10));g.f&&(g.m=g.f);if(0===g.m&&0===g.y&&0===g.d)return" ";g.m=parseInt(g.m,10)-1;h=g.y;70<=h&&99>=h?g.y=1900+g.y:0<=h&&69>=h&&(g.y=2E3+g.y);h=new Date(g.y,g.m,g.d,g.h,g.i,g.s,g.u);0<m&&h.setTime(Number(Number(h)+
|
||||
6E4*m))}else h=new Date(1E3*parseFloat(f));else h=new Date(g.y,g.m,g.d,g.h,g.i,g.s,g.u);if(void 0===c)return h;d.masks.hasOwnProperty(c)?c=d.masks[c]:c||(c="Y-m-d");e=h.getHours();f=h.getMinutes();g=h.getDate();m=h.getMonth()+1;l=h.getTimezoneOffset();k=h.getSeconds();n=h.getMilliseconds();var r=h.getDay(),p=h.getFullYear(),q=(r+6)%7+1,x=(new Date(p,m-1,g)-new Date(p,0,1))/864E5,G={d:a(g),D:d.dayNames[r],j:g,l:d.dayNames[r+7],N:q,S:d.S(g),w:r,z:x,W:5>q?Math.floor((x+q-1)/7)+1:Math.floor((x+q-1)/7)||
|
||||
(4>((new Date(p-1,0,1)).getDay()+6)%7?53:52),F:d.monthNames[m-1+12],m:a(m),M:d.monthNames[m-1],n:m,t:"?",L:"?",o:"?",Y:p,y:String(p).substring(2),a:12>e?d.AmPm[0]:d.AmPm[1],A:12>e?d.AmPm[2]:d.AmPm[3],B:"?",g:e%12||12,G:e,h:a(e%12||12),H:a(e),i:a(f),s:a(k),u:n,e:"?",I:"?",O:(0<l?"-":"+")+a(100*Math.floor(Math.abs(l)/60)+Math.abs(l)%60,4),P:"?",T:(String(h).match(/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g)||
|
||||
[""]).pop().replace(/[^-+\dA-Z]/g,""),Z:"?",c:"?",r:"?",U:Math.floor(h/1E3)};return c.replace(/\\.|[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/g,function(a){return G.hasOwnProperty(a)?G[a]:a.substring(1)})},jqID:function(b){return String(b).replace(/[!"#$%&'()*+,.\/:; <=>?@\[\\\]\^`{|}~]/g,"\\$&")},guid:1,uidPref:"jqg",randId:function(e){return(e||b.jgrid.uidPref)+b.jgrid.guid++},getAccessor:function(b,f){var c,d,a=[],l;if("function"===typeof f)return f(b);c=b[f];if(void 0===c)try{if("string"===typeof f&&
|
||||
(a=f.split(".")),l=a.length)for(c=b;c&&l--;)d=a.shift(),c=c[d]}catch(g){}return c},getXmlData:function(e,f,c){var d="string"===typeof f?f.match(/^(.*)\[(\w+)\]$/):null;if("function"===typeof f)return f(e);if(d&&d[2])return d[1]?b(d[1],e).attr(d[2]):b(e).attr(d[2]);e=b(f,e);return c?e:0<e.length?b(e).text():void 0},cellWidth:function(){var e=b("<div class='ui-jqgrid' style='left:10000px'><table class='ui-jqgrid-btable' style='width:5px;'><tr class='jqgrow'><td style='width:5px;display:block;'></td></tr></table></div>"),
|
||||
f=e.appendTo("body").find("td").width();e.remove();return 0.1<Math.abs(f-5)},cell_width:!0,ajaxOptions:{},from:function(e){return new function(e,c){"string"===typeof e&&(e=b.data(e));var d=this,a=e,l=!0,g=!1,h=c,k=/[\$,%]/g,n=null,m=null,r=0,p=!1,q="",x=[],G=!0;if("object"===typeof e&&e.push)0<e.length&&(G="object"!==typeof e[0]?!1:!0);else throw"data provides is not an array";this._hasData=function(){return null===a?!1:0===a.length?!1:!0};this._getStr=function(a){var b=[];g&&b.push("jQuery.trim(");
|
||||
b.push("String("+a+")");g&&b.push(")");l||b.push(".toLowerCase()");return b.join("")};this._strComp=function(a){return"string"===typeof a?".toString()":""};this._group=function(a,b){return{field:a.toString(),unique:b,items:[]}};this._toStr=function(a){g&&(a=b.trim(a));a=a.toString().replace(/\\/g,"\\\\").replace(/\"/g,'\\"');return l?a:a.toLowerCase()};this._funcLoop=function(d){var l=[];b.each(a,function(a,b){l.push(d(b))});return l};this._append=function(a){var b;h=null===h?"":h+(""===q?" && ":
|
||||
q);for(b=0;b<r;b++)h+="(";p&&(h+="!");h+="("+a+")";p=!1;q="";r=0};this._setCommand=function(a,b){n=a;m=b};this._resetNegate=function(){p=!1};this._repeatCommand=function(a,b){return null===n?d:null!==a&&null!==b?n(a,b):null!==m&&G?n(m,a):n(a)};this._equals=function(a,b){return 0===d._compare(a,b,1)};this._compare=function(a,b,d){var e=Object.prototype.toString;void 0===d&&(d=1);void 0===a&&(a=null);void 0===b&&(b=null);if(null===a&&null===b)return 0;if(null===a&&null!==b)return 1;if(null!==a&&null===
|
||||
b)return-1;if("[object Date]"===e.call(a)&&"[object Date]"===e.call(b))return a<b?-d:a>b?d:0;l||"number"===typeof a||"number"===typeof b||(a=String(a),b=String(b));return a<b?-d:a>b?d:0};this._performSort=function(){0!==x.length&&(a=d._doSort(a,0))};this._doSort=function(a,b){var l=x[b].by,e=x[b].dir,g=x[b].type,c=x[b].datefmt,f=x[b].sfunc;if(b===x.length-1)return d._getOrder(a,l,e,g,c,f);b++;l=d._getGroup(a,l,e,g,c);e=[];for(g=0;g<l.length;g++)for(f=d._doSort(l[g].items,b),c=0;c<f.length;c++)e.push(f[c]);
|
||||
return e};this._getOrder=function(a,e,g,c,f,h){var m=[],n=[],r="a"===g?1:-1,p,x;void 0===c&&(c="text");x="float"===c||"number"===c||"currency"===c||"numeric"===c?function(a){a=parseFloat(String(a).replace(k,""));return isNaN(a)?0:a}:"int"===c||"integer"===c?function(a){return a?parseFloat(String(a).replace(k,"")):0}:"date"===c||"datetime"===c?function(a){return b.jgrid.parseDate(f,a).getTime()}:b.isFunction(c)?c:function(a){a=a?b.trim(String(a)):"";return l?a:a.toLowerCase()};b.each(a,function(a,
|
||||
d){p=""!==e?b.jgrid.getAccessor(d,e):d;void 0===p&&(p="");p=x(p,d);n.push({vSort:p,index:a})});b.isFunction(h)?n.sort(function(a,b){a=a.vSort;b=b.vSort;return h.call(this,a,b,r)}):n.sort(function(a,b){a=a.vSort;b=b.vSort;return d._compare(a,b,r)});c=0;for(var q=a.length;c<q;)g=n[c].index,m.push(a[g]),c++;return m};this._getGroup=function(a,c,e,l,g){var f=[],h=null,k=null,m;b.each(d._getOrder(a,c,e,l,g),function(a,e){m=b.jgrid.getAccessor(e,c);null==m&&(m="");d._equals(k,m)||(k=m,null!==h&&f.push(h),
|
||||
h=d._group(c,m));h.items.push(e)});null!==h&&f.push(h);return f};this.ignoreCase=function(){l=!1;return d};this.useCase=function(){l=!0;return d};this.trim=function(){g=!0;return d};this.noTrim=function(){g=!1;return d};this.execute=function(){var c=h,e=[];if(null===c)return d;b.each(a,function(){eval(c)&&e.push(this)});a=e;return d};this.data=function(){return a};this.select=function(c){d._performSort();if(!d._hasData())return[];d.execute();if(b.isFunction(c)){var e=[];b.each(a,function(a,b){e.push(c(b))});
|
||||
return e}return a};this.hasMatch=function(){if(!d._hasData())return!1;d.execute();return 0<a.length};this.andNot=function(a,b,c){p=!p;return d.and(a,b,c)};this.orNot=function(a,b,c){p=!p;return d.or(a,b,c)};this.not=function(a,b,c){return d.andNot(a,b,c)};this.and=function(a,b,c){q=" && ";return void 0===a?d:d._repeatCommand(a,b,c)};this.or=function(a,b,c){q=" || ";return void 0===a?d:d._repeatCommand(a,b,c)};this.orBegin=function(){r++;return d};this.orEnd=function(){null!==h&&(h+=")");return d};
|
||||
this.isNot=function(a){p=!p;return d.is(a)};this.is=function(a){d._append("this."+a);d._resetNegate();return d};this._compareValues=function(a,c,e,l,g){var f;f=G?"jQuery.jgrid.getAccessor(this,'"+c+"')":"this";void 0===e&&(e=null);var h=e,m=void 0===g.stype?"text":g.stype;if(null!==e)switch(m){case "int":case "integer":h=isNaN(Number(h))||""===h?"0":h;f="parseInt("+f+",10)";h="parseInt("+h+",10)";break;case "float":case "number":case "numeric":h=String(h).replace(k,"");h=isNaN(Number(h))||""===h?
|
||||
"0":h;f="parseFloat("+f+")";h="parseFloat("+h+")";break;case "date":case "datetime":h=String(b.jgrid.parseDate(g.newfmt||"Y-m-d",h).getTime());f='jQuery.jgrid.parseDate("'+g.srcfmt+'",'+f+").getTime()";break;default:f=d._getStr(f),h=d._getStr('"'+d._toStr(h)+'"')}d._append(f+" "+l+" "+h);d._setCommand(a,c);d._resetNegate();return d};this.equals=function(a,b,c){return d._compareValues(d.equals,a,b,"==",c)};this.notEquals=function(a,b,c){return d._compareValues(d.equals,a,b,"!==",c)};this.isNull=function(a,
|
||||
b,c){return d._compareValues(d.equals,a,null,"===",c)};this.greater=function(a,b,c){return d._compareValues(d.greater,a,b,">",c)};this.less=function(a,b,c){return d._compareValues(d.less,a,b,"<",c)};this.greaterOrEquals=function(a,b,c){return d._compareValues(d.greaterOrEquals,a,b,">=",c)};this.lessOrEquals=function(a,b,c){return d._compareValues(d.lessOrEquals,a,b,"<=",c)};this.startsWith=function(a,c){var e=null==c?a:c,e=g?b.trim(e.toString()).length:e.toString().length;G?d._append(d._getStr("jQuery.jgrid.getAccessor(this,'"+
|
||||
a+"')")+".substr(0,"+e+") == "+d._getStr('"'+d._toStr(c)+'"')):(null!=c&&(e=g?b.trim(c.toString()).length:c.toString().length),d._append(d._getStr("this")+".substr(0,"+e+") == "+d._getStr('"'+d._toStr(a)+'"')));d._setCommand(d.startsWith,a);d._resetNegate();return d};this.endsWith=function(a,c){var e=null==c?a:c,e=g?b.trim(e.toString()).length:e.toString().length;G?d._append(d._getStr("jQuery.jgrid.getAccessor(this,'"+a+"')")+".substr("+d._getStr("jQuery.jgrid.getAccessor(this,'"+a+"')")+".length-"+
|
||||
e+","+e+') == "'+d._toStr(c)+'"'):d._append(d._getStr("this")+".substr("+d._getStr("this")+'.length-"'+d._toStr(a)+'".length,"'+d._toStr(a)+'".length) == "'+d._toStr(a)+'"');d._setCommand(d.endsWith,a);d._resetNegate();return d};this.contains=function(a,b){G?d._append(d._getStr("jQuery.jgrid.getAccessor(this,'"+a+"')")+'.indexOf("'+d._toStr(b)+'",0) > -1'):d._append(d._getStr("this")+'.indexOf("'+d._toStr(a)+'",0) > -1');d._setCommand(d.contains,a);d._resetNegate();return d};this.groupBy=function(b,
|
||||
c,e,l){return d._hasData()?d._getGroup(a,b,c,e,l):null};this.orderBy=function(a,c,e,l,g){c=null==c?"a":b.trim(c.toString().toLowerCase());null==e&&(e="text");null==l&&(l="Y-m-d");null==g&&(g=!1);if("desc"===c||"descending"===c)c="d";if("asc"===c||"ascending"===c)c="a";x.push({by:a,dir:c,type:e,datefmt:l,sfunc:g});return d};return d}(e,null)},getMethod:function(e){return this.getAccessor(b.fn.jqGrid,e)},extend:function(e){b.extend(b.fn.jqGrid,e);this.no_legacy_api||b.fn.extend(e)}});b.fn.jqGrid=function(e){if("string"===
|
||||
typeof e){var f=b.jgrid.getMethod(e);if(!f)throw"jqGrid - No such method: "+e;var c=b.makeArray(arguments).slice(1);return f.apply(this,c)}return this.each(function(){if(!this.grid){var d=b.extend(!0,{url:"",height:150,page:1,rowNum:20,rowTotal:null,records:0,pager:"",pgbuttons:!0,pginput:!0,colModel:[],rowList:[],colNames:[],sortorder:"asc",sortname:"",datatype:"xml",mtype:"GET",altRows:!1,selarrrow:[],savedRow:[],shrinkToFit:!0,xmlReader:{},jsonReader:{},subGrid:!1,subGridModel:[],reccount:0,lastpage:0,
|
||||
lastsort:0,selrow:null,beforeSelectRow:null,onSelectRow:null,onSortCol:null,ondblClickRow:null,onRightClickRow:null,onPaging:null,onSelectAll:null,onInitGrid:null,loadComplete:null,gridComplete:null,loadError:null,loadBeforeSend:null,afterInsertRow:null,beforeRequest:null,beforeProcessing:null,onHeaderClick:null,viewrecords:!1,loadonce:!1,multiselect:!1,multikey:!1,editurl:null,search:!1,caption:"",hidegrid:!0,hiddengrid:!1,postData:{},userData:{},treeGrid:!1,treeGridModel:"nested",treeReader:{},
|
||||
treeANode:-1,ExpandColumn:null,tree_root_level:0,prmNames:{page:"page",rows:"rows",sort:"sidx",order:"sord",search:"_search",nd:"nd",id:"id",oper:"oper",editoper:"edit",addoper:"add",deloper:"del",subgridid:"id",npage:null,totalrows:"totalrows"},forceFit:!1,gridstate:"visible",cellEdit:!1,cellsubmit:"remote",nv:0,loadui:"enable",toolbar:[!1,""],scroll:!1,multiboxonly:!1,deselectAfterSort:!0,scrollrows:!1,autowidth:!1,scrollOffset:18,cellLayout:5,subGridWidth:20,multiselectWidth:20,gridview:!1,rownumWidth:25,
|
||||
rownumbers:!1,pagerpos:"center",recordpos:"right",footerrow:!1,userDataOnFooter:!1,hoverrows:!0,altclass:"ui-priority-secondary",viewsortcols:[!1,"vertical",!0],resizeclass:"",autoencode:!1,remapColumns:[],ajaxGridOptions:{},direction:"ltr",toppager:!1,headertitles:!1,scrollTimeout:40,data:[],_index:{},grouping:!1,groupingView:{groupField:[],groupOrder:[],groupText:[],groupColumnShow:[],groupSummary:[],showSummaryOnHide:!1,sortitems:[],sortnames:[],summary:[],summaryval:[],plusicon:"ui-icon-circlesmall-plus",
|
||||
minusicon:"ui-icon-circlesmall-minus",displayField:[],groupSummaryPos:[],formatDisplayField:[],_locgr:!1},ignoreCase:!1,cmTemplate:{},idPrefix:"",multiSort:!1},b.jgrid.defaults,e||{}),a=this,c={headers:[],cols:[],footers:[],dragStart:function(c,e,g){var f=b(this.bDiv).offset().left;this.resizing={idx:c,startX:e.clientX,sOL:e.clientX-f};this.hDiv.style.cursor="col-resize";this.curGbox=b("#rs_m"+b.jgrid.jqID(d.id),"#gbox_"+b.jgrid.jqID(d.id));this.curGbox.css({display:"block",left:e.clientX-f,top:g[1],
|
||||
height:g[2]});b(a).triggerHandler("jqGridResizeStart",[e,c]);b.isFunction(d.resizeStart)&&d.resizeStart.call(a,e,c);document.onselectstart=function(){return!1}},dragMove:function(a){if(this.resizing){var b=a.clientX-this.resizing.startX;a=this.headers[this.resizing.idx];var c="ltr"===d.direction?a.width+b:a.width-b,e;33<c&&(this.curGbox.css({left:this.resizing.sOL+b}),!0===d.forceFit?(e=this.headers[this.resizing.idx+d.nv],b="ltr"===d.direction?e.width-b:e.width+b,33<b&&(a.newWidth=c,e.newWidth=b)):
|
||||
(this.newWidth="ltr"===d.direction?d.tblwidth+b:d.tblwidth-b,a.newWidth=c))}},dragEnd:function(){this.hDiv.style.cursor="default";if(this.resizing){var c=this.resizing.idx,e=this.headers[c].newWidth||this.headers[c].width,e=parseInt(e,10);this.resizing=!1;b("#rs_m"+b.jgrid.jqID(d.id)).css("display","none");d.colModel[c].width=e;this.headers[c].width=e;this.headers[c].el.style.width=e+"px";this.cols[c].style.width=e+"px";0<this.footers.length&&(this.footers[c].style.width=e+"px");!0===d.forceFit?(e=
|
||||
this.headers[c+d.nv].newWidth||this.headers[c+d.nv].width,this.headers[c+d.nv].width=e,this.headers[c+d.nv].el.style.width=e+"px",this.cols[c+d.nv].style.width=e+"px",0<this.footers.length&&(this.footers[c+d.nv].style.width=e+"px"),d.colModel[c+d.nv].width=e):(d.tblwidth=this.newWidth||d.tblwidth,b("table:first",this.bDiv).css("width",d.tblwidth+"px"),b("table:first",this.hDiv).css("width",d.tblwidth+"px"),this.hDiv.scrollLeft=this.bDiv.scrollLeft,d.footerrow&&(b("table:first",this.sDiv).css("width",
|
||||
d.tblwidth+"px"),this.sDiv.scrollLeft=this.bDiv.scrollLeft));b(a).triggerHandler("jqGridResizeStop",[e,c]);b.isFunction(d.resizeStop)&&d.resizeStop.call(a,e,c)}this.curGbox=null;document.onselectstart=function(){return!0}},populateVisible:function(){c.timer&&clearTimeout(c.timer);c.timer=null;var a=b(c.bDiv).height();if(a){var e=b("table:first",c.bDiv),g,f;if(e[0].rows.length)try{f=(g=e[0].rows[1])?b(g).outerHeight()||c.prevRowHeight:c.prevRowHeight}catch(pa){f=c.prevRowHeight}if(f){c.prevRowHeight=
|
||||
f;var h=d.rowNum;g=c.scrollTop=c.bDiv.scrollTop;var k=Math.round(e.position().top)-g,m=k+e.height();f*=h;var E,n,C;m<a&&0>=k&&(void 0===d.lastpage||parseInt((m+g+f-1)/f,10)<=d.lastpage)&&(n=parseInt((a-m+f-1)/f,10),0<=m||2>n||!0===d.scroll?(E=Math.round((m+g)/f)+1,k=-1):k=1);0<k&&(E=parseInt(g/f,10)+1,n=parseInt((g+a)/f,10)+2-E,C=!0);!n||d.lastpage&&(E>d.lastpage||1===d.lastpage||E===d.page&&E===d.lastpage)||(c.hDiv.loading?c.timer=setTimeout(c.populateVisible,d.scrollTimeout):(d.page=E,C&&(c.selectionPreserver(e[0]),
|
||||
c.emptyRows.call(e[0],!1,!1)),c.populate(n)))}}},scrollGrid:function(a){if(d.scroll){var b=c.bDiv.scrollTop;void 0===c.scrollTop&&(c.scrollTop=0);b!==c.scrollTop&&(c.scrollTop=b,c.timer&&clearTimeout(c.timer),c.timer=setTimeout(c.populateVisible,d.scrollTimeout))}c.hDiv.scrollLeft=c.bDiv.scrollLeft;d.footerrow&&(c.sDiv.scrollLeft=c.bDiv.scrollLeft);a&&a.stopPropagation()},selectionPreserver:function(a){var c=a.p,d=c.selrow,e=c.selarrrow?b.makeArray(c.selarrrow):null,f=a.grid.bDiv.scrollLeft,g=function(){var h;
|
||||
c.selrow=null;c.selarrrow=[];if(c.multiselect&&e&&0<e.length)for(h=0;h<e.length;h++)e[h]!==d&&b(a).jqGrid("setSelection",e[h],!1,null);d&&b(a).jqGrid("setSelection",d,!1,null);a.grid.bDiv.scrollLeft=f;b(a).unbind(".selectionPreserver",g)};b(a).bind("jqGridGridComplete.selectionPreserver",g)}};if("TABLE"!==this.tagName.toUpperCase())alert("Element is not a table");else if(void 0!==document.documentMode&&5>=document.documentMode)alert("Grid can not be used in this ('quirks') mode!");else{b(this).empty().attr("tabindex",
|
||||
"0");this.p=d;this.p.useProp=!!b.fn.prop;var g,f;if(0===this.p.colNames.length)for(g=0;g<this.p.colModel.length;g++)this.p.colNames[g]=this.p.colModel[g].label||this.p.colModel[g].name;if(this.p.colNames.length!==this.p.colModel.length)alert(b.jgrid.errors.model);else{var k=b("<div class='ui-jqgrid-view'></div>"),n=b.jgrid.msie;a.p.direction=b.trim(a.p.direction.toLowerCase());-1===b.inArray(a.p.direction,["ltr","rtl"])&&(a.p.direction="ltr");f=a.p.direction;b(k).insertBefore(this);b(this).removeClass("scroll").appendTo(k);
|
||||
var m=b("<div class='ui-jqgrid ui-widget ui-widget-content ui-corner-all'></div>");b(m).attr({id:"gbox_"+this.id,dir:f}).insertBefore(k);b(k).attr("id","gview_"+this.id).appendTo(m);b("<div class='ui-widget-overlay jqgrid-overlay' id='lui_"+this.id+"'></div>").insertBefore(k);b("<div class='loading ui-state-default ui-state-active' id='load_"+this.id+"'>"+this.p.loadtext+"</div>").insertBefore(k);b(this).attr({cellspacing:"0",cellpadding:"0",border:"0",role:"grid","aria-multiselectable":!!this.p.multiselect,
|
||||
"aria-labelledby":"gbox_"+this.id});var r=function(a,b){a=parseInt(a,10);return isNaN(a)?b||0:a},p=function(d,e,f,g,pa,h){var k=a.p.colModel[d],m=k.align,E='style="',n=k.classes,C=k.name,A=[];m&&(E+="text-align:"+m+";");!0===k.hidden&&(E+="display:none;");if(0===e)E+="width: "+c.headers[d].width+"px;";else if(k.cellattr&&b.isFunction(k.cellattr)&&(d=k.cellattr.call(a,pa,f,g,k,h))&&"string"===typeof d)if(d=d.replace(/style/i,"style").replace(/title/i,"title"),-1<d.indexOf("title")&&(k.title=!1),-1<
|
||||
d.indexOf("class")&&(n=void 0),A=d.replace("-style","-sti").split(/style/),2===A.length){A[1]=b.trim(A[1].replace("-sti","-style").replace("=",""));if(0===A[1].indexOf("'")||0===A[1].indexOf('"'))A[1]=A[1].substring(1);E+=A[1].replace(/'/gi,'"')}else E+='"';A.length||(A[0]="",E+='"');E+=(void 0!==n?' class="'+n+'"':"")+(k.title&&f?' title="'+b.jgrid.stripHtml(f)+'"':"");E+=' aria-describedby="'+a.p.id+"_"+C+'"';return E+A[0]},q=function(c){return null==c||""===c?" ":a.p.autoencode?b.jgrid.htmlEncode(c):
|
||||
String(c)},x=function(c,d,e,f,g){var h=a.p.colModel[e];void 0!==h.formatter?(c=""!==String(a.p.idPrefix)?b.jgrid.stripPref(a.p.idPrefix,c):c,c={rowId:c,colModel:h,gid:a.p.id,pos:e},d=b.isFunction(h.formatter)?h.formatter.call(a,d,c,f,g):b.fmatter?b.fn.fmatter.call(a,h.formatter,d,c,f,g):q(d)):d=q(d);return d},G=function(a,b,c,d,e,f){b=x(a,b,c,e,"add");return'<td role="gridcell" '+p(c,d,b,e,a,f)+">"+b+"</td>"},U=function(b,c,d,e){e='<input role="checkbox" type="checkbox" id="jqg_'+a.p.id+"_"+b+'" class="cbox" name="jqg_'+
|
||||
a.p.id+"_"+b+'"'+(e?'checked="checked"':"")+"/>";return'<td role="gridcell" '+p(c,d,"",null,b,!0)+">"+e+"</td>"},M=function(a,b,c,d){c=(parseInt(c,10)-1)*parseInt(d,10)+1+b;return'<td role="gridcell" class="ui-state-default jqgrid-rownum" '+p(a,b,c,null,b,!0)+">"+c+"</td>"},ea=function(b){var c,d=[],e=0,f;for(f=0;f<a.p.colModel.length;f++)c=a.p.colModel[f],"cb"!==c.name&&"subgrid"!==c.name&&"rn"!==c.name&&(d[e]="local"===b?c.name:"xml"===b||"xmlstring"===b?c.xmlmap||c.name:c.jsonmap||c.name,!1!==
|
||||
a.p.keyIndex&&!0===c.key&&(a.p.keyName=d[e]),e++);return d},W=function(c){var d=a.p.remapColumns;d&&d.length||(d=b.map(a.p.colModel,function(a,b){return b}));c&&(d=b.map(d,function(a){return a<c?null:a-c}));return d},X=function(a,c){var d;this.p.deepempty?b(this.rows).slice(1).remove():(d=0<this.rows.length?this.rows[0]:null,b(this.firstChild).empty().append(d));a&&this.p.scroll&&(b(this.grid.bDiv.firstChild).css({height:"auto"}),b(this.grid.bDiv.firstChild.firstChild).css({height:0,display:"none"}),
|
||||
0!==this.grid.bDiv.scrollTop&&(this.grid.bDiv.scrollTop=0));!0===c&&this.p.treeGrid&&(this.p.data=[],this.p._index={})},O=function(){var c=a.p.data.length,d,e,f;d=!0===a.p.rownumbers?1:0;e=!0===a.p.multiselect?1:0;f=!0===a.p.subGrid?1:0;d=!1===a.p.keyIndex||!0===a.p.loadonce?a.p.localReader.id:a.p.colModel[a.p.keyIndex+e+f+d].name;for(e=0;e<c;e++)f=b.jgrid.getAccessor(a.p.data[e],d),void 0===f&&(f=String(e+1)),a.p._index[f]=e},$=function(c,d,e,f,g,h){var l="-1",k="",m;d=d?"display:none;":"";e="ui-widget-content jqgrow ui-row-"+
|
||||
a.p.direction+(e?" "+e:"")+(h?" ui-state-highlight":"");h=b(a).triggerHandler("jqGridRowAttr",[f,g,c]);"object"!==typeof h&&(h=b.isFunction(a.p.rowattr)?a.p.rowattr.call(a,f,g,c):{});if(!b.isEmptyObject(h)){h.hasOwnProperty("id")&&(c=h.id,delete h.id);h.hasOwnProperty("tabindex")&&(l=h.tabindex,delete h.tabindex);h.hasOwnProperty("style")&&(d+=h.style,delete h.style);h.hasOwnProperty("class")&&(e+=" "+h["class"],delete h["class"]);try{delete h.role}catch(n){}for(m in h)h.hasOwnProperty(m)&&(k+=" "+
|
||||
m+"="+h[m])}return'<tr role="row" id="'+c+'" tabindex="'+l+'" class="'+e+'"'+(""===d?"":' style="'+d+'"')+k+">"},K=function(c,d,e,f,g){var h=new Date,l="local"!==a.p.datatype&&a.p.loadonce||"xmlstring"===a.p.datatype,k=a.p.xmlReader,m="local"===a.p.datatype?"local":"xml";l&&(a.p.data=[],a.p._index={},a.p.localReader.id="_id_");a.p.reccount=0;if(b.isXMLDoc(c)){-1!==a.p.treeANode||a.p.scroll?e=1<e?e:1:(X.call(a,!1,!0),e=1);var n=b(a),C,A,R=0,p,u=!0===a.p.multiselect?1:0,z=0,x,q=!0===a.p.rownumbers?
|
||||
1:0,t,Z=[],aa,v={},w,H,s=[],L=!0===a.p.altRows?a.p.altclass:"",ia;!0===a.p.subGrid&&(z=1,x=b.jgrid.getMethod("addSubGridCell"));k.repeatitems||(Z=ea(m));t=!1===a.p.keyIndex?b.isFunction(k.id)?k.id.call(a,c):k.id:a.p.keyIndex;0<Z.length&&!isNaN(t)&&(t=a.p.keyName);m=-1===String(t).indexOf("[")?Z.length?function(a,c){return b(t,a).text()||c}:function(a,c){return b(k.cell,a).eq(t).text()||c}:function(a,b){return a.getAttribute(t.replace(/[\[\]]/g,""))||b};a.p.userData={};a.p.page=r(b.jgrid.getXmlData(c,
|
||||
k.page),a.p.page);a.p.lastpage=r(b.jgrid.getXmlData(c,k.total),1);a.p.records=r(b.jgrid.getXmlData(c,k.records));b.isFunction(k.userdata)?a.p.userData=k.userdata.call(a,c)||{}:b.jgrid.getXmlData(c,k.userdata,!0).each(function(){a.p.userData[this.getAttribute("name")]=b(this).text()});c=b.jgrid.getXmlData(c,k.root,!0);(c=b.jgrid.getXmlData(c,k.row,!0))||(c=[]);var S=c.length,I=0,y=[],D=parseInt(a.p.rowNum,10),B=a.p.scroll?b.jgrid.randId():1;0<S&&0>=a.p.page&&(a.p.page=1);if(c&&S){g&&(D*=g+1);g=b.isFunction(a.p.afterInsertRow);
|
||||
var F=!1,J;a.p.grouping&&(F=!0===a.p.groupingView.groupCollapse,J=b.jgrid.getMethod("groupingPrepare"));for(;I<S;){w=c[I];H=m(w,B+I);H=a.p.idPrefix+H;C=0===e?0:e+1;ia=1===(C+I)%2?L:"";var K=s.length;s.push("");q&&s.push(M(0,I,a.p.page,a.p.rowNum));u&&s.push(U(H,q,I,!1));z&&s.push(x.call(n,u+q,I+e));if(k.repeatitems){aa||(aa=W(u+z+q));var N=b.jgrid.getXmlData(w,k.cell,!0);b.each(aa,function(b){var c=N[this];if(!c)return!1;p=c.textContent||c.text;v[a.p.colModel[b+u+z+q].name]=p;s.push(G(H,p,b+u+z+q,
|
||||
I+e,w,v))})}else for(C=0;C<Z.length;C++)p=b.jgrid.getXmlData(w,Z[C]),v[a.p.colModel[C+u+z+q].name]=p,s.push(G(H,p,C+u+z+q,I+e,w,v));s[K]=$(H,F,ia,v,w,!1);s.push("</tr>");a.p.grouping&&(y.push(s),a.p.groupingView._locgr||J.call(n,v,I),s=[]);if(l||!0===a.p.treeGrid)v._id_=b.jgrid.stripPref(a.p.idPrefix,H),a.p.data.push(v),a.p._index[v._id_]=a.p.data.length-1;!1===a.p.gridview&&(b("tbody:first",d).append(s.join("")),n.triggerHandler("jqGridAfterInsertRow",[H,v,w]),g&&a.p.afterInsertRow.call(a,H,v,w),
|
||||
s=[]);v={};R++;I++;if(R===D)break}}!0===a.p.gridview&&(A=-1<a.p.treeANode?a.p.treeANode:0,a.p.grouping?(l||n.jqGrid("groupingRender",y,a.p.colModel.length,a.p.page,D),y=null):!0===a.p.treeGrid&&0<A?b(a.rows[A]).after(s.join("")):b("tbody:first",d).append(s.join("")));if(!0===a.p.subGrid)try{n.jqGrid("addSubGrid",u+q)}catch(Q){}a.p.totaltime=new Date-h;0<R&&0===a.p.records&&(a.p.records=S);s=null;if(!0===a.p.treeGrid)try{n.jqGrid("setTreeNode",A+1,R+A+1)}catch(O){}a.p.treeGrid||a.p.scroll||(a.grid.bDiv.scrollTop=
|
||||
0);a.p.reccount=R;a.p.treeANode=-1;a.p.userDataOnFooter&&n.jqGrid("footerData","set",a.p.userData,!0);l&&(a.p.records=S,a.p.lastpage=Math.ceil(S/D));f||a.updatepager(!1,!0);if(l){for(;R<S;){w=c[R];H=m(w,R+B);H=a.p.idPrefix+H;if(k.repeatitems){aa||(aa=W(u+z+q));var P=b.jgrid.getXmlData(w,k.cell,!0);b.each(aa,function(b){var c=P[this];if(!c)return!1;p=c.textContent||c.text;v[a.p.colModel[b+u+z+q].name]=p})}else for(C=0;C<Z.length;C++)p=b.jgrid.getXmlData(w,Z[C]),v[a.p.colModel[C+u+z+q].name]=p;v._id_=
|
||||
b.jgrid.stripPref(a.p.idPrefix,H);a.p.grouping&&J.call(n,v,R);a.p.data.push(v);a.p._index[v._id_]=a.p.data.length-1;v={};R++}a.p.grouping&&(a.p.groupingView._locgr=!0,n.jqGrid("groupingRender",y,a.p.colModel.length,a.p.page,D),y=null)}}},Y=function(c,d,e,f,g){var h=new Date;if(c){-1!==a.p.treeANode||a.p.scroll?e=1<e?e:1:(X.call(a,!1,!0),e=1);var k,l="local"!==a.p.datatype&&a.p.loadonce||"jsonstring"===a.p.datatype;l&&(a.p.data=[],a.p._index={},a.p.localReader.id="_id_");a.p.reccount=0;"local"===a.p.datatype?
|
||||
(d=a.p.localReader,k="local"):(d=a.p.jsonReader,k="json");var m=b(a),n=0,C,A,p,q=[],u=a.p.multiselect?1:0,z=!0===a.p.subGrid?1:0,x,t=!0===a.p.rownumbers?1:0,D=W(u+z+t);k=ea(k);var y,B,v,w={},H,s,L=[],ia=!0===a.p.altRows?a.p.altclass:"",S;a.p.page=r(b.jgrid.getAccessor(c,d.page),a.p.page);a.p.lastpage=r(b.jgrid.getAccessor(c,d.total),1);a.p.records=r(b.jgrid.getAccessor(c,d.records));a.p.userData=b.jgrid.getAccessor(c,d.userdata)||{};z&&(x=b.jgrid.getMethod("addSubGridCell"));v=!1===a.p.keyIndex?b.isFunction(d.id)?
|
||||
d.id.call(a,c):d.id:a.p.keyIndex;d.repeatitems||(q=k,0<q.length&&!isNaN(v)&&(v=a.p.keyName));B=b.jgrid.getAccessor(c,d.root);null==B&&b.isArray(c)&&(B=c);B||(B=[]);c=B.length;A=0;0<c&&0>=a.p.page&&(a.p.page=1);var I=parseInt(a.p.rowNum,10),F=a.p.scroll?b.jgrid.randId():1,J=!1,K;g&&(I*=g+1);"local"!==a.p.datatype||a.p.deselectAfterSort||(J=!0);var N=b.isFunction(a.p.afterInsertRow),P=[],Q=!1,O;a.p.grouping&&(Q=!0===a.p.groupingView.groupCollapse,O=b.jgrid.getMethod("groupingPrepare"));for(;A<c;){g=
|
||||
B[A];s=b.jgrid.getAccessor(g,v);void 0===s&&("number"===typeof v&&null!=a.p.colModel[v+u+z+t]&&(s=b.jgrid.getAccessor(g,a.p.colModel[v+u+z+t].name)),void 0===s&&(s=F+A,0===q.length&&d.cell&&(C=b.jgrid.getAccessor(g,d.cell)||g,s=null!=C&&void 0!==C[v]?C[v]:s)));s=a.p.idPrefix+s;C=1===e?0:e;S=1===(C+A)%2?ia:"";J&&(K=a.p.multiselect?-1!==b.inArray(s,a.p.selarrrow):s===a.p.selrow);var T=L.length;L.push("");t&&L.push(M(0,A,a.p.page,a.p.rowNum));u&&L.push(U(s,t,A,K));z&&L.push(x.call(m,u+t,A+e));y=k;d.repeatitems&&
|
||||
(d.cell&&(g=b.jgrid.getAccessor(g,d.cell)||g),b.isArray(g)&&(y=D));for(p=0;p<y.length;p++)C=b.jgrid.getAccessor(g,y[p]),w[a.p.colModel[p+u+z+t].name]=C,L.push(G(s,C,p+u+z+t,A+e,g,w));L[T]=$(s,Q,S,w,g,K);L.push("</tr>");a.p.grouping&&(P.push(L),a.p.groupingView._locgr||O.call(m,w,A),L=[]);if(l||!0===a.p.treeGrid)w._id_=b.jgrid.stripPref(a.p.idPrefix,s),a.p.data.push(w),a.p._index[w._id_]=a.p.data.length-1;!1===a.p.gridview&&(b("#"+b.jgrid.jqID(a.p.id)+" tbody:first").append(L.join("")),m.triggerHandler("jqGridAfterInsertRow",
|
||||
[s,w,g]),N&&a.p.afterInsertRow.call(a,s,w,g),L=[]);w={};n++;A++;if(n===I)break}!0===a.p.gridview&&(H=-1<a.p.treeANode?a.p.treeANode:0,a.p.grouping?l||(m.jqGrid("groupingRender",P,a.p.colModel.length,a.p.page,I),P=null):!0===a.p.treeGrid&&0<H?b(a.rows[H]).after(L.join("")):b("#"+b.jgrid.jqID(a.p.id)+" tbody:first").append(L.join("")));if(!0===a.p.subGrid)try{m.jqGrid("addSubGrid",u+t)}catch(V){}a.p.totaltime=new Date-h;0<n&&0===a.p.records&&(a.p.records=c);if(!0===a.p.treeGrid)try{m.jqGrid("setTreeNode",
|
||||
H+1,n+H+1)}catch(Y){}a.p.treeGrid||a.p.scroll||(a.grid.bDiv.scrollTop=0);a.p.reccount=n;a.p.treeANode=-1;a.p.userDataOnFooter&&m.jqGrid("footerData","set",a.p.userData,!0);l&&(a.p.records=c,a.p.lastpage=Math.ceil(c/I));f||a.updatepager(!1,!0);if(l){for(;n<c&&B[n];){g=B[n];s=b.jgrid.getAccessor(g,v);void 0===s&&("number"===typeof v&&null!=a.p.colModel[v+u+z+t]&&(s=b.jgrid.getAccessor(g,a.p.colModel[v+u+z+t].name)),void 0===s&&(s=F+n,0===q.length&&d.cell&&(e=b.jgrid.getAccessor(g,d.cell)||g,s=null!=
|
||||
e&&void 0!==e[v]?e[v]:s)));if(g){s=a.p.idPrefix+s;y=k;d.repeatitems&&(d.cell&&(g=b.jgrid.getAccessor(g,d.cell)||g),b.isArray(g)&&(y=D));for(p=0;p<y.length;p++)w[a.p.colModel[p+u+z+t].name]=b.jgrid.getAccessor(g,y[p]);w._id_=b.jgrid.stripPref(a.p.idPrefix,s);a.p.grouping&&O.call(m,w,n);a.p.data.push(w);a.p._index[w._id_]=a.p.data.length-1;w={}}n++}a.p.grouping&&(a.p.groupingView._locgr=!0,m.jqGrid("groupingRender",P,a.p.colModel.length,a.p.page,I))}}},oa=function(){function c(a){var b=0,d,e,g,h,k;
|
||||
if(null!=a.groups){(e=a.groups.length&&"OR"===a.groupOp.toString().toUpperCase())&&u.orBegin();for(d=0;d<a.groups.length;d++){0<b&&e&&u.or();try{c(a.groups[d])}catch(l){alert(l)}b++}e&&u.orEnd()}if(null!=a.rules)try{(g=a.rules.length&&"OR"===a.groupOp.toString().toUpperCase())&&u.orBegin();for(d=0;d<a.rules.length;d++)k=a.rules[d],h=a.groupOp.toString().toUpperCase(),q[k.op]&&k.field&&(0<b&&h&&"OR"===h&&(u=u.or()),u=q[k.op](u,h)(k.field,k.data,f[k.field])),b++;g&&u.orEnd()}catch(m){alert(m)}}var d=
|
||||
a.p.multiSort?[]:"",e=[],g=!1,f={},h=[],k=[],l,m,n;if(b.isArray(a.p.data)){var p=a.p.grouping?a.p.groupingView:!1,A,r;b.each(a.p.colModel,function(){m=this.sorttype||"text";"date"===m||"datetime"===m?(this.formatter&&"string"===typeof this.formatter&&"date"===this.formatter?(l=this.formatoptions&&this.formatoptions.srcformat?this.formatoptions.srcformat:b.jgrid.formatter.date.srcformat,n=this.formatoptions&&this.formatoptions.newformat?this.formatoptions.newformat:b.jgrid.formatter.date.newformat):
|
||||
l=n=this.datefmt||"Y-m-d",f[this.name]={stype:m,srcfmt:l,newfmt:n,sfunc:this.sortfunc||null}):f[this.name]={stype:m,srcfmt:"",newfmt:"",sfunc:this.sortfunc||null};if(a.p.grouping)for(r=0,A=p.groupField.length;r<A;r++)if(this.name===p.groupField[r]){var c=this.name;this.index&&(c=this.index);h[r]=f[c];k[r]=c}a.p.multiSort?this.lso&&(d.push(this.name),c=this.lso.split("-"),e.push(c[c.length-1])):g||this.index!==a.p.sortname&&this.name!==a.p.sortname||(d=this.name,g=!0)});if(a.p.treeGrid)b(a).jqGrid("SortTree",
|
||||
d,a.p.sortorder,f[d].stype||"text",f[d].srcfmt||"");else{var q={eq:function(a){return a.equals},ne:function(a){return a.notEquals},lt:function(a){return a.less},le:function(a){return a.lessOrEquals},gt:function(a){return a.greater},ge:function(a){return a.greaterOrEquals},cn:function(a){return a.contains},nc:function(a,b){return"OR"===b?a.orNot().contains:a.andNot().contains},bw:function(a){return a.startsWith},bn:function(a,b){return"OR"===b?a.orNot().startsWith:a.andNot().startsWith},en:function(a,
|
||||
b){return"OR"===b?a.orNot().endsWith:a.andNot().endsWith},ew:function(a){return a.endsWith},ni:function(a,b){return"OR"===b?a.orNot().equals:a.andNot().equals},"in":function(a){return a.equals},nu:function(a){return a.isNull},nn:function(a,b){return"OR"===b?a.orNot().isNull:a.andNot().isNull}},u=b.jgrid.from(a.p.data);a.p.ignoreCase&&(u=u.ignoreCase());if(!0===a.p.search){var z=a.p.postData.filters;if(z)"string"===typeof z&&(z=b.jgrid.parse(z)),c(z);else try{u=q[a.p.postData.searchOper](u)(a.p.postData.searchField,
|
||||
a.p.postData.searchString,f[a.p.postData.searchField])}catch(t){}}if(a.p.grouping)for(r=0;r<A;r++)u.orderBy(k[r],p.groupOrder[r],h[r].stype,h[r].srcfmt);a.p.multiSort?b.each(d,function(a){u.orderBy(this,e[a],f[this].stype,f[this].srcfmt,f[this].sfunc)}):d&&a.p.sortorder&&g&&("DESC"===a.p.sortorder.toUpperCase()?u.orderBy(a.p.sortname,"d",f[d].stype,f[d].srcfmt,f[d].sfunc):u.orderBy(a.p.sortname,"a",f[d].stype,f[d].srcfmt,f[d].sfunc));var z=u.select(),x=parseInt(a.p.rowNum,10),y=z.length,B=parseInt(a.p.page,
|
||||
10),D=Math.ceil(y/x),v={};if((a.p.search||a.p.resetsearch)&&a.p.grouping&&a.p.groupingView._locgr){a.p.groupingView.groups=[];var w,G=b.jgrid.getMethod("groupingPrepare"),s,F;if(a.p.footerrow&&a.p.userDataOnFooter){for(s in a.p.userData)a.p.userData.hasOwnProperty(s)&&(a.p.userData[s]=0);F=!0}for(w=0;w<y;w++){if(F)for(s in a.p.userData)a.p.userData[s]+=parseFloat(z[w][s]||0);G.call(b(a),z[w],w,x)}}z=z.slice((B-1)*x,B*x);f=u=null;v[a.p.localReader.total]=D;v[a.p.localReader.page]=B;v[a.p.localReader.records]=
|
||||
y;v[a.p.localReader.root]=z;v[a.p.localReader.userdata]=a.p.userData;z=null;return v}}},P=function(){a.grid.hDiv.loading=!0;if(!a.p.hiddengrid)switch(a.p.loadui){case "enable":b("#load_"+b.jgrid.jqID(a.p.id)).show();break;case "block":b("#lui_"+b.jgrid.jqID(a.p.id)).show(),b("#load_"+b.jgrid.jqID(a.p.id)).show()}},T=function(){a.grid.hDiv.loading=!1;switch(a.p.loadui){case "enable":b("#load_"+b.jgrid.jqID(a.p.id)).hide();break;case "block":b("#lui_"+b.jgrid.jqID(a.p.id)).hide(),b("#load_"+b.jgrid.jqID(a.p.id)).hide()}},
|
||||
Q=function(c){if(!a.grid.hDiv.loading){var d=a.p.scroll&&!1===c,e={},g,f=a.p.prmNames;0>=a.p.page&&(a.p.page=Math.min(1,a.p.lastpage));null!==f.search&&(e[f.search]=a.p.search);null!==f.nd&&(e[f.nd]=(new Date).getTime());null!==f.rows&&(e[f.rows]=a.p.rowNum);null!==f.page&&(e[f.page]=a.p.page);null!==f.sort&&(e[f.sort]=a.p.sortname);null!==f.order&&(e[f.order]=a.p.sortorder);null!==a.p.rowTotal&&null!==f.totalrows&&(e[f.totalrows]=a.p.rowTotal);var h=b.isFunction(a.p.loadComplete),k=h?a.p.loadComplete:
|
||||
null,l=0;c=c||1;1<c?null!==f.npage?(e[f.npage]=c,l=c-1,c=1):k=function(b){a.p.page++;a.grid.hDiv.loading=!1;h&&a.p.loadComplete.call(a,b);Q(c-1)}:null!==f.npage&&delete a.p.postData[f.npage];if(a.p.grouping){b(a).jqGrid("groupingSetup");var m=a.p.groupingView,n,p="";for(n=0;n<m.groupField.length;n++){var r=m.groupField[n];b.each(a.p.colModel,function(a,b){b.name===r&&b.index&&(r=b.index)});p+=r+" "+m.groupOrder[n]+", "}e[f.sort]=p+e[f.sort]}b.extend(a.p.postData,e);var q=a.p.scroll?a.rows.length-
|
||||
1:1,e=b(a).triggerHandler("jqGridBeforeRequest");if(!1!==e&&"stop"!==e)if(b.isFunction(a.p.datatype))a.p.datatype.call(a,a.p.postData,"load_"+a.p.id,q,c,l);else{if(b.isFunction(a.p.beforeRequest)&&(e=a.p.beforeRequest.call(a),void 0===e&&(e=!0),!1===e))return;g=a.p.datatype.toLowerCase();switch(g){case "json":case "jsonp":case "xml":case "script":b.ajax(b.extend({url:a.p.url,type:a.p.mtype,dataType:g,data:b.isFunction(a.p.serializeGridData)?a.p.serializeGridData.call(a,a.p.postData):a.p.postData,
|
||||
success:function(e,f,h){if(b.isFunction(a.p.beforeProcessing)&&!1===a.p.beforeProcessing.call(a,e,f,h))T();else{"xml"===g?K(e,a.grid.bDiv,q,1<c,l):Y(e,a.grid.bDiv,q,1<c,l);b(a).triggerHandler("jqGridLoadComplete",[e]);k&&k.call(a,e);b(a).triggerHandler("jqGridAfterLoadComplete",[e]);d&&a.grid.populateVisible();if(a.p.loadonce||a.p.treeGrid)a.p.datatype="local";1===c&&T()}},error:function(d,e,f){b.isFunction(a.p.loadError)&&a.p.loadError.call(a,d,e,f);1===c&&T()},beforeSend:function(c,d){var e=!0;
|
||||
b.isFunction(a.p.loadBeforeSend)&&(e=a.p.loadBeforeSend.call(a,c,d));void 0===e&&(e=!0);if(!1===e)return!1;P()}},b.jgrid.ajaxOptions,a.p.ajaxGridOptions));break;case "xmlstring":P();e="string"!==typeof a.p.datastr?a.p.datastr:b.parseXML(a.p.datastr);K(e,a.grid.bDiv);b(a).triggerHandler("jqGridLoadComplete",[e]);h&&a.p.loadComplete.call(a,e);b(a).triggerHandler("jqGridAfterLoadComplete",[e]);a.p.datatype="local";a.p.datastr=null;T();break;case "jsonstring":P();e="string"===typeof a.p.datastr?b.jgrid.parse(a.p.datastr):
|
||||
a.p.datastr;Y(e,a.grid.bDiv);b(a).triggerHandler("jqGridLoadComplete",[e]);h&&a.p.loadComplete.call(a,e);b(a).triggerHandler("jqGridAfterLoadComplete",[e]);a.p.datatype="local";a.p.datastr=null;T();break;case "local":case "clientside":P(),a.p.datatype="local",e=oa(),Y(e,a.grid.bDiv,q,1<c,l),b(a).triggerHandler("jqGridLoadComplete",[e]),k&&k.call(a,e),b(a).triggerHandler("jqGridAfterLoadComplete",[e]),d&&a.grid.populateVisible(),T()}}}},ha=function(c){b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv)[a.p.useProp?
|
||||
"prop":"attr"]("checked",c);if(a.p.frozenColumns&&a.p.id+"_frozen")b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.fhDiv)[a.p.useProp?"prop":"attr"]("checked",c)},qa=function(c,e){var d="",g="<table cellspacing='0' cellpadding='0' border='0' style='table-layout:auto;' class='ui-pg-table'><tbody><tr>",k="",l,m,n,p,q=function(c){var e;b.isFunction(a.p.onPaging)&&(e=a.p.onPaging.call(a,c));if("stop"===e)return!1;a.p.selrow=null;a.p.multiselect&&(a.p.selarrrow=[],ha(!1));a.p.savedRow=[];return!0};c=c.substr(1);
|
||||
e+="_"+c;l="pg_"+c;m=c+"_left";n=c+"_center";p=c+"_right";b("#"+b.jgrid.jqID(c)).append("<div id='"+l+"' class='ui-pager-control' role='group'><table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table' style='width:100%;table-layout:fixed;height:100%;' role='row'><tbody><tr><td id='"+m+"' align='left'></td><td id='"+n+"' align='center' style='white-space:pre;'></td><td id='"+p+"' align='right'></td></tr></tbody></table></div>").attr("dir","ltr");if(0<a.p.rowList.length){k="<td dir='"+f+
|
||||
"'>";k+="<select class='ui-pg-selbox' role='listbox'>";for(m=0;m<a.p.rowList.length;m++)k+='<option role="option" value="'+a.p.rowList[m]+'"'+(a.p.rowNum===a.p.rowList[m]?' selected="selected"':"")+">"+a.p.rowList[m]+"</option>";k+="</select></td>"}"rtl"===f&&(g+=k);!0===a.p.pginput&&(d="<td dir='"+f+"'>"+b.jgrid.format(a.p.pgtext||"","<input class='ui-pg-input' type='text' size='2' maxlength='7' value='0' role='textbox'/>","<span id='sp_1_"+b.jgrid.jqID(c)+"'></span>")+"</td>");!0===a.p.pgbuttons?
|
||||
(m=["first"+e,"prev"+e,"next"+e,"last"+e],"rtl"===f&&m.reverse(),g+="<td id='"+m[0]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-first'></span></td>",g+="<td id='"+m[1]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-prev'></span></td>",g=g+(""!==d?"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>"+d+"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>":
|
||||
"")+("<td id='"+m[2]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-next'></span></td>"),g+="<td id='"+m[3]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-end'></span></td>"):""!==d&&(g+=d);"ltr"===f&&(g+=k);g+="</tr></tbody></table>";!0===a.p.viewrecords&&b("td#"+c+"_"+a.p.recordpos,"#"+l).append("<div dir='"+f+"' style='text-align:"+a.p.recordpos+"' class='ui-paging-info'></div>");b("td#"+c+"_"+a.p.pagerpos,"#"+l).append(g);k=b(".ui-jqgrid").css("font-size")||
|
||||
"11px";b(document.body).append("<div id='testpg' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+k+";visibility:hidden;' ></div>");g=b(g).clone().appendTo("#testpg").width();b("#testpg").remove();0<g&&(""!==d&&(g+=50),b("td#"+c+"_"+a.p.pagerpos,"#"+l).width(g));a.p._nvtd=[];a.p._nvtd[0]=g?Math.floor((a.p.width-g)/2):Math.floor(a.p.width/3);a.p._nvtd[1]=0;g=null;b(".ui-pg-selbox","#"+l).bind("change",function(){if(!q("records"))return!1;a.p.page=Math.round(a.p.rowNum*(a.p.page-1)/
|
||||
this.value-0.5)+1;a.p.rowNum=this.value;a.p.pager&&b(".ui-pg-selbox",a.p.pager).val(this.value);a.p.toppager&&b(".ui-pg-selbox",a.p.toppager).val(this.value);Q();return!1});!0===a.p.pgbuttons&&(b(".ui-pg-button","#"+l).hover(function(){b(this).hasClass("ui-state-disabled")?this.style.cursor="default":(b(this).addClass("ui-state-hover"),this.style.cursor="pointer")},function(){b(this).hasClass("ui-state-disabled")||(b(this).removeClass("ui-state-hover"),this.style.cursor="default")}),b("#first"+b.jgrid.jqID(e)+
|
||||
", #prev"+b.jgrid.jqID(e)+", #next"+b.jgrid.jqID(e)+", #last"+b.jgrid.jqID(e)).click(function(){if(b(this).hasClass("ui-state-disabled"))return!1;var c=r(a.p.page,1),d=r(a.p.lastpage,1),g=!1,f=!0,h=!0,k=!0,l=!0;0===d||1===d?l=k=h=f=!1:1<d&&1<=c?1===c?h=f=!1:c===d&&(l=k=!1):1<d&&0===c&&(l=k=!1,c=d-1);if(!q(this.id))return!1;this.id==="first"+e&&f&&(a.p.page=1,g=!0);this.id==="prev"+e&&h&&(a.p.page=c-1,g=!0);this.id==="next"+e&&k&&(a.p.page=c+1,g=!0);this.id==="last"+e&&l&&(a.p.page=d,g=!0);g&&Q();
|
||||
return!1}));!0===a.p.pginput&&b("input.ui-pg-input","#"+l).keypress(function(c){if(13===(c.charCode||c.keyCode||0)){if(!q("user"))return!1;b(this).val(r(b(this).val(),1));a.p.page=0<b(this).val()?b(this).val():a.p.page;Q();return!1}return this})},wa=function(c,e){var d,g="",f=a.p.colModel,h=!1,k;k=a.p.frozenColumns?e:a.grid.headers[c].el;var l="";b("span.ui-grid-ico-sort",k).addClass("ui-state-disabled");b(k).attr("aria-selected","false");if(f[c].lso)if("asc"===f[c].lso)f[c].lso+="-desc",l="desc";
|
||||
else if("desc"===f[c].lso)f[c].lso+="-asc",l="asc";else{if("asc-desc"===f[c].lso||"desc-asc"===f[c].lso)f[c].lso=""}else f[c].lso=l=f[c].firstsortorder||"asc";l?(b("span.s-ico",k).show(),b("span.ui-icon-"+l,k).removeClass("ui-state-disabled"),b(k).attr("aria-selected","true")):a.p.viewsortcols[0]||b("span.s-ico",k).hide();a.p.sortorder="";b.each(f,function(b){this.lso&&(0<b&&h&&(g+=", "),d=this.lso.split("-"),g+=f[b].index||f[b].name,g+=" "+d[d.length-1],h=!0,a.p.sortorder=d[d.length-1])});k=g.lastIndexOf(a.p.sortorder);
|
||||
g=g.substring(0,k);a.p.sortname=g},ra=function(c,d,e,g,f){if(a.p.colModel[d].sortable&&!(0<a.p.savedRow.length)){e||(a.p.lastsort===d?"asc"===a.p.sortorder?a.p.sortorder="desc":"desc"===a.p.sortorder&&(a.p.sortorder="asc"):a.p.sortorder=a.p.colModel[d].firstsortorder||"asc",a.p.page=1);if(a.p.multiSort)wa(d,f);else{if(g){if(a.p.lastsort===d&&a.p.sortorder===g&&!e)return;a.p.sortorder=g}e=a.grid.headers[a.p.lastsort].el;f=a.p.frozenColumns?f:a.grid.headers[d].el;b("span.ui-grid-ico-sort",e).addClass("ui-state-disabled");
|
||||
b(e).attr("aria-selected","false");a.p.frozenColumns&&(a.grid.fhDiv.find("span.ui-grid-ico-sort").addClass("ui-state-disabled"),a.grid.fhDiv.find("th").attr("aria-selected","false"));b("span.ui-icon-"+a.p.sortorder,f).removeClass("ui-state-disabled");b(f).attr("aria-selected","true");a.p.viewsortcols[0]||a.p.lastsort===d||(a.p.frozenColumns&&a.grid.fhDiv.find("span.s-ico").hide(),b("span.s-ico",e).hide(),b("span.s-ico",f).show());c=c.substring(5+a.p.id.length+1);a.p.sortname=a.p.colModel[d].index||
|
||||
c}"stop"===b(a).triggerHandler("jqGridSortCol",[a.p.sortname,d,a.p.sortorder])?a.p.lastsort=d:b.isFunction(a.p.onSortCol)&&"stop"===a.p.onSortCol.call(a,a.p.sortname,d,a.p.sortorder)?a.p.lastsort=d:("local"===a.p.datatype?a.p.deselectAfterSort&&b(a).jqGrid("resetSelection"):(a.p.selrow=null,a.p.multiselect&&ha(!1),a.p.selarrrow=[],a.p.savedRow=[]),a.p.scroll&&(f=a.grid.bDiv.scrollLeft,X.call(a,!0,!1),a.grid.hDiv.scrollLeft=f),a.p.subGrid&&"local"===a.p.datatype&&b("td.sgexpanded","#"+b.jgrid.jqID(a.p.id)).each(function(){b(this).trigger("click")}),
|
||||
Q(),a.p.lastsort=d,a.p.sortname!==c&&d&&(a.p.lastsort=d))}},xa=function(c){c=b(a.grid.headers[c].el);c=[c.position().left+c.outerWidth()];"rtl"===a.p.direction&&(c[0]=a.p.width-c[0]);c[0]-=a.grid.bDiv.scrollLeft;c.push(b(a.grid.hDiv).position().top);c.push(b(a.grid.bDiv).offset().top-b(a.grid.hDiv).offset().top+b(a.grid.bDiv).height());return c},sa=function(c){var d,e=a.grid.headers,g=b.jgrid.getCellIndex(c);for(d=0;d<e.length;d++)if(c===e[d].el){g=d;break}return g};this.p.id=this.id;-1===b.inArray(a.p.multikey,
|
||||
["shiftKey","altKey","ctrlKey"])&&(a.p.multikey=!1);a.p.keyIndex=!1;a.p.keyName=!1;for(g=0;g<a.p.colModel.length;g++)a.p.colModel[g]=b.extend(!0,{},a.p.cmTemplate,a.p.colModel[g].template||{},a.p.colModel[g]),!1===a.p.keyIndex&&!0===a.p.colModel[g].key&&(a.p.keyIndex=g);a.p.sortorder=a.p.sortorder.toLowerCase();b.jgrid.cell_width=b.jgrid.cellWidth();!0===a.p.grouping&&(a.p.scroll=!1,a.p.rownumbers=!1,a.p.treeGrid=!1,a.p.gridview=!0);if(!0===this.p.treeGrid){try{b(this).jqGrid("setTreeGrid")}catch(za){}"local"!==
|
||||
a.p.datatype&&(a.p.localReader={id:"_id_"})}if(this.p.subGrid)try{b(a).jqGrid("setSubGrid")}catch(Aa){}this.p.multiselect&&(this.p.colNames.unshift("<input role='checkbox' id='cb_"+this.p.id+"' class='cbox' type='checkbox'/>"),this.p.colModel.unshift({name:"cb",width:b.jgrid.cell_width?a.p.multiselectWidth+a.p.cellLayout:a.p.multiselectWidth,sortable:!1,resizable:!1,hidedlg:!0,search:!1,align:"center",fixed:!0}));this.p.rownumbers&&(this.p.colNames.unshift(""),this.p.colModel.unshift({name:"rn",width:a.p.rownumWidth,
|
||||
sortable:!1,resizable:!1,hidedlg:!0,search:!1,align:"center",fixed:!0}));a.p.xmlReader=b.extend(!0,{root:"rows",row:"row",page:"rows>page",total:"rows>total",records:"rows>records",repeatitems:!0,cell:"cell",id:"[id]",userdata:"userdata",subgrid:{root:"rows",row:"row",repeatitems:!0,cell:"cell"}},a.p.xmlReader);a.p.jsonReader=b.extend(!0,{root:"rows",page:"page",total:"total",records:"records",repeatitems:!0,cell:"cell",id:"id",userdata:"userdata",subgrid:{root:"rows",repeatitems:!0,cell:"cell"}},
|
||||
a.p.jsonReader);a.p.localReader=b.extend(!0,{root:"rows",page:"page",total:"total",records:"records",repeatitems:!1,cell:"cell",id:"id",userdata:"userdata",subgrid:{root:"rows",repeatitems:!0,cell:"cell"}},a.p.localReader);a.p.scroll&&(a.p.pgbuttons=!1,a.p.pginput=!1,a.p.rowList=[]);a.p.data.length&&O();var D="<thead><tr class='ui-jqgrid-labels' role='rowheader'>",ta,F,ja,fa,ka,y,t,ba,ua=ba="",ga=[],va=[];F=[];if(!0===a.p.shrinkToFit&&!0===a.p.forceFit)for(g=a.p.colModel.length-1;0<=g;g--)if(!a.p.colModel[g].hidden){a.p.colModel[g].resizable=
|
||||
!1;break}"horizontal"===a.p.viewsortcols[1]&&(ba=" ui-i-asc",ua=" ui-i-desc");ta=n?"class='ui-th-div-ie'":"";ba="<span class='s-ico' style='display:none'><span sort='asc' class='ui-grid-ico-sort ui-icon-asc"+ba+" ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-"+f+"'></span>"+("<span sort='desc' class='ui-grid-ico-sort ui-icon-desc"+ua+" ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-"+f+"'></span></span>");if(a.p.multiSort)for(ga=a.p.sortname.split(","),g=0;g<ga.length;g++)F=b.trim(ga[g]).split(" "),
|
||||
ga[g]=b.trim(F[0]),va[g]=F[1]?b.trim(F[1]):a.p.sortorder||"asc";for(g=0;g<this.p.colNames.length;g++)F=a.p.headertitles?' title="'+b.jgrid.stripHtml(a.p.colNames[g])+'"':"",D+="<th id='"+a.p.id+"_"+a.p.colModel[g].name+"' role='columnheader' class='ui-state-default ui-th-column ui-th-"+f+"'"+F+">",F=a.p.colModel[g].index||a.p.colModel[g].name,D+="<div id='jqgh_"+a.p.id+"_"+a.p.colModel[g].name+"' "+ta+">"+a.p.colNames[g],a.p.colModel[g].width=a.p.colModel[g].width?parseInt(a.p.colModel[g].width,10):
|
||||
150,"boolean"!==typeof a.p.colModel[g].title&&(a.p.colModel[g].title=!0),a.p.colModel[g].lso="",F===a.p.sortname&&(a.p.lastsort=g),a.p.multiSort&&(F=b.inArray(F,ga),-1!==F&&(a.p.colModel[g].lso=va[F])),D+=ba+"</div></th>";D+="</tr></thead>";ba=null;b(this).append(D);b("thead tr:first th",this).hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});if(this.p.multiselect){var la=[],ca;b("#cb_"+b.jgrid.jqID(a.p.id),this).bind("click",function(){a.p.selarrrow=
|
||||
[];var c=!0===a.p.frozenColumns?a.p.id+"_frozen":"";this.checked?(b(a.rows).each(function(d){0<d&&!b(this).hasClass("ui-subgrid")&&!b(this).hasClass("jqgroup")&&!b(this).hasClass("ui-state-disabled")&&(b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+b.jgrid.jqID(this.id))[a.p.useProp?"prop":"attr"]("checked",!0),b(this).addClass("ui-state-highlight").attr("aria-selected","true"),a.p.selarrrow.push(this.id),a.p.selrow=this.id,c&&(b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+b.jgrid.jqID(this.id),a.grid.fbDiv)[a.p.useProp?
|
||||
"prop":"attr"]("checked",!0),b("#"+b.jgrid.jqID(this.id),a.grid.fbDiv).addClass("ui-state-highlight")))}),ca=!0,la=[]):(b(a.rows).each(function(d){0<d&&!b(this).hasClass("ui-subgrid")&&!b(this).hasClass("ui-state-disabled")&&(b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+b.jgrid.jqID(this.id))[a.p.useProp?"prop":"attr"]("checked",!1),b(this).removeClass("ui-state-highlight").attr("aria-selected","false"),la.push(this.id),c&&(b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+b.jgrid.jqID(this.id),a.grid.fbDiv)[a.p.useProp?
|
||||
"prop":"attr"]("checked",!1),b("#"+b.jgrid.jqID(this.id),a.grid.fbDiv).removeClass("ui-state-highlight")))}),a.p.selrow=null,ca=!1);b(a).triggerHandler("jqGridSelectAll",[ca?a.p.selarrrow:la,ca]);b.isFunction(a.p.onSelectAll)&&a.p.onSelectAll.call(a,ca?a.p.selarrrow:la,ca)})}!0===a.p.autowidth&&(D=b(m).innerWidth(),a.p.width=0<D?D:"nw");(function(){var d=0,e=b.jgrid.cell_width?0:r(a.p.cellLayout,0),g=0,f,h=r(a.p.scrollOffset,0),k,m=!1,n,p=0,q;b.each(a.p.colModel,function(){void 0===this.hidden&&(this.hidden=
|
||||
!1);if(a.p.grouping&&a.p.autowidth){var c=b.inArray(this.name,a.p.groupingView.groupField);0<=c&&a.p.groupingView.groupColumnShow.length>c&&(this.hidden=!a.p.groupingView.groupColumnShow[c])}this.widthOrg=k=r(this.width,0);!1===this.hidden&&(d+=k+e,this.fixed?p+=k+e:g++)});isNaN(a.p.width)&&(a.p.width=d+(!1!==a.p.shrinkToFit||isNaN(a.p.height)?0:h));c.width=a.p.width;a.p.tblwidth=d;!1===a.p.shrinkToFit&&!0===a.p.forceFit&&(a.p.forceFit=!1);!0===a.p.shrinkToFit&&0<g&&(n=c.width-e*g-p,isNaN(a.p.height)||
|
||||
(n-=h,m=!0),d=0,b.each(a.p.colModel,function(b){!1!==this.hidden||this.fixed||(this.width=k=Math.round(n*this.width/(a.p.tblwidth-e*g-p)),d+=k,f=b)}),q=0,m?c.width-p-(d+e*g)!==h&&(q=c.width-p-(d+e*g)-h):m||1===Math.abs(c.width-p-(d+e*g))||(q=c.width-p-(d+e*g)),a.p.colModel[f].width+=q,a.p.tblwidth=d+q+e*g+p,a.p.tblwidth>a.p.width&&(a.p.colModel[f].width-=a.p.tblwidth-parseInt(a.p.width,10),a.p.tblwidth=a.p.width))})();b(m).css("width",c.width+"px").append("<div class='ui-jqgrid-resize-mark' id='rs_m"+
|
||||
a.p.id+"'> </div>");b(k).css("width",c.width+"px");var D=b("thead:first",a).get(0),V="";a.p.footerrow&&(V+="<table role='grid' style='width:"+a.p.tblwidth+"px' class='ui-jqgrid-ftable' cellspacing='0' cellpadding='0' border='0'><tbody><tr role='row' class='ui-widget-content footrow footrow-"+f+"'>");var k=b("tr:first",D),da="<tr class='jqgfirstrow' role='row' style='height:auto'>";a.p.disableClick=!1;b("th",k).each(function(d){ja=a.p.colModel[d].width;void 0===a.p.colModel[d].resizable&&(a.p.colModel[d].resizable=
|
||||
!0);a.p.colModel[d].resizable?(fa=document.createElement("span"),b(fa).html(" ").addClass("ui-jqgrid-resize ui-jqgrid-resize-"+f).css("cursor","col-resize"),b(this).addClass(a.p.resizeclass)):fa="";b(this).css("width",ja+"px").prepend(fa);fa=null;var e="";a.p.colModel[d].hidden&&(b(this).css("display","none"),e="display:none;");da+="<td role='gridcell' style='height:0px;width:"+ja+"px;"+e+"'></td>";c.headers[d]={width:ja,el:this};ka=a.p.colModel[d].sortable;"boolean"!==typeof ka&&(ka=a.p.colModel[d].sortable=
|
||||
!0);e=a.p.colModel[d].name;"cb"!==e&&"subgrid"!==e&&"rn"!==e&&a.p.viewsortcols[2]&&b(">div",this).addClass("ui-jqgrid-sortable");ka&&(a.p.multiSort?a.p.viewsortcols[0]?(b("div span.s-ico",this).show(),a.p.colModel[d].lso&&b("div span.ui-icon-"+a.p.colModel[d].lso,this).removeClass("ui-state-disabled")):a.p.colModel[d].lso&&(b("div span.s-ico",this).show(),b("div span.ui-icon-"+a.p.colModel[d].lso,this).removeClass("ui-state-disabled")):a.p.viewsortcols[0]?(b("div span.s-ico",this).show(),d===a.p.lastsort&&
|
||||
b("div span.ui-icon-"+a.p.sortorder,this).removeClass("ui-state-disabled")):d===a.p.lastsort&&(b("div span.s-ico",this).show(),b("div span.ui-icon-"+a.p.sortorder,this).removeClass("ui-state-disabled")));a.p.footerrow&&(V+="<td role='gridcell' "+p(d,0,"",null,"",!1)+"> </td>")}).mousedown(function(d){if(1===b(d.target).closest("th>span.ui-jqgrid-resize").length){var e=sa(this);if(!0===a.p.forceFit){var g=a.p,f=e,h;for(h=e+1;h<a.p.colModel.length;h++)if(!0!==a.p.colModel[h].hidden){f=h;break}g.nv=
|
||||
f-e}c.dragStart(e,d,xa(e));return!1}}).click(function(c){if(a.p.disableClick)return a.p.disableClick=!1;var d="th>div.ui-jqgrid-sortable",e,g;a.p.viewsortcols[2]||(d="th>div>span>span.ui-grid-ico-sort");c=b(c.target).closest(d);if(1===c.length){var f;if(a.p.frozenColumns){var h=b(this)[0].id.substring(a.p.id.length+1);b(a.p.colModel).each(function(a){if(this.name===h)return f=a,!1})}else f=sa(this);a.p.viewsortcols[2]||(e=!0,g=c.attr("sort"));null!=f&&ra(b("div",this)[0].id,f,e,g,this);return!1}});
|
||||
if(a.p.sortable&&b.fn.sortable)try{b(a).jqGrid("sortableColumns",k)}catch(Ba){}a.p.footerrow&&(V+="</tr></tbody></table>");da+="</tr>";k=document.createElement("tbody");this.appendChild(k);b(this).addClass("ui-jqgrid-btable").append(da);var da=null,k=b("<table class='ui-jqgrid-htable' style='width:"+a.p.tblwidth+"px' role='grid' aria-labelledby='gbox_"+this.id+"' cellspacing='0' cellpadding='0' border='0'></table>").append(D),J=a.p.caption&&!0===a.p.hiddengrid?!0:!1;g=b("<div class='ui-jqgrid-hbox"+
|
||||
("rtl"===f?"-rtl":"")+"'></div>");D=null;c.hDiv=document.createElement("div");b(c.hDiv).css({width:c.width+"px"}).addClass("ui-state-default ui-jqgrid-hdiv").append(g);b(g).append(k);k=null;J&&b(c.hDiv).hide();a.p.pager&&("string"===typeof a.p.pager?"#"!==a.p.pager.substr(0,1)&&(a.p.pager="#"+a.p.pager):a.p.pager="#"+b(a.p.pager).attr("id"),b(a.p.pager).css({width:c.width+"px"}).addClass("ui-state-default ui-jqgrid-pager ui-corner-bottom").appendTo(m),J&&b(a.p.pager).hide(),qa(a.p.pager,""));!1===
|
||||
a.p.cellEdit&&!0===a.p.hoverrows&&b(a).bind("mouseover",function(a){t=b(a.target).closest("tr.jqgrow");"ui-subgrid"!==b(t).attr("class")&&b(t).addClass("ui-state-hover")}).bind("mouseout",function(a){t=b(a.target).closest("tr.jqgrow");b(t).removeClass("ui-state-hover")});var B,N,ma;b(a).before(c.hDiv).click(function(c){y=c.target;t=b(y,a.rows).closest("tr.jqgrow");if(0===b(t).length||-1<t[0].className.indexOf("ui-state-disabled")||(b(y,a).closest("table.ui-jqgrid-btable").attr("id")||"").replace("_frozen",
|
||||
"")!==a.id)return this;var d=b(y).hasClass("cbox"),e=b(a).triggerHandler("jqGridBeforeSelectRow",[t[0].id,c]);(e=!1===e||"stop"===e?!1:!0)&&b.isFunction(a.p.beforeSelectRow)&&(e=a.p.beforeSelectRow.call(a,t[0].id,c));if("A"!==y.tagName&&("INPUT"!==y.tagName&&"TEXTAREA"!==y.tagName&&"OPTION"!==y.tagName&&"SELECT"!==y.tagName||d)&&!0===e)if(B=t[0].id,N=b.jgrid.getCellIndex(y),ma=b(y).closest("td,th").html(),b(a).triggerHandler("jqGridCellSelect",[B,N,ma,c]),b.isFunction(a.p.onCellSelect)&&a.p.onCellSelect.call(a,
|
||||
B,N,ma,c),!0===a.p.cellEdit)if(a.p.multiselect&&d)b(a).jqGrid("setSelection",B,!0,c);else{B=t[0].rowIndex;try{b(a).jqGrid("editCell",B,N,!0)}catch(g){}}else if(a.p.multikey)c[a.p.multikey]?b(a).jqGrid("setSelection",B,!0,c):a.p.multiselect&&d&&(d=b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+B).is(":checked"),b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+B)[a.p.useProp?"prop":"attr"]("checked",d));else{if(a.p.multiselect&&a.p.multiboxonly&&!d){var f=a.p.frozenColumns?a.p.id+"_frozen":"";b(a.p.selarrrow).each(function(c,
|
||||
d){var e=b(a).jqGrid("getGridRowById",d);b(e).removeClass("ui-state-highlight");b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+b.jgrid.jqID(d))[a.p.useProp?"prop":"attr"]("checked",!1);f&&(b("#"+b.jgrid.jqID(d),"#"+b.jgrid.jqID(f)).removeClass("ui-state-highlight"),b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+b.jgrid.jqID(d),"#"+b.jgrid.jqID(f))[a.p.useProp?"prop":"attr"]("checked",!1))});a.p.selarrrow=[]}b(a).jqGrid("setSelection",B,!0,c)}}).bind("reloadGrid",function(c,d){!0===a.p.treeGrid&&(a.p.datatype=a.p.treedatatype);
|
||||
d&&d.current&&a.grid.selectionPreserver(a);"local"===a.p.datatype?(b(a).jqGrid("resetSelection"),a.p.data.length&&O()):a.p.treeGrid||(a.p.selrow=null,a.p.multiselect&&(a.p.selarrrow=[],ha(!1)),a.p.savedRow=[]);a.p.scroll&&X.call(a,!0,!1);if(d&&d.page){var e=d.page;e>a.p.lastpage&&(e=a.p.lastpage);1>e&&(e=1);a.p.page=e;a.grid.bDiv.scrollTop=a.grid.prevRowHeight?(e-1)*a.grid.prevRowHeight*a.p.rowNum:0}a.grid.prevRowHeight&&a.p.scroll?(delete a.p.lastpage,a.grid.populateVisible()):a.grid.populate();
|
||||
!0===a.p._inlinenav&&b(a).jqGrid("showAddEditButtons");return!1}).dblclick(function(c){y=c.target;t=b(y,a.rows).closest("tr.jqgrow");0!==b(t).length&&(B=t[0].rowIndex,N=b.jgrid.getCellIndex(y),b(a).triggerHandler("jqGridDblClickRow",[b(t).attr("id"),B,N,c]),b.isFunction(a.p.ondblClickRow)&&a.p.ondblClickRow.call(a,b(t).attr("id"),B,N,c))}).bind("contextmenu",function(c){y=c.target;t=b(y,a.rows).closest("tr.jqgrow");0!==b(t).length&&(a.p.multiselect||b(a).jqGrid("setSelection",t[0].id,!0,c),B=t[0].rowIndex,
|
||||
N=b.jgrid.getCellIndex(y),b(a).triggerHandler("jqGridRightClickRow",[b(t).attr("id"),B,N,c]),b.isFunction(a.p.onRightClickRow)&&a.p.onRightClickRow.call(a,b(t).attr("id"),B,N,c))});c.bDiv=document.createElement("div");n&&"auto"===String(a.p.height).toLowerCase()&&(a.p.height="100%");b(c.bDiv).append(b('<div style="position:relative;'+(n&&8>b.jgrid.msiever()?"height:0.01%;":"")+'"></div>').append("<div></div>").append(this)).addClass("ui-jqgrid-bdiv").css({height:a.p.height+(isNaN(a.p.height)?"":"px"),
|
||||
width:c.width+"px"}).scroll(c.scrollGrid);b("table:first",c.bDiv).css({width:a.p.tblwidth+"px"});b.support.tbody||2===b("tbody",this).length&&b("tbody:gt(0)",this).remove();a.p.multikey&&(b.jgrid.msie?b(c.bDiv).bind("selectstart",function(){return!1}):b(c.bDiv).bind("mousedown",function(){return!1}));J&&b(c.bDiv).hide();c.cDiv=document.createElement("div");var na=!0===a.p.hidegrid?b("<a role='link' class='ui-jqgrid-titlebar-close ui-corner-all HeaderButton' />").hover(function(){na.addClass("ui-state-hover")},
|
||||
function(){na.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-circle-triangle-n'></span>").css("rtl"===f?"left":"right","0px"):"";b(c.cDiv).append(na).append("<span class='ui-jqgrid-title'>"+a.p.caption+"</span>").addClass("ui-jqgrid-titlebar ui-jqgrid-caption"+("rtl"===f?"-rtl":"")+" ui-widget-header ui-corner-top ui-helper-clearfix");b(c.cDiv).insertBefore(c.hDiv);a.p.toolbar[0]&&(c.uDiv=document.createElement("div"),"top"===a.p.toolbar[1]?b(c.uDiv).insertBefore(c.hDiv):"bottom"===
|
||||
a.p.toolbar[1]&&b(c.uDiv).insertAfter(c.hDiv),"both"===a.p.toolbar[1]?(c.ubDiv=document.createElement("div"),b(c.uDiv).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id).insertBefore(c.hDiv),b(c.ubDiv).addClass("ui-userdata ui-state-default").attr("id","tb_"+this.id).insertAfter(c.hDiv),J&&b(c.ubDiv).hide()):b(c.uDiv).width(c.width).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id),J&&b(c.uDiv).hide());a.p.toppager&&(a.p.toppager=b.jgrid.jqID(a.p.id)+"_toppager",c.topDiv=
|
||||
b("<div id='"+a.p.toppager+"'></div>")[0],a.p.toppager="#"+a.p.toppager,b(c.topDiv).addClass("ui-state-default ui-jqgrid-toppager").width(c.width).insertBefore(c.hDiv),qa(a.p.toppager,"_t"));a.p.footerrow&&(c.sDiv=b("<div class='ui-jqgrid-sdiv'></div>")[0],g=b("<div class='ui-jqgrid-hbox"+("rtl"===f?"-rtl":"")+"'></div>"),b(c.sDiv).append(g).width(c.width).insertAfter(c.hDiv),b(g).append(V),c.footers=b(".ui-jqgrid-ftable",c.sDiv)[0].rows[0].cells,a.p.rownumbers&&(c.footers[0].className="ui-state-default jqgrid-rownum"),
|
||||
J&&b(c.sDiv).hide());g=null;if(a.p.caption){var ya=a.p.datatype;!0===a.p.hidegrid&&(b(".ui-jqgrid-titlebar-close",c.cDiv).click(function(d){var e=b.isFunction(a.p.onHeaderClick),g=".ui-jqgrid-bdiv, .ui-jqgrid-hdiv, .ui-jqgrid-pager, .ui-jqgrid-sdiv",f,h=this;!0===a.p.toolbar[0]&&("both"===a.p.toolbar[1]&&(g+=", #"+b(c.ubDiv).attr("id")),g+=", #"+b(c.uDiv).attr("id"));f=b(g,"#gview_"+b.jgrid.jqID(a.p.id)).length;"visible"===a.p.gridstate?b(g,"#gbox_"+b.jgrid.jqID(a.p.id)).slideUp("fast",function(){f--;
|
||||
0===f&&(b("span",h).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s"),a.p.gridstate="hidden",b("#gbox_"+b.jgrid.jqID(a.p.id)).hasClass("ui-resizable")&&b(".ui-resizable-handle","#gbox_"+b.jgrid.jqID(a.p.id)).hide(),b(a).triggerHandler("jqGridHeaderClick",[a.p.gridstate,d]),e&&(J||a.p.onHeaderClick.call(a,a.p.gridstate,d)))}):"hidden"===a.p.gridstate&&b(g,"#gbox_"+b.jgrid.jqID(a.p.id)).slideDown("fast",function(){f--;0===f&&(b("span",h).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n"),
|
||||
J&&(a.p.datatype=ya,Q(),J=!1),a.p.gridstate="visible",b("#gbox_"+b.jgrid.jqID(a.p.id)).hasClass("ui-resizable")&&b(".ui-resizable-handle","#gbox_"+b.jgrid.jqID(a.p.id)).show(),b(a).triggerHandler("jqGridHeaderClick",[a.p.gridstate,d]),e&&(J||a.p.onHeaderClick.call(a,a.p.gridstate,d)))});return!1}),J&&(a.p.datatype="local",b(".ui-jqgrid-titlebar-close",c.cDiv).trigger("click")))}else b(c.cDiv).hide();b(c.hDiv).after(c.bDiv).mousemove(function(a){if(c.resizing)return c.dragMove(a),!1});b(".ui-jqgrid-labels",
|
||||
c.hDiv).bind("selectstart",function(){return!1});b(document).bind("mouseup.jqGrid"+a.p.id,function(){return c.resizing?(c.dragEnd(),!1):!0});a.formatCol=p;a.sortData=ra;a.updatepager=function(c,d){var e,g,f,h,k,l,m,n="",p=a.p.pager?"_"+b.jgrid.jqID(a.p.pager.substr(1)):"",q=a.p.toppager?"_"+a.p.toppager.substr(1):"";f=parseInt(a.p.page,10)-1;0>f&&(f=0);f*=parseInt(a.p.rowNum,10);k=f+a.p.reccount;if(a.p.scroll){e=b("tbody:first > tr:gt(0)",a.grid.bDiv);f=k-e.length;a.p.reccount=e.length;if(e=e.outerHeight()||
|
||||
a.grid.prevRowHeight)g=f*e,m=parseInt(a.p.records,10)*e,b(">div:first",a.grid.bDiv).css({height:m}).children("div:first").css({height:g,display:g?"":"none"}),0==a.grid.bDiv.scrollTop&&1<a.p.page&&(a.grid.bDiv.scrollTop=a.p.rowNum*(a.p.page-1)*e);a.grid.bDiv.scrollLeft=a.grid.hDiv.scrollLeft}n=a.p.pager||"";if(n+=a.p.toppager?n?","+a.p.toppager:a.p.toppager:"")m=b.jgrid.formatter.integer||{},e=r(a.p.page),g=r(a.p.lastpage),b(".selbox",n)[this.p.useProp?"prop":"attr"]("disabled",!1),!0===a.p.pginput&&
|
||||
(b(".ui-pg-input",n).val(a.p.page),h=a.p.toppager?"#sp_1"+p+",#sp_1"+q:"#sp_1"+p,b(h).html(b.fmatter?b.fmatter.util.NumberFormat(a.p.lastpage,m):a.p.lastpage)),a.p.viewrecords&&(0===a.p.reccount?b(".ui-paging-info",n).html(a.p.emptyrecords):(h=f+1,l=a.p.records,b.fmatter&&(h=b.fmatter.util.NumberFormat(h,m),k=b.fmatter.util.NumberFormat(k,m),l=b.fmatter.util.NumberFormat(l,m)),b(".ui-paging-info",n).html(b.jgrid.format(a.p.recordtext,h,k,l)))),!0===a.p.pgbuttons&&(0>=e&&(e=g=0),1===e||0===e?(b("#first"+
|
||||
p+", #prev"+p).addClass("ui-state-disabled").removeClass("ui-state-hover"),a.p.toppager&&b("#first_t"+q+", #prev_t"+q).addClass("ui-state-disabled").removeClass("ui-state-hover")):(b("#first"+p+", #prev"+p).removeClass("ui-state-disabled"),a.p.toppager&&b("#first_t"+q+", #prev_t"+q).removeClass("ui-state-disabled")),e===g||0===e?(b("#next"+p+", #last"+p).addClass("ui-state-disabled").removeClass("ui-state-hover"),a.p.toppager&&b("#next_t"+q+", #last_t"+q).addClass("ui-state-disabled").removeClass("ui-state-hover")):
|
||||
(b("#next"+p+", #last"+p).removeClass("ui-state-disabled"),a.p.toppager&&b("#next_t"+q+", #last_t"+q).removeClass("ui-state-disabled")));!0===c&&!0===a.p.rownumbers&&b(">td.jqgrid-rownum",a.rows).each(function(a){b(this).html(f+1+a)});d&&a.p.jqgdnd&&b(a).jqGrid("gridDnD","updateDnD");b(a).triggerHandler("jqGridGridComplete");b.isFunction(a.p.gridComplete)&&a.p.gridComplete.call(a);b(a).triggerHandler("jqGridAfterGridComplete")};a.refreshIndex=O;a.setHeadCheckBox=ha;a.constructTr=$;a.formatter=function(a,
|
||||
b,c,d,e){return x(a,b,c,d,e)};b.extend(c,{populate:Q,emptyRows:X,beginReq:P,endReq:T});this.grid=c;a.addXmlData=function(b){K(b,a.grid.bDiv)};a.addJSONData=function(b){Y(b,a.grid.bDiv)};this.grid.cols=this.rows[0].cells;b(a).triggerHandler("jqGridInitGrid");b.isFunction(a.p.onInitGrid)&&a.p.onInitGrid.call(a);Q();a.p.hiddengrid=!1}}}})};b.jgrid.extend({getGridParam:function(b){var f=this[0];if(f&&f.grid)return b?void 0!==f.p[b]?f.p[b]:null:f.p},setGridParam:function(e){return this.each(function(){this.grid&&
|
||||
"object"===typeof e&&b.extend(!0,this.p,e)})},getGridRowById:function(e){var f;this.each(function(){try{for(var c=this.rows.length;c--;)if(e.toString()===this.rows[c].id){f=this.rows[c];break}}catch(d){f=b(this.grid.bDiv).find("#"+b.jgrid.jqID(e))}});return f},getDataIDs:function(){var e=[],f=0,c,d=0;this.each(function(){if((c=this.rows.length)&&0<c)for(;f<c;)b(this.rows[f]).hasClass("jqgrow")&&(e[d]=this.rows[f].id,d++),f++});return e},setSelection:function(e,f,c){return this.each(function(){var d,
|
||||
a,l,g,h,k;void 0!==e&&(f=!1===f?!1:!0,!(a=b(this).jqGrid("getGridRowById",e))||!a.className||-1<a.className.indexOf("ui-state-disabled")||(!0===this.p.scrollrows&&(l=b(this).jqGrid("getGridRowById",e).rowIndex,0<=l&&(d=b(this.grid.bDiv)[0].clientHeight,g=b(this.grid.bDiv)[0].scrollTop,h=b(this.rows[l]).position().top,l=this.rows[l].clientHeight,h+l>=d+g?b(this.grid.bDiv)[0].scrollTop=h-(d+g)+l+g:h<d+g&&h<g&&(b(this.grid.bDiv)[0].scrollTop=h))),!0===this.p.frozenColumns&&(k=this.p.id+"_frozen"),this.p.multiselect?
|
||||
(this.setHeadCheckBox(!1),this.p.selrow=a.id,g=b.inArray(this.p.selrow,this.p.selarrrow),-1===g?("ui-subgrid"!==a.className&&b(a).addClass("ui-state-highlight").attr("aria-selected","true"),d=!0,this.p.selarrrow.push(this.p.selrow)):("ui-subgrid"!==a.className&&b(a).removeClass("ui-state-highlight").attr("aria-selected","false"),d=!1,this.p.selarrrow.splice(g,1),h=this.p.selarrrow[0],this.p.selrow=void 0===h?null:h),b("#jqg_"+b.jgrid.jqID(this.p.id)+"_"+b.jgrid.jqID(a.id))[this.p.useProp?"prop":"attr"]("checked",
|
||||
d),k&&(-1===g?b("#"+b.jgrid.jqID(e),"#"+b.jgrid.jqID(k)).addClass("ui-state-highlight"):b("#"+b.jgrid.jqID(e),"#"+b.jgrid.jqID(k)).removeClass("ui-state-highlight"),b("#jqg_"+b.jgrid.jqID(this.p.id)+"_"+b.jgrid.jqID(e),"#"+b.jgrid.jqID(k))[this.p.useProp?"prop":"attr"]("checked",d)),f&&(b(this).triggerHandler("jqGridSelectRow",[a.id,d,c]),this.p.onSelectRow&&this.p.onSelectRow.call(this,a.id,d,c))):"ui-subgrid"!==a.className&&(this.p.selrow!==a.id?(b(b(this).jqGrid("getGridRowById",this.p.selrow)).removeClass("ui-state-highlight").attr({"aria-selected":"false",
|
||||
tabindex:"-1"}),b(a).addClass("ui-state-highlight").attr({"aria-selected":"true",tabindex:"0"}),k&&(b("#"+b.jgrid.jqID(this.p.selrow),"#"+b.jgrid.jqID(k)).removeClass("ui-state-highlight"),b("#"+b.jgrid.jqID(e),"#"+b.jgrid.jqID(k)).addClass("ui-state-highlight")),d=!0):d=!1,this.p.selrow=a.id,f&&(b(this).triggerHandler("jqGridSelectRow",[a.id,d,c]),this.p.onSelectRow&&this.p.onSelectRow.call(this,a.id,d,c)))))})},resetSelection:function(e){return this.each(function(){var f=this,c,d;!0===f.p.frozenColumns&&
|
||||
(d=f.p.id+"_frozen");if(void 0!==e){c=e===f.p.selrow?f.p.selrow:e;b("#"+b.jgrid.jqID(f.p.id)+" tbody:first tr#"+b.jgrid.jqID(c)).removeClass("ui-state-highlight").attr("aria-selected","false");d&&b("#"+b.jgrid.jqID(c),"#"+b.jgrid.jqID(d)).removeClass("ui-state-highlight");if(f.p.multiselect){b("#jqg_"+b.jgrid.jqID(f.p.id)+"_"+b.jgrid.jqID(c),"#"+b.jgrid.jqID(f.p.id))[f.p.useProp?"prop":"attr"]("checked",!1);if(d)b("#jqg_"+b.jgrid.jqID(f.p.id)+"_"+b.jgrid.jqID(c),"#"+b.jgrid.jqID(d))[f.p.useProp?"prop":
|
||||
"attr"]("checked",!1);f.setHeadCheckBox(!1)}c=null}else f.p.multiselect?(b(f.p.selarrrow).each(function(a,c){b(b(f).jqGrid("getGridRowById",c)).removeClass("ui-state-highlight").attr("aria-selected","false");b("#jqg_"+b.jgrid.jqID(f.p.id)+"_"+b.jgrid.jqID(c))[f.p.useProp?"prop":"attr"]("checked",!1);d&&(b("#"+b.jgrid.jqID(c),"#"+b.jgrid.jqID(d)).removeClass("ui-state-highlight"),b("#jqg_"+b.jgrid.jqID(f.p.id)+"_"+b.jgrid.jqID(c),"#"+b.jgrid.jqID(d))[f.p.useProp?"prop":"attr"]("checked",!1))}),f.setHeadCheckBox(!1),
|
||||
f.p.selarrrow=[],f.p.selrow=null):f.p.selrow&&(b("#"+b.jgrid.jqID(f.p.id)+" tbody:first tr#"+b.jgrid.jqID(f.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected","false"),d&&b("#"+b.jgrid.jqID(f.p.selrow),"#"+b.jgrid.jqID(d)).removeClass("ui-state-highlight"),f.p.selrow=null);!0===f.p.cellEdit&&0<=parseInt(f.p.iCol,10)&&0<=parseInt(f.p.iRow,10)&&(b("td:eq("+f.p.iCol+")",f.rows[f.p.iRow]).removeClass("edit-cell ui-state-highlight"),b(f.rows[f.p.iRow]).removeClass("selected-row ui-state-hover"));
|
||||
f.p.savedRow=[]})},getRowData:function(e){var f={},c,d=!1,a,l=0;this.each(function(){var g=this,h,k;if(void 0===e)d=!0,c=[],a=g.rows.length;else{k=b(g).jqGrid("getGridRowById",e);if(!k)return f;a=2}for(;l<a;)d&&(k=g.rows[l]),b(k).hasClass("jqgrow")&&(b('td[role="gridcell"]',k).each(function(a){h=g.p.colModel[a].name;if("cb"!==h&&"subgrid"!==h&&"rn"!==h)if(!0===g.p.treeGrid&&h===g.p.ExpandColumn)f[h]=b.jgrid.htmlDecode(b("span:first",this).html());else try{f[h]=b.unformat.call(g,this,{rowId:k.id,colModel:g.p.colModel[a]},
|
||||
a)}catch(c){f[h]=b.jgrid.htmlDecode(b(this).html())}}),d&&(c.push(f),f={})),l++});return c||f},delRowData:function(e){var f=!1,c,d;this.each(function(){c=b(this).jqGrid("getGridRowById",e);if(!c)return!1;b(c).remove();this.p.records--;this.p.reccount--;this.updatepager(!0,!1);f=!0;this.p.multiselect&&(d=b.inArray(e,this.p.selarrrow),-1!==d&&this.p.selarrrow.splice(d,1));this.p.selrow=this.p.multiselect&&0<this.p.selarrrow.length?this.p.selarrrow[this.p.selarrrow.length-1]:null;if("local"===this.p.datatype){var a=
|
||||
b.jgrid.stripPref(this.p.idPrefix,e),a=this.p._index[a];void 0!==a&&(this.p.data.splice(a,1),this.refreshIndex())}if(!0===this.p.altRows&&f){var l=this.p.altclass;b(this.rows).each(function(a){1===a%2?b(this).addClass(l):b(this).removeClass(l)})}});return f},setRowData:function(e,f,c){var d,a=!0,l;this.each(function(){if(!this.grid)return!1;var g=this,h,k,n=typeof c,m={};k=b(this).jqGrid("getGridRowById",e);if(!k)return!1;if(f)try{if(b(this.p.colModel).each(function(a){d=this.name;var c=b.jgrid.getAccessor(f,
|
||||
d);void 0!==c&&(m[d]=this.formatter&&"string"===typeof this.formatter&&"date"===this.formatter?b.unformat.date.call(g,c,this):c,h=g.formatter(e,c,a,f,"edit"),l=this.title?{title:b.jgrid.stripHtml(h)}:{},!0===g.p.treeGrid&&d===g.p.ExpandColumn?b("td[role='gridcell']:eq("+a+") > span:first",k).html(h).attr(l):b("td[role='gridcell']:eq("+a+")",k).html(h).attr(l))}),"local"===g.p.datatype){var r=b.jgrid.stripPref(g.p.idPrefix,e),p=g.p._index[r],q;if(g.p.treeGrid)for(q in g.p.treeReader)g.p.treeReader.hasOwnProperty(q)&&
|
||||
delete m[g.p.treeReader[q]];void 0!==p&&(g.p.data[p]=b.extend(!0,g.p.data[p],m));m=null}}catch(x){a=!1}a&&("string"===n?b(k).addClass(c):null!==c&&"object"===n&&b(k).css(c),b(g).triggerHandler("jqGridAfterGridComplete"))});return a},addRowData:function(e,f,c,d){c||(c="last");var a=!1,l,g,h,k,n,m,r,p,q="",x,G,U,M,ea,W;f&&(b.isArray(f)?(x=!0,c="last",G=e):(f=[f],x=!1),this.each(function(){var X=f.length;n=!0===this.p.rownumbers?1:0;h=!0===this.p.multiselect?1:0;k=!0===this.p.subGrid?1:0;x||(void 0!==
|
||||
e?e=String(e):(e=b.jgrid.randId(),!1!==this.p.keyIndex&&(G=this.p.colModel[this.p.keyIndex+h+k+n].name,void 0!==f[0][G]&&(e=f[0][G]))));U=this.p.altclass;for(var O=0,$="",K={},Y=b.isFunction(this.p.afterInsertRow)?!0:!1;O<X;){M=f[O];g=[];if(x){try{e=M[G],void 0===e&&(e=b.jgrid.randId())}catch(oa){e=b.jgrid.randId()}$=!0===this.p.altRows?0===(this.rows.length-1)%2?U:"":""}W=e;e=this.p.idPrefix+e;n&&(q=this.formatCol(0,1,"",null,e,!0),g[g.length]='<td role="gridcell" class="ui-state-default jqgrid-rownum" '+
|
||||
q+">0</td>");h&&(p='<input role="checkbox" type="checkbox" id="jqg_'+this.p.id+"_"+e+'" class="cbox"/>',q=this.formatCol(n,1,"",null,e,!0),g[g.length]='<td role="gridcell" '+q+">"+p+"</td>");k&&(g[g.length]=b(this).jqGrid("addSubGridCell",h+n,1));for(r=h+k+n;r<this.p.colModel.length;r++)ea=this.p.colModel[r],l=ea.name,K[l]=M[l],p=this.formatter(e,b.jgrid.getAccessor(M,l),r,M),q=this.formatCol(r,1,p,M,e,K),g[g.length]='<td role="gridcell" '+q+">"+p+"</td>";g.unshift(this.constructTr(e,!1,$,K,M,!1));
|
||||
g[g.length]="</tr>";if(0===this.rows.length)b("table:first",this.grid.bDiv).append(g.join(""));else switch(c){case "last":b(this.rows[this.rows.length-1]).after(g.join(""));m=this.rows.length-1;break;case "first":b(this.rows[0]).after(g.join(""));m=1;break;case "after":if(m=b(this).jqGrid("getGridRowById",d))b(this.rows[m.rowIndex+1]).hasClass("ui-subgrid")?b(this.rows[m.rowIndex+1]).after(g):b(m).after(g.join("")),m=m.rowIndex+1;break;case "before":if(m=b(this).jqGrid("getGridRowById",d))b(m).before(g.join("")),
|
||||
m=m.rowIndex-1}!0===this.p.subGrid&&b(this).jqGrid("addSubGrid",h+n,m);this.p.records++;this.p.reccount++;b(this).triggerHandler("jqGridAfterInsertRow",[e,M,M]);Y&&this.p.afterInsertRow.call(this,e,M,M);O++;"local"===this.p.datatype&&(K[this.p.localReader.id]=W,this.p._index[W]=this.p.data.length,this.p.data.push(K),K={})}!0!==this.p.altRows||x||("last"===c?1===(this.rows.length-1)%2&&b(this.rows[this.rows.length-1]).addClass(U):b(this.rows).each(function(a){1===a%2?b(this).addClass(U):b(this).removeClass(U)}));
|
||||
this.updatepager(!0,!0);a=!0}));return a},footerData:function(e,f,c){function d(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0}var a,l=!1,g={},h;void 0==e&&(e="get");"boolean"!==typeof c&&(c=!0);e=e.toLowerCase();this.each(function(){var k=this,n;if(!k.grid||!k.p.footerrow||"set"===e&&d(f))return!1;l=!0;b(this.p.colModel).each(function(d){a=this.name;"set"===e?void 0!==f[a]&&(n=c?k.formatter("",f[a],d,f,"edit"):f[a],h=this.title?{title:b.jgrid.stripHtml(n)}:{},b("tr.footrow td:eq("+d+
|
||||
")",k.grid.sDiv).html(n).attr(h),l=!0):"get"===e&&(g[a]=b("tr.footrow td:eq("+d+")",k.grid.sDiv).html())})});return"get"===e?g:l},showHideCol:function(e,f){return this.each(function(){var c=this,d=!1,a=b.jgrid.cell_width?0:c.p.cellLayout,l;if(c.grid){"string"===typeof e&&(e=[e]);f="none"!==f?"":"none";var g=""===f?!0:!1,h=c.p.groupHeader&&("object"===typeof c.p.groupHeader||b.isFunction(c.p.groupHeader));h&&b(c).jqGrid("destroyGroupHeader",!1);b(this.p.colModel).each(function(h){if(-1!==b.inArray(this.name,
|
||||
e)&&this.hidden===g){if(!0===c.p.frozenColumns&&!0===this.frozen)return!0;b("tr[role=rowheader]",c.grid.hDiv).each(function(){b(this.cells[h]).css("display",f)});b(c.rows).each(function(){b(this).hasClass("jqgroup")||b(this.cells[h]).css("display",f)});c.p.footerrow&&b("tr.footrow td:eq("+h+")",c.grid.sDiv).css("display",f);l=parseInt(this.width,10);c.p.tblwidth="none"===f?c.p.tblwidth-(l+a):c.p.tblwidth+(l+a);this.hidden=!g;d=!0;b(c).triggerHandler("jqGridShowHideCol",[g,this.name,h])}});!0===d&&
|
||||
(!0!==c.p.shrinkToFit||isNaN(c.p.height)||(c.p.tblwidth+=parseInt(c.p.scrollOffset,10)),b(c).jqGrid("setGridWidth",!0===c.p.shrinkToFit?c.p.tblwidth:c.p.width));h&&b(c).jqGrid("setGroupHeaders",c.p.groupHeader)}})},hideCol:function(e){return this.each(function(){b(this).jqGrid("showHideCol",e,"none")})},showCol:function(e){return this.each(function(){b(this).jqGrid("showHideCol",e,"")})},remapColumns:function(e,f,c){function d(a){var c;c=a.length?b.makeArray(a):b.extend({},a);b.each(e,function(b){a[b]=
|
||||
c[this]})}function a(a,c){b(">tr"+(c||""),a).each(function(){var a=this,c=b.makeArray(a.cells);b.each(e,function(){var b=c[this];b&&a.appendChild(b)})})}var l=this.get(0);d(l.p.colModel);d(l.p.colNames);d(l.grid.headers);a(b("thead:first",l.grid.hDiv),c&&":not(.ui-jqgrid-labels)");f&&a(b("#"+b.jgrid.jqID(l.p.id)+" tbody:first"),".jqgfirstrow, tr.jqgrow, tr.jqfoot");l.p.footerrow&&a(b("tbody:first",l.grid.sDiv));l.p.remapColumns&&(l.p.remapColumns.length?d(l.p.remapColumns):l.p.remapColumns=b.makeArray(e));
|
||||
l.p.lastsort=b.inArray(l.p.lastsort,e);l.p.treeGrid&&(l.p.expColInd=b.inArray(l.p.expColInd,e));b(l).triggerHandler("jqGridRemapColumns",[e,f,c])},setGridWidth:function(e,f){return this.each(function(){if(this.grid){var c=this,d,a=0,l=b.jgrid.cell_width?0:c.p.cellLayout,g,h=0,k=!1,n=c.p.scrollOffset,m,r=0,p;"boolean"!==typeof f&&(f=c.p.shrinkToFit);if(!isNaN(e)){e=parseInt(e,10);c.grid.width=c.p.width=e;b("#gbox_"+b.jgrid.jqID(c.p.id)).css("width",e+"px");b("#gview_"+b.jgrid.jqID(c.p.id)).css("width",
|
||||
e+"px");b(c.grid.bDiv).css("width",e+"px");b(c.grid.hDiv).css("width",e+"px");c.p.pager&&b(c.p.pager).css("width",e+"px");c.p.toppager&&b(c.p.toppager).css("width",e+"px");!0===c.p.toolbar[0]&&(b(c.grid.uDiv).css("width",e+"px"),"both"===c.p.toolbar[1]&&b(c.grid.ubDiv).css("width",e+"px"));c.p.footerrow&&b(c.grid.sDiv).css("width",e+"px");!1===f&&!0===c.p.forceFit&&(c.p.forceFit=!1);if(!0===f){b.each(c.p.colModel,function(){!1===this.hidden&&(d=this.widthOrg,a+=d+l,this.fixed?r+=d+l:h++)});if(0===
|
||||
h)return;c.p.tblwidth=a;m=e-l*h-r;!isNaN(c.p.height)&&(b(c.grid.bDiv)[0].clientHeight<b(c.grid.bDiv)[0].scrollHeight||1===c.rows.length)&&(k=!0,m-=n);var a=0,q=0<c.grid.cols.length;b.each(c.p.colModel,function(b){!1!==this.hidden||this.fixed||(d=this.widthOrg,d=Math.round(m*d/(c.p.tblwidth-l*h-r)),0>d||(this.width=d,a+=d,c.grid.headers[b].width=d,c.grid.headers[b].el.style.width=d+"px",c.p.footerrow&&(c.grid.footers[b].style.width=d+"px"),q&&(c.grid.cols[b].style.width=d+"px"),g=b))});if(!g)return;
|
||||
p=0;k?e-r-(a+l*h)!==n&&(p=e-r-(a+l*h)-n):1!==Math.abs(e-r-(a+l*h))&&(p=e-r-(a+l*h));c.p.colModel[g].width+=p;c.p.tblwidth=a+p+l*h+r;c.p.tblwidth>e?(k=c.p.tblwidth-parseInt(e,10),c.p.tblwidth=e,d=c.p.colModel[g].width-=k):d=c.p.colModel[g].width;c.grid.headers[g].width=d;c.grid.headers[g].el.style.width=d+"px";q&&(c.grid.cols[g].style.width=d+"px");c.p.footerrow&&(c.grid.footers[g].style.width=d+"px")}c.p.tblwidth&&(b("table:first",c.grid.bDiv).css("width",c.p.tblwidth+"px"),b("table:first",c.grid.hDiv).css("width",
|
||||
c.p.tblwidth+"px"),c.grid.hDiv.scrollLeft=c.grid.bDiv.scrollLeft,c.p.footerrow&&b("table:first",c.grid.sDiv).css("width",c.p.tblwidth+"px"))}}})},setGridHeight:function(e){return this.each(function(){if(this.grid){var f=b(this.grid.bDiv);f.css({height:e+(isNaN(e)?"":"px")});!0===this.p.frozenColumns&&b("#"+b.jgrid.jqID(this.p.id)+"_frozen").parent().height(f.height()-16);this.p.height=e;this.p.scroll&&this.grid.populateVisible()}})},setCaption:function(e){return this.each(function(){this.p.caption=
|
||||
e;b("span.ui-jqgrid-title, span.ui-jqgrid-title-rtl",this.grid.cDiv).html(e);b(this.grid.cDiv).show()})},setLabel:function(e,f,c,d){return this.each(function(){var a=-1;if(this.grid&&void 0!==e&&(b(this.p.colModel).each(function(b){if(this.name===e)return a=b,!1}),0<=a)){var l=b("tr.ui-jqgrid-labels th:eq("+a+")",this.grid.hDiv);if(f){var g=b(".s-ico",l);b("[id^=jqgh_]",l).empty().html(f).append(g);this.p.colNames[a]=f}c&&("string"===typeof c?b(l).addClass(c):b(l).css(c));"object"===typeof d&&b(l).attr(d)}})},
|
||||
setCell:function(e,f,c,d,a,l){return this.each(function(){var g=-1,h,k;if(this.grid&&(isNaN(f)?b(this.p.colModel).each(function(a){if(this.name===f)return g=a,!1}):g=parseInt(f,10),0<=g&&(h=b(this).jqGrid("getGridRowById",e)))){var n=b("td:eq("+g+")",h);if(""!==c||!0===l)h=this.formatter(e,c,g,h,"edit"),k=this.p.colModel[g].title?{title:b.jgrid.stripHtml(h)}:{},this.p.treeGrid&&0<b(".tree-wrap",b(n)).length?b("span",b(n)).html(h).attr(k):b(n).html(h).attr(k),"local"===this.p.datatype&&(h=this.p.colModel[g],
|
||||
c=h.formatter&&"string"===typeof h.formatter&&"date"===h.formatter?b.unformat.date.call(this,c,h):c,k=this.p._index[b.jgrid.stripPref(this.p.idPrefix,e)],void 0!==k&&(this.p.data[k][h.name]=c));"string"===typeof d?b(n).addClass(d):d&&b(n).css(d);"object"===typeof a&&b(n).attr(a)}})},getCell:function(e,f){var c=!1;this.each(function(){var d=-1;if(this.grid&&(isNaN(f)?b(this.p.colModel).each(function(a){if(this.name===f)return d=a,!1}):d=parseInt(f,10),0<=d)){var a=b(this).jqGrid("getGridRowById",e);
|
||||
if(a)try{c=b.unformat.call(this,b("td:eq("+d+")",a),{rowId:a.id,colModel:this.p.colModel[d]},d)}catch(l){c=b.jgrid.htmlDecode(b("td:eq("+d+")",a).html())}}});return c},getCol:function(e,f,c){var d=[],a,l=0,g,h,k;f="boolean"!==typeof f?!1:f;void 0===c&&(c=!1);this.each(function(){var n=-1;if(this.grid&&(isNaN(e)?b(this.p.colModel).each(function(a){if(this.name===e)return n=a,!1}):n=parseInt(e,10),0<=n)){var m=this.rows.length,r=0,p=0;if(m&&0<m){for(;r<m;){if(b(this.rows[r]).hasClass("jqgrow")){try{a=
|
||||
b.unformat.call(this,b(this.rows[r].cells[n]),{rowId:this.rows[r].id,colModel:this.p.colModel[n]},n)}catch(q){a=b.jgrid.htmlDecode(this.rows[r].cells[n].innerHTML)}c?(k=parseFloat(a),isNaN(k)||(l+=k,void 0===h&&(h=g=k),g=Math.min(g,k),h=Math.max(h,k),p++)):f?d.push({id:this.rows[r].id,value:a}):d.push(a)}r++}if(c)switch(c.toLowerCase()){case "sum":d=l;break;case "avg":d=l/p;break;case "count":d=m-1;break;case "min":d=g;break;case "max":d=h}}}});return d},clearGridData:function(e){return this.each(function(){if(this.grid){"boolean"!==
|
||||
typeof e&&(e=!1);if(this.p.deepempty)b("#"+b.jgrid.jqID(this.p.id)+" tbody:first tr:gt(0)").remove();else{var f=b("#"+b.jgrid.jqID(this.p.id)+" tbody:first tr:first")[0];b("#"+b.jgrid.jqID(this.p.id)+" tbody:first").empty().append(f)}this.p.footerrow&&e&&b(".ui-jqgrid-ftable td",this.grid.sDiv).html(" ");this.p.selrow=null;this.p.selarrrow=[];this.p.savedRow=[];this.p.records=0;this.p.page=1;this.p.lastpage=0;this.p.reccount=0;this.p.data=[];this.p._index={};this.updatepager(!0,!1)}})},getInd:function(e,
|
||||
f){var c=!1,d;this.each(function(){(d=b(this).jqGrid("getGridRowById",e))&&(c=!0===f?d:d.rowIndex)});return c},bindKeys:function(e){var f=b.extend({onEnter:null,onSpace:null,onLeftKey:null,onRightKey:null,scrollingRows:!0},e||{});return this.each(function(){var c=this;b("body").is("[role]")||b("body").attr("role","application");c.p.scrollrows=f.scrollingRows;b(c).keydown(function(d){var a=b(c).find("tr[tabindex=0]")[0],e,g,h,k=c.p.treeReader.expanded_field;if(a)if(h=c.p._index[b.jgrid.stripPref(c.p.idPrefix,
|
||||
a.id)],37===d.keyCode||38===d.keyCode||39===d.keyCode||40===d.keyCode){if(38===d.keyCode){g=a.previousSibling;e="";if(g)if(b(g).is(":hidden"))for(;g;){if(g=g.previousSibling,!b(g).is(":hidden")&&b(g).hasClass("jqgrow")){e=g.id;break}}else e=g.id;b(c).jqGrid("setSelection",e,!0,d);d.preventDefault()}if(40===d.keyCode){g=a.nextSibling;e="";if(g)if(b(g).is(":hidden"))for(;g;){if(g=g.nextSibling,!b(g).is(":hidden")&&b(g).hasClass("jqgrow")){e=g.id;break}}else e=g.id;b(c).jqGrid("setSelection",e,!0,d);
|
||||
d.preventDefault()}37===d.keyCode&&(c.p.treeGrid&&c.p.data[h][k]&&b(a).find("div.treeclick").trigger("click"),b(c).triggerHandler("jqGridKeyLeft",[c.p.selrow]),b.isFunction(f.onLeftKey)&&f.onLeftKey.call(c,c.p.selrow));39===d.keyCode&&(c.p.treeGrid&&!c.p.data[h][k]&&b(a).find("div.treeclick").trigger("click"),b(c).triggerHandler("jqGridKeyRight",[c.p.selrow]),b.isFunction(f.onRightKey)&&f.onRightKey.call(c,c.p.selrow))}else 13===d.keyCode?(b(c).triggerHandler("jqGridKeyEnter",[c.p.selrow]),b.isFunction(f.onEnter)&&
|
||||
f.onEnter.call(c,c.p.selrow)):32===d.keyCode&&(b(c).triggerHandler("jqGridKeySpace",[c.p.selrow]),b.isFunction(f.onSpace)&&f.onSpace.call(c,c.p.selrow))})})},unbindKeys:function(){return this.each(function(){b(this).unbind("keydown")})},getLocalRow:function(e){var f=!1,c;this.each(function(){void 0!==e&&(c=this.p._index[b.jgrid.stripPref(this.p.idPrefix,e)],0<=c&&(f=this.p.data[c]))});return f}})})(jQuery);
|
||||
(function(a){a.fmatter={};a.extend(a.fmatter,{isBoolean:function(a){return"boolean"===typeof a},isObject:function(c){return c&&("object"===typeof c||a.isFunction(c))||!1},isString:function(a){return"string"===typeof a},isNumber:function(a){return"number"===typeof a&&isFinite(a)},isValue:function(a){return this.isObject(a)||this.isString(a)||this.isNumber(a)||this.isBoolean(a)},isEmpty:function(c){if(!this.isString(c)&&this.isValue(c))return!1;if(!this.isValue(c))return!0;c=a.trim(c).replace(/\ \;/ig,
|
||||
"").replace(/\ \;/ig,"");return""===c}});a.fn.fmatter=function(c,b,d,e,f){var g=b;d=a.extend({},a.jgrid.formatter,d);try{g=a.fn.fmatter[c].call(this,b,d,e,f)}catch(h){}return g};a.fmatter.util={NumberFormat:function(c,b){a.fmatter.isNumber(c)||(c*=1);if(a.fmatter.isNumber(c)){var d=0>c,e=String(c),f=b.decimalSeparator||".",g;if(a.fmatter.isNumber(b.decimalPlaces)){var h=b.decimalPlaces,e=Math.pow(10,h),e=String(Math.round(c*e)/e);g=e.lastIndexOf(".");if(0<h)for(0>g?(e+=f,g=e.length-1):"."!==f&&
|
||||
(e=e.replace(".",f));e.length-1-g<h;)e+="0"}if(b.thousandsSeparator){h=b.thousandsSeparator;g=e.lastIndexOf(f);g=-1<g?g:e.length;var f=e.substring(g),l=-1,k;for(k=g;0<k;k--)l++,0===l%3&&k!==g&&(!d||1<k)&&(f=h+f),f=e.charAt(k-1)+f;e=f}e=b.prefix?b.prefix+e:e;return e=b.suffix?e+b.suffix:e}return c}};a.fn.fmatter.defaultFormat=function(c,b){return a.fmatter.isValue(c)&&""!==c?c:b.defaultValue||" "};a.fn.fmatter.email=function(c,b){return a.fmatter.isEmpty(c)?a.fn.fmatter.defaultFormat(c,b):'<a href="mailto:'+
|
||||
c+'">'+c+"</a>"};a.fn.fmatter.checkbox=function(c,b){var d=a.extend({},b.checkbox),e;void 0!==b.colModel&&void 0!==b.colModel.formatoptions&&(d=a.extend({},d,b.colModel.formatoptions));e=!0===d.disabled?'disabled="disabled"':"";if(a.fmatter.isEmpty(c)||void 0===c)c=a.fn.fmatter.defaultFormat(c,d);c=String(c);c=(c+"").toLowerCase();return'<input type="checkbox" '+(0>c.search(/(false|f|0|no|n|off|undefined)/i)?" checked='checked' ":"")+' value="'+c+'" offval="no" '+e+"/>"};a.fn.fmatter.link=function(c,
|
||||
b){var d={target:b.target},e="";void 0!==b.colModel&&void 0!==b.colModel.formatoptions&&(d=a.extend({},d,b.colModel.formatoptions));d.target&&(e="target="+d.target);return a.fmatter.isEmpty(c)?a.fn.fmatter.defaultFormat(c,b):"<a "+e+' href="'+c+'">'+c+"</a>"};a.fn.fmatter.showlink=function(c,b){var d={baseLinkUrl:b.baseLinkUrl,showAction:b.showAction,addParam:b.addParam||"",target:b.target,idName:b.idName},e="";void 0!==b.colModel&&void 0!==b.colModel.formatoptions&&(d=a.extend({},d,b.colModel.formatoptions));
|
||||
d.target&&(e="target="+d.target);d=d.baseLinkUrl+d.showAction+"?"+d.idName+"="+b.rowId+d.addParam;return a.fmatter.isString(c)||a.fmatter.isNumber(c)?"<a "+e+' href="'+d+'">'+c+"</a>":a.fn.fmatter.defaultFormat(c,b)};a.fn.fmatter.integer=function(c,b){var d=a.extend({},b.integer);void 0!==b.colModel&&void 0!==b.colModel.formatoptions&&(d=a.extend({},d,b.colModel.formatoptions));return a.fmatter.isEmpty(c)?d.defaultValue:a.fmatter.util.NumberFormat(c,d)};a.fn.fmatter.number=function(c,b){var d=a.extend({},
|
||||
b.number);void 0!==b.colModel&&void 0!==b.colModel.formatoptions&&(d=a.extend({},d,b.colModel.formatoptions));return a.fmatter.isEmpty(c)?d.defaultValue:a.fmatter.util.NumberFormat(c,d)};a.fn.fmatter.currency=function(c,b){var d=a.extend({},b.currency);void 0!==b.colModel&&void 0!==b.colModel.formatoptions&&(d=a.extend({},d,b.colModel.formatoptions));return a.fmatter.isEmpty(c)?d.defaultValue:a.fmatter.util.NumberFormat(c,d)};a.fn.fmatter.date=function(c,b,d,e){d=a.extend({},b.date);void 0!==b.colModel&&
|
||||
void 0!==b.colModel.formatoptions&&(d=a.extend({},d,b.colModel.formatoptions));return d.reformatAfterEdit||"edit"!==e?a.fmatter.isEmpty(c)?a.fn.fmatter.defaultFormat(c,b):a.jgrid.parseDate(d.srcformat,c,d.newformat,d):a.fn.fmatter.defaultFormat(c,b)};a.fn.fmatter.select=function(c,b){c=String(c);var d=!1,e=[],f,g;void 0!==b.colModel.formatoptions?(d=b.colModel.formatoptions.value,f=void 0===b.colModel.formatoptions.separator?":":b.colModel.formatoptions.separator,g=void 0===b.colModel.formatoptions.delimiter?
|
||||
";":b.colModel.formatoptions.delimiter):void 0!==b.colModel.editoptions&&(d=b.colModel.editoptions.value,f=void 0===b.colModel.editoptions.separator?":":b.colModel.editoptions.separator,g=void 0===b.colModel.editoptions.delimiter?";":b.colModel.editoptions.delimiter);if(d){var h=!0===b.colModel.editoptions.multiple?!0:!1,l=[];h&&(l=c.split(","),l=a.map(l,function(b){return a.trim(b)}));if(a.fmatter.isString(d)){var k=d.split(g),m=0,n;for(n=0;n<k.length;n++)if(g=k[n].split(f),2<g.length&&(g[1]=a.map(g,
|
||||
function(a,b){if(0<b)return a}).join(f)),h)-1<a.inArray(g[0],l)&&(e[m]=g[1],m++);else if(a.trim(g[0])===a.trim(c)){e[0]=g[1];break}}else a.fmatter.isObject(d)&&(h?e=a.map(l,function(a){return d[a]}):e[0]=d[c]||"")}c=e.join(", ");return""===c?a.fn.fmatter.defaultFormat(c,b):c};a.fn.fmatter.rowactions=function(c){var b=a(this).closest("tr.jqgrow"),d=b.attr("id"),e=a(this).closest("table.ui-jqgrid-btable").attr("id").replace(/_frozen([^_]*)$/,"$1"),e=a("#"+e),f=e[0],g=f.p,h=g.colModel[a.jgrid.getCellIndex(this)],
|
||||
l=h.frozen?a("tr#"+d+" td:eq("+a.jgrid.getCellIndex(this)+") > div",e):a(this).parent(),k={extraparam:{}},m=function(b){a.isFunction(k.afterRestore)&&k.afterRestore.call(f,b);l.find("div.ui-inline-edit,div.ui-inline-del").show();l.find("div.ui-inline-save,div.ui-inline-cancel").hide()};void 0!==h.formatoptions&&(k=a.extend(k,h.formatoptions));void 0!==g.editOptions&&(k.editOptions=g.editOptions);void 0!==g.delOptions&&(k.delOptions=g.delOptions);b.hasClass("jqgrid-new-row")&&(k.extraparam[g.prmNames.oper]=
|
||||
g.prmNames.addoper);b={keys:k.keys,oneditfunc:k.onEdit,successfunc:k.onSuccess,url:k.url,extraparam:k.extraparam,aftersavefunc:function(b,c){a.isFunction(k.afterSave)&&k.afterSave.call(f,b,c);l.find("div.ui-inline-edit,div.ui-inline-del").show();l.find("div.ui-inline-save,div.ui-inline-cancel").hide()},errorfunc:k.onError,afterrestorefunc:m,restoreAfterError:k.restoreAfterError,mtype:k.mtype};switch(c){case "edit":e.jqGrid("editRow",d,b);l.find("div.ui-inline-edit,div.ui-inline-del").hide();l.find("div.ui-inline-save,div.ui-inline-cancel").show();
|
||||
e.triggerHandler("jqGridAfterGridComplete");break;case "save":e.jqGrid("saveRow",d,b)&&(l.find("div.ui-inline-edit,div.ui-inline-del").show(),l.find("div.ui-inline-save,div.ui-inline-cancel").hide(),e.triggerHandler("jqGridAfterGridComplete"));break;case "cancel":e.jqGrid("restoreRow",d,m);l.find("div.ui-inline-edit,div.ui-inline-del").show();l.find("div.ui-inline-save,div.ui-inline-cancel").hide();e.triggerHandler("jqGridAfterGridComplete");break;case "del":e.jqGrid("delGridRow",d,k.delOptions);
|
||||
break;case "formedit":e.jqGrid("setSelection",d),e.jqGrid("editGridRow",d,k.editOptions)}};a.fn.fmatter.actions=function(c,b){var d={keys:!1,editbutton:!0,delbutton:!0,editformbutton:!1},e=b.rowId,f="";void 0!==b.colModel.formatoptions&&(d=a.extend(d,b.colModel.formatoptions));if(void 0===e||a.fmatter.isEmpty(e))return"";d.editformbutton?f+="<div title='"+a.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+("id='jEditButton_"+e+"' onclick=jQuery.fn.fmatter.rowactions.call(this,'formedit'); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ")+
|
||||
"><span class='ui-icon ui-icon-pencil'></span></div>":d.editbutton&&(f+="<div title='"+a.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+("id='jEditButton_"+e+"' onclick=jQuery.fn.fmatter.rowactions.call(this,'edit'); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover') ")+"><span class='ui-icon ui-icon-pencil'></span></div>");d.delbutton&&(f+="<div title='"+a.jgrid.nav.deltitle+"' style='float:left;margin-left:5px;' class='ui-pg-div ui-inline-del' "+
|
||||
("id='jDeleteButton_"+e+"' onclick=jQuery.fn.fmatter.rowactions.call(this,'del'); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ")+"><span class='ui-icon ui-icon-trash'></span></div>");f+="<div title='"+a.jgrid.edit.bSubmit+"' style='float:left;display:none' class='ui-pg-div ui-inline-save' "+("id='jSaveButton_"+e+"' onclick=jQuery.fn.fmatter.rowactions.call(this,'save'); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ")+
|
||||
"><span class='ui-icon ui-icon-disk'></span></div>";f+="<div title='"+a.jgrid.edit.bCancel+"' style='float:left;display:none;margin-left:5px;' class='ui-pg-div ui-inline-cancel' "+("id='jCancelButton_"+e+"' onclick=jQuery.fn.fmatter.rowactions.call(this,'cancel'); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ")+"><span class='ui-icon ui-icon-cancel'></span></div>";return"<div style='margin-left:8px;'>"+f+"</div>"};a.unformat=function(c,
|
||||
b,d,e){var f,g=b.colModel.formatter,h=b.colModel.formatoptions||{},l=/([\.\*\_\'\(\)\{\}\+\?\\])/g,k=b.colModel.unformat||a.fn.fmatter[g]&&a.fn.fmatter[g].unformat;if(void 0!==k&&a.isFunction(k))f=k.call(this,a(c).text(),b,c);else if(void 0!==g&&a.fmatter.isString(g))switch(f=a.jgrid.formatter||{},g){case "integer":h=a.extend({},f.integer,h);b=h.thousandsSeparator.replace(l,"\\$1");b=RegExp(b,"g");f=a(c).text().replace(b,"");break;case "number":h=a.extend({},f.number,h);b=h.thousandsSeparator.replace(l,
|
||||
"\\$1");b=RegExp(b,"g");f=a(c).text().replace(b,"").replace(h.decimalSeparator,".");break;case "currency":h=a.extend({},f.currency,h);b=h.thousandsSeparator.replace(l,"\\$1");b=RegExp(b,"g");f=a(c).text();h.prefix&&h.prefix.length&&(f=f.substr(h.prefix.length));h.suffix&&h.suffix.length&&(f=f.substr(0,f.length-h.suffix.length));f=f.replace(b,"").replace(h.decimalSeparator,".");break;case "checkbox":h=b.colModel.editoptions?b.colModel.editoptions.value.split(":"):["Yes","No"];f=a("input",c).is(":checked")?
|
||||
h[0]:h[1];break;case "select":f=a.unformat.select(c,b,d,e);break;case "actions":return"";default:f=a(c).text()}return void 0!==f?f:!0===e?a(c).text():a.jgrid.htmlDecode(a(c).html())};a.unformat.select=function(c,b,d,e){d=[];c=a(c).text();if(!0===e)return c;e=a.extend({},void 0!==b.colModel.formatoptions?b.colModel.formatoptions:b.colModel.editoptions);b=void 0===e.separator?":":e.separator;var f=void 0===e.delimiter?";":e.delimiter;if(e.value){var g=e.value;e=!0===e.multiple?!0:!1;var h=[];e&&(h=
|
||||
c.split(","),h=a.map(h,function(b){return a.trim(b)}));if(a.fmatter.isString(g)){var l=g.split(f),k=0,m;for(m=0;m<l.length;m++)if(f=l[m].split(b),2<f.length&&(f[1]=a.map(f,function(a,b){if(0<b)return a}).join(b)),e)-1<a.inArray(f[1],h)&&(d[k]=f[0],k++);else if(a.trim(f[1])===a.trim(c)){d[0]=f[0];break}}else if(a.fmatter.isObject(g)||a.isArray(g))e||(h[0]=c),d=a.map(h,function(b){var c;a.each(g,function(a,d){if(d===b)return c=a,!1});if(void 0!==c)return c});return d.join(", ")}return c||""};a.unformat.date=
|
||||
function(c,b){var d=a.jgrid.formatter.date||{};void 0!==b.formatoptions&&(d=a.extend({},d,b.formatoptions));return a.fmatter.isEmpty(c)?a.fn.fmatter.defaultFormat(c,b):a.jgrid.parseDate(d.newformat,c,d.srcformat,d)}})(jQuery);
|
||||
(function(a){a.jgrid.extend({getColProp:function(a){var c={},d=this[0];if(!d.grid)return!1;var d=d.p.colModel,h;for(h=0;h<d.length;h++)if(d[h].name===a){c=d[h];break}return c},setColProp:function(b,c){return this.each(function(){if(this.grid&&c){var d=this.p.colModel,h;for(h=0;h<d.length;h++)if(d[h].name===b){a.extend(!0,this.p.colModel[h],c);break}}})},sortGrid:function(a,c,d){return this.each(function(){var h=-1,k,e=!1;if(this.grid){a||(a=this.p.sortname);for(k=0;k<this.p.colModel.length;k++)if(this.p.colModel[k].index===
|
||||
a||this.p.colModel[k].name===a){h=k;!0===this.p.frozenColumns&&!0===this.p.colModel[k].frozen&&(e=this.grid.fhDiv.find("#"+this.p.id+"_"+a));break}-1!==h&&(k=this.p.colModel[h].sortable,e||(e=this.grid.headers[h].el),"boolean"!==typeof k&&(k=!0),"boolean"!==typeof c&&(c=!1),k&&this.sortData("jqgh_"+this.p.id+"_"+a,h,c,d,e))}})},clearBeforeUnload:function(){return this.each(function(){var b=this.grid;a.isFunction(b.emptyRows)&&b.emptyRows.call(this,!0,!0);a(document).unbind("mouseup.jqGrid"+this.p.id);
|
||||
a(b.hDiv).unbind("mousemove");a(this).unbind();b.dragEnd=null;b.dragMove=null;b.dragStart=null;b.emptyRows=null;b.populate=null;b.populateVisible=null;b.scrollGrid=null;b.selectionPreserver=null;b.bDiv=null;b.cDiv=null;b.hDiv=null;b.cols=null;var c,d=b.headers.length;for(c=0;c<d;c++)b.headers[c].el=null;this.grid=this.addJSONData=this.addXmlData=this.formatter=this.constructTr=this.setHeadCheckBox=this.refreshIndex=this.updatepager=this.sortData=this.formatCol=null})},GridDestroy:function(){return this.each(function(){if(this.grid){this.p.pager&&
|
||||
a(this.p.pager).remove();try{a(this).jqGrid("clearBeforeUnload"),a("#gbox_"+a.jgrid.jqID(this.id)).remove()}catch(b){}}})},GridUnload:function(){return this.each(function(){if(this.grid){var b=a(this).attr("id"),c=a(this).attr("class");this.p.pager&&a(this.p.pager).empty().removeClass("ui-state-default ui-jqgrid-pager ui-corner-bottom");var d=document.createElement("table");a(d).attr({id:b});d.className=c;b=a.jgrid.jqID(this.id);a(d).removeClass("ui-jqgrid-btable");1===a(this.p.pager).parents("#gbox_"+
|
||||
b).length?(a(d).insertBefore("#gbox_"+b).show(),a(this.p.pager).insertBefore("#gbox_"+b)):a(d).insertBefore("#gbox_"+b).show();a(this).jqGrid("clearBeforeUnload");a("#gbox_"+b).remove()}})},setGridState:function(b){return this.each(function(){this.grid&&("hidden"===b?(a(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv","#gview_"+a.jgrid.jqID(this.p.id)).slideUp("fast"),this.p.pager&&a(this.p.pager).slideUp("fast"),this.p.toppager&&a(this.p.toppager).slideUp("fast"),!0===this.p.toolbar[0]&&("both"===this.p.toolbar[1]&&
|
||||
a(this.grid.ubDiv).slideUp("fast"),a(this.grid.uDiv).slideUp("fast")),this.p.footerrow&&a(".ui-jqgrid-sdiv","#gbox_"+a.jgrid.jqID(this.p.id)).slideUp("fast"),a(".ui-jqgrid-titlebar-close span",this.grid.cDiv).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s"),this.p.gridstate="hidden"):"visible"===b&&(a(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv","#gview_"+a.jgrid.jqID(this.p.id)).slideDown("fast"),this.p.pager&&a(this.p.pager).slideDown("fast"),this.p.toppager&&a(this.p.toppager).slideDown("fast"),
|
||||
!0===this.p.toolbar[0]&&("both"===this.p.toolbar[1]&&a(this.grid.ubDiv).slideDown("fast"),a(this.grid.uDiv).slideDown("fast")),this.p.footerrow&&a(".ui-jqgrid-sdiv","#gbox_"+a.jgrid.jqID(this.p.id)).slideDown("fast"),a(".ui-jqgrid-titlebar-close span",this.grid.cDiv).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n"),this.p.gridstate="visible"))})},filterToolbar:function(b){b=a.extend({autosearch:!0,searchOnEnter:!0,beforeSearch:null,afterSearch:null,beforeClear:null,afterClear:null,
|
||||
searchurl:"",stringResult:!1,groupOp:"AND",defaultSearch:"bw",searchOperators:!1,resetIcon:"x",operands:{eq:"==",ne:"!",lt:"<",le:"<=",gt:">",ge:">=",bw:"^",bn:"!^","in":"=",ni:"!=",ew:"|",en:"!@",cn:"~",nc:"!~",nu:"#",nn:"!#"}},a.jgrid.search,b||{});return this.each(function(){var c=this;if(!this.ftoolbar){var d=function(){var d={},f=0,g,m,e={},q;a.each(c.p.colModel,function(){var l=a("#gs_"+a.jgrid.jqID(this.name),!0===this.frozen&&!0===c.p.frozenColumns?c.grid.fhDiv:c.grid.hDiv);m=this.index||
|
||||
this.name;q=b.searchOperators?l.parent().prev().children("a").attr("soper")||b.defaultSearch:this.searchoptions&&this.searchoptions.sopt?this.searchoptions.sopt[0]:"select"===this.stype?"eq":b.defaultSearch;if((g="custom"===this.stype&&a.isFunction(this.searchoptions.custom_value)&&0<l.length&&"SPAN"===l[0].nodeName.toUpperCase()?this.searchoptions.custom_value.call(c,l.children(".customelement:first"),"get"):l.val())||"nu"===q||"nn"===q)d[m]=g,e[m]=q,f++;else try{delete c.p.postData[m]}catch(k){}});
|
||||
var k=0<f?!0:!1;if(!0===b.stringResult||"local"===c.p.datatype){var l='{"groupOp":"'+b.groupOp+'","rules":[',n=0;a.each(d,function(a,b){0<n&&(l+=",");l+='{"field":"'+a+'",';l+='"op":"'+e[a]+'",';l+='"data":"'+(b+"").replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"}';n++});l+="]}";a.extend(c.p.postData,{filters:l});a.each(["searchField","searchString","searchOper"],function(a,b){c.p.postData.hasOwnProperty(b)&&delete c.p.postData[b]})}else a.extend(c.p.postData,d);var r;c.p.searchurl&&(r=c.p.url,a(c).jqGrid("setGridParam",
|
||||
{url:c.p.searchurl}));var h="stop"===a(c).triggerHandler("jqGridToolbarBeforeSearch")?!0:!1;!h&&a.isFunction(b.beforeSearch)&&(h=b.beforeSearch.call(c));h||a(c).jqGrid("setGridParam",{search:k}).trigger("reloadGrid",[{page:1}]);r&&a(c).jqGrid("setGridParam",{url:r});a(c).triggerHandler("jqGridToolbarAfterSearch");a.isFunction(b.afterSearch)&&b.afterSearch.call(c)},h=function(e,f,g){a("#sopt_menu").remove();f=parseInt(f,10);g=parseInt(g,10)+18;f='<ul id="sopt_menu" class="ui-search-menu" role="menu" tabindex="0" style="font-size:'+
|
||||
(a(".ui-jqgrid-view").css("font-size")||"11px")+";left:"+f+"px;top:"+g+'px;">';g=a(e).attr("soper");var k,h=[],q,p=0,l=a(e).attr("colname");for(k=c.p.colModel.length;p<k&&c.p.colModel[p].name!==l;)p++;p=c.p.colModel[p];l=a.extend({},p.searchoptions);l.sopt||(l.sopt=[],l.sopt[0]="select"===p.stype?"eq":b.defaultSearch);a.each(b.odata,function(){h.push(this.oper)});for(p=0;p<l.sopt.length;p++)q=a.inArray(l.sopt[p],h),-1!==q&&(k=g===b.odata[q].oper?"ui-state-highlight":"",f+='<li class="ui-menu-item '+
|
||||
k+'" role="presentation"><a class="ui-corner-all g-menu-item" tabindex="0" role="menuitem" value="'+b.odata[q].oper+'" oper="'+b.operands[b.odata[q].oper]+'"><table cellspacing="0" cellpadding="0" border="0"><tr><td width="25px">'+b.operands[b.odata[q].oper]+"</td><td>"+b.odata[q].text+"</td></tr></table></a></li>");f+="</ul>";a("body").append(f);a("#sopt_menu").addClass("ui-menu ui-widget ui-widget-content ui-corner-all");a("#sopt_menu > li > a").hover(function(){a(this).addClass("ui-state-hover")},
|
||||
function(){a(this).removeClass("ui-state-hover")}).click(function(f){f=a(this).attr("value");var g=a(this).attr("oper");a(c).triggerHandler("jqGridToolbarSelectOper",[f,g,e]);a("#sopt_menu").hide();a(e).text(g).attr("soper",f);!0===b.autosearch&&(g=a(e).parent().next().children()[0],(a(g).val()||"nu"===f||"nn"===f)&&d())})},k=a("<tr class='ui-search-toolbar' role='rowheader'></tr>"),e;a.each(c.p.colModel,function(h){var f=this,g,m;m="";var x="=",q,p=a("<th role='columnheader' class='ui-state-default ui-th-column ui-th-"+
|
||||
c.p.direction+"'></th>"),l=a("<div style='position:relative;height:100%;padding-right:0.3em;padding-left:0.3em;'></div>"),n=a("<table class='ui-search-table' cellspacing='0'><tr><td class='ui-search-oper'></td><td class='ui-search-input'></td><td class='ui-search-clear'></td></tr></table>");!0===this.hidden&&a(p).css("display","none");this.search=!1===this.search?!1:!0;void 0===this.stype&&(this.stype="text");g=a.extend({},this.searchoptions||{});if(this.search){if(b.searchOperators){m=g.sopt?g.sopt[0]:
|
||||
"select"===f.stype?"eq":b.defaultSearch;for(q=0;q<b.odata.length;q++)if(b.odata[q].oper===m){x=b.operands[m]||"";break}m="<a title='"+(null!=g.searchtitle?g.searchtitle:b.operandTitle)+"' style='padding-right: 0.5em;' soper='"+m+"' class='soptclass' colname='"+this.name+"'>"+x+"</a>"}a("td:eq(0)",n).attr("colindex",h).append(m);void 0===g.clearSearch&&(g.clearSearch=!0);g.clearSearch?(m=b.resetTitle||"Clear Search Value",a("td:eq(2)",n).append("<a title='"+m+"' style='padding-right: 0.3em;padding-left: 0.3em;' class='clearsearchclass'>"+
|
||||
b.resetIcon+"</a>")):a("td:eq(2)",n).hide();switch(this.stype){case "select":if(m=this.surl||g.dataUrl)a(l).append(n),a.ajax(a.extend({url:m,dataType:"html",success:function(e){void 0!==g.buildSelect?(e=g.buildSelect(e))&&a("td:eq(1)",n).append(e):a("td:eq(1)",n).append(e);void 0!==g.defaultValue&&a("select",l).val(g.defaultValue);a("select",l).attr({name:f.index||f.name,id:"gs_"+f.name});g.attr&&a("select",l).attr(g.attr);a("select",l).css({width:"100%"});a.jgrid.bindEv.call(c,a("select",l)[0],g);
|
||||
!0===b.autosearch&&a("select",l).change(function(){d();return!1});e=null}},a.jgrid.ajaxOptions,c.p.ajaxSelectOptions||{}));else{var r,w,u;f.searchoptions?(r=void 0===f.searchoptions.value?"":f.searchoptions.value,w=void 0===f.searchoptions.separator?":":f.searchoptions.separator,u=void 0===f.searchoptions.delimiter?";":f.searchoptions.delimiter):f.editoptions&&(r=void 0===f.editoptions.value?"":f.editoptions.value,w=void 0===f.editoptions.separator?":":f.editoptions.separator,u=void 0===f.editoptions.delimiter?
|
||||
";":f.editoptions.delimiter);if(r){var t=document.createElement("select");t.style.width="100%";a(t).attr({name:f.index||f.name,id:"gs_"+f.name});var v;if("string"===typeof r)for(m=r.split(u),v=0;v<m.length;v++)r=m[v].split(w),u=document.createElement("option"),u.value=r[0],u.innerHTML=r[1],t.appendChild(u);else if("object"===typeof r)for(v in r)r.hasOwnProperty(v)&&(u=document.createElement("option"),u.value=v,u.innerHTML=r[v],t.appendChild(u));void 0!==g.defaultValue&&a(t).val(g.defaultValue);g.attr&&
|
||||
a(t).attr(g.attr);a(l).append(n);a.jgrid.bindEv.call(c,t,g);a("td:eq(1)",n).append(t);!0===b.autosearch&&a(t).change(function(){d();return!1})}}break;case "text":w=void 0!==g.defaultValue?g.defaultValue:"";a("td:eq(1)",n).append("<input type='text' style='width:100%;padding:0px;' name='"+(f.index||f.name)+"' id='gs_"+f.name+"' value='"+w+"'/>");a(l).append(n);g.attr&&a("input",l).attr(g.attr);a.jgrid.bindEv.call(c,a("input",l)[0],g);!0===b.autosearch&&(b.searchOnEnter?a("input",l).keypress(function(a){return 13===
|
||||
(a.charCode||a.keyCode||0)?(d(),!1):this}):a("input",l).keydown(function(a){switch(a.which){case 13:return!1;case 9:case 16:case 37:case 38:case 39:case 40:case 27:break;default:e&&clearTimeout(e),e=setTimeout(function(){d()},500)}}));break;case "custom":a("td:eq(1)",n).append("<span style='width:95%;padding:0px;' name='"+(f.index||f.name)+"' id='gs_"+f.name+"'/>");a(l).append(n);try{if(a.isFunction(g.custom_element))if(t=g.custom_element.call(c,void 0!==g.defaultValue?g.defaultValue:"",g))t=a(t).addClass("customelement"),
|
||||
a(l).find(">span").append(t);else throw"e2";else throw"e1";}catch(y){"e1"===y&&a.jgrid.info_dialog(a.jgrid.errors.errcap,"function 'custom_element' "+a.jgrid.edit.msg.nodefined,a.jgrid.edit.bClose),"e2"===y?a.jgrid.info_dialog(a.jgrid.errors.errcap,"function 'custom_element' "+a.jgrid.edit.msg.novalue,a.jgrid.edit.bClose):a.jgrid.info_dialog(a.jgrid.errors.errcap,"string"===typeof y?y:y.message,a.jgrid.edit.bClose)}}}a(p).append(l);a(k).append(p);b.searchOperators||a("td:eq(0)",n).hide()});a("table thead",
|
||||
c.grid.hDiv).append(k);b.searchOperators&&(a(".soptclass",k).click(function(b){var c=a(this).offset();h(this,c.left,c.top);b.stopPropagation()}),a("body").on("click",function(b){"soptclass"!==b.target.className&&a("#sopt_menu").hide()}));a(".clearsearchclass",k).click(function(e){e=a(this).parents("tr:first");var f=parseInt(a("td.ui-search-oper",e).attr("colindex"),10),g=a.extend({},c.p.colModel[f].searchoptions||{}),g=g.defaultValue?g.defaultValue:"";"select"===c.p.colModel[f].stype?g?a("td.ui-search-input select",
|
||||
e).val(g):a("td.ui-search-input select",e)[0].selectedIndex=0:a("td.ui-search-input input",e).val(g);!0===b.autosearch&&d()});this.ftoolbar=!0;this.triggerToolbar=d;this.clearToolbar=function(d){var f={},g=0,e;d="boolean"!==typeof d?!0:d;a.each(c.p.colModel,function(){var b,d=a("#gs_"+a.jgrid.jqID(this.name),!0===this.frozen&&!0===c.p.frozenColumns?c.grid.fhDiv:c.grid.hDiv);this.searchoptions&&void 0!==this.searchoptions.defaultValue&&(b=this.searchoptions.defaultValue);e=this.index||this.name;switch(this.stype){case "select":d.find("option").each(function(c){0===
|
||||
c&&(this.selected=!0);if(a(this).val()===b)return this.selected=!0,!1});if(void 0!==b)f[e]=b,g++;else try{delete c.p.postData[e]}catch(h){}break;case "text":d.val(b||"");if(void 0!==b)f[e]=b,g++;else try{delete c.p.postData[e]}catch(k){}break;case "custom":a.isFunction(this.searchoptions.custom_value)&&0<d.length&&"SPAN"===d[0].nodeName.toUpperCase()&&this.searchoptions.custom_value.call(c,d.children(".customelement:first"),"set",b||"")}});var k=0<g?!0:!1;c.p.resetsearch=!0;if(!0===b.stringResult||
|
||||
"local"===c.p.datatype){var h='{"groupOp":"'+b.groupOp+'","rules":[',p=0;a.each(f,function(a,b){0<p&&(h+=",");h+='{"field":"'+a+'",';h+='"op":"eq",';h+='"data":"'+(b+"").replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"}';p++});h+="]}";a.extend(c.p.postData,{filters:h});a.each(["searchField","searchString","searchOper"],function(a,b){c.p.postData.hasOwnProperty(b)&&delete c.p.postData[b]})}else a.extend(c.p.postData,f);var l;c.p.searchurl&&(l=c.p.url,a(c).jqGrid("setGridParam",{url:c.p.searchurl}));var n=
|
||||
"stop"===a(c).triggerHandler("jqGridToolbarBeforeClear")?!0:!1;!n&&a.isFunction(b.beforeClear)&&(n=b.beforeClear.call(c));n||d&&a(c).jqGrid("setGridParam",{search:k}).trigger("reloadGrid",[{page:1}]);l&&a(c).jqGrid("setGridParam",{url:l});a(c).triggerHandler("jqGridToolbarAfterClear");a.isFunction(b.afterClear)&&b.afterClear()};this.toggleToolbar=function(){var b=a("tr.ui-search-toolbar",c.grid.hDiv),d=!0===c.p.frozenColumns?a("tr.ui-search-toolbar",c.grid.fhDiv):!1;"none"===b.css("display")?(b.show(),
|
||||
d&&d.show()):(b.hide(),d&&d.hide())}}})},destroyFilterToolbar:function(){return this.each(function(){this.ftoolbar&&(this.toggleToolbar=this.clearToolbar=this.triggerToolbar=null,this.ftoolbar=!1,a(this.grid.hDiv).find("table thead tr.ui-search-toolbar").remove())})},destroyGroupHeader:function(b){void 0===b&&(b=!0);return this.each(function(){var c,d,h,k,e,s;d=this.grid;var f=a("table.ui-jqgrid-htable thead",d.hDiv),g=this.p.colModel;if(d){a(this).unbind(".setGroupHeaders");c=a("<tr>",{role:"rowheader"}).addClass("ui-jqgrid-labels");
|
||||
k=d.headers;d=0;for(h=k.length;d<h;d++){e=g[d].hidden?"none":"";e=a(k[d].el).width(k[d].width).css("display",e);try{e.removeAttr("rowSpan")}catch(m){e.attr("rowSpan",1)}c.append(e);s=e.children("span.ui-jqgrid-resize");0<s.length&&(s[0].style.height="");e.children("div")[0].style.top=""}a(f).children("tr.ui-jqgrid-labels").remove();a(f).prepend(c);!0===b&&a(this).jqGrid("setGridParam",{groupHeader:null})}})},setGroupHeaders:function(b){b=a.extend({useColSpanStyle:!1,groupHeaders:[]},b||{});return this.each(function(){this.p.groupHeader=
|
||||
b;var c,d,h=0,k,e,s,f,g,m=this.p.colModel,x=m.length,q=this.grid.headers,p=a("table.ui-jqgrid-htable",this.grid.hDiv),l=p.children("thead").children("tr.ui-jqgrid-labels:last").addClass("jqg-second-row-header");k=p.children("thead");var n=p.find(".jqg-first-row-header");void 0===n[0]?n=a("<tr>",{role:"row","aria-hidden":"true"}).addClass("jqg-first-row-header").css("height","auto"):n.empty();var r,w=function(a,b){var c=b.length,d;for(d=0;d<c;d++)if(b[d].startColumnName===a)return d;return-1};a(this).prepend(k);
|
||||
k=a("<tr>",{role:"rowheader"}).addClass("ui-jqgrid-labels jqg-third-row-header");for(c=0;c<x;c++)if(s=q[c].el,f=a(s),d=m[c],e={height:"0px",width:q[c].width+"px",display:d.hidden?"none":""},a("<th>",{role:"gridcell"}).css(e).addClass("ui-first-th-"+this.p.direction).appendTo(n),s.style.width="",e=w(d.name,b.groupHeaders),0<=e){e=b.groupHeaders[e];h=e.numberOfColumns;g=e.titleText;for(e=d=0;e<h&&c+e<x;e++)m[c+e].hidden||d++;e=a("<th>").attr({role:"columnheader"}).addClass("ui-state-default ui-th-column-header ui-th-"+
|
||||
this.p.direction).css({height:"22px","border-top":"0 none"}).html(g);0<d&&e.attr("colspan",String(d));this.p.headertitles&&e.attr("title",e.text());0===d&&e.hide();f.before(e);k.append(s);h-=1}else 0===h?b.useColSpanStyle?f.attr("rowspan","2"):(a("<th>",{role:"columnheader"}).addClass("ui-state-default ui-th-column-header ui-th-"+this.p.direction).css({display:d.hidden?"none":"","border-top":"0 none"}).insertBefore(f),k.append(s)):(k.append(s),h--);m=a(this).children("thead");m.prepend(n);k.insertAfter(l);
|
||||
p.append(m);b.useColSpanStyle&&(p.find("span.ui-jqgrid-resize").each(function(){var b=a(this).parent();b.is(":visible")&&(this.style.cssText="height: "+b.height()+"px !important; cursor: col-resize;")}),p.find("div.ui-jqgrid-sortable").each(function(){var b=a(this),c=b.parent();c.is(":visible")&&c.is(":has(span.ui-jqgrid-resize)")&&b.css("top",(c.height()-b.outerHeight())/2+"px")}));r=m.find("tr.jqg-first-row-header");a(this).bind("jqGridResizeStop.setGroupHeaders",function(a,b,c){r.find("th").eq(c).width(b)})})},
|
||||
setFrozenColumns:function(){return this.each(function(){if(this.grid){var b=this,c=b.p.colModel,d=0,h=c.length,k=-1,e=!1;if(!0!==b.p.subGrid&&!0!==b.p.treeGrid&&!0!==b.p.cellEdit&&!b.p.sortable&&!b.p.scroll){b.p.rownumbers&&d++;for(b.p.multiselect&&d++;d<h;){if(!0===c[d].frozen)e=!0,k=d;else break;d++}if(0<=k&&e){c=b.p.caption?a(b.grid.cDiv).outerHeight():0;d=a(".ui-jqgrid-htable","#gview_"+a.jgrid.jqID(b.p.id)).height();b.p.toppager&&(c+=a(b.grid.topDiv).outerHeight());!0===b.p.toolbar[0]&&"bottom"!==
|
||||
b.p.toolbar[1]&&(c+=a(b.grid.uDiv).outerHeight());b.grid.fhDiv=a('<div style="position:absolute;left:0px;top:'+c+"px;height:"+d+'px;" class="frozen-div ui-state-default ui-jqgrid-hdiv"></div>');b.grid.fbDiv=a('<div style="position:absolute;left:0px;top:'+(parseInt(c,10)+parseInt(d,10)+1)+'px;overflow-y:hidden" class="frozen-bdiv ui-jqgrid-bdiv"></div>');a("#gview_"+a.jgrid.jqID(b.p.id)).append(b.grid.fhDiv);c=a(".ui-jqgrid-htable","#gview_"+a.jgrid.jqID(b.p.id)).clone(!0);if(b.p.groupHeader){a("tr.jqg-first-row-header, tr.jqg-third-row-header",
|
||||
c).each(function(){a("th:gt("+k+")",this).remove()});var s=-1,f=-1,g,m;a("tr.jqg-second-row-header th",c).each(function(){g=parseInt(a(this).attr("colspan"),10);if(m=parseInt(a(this).attr("rowspan"),10))s++,f++;g&&(s+=g,f++);if(s===k)return!1});s!==k&&(f=k);a("tr.jqg-second-row-header",c).each(function(){a("th:gt("+f+")",this).remove()})}else a("tr",c).each(function(){a("th:gt("+k+")",this).remove()});a(c).width(1);a(b.grid.fhDiv).append(c).mousemove(function(a){if(b.grid.resizing)return b.grid.dragMove(a),
|
||||
!1});a(b).bind("jqGridResizeStop.setFrozenColumns",function(c,d,e){c=a(".ui-jqgrid-htable",b.grid.fhDiv);a("th:eq("+e+")",c).width(d);c=a(".ui-jqgrid-btable",b.grid.fbDiv);a("tr:first td:eq("+e+")",c).width(d)});a(b).bind("jqGridSortCol.setFrozenColumns",function(c,d,e){c=a("tr.ui-jqgrid-labels:last th:eq("+b.p.lastsort+")",b.grid.fhDiv);d=a("tr.ui-jqgrid-labels:last th:eq("+e+")",b.grid.fhDiv);a("span.ui-grid-ico-sort",c).addClass("ui-state-disabled");a(c).attr("aria-selected","false");a("span.ui-icon-"+
|
||||
b.p.sortorder,d).removeClass("ui-state-disabled");a(d).attr("aria-selected","true");b.p.viewsortcols[0]||b.p.lastsort===e||(a("span.s-ico",c).hide(),a("span.s-ico",d).show())});a("#gview_"+a.jgrid.jqID(b.p.id)).append(b.grid.fbDiv);a(b.grid.bDiv).scroll(function(){a(b.grid.fbDiv).scrollTop(a(this).scrollTop())});!0===b.p.hoverrows&&a("#"+a.jgrid.jqID(b.p.id)).unbind("mouseover").unbind("mouseout");a(b).bind("jqGridAfterGridComplete.setFrozenColumns",function(){a("#"+a.jgrid.jqID(b.p.id)+"_frozen").remove();
|
||||
a(b.grid.fbDiv).height(a(b.grid.bDiv).height()-16);var c=a("#"+a.jgrid.jqID(b.p.id)).clone(!0);a("tr[role=row]",c).each(function(){a("td[role=gridcell]:gt("+k+")",this).remove()});a(c).width(1).attr("id",b.p.id+"_frozen");a(b.grid.fbDiv).append(c);!0===b.p.hoverrows&&(a("tr.jqgrow",c).hover(function(){a(this).addClass("ui-state-hover");a("#"+a.jgrid.jqID(this.id),"#"+a.jgrid.jqID(b.p.id)).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover");a("#"+a.jgrid.jqID(this.id),"#"+
|
||||
a.jgrid.jqID(b.p.id)).removeClass("ui-state-hover")}),a("tr.jqgrow","#"+a.jgrid.jqID(b.p.id)).hover(function(){a(this).addClass("ui-state-hover");a("#"+a.jgrid.jqID(this.id),"#"+a.jgrid.jqID(b.p.id)+"_frozen").addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover");a("#"+a.jgrid.jqID(this.id),"#"+a.jgrid.jqID(b.p.id)+"_frozen").removeClass("ui-state-hover")}));c=null});b.grid.hDiv.loading||a(b).triggerHandler("jqGridAfterGridComplete");b.p.frozenColumns=!0}}}})},destroyFrozenColumns:function(){return this.each(function(){if(this.grid&&
|
||||
!0===this.p.frozenColumns){a(this.grid.fhDiv).remove();a(this.grid.fbDiv).remove();this.grid.fhDiv=null;this.grid.fbDiv=null;a(this).unbind(".setFrozenColumns");if(!0===this.p.hoverrows){var b;a("#"+a.jgrid.jqID(this.p.id)).bind("mouseover",function(c){b=a(c.target).closest("tr.jqgrow");"ui-subgrid"!==a(b).attr("class")&&a(b).addClass("ui-state-hover")}).bind("mouseout",function(c){b=a(c.target).closest("tr.jqgrow");a(b).removeClass("ui-state-hover")})}this.p.frozenColumns=!1}})}})})(jQuery);
|
||||
(function(a){a.extend(a.jgrid,{showModal:function(a){a.w.show()},closeModal:function(a){a.w.hide().attr("aria-hidden","true");a.o&&a.o.remove()},hideModal:function(d,b){b=a.extend({jqm:!0,gb:""},b||{});if(b.onClose){var c=b.gb&&"string"===typeof b.gb&&"#gbox_"===b.gb.substr(0,6)?b.onClose.call(a("#"+b.gb.substr(6))[0],d):b.onClose(d);if("boolean"===typeof c&&!c)return}if(a.fn.jqm&&!0===b.jqm)a(d).attr("aria-hidden","true").jqmHide();else{if(""!==b.gb)try{a(".jqgrid-overlay:first",b.gb).hide()}catch(g){}a(d).hide().attr("aria-hidden",
|
||||
"true")}},findPos:function(a){var b=0,c=0;if(a.offsetParent){do b+=a.offsetLeft,c+=a.offsetTop;while(a=a.offsetParent)}return[b,c]},createModal:function(d,b,c,g,e,h,f){c=a.extend(!0,{},a.jgrid.jqModal||{},c);var k=document.createElement("div"),l,m=this;f=a.extend({},f||{});l="rtl"===a(c.gbox).attr("dir")?!0:!1;k.className="ui-widget ui-widget-content ui-corner-all ui-jqdialog";k.id=d.themodal;var n=document.createElement("div");n.className="ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix";
|
||||
n.id=d.modalhead;a(n).append("<span class='ui-jqdialog-title'>"+c.caption+"</span>");var q=a("<a class='ui-jqdialog-titlebar-close ui-corner-all'></a>").hover(function(){q.addClass("ui-state-hover")},function(){q.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-closethick'></span>");a(n).append(q);l?(k.dir="rtl",a(".ui-jqdialog-title",n).css("float","right"),a(".ui-jqdialog-titlebar-close",n).css("left","0.3em")):(k.dir="ltr",a(".ui-jqdialog-title",n).css("float","left"),a(".ui-jqdialog-titlebar-close",
|
||||
n).css("right","0.3em"));var p=document.createElement("div");a(p).addClass("ui-jqdialog-content ui-widget-content").attr("id",d.modalcontent);a(p).append(b);k.appendChild(p);a(k).prepend(n);!0===h?a("body").append(k):"string"===typeof h?a(h).append(k):a(k).insertBefore(g);a(k).css(f);void 0===c.jqModal&&(c.jqModal=!0);b={};if(a.fn.jqm&&!0===c.jqModal)0===c.left&&0===c.top&&c.overlay&&(f=[],f=a.jgrid.findPos(e),c.left=f[0]+4,c.top=f[1]+4),b.top=c.top+"px",b.left=c.left;else if(0!==c.left||0!==c.top)b.left=
|
||||
c.left,b.top=c.top+"px";a("a.ui-jqdialog-titlebar-close",n).click(function(){var b=a("#"+a.jgrid.jqID(d.themodal)).data("onClose")||c.onClose,e=a("#"+a.jgrid.jqID(d.themodal)).data("gbox")||c.gbox;m.hideModal("#"+a.jgrid.jqID(d.themodal),{gb:e,jqm:c.jqModal,onClose:b});return!1});0!==c.width&&c.width||(c.width=300);0!==c.height&&c.height||(c.height=200);c.zIndex||(g=a(g).parents("*[role=dialog]").filter(":first").css("z-index"),c.zIndex=g?parseInt(g,10)+2:950);g=0;l&&b.left&&!h&&(g=a(c.gbox).width()-
|
||||
(isNaN(c.width)?0:parseInt(c.width,10))-8,b.left=parseInt(b.left,10)+parseInt(g,10));b.left&&(b.left+="px");a(k).css(a.extend({width:isNaN(c.width)?"auto":c.width+"px",height:isNaN(c.height)?"auto":c.height+"px",zIndex:c.zIndex,overflow:"hidden"},b)).attr({tabIndex:"-1",role:"dialog","aria-labelledby":d.modalhead,"aria-hidden":"true"});void 0===c.drag&&(c.drag=!0);void 0===c.resize&&(c.resize=!0);if(c.drag)if(a(n).css("cursor","move"),a.fn.jqDrag)a(k).jqDrag(n);else try{a(k).draggable({handle:a("#"+
|
||||
a.jgrid.jqID(n.id))})}catch(r){}if(c.resize)if(a.fn.jqResize)a(k).append("<div class='jqResize ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se'></div>"),a("#"+a.jgrid.jqID(d.themodal)).jqResize(".jqResize",d.scrollelm?"#"+a.jgrid.jqID(d.scrollelm):!1);else try{a(k).resizable({handles:"se, sw",alsoResize:d.scrollelm?"#"+a.jgrid.jqID(d.scrollelm):!1})}catch(s){}!0===c.closeOnEscape&&a(k).keydown(function(b){27==b.which&&(b=a("#"+a.jgrid.jqID(d.themodal)).data("onClose")||c.onClose,
|
||||
m.hideModal("#"+a.jgrid.jqID(d.themodal),{gb:c.gbox,jqm:c.jqModal,onClose:b}))})},viewModal:function(d,b){b=a.extend({toTop:!0,overlay:10,modal:!1,overlayClass:"ui-widget-overlay",onShow:a.jgrid.showModal,onHide:a.jgrid.closeModal,gbox:"",jqm:!0,jqM:!0},b||{});if(a.fn.jqm&&!0===b.jqm)b.jqM?a(d).attr("aria-hidden","false").jqm(b).jqmShow():a(d).attr("aria-hidden","false").jqmShow();else{""!==b.gbox&&(a(".jqgrid-overlay:first",b.gbox).show(),a(d).data("gbox",b.gbox));a(d).show().attr("aria-hidden",
|
||||
"false");try{a(":input:visible",d)[0].focus()}catch(c){}}},info_dialog:function(d,b,c,g){var e={width:290,height:"auto",dataheight:"auto",drag:!0,resize:!1,left:250,top:170,zIndex:1E3,jqModal:!0,modal:!1,closeOnEscape:!0,align:"center",buttonalign:"center",buttons:[]};a.extend(!0,e,a.jgrid.jqModal||{},{caption:"<b>"+d+"</b>"},g||{});var h=e.jqModal,f=this;a.fn.jqm&&!h&&(h=!1);d="";if(0<e.buttons.length)for(g=0;g<e.buttons.length;g++)void 0===e.buttons[g].id&&(e.buttons[g].id="info_button_"+g),d+=
|
||||
"<a id='"+e.buttons[g].id+"' class='fm-button ui-state-default ui-corner-all'>"+e.buttons[g].text+"</a>";g=isNaN(e.dataheight)?e.dataheight:e.dataheight+"px";b="<div id='info_id'>"+("<div id='infocnt' style='margin:0px;padding-bottom:1em;width:100%;overflow:auto;position:relative;height:"+g+";"+("text-align:"+e.align+";")+"'>"+b+"</div>");b+=c?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+e.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'><a id='closedialog' class='fm-button ui-state-default ui-corner-all'>"+
|
||||
c+"</a>"+d+"</div>":""!==d?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+e.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'>"+d+"</div>":"";b+="</div>";try{"false"===a("#info_dialog").attr("aria-hidden")&&a.jgrid.hideModal("#info_dialog",{jqm:h}),a("#info_dialog").remove()}catch(k){}a.jgrid.createModal({themodal:"info_dialog",modalhead:"info_head",modalcontent:"info_content",scrollelm:"infocnt"},b,e,"","",!0);d&&a.each(e.buttons,
|
||||
function(b){a("#"+a.jgrid.jqID(this.id),"#info_id").bind("click",function(){e.buttons[b].onClick.call(a("#info_dialog"));return!1})});a("#closedialog","#info_id").click(function(){f.hideModal("#info_dialog",{jqm:h,onClose:a("#info_dialog").data("onClose")||e.onClose,gb:a("#info_dialog").data("gbox")||e.gbox});return!1});a(".fm-button","#info_dialog").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});a.isFunction(e.beforeOpen)&&e.beforeOpen();a.jgrid.viewModal("#info_dialog",
|
||||
{onHide:function(a){a.w.hide().remove();a.o&&a.o.remove()},modal:e.modal,jqm:h});a.isFunction(e.afterOpen)&&e.afterOpen();try{a("#info_dialog").focus()}catch(l){}},bindEv:function(d,b){a.isFunction(b.dataInit)&&b.dataInit.call(this,d,b);b.dataEvents&&a.each(b.dataEvents,function(){void 0!==this.data?a(d).bind(this.type,this.data,this.fn):a(d).bind(this.type,this.fn)})},createEl:function(d,b,c,g,e){function h(b,d,c){var e="dataInit dataEvents dataUrl buildSelect sopt searchhidden defaultValue attr custom_element custom_value".split(" ");
|
||||
void 0!==c&&a.isArray(c)&&a.merge(e,c);a.each(d,function(d,c){-1===a.inArray(d,e)&&a(b).attr(d,c)});d.hasOwnProperty("id")||a(b).attr("id",a.jgrid.randId())}var f="",k=this;switch(d){case "textarea":f=document.createElement("textarea");g?b.cols||a(f).css({width:"98%"}):b.cols||(b.cols=20);b.rows||(b.rows=2);if(" "===c||" "===c||1===c.length&&160===c.charCodeAt(0))c="";f.value=c;h(f,b);a(f).attr({role:"textbox",multiline:"true"});break;case "checkbox":f=document.createElement("input");f.type=
|
||||
"checkbox";b.value?(d=b.value.split(":"),c===d[0]&&(f.checked=!0,f.defaultChecked=!0),f.value=d[0],a(f).attr("offval",d[1])):(d=(c+"").toLowerCase(),0>d.search(/(false|f|0|no|n|off|undefined)/i)&&""!==d?(f.checked=!0,f.defaultChecked=!0,f.value=c):f.value="on",a(f).attr("offval","off"));h(f,b,["value"]);a(f).attr("role","checkbox");break;case "select":f=document.createElement("select");f.setAttribute("role","select");g=[];!0===b.multiple?(d=!0,f.multiple="multiple",a(f).attr("aria-multiselectable",
|
||||
"true")):d=!1;if(void 0!==b.dataUrl){d=b.name?String(b.id).substring(0,String(b.id).length-String(b.name).length-1):String(b.id);var l=b.postData||e.postData;k.p&&k.p.idPrefix&&(d=a.jgrid.stripPref(k.p.idPrefix,d));a.ajax(a.extend({url:a.isFunction(b.dataUrl)?b.dataUrl.call(k,d,c,String(b.name)):b.dataUrl,type:"GET",dataType:"html",data:a.isFunction(l)?l.call(k,d,c,String(b.name)):l,context:{elem:f,options:b,vl:c},success:function(b){var d=[],c=this.elem,e=this.vl,f=a.extend({},this.options),g=!0===
|
||||
f.multiple;b=a.isFunction(f.buildSelect)?f.buildSelect.call(k,b):b;"string"===typeof b&&(b=a(a.trim(b)).html());b&&(a(c).append(b),h(c,f,l?["postData"]:void 0),void 0===f.size&&(f.size=g?3:1),g?(d=e.split(","),d=a.map(d,function(b){return a.trim(b)})):d[0]=a.trim(e),setTimeout(function(){a("option",c).each(function(b){0===b&&c.multiple&&(this.selected=!1);a(this).attr("role","option");if(-1<a.inArray(a.trim(a(this).text()),d)||-1<a.inArray(a.trim(a(this).val()),d))this.selected="selected"})},0))}},
|
||||
e||{}))}else if(b.value){var m;void 0===b.size&&(b.size=d?3:1);d&&(g=c.split(","),g=a.map(g,function(b){return a.trim(b)}));"function"===typeof b.value&&(b.value=b.value());var n,q,p=void 0===b.separator?":":b.separator;e=void 0===b.delimiter?";":b.delimiter;if("string"===typeof b.value)for(n=b.value.split(e),m=0;m<n.length;m++)q=n[m].split(p),2<q.length&&(q[1]=a.map(q,function(a,b){if(0<b)return a}).join(p)),e=document.createElement("option"),e.setAttribute("role","option"),e.value=q[0],e.innerHTML=
|
||||
q[1],f.appendChild(e),d||a.trim(q[0])!==a.trim(c)&&a.trim(q[1])!==a.trim(c)||(e.selected="selected"),d&&(-1<a.inArray(a.trim(q[1]),g)||-1<a.inArray(a.trim(q[0]),g))&&(e.selected="selected");else if("object"===typeof b.value)for(m in p=b.value,p)p.hasOwnProperty(m)&&(e=document.createElement("option"),e.setAttribute("role","option"),e.value=m,e.innerHTML=p[m],f.appendChild(e),d||a.trim(m)!==a.trim(c)&&a.trim(p[m])!==a.trim(c)||(e.selected="selected"),d&&(-1<a.inArray(a.trim(p[m]),g)||-1<a.inArray(a.trim(m),
|
||||
g))&&(e.selected="selected"));h(f,b,["value"])}break;case "text":case "password":case "button":m="button"===d?"button":"textbox";f=document.createElement("input");f.type=d;f.value=c;h(f,b);"button"!==d&&(g?b.size||a(f).css({width:"98%"}):b.size||(b.size=20));a(f).attr("role",m);break;case "image":case "file":f=document.createElement("input");f.type=d;h(f,b);break;case "custom":f=document.createElement("span");try{if(a.isFunction(b.custom_element))if(p=b.custom_element.call(k,c,b))p=a(p).addClass("customelement").attr({id:b.id,
|
||||
name:b.name}),a(f).empty().append(p);else throw"e2";else throw"e1";}catch(r){"e1"===r&&a.jgrid.info_dialog(a.jgrid.errors.errcap,"function 'custom_element' "+a.jgrid.edit.msg.nodefined,a.jgrid.edit.bClose),"e2"===r?a.jgrid.info_dialog(a.jgrid.errors.errcap,"function 'custom_element' "+a.jgrid.edit.msg.novalue,a.jgrid.edit.bClose):a.jgrid.info_dialog(a.jgrid.errors.errcap,"string"===typeof r?r:r.message,a.jgrid.edit.bClose)}}return f},checkDate:function(a,b){var c={},g;a=a.toLowerCase();g=-1!==a.indexOf("/")?
|
||||
"/":-1!==a.indexOf("-")?"-":-1!==a.indexOf(".")?".":"/";a=a.split(g);b=b.split(g);if(3!==b.length)return!1;var e=-1,h,f=g=-1,k;for(k=0;k<a.length;k++)h=isNaN(b[k])?0:parseInt(b[k],10),c[a[k]]=h,h=a[k],-1!==h.indexOf("y")&&(e=k),-1!==h.indexOf("m")&&(f=k),-1!==h.indexOf("d")&&(g=k);h="y"===a[e]||"yyyy"===a[e]?4:"yy"===a[e]?2:-1;k=[0,31,29,31,30,31,30,31,31,30,31,30,31];var l;if(-1===e)return!1;l=c[a[e]].toString();2===h&&1===l.length&&(h=1);if(l.length!==h||0===c[a[e]]&&"00"!==b[e]||-1===f)return!1;
|
||||
l=c[a[f]].toString();if(1>l.length||1>c[a[f]]||12<c[a[f]]||-1===g)return!1;l=c[a[g]].toString();if(!(h=1>l.length)&&!(h=1>c[a[g]])&&!(h=31<c[a[g]])){if(h=2===c[a[f]])e=c[a[e]],h=c[a[g]]>(0!==e%4||0===e%100&&0!==e%400?28:29);h=h||c[a[g]]>k[c[a[f]]]}return h?!1:!0},isEmpty:function(a){return a.match(/^\s+$/)||""===a?!0:!1},checkTime:function(d){var b=/^(\d{1,2}):(\d{2})([apAP][Mm])?$/;if(!a.jgrid.isEmpty(d))if(d=d.match(b)){if(d[3]){if(1>d[1]||12<d[1])return!1}else if(23<d[1])return!1;if(59<d[2])return!1}else return!1;
|
||||
return!0},checkValues:function(d,b,c,g){var e,h,f;f=this.p.colModel;if(void 0===c)if("string"===typeof b)for(c=0,g=f.length;c<g;c++){if(f[c].name===b){e=f[c].editrules;b=c;null!=f[c].formoptions&&(h=f[c].formoptions.label);break}}else 0<=b&&(e=f[b].editrules);else e=c,h=void 0===g?"_":g;if(e){h||(h=null!=this.p.colNames?this.p.colNames[b]:f[b].label);if(!0===e.required&&a.jgrid.isEmpty(d))return[!1,h+": "+a.jgrid.edit.msg.required,""];c=!1===e.required?!1:!0;if(!0===e.number&&(!1!==c||!a.jgrid.isEmpty(d))&&
|
||||
isNaN(d))return[!1,h+": "+a.jgrid.edit.msg.number,""];if(void 0!==e.minValue&&!isNaN(e.minValue)&&parseFloat(d)<parseFloat(e.minValue))return[!1,h+": "+a.jgrid.edit.msg.minValue+" "+e.minValue,""];if(void 0!==e.maxValue&&!isNaN(e.maxValue)&&parseFloat(d)>parseFloat(e.maxValue))return[!1,h+": "+a.jgrid.edit.msg.maxValue+" "+e.maxValue,""];if(!(!0!==e.email||!1===c&&a.jgrid.isEmpty(d)||(g=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i,
|
||||
g.test(d))))return[!1,h+": "+a.jgrid.edit.msg.email,""];if(!(!0!==e.integer||!1===c&&a.jgrid.isEmpty(d)||!isNaN(d)&&0===d%1&&-1===d.indexOf(".")))return[!1,h+": "+a.jgrid.edit.msg.integer,""];if(!(!0!==e.date||!1===c&&a.jgrid.isEmpty(d)||(f[b].formatoptions&&f[b].formatoptions.newformat?(f=f[b].formatoptions.newformat,a.jgrid.formatter.date.masks.hasOwnProperty(f)&&(f=a.jgrid.formatter.date.masks[f])):f=f[b].datefmt||"Y-m-d",a.jgrid.checkDate(f,d))))return[!1,h+": "+a.jgrid.edit.msg.date+" - "+f,
|
||||
""];if(!0===e.time&&!(!1===c&&a.jgrid.isEmpty(d)||a.jgrid.checkTime(d)))return[!1,h+": "+a.jgrid.edit.msg.date+" - hh:mm (am/pm)",""];if(!(!0!==e.url||!1===c&&a.jgrid.isEmpty(d)||(g=/^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i,g.test(d))))return[!1,h+": "+a.jgrid.edit.msg.url,""];if(!0===e.custom&&(!1!==c||!a.jgrid.isEmpty(d)))return a.isFunction(e.custom_func)?(d=e.custom_func.call(this,d,h,b),a.isArray(d)?d:[!1,a.jgrid.edit.msg.customarray,
|
||||
""]):[!1,a.jgrid.edit.msg.customfcheck,""]}return[!0,"",""]}})})(jQuery);
|
||||
(function(a){var b={};a.jgrid.extend({searchGrid:function(b){b=a.extend(!0,{recreateFilter:!1,drag:!0,sField:"searchField",sValue:"searchString",sOper:"searchOper",sFilter:"filters",loadDefaults:!0,beforeShowSearch:null,afterShowSearch:null,onInitializeSearch:null,afterRedraw:null,afterChange:null,closeAfterSearch:!1,closeAfterReset:!1,closeOnEscape:!1,searchOnEnter:!1,multipleSearch:!1,multipleGroup:!1,top:0,left:0,jqModal:!0,modal:!1,resize:!0,width:450,height:"auto",dataheight:"auto",showQuery:!1,
|
||||
errorcheck:!0,sopt:null,stringResult:void 0,onClose:null,onSearch:null,onReset:null,toTop:!0,overlay:30,columns:[],tmplNames:null,tmplFilters:null,tmplLabel:" Template: ",showOnLoad:!1,layer:null,operands:{eq:"=",ne:"<>",lt:"<",le:"<=",gt:">",ge:">=",bw:"LIKE",bn:"NOT LIKE","in":"IN",ni:"NOT IN",ew:"LIKE",en:"NOT LIKE",cn:"LIKE",nc:"NOT LIKE",nu:"IS NULL",nn:"ISNOT NULL"}},a.jgrid.search,b||{});return this.each(function(){function c(c){w=a(e).triggerHandler("jqGridFilterBeforeShow",[c]);void 0===
|
||||
w&&(w=!0);w&&a.isFunction(b.beforeShowSearch)&&(w=b.beforeShowSearch.call(e,c));w&&(a.jgrid.viewModal("#"+a.jgrid.jqID(s.themodal),{gbox:"#gbox_"+a.jgrid.jqID(h),jqm:b.jqModal,modal:b.modal,overlay:b.overlay,toTop:b.toTop}),a(e).triggerHandler("jqGridFilterAfterShow",[c]),a.isFunction(b.afterShowSearch)&&b.afterShowSearch.call(e,c))}var e=this;if(e.grid){var h="fbox_"+e.p.id,w=!0,t=!0,s={themodal:"searchmod"+h,modalhead:"searchhd"+h,modalcontent:"searchcnt"+h,scrollelm:h},r=e.p.postData[b.sFilter];
|
||||
"string"===typeof r&&(r=a.jgrid.parse(r));!0===b.recreateFilter&&a("#"+a.jgrid.jqID(s.themodal)).remove();if(void 0!==a("#"+a.jgrid.jqID(s.themodal))[0])c(a("#fbox_"+a.jgrid.jqID(+e.p.id)));else{var f=a("<div><div id='"+h+"' class='searchFilter' style='overflow:auto'></div></div>").insertBefore("#gview_"+a.jgrid.jqID(e.p.id)),k="left",u="";"rtl"===e.p.direction&&(k="right",u=" style='text-align:left'",f.attr("dir","rtl"));var x=a.extend([],e.p.colModel),d="<a id='"+h+"_search' class='fm-button ui-state-default ui-corner-all fm-button-icon-right ui-reset'><span class='ui-icon ui-icon-search'></span>"+
|
||||
b.Find+"</a>",v="<a id='"+h+"_reset' class='fm-button ui-state-default ui-corner-all fm-button-icon-left ui-search'><span class='ui-icon ui-icon-arrowreturnthick-1-w'></span>"+b.Reset+"</a>",g="",m="",p,q=!1,y=-1;b.showQuery&&(g="<a id='"+h+"_query' class='fm-button ui-state-default ui-corner-all fm-button-icon-left'><span class='ui-icon ui-icon-comment'></span>Query</a>");b.columns.length?(x=b.columns,y=0,p=x[0].index||x[0].name):a.each(x,function(a,b){b.label||(b.label=e.p.colNames[a]);if(!q){var c=
|
||||
void 0===b.search?!0:b.search,d=!0===b.hidden;if(b.searchoptions&&!0===b.searchoptions.searchhidden&&c||c&&!d)q=!0,p=b.index||b.name,y=a}});if(!r&&p||!1===b.multipleSearch){var D="eq";0<=y&&x[y].searchoptions&&x[y].searchoptions.sopt?D=x[y].searchoptions.sopt[0]:b.sopt&&b.sopt.length&&(D=b.sopt[0]);r={groupOp:"AND",rules:[{field:p,op:D,data:""}]}}q=!1;b.tmplNames&&b.tmplNames.length&&(q=!0,m=b.tmplLabel,m+="<select class='ui-template'>",m+="<option value='default'>Default</option>",a.each(b.tmplNames,
|
||||
function(a,b){m+="<option value='"+a+"'>"+b+"</option>"}),m+="</select>");k="<table class='EditTable' style='border:0px none;margin-top:5px' id='"+h+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr><td class='EditButton' style='text-align:"+k+"'>"+v+m+"</td><td class='EditButton' "+u+">"+g+d+"</td></tr></tbody></table>";h=a.jgrid.jqID(h);a("#"+h).jqFilter({columns:x,filter:b.loadDefaults?r:null,showQuery:b.showQuery,errorcheck:b.errorcheck,sopt:b.sopt,
|
||||
groupButton:b.multipleGroup,ruleButtons:b.multipleSearch,afterRedraw:b.afterRedraw,ops:b.odata,operands:b.operands,ajaxSelectOptions:e.p.ajaxSelectOptions,groupOps:b.groupOps,onChange:function(){this.p.showQuery&&a(".query",this).html(this.toUserFriendlyString());a.isFunction(b.afterChange)&&b.afterChange.call(e,a("#"+h),b)},direction:e.p.direction,id:e.p.id});f.append(k);q&&b.tmplFilters&&b.tmplFilters.length&&a(".ui-template",f).bind("change",function(){var c=a(this).val();"default"===c?a("#"+h).jqFilter("addFilter",
|
||||
r):a("#"+h).jqFilter("addFilter",b.tmplFilters[parseInt(c,10)]);return!1});!0===b.multipleGroup&&(b.multipleSearch=!0);a(e).triggerHandler("jqGridFilterInitialize",[a("#"+h)]);a.isFunction(b.onInitializeSearch)&&b.onInitializeSearch.call(e,a("#"+h));b.gbox="#gbox_"+h;b.layer?a.jgrid.createModal(s,f,b,"#gview_"+a.jgrid.jqID(e.p.id),a("#gbox_"+a.jgrid.jqID(e.p.id))[0],"#"+a.jgrid.jqID(b.layer),{position:"relative"}):a.jgrid.createModal(s,f,b,"#gview_"+a.jgrid.jqID(e.p.id),a("#gbox_"+a.jgrid.jqID(e.p.id))[0]);
|
||||
(b.searchOnEnter||b.closeOnEscape)&&a("#"+a.jgrid.jqID(s.themodal)).keydown(function(c){var d=a(c.target);if(b.searchOnEnter&&13===c.which&&!(d.hasClass("add-group")||d.hasClass("add-rule")||d.hasClass("delete-group")||d.hasClass("delete-rule")||d.hasClass("fm-button")&&d.is("[id$=_query]")))return a("#"+h+"_search").click(),!1;if(b.closeOnEscape&&27===c.which)return a("#"+a.jgrid.jqID(s.modalhead)).find(".ui-jqdialog-titlebar-close").click(),!1});g&&a("#"+h+"_query").bind("click",function(){a(".queryresult",
|
||||
f).toggle();return!1});void 0===b.stringResult&&(b.stringResult=b.multipleSearch);a("#"+h+"_search").bind("click",function(){var c=a("#"+h),d={},n,g;c.find(".input-elm:focus").change();g=c.jqFilter("filterData");if(b.errorcheck&&(c[0].hideError(),b.showQuery||c.jqFilter("toSQLString"),c[0].p.error))return c[0].showError(),!1;if(b.stringResult){try{n=xmlJsonClass.toJson(g,"","",!1)}catch(f){try{n=JSON.stringify(g)}catch(k){}}"string"===typeof n&&(d[b.sFilter]=n,a.each([b.sField,b.sValue,b.sOper],function(){d[this]=
|
||||
""}))}else b.multipleSearch?(d[b.sFilter]=g,a.each([b.sField,b.sValue,b.sOper],function(){d[this]=""})):(d[b.sField]=g.rules[0].field,d[b.sValue]=g.rules[0].data,d[b.sOper]=g.rules[0].op,d[b.sFilter]="");e.p.search=!0;a.extend(e.p.postData,d);t=a(e).triggerHandler("jqGridFilterSearch");void 0===t&&(t=!0);t&&a.isFunction(b.onSearch)&&(t=b.onSearch.call(e,e.p.filters));!1!==t&&a(e).trigger("reloadGrid",[{page:1}]);b.closeAfterSearch&&a.jgrid.hideModal("#"+a.jgrid.jqID(s.themodal),{gb:"#gbox_"+a.jgrid.jqID(e.p.id),
|
||||
jqm:b.jqModal,onClose:b.onClose});return!1});a("#"+h+"_reset").bind("click",function(){var c={},d=a("#"+h);e.p.search=!1;e.p.resetsearch=!0;!1===b.multipleSearch?c[b.sField]=c[b.sValue]=c[b.sOper]="":c[b.sFilter]="";d[0].resetFilter();q&&a(".ui-template",f).val("default");a.extend(e.p.postData,c);t=a(e).triggerHandler("jqGridFilterReset");void 0===t&&(t=!0);t&&a.isFunction(b.onReset)&&(t=b.onReset.call(e));!1!==t&&a(e).trigger("reloadGrid",[{page:1}]);b.closeAfterReset&&a.jgrid.hideModal("#"+a.jgrid.jqID(s.themodal),
|
||||
{gb:"#gbox_"+a.jgrid.jqID(e.p.id),jqm:b.jqModal,onClose:b.onClose});return!1});c(a("#"+h));a(".fm-button:not(.ui-state-disabled)",f).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")})}}})},editGridRow:function(z,c){c=a.extend(!0,{top:0,left:0,width:300,datawidth:"auto",height:"auto",dataheight:"auto",modal:!1,overlay:30,drag:!0,resize:!0,url:null,mtype:"POST",clearAfterAdd:!0,closeAfterEdit:!1,reloadAfterSubmit:!0,onInitializeForm:null,beforeInitData:null,
|
||||
beforeShowForm:null,afterShowForm:null,beforeSubmit:null,afterSubmit:null,onclickSubmit:null,afterComplete:null,onclickPgButtons:null,afterclickPgButtons:null,editData:{},recreateForm:!1,jqModal:!0,closeOnEscape:!1,addedrow:"first",topinfo:"",bottominfo:"",saveicon:[],closeicon:[],savekey:[!1,13],navkeys:[!1,38,40],checkOnSubmit:!1,checkOnUpdate:!1,_savedData:{},processing:!1,onClose:null,ajaxEditOptions:{},serializeEditData:null,viewPagerButtons:!0,overlayClass:"ui-widget-overlay"},a.jgrid.edit,
|
||||
c||{});b[a(this)[0].p.id]=c;return this.each(function(){function e(){a(p+" > tbody > tr > td > .FormElement").each(function(){var b=a(".customelement",this);if(b.length){var c=a(b[0]).attr("name");a.each(d.p.colModel,function(){if(this.name===c&&this.editoptions&&a.isFunction(this.editoptions.custom_value)){try{if(l[c]=this.editoptions.custom_value.call(d,a("#"+a.jgrid.jqID(c),p),"get"),void 0===l[c])throw"e1";}catch(b){"e1"===b?a.jgrid.info_dialog(a.jgrid.errors.errcap,"function 'custom_value' "+
|
||||
a.jgrid.edit.msg.novalue,a.jgrid.edit.bClose):a.jgrid.info_dialog(a.jgrid.errors.errcap,b.message,a.jgrid.edit.bClose)}return!0}})}else{switch(a(this).get(0).type){case "checkbox":a(this).is(":checked")?l[this.name]=a(this).val():(b=a(this).attr("offval"),l[this.name]=b);break;case "select-one":l[this.name]=a("option:selected",this).val();break;case "select-multiple":l[this.name]=a(this).val();l[this.name]=l[this.name]?l[this.name].join(","):"";a("option:selected",this).each(function(b,c){a(c).text()});
|
||||
break;case "password":case "text":case "textarea":case "button":l[this.name]=a(this).val()}d.p.autoencode&&(l[this.name]=a.jgrid.htmlEncode(l[this.name]))}});return!0}function h(c,e,n,f){var k,l,p,h=0,q,m,r,C=[],u=!1,z="",t;for(t=1;t<=f;t++)z+="<td class='CaptionTD'> </td><td class='DataTD'> </td>";"_empty"!==c&&(u=a(e).jqGrid("getInd",c));a(e.p.colModel).each(function(t){k=this.name;m=(l=this.editrules&&!0===this.editrules.edithidden?!1:!0===this.hidden?!0:!1)?"style='display:none'":"";
|
||||
if("cb"!==k&&"subgrid"!==k&&!0===this.editable&&"rn"!==k){if(!1===u)q="";else if(k===e.p.ExpandColumn&&!0===e.p.treeGrid)q=a("td[role='gridcell']:eq("+t+")",e.rows[u]).text();else{try{q=a.unformat.call(e,a("td[role='gridcell']:eq("+t+")",e.rows[u]),{rowId:c,colModel:this},t)}catch(w){q=this.edittype&&"textarea"===this.edittype?a("td[role='gridcell']:eq("+t+")",e.rows[u]).text():a("td[role='gridcell']:eq("+t+")",e.rows[u]).html()}if(!q||" "===q||" "===q||1===q.length&&160===q.charCodeAt(0))q=
|
||||
""}var s=a.extend({},this.editoptions||{},{id:k,name:k}),y=a.extend({},{elmprefix:"",elmsuffix:"",rowabove:!1,rowcontent:""},this.formoptions||{}),v=parseInt(y.rowpos,10)||h+1,A=parseInt(2*(parseInt(y.colpos,10)||1),10);"_empty"===c&&s.defaultValue&&(q=a.isFunction(s.defaultValue)?s.defaultValue.call(d):s.defaultValue);this.edittype||(this.edittype="text");d.p.autoencode&&(q=a.jgrid.htmlDecode(q));r=a.jgrid.createEl.call(d,this.edittype,s,q,!1,a.extend({},a.jgrid.ajaxOptions,e.p.ajaxSelectOptions||
|
||||
{}));if(b[d.p.id].checkOnSubmit||b[d.p.id].checkOnUpdate)b[d.p.id]._savedData[k]=q;a(r).addClass("FormElement");-1<a.inArray(this.edittype,["text","textarea","password","select"])&&a(r).addClass("ui-widget-content ui-corner-all");p=a(n).find("tr[rowpos="+v+"]");if(y.rowabove){var x=a("<tr><td class='contentinfo' colspan='"+2*f+"'>"+y.rowcontent+"</td></tr>");a(n).append(x);x[0].rp=v}0===p.length&&(p=a("<tr "+m+" rowpos='"+v+"'></tr>").addClass("FormData").attr("id","tr_"+k),a(p).append(z),a(n).append(p),
|
||||
p[0].rp=v);a("td:eq("+(A-2)+")",p[0]).html(void 0===y.label?e.p.colNames[t]:y.label);a("td:eq("+(A-1)+")",p[0]).append(y.elmprefix).append(r).append(y.elmsuffix);"custom"===this.edittype&&a.isFunction(s.custom_value)&&s.custom_value.call(d,a("#"+k,"#"+g),"set",q);a.jgrid.bindEv.call(d,r,s);C[h]=t;h++}});0<h&&(t=a("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+(2*f-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='"+e.p.id+"_id' value='"+
|
||||
c+"'/></td></tr>"),t[0].rp=h+999,a(n).append(t),b[d.p.id].checkOnSubmit||b[d.p.id].checkOnUpdate)&&(b[d.p.id]._savedData[e.p.id+"_id"]=c);return C}function w(c,e,n){var g,k=0,f,l,q,h,r;if(b[d.p.id].checkOnSubmit||b[d.p.id].checkOnUpdate)b[d.p.id]._savedData={},b[d.p.id]._savedData[e.p.id+"_id"]=c;var m=e.p.colModel;if("_empty"===c)a(m).each(function(){g=this.name;q=a.extend({},this.editoptions||{});(l=a("#"+a.jgrid.jqID(g),"#"+n))&&l.length&&null!==l[0]&&(h="","custom"===this.edittype&&a.isFunction(q.custom_value)?
|
||||
q.custom_value.call(d,a("#"+g,"#"+n),"set",h):q.defaultValue?(h=a.isFunction(q.defaultValue)?q.defaultValue.call(d):q.defaultValue,"checkbox"===l[0].type?(r=h.toLowerCase(),0>r.search(/(false|f|0|no|n|off|undefined)/i)&&""!==r?(l[0].checked=!0,l[0].defaultChecked=!0,l[0].value=h):(l[0].checked=!1,l[0].defaultChecked=!1)):l.val(h)):"checkbox"===l[0].type?(l[0].checked=!1,l[0].defaultChecked=!1,h=a(l).attr("offval")):l[0].type&&"select"===l[0].type.substr(0,6)?l[0].selectedIndex=0:l.val(h),!0===b[d.p.id].checkOnSubmit||
|
||||
b[d.p.id].checkOnUpdate)&&(b[d.p.id]._savedData[g]=h)}),a("#id_g","#"+n).val(c);else{var t=a(e).jqGrid("getInd",c,!0);t&&(a('td[role="gridcell"]',t).each(function(l){g=m[l].name;if("cb"!==g&&"subgrid"!==g&&"rn"!==g&&!0===m[l].editable){if(g===e.p.ExpandColumn&&!0===e.p.treeGrid)f=a(this).text();else try{f=a.unformat.call(e,a(this),{rowId:c,colModel:m[l]},l)}catch(q){f="textarea"===m[l].edittype?a(this).text():a(this).html()}d.p.autoencode&&(f=a.jgrid.htmlDecode(f));if(!0===b[d.p.id].checkOnSubmit||
|
||||
b[d.p.id].checkOnUpdate)b[d.p.id]._savedData[g]=f;g=a.jgrid.jqID(g);switch(m[l].edittype){case "password":case "text":case "button":case "image":case "textarea":if(" "===f||" "===f||1===f.length&&160===f.charCodeAt(0))f="";a("#"+g,"#"+n).val(f);break;case "select":var h=f.split(","),h=a.map(h,function(b){return a.trim(b)});a("#"+g+" option","#"+n).each(function(){m[l].editoptions.multiple||a.trim(f)!==a.trim(a(this).text())&&h[0]!==a.trim(a(this).text())&&h[0]!==a.trim(a(this).val())?m[l].editoptions.multiple?
|
||||
-1<a.inArray(a.trim(a(this).text()),h)||-1<a.inArray(a.trim(a(this).val()),h)?this.selected=!0:this.selected=!1:this.selected=!1:this.selected=!0});break;case "checkbox":f=String(f);if(m[l].editoptions&&m[l].editoptions.value)if(m[l].editoptions.value.split(":")[0]===f)a("#"+g,"#"+n)[d.p.useProp?"prop":"attr"]({checked:!0,defaultChecked:!0});else a("#"+g,"#"+n)[d.p.useProp?"prop":"attr"]({checked:!1,defaultChecked:!1});else f=f.toLowerCase(),0>f.search(/(false|f|0|no|n|off|undefined)/i)&&""!==f?(a("#"+
|
||||
g,"#"+n)[d.p.useProp?"prop":"attr"]("checked",!0),a("#"+g,"#"+n)[d.p.useProp?"prop":"attr"]("defaultChecked",!0)):(a("#"+g,"#"+n)[d.p.useProp?"prop":"attr"]("checked",!1),a("#"+g,"#"+n)[d.p.useProp?"prop":"attr"]("defaultChecked",!1));break;case "custom":try{if(m[l].editoptions&&a.isFunction(m[l].editoptions.custom_value))m[l].editoptions.custom_value.call(d,a("#"+g,"#"+n),"set",f);else throw"e1";}catch(p){"e1"===p?a.jgrid.info_dialog(a.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,
|
||||
a.jgrid.edit.bClose):a.jgrid.info_dialog(a.jgrid.errors.errcap,p.message,a.jgrid.edit.bClose)}}k++}}),0<k&&a("#id_g",p).val(c))}}function t(){a.each(d.p.colModel,function(a,b){b.editoptions&&!0===b.editoptions.NullIfEmpty&&l.hasOwnProperty(b.name)&&""===l[b.name]&&(l[b.name]="null")})}function s(){var e,n=[!0,"",""],f={},k=d.p.prmNames,h,m,r,u,s,C=a(d).triggerHandler("jqGridAddEditBeforeCheckValues",[a("#"+g),B]);C&&"object"===typeof C&&(l=C);a.isFunction(b[d.p.id].beforeCheckValues)&&(C=b[d.p.id].beforeCheckValues.call(d,
|
||||
l,a("#"+g),B))&&"object"===typeof C&&(l=C);for(r in l)if(l.hasOwnProperty(r)&&(n=a.jgrid.checkValues.call(d,l[r],r),!1===n[0]))break;t();n[0]&&(f=a(d).triggerHandler("jqGridAddEditClickSubmit",[b[d.p.id],l,B]),void 0===f&&a.isFunction(b[d.p.id].onclickSubmit)&&(f=b[d.p.id].onclickSubmit.call(d,b[d.p.id],l,B)||{}),n=a(d).triggerHandler("jqGridAddEditBeforeSubmit",[l,a("#"+g),B]),void 0===n&&(n=[!0,"",""]),n[0]&&a.isFunction(b[d.p.id].beforeSubmit)&&(n=b[d.p.id].beforeSubmit.call(d,l,a("#"+g),B)));
|
||||
if(n[0]&&!b[d.p.id].processing){b[d.p.id].processing=!0;a("#sData",p+"_2").addClass("ui-state-active");m=k.oper;h=k.id;l[m]="_empty"===a.trim(l[d.p.id+"_id"])?k.addoper:k.editoper;l[m]!==k.addoper?l[h]=l[d.p.id+"_id"]:void 0===l[h]&&(l[h]=l[d.p.id+"_id"]);delete l[d.p.id+"_id"];l=a.extend(l,b[d.p.id].editData,f);if(!0===d.p.treeGrid)for(s in l[m]===k.addoper&&(u=a(d).jqGrid("getGridParam","selrow"),l["adjacency"===d.p.treeGridModel?d.p.treeReader.parent_id_field:"parent_id"]=u),d.p.treeReader)d.p.treeReader.hasOwnProperty(s)&&
|
||||
(f=d.p.treeReader[s],!l.hasOwnProperty(f)||l[m]===k.addoper&&"parent_id_field"===s||delete l[f]);l[h]=a.jgrid.stripPref(d.p.idPrefix,l[h]);s=a.extend({url:b[d.p.id].url||a(d).jqGrid("getGridParam","editurl"),type:b[d.p.id].mtype,data:a.isFunction(b[d.p.id].serializeEditData)?b[d.p.id].serializeEditData.call(d,l):l,complete:function(f,r){var s;l[h]=d.p.idPrefix+l[h];300<=f.status&&304!==f.status?(n[0]=!1,n[1]=a(d).triggerHandler("jqGridAddEditErrorTextFormat",[f,B]),a.isFunction(b[d.p.id].errorTextFormat)?
|
||||
n[1]=b[d.p.id].errorTextFormat.call(d,f,B):n[1]=r+" Status: '"+f.statusText+"'. Error code: "+f.status):(n=a(d).triggerHandler("jqGridAddEditAfterSubmit",[f,l,B]),void 0===n&&(n=[!0,"",""]),n[0]&&a.isFunction(b[d.p.id].afterSubmit)&&(n=b[d.p.id].afterSubmit.call(d,f,l,B)));if(!1===n[0])a("#FormError>td",p).html(n[1]),a("#FormError",p).show();else if(d.p.autoencode&&a.each(l,function(b,c){l[b]=a.jgrid.htmlDecode(c)}),l[m]===k.addoper?(n[2]||(n[2]=a.jgrid.randId()),l[h]=n[2],b[d.p.id].reloadAfterSubmit?
|
||||
a(d).trigger("reloadGrid"):!0===d.p.treeGrid?a(d).jqGrid("addChildNode",n[2],u,l):a(d).jqGrid("addRowData",n[2],l,c.addedrow),b[d.p.id].closeAfterAdd?(!0!==d.p.treeGrid&&a(d).jqGrid("setSelection",n[2]),a.jgrid.hideModal("#"+a.jgrid.jqID(q.themodal),{gb:"#gbox_"+a.jgrid.jqID(v),jqm:c.jqModal,onClose:b[d.p.id].onClose})):b[d.p.id].clearAfterAdd&&w("_empty",d,g)):(b[d.p.id].reloadAfterSubmit?(a(d).trigger("reloadGrid"),b[d.p.id].closeAfterEdit||setTimeout(function(){a(d).jqGrid("setSelection",l[h])},
|
||||
1E3)):!0===d.p.treeGrid?a(d).jqGrid("setTreeRow",l[h],l):a(d).jqGrid("setRowData",l[h],l),b[d.p.id].closeAfterEdit&&a.jgrid.hideModal("#"+a.jgrid.jqID(q.themodal),{gb:"#gbox_"+a.jgrid.jqID(v),jqm:c.jqModal,onClose:b[d.p.id].onClose})),a.isFunction(b[d.p.id].afterComplete)&&(e=f,setTimeout(function(){a(d).triggerHandler("jqGridAddEditAfterComplete",[e,l,a("#"+g),B]);b[d.p.id].afterComplete.call(d,e,l,a("#"+g),B);e=null},500)),b[d.p.id].checkOnSubmit||b[d.p.id].checkOnUpdate)if(a("#"+g).data("disabled",
|
||||
!1),"_empty"!==b[d.p.id]._savedData[d.p.id+"_id"])for(s in b[d.p.id]._savedData)b[d.p.id]._savedData.hasOwnProperty(s)&&l[s]&&(b[d.p.id]._savedData[s]=l[s]);b[d.p.id].processing=!1;a("#sData",p+"_2").removeClass("ui-state-active");try{a(":input:visible","#"+g)[0].focus()}catch(t){}}},a.jgrid.ajaxOptions,b[d.p.id].ajaxEditOptions);s.url||b[d.p.id].useDataProxy||(a.isFunction(d.p.dataProxy)?b[d.p.id].useDataProxy=!0:(n[0]=!1,n[1]+=" "+a.jgrid.errors.nourl));n[0]&&(b[d.p.id].useDataProxy?(f=d.p.dataProxy.call(d,
|
||||
s,"set_"+d.p.id),void 0===f&&(f=[!0,""]),!1===f[0]?(n[0]=!1,n[1]=f[1]||"Error deleting the selected row!"):(s.data.oper===k.addoper&&b[d.p.id].closeAfterAdd&&a.jgrid.hideModal("#"+a.jgrid.jqID(q.themodal),{gb:"#gbox_"+a.jgrid.jqID(v),jqm:c.jqModal,onClose:b[d.p.id].onClose}),s.data.oper===k.editoper&&b[d.p.id].closeAfterEdit&&a.jgrid.hideModal("#"+a.jgrid.jqID(q.themodal),{gb:"#gbox_"+a.jgrid.jqID(v),jqm:c.jqModal,onClose:b[d.p.id].onClose}))):a.ajax(s))}!1===n[0]&&(a("#FormError>td",p).html(n[1]),
|
||||
a("#FormError",p).show())}function r(a,b){var c=!1,d;for(d in a)if(a.hasOwnProperty(d)&&a[d]!=b[d]){c=!0;break}return c}function f(){var c=!0;a("#FormError",p).hide();b[d.p.id].checkOnUpdate&&(l={},e(),M=r(l,b[d.p.id]._savedData))&&(a("#"+g).data("disabled",!0),a(".confirm","#"+q.themodal).show(),c=!1);return c}function k(){var b;if("_empty"!==z&&void 0!==d.p.savedRow&&0<d.p.savedRow.length&&a.isFunction(a.fn.jqGrid.restoreRow))for(b=0;b<d.p.savedRow.length;b++)if(d.p.savedRow[b].id==z){a(d).jqGrid("restoreRow",
|
||||
z);break}}function u(b,c){var d=c[1].length-1;0===b?a("#pData",p+"_2").addClass("ui-state-disabled"):void 0!==c[1][b-1]&&a("#"+a.jgrid.jqID(c[1][b-1])).hasClass("ui-state-disabled")?a("#pData",p+"_2").addClass("ui-state-disabled"):a("#pData",p+"_2").removeClass("ui-state-disabled");b===d?a("#nData",p+"_2").addClass("ui-state-disabled"):void 0!==c[1][b+1]&&a("#"+a.jgrid.jqID(c[1][b+1])).hasClass("ui-state-disabled")?a("#nData",p+"_2").addClass("ui-state-disabled"):a("#nData",p+"_2").removeClass("ui-state-disabled")}
|
||||
function x(){var b=a(d).jqGrid("getDataIDs"),c=a("#id_g",p).val();return[a.inArray(c,b),b]}var d=this;if(d.grid&&z){var v=d.p.id,g="FrmGrid_"+v,m="TblGrid_"+v,p="#"+a.jgrid.jqID(m),q={themodal:"editmod"+v,modalhead:"edithd"+v,modalcontent:"editcnt"+v,scrollelm:g},y=a.isFunction(b[d.p.id].beforeShowForm)?b[d.p.id].beforeShowForm:!1,D=a.isFunction(b[d.p.id].afterShowForm)?b[d.p.id].afterShowForm:!1,A=a.isFunction(b[d.p.id].beforeInitData)?b[d.p.id].beforeInitData:!1,E=a.isFunction(b[d.p.id].onInitializeForm)?
|
||||
b[d.p.id].onInitializeForm:!1,n=!0,C=1,I=0,l,M,B,g=a.jgrid.jqID(g);"new"===z?(z="_empty",B="add",c.caption=b[d.p.id].addCaption):(c.caption=b[d.p.id].editCaption,B="edit");c.recreateForm||a(d).data("formProp")&&a.extend(b[a(this)[0].p.id],a(d).data("formProp"));var N=!0;c.checkOnUpdate&&c.jqModal&&!c.modal&&(N=!1);var H=isNaN(b[a(this)[0].p.id].dataheight)?b[a(this)[0].p.id].dataheight:b[a(this)[0].p.id].dataheight+"px",n=isNaN(b[a(this)[0].p.id].datawidth)?b[a(this)[0].p.id].datawidth:b[a(this)[0].p.id].datawidth+
|
||||
"px",H=a("<form name='FormPost' id='"+g+"' class='FormGrid' onSubmit='return false;' style='width:"+n+";overflow:auto;position:relative;height:"+H+";'></form>").data("disabled",!1),F=a("<table id='"+m+"' class='EditTable' cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),n=a(d).triggerHandler("jqGridAddEditBeforeInitData",[a("#"+g),B]);void 0===n&&(n=!0);n&&A&&(n=A.call(d,a("#"+g),B));if(!1!==n){k();a(d.p.colModel).each(function(){var a=this.formoptions;C=Math.max(C,a?a.colpos||
|
||||
0:0);I=Math.max(I,a?a.rowpos||0:0)});a(H).append(F);A=a("<tr id='FormError' style='display:none'><td class='ui-state-error' colspan='"+2*C+"'></td></tr>");A[0].rp=0;a(F).append(A);A=a("<tr style='display:none' class='tinfo'><td class='topinfo' colspan='"+2*C+"'>"+b[d.p.id].topinfo+"</td></tr>");A[0].rp=0;a(F).append(A);var n=(A="rtl"===d.p.direction?!0:!1)?"nData":"pData",G=A?"pData":"nData";h(z,d,F,C);var n="<a id='"+n+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>",
|
||||
G="<a id='"+G+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>",J="<a id='sData' class='fm-button ui-state-default ui-corner-all'>"+c.bSubmit+"</a>",K="<a id='cData' class='fm-button ui-state-default ui-corner-all'>"+c.bCancel+"</a>",m="<table border='0' cellspacing='0' cellpadding='0' class='EditTable' id='"+m+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr id='Act_Buttons'><td class='navButton'>"+
|
||||
(A?G+n:n+G)+"</td><td class='EditButton'>"+J+K+"</td></tr>"+("<tr style='display:none' class='binfo'><td class='bottominfo' colspan='2'>"+b[d.p.id].bottominfo+"</td></tr>"),m=m+"</tbody></table>";if(0<I){var L=[];a.each(a(F)[0].rows,function(a,b){L[a]=b});L.sort(function(a,b){return a.rp>b.rp?1:a.rp<b.rp?-1:0});a.each(L,function(b,c){a("tbody",F).append(c)})}c.gbox="#gbox_"+a.jgrid.jqID(v);var O=!1;!0===c.closeOnEscape&&(c.closeOnEscape=!1,O=!0);m=a("<div></div>").append(H).append(m);a.jgrid.createModal(q,
|
||||
m,b[a(this)[0].p.id],"#gview_"+a.jgrid.jqID(d.p.id),a("#gbox_"+a.jgrid.jqID(d.p.id))[0]);A&&(a("#pData, #nData",p+"_2").css("float","right"),a(".EditButton",p+"_2").css("text-align","left"));b[d.p.id].topinfo&&a(".tinfo",p).show();b[d.p.id].bottominfo&&a(".binfo",p+"_2").show();m=m=null;a("#"+a.jgrid.jqID(q.themodal)).keydown(function(e){var n=e.target;if(!0===a("#"+g).data("disabled"))return!1;if(!0===b[d.p.id].savekey[0]&&e.which===b[d.p.id].savekey[1]&&"TEXTAREA"!==n.tagName)return a("#sData",
|
||||
p+"_2").trigger("click"),!1;if(27===e.which){if(!f())return!1;O&&a.jgrid.hideModal("#"+a.jgrid.jqID(q.themodal),{gb:c.gbox,jqm:c.jqModal,onClose:b[d.p.id].onClose});return!1}if(!0===b[d.p.id].navkeys[0]){if("_empty"===a("#id_g",p).val())return!0;if(e.which===b[d.p.id].navkeys[1])return a("#pData",p+"_2").trigger("click"),!1;if(e.which===b[d.p.id].navkeys[2])return a("#nData",p+"_2").trigger("click"),!1}});c.checkOnUpdate&&(a("a.ui-jqdialog-titlebar-close span","#"+a.jgrid.jqID(q.themodal)).removeClass("jqmClose"),
|
||||
a("a.ui-jqdialog-titlebar-close","#"+a.jgrid.jqID(q.themodal)).unbind("click").click(function(){if(!f())return!1;a.jgrid.hideModal("#"+a.jgrid.jqID(q.themodal),{gb:"#gbox_"+a.jgrid.jqID(v),jqm:c.jqModal,onClose:b[d.p.id].onClose});return!1}));c.saveicon=a.extend([!0,"left","ui-icon-disk"],c.saveicon);c.closeicon=a.extend([!0,"left","ui-icon-close"],c.closeicon);!0===c.saveicon[0]&&a("#sData",p+"_2").addClass("right"===c.saveicon[1]?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+
|
||||
c.saveicon[2]+"'></span>");!0===c.closeicon[0]&&a("#cData",p+"_2").addClass("right"===c.closeicon[1]?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+c.closeicon[2]+"'></span>");if(b[d.p.id].checkOnSubmit||b[d.p.id].checkOnUpdate)J="<a id='sNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+c.bYes+"</a>",G="<a id='nNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+c.bNo+"</a>",K="<a id='cNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+
|
||||
c.bExit+"</a>",m=c.zIndex||999,m++,a("<div class='"+c.overlayClass+" jqgrid-overlay confirm' style='z-index:"+m+";display:none;'> </div><div class='confirm ui-widget-content ui-jqconfirm' style='z-index:"+(m+1)+"'>"+c.saveData+"<br/><br/>"+J+G+K+"</div>").insertAfter("#"+g),a("#sNew","#"+a.jgrid.jqID(q.themodal)).click(function(){s();a("#"+g).data("disabled",!1);a(".confirm","#"+a.jgrid.jqID(q.themodal)).hide();return!1}),a("#nNew","#"+a.jgrid.jqID(q.themodal)).click(function(){a(".confirm",
|
||||
"#"+a.jgrid.jqID(q.themodal)).hide();a("#"+g).data("disabled",!1);setTimeout(function(){a(":input:visible","#"+g)[0].focus()},0);return!1}),a("#cNew","#"+a.jgrid.jqID(q.themodal)).click(function(){a(".confirm","#"+a.jgrid.jqID(q.themodal)).hide();a("#"+g).data("disabled",!1);a.jgrid.hideModal("#"+a.jgrid.jqID(q.themodal),{gb:"#gbox_"+a.jgrid.jqID(v),jqm:c.jqModal,onClose:b[d.p.id].onClose});return!1});a(d).triggerHandler("jqGridAddEditInitializeForm",[a("#"+g),B]);E&&E.call(d,a("#"+g),B);"_empty"!==
|
||||
z&&b[d.p.id].viewPagerButtons?a("#pData,#nData",p+"_2").show():a("#pData,#nData",p+"_2").hide();a(d).triggerHandler("jqGridAddEditBeforeShowForm",[a("#"+g),B]);y&&y.call(d,a("#"+g),B);a("#"+a.jgrid.jqID(q.themodal)).data("onClose",b[d.p.id].onClose);a.jgrid.viewModal("#"+a.jgrid.jqID(q.themodal),{gbox:"#gbox_"+a.jgrid.jqID(v),jqm:c.jqModal,overlay:c.overlay,modal:c.modal,overlayClass:c.overlayClass,onHide:function(b){a(d).data("formProp",{top:parseFloat(a(b.w).css("top")),left:parseFloat(a(b.w).css("left")),
|
||||
width:a(b.w).width(),height:a(b.w).height(),dataheight:a("#"+g).height(),datawidth:a("#"+g).width()});b.w.remove();b.o&&b.o.remove()}});N||a("."+a.jgrid.jqID(c.overlayClass)).click(function(){if(!f())return!1;a.jgrid.hideModal("#"+a.jgrid.jqID(q.themodal),{gb:"#gbox_"+a.jgrid.jqID(v),jqm:c.jqModal,onClose:b[d.p.id].onClose});return!1});a(".fm-button","#"+a.jgrid.jqID(q.themodal)).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});a("#sData",p+"_2").click(function(){l=
|
||||
{};a("#FormError",p).hide();e();"_empty"===l[d.p.id+"_id"]?s():!0===c.checkOnSubmit?(M=r(l,b[d.p.id]._savedData))?(a("#"+g).data("disabled",!0),a(".confirm","#"+a.jgrid.jqID(q.themodal)).show()):s():s();return!1});a("#cData",p+"_2").click(function(){if(!f())return!1;a.jgrid.hideModal("#"+a.jgrid.jqID(q.themodal),{gb:"#gbox_"+a.jgrid.jqID(v),jqm:c.jqModal,onClose:b[d.p.id].onClose});return!1});a("#nData",p+"_2").click(function(){if(!f())return!1;a("#FormError",p).hide();var b=x();b[0]=parseInt(b[0],
|
||||
10);if(-1!==b[0]&&b[1][b[0]+1]){a(d).triggerHandler("jqGridAddEditClickPgButtons",["next",a("#"+g),b[1][b[0]]]);var e;if(a.isFunction(c.onclickPgButtons)&&(e=c.onclickPgButtons.call(d,"next",a("#"+g),b[1][b[0]]),void 0!==e&&!1===e)||a("#"+a.jgrid.jqID(b[1][b[0]+1])).hasClass("ui-state-disabled"))return!1;w(b[1][b[0]+1],d,g);a(d).jqGrid("setSelection",b[1][b[0]+1]);a(d).triggerHandler("jqGridAddEditAfterClickPgButtons",["next",a("#"+g),b[1][b[0]]]);a.isFunction(c.afterclickPgButtons)&&c.afterclickPgButtons.call(d,
|
||||
"next",a("#"+g),b[1][b[0]+1]);u(b[0]+1,b)}return!1});a("#pData",p+"_2").click(function(){if(!f())return!1;a("#FormError",p).hide();var b=x();if(-1!==b[0]&&b[1][b[0]-1]){a(d).triggerHandler("jqGridAddEditClickPgButtons",["prev",a("#"+g),b[1][b[0]]]);var e;if(a.isFunction(c.onclickPgButtons)&&(e=c.onclickPgButtons.call(d,"prev",a("#"+g),b[1][b[0]]),void 0!==e&&!1===e)||a("#"+a.jgrid.jqID(b[1][b[0]-1])).hasClass("ui-state-disabled"))return!1;w(b[1][b[0]-1],d,g);a(d).jqGrid("setSelection",b[1][b[0]-1]);
|
||||
a(d).triggerHandler("jqGridAddEditAfterClickPgButtons",["prev",a("#"+g),b[1][b[0]]]);a.isFunction(c.afterclickPgButtons)&&c.afterclickPgButtons.call(d,"prev",a("#"+g),b[1][b[0]-1]);u(b[0]-1,b)}return!1});a(d).triggerHandler("jqGridAddEditAfterShowForm",[a("#"+g),B]);D&&D.call(d,a("#"+g),B);y=x();u(y[0],y)}}})},viewGridRow:function(z,c){c=a.extend(!0,{top:0,left:0,width:0,datawidth:"auto",height:"auto",dataheight:"auto",modal:!1,overlay:30,drag:!0,resize:!0,jqModal:!0,closeOnEscape:!1,labelswidth:"30%",
|
||||
closeicon:[],navkeys:[!1,38,40],onClose:null,beforeShowForm:null,beforeInitData:null,viewPagerButtons:!0,recreateForm:!1},a.jgrid.view,c||{});b[a(this)[0].p.id]=c;return this.each(function(){function e(){!0!==b[r.p.id].closeOnEscape&&!0!==b[r.p.id].navkeys[0]||setTimeout(function(){a(".ui-jqdialog-titlebar-close","#"+a.jgrid.jqID(v.modalhead)).focus()},0)}function h(b,d,e,f){var g,k,h,q=0,m,p,r=[],s=!1,t,u="<td class='CaptionTD form-view-label ui-widget-content' width='"+c.labelswidth+"'> </td><td class='DataTD form-view-data ui-helper-reset ui-widget-content'> </td>",
|
||||
y="",z=["integer","number","currency"],v=0,w=0,A,x,D;for(t=1;t<=f;t++)y+=1===t?u:"<td class='CaptionTD form-view-label ui-widget-content'> </td><td class='DataTD form-view-data ui-widget-content'> </td>";a(d.p.colModel).each(function(){(k=this.editrules&&!0===this.editrules.edithidden?!1:!0===this.hidden?!0:!1)||"right"!==this.align||(this.formatter&&-1!==a.inArray(this.formatter,z)?v=Math.max(v,parseInt(this.width,10)):w=Math.max(w,parseInt(this.width,10)))});A=0!==v?v:0!==w?w:0;s=a(d).jqGrid("getInd",
|
||||
b);a(d.p.colModel).each(function(b){g=this.name;x=!1;p=(k=this.editrules&&!0===this.editrules.edithidden?!1:!0===this.hidden?!0:!1)?"style='display:none'":"";D="boolean"!==typeof this.viewable?!0:this.viewable;if("cb"!==g&&"subgrid"!==g&&"rn"!==g&&D){m=!1===s?"":g===d.p.ExpandColumn&&!0===d.p.treeGrid?a("td:eq("+b+")",d.rows[s]).text():a("td:eq("+b+")",d.rows[s]).html();x="right"===this.align&&0!==A?!0:!1;var c=a.extend({},{rowabove:!1,rowcontent:""},this.formoptions||{}),n=parseInt(c.rowpos,10)||
|
||||
q+1,t=parseInt(2*(parseInt(c.colpos,10)||1),10);if(c.rowabove){var u=a("<tr><td class='contentinfo' colspan='"+2*f+"'>"+c.rowcontent+"</td></tr>");a(e).append(u);u[0].rp=n}h=a(e).find("tr[rowpos="+n+"]");0===h.length&&(h=a("<tr "+p+" rowpos='"+n+"'></tr>").addClass("FormData").attr("id","trv_"+g),a(h).append(y),a(e).append(h),h[0].rp=n);a("td:eq("+(t-2)+")",h[0]).html("<b>"+(void 0===c.label?d.p.colNames[b]:c.label)+"</b>");a("td:eq("+(t-1)+")",h[0]).append("<span>"+m+"</span>").attr("id","v_"+g);
|
||||
x&&a("td:eq("+(t-1)+") span",h[0]).css({"text-align":"right",width:A+"px"});r[q]=b;q++}});0<q&&(b=a("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+(2*f-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='id' value='"+b+"'/></td></tr>"),b[0].rp=q+99,a(e).append(b));return r}function w(b,c){var d,e,f=0,g,k;if(k=a(c).jqGrid("getInd",b,!0))a("td",k).each(function(b){d=c.p.colModel[b].name;e=c.p.colModel[b].editrules&&!0===c.p.colModel[b].editrules.edithidden?
|
||||
!1:!0===c.p.colModel[b].hidden?!0:!1;"cb"!==d&&"subgrid"!==d&&"rn"!==d&&(g=d===c.p.ExpandColumn&&!0===c.p.treeGrid?a(this).text():a(this).html(),d=a.jgrid.jqID("v_"+d),a("#"+d+" span","#"+u).html(g),e&&a("#"+d,"#"+u).parents("tr:first").hide(),f++)}),0<f&&a("#id_g","#"+u).val(b)}function t(b,c){var d=c[1].length-1;0===b?a("#pData","#"+u+"_2").addClass("ui-state-disabled"):void 0!==c[1][b-1]&&a("#"+a.jgrid.jqID(c[1][b-1])).hasClass("ui-state-disabled")?a("#pData",u+"_2").addClass("ui-state-disabled"):
|
||||
a("#pData","#"+u+"_2").removeClass("ui-state-disabled");b===d?a("#nData","#"+u+"_2").addClass("ui-state-disabled"):void 0!==c[1][b+1]&&a("#"+a.jgrid.jqID(c[1][b+1])).hasClass("ui-state-disabled")?a("#nData",u+"_2").addClass("ui-state-disabled"):a("#nData","#"+u+"_2").removeClass("ui-state-disabled")}function s(){var b=a(r).jqGrid("getDataIDs"),c=a("#id_g","#"+u).val();return[a.inArray(c,b),b]}var r=this;if(r.grid&&z){var f=r.p.id,k="ViewGrid_"+a.jgrid.jqID(f),u="ViewTbl_"+a.jgrid.jqID(f),x="ViewGrid_"+
|
||||
f,d="ViewTbl_"+f,v={themodal:"viewmod"+f,modalhead:"viewhd"+f,modalcontent:"viewcnt"+f,scrollelm:k},g=a.isFunction(b[r.p.id].beforeInitData)?b[r.p.id].beforeInitData:!1,m=!0,p=1,q=0;c.recreateForm||a(r).data("viewProp")&&a.extend(b[a(this)[0].p.id],a(r).data("viewProp"));var y=isNaN(b[a(this)[0].p.id].dataheight)?b[a(this)[0].p.id].dataheight:b[a(this)[0].p.id].dataheight+"px",D=isNaN(b[a(this)[0].p.id].datawidth)?b[a(this)[0].p.id].datawidth:b[a(this)[0].p.id].datawidth+"px",x=a("<form name='FormPost' id='"+
|
||||
x+"' class='FormGrid' style='width:"+D+";overflow:auto;position:relative;height:"+y+";'></form>"),A=a("<table id='"+d+"' class='EditTable' cellspacing='1' cellpadding='2' border='0' style='table-layout:fixed'><tbody></tbody></table>");g&&(m=g.call(r,a("#"+k)),void 0===m&&(m=!0));if(!1!==m){a(r.p.colModel).each(function(){var a=this.formoptions;p=Math.max(p,a?a.colpos||0:0);q=Math.max(q,a?a.rowpos||0:0)});a(x).append(A);h(z,r,A,p);d="rtl"===r.p.direction?!0:!1;g="<a id='"+(d?"nData":"pData")+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>";
|
||||
m="<a id='"+(d?"pData":"nData")+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>";y="<a id='cData' class='fm-button ui-state-default ui-corner-all'>"+c.bClose+"</a>";if(0<q){var E=[];a.each(a(A)[0].rows,function(a,b){E[a]=b});E.sort(function(a,b){return a.rp>b.rp?1:a.rp<b.rp?-1:0});a.each(E,function(b,c){a("tbody",A).append(c)})}c.gbox="#gbox_"+a.jgrid.jqID(f);x=a("<div></div>").append(x).append("<table border='0' class='EditTable' id='"+
|
||||
u+"_2'><tbody><tr id='Act_Buttons'><td class='navButton' width='"+c.labelswidth+"'>"+(d?m+g:g+m)+"</td><td class='EditButton'>"+y+"</td></tr></tbody></table>");a.jgrid.createModal(v,x,c,"#gview_"+a.jgrid.jqID(r.p.id),a("#gview_"+a.jgrid.jqID(r.p.id))[0]);d&&(a("#pData, #nData","#"+u+"_2").css("float","right"),a(".EditButton","#"+u+"_2").css("text-align","left"));c.viewPagerButtons||a("#pData, #nData","#"+u+"_2").hide();x=null;a("#"+v.themodal).keydown(function(d){if(27===d.which)return b[r.p.id].closeOnEscape&&
|
||||
a.jgrid.hideModal("#"+a.jgrid.jqID(v.themodal),{gb:c.gbox,jqm:c.jqModal,onClose:c.onClose}),!1;if(!0===c.navkeys[0]){if(d.which===c.navkeys[1])return a("#pData","#"+u+"_2").trigger("click"),!1;if(d.which===c.navkeys[2])return a("#nData","#"+u+"_2").trigger("click"),!1}});c.closeicon=a.extend([!0,"left","ui-icon-close"],c.closeicon);!0===c.closeicon[0]&&a("#cData","#"+u+"_2").addClass("right"===c.closeicon[1]?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+c.closeicon[2]+
|
||||
"'></span>");a.isFunction(c.beforeShowForm)&&c.beforeShowForm.call(r,a("#"+k));a.jgrid.viewModal("#"+a.jgrid.jqID(v.themodal),{gbox:"#gbox_"+a.jgrid.jqID(f),jqm:c.jqModal,overlay:c.overlay,modal:c.modal,onHide:function(b){a(r).data("viewProp",{top:parseFloat(a(b.w).css("top")),left:parseFloat(a(b.w).css("left")),width:a(b.w).width(),height:a(b.w).height(),dataheight:a("#"+k).height(),datawidth:a("#"+k).width()});b.w.remove();b.o&&b.o.remove()}});a(".fm-button:not(.ui-state-disabled)","#"+u+"_2").hover(function(){a(this).addClass("ui-state-hover")},
|
||||
function(){a(this).removeClass("ui-state-hover")});e();a("#cData","#"+u+"_2").click(function(){a.jgrid.hideModal("#"+a.jgrid.jqID(v.themodal),{gb:"#gbox_"+a.jgrid.jqID(f),jqm:c.jqModal,onClose:c.onClose});return!1});a("#nData","#"+u+"_2").click(function(){a("#FormError","#"+u).hide();var b=s();b[0]=parseInt(b[0],10);-1!==b[0]&&b[1][b[0]+1]&&(a.isFunction(c.onclickPgButtons)&&c.onclickPgButtons.call(r,"next",a("#"+k),b[1][b[0]]),w(b[1][b[0]+1],r),a(r).jqGrid("setSelection",b[1][b[0]+1]),a.isFunction(c.afterclickPgButtons)&&
|
||||
c.afterclickPgButtons.call(r,"next",a("#"+k),b[1][b[0]+1]),t(b[0]+1,b));e();return!1});a("#pData","#"+u+"_2").click(function(){a("#FormError","#"+u).hide();var b=s();-1!==b[0]&&b[1][b[0]-1]&&(a.isFunction(c.onclickPgButtons)&&c.onclickPgButtons.call(r,"prev",a("#"+k),b[1][b[0]]),w(b[1][b[0]-1],r),a(r).jqGrid("setSelection",b[1][b[0]-1]),a.isFunction(c.afterclickPgButtons)&&c.afterclickPgButtons.call(r,"prev",a("#"+k),b[1][b[0]-1]),t(b[0]-1,b));e();return!1});x=s();t(x[0],x)}}})},delGridRow:function(z,
|
||||
c){c=a.extend(!0,{top:0,left:0,width:240,height:"auto",dataheight:"auto",modal:!1,overlay:30,drag:!0,resize:!0,url:"",mtype:"POST",reloadAfterSubmit:!0,beforeShowForm:null,beforeInitData:null,afterShowForm:null,beforeSubmit:null,onclickSubmit:null,afterSubmit:null,jqModal:!0,closeOnEscape:!1,delData:{},delicon:[],cancelicon:[],onClose:null,ajaxDelOptions:{},processing:!1,serializeDelData:null,useDataProxy:!1},a.jgrid.del,c||{});b[a(this)[0].p.id]=c;return this.each(function(){var e=this;if(e.grid&&
|
||||
z){var h=a.isFunction(b[e.p.id].beforeShowForm),w=a.isFunction(b[e.p.id].afterShowForm),t=a.isFunction(b[e.p.id].beforeInitData)?b[e.p.id].beforeInitData:!1,s=e.p.id,r={},f=!0,k="DelTbl_"+a.jgrid.jqID(s),u,x,d,v,g="DelTbl_"+s,m={themodal:"delmod"+s,modalhead:"delhd"+s,modalcontent:"delcnt"+s,scrollelm:k};a.isArray(z)&&(z=z.join());if(void 0!==a("#"+a.jgrid.jqID(m.themodal))[0]){t&&(f=t.call(e,a("#"+k)),void 0===f&&(f=!0));if(!1===f)return;a("#DelData>td","#"+k).text(z);a("#DelError","#"+k).hide();
|
||||
!0===b[e.p.id].processing&&(b[e.p.id].processing=!1,a("#dData","#"+k).removeClass("ui-state-active"));h&&b[e.p.id].beforeShowForm.call(e,a("#"+k));a.jgrid.viewModal("#"+a.jgrid.jqID(m.themodal),{gbox:"#gbox_"+a.jgrid.jqID(s),jqm:b[e.p.id].jqModal,jqM:!1,overlay:b[e.p.id].overlay,modal:b[e.p.id].modal})}else{var p=isNaN(b[e.p.id].dataheight)?b[e.p.id].dataheight:b[e.p.id].dataheight+"px",q=isNaN(c.datawidth)?c.datawidth:c.datawidth+"px",g="<div id='"+g+"' class='formdata' style='width:"+q+";overflow:auto;position:relative;height:"+
|
||||
p+";'><table class='DelTable'><tbody>",g=g+"<tr id='DelError' style='display:none'><td class='ui-state-error'></td></tr>",g=g+("<tr id='DelData' style='display:none'><td >"+z+"</td></tr>"),g=g+('<tr><td class="delmsg" style="white-space:pre;">'+b[e.p.id].msg+"</td></tr><tr><td > </td></tr>"),g=g+"</tbody></table></div>",g=g+("<table cellspacing='0' cellpadding='0' border='0' class='EditTable' id='"+k+"_2'><tbody><tr><td><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr><td class='DelButton EditButton'>"+
|
||||
("<a id='dData' class='fm-button ui-state-default ui-corner-all'>"+c.bSubmit+"</a>")+" "+("<a id='eData' class='fm-button ui-state-default ui-corner-all'>"+c.bCancel+"</a>")+"</td></tr></tbody></table>");c.gbox="#gbox_"+a.jgrid.jqID(s);a.jgrid.createModal(m,g,c,"#gview_"+a.jgrid.jqID(e.p.id),a("#gview_"+a.jgrid.jqID(e.p.id))[0]);t&&(f=t.call(e,a("#"+k)),void 0===f&&(f=!0));if(!1===f)return;a(".fm-button","#"+k+"_2").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});
|
||||
c.delicon=a.extend([!0,"left","ui-icon-scissors"],b[e.p.id].delicon);c.cancelicon=a.extend([!0,"left","ui-icon-cancel"],b[e.p.id].cancelicon);!0===c.delicon[0]&&a("#dData","#"+k+"_2").addClass("right"===c.delicon[1]?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+c.delicon[2]+"'></span>");!0===c.cancelicon[0]&&a("#eData","#"+k+"_2").addClass("right"===c.cancelicon[1]?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+c.cancelicon[2]+"'></span>");
|
||||
a("#dData","#"+k+"_2").click(function(){var f=[!0,""],g,h=a("#DelData>td","#"+k).text();r={};a.isFunction(b[e.p.id].onclickSubmit)&&(r=b[e.p.id].onclickSubmit.call(e,b[e.p.id],h)||{});a.isFunction(b[e.p.id].beforeSubmit)&&(f=b[e.p.id].beforeSubmit.call(e,h));if(f[0]&&!b[e.p.id].processing){b[e.p.id].processing=!0;d=e.p.prmNames;u=a.extend({},b[e.p.id].delData,r);v=d.oper;u[v]=d.deloper;x=d.id;h=String(h).split(",");if(!h.length)return!1;for(g in h)h.hasOwnProperty(g)&&(h[g]=a.jgrid.stripPref(e.p.idPrefix,
|
||||
h[g]));u[x]=h.join();a(this).addClass("ui-state-active");g=a.extend({url:b[e.p.id].url||a(e).jqGrid("getGridParam","editurl"),type:b[e.p.id].mtype,data:a.isFunction(b[e.p.id].serializeDelData)?b[e.p.id].serializeDelData.call(e,u):u,complete:function(d,g){var q;300<=d.status&&304!==d.status?(f[0]=!1,a.isFunction(b[e.p.id].errorTextFormat)?f[1]=b[e.p.id].errorTextFormat.call(e,d):f[1]=g+" Status: '"+d.statusText+"'. Error code: "+d.status):a.isFunction(b[e.p.id].afterSubmit)&&(f=b[e.p.id].afterSubmit.call(e,
|
||||
d,u));if(!1===f[0])a("#DelError>td","#"+k).html(f[1]),a("#DelError","#"+k).show();else{if(b[e.p.id].reloadAfterSubmit&&"local"!==e.p.datatype)a(e).trigger("reloadGrid");else{if(!0===e.p.treeGrid)try{a(e).jqGrid("delTreeNode",e.p.idPrefix+h[0])}catch(p){}else for(q=0;q<h.length;q++)a(e).jqGrid("delRowData",e.p.idPrefix+h[q]);e.p.selrow=null;e.p.selarrrow=[]}a.isFunction(b[e.p.id].afterComplete)&&setTimeout(function(){b[e.p.id].afterComplete.call(e,d,h)},500)}b[e.p.id].processing=!1;a("#dData","#"+
|
||||
k+"_2").removeClass("ui-state-active");f[0]&&a.jgrid.hideModal("#"+a.jgrid.jqID(m.themodal),{gb:"#gbox_"+a.jgrid.jqID(s),jqm:c.jqModal,onClose:b[e.p.id].onClose})}},a.jgrid.ajaxOptions,b[e.p.id].ajaxDelOptions);g.url||b[e.p.id].useDataProxy||(a.isFunction(e.p.dataProxy)?b[e.p.id].useDataProxy=!0:(f[0]=!1,f[1]+=" "+a.jgrid.errors.nourl));f[0]&&(b[e.p.id].useDataProxy?(g=e.p.dataProxy.call(e,g,"del_"+e.p.id),void 0===g&&(g=[!0,""]),!1===g[0]?(f[0]=!1,f[1]=g[1]||"Error deleting the selected row!"):a.jgrid.hideModal("#"+
|
||||
a.jgrid.jqID(m.themodal),{gb:"#gbox_"+a.jgrid.jqID(s),jqm:c.jqModal,onClose:b[e.p.id].onClose})):a.ajax(g))}!1===f[0]&&(a("#DelError>td","#"+k).html(f[1]),a("#DelError","#"+k).show());return!1});a("#eData","#"+k+"_2").click(function(){a.jgrid.hideModal("#"+a.jgrid.jqID(m.themodal),{gb:"#gbox_"+a.jgrid.jqID(s),jqm:b[e.p.id].jqModal,onClose:b[e.p.id].onClose});return!1});h&&b[e.p.id].beforeShowForm.call(e,a("#"+k));a.jgrid.viewModal("#"+a.jgrid.jqID(m.themodal),{gbox:"#gbox_"+a.jgrid.jqID(s),jqm:b[e.p.id].jqModal,
|
||||
overlay:b[e.p.id].overlay,modal:b[e.p.id].modal})}w&&b[e.p.id].afterShowForm.call(e,a("#"+k));!0===b[e.p.id].closeOnEscape&&setTimeout(function(){a(".ui-jqdialog-titlebar-close","#"+a.jgrid.jqID(m.modalhead)).focus()},0)}})},navGrid:function(b,c,e,h,w,t,s){c=a.extend({edit:!0,editicon:"ui-icon-pencil",add:!0,addicon:"ui-icon-plus",del:!0,delicon:"ui-icon-trash",search:!0,searchicon:"ui-icon-search",refresh:!0,refreshicon:"ui-icon-refresh",refreshstate:"firstpage",view:!1,viewicon:"ui-icon-document",
|
||||
position:"left",closeOnEscape:!0,beforeRefresh:null,afterRefresh:null,cloneToTop:!1,alertwidth:200,alertheight:"auto",alerttop:null,alertleft:null,alertzIndex:null},a.jgrid.nav,c||{});return this.each(function(){if(!this.nav){var r={themodal:"alertmod_"+this.p.id,modalhead:"alerthd_"+this.p.id,modalcontent:"alertcnt_"+this.p.id},f=this,k;if(f.grid&&"string"===typeof b){void 0===a("#"+r.themodal)[0]&&(c.alerttop||c.alertleft||(void 0!==window.innerWidth?(c.alertleft=window.innerWidth,c.alerttop=window.innerHeight):
|
||||
void 0!==document.documentElement&&void 0!==document.documentElement.clientWidth&&0!==document.documentElement.clientWidth?(c.alertleft=document.documentElement.clientWidth,c.alerttop=document.documentElement.clientHeight):(c.alertleft=1024,c.alerttop=768),c.alertleft=c.alertleft/2-parseInt(c.alertwidth,10)/2,c.alerttop=c.alerttop/2-25),a.jgrid.createModal(r,"<div>"+c.alerttext+"</div><span tabindex='0'><span tabindex='-1' id='jqg_alrt'></span></span>",{gbox:"#gbox_"+a.jgrid.jqID(f.p.id),jqModal:!0,
|
||||
drag:!0,resize:!0,caption:c.alertcap,top:c.alerttop,left:c.alertleft,width:c.alertwidth,height:c.alertheight,closeOnEscape:c.closeOnEscape,zIndex:c.alertzIndex},"#gview_"+a.jgrid.jqID(f.p.id),a("#gbox_"+a.jgrid.jqID(f.p.id))[0],!0));var u=1,x,d=function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},v=function(){a(this).removeClass("ui-state-hover")};c.cloneToTop&&f.p.toppager&&(u=2);for(x=0;x<u;x++){var g=a("<table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table navtable' style='float:left;table-layout:auto;'><tbody><tr></tr></tbody></table>"),
|
||||
m,p;0===x?(m=b,p=f.p.id,m===f.p.toppager&&(p+="_top",u=1)):(m=f.p.toppager,p=f.p.id+"_top");"rtl"===f.p.direction&&a(g).attr("dir","rtl").css("float","right");c.add&&(h=h||{},k=a("<td class='ui-pg-button ui-corner-all'></td>"),a(k).append("<div class='ui-pg-div'><span class='ui-icon "+c.addicon+"'></span>"+c.addtext+"</div>"),a("tr",g).append(k),a(k,g).attr({title:c.addtitle||"",id:h.id||"add_"+p}).click(function(){a(this).hasClass("ui-state-disabled")||(a.isFunction(c.addfunc)?c.addfunc.call(f):
|
||||
a(f).jqGrid("editGridRow","new",h));return!1}).hover(d,v),k=null);c.edit&&(k=a("<td class='ui-pg-button ui-corner-all'></td>"),e=e||{},a(k).append("<div class='ui-pg-div'><span class='ui-icon "+c.editicon+"'></span>"+c.edittext+"</div>"),a("tr",g).append(k),a(k,g).attr({title:c.edittitle||"",id:e.id||"edit_"+p}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var b=f.p.selrow;b?a.isFunction(c.editfunc)?c.editfunc.call(f,b):a(f).jqGrid("editGridRow",b,e):(a.jgrid.viewModal("#"+r.themodal,
|
||||
{gbox:"#gbox_"+a.jgrid.jqID(f.p.id),jqm:!0}),a("#jqg_alrt").focus())}return!1}).hover(d,v),k=null);c.view&&(k=a("<td class='ui-pg-button ui-corner-all'></td>"),s=s||{},a(k).append("<div class='ui-pg-div'><span class='ui-icon "+c.viewicon+"'></span>"+c.viewtext+"</div>"),a("tr",g).append(k),a(k,g).attr({title:c.viewtitle||"",id:s.id||"view_"+p}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var b=f.p.selrow;b?a.isFunction(c.viewfunc)?c.viewfunc.call(f,b):a(f).jqGrid("viewGridRow",b,s):
|
||||
(a.jgrid.viewModal("#"+r.themodal,{gbox:"#gbox_"+a.jgrid.jqID(f.p.id),jqm:!0}),a("#jqg_alrt").focus())}return!1}).hover(d,v),k=null);c.del&&(k=a("<td class='ui-pg-button ui-corner-all'></td>"),w=w||{},a(k).append("<div class='ui-pg-div'><span class='ui-icon "+c.delicon+"'></span>"+c.deltext+"</div>"),a("tr",g).append(k),a(k,g).attr({title:c.deltitle||"",id:w.id||"del_"+p}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var b;f.p.multiselect?(b=f.p.selarrrow,0===b.length&&(b=null)):b=
|
||||
f.p.selrow;b?a.isFunction(c.delfunc)?c.delfunc.call(f,b):a(f).jqGrid("delGridRow",b,w):(a.jgrid.viewModal("#"+r.themodal,{gbox:"#gbox_"+a.jgrid.jqID(f.p.id),jqm:!0}),a("#jqg_alrt").focus())}return!1}).hover(d,v),k=null);(c.add||c.edit||c.del||c.view)&&a("tr",g).append("<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>");c.search&&(k=a("<td class='ui-pg-button ui-corner-all'></td>"),t=t||{},a(k).append("<div class='ui-pg-div'><span class='ui-icon "+
|
||||
c.searchicon+"'></span>"+c.searchtext+"</div>"),a("tr",g).append(k),a(k,g).attr({title:c.searchtitle||"",id:t.id||"search_"+p}).click(function(){a(this).hasClass("ui-state-disabled")||(a.isFunction(c.searchfunc)?c.searchfunc.call(f,t):a(f).jqGrid("searchGrid",t));return!1}).hover(d,v),t.showOnLoad&&!0===t.showOnLoad&&a(k,g).click(),k=null);c.refresh&&(k=a("<td class='ui-pg-button ui-corner-all'></td>"),a(k).append("<div class='ui-pg-div'><span class='ui-icon "+c.refreshicon+"'></span>"+c.refreshtext+
|
||||
"</div>"),a("tr",g).append(k),a(k,g).attr({title:c.refreshtitle||"",id:"refresh_"+p}).click(function(){if(!a(this).hasClass("ui-state-disabled")){a.isFunction(c.beforeRefresh)&&c.beforeRefresh.call(f);f.p.search=!1;f.p.resetsearch=!0;try{var b=f.p.id;f.p.postData.filters="";try{a("#fbox_"+a.jgrid.jqID(b)).jqFilter("resetFilter")}catch(d){}a.isFunction(f.clearToolbar)&&f.clearToolbar.call(f,!1)}catch(e){}switch(c.refreshstate){case "firstpage":a(f).trigger("reloadGrid",[{page:1}]);break;case "current":a(f).trigger("reloadGrid",
|
||||
[{current:!0}])}a.isFunction(c.afterRefresh)&&c.afterRefresh.call(f)}return!1}).hover(d,v),k=null);k=a(".ui-jqgrid").css("font-size")||"11px";a("body").append("<div id='testpg2' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+k+";visibility:hidden;' ></div>");k=a(g).clone().appendTo("#testpg2").width();a("#testpg2").remove();a(m+"_"+c.position,m).append(g);f.p._nvtd&&(k>f.p._nvtd[0]&&(a(m+"_"+c.position,m).width(k),f.p._nvtd[0]=k),f.p._nvtd[1]=k);g=k=k=null;this.nav=!0}}}})},navButtonAdd:function(b,
|
||||
c){c=a.extend({caption:"newButton",title:"",buttonicon:"ui-icon-newwin",onClickButton:null,position:"last",cursor:"pointer"},c||{});return this.each(function(){if(this.grid){"string"===typeof b&&0!==b.indexOf("#")&&(b="#"+a.jgrid.jqID(b));var e=a(".navtable",b)[0],h=this;if(e&&(!c.id||void 0===a("#"+a.jgrid.jqID(c.id),e)[0])){var w=a("<td></td>");"NONE"===c.buttonicon.toString().toUpperCase()?a(w).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'>"+c.caption+"</div>"):a(w).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'><span class='ui-icon "+
|
||||
c.buttonicon+"'></span>"+c.caption+"</div>");c.id&&a(w).attr("id",c.id);"first"===c.position?0===e.rows[0].cells.length?a("tr",e).append(w):a("tr td:eq(0)",e).before(w):a("tr",e).append(w);a(w,e).attr("title",c.title||"").click(function(b){a(this).hasClass("ui-state-disabled")||a.isFunction(c.onClickButton)&&c.onClickButton.call(h,b);return!1}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")})}}})},navSeparatorAdd:function(b,
|
||||
c){c=a.extend({sepclass:"ui-separator",sepcontent:"",position:"last"},c||{});return this.each(function(){if(this.grid){"string"===typeof b&&0!==b.indexOf("#")&&(b="#"+a.jgrid.jqID(b));var e=a(".navtable",b)[0];if(e){var h="<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='"+c.sepclass+"'></span>"+c.sepcontent+"</td>";"first"===c.position?0===e.rows[0].cells.length?a("tr",e).append(h):a("tr td:eq(0)",e).before(h):a("tr",e).append(h)}}})},GridToForm:function(b,c){return this.each(function(){var e=
|
||||
this,h;if(e.grid){var w=a(e).jqGrid("getRowData",b);if(w)for(h in w)w.hasOwnProperty(h)&&(a("[name="+a.jgrid.jqID(h)+"]",c).is("input:radio")||a("[name="+a.jgrid.jqID(h)+"]",c).is("input:checkbox")?a("[name="+a.jgrid.jqID(h)+"]",c).each(function(){if(a(this).val()==w[h])a(this)[e.p.useProp?"prop":"attr"]("checked",!0);else a(this)[e.p.useProp?"prop":"attr"]("checked",!1)}):a("[name="+a.jgrid.jqID(h)+"]",c).val(w[h]))}})},FormToGrid:function(b,c,e,h){return this.each(function(){if(this.grid){e||(e=
|
||||
"set");h||(h="first");var w=a(c).serializeArray(),t={};a.each(w,function(a,b){t[b.name]=b.value});"add"===e?a(this).jqGrid("addRowData",b,t,h):"set"===e&&a(this).jqGrid("setRowData",b,t)}})}})})(jQuery);
|
||||
(function(a){a.fn.jqFilter=function(d){if("string"===typeof d){var q=a.fn.jqFilter[d];if(!q)throw"jqFilter - No such method: "+d;var x=a.makeArray(arguments).slice(1);return q.apply(this,x)}var n=a.extend(!0,{filter:null,columns:[],onChange:null,afterRedraw:null,checkValues:null,error:!1,errmsg:"",errorcheck:!0,showQuery:!0,sopt:null,ops:[],operands:null,numopts:"eq ne lt le gt ge nu nn in ni".split(" "),stropts:"eq ne bw bn ew en cn nc nu nn in ni".split(" "),strarr:["text","string","blob"],groupOps:[{op:"AND",
|
||||
text:"AND"},{op:"OR",text:"OR"}],groupButton:!0,ruleButtons:!0,direction:"ltr"},a.jgrid.filter,d||{});return this.each(function(){if(!this.filter){this.p=n;if(null===this.p.filter||void 0===this.p.filter)this.p.filter={groupOp:this.p.groupOps[0].op,rules:[],groups:[]};var d,q=this.p.columns.length,f,w=/msie/i.test(navigator.userAgent)&&!window.opera;this.p.initFilter=a.extend(!0,{},this.p.filter);if(q){for(d=0;d<q;d++)f=this.p.columns[d],f.stype?f.inputtype=f.stype:f.inputtype||(f.inputtype="text"),
|
||||
f.sorttype?f.searchtype=f.sorttype:f.searchtype||(f.searchtype="string"),void 0===f.hidden&&(f.hidden=!1),f.label||(f.label=f.name),f.index&&(f.name=f.index),f.hasOwnProperty("searchoptions")||(f.searchoptions={}),f.hasOwnProperty("searchrules")||(f.searchrules={});this.p.showQuery&&a(this).append("<table class='queryresult ui-widget ui-widget-content' style='display:block;max-width:440px;border:0px none;' dir='"+this.p.direction+"'><tbody><tr><td class='query'></td></tr></tbody></table>");var u=
|
||||
function(g,l){var b=[!0,""],c=a("#"+a.jgrid.jqID(n.id))[0]||null;if(a.isFunction(l.searchrules))b=l.searchrules.call(c,g,l);else if(a.jgrid&&a.jgrid.checkValues)try{b=a.jgrid.checkValues.call(c,g,-1,l.searchrules,l.label)}catch(m){}b&&b.length&&!1===b[0]&&(n.error=!b[0],n.errmsg=b[1])};this.onchange=function(){this.p.error=!1;this.p.errmsg="";return a.isFunction(this.p.onChange)?this.p.onChange.call(this,this.p):!1};this.reDraw=function(){a("table.group:first",this).remove();var g=this.createTableForGroup(n.filter,
|
||||
null);a(this).append(g);a.isFunction(this.p.afterRedraw)&&this.p.afterRedraw.call(this,this.p)};this.createTableForGroup=function(g,l){var b=this,c,m=a("<table class='group ui-widget ui-widget-content' style='border:0px none;'><tbody></tbody></table>"),e="left";"rtl"===this.p.direction&&(e="right",m.attr("dir","rtl"));null===l&&m.append("<tr class='error' style='display:none;'><th colspan='5' class='ui-state-error' align='"+e+"'></th></tr>");var h=a("<tr></tr>");m.append(h);e=a("<th colspan='5' align='"+
|
||||
e+"'></th>");h.append(e);if(!0===this.p.ruleButtons){var d=a("<select class='opsel'></select>");e.append(d);var h="",k;for(c=0;c<n.groupOps.length;c++)k=g.groupOp===b.p.groupOps[c].op?" selected='selected'":"",h+="<option value='"+b.p.groupOps[c].op+"'"+k+">"+b.p.groupOps[c].text+"</option>";d.append(h).bind("change",function(){g.groupOp=a(d).val();b.onchange()})}h="<span></span>";this.p.groupButton&&(h=a("<input type='button' value='+ {}' title='Add subgroup' class='add-group'/>"),h.bind("click",
|
||||
function(){void 0===g.groups&&(g.groups=[]);g.groups.push({groupOp:n.groupOps[0].op,rules:[],groups:[]});b.reDraw();b.onchange();return!1}));e.append(h);if(!0===this.p.ruleButtons){var h=a("<input type='button' value='+' title='Add rule' class='add-rule ui-add'/>"),f;h.bind("click",function(){void 0===g.rules&&(g.rules=[]);for(c=0;c<b.p.columns.length;c++){var e=void 0===b.p.columns[c].search?!0:b.p.columns[c].search,l=!0===b.p.columns[c].hidden;if(!0===b.p.columns[c].searchoptions.searchhidden&&
|
||||
e||e&&!l){f=b.p.columns[c];break}}e=f.searchoptions.sopt?f.searchoptions.sopt:b.p.sopt?b.p.sopt:-1!==a.inArray(f.searchtype,b.p.strarr)?b.p.stropts:b.p.numopts;g.rules.push({field:f.name,op:e[0],data:""});b.reDraw();return!1});e.append(h)}null!==l&&(h=a("<input type='button' value='-' title='Delete group' class='delete-group'/>"),e.append(h),h.bind("click",function(){for(c=0;c<l.groups.length;c++)if(l.groups[c]===g){l.groups.splice(c,1);break}b.reDraw();b.onchange();return!1}));if(void 0!==g.groups)for(c=
|
||||
0;c<g.groups.length;c++)e=a("<tr></tr>"),m.append(e),h=a("<td class='first'></td>"),e.append(h),h=a("<td colspan='4'></td>"),h.append(this.createTableForGroup(g.groups[c],g)),e.append(h);void 0===g.groupOp&&(g.groupOp=b.p.groupOps[0].op);if(void 0!==g.rules)for(c=0;c<g.rules.length;c++)m.append(this.createTableRowForRule(g.rules[c],g));return m};this.createTableRowForRule=function(g,l){var b=this,c=a("#"+a.jgrid.jqID(n.id))[0]||null,m=a("<tr></tr>"),e,h,f,k,d="",s;m.append("<td class='first'></td>");
|
||||
var p=a("<td class='columns'></td>");m.append(p);var q=a("<select></select>"),r,t=[];p.append(q);q.bind("change",function(){g.field=a(q).val();f=a(this).parents("tr:first");for(e=0;e<b.p.columns.length;e++)if(b.p.columns[e].name===g.field){k=b.p.columns[e];break}if(k){k.searchoptions.id=a.jgrid.randId();w&&"text"===k.inputtype&&!k.searchoptions.size&&(k.searchoptions.size=10);var d=a.jgrid.createEl.call(c,k.inputtype,k.searchoptions,"",!0,b.p.ajaxSelectOptions||{},!0);a(d).addClass("input-elm");h=
|
||||
k.searchoptions.sopt?k.searchoptions.sopt:b.p.sopt?b.p.sopt:-1!==a.inArray(k.searchtype,b.p.strarr)?b.p.stropts:b.p.numopts;var l="",m=0;t=[];a.each(b.p.ops,function(){t.push(this.oper)});for(e=0;e<h.length;e++)r=a.inArray(h[e],t),-1!==r&&(0===m&&(g.op=b.p.ops[r].oper),l+="<option value='"+b.p.ops[r].oper+"'>"+b.p.ops[r].text+"</option>",m++);a(".selectopts",f).empty().append(l);a(".selectopts",f)[0].selectedIndex=0;a.jgrid.msie&&9>a.jgrid.msiever()&&(l=parseInt(a("select.selectopts",f)[0].offsetWidth,
|
||||
10)+1,a(".selectopts",f).width(l),a(".selectopts",f).css("width","auto"));a(".data",f).empty().append(d);a.jgrid.bindEv.call(c,d,k.searchoptions);a(".input-elm",f).bind("change",function(e){e=e.target;g.data="SPAN"===e.nodeName.toUpperCase()&&k.searchoptions&&a.isFunction(k.searchoptions.custom_value)?k.searchoptions.custom_value.call(c,a(e).children(".customelement:first"),"get"):e.value;b.onchange()});setTimeout(function(){g.data=a(d).val();b.onchange()},0)}});for(e=p=0;e<b.p.columns.length;e++){s=
|
||||
void 0===b.p.columns[e].search?!0:b.p.columns[e].search;var u=!0===b.p.columns[e].hidden;if(!0===b.p.columns[e].searchoptions.searchhidden&&s||s&&!u)s="",g.field===b.p.columns[e].name&&(s=" selected='selected'",p=e),d+="<option value='"+b.p.columns[e].name+"'"+s+">"+b.p.columns[e].label+"</option>"}q.append(d);d=a("<td class='operators'></td>");m.append(d);k=n.columns[p];k.searchoptions.id=a.jgrid.randId();w&&"text"===k.inputtype&&!k.searchoptions.size&&(k.searchoptions.size=10);p=a.jgrid.createEl.call(c,
|
||||
k.inputtype,k.searchoptions,g.data,!0,b.p.ajaxSelectOptions||{},!0);if("nu"===g.op||"nn"===g.op)a(p).attr("readonly","true"),a(p).attr("disabled","true");var v=a("<select class='selectopts'></select>");d.append(v);v.bind("change",function(){g.op=a(v).val();f=a(this).parents("tr:first");var c=a(".input-elm",f)[0];"nu"===g.op||"nn"===g.op?(g.data="","SELECT"!==c.tagName.toUpperCase()&&(c.value=""),c.setAttribute("readonly","true"),c.setAttribute("disabled","true")):("SELECT"===c.tagName.toUpperCase()&&
|
||||
(g.data=c.value),c.removeAttribute("readonly"),c.removeAttribute("disabled"));b.onchange()});h=k.searchoptions.sopt?k.searchoptions.sopt:b.p.sopt?b.p.sopt:-1!==a.inArray(k.searchtype,b.p.strarr)?b.p.stropts:b.p.numopts;d="";a.each(b.p.ops,function(){t.push(this.oper)});for(e=0;e<h.length;e++)r=a.inArray(h[e],t),-1!==r&&(s=g.op===b.p.ops[r].oper?" selected='selected'":"",d+="<option value='"+b.p.ops[r].oper+"'"+s+">"+b.p.ops[r].text+"</option>");v.append(d);d=a("<td class='data'></td>");m.append(d);
|
||||
d.append(p);a.jgrid.bindEv.call(c,p,k.searchoptions);a(p).addClass("input-elm").bind("change",function(){g.data="custom"===k.inputtype?k.searchoptions.custom_value.call(c,a(this).children(".customelement:first"),"get"):a(this).val();b.onchange()});d=a("<td></td>");m.append(d);!0===this.p.ruleButtons&&(p=a("<input type='button' value='-' title='Delete rule' class='delete-rule ui-del'/>"),d.append(p),p.bind("click",function(){for(e=0;e<l.rules.length;e++)if(l.rules[e]===g){l.rules.splice(e,1);break}b.reDraw();
|
||||
b.onchange();return!1}));return m};this.getStringForGroup=function(a){var d="(",b;if(void 0!==a.groups)for(b=0;b<a.groups.length;b++){1<d.length&&(d+=" "+a.groupOp+" ");try{d+=this.getStringForGroup(a.groups[b])}catch(c){alert(c)}}if(void 0!==a.rules)try{for(b=0;b<a.rules.length;b++)1<d.length&&(d+=" "+a.groupOp+" "),d+=this.getStringForRule(a.rules[b])}catch(f){alert(f)}d+=")";return"()"===d?"":d};this.getStringForRule=function(d){var f="",b="",c,m;for(c=0;c<this.p.ops.length;c++)if(this.p.ops[c].oper===
|
||||
d.op){f=this.p.operands.hasOwnProperty(d.op)?this.p.operands[d.op]:"";b=this.p.ops[c].oper;break}for(c=0;c<this.p.columns.length;c++)if(this.p.columns[c].name===d.field){m=this.p.columns[c];break}if(void 0==m)return"";c=d.data;if("bw"===b||"bn"===b)c+="%";if("ew"===b||"en"===b)c="%"+c;if("cn"===b||"nc"===b)c="%"+c+"%";if("in"===b||"ni"===b)c=" ("+c+")";n.errorcheck&&u(d.data,m);return-1!==a.inArray(m.searchtype,["int","integer","float","number","currency"])||"nn"===b||"nu"===b?d.field+" "+f+" "+c:
|
||||
d.field+" "+f+' "'+c+'"'};this.resetFilter=function(){this.p.filter=a.extend(!0,{},this.p.initFilter);this.reDraw();this.onchange()};this.hideError=function(){a("th.ui-state-error",this).html("");a("tr.error",this).hide()};this.showError=function(){a("th.ui-state-error",this).html(this.p.errmsg);a("tr.error",this).show()};this.toUserFriendlyString=function(){return this.getStringForGroup(n.filter)};this.toString=function(){function a(b){var c="(",f;if(void 0!==b.groups)for(f=0;f<b.groups.length;f++)1<
|
||||
c.length&&(c="OR"===b.groupOp?c+" || ":c+" && "),c+=a(b.groups[f]);if(void 0!==b.rules)for(f=0;f<b.rules.length;f++){1<c.length&&(c="OR"===b.groupOp?c+" || ":c+" && ");var e=b.rules[f];if(d.p.errorcheck){for(var h=void 0,n=void 0,h=0;h<d.p.columns.length;h++)if(d.p.columns[h].name===e.field){n=d.p.columns[h];break}n&&u(e.data,n)}c+=e.op+"(item."+e.field+",'"+e.data+"')"}c+=")";return"()"===c?"":c}var d=this;return a(this.p.filter)};this.reDraw();if(this.p.showQuery)this.onchange();this.filter=!0}}})};
|
||||
a.extend(a.fn.jqFilter,{toSQLString:function(){var a="";this.each(function(){a=this.toUserFriendlyString()});return a},filterData:function(){var a;this.each(function(){a=this.p.filter});return a},getParameter:function(a){return void 0!==a&&this.p.hasOwnProperty(a)?this.p[a]:this.p},resetFilter:function(){return this.each(function(){this.resetFilter()})},addFilter:function(d){"string"===typeof d&&(d=a.jgrid.parse(d));this.each(function(){this.p.filter=d;this.reDraw();this.onchange()})}})})(jQuery);
|
||||
(function(a){a.jgrid.inlineEdit=a.jgrid.inlineEdit||{};a.jgrid.extend({editRow:function(c,e,b,l,h,n,p,g,f){var m={},d=a.makeArray(arguments).slice(1);"object"===a.type(d[0])?m=d[0]:(void 0!==e&&(m.keys=e),a.isFunction(b)&&(m.oneditfunc=b),a.isFunction(l)&&(m.successfunc=l),void 0!==h&&(m.url=h),void 0!==n&&(m.extraparam=n),a.isFunction(p)&&(m.aftersavefunc=p),a.isFunction(g)&&(m.errorfunc=g),a.isFunction(f)&&(m.afterrestorefunc=f));m=a.extend(!0,{keys:!1,oneditfunc:null,successfunc:null,url:null,
|
||||
extraparam:{},aftersavefunc:null,errorfunc:null,afterrestorefunc:null,restoreAfterError:!0,mtype:"POST"},a.jgrid.inlineEdit,m);return this.each(function(){var d=this,f,e,b,g=0,h=null,n={},l,q;d.grid&&(l=a(d).jqGrid("getInd",c,!0),!1!==l&&(b=a.isFunction(m.beforeEditRow)?m.beforeEditRow.call(d,m,c):void 0,void 0===b&&(b=!0),b&&(b=a(l).attr("editable")||"0","0"!==b||a(l).hasClass("not-editable-row")||(q=d.p.colModel,a('td[role="gridcell"]',l).each(function(b){f=q[b].name;var l=!0===d.p.treeGrid&&f===
|
||||
d.p.ExpandColumn;if(l)e=a("span:first",this).html();else try{e=a.unformat.call(d,this,{rowId:c,colModel:q[b]},b)}catch(m){e=q[b].edittype&&"textarea"===q[b].edittype?a(this).text():a(this).html()}if("cb"!==f&&"subgrid"!==f&&"rn"!==f&&(d.p.autoencode&&(e=a.jgrid.htmlDecode(e)),n[f]=e,!0===q[b].editable)){null===h&&(h=b);l?a("span:first",this).html(""):a(this).html("");var p=a.extend({},q[b].editoptions||{},{id:c+"_"+f,name:f});q[b].edittype||(q[b].edittype="text");if(" "===e||" "===e||1===
|
||||
e.length&&160===e.charCodeAt(0))e="";var x=a.jgrid.createEl.call(d,q[b].edittype,p,e,!0,a.extend({},a.jgrid.ajaxOptions,d.p.ajaxSelectOptions||{}));a(x).addClass("editable");l?a("span:first",this).append(x):a(this).append(x);a.jgrid.bindEv.call(d,x,p);"select"===q[b].edittype&&void 0!==q[b].editoptions&&!0===q[b].editoptions.multiple&&void 0===q[b].editoptions.dataUrl&&a.jgrid.msie&&a(x).width(a(x).width());g++}}),0<g&&(n.id=c,d.p.savedRow.push(n),a(l).attr("editable","1"),setTimeout(function(){a("td:eq("+
|
||||
h+") input",l).focus()},0),!0===m.keys&&a(l).bind("keydown",function(b){if(27===b.keyCode){a(d).jqGrid("restoreRow",c,m.afterrestorefunc);if(d.p._inlinenav)try{a(d).jqGrid("showAddEditButtons")}catch(f){}return!1}if(13===b.keyCode){if("TEXTAREA"===b.target.tagName)return!0;if(a(d).jqGrid("saveRow",c,m)&&d.p._inlinenav)try{a(d).jqGrid("showAddEditButtons")}catch(e){}return!1}}),a(d).triggerHandler("jqGridInlineEditRow",[c,m]),a.isFunction(m.oneditfunc)&&m.oneditfunc.call(d,c))))))})},saveRow:function(c,
|
||||
e,b,l,h,n,p){var g=a.makeArray(arguments).slice(1),f={};"object"===a.type(g[0])?f=g[0]:(a.isFunction(e)&&(f.successfunc=e),void 0!==b&&(f.url=b),void 0!==l&&(f.extraparam=l),a.isFunction(h)&&(f.aftersavefunc=h),a.isFunction(n)&&(f.errorfunc=n),a.isFunction(p)&&(f.afterrestorefunc=p));var f=a.extend(!0,{successfunc:null,url:null,extraparam:{},aftersavefunc:null,errorfunc:null,afterrestorefunc:null,restoreAfterError:!0,mtype:"POST"},a.jgrid.inlineEdit,f),m=!1,d=this[0],r,k={},y={},v={},w,z,u;if(!d.grid)return m;
|
||||
u=a(d).jqGrid("getInd",c,!0);if(!1===u)return m;g=a.isFunction(f.beforeSaveRow)?f.beforeSaveRow.call(d,f,c):void 0;void 0===g&&(g=!0);if(g){g=a(u).attr("editable");f.url=f.url||d.p.editurl;if("1"===g){var t;a('td[role="gridcell"]',u).each(function(c){t=d.p.colModel[c];r=t.name;if("cb"!==r&&"subgrid"!==r&&!0===t.editable&&"rn"!==r&&!a(this).hasClass("not-editable-cell")){switch(t.edittype){case "checkbox":var b=["Yes","No"];t.editoptions&&(b=t.editoptions.value.split(":"));k[r]=a("input",this).is(":checked")?
|
||||
b[0]:b[1];break;case "text":case "password":case "textarea":case "button":k[r]=a("input, textarea",this).val();break;case "select":if(t.editoptions.multiple){var b=a("select",this),e=[];k[r]=a(b).val();k[r]=k[r]?k[r].join(","):"";a("select option:selected",this).each(function(d,b){e[d]=a(b).text()});y[r]=e.join(",")}else k[r]=a("select option:selected",this).val(),y[r]=a("select option:selected",this).text();t.formatter&&"select"===t.formatter&&(y={});break;case "custom":try{if(t.editoptions&&a.isFunction(t.editoptions.custom_value)){if(k[r]=
|
||||
t.editoptions.custom_value.call(d,a(".customelement",this),"get"),void 0===k[r])throw"e2";}else throw"e1";}catch(g){"e1"===g&&a.jgrid.info_dialog(a.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,a.jgrid.edit.bClose),"e2"===g?a.jgrid.info_dialog(a.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,a.jgrid.edit.bClose):a.jgrid.info_dialog(a.jgrid.errors.errcap,g.message,a.jgrid.edit.bClose)}}z=a.jgrid.checkValues.call(d,k[r],c);if(!1===z[0])return!1;d.p.autoencode&&
|
||||
(k[r]=a.jgrid.htmlEncode(k[r]));"clientArray"!==f.url&&t.editoptions&&!0===t.editoptions.NullIfEmpty&&""===k[r]&&(v[r]="null")}});if(!1===z[0]){try{var q=a(d).jqGrid("getGridRowById",c),s=a.jgrid.findPos(q);a.jgrid.info_dialog(a.jgrid.errors.errcap,z[1],a.jgrid.edit.bClose,{left:s[0],top:s[1]+a(q).outerHeight()})}catch(A){alert(z[1])}return m}g=d.p.prmNames;q=c;s=!1===d.p.keyIndex?g.id:d.p.colModel[d.p.keyIndex+(!0===d.p.rownumbers?1:0)+(!0===d.p.multiselect?1:0)+(!0===d.p.subGrid?1:0)].name;k&&(k[g.oper]=
|
||||
g.editoper,void 0===k[s]||""===k[s]?k[s]=c:u.id!==d.p.idPrefix+k[s]&&(g=a.jgrid.stripPref(d.p.idPrefix,c),void 0!==d.p._index[g]&&(d.p._index[k[s]]=d.p._index[g],delete d.p._index[g]),c=d.p.idPrefix+k[s],a(u).attr("id",c),d.p.selrow===q&&(d.p.selrow=c),a.isArray(d.p.selarrrow)&&(g=a.inArray(q,d.p.selarrrow),0<=g&&(d.p.selarrrow[g]=c)),d.p.multiselect&&(g="jqg_"+d.p.id+"_"+c,a("input.cbox",u).attr("id",g).attr("name",g))),void 0===d.p.inlineData&&(d.p.inlineData={}),k=a.extend({},k,d.p.inlineData,
|
||||
f.extraparam));if("clientArray"===f.url){k=a.extend({},k,y);d.p.autoencode&&a.each(k,function(d,b){k[d]=a.jgrid.htmlDecode(b)});g=a(d).jqGrid("setRowData",c,k);a(u).attr("editable","0");for(s=0;s<d.p.savedRow.length;s++)if(String(d.p.savedRow[s].id)===String(q)){w=s;break}0<=w&&d.p.savedRow.splice(w,1);a(d).triggerHandler("jqGridInlineAfterSaveRow",[c,g,k,f]);a.isFunction(f.aftersavefunc)&&f.aftersavefunc.call(d,c,g,f);m=!0;a(u).removeClass("jqgrid-new-row").unbind("keydown")}else a("#lui_"+a.jgrid.jqID(d.p.id)).show(),
|
||||
v=a.extend({},k,v),v[s]=a.jgrid.stripPref(d.p.idPrefix,v[s]),a.ajax(a.extend({url:f.url,data:a.isFunction(d.p.serializeRowData)?d.p.serializeRowData.call(d,v):v,type:f.mtype,async:!1,complete:function(b,e){a("#lui_"+a.jgrid.jqID(d.p.id)).hide();if("success"===e){var g=!0,h;h=a(d).triggerHandler("jqGridInlineSuccessSaveRow",[b,c,f]);a.isArray(h)||(h=[!0,k]);h[0]&&a.isFunction(f.successfunc)&&(h=f.successfunc.call(d,b));a.isArray(h)?(g=h[0],k=h[1]||k):g=h;if(!0===g){d.p.autoencode&&a.each(k,function(b,
|
||||
d){k[b]=a.jgrid.htmlDecode(d)});k=a.extend({},k,y);a(d).jqGrid("setRowData",c,k);a(u).attr("editable","0");for(g=0;g<d.p.savedRow.length;g++)if(String(d.p.savedRow[g].id)===String(c)){w=g;break}0<=w&&d.p.savedRow.splice(w,1);a(d).triggerHandler("jqGridInlineAfterSaveRow",[c,b,k,f]);a.isFunction(f.aftersavefunc)&&f.aftersavefunc.call(d,c,b);m=!0;a(u).removeClass("jqgrid-new-row").unbind("keydown")}else a(d).triggerHandler("jqGridInlineErrorSaveRow",[c,b,e,null,f]),a.isFunction(f.errorfunc)&&f.errorfunc.call(d,
|
||||
c,b,e,null),!0===f.restoreAfterError&&a(d).jqGrid("restoreRow",c,f.afterrestorefunc)}},error:function(b,e,g){a("#lui_"+a.jgrid.jqID(d.p.id)).hide();a(d).triggerHandler("jqGridInlineErrorSaveRow",[c,b,e,g,f]);if(a.isFunction(f.errorfunc))f.errorfunc.call(d,c,b,e,g);else{b=b.responseText||b.statusText;try{a.jgrid.info_dialog(a.jgrid.errors.errcap,'<div class="ui-state-error">'+b+"</div>",a.jgrid.edit.bClose,{buttonalign:"right"})}catch(h){alert(b)}}!0===f.restoreAfterError&&a(d).jqGrid("restoreRow",
|
||||
c,f.afterrestorefunc)}},a.jgrid.ajaxOptions,d.p.ajaxRowOptions||{}))}return m}},restoreRow:function(c,e){var b=a.makeArray(arguments).slice(1),l={};"object"===a.type(b[0])?l=b[0]:a.isFunction(e)&&(l.afterrestorefunc=e);l=a.extend(!0,{},a.jgrid.inlineEdit,l);return this.each(function(){var b=this,e=-1,p,g={},f;if(b.grid&&(p=a(b).jqGrid("getInd",c,!0),!1!==p&&(f=a.isFunction(l.beforeCancelRow)?l.beforeCancelRow.call(b,l,sr):void 0,void 0===f&&(f=!0),f))){for(f=0;f<b.p.savedRow.length;f++)if(String(b.p.savedRow[f].id)===
|
||||
String(c)){e=f;break}if(0<=e){if(a.isFunction(a.fn.datepicker))try{a("input.hasDatepicker","#"+a.jgrid.jqID(p.id)).datepicker("hide")}catch(m){}a.each(b.p.colModel,function(){!0===this.editable&&b.p.savedRow[e].hasOwnProperty(this.name)&&(g[this.name]=b.p.savedRow[e][this.name])});a(b).jqGrid("setRowData",c,g);a(p).attr("editable","0").unbind("keydown");b.p.savedRow.splice(e,1);a("#"+a.jgrid.jqID(c),"#"+a.jgrid.jqID(b.p.id)).hasClass("jqgrid-new-row")&&setTimeout(function(){a(b).jqGrid("delRowData",
|
||||
c);a(b).jqGrid("showAddEditButtons")},0)}a(b).triggerHandler("jqGridInlineAfterRestoreRow",[c]);a.isFunction(l.afterrestorefunc)&&l.afterrestorefunc.call(b,c)}})},addRow:function(c){c=a.extend(!0,{rowID:null,initdata:{},position:"first",useDefValues:!0,useFormatter:!1,addRowParams:{extraparam:{}}},c||{});return this.each(function(){if(this.grid){var e=this,b=a.isFunction(c.beforeAddRow)?c.beforeAddRow.call(e,c.addRowParams):void 0;void 0===b&&(b=!0);b&&(c.rowID=a.isFunction(c.rowID)?c.rowID.call(e,
|
||||
c):null!=c.rowID?c.rowID:a.jgrid.randId(),!0===c.useDefValues&&a(e.p.colModel).each(function(){if(this.editoptions&&this.editoptions.defaultValue){var b=this.editoptions.defaultValue,b=a.isFunction(b)?b.call(e):b;c.initdata[this.name]=b}}),a(e).jqGrid("addRowData",c.rowID,c.initdata,c.position),c.rowID=e.p.idPrefix+c.rowID,a("#"+a.jgrid.jqID(c.rowID),"#"+a.jgrid.jqID(e.p.id)).addClass("jqgrid-new-row"),c.useFormatter?a("#"+a.jgrid.jqID(c.rowID)+" .ui-inline-edit","#"+a.jgrid.jqID(e.p.id)).click():
|
||||
(b=e.p.prmNames,c.addRowParams.extraparam[b.oper]=b.addoper,a(e).jqGrid("editRow",c.rowID,c.addRowParams),a(e).jqGrid("setSelection",c.rowID)))}})},inlineNav:function(c,e){e=a.extend(!0,{edit:!0,editicon:"ui-icon-pencil",add:!0,addicon:"ui-icon-plus",save:!0,saveicon:"ui-icon-disk",cancel:!0,cancelicon:"ui-icon-cancel",addParams:{addRowParams:{extraparam:{}}},editParams:{},restoreAfterSelect:!0},a.jgrid.nav,e||{});return this.each(function(){if(this.grid){var b=this,l,h=a.jgrid.jqID(b.p.id);b.p._inlinenav=
|
||||
!0;if(!0===e.addParams.useFormatter){var n=b.p.colModel,p;for(p=0;p<n.length;p++)if(n[p].formatter&&"actions"===n[p].formatter){n[p].formatoptions&&(n=a.extend({keys:!1,onEdit:null,onSuccess:null,afterSave:null,onError:null,afterRestore:null,extraparam:{},url:null},n[p].formatoptions),e.addParams.addRowParams={keys:n.keys,oneditfunc:n.onEdit,successfunc:n.onSuccess,url:n.url,extraparam:n.extraparam,aftersavefunc:n.afterSave,errorfunc:n.onError,afterrestorefunc:n.afterRestore});break}}e.add&&a(b).jqGrid("navButtonAdd",
|
||||
c,{caption:e.addtext,title:e.addtitle,buttonicon:e.addicon,id:b.p.id+"_iladd",onClickButton:function(){a(b).jqGrid("addRow",e.addParams);e.addParams.useFormatter||(a("#"+h+"_ilsave").removeClass("ui-state-disabled"),a("#"+h+"_ilcancel").removeClass("ui-state-disabled"),a("#"+h+"_iladd").addClass("ui-state-disabled"),a("#"+h+"_iledit").addClass("ui-state-disabled"))}});e.edit&&a(b).jqGrid("navButtonAdd",c,{caption:e.edittext,title:e.edittitle,buttonicon:e.editicon,id:b.p.id+"_iledit",onClickButton:function(){var c=
|
||||
a(b).jqGrid("getGridParam","selrow");c?(a(b).jqGrid("editRow",c,e.editParams),a("#"+h+"_ilsave").removeClass("ui-state-disabled"),a("#"+h+"_ilcancel").removeClass("ui-state-disabled"),a("#"+h+"_iladd").addClass("ui-state-disabled"),a("#"+h+"_iledit").addClass("ui-state-disabled")):(a.jgrid.viewModal("#alertmod",{gbox:"#gbox_"+h,jqm:!0}),a("#jqg_alrt").focus())}});e.save&&(a(b).jqGrid("navButtonAdd",c,{caption:e.savetext||"",title:e.savetitle||"Save row",buttonicon:e.saveicon,id:b.p.id+"_ilsave",onClickButton:function(){var c=
|
||||
b.p.savedRow[0].id;if(c){var f=b.p.prmNames,m=f.oper,d=e.editParams;a("#"+a.jgrid.jqID(c),"#"+h).hasClass("jqgrid-new-row")?(e.addParams.addRowParams.extraparam[m]=f.addoper,d=e.addParams.addRowParams):(e.editParams.extraparam||(e.editParams.extraparam={}),e.editParams.extraparam[m]=f.editoper);a(b).jqGrid("saveRow",c,d)&&a(b).jqGrid("showAddEditButtons")}else a.jgrid.viewModal("#alertmod",{gbox:"#gbox_"+h,jqm:!0}),a("#jqg_alrt").focus()}}),a("#"+h+"_ilsave").addClass("ui-state-disabled"));e.cancel&&
|
||||
(a(b).jqGrid("navButtonAdd",c,{caption:e.canceltext||"",title:e.canceltitle||"Cancel row editing",buttonicon:e.cancelicon,id:b.p.id+"_ilcancel",onClickButton:function(){var c=b.p.savedRow[0].id,f=e.editParams;c?(a("#"+a.jgrid.jqID(c),"#"+h).hasClass("jqgrid-new-row")&&(f=e.addParams.addRowParams),a(b).jqGrid("restoreRow",c,f),a(b).jqGrid("showAddEditButtons")):(a.jgrid.viewModal("#alertmod",{gbox:"#gbox_"+h,jqm:!0}),a("#jqg_alrt").focus())}}),a("#"+h+"_ilcancel").addClass("ui-state-disabled"));!0===
|
||||
e.restoreAfterSelect&&(l=a.isFunction(b.p.beforeSelectRow)?b.p.beforeSelectRow:!1,b.p.beforeSelectRow=function(c,f){var h=!0;0<b.p.savedRow.length&&!0===b.p._inlinenav&&c!==b.p.selrow&&null!==b.p.selrow&&(b.p.selrow===e.addParams.rowID?a(b).jqGrid("delRowData",b.p.selrow):a(b).jqGrid("restoreRow",b.p.selrow,e.editParams),a(b).jqGrid("showAddEditButtons"));l&&(h=l.call(b,c,f));return h})}})},showAddEditButtons:function(){return this.each(function(){if(this.grid){var c=a.jgrid.jqID(this.p.id);a("#"+
|
||||
c+"_ilsave").addClass("ui-state-disabled");a("#"+c+"_ilcancel").addClass("ui-state-disabled");a("#"+c+"_iladd").removeClass("ui-state-disabled");a("#"+c+"_iledit").removeClass("ui-state-disabled")}})}})})(jQuery);
|
||||
(function(b){b.jgrid.extend({editCell:function(d,f,a){return this.each(function(){var c=this,g,e,h,k;if(c.grid&&!0===c.p.cellEdit){f=parseInt(f,10);c.p.selrow=c.rows[d].id;c.p.knv||b(c).jqGrid("GridNav");if(0<c.p.savedRow.length){if(!0===a&&d==c.p.iRow&&f==c.p.iCol)return;b(c).jqGrid("saveCell",c.p.savedRow[0].id,c.p.savedRow[0].ic)}else window.setTimeout(function(){b("#"+b.jgrid.jqID(c.p.knv)).attr("tabindex","-1").focus()},0);k=c.p.colModel[f];g=k.name;if("subgrid"!==g&&"cb"!==g&&"rn"!==g){h=b("td:eq("+
|
||||
f+")",c.rows[d]);if(!0!==k.editable||!0!==a||h.hasClass("not-editable-cell"))0<=parseInt(c.p.iCol,10)&&0<=parseInt(c.p.iRow,10)&&(b("td:eq("+c.p.iCol+")",c.rows[c.p.iRow]).removeClass("edit-cell ui-state-highlight"),b(c.rows[c.p.iRow]).removeClass("selected-row ui-state-hover")),h.addClass("edit-cell ui-state-highlight"),b(c.rows[d]).addClass("selected-row ui-state-hover"),e=h.html().replace(/\ \;/ig,""),b(c).triggerHandler("jqGridSelectCell",[c.rows[d].id,g,e,d,f]),b.isFunction(c.p.onSelectCell)&&
|
||||
c.p.onSelectCell.call(c,c.rows[d].id,g,e,d,f);else{0<=parseInt(c.p.iCol,10)&&0<=parseInt(c.p.iRow,10)&&(b("td:eq("+c.p.iCol+")",c.rows[c.p.iRow]).removeClass("edit-cell ui-state-highlight"),b(c.rows[c.p.iRow]).removeClass("selected-row ui-state-hover"));b(h).addClass("edit-cell ui-state-highlight");b(c.rows[d]).addClass("selected-row ui-state-hover");try{e=b.unformat.call(c,h,{rowId:c.rows[d].id,colModel:k},f)}catch(m){e=k.edittype&&"textarea"===k.edittype?b(h).text():b(h).html()}c.p.autoencode&&
|
||||
(e=b.jgrid.htmlDecode(e));k.edittype||(k.edittype="text");c.p.savedRow.push({id:d,ic:f,name:g,v:e});if(" "===e||" "===e||1===e.length&&160===e.charCodeAt(0))e="";if(b.isFunction(c.p.formatCell)){var l=c.p.formatCell.call(c,c.rows[d].id,g,e,d,f);void 0!==l&&(e=l)}b(c).triggerHandler("jqGridBeforeEditCell",[c.rows[d].id,g,e,d,f]);b.isFunction(c.p.beforeEditCell)&&c.p.beforeEditCell.call(c,c.rows[d].id,g,e,d,f);var l=b.extend({},k.editoptions||{},{id:d+"_"+g,name:g}),q=b.jgrid.createEl.call(c,
|
||||
k.edittype,l,e,!0,b.extend({},b.jgrid.ajaxOptions,c.p.ajaxSelectOptions||{}));b(h).html("").append(q).attr("tabindex","0");b.jgrid.bindEv.call(c,q,l);window.setTimeout(function(){b(q).focus()},0);b("input, select, textarea",h).bind("keydown",function(a){27===a.keyCode&&(0<b("input.hasDatepicker",h).length?b(".ui-datepicker").is(":hidden")?b(c).jqGrid("restoreCell",d,f):b("input.hasDatepicker",h).datepicker("hide"):b(c).jqGrid("restoreCell",d,f));if(13===a.keyCode)return b(c).jqGrid("saveCell",d,f),
|
||||
!1;if(9===a.keyCode){if(c.grid.hDiv.loading)return!1;a.shiftKey?b(c).jqGrid("prevCell",d,f):b(c).jqGrid("nextCell",d,f)}a.stopPropagation()});b(c).triggerHandler("jqGridAfterEditCell",[c.rows[d].id,g,e,d,f]);b.isFunction(c.p.afterEditCell)&&c.p.afterEditCell.call(c,c.rows[d].id,g,e,d,f)}c.p.iCol=f;c.p.iRow=d}}})},saveCell:function(d,f){return this.each(function(){var a=this,c;if(a.grid&&!0===a.p.cellEdit){c=1<=a.p.savedRow.length?0:null;if(null!==c){var g=b("td:eq("+f+")",a.rows[d]),e,h,k=a.p.colModel[f],
|
||||
m=k.name,l=b.jgrid.jqID(m);switch(k.edittype){case "select":if(k.editoptions.multiple){var l=b("#"+d+"_"+l,a.rows[d]),q=[];(e=b(l).val())?e.join(","):e="";b("option:selected",l).each(function(a,c){q[a]=b(c).text()});h=q.join(",")}else e=b("#"+d+"_"+l+" option:selected",a.rows[d]).val(),h=b("#"+d+"_"+l+" option:selected",a.rows[d]).text();k.formatter&&(h=e);break;case "checkbox":var n=["Yes","No"];k.editoptions&&(n=k.editoptions.value.split(":"));h=e=b("#"+d+"_"+l,a.rows[d]).is(":checked")?n[0]:n[1];
|
||||
break;case "password":case "text":case "textarea":case "button":h=e=b("#"+d+"_"+l,a.rows[d]).val();break;case "custom":try{if(k.editoptions&&b.isFunction(k.editoptions.custom_value)){e=k.editoptions.custom_value.call(a,b(".customelement",g),"get");if(void 0===e)throw"e2";h=e}else throw"e1";}catch(r){"e1"===r&&b.jgrid.info_dialog(b.jgrid.errors.errcap,"function 'custom_value' "+b.jgrid.edit.msg.nodefined,b.jgrid.edit.bClose),"e2"===r?b.jgrid.info_dialog(b.jgrid.errors.errcap,"function 'custom_value' "+
|
||||
b.jgrid.edit.msg.novalue,b.jgrid.edit.bClose):b.jgrid.info_dialog(b.jgrid.errors.errcap,r.message,b.jgrid.edit.bClose)}}if(h!==a.p.savedRow[c].v){if(c=b(a).triggerHandler("jqGridBeforeSaveCell",[a.rows[d].id,m,e,d,f]))h=e=c;b.isFunction(a.p.beforeSaveCell)&&(c=a.p.beforeSaveCell.call(a,a.rows[d].id,m,e,d,f))&&(h=e=c);var s=b.jgrid.checkValues.call(a,e,f);if(!0===s[0]){c=b(a).triggerHandler("jqGridBeforeSubmitCell",[a.rows[d].id,m,e,d,f])||{};b.isFunction(a.p.beforeSubmitCell)&&((c=a.p.beforeSubmitCell.call(a,
|
||||
a.rows[d].id,m,e,d,f))||(c={}));0<b("input.hasDatepicker",g).length&&b("input.hasDatepicker",g).datepicker("hide");if("remote"===a.p.cellsubmit)if(a.p.cellurl){var p={};a.p.autoencode&&(e=b.jgrid.htmlEncode(e));p[m]=e;n=a.p.prmNames;k=n.id;l=n.oper;p[k]=b.jgrid.stripPref(a.p.idPrefix,a.rows[d].id);p[l]=n.editoper;p=b.extend(c,p);b("#lui_"+b.jgrid.jqID(a.p.id)).show();a.grid.hDiv.loading=!0;b.ajax(b.extend({url:a.p.cellurl,data:b.isFunction(a.p.serializeCellData)?a.p.serializeCellData.call(a,p):p,
|
||||
type:"POST",complete:function(c,k){b("#lui_"+a.p.id).hide();a.grid.hDiv.loading=!1;if("success"===k){var l=b(a).triggerHandler("jqGridAfterSubmitCell",[a,c,p.id,m,e,d,f])||[!0,""];!0===l[0]&&b.isFunction(a.p.afterSubmitCell)&&(l=a.p.afterSubmitCell.call(a,c,p.id,m,e,d,f));!0===l[0]?(b(g).empty(),b(a).jqGrid("setCell",a.rows[d].id,f,h,!1,!1,!0),b(g).addClass("dirty-cell"),b(a.rows[d]).addClass("edited"),b(a).triggerHandler("jqGridAfterSaveCell",[a.rows[d].id,m,e,d,f]),b.isFunction(a.p.afterSaveCell)&&
|
||||
a.p.afterSaveCell.call(a,a.rows[d].id,m,e,d,f),a.p.savedRow.splice(0,1)):(b.jgrid.info_dialog(b.jgrid.errors.errcap,l[1],b.jgrid.edit.bClose),b(a).jqGrid("restoreCell",d,f))}},error:function(c,e,h){b("#lui_"+b.jgrid.jqID(a.p.id)).hide();a.grid.hDiv.loading=!1;b(a).triggerHandler("jqGridErrorCell",[c,e,h]);b.isFunction(a.p.errorCell)?a.p.errorCell.call(a,c,e,h):b.jgrid.info_dialog(b.jgrid.errors.errcap,c.status+" : "+c.statusText+"<br/>"+e,b.jgrid.edit.bClose);b(a).jqGrid("restoreCell",d,f)}},b.jgrid.ajaxOptions,
|
||||
a.p.ajaxCellOptions||{}))}else try{b.jgrid.info_dialog(b.jgrid.errors.errcap,b.jgrid.errors.nourl,b.jgrid.edit.bClose),b(a).jqGrid("restoreCell",d,f)}catch(t){}"clientArray"===a.p.cellsubmit&&(b(g).empty(),b(a).jqGrid("setCell",a.rows[d].id,f,h,!1,!1,!0),b(g).addClass("dirty-cell"),b(a.rows[d]).addClass("edited"),b(a).triggerHandler("jqGridAfterSaveCell",[a.rows[d].id,m,e,d,f]),b.isFunction(a.p.afterSaveCell)&&a.p.afterSaveCell.call(a,a.rows[d].id,m,e,d,f),a.p.savedRow.splice(0,1))}else try{window.setTimeout(function(){b.jgrid.info_dialog(b.jgrid.errors.errcap,
|
||||
e+" "+s[1],b.jgrid.edit.bClose)},100),b(a).jqGrid("restoreCell",d,f)}catch(u){}}else b(a).jqGrid("restoreCell",d,f)}window.setTimeout(function(){b("#"+b.jgrid.jqID(a.p.knv)).attr("tabindex","-1").focus()},0)}})},restoreCell:function(d,f){return this.each(function(){var a=this,c;if(a.grid&&!0===a.p.cellEdit){c=1<=a.p.savedRow.length?0:null;if(null!==c){var g=b("td:eq("+f+")",a.rows[d]);if(b.isFunction(b.fn.datepicker))try{b("input.hasDatepicker",g).datepicker("hide")}catch(e){}b(g).empty().attr("tabindex",
|
||||
"-1");b(a).jqGrid("setCell",a.rows[d].id,f,a.p.savedRow[c].v,!1,!1,!0);b(a).triggerHandler("jqGridAfterRestoreCell",[a.rows[d].id,a.p.savedRow[c].v,d,f]);b.isFunction(a.p.afterRestoreCell)&&a.p.afterRestoreCell.call(a,a.rows[d].id,a.p.savedRow[c].v,d,f);a.p.savedRow.splice(0,1)}window.setTimeout(function(){b("#"+a.p.knv).attr("tabindex","-1").focus()},0)}})},nextCell:function(d,f){return this.each(function(){var a=!1,c;if(this.grid&&!0===this.p.cellEdit){for(c=f+1;c<this.p.colModel.length;c++)if(!0===
|
||||
this.p.colModel[c].editable){a=c;break}!1!==a?b(this).jqGrid("editCell",d,a,!0):0<this.p.savedRow.length&&b(this).jqGrid("saveCell",d,f)}})},prevCell:function(d,f){return this.each(function(){var a=!1,c;if(this.grid&&!0===this.p.cellEdit){for(c=f-1;0<=c;c--)if(!0===this.p.colModel[c].editable){a=c;break}!1!==a?b(this).jqGrid("editCell",d,a,!0):0<this.p.savedRow.length&&b(this).jqGrid("saveCell",d,f)}})},GridNav:function(){return this.each(function(){function d(c,d,e){if("v"===e.substr(0,1)){var f=
|
||||
b(a.grid.bDiv)[0].clientHeight,g=b(a.grid.bDiv)[0].scrollTop,n=a.rows[c].offsetTop+a.rows[c].clientHeight,r=a.rows[c].offsetTop;"vd"===e&&n>=f&&(b(a.grid.bDiv)[0].scrollTop=b(a.grid.bDiv)[0].scrollTop+a.rows[c].clientHeight);"vu"===e&&r<g&&(b(a.grid.bDiv)[0].scrollTop=b(a.grid.bDiv)[0].scrollTop-a.rows[c].clientHeight)}"h"===e&&(e=b(a.grid.bDiv)[0].clientWidth,f=b(a.grid.bDiv)[0].scrollLeft,g=a.rows[c].cells[d].offsetLeft,a.rows[c].cells[d].offsetLeft+a.rows[c].cells[d].clientWidth>=e+parseInt(f,
|
||||
10)?b(a.grid.bDiv)[0].scrollLeft=b(a.grid.bDiv)[0].scrollLeft+a.rows[c].cells[d].clientWidth:g<f&&(b(a.grid.bDiv)[0].scrollLeft=b(a.grid.bDiv)[0].scrollLeft-a.rows[c].cells[d].clientWidth))}function f(b,c){var d,e;if("lft"===c)for(d=b+1,e=b;0<=e;e--)if(!0!==a.p.colModel[e].hidden){d=e;break}if("rgt"===c)for(d=b-1,e=b;e<a.p.colModel.length;e++)if(!0!==a.p.colModel[e].hidden){d=e;break}return d}var a=this;if(a.grid&&!0===a.p.cellEdit){a.p.knv=a.p.id+"_kn";var c=b("<div style='position:fixed;top:0px;width:1px;height:1px;' tabindex='0'><div tabindex='-1' style='width:1px;height:1px;' id='"+
|
||||
a.p.knv+"'></div></div>"),g,e;b(c).insertBefore(a.grid.cDiv);b("#"+a.p.knv).focus().keydown(function(c){e=c.keyCode;"rtl"===a.p.direction&&(37===e?e=39:39===e&&(e=37));switch(e){case 38:0<a.p.iRow-1&&(d(a.p.iRow-1,a.p.iCol,"vu"),b(a).jqGrid("editCell",a.p.iRow-1,a.p.iCol,!1));break;case 40:a.p.iRow+1<=a.rows.length-1&&(d(a.p.iRow+1,a.p.iCol,"vd"),b(a).jqGrid("editCell",a.p.iRow+1,a.p.iCol,!1));break;case 37:0<=a.p.iCol-1&&(g=f(a.p.iCol-1,"lft"),d(a.p.iRow,g,"h"),b(a).jqGrid("editCell",a.p.iRow,g,
|
||||
!1));break;case 39:a.p.iCol+1<=a.p.colModel.length-1&&(g=f(a.p.iCol+1,"rgt"),d(a.p.iRow,g,"h"),b(a).jqGrid("editCell",a.p.iRow,g,!1));break;case 13:0<=parseInt(a.p.iCol,10)&&0<=parseInt(a.p.iRow,10)&&b(a).jqGrid("editCell",a.p.iRow,a.p.iCol,!0);break;default:return!0}return!1})}})},getChangedCells:function(d){var f=[];d||(d="all");this.each(function(){var a=this,c;a.grid&&!0===a.p.cellEdit&&b(a.rows).each(function(g){var e={};b(this).hasClass("edited")&&(b("td",this).each(function(f){c=a.p.colModel[f].name;
|
||||
if("cb"!==c&&"subgrid"!==c)if("dirty"===d){if(b(this).hasClass("dirty-cell"))try{e[c]=b.unformat.call(a,this,{rowId:a.rows[g].id,colModel:a.p.colModel[f]},f)}catch(k){e[c]=b.jgrid.htmlDecode(b(this).html())}}else try{e[c]=b.unformat.call(a,this,{rowId:a.rows[g].id,colModel:a.p.colModel[f]},f)}catch(m){e[c]=b.jgrid.htmlDecode(b(this).html())}}),e.id=this.id,f.push(e))})});return f}})})(jQuery);
|
||||
(function(c){c.fn.jqm=function(a){var k={overlay:50,closeoverlay:!0,overlayClass:"jqmOverlay",closeClass:"jqmClose",trigger:".jqModal",ajax:d,ajaxText:"",target:d,modal:d,toTop:d,onShow:d,onHide:d,onLoad:d};return this.each(function(){if(this._jqm)return l[this._jqm].c=c.extend({},l[this._jqm].c,a);n++;this._jqm=n;l[n]={c:c.extend(k,c.jqm.params,a),a:d,w:c(this).addClass("jqmID"+n),s:n};k.trigger&&c(this).jqmAddTrigger(k.trigger)})};c.fn.jqmAddClose=function(a){return r(this,a,"jqmHide")};c.fn.jqmAddTrigger=
|
||||
function(a){return r(this,a,"jqmShow")};c.fn.jqmShow=function(a){return this.each(function(){c.jqm.open(this._jqm,a)})};c.fn.jqmHide=function(a){return this.each(function(){c.jqm.close(this._jqm,a)})};c.jqm={hash:{},open:function(a,k){var b=l[a],e=b.c,h="."+e.closeClass,f=parseInt(b.w.css("z-index")),f=0<f?f:3E3,g=c("<div></div>").css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":f-1,opacity:e.overlay/100});if(b.a)return d;b.t=k;b.a=!0;b.w.css("z-index",f);e.modal?(m[0]||setTimeout(function(){s("bind")},
|
||||
1),m.push(a)):0<e.overlay?e.closeoverlay&&b.w.jqmAddClose(g):g=d;b.o=g?g.addClass(e.overlayClass).prependTo("body"):d;e.ajax?(f=e.target||b.w,g=e.ajax,f="string"==typeof f?c(f,b.w):c(f),g="@"==g.substr(0,1)?c(k).attr(g.substring(1)):g,f.html(e.ajaxText).load(g,function(){e.onLoad&&e.onLoad.call(this,b);h&&b.w.jqmAddClose(c(h,b.w));p(b)})):h&&b.w.jqmAddClose(c(h,b.w));e.toTop&&b.o&&b.w.before('<span id="jqmP'+b.w[0]._jqm+'"></span>').insertAfter(b.o);e.onShow?e.onShow(b):b.w.show();p(b);return d},
|
||||
close:function(a){a=l[a];if(!a.a)return d;a.a=d;m[0]&&(m.pop(),m[0]||s("unbind"));a.c.toTop&&a.o&&c("#jqmP"+a.w[0]._jqm).after(a.w).remove();if(a.c.onHide)a.c.onHide(a);else a.w.hide(),a.o&&a.o.remove();return d},params:{}};var n=0,l=c.jqm.hash,m=[],d=!1,p=function(a){try{c(":input:visible",a.w)[0].focus()}catch(d){}},s=function(a){c(document)[a]("keypress",q)[a]("keydown",q)[a]("mousedown",q)},q=function(a){var d=l[m[m.length-1]],b=!c(a.target).parents(".jqmID"+d.s)[0];b&&(c(".jqmID"+d.s).each(function(){var d=
|
||||
c(this),h=d.offset();if(h.top<=a.pageY&&a.pageY<=h.top+d.height()&&h.left<=a.pageX&&a.pageX<=h.left+d.width())return b=!1}),p(d));return!b},r=function(a,k,b){return a.each(function(){var a=this._jqm;c(k).each(function(){this[b]||(this[b]=[],c(this).click(function(){for(var a in{jqmShow:1,jqmHide:1})for(var b in this[a])if(l[this[a][b]])l[this[a][b]].w[a](this);return d}));this[b].push(a)})})}})(jQuery);
|
||||
(function(b){b.fn.jqDrag=function(a){return h(this,a,"d")};b.fn.jqResize=function(a,b){return h(this,a,"r",b)};b.jqDnR={dnr:{},e:0,drag:function(a){"d"==d.k?e.css({left:d.X+a.pageX-d.pX,top:d.Y+a.pageY-d.pY}):(e.css({width:Math.max(a.pageX-d.pX+d.W,0),height:Math.max(a.pageY-d.pY+d.H,0)}),f&&g.css({width:Math.max(a.pageX-f.pX+f.W,0),height:Math.max(a.pageY-f.pY+f.H,0)}));return!1},stop:function(){b(document).unbind("mousemove",c.drag).unbind("mouseup",c.stop)}};var c=b.jqDnR,d=c.dnr,e=c.e,g,f,h=function(a,
|
||||
c,h,n){return a.each(function(){c=c?b(c,a):a;c.bind("mousedown",{e:a,k:h},function(a){var c=a.data,k={};e=c.e;g=n?b(n):!1;if("relative"!=e.css("position"))try{e.position(k)}catch(h){}d={X:k.left||l("left")||0,Y:k.top||l("top")||0,W:l("width")||e[0].scrollWidth||0,H:l("height")||e[0].scrollHeight||0,pX:a.pageX,pY:a.pageY,k:c.k};f=g&&"d"!=c.k?{X:k.left||m("left")||0,Y:k.top||m("top")||0,W:g[0].offsetWidth||m("width")||0,H:g[0].offsetHeight||m("height")||0,pX:a.pageX,pY:a.pageY,k:c.k}:!1;if(b("input.hasDatepicker",
|
||||
e[0])[0])try{b("input.hasDatepicker",e[0]).datepicker("hide")}catch(p){}b(document).mousemove(b.jqDnR.drag).mouseup(b.jqDnR.stop);return!1})})},l=function(a){return parseInt(e.css(a),10)||!1},m=function(a){return parseInt(g.css(a),10)||!1}})(jQuery);
|
||||
(function(b){b.jgrid.extend({setSubGrid:function(){return this.each(function(){var d,c;this.p.subGridOptions=b.extend({plusicon:"ui-icon-plus",minusicon:"ui-icon-minus",openicon:"ui-icon-carat-1-sw",expandOnLoad:!1,delayOnLoad:50,selectOnExpand:!1,selectOnCollapse:!1,reloadOnExpand:!0},this.p.subGridOptions||{});this.p.colNames.unshift("");this.p.colModel.unshift({name:"subgrid",width:b.jgrid.cell_width?this.p.subGridWidth+this.p.cellLayout:this.p.subGridWidth,sortable:!1,resizable:!1,hidedlg:!0,
|
||||
search:!1,fixed:!0});d=this.p.subGridModel;if(d[0])for(d[0].align=b.extend([],d[0].align||[]),c=0;c<d[0].name.length;c++)d[0].align[c]=d[0].align[c]||"left"})},addSubGridCell:function(b,c){var a="",p,n;this.each(function(){a=this.formatCol(b,c);n=this.p.id;p=this.p.subGridOptions.plusicon});return'<td role="gridcell" aria-describedby="'+n+'_subgrid" class="ui-sgcollapsed sgcollapsed" '+a+"><a style='cursor:pointer;'><span class='ui-icon "+p+"'></span></a></td>"},addSubGrid:function(d,c){return this.each(function(){var a=
|
||||
this;if(a.grid){var p=function(c,d,h){d=b("<td align='"+a.p.subGridModel[0].align[h]+"'></td>").html(d);b(c).append(d)},n=function(c,d){var h,f,e,g=b("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),k=b("<tr></tr>");for(f=0;f<a.p.subGridModel[0].name.length;f++)h=b("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+a.p.direction+"'></th>"),b(h).html(a.p.subGridModel[0].name[f]),b(h).width(a.p.subGridModel[0].width[f]),b(k).append(h);b(g).append(k);c&&(e=a.p.xmlReader.subgrid,
|
||||
b(e.root+" "+e.row,c).each(function(){k=b("<tr class='ui-widget-content ui-subtblcell'></tr>");if(!0===e.repeatitems)b(e.cell,this).each(function(a){p(k,b(this).text()||" ",a)});else{var c=a.p.subGridModel[0].mapping||a.p.subGridModel[0].name;if(c)for(f=0;f<c.length;f++)p(k,b(c[f],this).text()||" ",f)}b(g).append(k)}));h=b("table:first",a.grid.bDiv).attr("id")+"_";b("#"+b.jgrid.jqID(h+d)).append(g);a.grid.hDiv.loading=!1;b("#load_"+b.jgrid.jqID(a.p.id)).hide();return!1},r=function(c,d){var h,
|
||||
f,e,g,k,m=b("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),l=b("<tr></tr>");for(f=0;f<a.p.subGridModel[0].name.length;f++)h=b("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+a.p.direction+"'></th>"),b(h).html(a.p.subGridModel[0].name[f]),b(h).width(a.p.subGridModel[0].width[f]),b(l).append(h);b(m).append(l);if(c&&(g=a.p.jsonReader.subgrid,h=b.jgrid.getAccessor(c,g.root),void 0!==h))for(f=0;f<h.length;f++){e=h[f];l=b("<tr class='ui-widget-content ui-subtblcell'></tr>");
|
||||
if(!0===g.repeatitems)for(g.cell&&(e=e[g.cell]),k=0;k<e.length;k++)p(l,e[k]||" ",k);else{var n=a.p.subGridModel[0].mapping||a.p.subGridModel[0].name;if(n.length)for(k=0;k<n.length;k++)p(l,e[n[k]]||" ",k)}b(m).append(l)}f=b("table:first",a.grid.bDiv).attr("id")+"_";b("#"+b.jgrid.jqID(f+d)).append(m);a.grid.hDiv.loading=!1;b("#load_"+b.jgrid.jqID(a.p.id)).hide();return!1},v=function(c){var e,d,f,g;e=b(c).attr("id");d={nd_:(new Date).getTime()};d[a.p.prmNames.subgridid]=e;if(!a.p.subGridModel[0])return!1;
|
||||
if(a.p.subGridModel[0].params)for(g=0;g<a.p.subGridModel[0].params.length;g++)for(f=0;f<a.p.colModel.length;f++)a.p.colModel[f].name===a.p.subGridModel[0].params[g]&&(d[a.p.colModel[f].name]=b("td:eq("+f+")",c).text().replace(/\ \;/ig,""));if(!a.grid.hDiv.loading)switch(a.grid.hDiv.loading=!0,b("#load_"+b.jgrid.jqID(a.p.id)).show(),a.p.subgridtype||(a.p.subgridtype=a.p.datatype),b.isFunction(a.p.subgridtype)?a.p.subgridtype.call(a,d):a.p.subgridtype=a.p.subgridtype.toLowerCase(),a.p.subgridtype){case "xml":case "json":b.ajax(b.extend({type:a.p.mtype,
|
||||
url:a.p.subGridUrl,dataType:a.p.subgridtype,data:b.isFunction(a.p.serializeSubGridData)?a.p.serializeSubGridData.call(a,d):d,complete:function(c){"xml"===a.p.subgridtype?n(c.responseXML,e):r(b.jgrid.parse(c.responseText),e)}},b.jgrid.ajaxOptions,a.p.ajaxSubgridOptions||{}))}return!1},e,m,s,t=0,g,l;b.each(a.p.colModel,function(){!0!==this.hidden&&"rn"!==this.name&&"cb"!==this.name||t++});var u=a.rows.length,q=1;void 0!==c&&0<c&&(q=c,u=c+1);for(;q<u;)b(a.rows[q]).hasClass("jqgrow")&&b(a.rows[q].cells[d]).bind("click",
|
||||
function(){var c=b(this).parent("tr")[0];l=c.nextSibling;if(b(this).hasClass("sgcollapsed")){m=a.p.id;e=c.id;if(!0===a.p.subGridOptions.reloadOnExpand||!1===a.p.subGridOptions.reloadOnExpand&&!b(l).hasClass("ui-subgrid")){s=1<=d?"<td colspan='"+d+"'> </td>":"";g=b(a).triggerHandler("jqGridSubGridBeforeExpand",[m+"_"+e,e]);(g=!1===g||"stop"===g?!1:!0)&&b.isFunction(a.p.subGridBeforeExpand)&&(g=a.p.subGridBeforeExpand.call(a,m+"_"+e,e));if(!1===g)return!1;b(c).after("<tr role='row' class='ui-subgrid'>"+
|
||||
s+"<td class='ui-widget-content subgrid-cell'><span class='ui-icon "+a.p.subGridOptions.openicon+"'></span></td><td colspan='"+parseInt(a.p.colNames.length-1-t,10)+"' class='ui-widget-content subgrid-data'><div id="+m+"_"+e+" class='tablediv'></div></td></tr>");b(a).triggerHandler("jqGridSubGridRowExpanded",[m+"_"+e,e]);b.isFunction(a.p.subGridRowExpanded)?a.p.subGridRowExpanded.call(a,m+"_"+e,e):v(c)}else b(l).show();b(this).html("<a style='cursor:pointer;'><span class='ui-icon "+a.p.subGridOptions.minusicon+
|
||||
"'></span></a>").removeClass("sgcollapsed").addClass("sgexpanded");a.p.subGridOptions.selectOnExpand&&b(a).jqGrid("setSelection",e)}else if(b(this).hasClass("sgexpanded")){g=b(a).triggerHandler("jqGridSubGridRowColapsed",[m+"_"+e,e]);g=!1===g||"stop"===g?!1:!0;e=c.id;g&&b.isFunction(a.p.subGridRowColapsed)&&(g=a.p.subGridRowColapsed.call(a,m+"_"+e,e));if(!1===g)return!1;!0===a.p.subGridOptions.reloadOnExpand?b(l).remove(".ui-subgrid"):b(l).hasClass("ui-subgrid")&&b(l).hide();b(this).html("<a style='cursor:pointer;'><span class='ui-icon "+
|
||||
a.p.subGridOptions.plusicon+"'></span></a>").removeClass("sgexpanded").addClass("sgcollapsed");a.p.subGridOptions.selectOnCollapse&&b(a).jqGrid("setSelection",e)}return!1}),q++;!0===a.p.subGridOptions.expandOnLoad&&b(a.rows).filter(".jqgrow").each(function(a,c){b(c.cells[0]).click()});a.subGridXml=function(a,b){n(a,b)};a.subGridJson=function(a,b){r(a,b)}}})},expandSubGridRow:function(d){return this.each(function(){if((this.grid||d)&&!0===this.p.subGrid){var c=b(this).jqGrid("getInd",d,!0);c&&(c=b("td.sgcollapsed",
|
||||
c)[0])&&b(c).trigger("click")}})},collapseSubGridRow:function(d){return this.each(function(){if((this.grid||d)&&!0===this.p.subGrid){var c=b(this).jqGrid("getInd",d,!0);c&&(c=b("td.sgexpanded",c)[0])&&b(c).trigger("click")}})},toggleSubGridRow:function(d){return this.each(function(){if((this.grid||d)&&!0===this.p.subGrid){var c=b(this).jqGrid("getInd",d,!0);if(c){var a=b("td.sgcollapsed",c)[0];a?b(a).trigger("click"):(a=b("td.sgexpanded",c)[0])&&b(a).trigger("click")}}})}})})(jQuery);
|
||||
(function(d){d.extend(d.jgrid,{template:function(b){var k=d.makeArray(arguments).slice(1),a,c=k.length;null==b&&(b="");return b.replace(/\{([\w\-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,function(b,m){if(!isNaN(parseInt(m,10)))return k[parseInt(m,10)];for(a=0;a<c;a++)if(d.isArray(k[a]))for(var e=k[a],f=e.length;f--;)if(m===e[f].nm)return e[f].v})}});d.jgrid.extend({groupingSetup:function(){return this.each(function(){var b,k,a=this.p.colModel,c=this.p.groupingView;if(null===c||"object"!==typeof c&&!d.isFunction(c))this.p.grouping=
|
||||
!1;else if(c.groupField.length){void 0===c.visibiltyOnNextGrouping&&(c.visibiltyOnNextGrouping=[]);c.lastvalues=[];c._locgr||(c.groups=[]);c.counters=[];for(b=0;b<c.groupField.length;b++)c.groupOrder[b]||(c.groupOrder[b]="asc"),c.groupText[b]||(c.groupText[b]="{0}"),"boolean"!==typeof c.groupColumnShow[b]&&(c.groupColumnShow[b]=!0),"boolean"!==typeof c.groupSummary[b]&&(c.groupSummary[b]=!1),c.groupSummaryPos[b]||(c.groupSummaryPos[b]="footer"),!0===c.groupColumnShow[b]?(c.visibiltyOnNextGrouping[b]=
|
||||
!0,d(this).jqGrid("showCol",c.groupField[b])):(c.visibiltyOnNextGrouping[b]=d("#"+d.jgrid.jqID(this.p.id+"_"+c.groupField[b])).is(":visible"),d(this).jqGrid("hideCol",c.groupField[b]));c.summary=[];c.hideFirstGroupCol&&(c.formatDisplayField[0]=function(a){return a});b=0;for(k=a.length;b<k;b++)c.hideFirstGroupCol&&!a[b].hidden&&c.groupField[0]===a[b].name&&(a[b].formatter=function(){return""}),a[b].summaryType&&(a[b].summaryDivider?c.summary.push({nm:a[b].name,st:a[b].summaryType,v:"",sd:a[b].summaryDivider,
|
||||
vd:"",sr:a[b].summaryRound,srt:a[b].summaryRoundType||"round"}):c.summary.push({nm:a[b].name,st:a[b].summaryType,v:"",sr:a[b].summaryRound,srt:a[b].summaryRoundType||"round"}))}else this.p.grouping=!1})},groupingPrepare:function(b,k){this.each(function(){var a=this.p.groupingView,c=this,g,m=a.groupField.length,e,f,h,p=0;for(g=0;g<m;g++)e=a.groupField[g],h=a.displayField[g],f=b[e],h=null==h?null:b[h],null==h&&(h=f),void 0!==f&&(0===k?(a.groups.push({idx:g,dataIndex:e,value:f,displayValue:h,startRow:k,
|
||||
cnt:1,summary:[]}),a.lastvalues[g]=f,a.counters[g]={cnt:1,pos:a.groups.length-1,summary:d.extend(!0,[],a.summary)}):"object"===typeof f||(d.isArray(a.isInTheSameGroup)&&d.isFunction(a.isInTheSameGroup[g])?a.isInTheSameGroup[g].call(c,a.lastvalues[g],f,g,a):a.lastvalues[g]===f)?1===p?(a.groups.push({idx:g,dataIndex:e,value:f,displayValue:h,startRow:k,cnt:1,summary:[]}),a.lastvalues[g]=f,a.counters[g]={cnt:1,pos:a.groups.length-1,summary:d.extend(!0,[],a.summary)}):(a.counters[g].cnt+=1,a.groups[a.counters[g].pos].cnt=
|
||||
a.counters[g].cnt):(a.groups.push({idx:g,dataIndex:e,value:f,displayValue:h,startRow:k,cnt:1,summary:[]}),a.lastvalues[g]=f,p=1,a.counters[g]={cnt:1,pos:a.groups.length-1,summary:d.extend(!0,[],a.summary)}),d.each(a.counters[g].summary,function(){d.isFunction(this.st)?this.v=this.st.call(c,this.v,this.nm,b):(this.v=d(c).jqGrid("groupingCalculations.handler",this.st,this.v,this.nm,this.sr,this.srt,b),"avg"===this.st.toLowerCase()&&this.sd&&(this.vd=d(c).jqGrid("groupingCalculations.handler",this.st,
|
||||
this.vd,this.sd,this.sr,this.srt,b)))}),a.groups[a.counters[g].pos].summary=a.counters[g].summary)});return this},groupingToggle:function(b){this.each(function(){var k=this.p.groupingView,a=b.split("_"),c=parseInt(a[a.length-2],10);a.splice(a.length-2,2);var g=a.join("_"),a=k.minusicon,m=k.plusicon,e=d("#"+d.jgrid.jqID(b)),e=e.length?e[0].nextSibling:null,f=d("#"+d.jgrid.jqID(b)+" span.tree-wrap-"+this.p.direction),h=function(a){a=d.map(a.split(" "),function(a){if(a.substring(0,g.length+1)===g+"_")return parseInt(a.substring(g.length+
|
||||
1),10)});return 0<a.length?a[0]:void 0},p,r=!1,q=this.p.frozenColumns?this.p.id+"_frozen":!1,n=q?d("#"+d.jgrid.jqID(b),"#"+d.jgrid.jqID(q)):!1,n=n&&n.length?n[0].nextSibling:null;if(f.hasClass(a)){if(k.showSummaryOnHide){if(e)for(;e&&!(d(e).hasClass("jqfoot")&&parseInt(d(e).attr("jqfootlevel"),10)<=c);)d(e).hide(),e=e.nextSibling,q&&(d(n).hide(),n=n.nextSibling)}else if(e)for(;e;){k=h(e.className);if(void 0!==k&&k<=c)break;d(e).hide();e=e.nextSibling;q&&(d(n).hide(),n=n.nextSibling)}f.removeClass(a).addClass(m);
|
||||
r=!0}else{if(e)for(p=void 0;e;){k=h(e.className);void 0===p&&(p=void 0===k);if(void 0!==k){if(k<=c)break;k===c+1&&(d(e).show().find(">td>span.tree-wrap-"+this.p.direction).removeClass(a).addClass(m),q&&d(n).show().find(">td>span.tree-wrap-"+this.p.direction).removeClass(a).addClass(m))}else p&&(d(e).show(),q&&d(n).show());e=e.nextSibling;q&&(n=n.nextSibling)}f.removeClass(m).addClass(a)}d(this).triggerHandler("jqGridGroupingClickGroup",[b,r]);d.isFunction(this.p.onClickGroup)&&this.p.onClickGroup.call(this,
|
||||
b,r)});return!1},groupingRender:function(b,k,a,c){return this.each(function(){function g(a,b,c){var d=!1;if(0===b)d=c[a];else{var e=c[a].idx;if(0===e)d=c[a];else for(;0<=a;a--)if(c[a].idx===e-b){d=c[a];break}}return d}function m(a,b,c,f){var h=g(a,b,c),m=e.p.colModel,n,q=h.cnt;a="";var p;for(p=f;p<k;p++){var r="<td "+e.formatCol(p,1,"")+"> </td>",t="{0}";d.each(h.summary,function(){if(this.nm===m[p].name){m[p].summaryTpl&&(t=m[p].summaryTpl);"string"===typeof this.st&&"avg"===this.st.toLowerCase()&&
|
||||
(this.sd&&this.vd?this.v/=this.vd:this.v&&0<q&&(this.v/=q));try{this.groupCount=h.cnt,this.groupIndex=h.dataIndex,this.groupValue=h.value,n=e.formatter("",this.v,p,this)}catch(a){n=this.v}r="<td "+e.formatCol(p,1,"")+">"+d.jgrid.format(t,n)+"</td>";return!1}});a+=r}return a}var e=this,f=e.p.groupingView,h="",p="",r,q,n=f.groupCollapse?f.plusicon:f.minusicon,t,y=[],z=f.groupField.length,n=n+(" tree-wrap-"+e.p.direction);d.each(e.p.colModel,function(a,b){var c;for(c=0;c<z;c++)if(f.groupField[c]===b.name){y[c]=
|
||||
a;break}});var x=0,A=d.makeArray(f.groupSummary);A.reverse();d.each(f.groups,function(g,l){if(f._locgr&&!(l.startRow+l.cnt>(a-1)*c&&l.startRow<a*c))return!0;x++;q=e.p.id+"ghead_"+l.idx;r=q+"_"+g;p="<span style='cursor:pointer;' class='ui-icon "+n+"' onclick=\"jQuery('#"+d.jgrid.jqID(e.p.id)+"').jqGrid('groupingToggle','"+r+"');return false;\"></span>";try{d.isArray(f.formatDisplayField)&&d.isFunction(f.formatDisplayField[l.idx])?(l.displayValue=f.formatDisplayField[l.idx].call(e,l.displayValue,l.value,
|
||||
e.p.colModel[y[l.idx]],l.idx,f),t=l.displayValue):t=e.formatter(r,l.displayValue,y[l.idx],l.value)}catch(C){t=l.displayValue}"header"===f.groupSummaryPos[l.idx]?(h+='<tr id="'+r+'"'+(f.groupCollapse&&0<l.idx?' style="display:none;" ':" ")+'role="row" class= "ui-widget-content jqgroup ui-row-'+e.p.direction+" "+q+'"><td style="padding-left:'+12*l.idx+'px;">'+p+d.jgrid.template(f.groupText[l.idx],t,l.cnt,l.summary)+"</td>",h+=m(g,l.idx-1,f.groups,1),h+="</tr>"):h+='<tr id="'+r+'"'+(f.groupCollapse&&
|
||||
0<l.idx?' style="display:none;" ':" ")+'role="row" class= "ui-widget-content jqgroup ui-row-'+e.p.direction+" "+q+'"><td style="padding-left:'+12*l.idx+'px;" colspan="'+k+'">'+p+d.jgrid.template(f.groupText[l.idx],t,l.cnt,l.summary)+"</td></tr>";if(z-1===l.idx){var s=f.groups[g+1],v,u=0;v=l.startRow;var B=void 0!==s?f.groups[g+1].startRow:b.length;f._locgr&&(u=(a-1)*c,u>l.startRow&&(v=u));for(;v<B&&b[v-u];v++)h+=b[v-u].join("");if("header"!==f.groupSummaryPos[l.idx]){var w;if(void 0!==s){for(w=0;w<
|
||||
f.groupField.length&&s.dataIndex!==f.groupField[w];w++);x=f.groupField.length-w}for(s=0;s<x;s++)A[s]&&(u="",f.groupCollapse&&!f.showSummaryOnHide&&(u=' style="display:none;"'),h+="<tr"+u+' jqfootlevel="'+(l.idx-s)+'" role="row" class="ui-widget-content jqfoot ui-row-'+e.p.direction+'">',h+=m(g,s,f.groups,0),h+="</tr>");x=w}}});d("#"+d.jgrid.jqID(e.p.id)+" tbody:first").append(h);h=null})},groupingGroupBy:function(b,k){return this.each(function(){"string"===typeof b&&(b=[b]);var a=this.p.groupingView;
|
||||
this.p.grouping=!0;void 0===a.visibiltyOnNextGrouping&&(a.visibiltyOnNextGrouping=[]);var c;for(c=0;c<a.groupField.length;c++)!a.groupColumnShow[c]&&a.visibiltyOnNextGrouping[c]&&d(this).jqGrid("showCol",a.groupField[c]);for(c=0;c<b.length;c++)a.visibiltyOnNextGrouping[c]=d("#"+d.jgrid.jqID(this.p.id)+"_"+d.jgrid.jqID(b[c])).is(":visible");this.p.groupingView=d.extend(this.p.groupingView,k||{});a.groupField=b;d(this).trigger("reloadGrid")})},groupingRemove:function(b){return this.each(function(){void 0===
|
||||
b&&(b=!0);this.p.grouping=!1;if(!0===b){var k=this.p.groupingView,a;for(a=0;a<k.groupField.length;a++)!k.groupColumnShow[a]&&k.visibiltyOnNextGrouping[a]&&d(this).jqGrid("showCol",k.groupField);d("tr.jqgroup, tr.jqfoot","#"+d.jgrid.jqID(this.p.id)+" tbody:first").remove();d("tr.jqgrow:hidden","#"+d.jgrid.jqID(this.p.id)+" tbody:first").show()}else d(this).trigger("reloadGrid")})},groupingCalculations:{handler:function(b,d,a,c,g,m){var e={sum:function(){return parseFloat(d||0)+parseFloat(m[a]||0)},
|
||||
min:function(){return""===d?parseFloat(m[a]||0):Math.min(parseFloat(d),parseFloat(m[a]||0))},max:function(){return""===d?parseFloat(m[a]||0):Math.max(parseFloat(d),parseFloat(m[a]||0))},count:function(){""===d&&(d=0);return m.hasOwnProperty(a)?d+1:0},avg:function(){return e.sum()}};if(!e[b])throw"jqGrid Grouping No such method: "+b;b=e[b]();null!=c&&("fixed"===g?b=b.toFixed(c):(c=Math.pow(10,c),b=Math.round(b*c)/c));return b}}})})(jQuery);
|
||||
(function(d){d.jgrid.extend({setTreeNode:function(b,c){return this.each(function(){var a=this;if(a.grid&&a.p.treeGrid)for(var h=a.p.expColInd,e=a.p.treeReader.expanded_field,k=a.p.treeReader.leaf_field,g=a.p.treeReader.level_field,f=a.p.treeReader.icon_field,n=a.p.treeReader.loaded,m,p,q,l;b<c;)l=d.jgrid.stripPref(a.p.idPrefix,a.rows[b].id),l=a.p.data[a.p._index[l]],"nested"!==a.p.treeGridModel||l[k]||(m=parseInt(l[a.p.treeReader.left_field],10),p=parseInt(l[a.p.treeReader.right_field],10),l[k]=p===
|
||||
m+1?"true":"false",a.rows[b].cells[a.p._treeleafpos].innerHTML=l[k]),m=parseInt(l[g],10),0===a.p.tree_root_level?(q=m+1,p=m):(q=m,p=m-1),q="<div class='tree-wrap tree-wrap-"+a.p.direction+"' style='width:"+18*q+"px;'>",q+="<div style='"+("rtl"===a.p.direction?"right:":"left:")+18*p+"px;' class='ui-icon ",void 0!==l[n]&&(l[n]="true"===l[n]||!0===l[n]?!0:!1),"true"===l[k]||!0===l[k]?(q+=(void 0!==l[f]&&""!==l[f]?l[f]:a.p.treeIcons.leaf)+" tree-leaf treeclick",l[k]=!0,p="leaf"):(l[k]=!1,p=""),l[e]=("true"===
|
||||
l[e]||!0===l[e]?!0:!1)&&(l[n]||void 0===l[n]),q=!1===l[e]?q+(!0===l[k]?"'":a.p.treeIcons.plus+" tree-plus treeclick'"):q+(!0===l[k]?"'":a.p.treeIcons.minus+" tree-minus treeclick'"),q+="></div></div>",d(a.rows[b].cells[h]).wrapInner("<span class='cell-wrapper"+p+"'></span>").prepend(q),m!==parseInt(a.p.tree_root_level,10)&&((l=(l=d(a).jqGrid("getNodeParent",l))&&l.hasOwnProperty(e)?l[e]:!0)||d(a.rows[b]).css("display","none")),d(a.rows[b].cells[h]).find("div.treeclick").bind("click",function(b){b=
|
||||
d.jgrid.stripPref(a.p.idPrefix,d(b.target||b.srcElement,a.rows).closest("tr.jqgrow")[0].id);b=a.p._index[b];a.p.data[b][k]||(a.p.data[b][e]?(d(a).jqGrid("collapseRow",a.p.data[b]),d(a).jqGrid("collapseNode",a.p.data[b])):(d(a).jqGrid("expandRow",a.p.data[b]),d(a).jqGrid("expandNode",a.p.data[b])));return!1}),!0===a.p.ExpandColClick&&d(a.rows[b].cells[h]).find("span.cell-wrapper").css("cursor","pointer").bind("click",function(b){b=d.jgrid.stripPref(a.p.idPrefix,d(b.target||b.srcElement,a.rows).closest("tr.jqgrow")[0].id);
|
||||
var c=a.p._index[b];a.p.data[c][k]||(a.p.data[c][e]?(d(a).jqGrid("collapseRow",a.p.data[c]),d(a).jqGrid("collapseNode",a.p.data[c])):(d(a).jqGrid("expandRow",a.p.data[c]),d(a).jqGrid("expandNode",a.p.data[c])));d(a).jqGrid("setSelection",b);return!1}),b++})},setTreeGrid:function(){return this.each(function(){var b=this,c=0,a,h=!1,e,k,g=[];if(b.p.treeGrid){b.p.treedatatype||d.extend(b.p,{treedatatype:b.p.datatype});b.p.subGrid=!1;b.p.altRows=!1;b.p.pgbuttons=!1;b.p.pginput=!1;b.p.gridview=!0;null===
|
||||
b.p.rowTotal&&(b.p.rowNum=1E4);b.p.multiselect=!1;b.p.rowList=[];b.p.expColInd=0;a="ui-icon-triangle-1-"+("rtl"===b.p.direction?"w":"e");b.p.treeIcons=d.extend({plus:a,minus:"ui-icon-triangle-1-s",leaf:"ui-icon-radio-off"},b.p.treeIcons||{});"nested"===b.p.treeGridModel?b.p.treeReader=d.extend({level_field:"level",left_field:"lft",right_field:"rgt",leaf_field:"isLeaf",expanded_field:"expanded",loaded:"loaded",icon_field:"icon"},b.p.treeReader):"adjacency"===b.p.treeGridModel&&(b.p.treeReader=d.extend({level_field:"level",
|
||||
parent_id_field:"parent",leaf_field:"isLeaf",expanded_field:"expanded",loaded:"loaded",icon_field:"icon"},b.p.treeReader));for(e in b.p.colModel)if(b.p.colModel.hasOwnProperty(e))for(k in a=b.p.colModel[e].name,a!==b.p.ExpandColumn||h||(h=!0,b.p.expColInd=c),c++,b.p.treeReader)b.p.treeReader.hasOwnProperty(k)&&b.p.treeReader[k]===a&&g.push(a);d.each(b.p.treeReader,function(a,e){e&&-1===d.inArray(e,g)&&("leaf_field"===a&&(b.p._treeleafpos=c),c++,b.p.colNames.push(e),b.p.colModel.push({name:e,width:1,
|
||||
hidden:!0,sortable:!1,resizable:!1,hidedlg:!0,editable:!0,search:!1}))})}})},expandRow:function(b){this.each(function(){var c=this;if(c.grid&&c.p.treeGrid){var a=d(c).jqGrid("getNodeChildren",b),h=c.p.treeReader.expanded_field;d(a).each(function(){var a=c.p.idPrefix+d.jgrid.getAccessor(this,c.p.localReader.id);d(d(c).jqGrid("getGridRowById",a)).css("display","");this[h]&&d(c).jqGrid("expandRow",this)})}})},collapseRow:function(b){this.each(function(){var c=this;if(c.grid&&c.p.treeGrid){var a=d(c).jqGrid("getNodeChildren",
|
||||
b),h=c.p.treeReader.expanded_field;d(a).each(function(){var a=c.p.idPrefix+d.jgrid.getAccessor(this,c.p.localReader.id);d(d(c).jqGrid("getGridRowById",a)).css("display","none");this[h]&&d(c).jqGrid("collapseRow",this)})}})},getRootNodes:function(){var b=[];this.each(function(){var c=this;if(c.grid&&c.p.treeGrid)switch(c.p.treeGridModel){case "nested":var a=c.p.treeReader.level_field;d(c.p.data).each(function(){parseInt(this[a],10)===parseInt(c.p.tree_root_level,10)&&b.push(this)});break;case "adjacency":var h=
|
||||
c.p.treeReader.parent_id_field;d(c.p.data).each(function(){null!==this[h]&&"null"!==String(this[h]).toLowerCase()||b.push(this)})}});return b},getNodeDepth:function(b){var c=null;this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":c=parseInt(b[this.p.treeReader.level_field],10)-parseInt(this.p.tree_root_level,10);break;case "adjacency":c=d(this).jqGrid("getNodeAncestors",b).length}});return c},getNodeParent:function(b){var c=null;this.each(function(){var a=
|
||||
this;if(a.grid&&a.p.treeGrid)switch(a.p.treeGridModel){case "nested":var h=a.p.treeReader.left_field,e=a.p.treeReader.right_field,k=a.p.treeReader.level_field,g=parseInt(b[h],10),f=parseInt(b[e],10),n=parseInt(b[k],10);d(this.p.data).each(function(){if(parseInt(this[k],10)===n-1&&parseInt(this[h],10)<g&&parseInt(this[e],10)>f)return c=this,!1});break;case "adjacency":var m=a.p.treeReader.parent_id_field,p=a.p.localReader.id;d(this.p.data).each(function(){if(this[p]===d.jgrid.stripPref(a.p.idPrefix,
|
||||
b[m]))return c=this,!1})}});return c},getNodeChildren:function(b){var c=[];this.each(function(){var a=this;if(a.grid&&a.p.treeGrid)switch(a.p.treeGridModel){case "nested":var h=a.p.treeReader.left_field,e=a.p.treeReader.right_field,k=a.p.treeReader.level_field,g=parseInt(b[h],10),f=parseInt(b[e],10),n=parseInt(b[k],10);d(this.p.data).each(function(){parseInt(this[k],10)===n+1&&parseInt(this[h],10)>g&&parseInt(this[e],10)<f&&c.push(this)});break;case "adjacency":var m=a.p.treeReader.parent_id_field,
|
||||
p=a.p.localReader.id;d(this.p.data).each(function(){this[m]==d.jgrid.stripPref(a.p.idPrefix,b[p])&&c.push(this)})}});return c},getFullTreeNode:function(b){var c=[];this.each(function(){var a=this,h;if(a.grid&&a.p.treeGrid)switch(a.p.treeGridModel){case "nested":var e=a.p.treeReader.left_field,k=a.p.treeReader.right_field,g=a.p.treeReader.level_field,f=parseInt(b[e],10),n=parseInt(b[k],10),m=parseInt(b[g],10);d(this.p.data).each(function(){parseInt(this[g],10)>=m&&parseInt(this[e],10)>=f&&parseInt(this[e],
|
||||
10)<=n&&c.push(this)});break;case "adjacency":if(b){c.push(b);var p=a.p.treeReader.parent_id_field,q=a.p.localReader.id;d(this.p.data).each(function(b){h=c.length;for(b=0;b<h;b++)if(d.jgrid.stripPref(a.p.idPrefix,c[b][q])===this[p]){c.push(this);break}})}}});return c},getNodeAncestors:function(b){var c=[];this.each(function(){if(this.grid&&this.p.treeGrid)for(var a=d(this).jqGrid("getNodeParent",b);a;)c.push(a),a=d(this).jqGrid("getNodeParent",a)});return c},isVisibleNode:function(b){var c=!0;this.each(function(){if(this.grid&&
|
||||
this.p.treeGrid){var a=d(this).jqGrid("getNodeAncestors",b),h=this.p.treeReader.expanded_field;d(a).each(function(){c=c&&this[h];if(!c)return!1})}});return c},isNodeLoaded:function(b){var c;this.each(function(){if(this.grid&&this.p.treeGrid){var a=this.p.treeReader.leaf_field,h=this.p.treeReader.loaded;c=void 0!==b?void 0!==b[h]?b[h]:b[a]||0<d(this).jqGrid("getNodeChildren",b).length?!0:!1:!1}});return c},expandNode:function(b){return this.each(function(){if(this.grid&&this.p.treeGrid){var c=this.p.treeReader.expanded_field,
|
||||
a=this.p.treeReader.parent_id_field,h=this.p.treeReader.loaded,e=this.p.treeReader.level_field,k=this.p.treeReader.left_field,g=this.p.treeReader.right_field;if(!b[c]){var f=d.jgrid.getAccessor(b,this.p.localReader.id),n=d("#"+this.p.idPrefix+d.jgrid.jqID(f),this.grid.bDiv)[0],m=this.p._index[f];d(this).jqGrid("isNodeLoaded",this.p.data[m])?(b[c]=!0,d("div.treeclick",n).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus")):this.grid.hDiv.loading||(b[c]=!0,
|
||||
d("div.treeclick",n).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus"),this.p.treeANode=n.rowIndex,this.p.datatype=this.p.treedatatype,"nested"===this.p.treeGridModel?d(this).jqGrid("setGridParam",{postData:{nodeid:f,n_left:b[k],n_right:b[g],n_level:b[e]}}):d(this).jqGrid("setGridParam",{postData:{nodeid:f,parentid:b[a],n_level:b[e]}}),d(this).trigger("reloadGrid"),b[h]=!0,"nested"===this.p.treeGridModel?d(this).jqGrid("setGridParam",{postData:{nodeid:"",
|
||||
n_left:"",n_right:"",n_level:""}}):d(this).jqGrid("setGridParam",{postData:{nodeid:"",parentid:"",n_level:""}}))}}})},collapseNode:function(b){return this.each(function(){if(this.grid&&this.p.treeGrid){var c=this.p.treeReader.expanded_field;b[c]&&(b[c]=!1,c=d.jgrid.getAccessor(b,this.p.localReader.id),c=d("#"+this.p.idPrefix+d.jgrid.jqID(c),this.grid.bDiv)[0],d("div.treeclick",c).removeClass(this.p.treeIcons.minus+" tree-minus").addClass(this.p.treeIcons.plus+" tree-plus"))}})},SortTree:function(b,
|
||||
c,a,h){return this.each(function(){if(this.grid&&this.p.treeGrid){var e,k,g,f=[],n=this,m;e=d(this).jqGrid("getRootNodes");e=d.jgrid.from(e);e.orderBy(b,c,a,h);m=e.select();e=0;for(k=m.length;e<k;e++)g=m[e],f.push(g),d(this).jqGrid("collectChildrenSortTree",f,g,b,c,a,h);d.each(f,function(a){var b=d.jgrid.getAccessor(this,n.p.localReader.id);d("#"+d.jgrid.jqID(n.p.id)+" tbody tr:eq("+a+")").after(d("tr#"+d.jgrid.jqID(b),n.grid.bDiv))});f=m=e=null}})},collectChildrenSortTree:function(b,c,a,h,e,k){return this.each(function(){if(this.grid&&
|
||||
this.p.treeGrid){var g,f,n,m;g=d(this).jqGrid("getNodeChildren",c);g=d.jgrid.from(g);g.orderBy(a,h,e,k);m=g.select();g=0;for(f=m.length;g<f;g++)n=m[g],b.push(n),d(this).jqGrid("collectChildrenSortTree",b,n,a,h,e,k)}})},setTreeRow:function(b,c){var a=!1;this.each(function(){this.grid&&this.p.treeGrid&&(a=d(this).jqGrid("setRowData",b,c))});return a},delTreeNode:function(b){return this.each(function(){var c=this.p.localReader.id,a,h=this.p.treeReader.left_field,e=this.p.treeReader.right_field,k,g,f;
|
||||
if(this.grid&&this.p.treeGrid&&(a=this.p._index[b],void 0!==a)){k=parseInt(this.p.data[a][e],10);g=k-parseInt(this.p.data[a][h],10)+1;var n=d(this).jqGrid("getFullTreeNode",this.p.data[a]);if(0<n.length)for(a=0;a<n.length;a++)d(this).jqGrid("delRowData",n[a][c]);if("nested"===this.p.treeGridModel){c=d.jgrid.from(this.p.data).greater(h,k,{stype:"integer"}).select();if(c.length)for(f in c)c.hasOwnProperty(f)&&(c[f][h]=parseInt(c[f][h],10)-g);c=d.jgrid.from(this.p.data).greater(e,k,{stype:"integer"}).select();
|
||||
if(c.length)for(f in c)c.hasOwnProperty(f)&&(c[f][e]=parseInt(c[f][e],10)-g)}}})},addChildNode:function(b,c,a,h){var e=this[0];if(a){var k=e.p.treeReader.expanded_field,g=e.p.treeReader.leaf_field,f=e.p.treeReader.level_field,n=e.p.treeReader.parent_id_field,m=e.p.treeReader.left_field,p=e.p.treeReader.right_field,q=e.p.treeReader.loaded,l,u,t,w,s;l=0;var v=c,x;void 0===h&&(h=!1);if(void 0===b||null===b){s=e.p.data.length-1;if(0<=s)for(;0<=s;)l=Math.max(l,parseInt(e.p.data[s][e.p.localReader.id],
|
||||
10)),s--;b=l+1}var y=d(e).jqGrid("getInd",c);x=!1;void 0===c||null===c||""===c?(v=c=null,l="last",w=e.p.tree_root_level,s=e.p.data.length+1):(l="after",u=e.p._index[c],t=e.p.data[u],c=t[e.p.localReader.id],w=parseInt(t[f],10)+1,s=d(e).jqGrid("getFullTreeNode",t),s.length?(v=s=s[s.length-1][e.p.localReader.id],s=d(e).jqGrid("getInd",v)+1):s=d(e).jqGrid("getInd",c)+1,t[g]&&(x=!0,t[k]=!0,d(e.rows[y]).find("span.cell-wrapperleaf").removeClass("cell-wrapperleaf").addClass("cell-wrapper").end().find("div.tree-leaf").removeClass(e.p.treeIcons.leaf+
|
||||
" tree-leaf").addClass(e.p.treeIcons.minus+" tree-minus"),e.p.data[u][g]=!1,t[q]=!0));u=s+1;void 0===a[k]&&(a[k]=!1);void 0===a[q]&&(a[q]=!1);a[f]=w;void 0===a[g]&&(a[g]=!0);"adjacency"===e.p.treeGridModel&&(a[n]=c);if("nested"===e.p.treeGridModel){var r;if(null!==c){g=parseInt(t[p],10);f=d.jgrid.from(e.p.data);f=f.greaterOrEquals(p,g,{stype:"integer"});f=f.select();if(f.length)for(r in f)f.hasOwnProperty(r)&&(f[r][m]=f[r][m]>g?parseInt(f[r][m],10)+2:f[r][m],f[r][p]=f[r][p]>=g?parseInt(f[r][p],10)+
|
||||
2:f[r][p]);a[m]=g;a[p]=g+1}else{g=parseInt(d(e).jqGrid("getCol",p,!1,"max"),10);f=d.jgrid.from(e.p.data).greater(m,g,{stype:"integer"}).select();if(f.length)for(r in f)f.hasOwnProperty(r)&&(f[r][m]=parseInt(f[r][m],10)+2);f=d.jgrid.from(e.p.data).greater(p,g,{stype:"integer"}).select();if(f.length)for(r in f)f.hasOwnProperty(r)&&(f[r][p]=parseInt(f[r][p],10)+2);a[m]=g+1;a[p]=g+2}}if(null===c||d(e).jqGrid("isNodeLoaded",t)||x)d(e).jqGrid("addRowData",b,a,l,v),d(e).jqGrid("setTreeNode",s,u);t&&!t[k]&&
|
||||
h&&d(e.rows[y]).find("div.treeclick").click()}}})})(jQuery);
|
||||
(function(d){function I(d,n){var h,e,v=[],r;if(!this||"function"!==typeof d||d instanceof RegExp)throw new TypeError;r=this.length;for(h=0;h<r;h++)if(this.hasOwnProperty(h)&&(e=this[h],d.call(n,e,h,this))){v.push(e);break}return v}d.assocArraySize=function(d){var n=0,h;for(h in d)d.hasOwnProperty(h)&&n++;return n};d.jgrid.extend({pivotSetup:function(q,n){var h=[],e=[],v=[],r=[],b={grouping:!0,groupingView:{groupField:[],groupSummary:[],groupSummaryPos:[]}},f=[],c=d.extend({rowTotals:!1,rowTotalsText:"Total",
|
||||
colTotals:!1,groupSummary:!0,groupSummaryPos:"header",frozenStaticCols:!1},n||{});this.each(function(){function n(C,c,a){C=I.call(C,c,a);return 0<C.length?C[0]:null}function J(c,a){var d=0,f=!0,h;for(h in c){if(c[h]!=this[d]){f=!1;break}d++;if(d>=this.length)break}f&&(D=a);return f}function E(c,a,f,h){var g=a.length,b,k,e,l;l=d.isArray(f)?f.length:1;r=[];for(e=r.root=0;e<l;e++){var n=[],m;for(b=0;b<g;b++){if(null==f)m=k=d.trim(a[b].member)+"_"+a[b].aggregator;else{m=f[e].replace(/\s+/g,"");try{k=
|
||||
1===g?m:m+"_"+a[b].aggregator+"_"+b}catch(v){}}var t=h,u=k,x=n,y=k,w=h[k],p=a[b].member,q=c,s=void 0;switch(a[b].aggregator){case "sum":s=parseFloat(w||0)+parseFloat(q[p]||0);break;case "count":if(""===w||null==w)w=0;s=q.hasOwnProperty(p)?w+1:0;break;case "min":s=""===w||null==w?parseFloat(q[p]||0):Math.min(parseFloat(w),parseFloat(q[p]||0));break;case "max":s=""===w||null==w?parseFloat(q[p]||0):Math.max(parseFloat(w),parseFloat(q[p]||0))}t[u]=x[y]=s}r[m]=n}return h}function H(a){var d,b,g,k,e;for(g in a)if(a.hasOwnProperty(g)){if("object"!==
|
||||
typeof a[g]&&("level"===g&&(void 0===F[a.level]&&(F[a.level]="",0<a.level&&"_r_Totals"!==a.text&&(f[a.level-1]={useColSpanStyle:!1,groupHeaders:[]})),F[a.level]!==a.text&&a.children.length&&"_r_Totals"!==a.text&&0<a.level&&(f[a.level-1].groupHeaders.push({titleText:a.text}),b=f[a.level-1].groupHeaders.length,e=1===b?K:G+(b-1)*z,f[a.level-1].groupHeaders[b-1].startColumnName=h[e].name,f[a.level-1].groupHeaders[b-1].numberOfColumns=h.length-e,G=h.length),F[a.level]=a.text),a.level===l&&"level"===g&&
|
||||
0<l))if(1<z){b=1;for(d in a.fields)1===b&&f[l-1].groupHeaders.push({startColumnName:d,numberOfColumns:1,titleText:a.text}),b++;f[l-1].groupHeaders[f[l-1].groupHeaders.length-1].numberOfColumns=b-1}else f.splice(l-1,1);null!=a[g]&&"object"===typeof a[g]&&H(a[g]);if("level"===g&&0<a.level)for(d in b=0,a.fields){e={};for(k in c.aggregates[b])if(c.aggregates[b].hasOwnProperty(k))switch(k){case "member":case "label":case "aggregator":break;default:e[k]=c.aggregates[b][k]}1<z?(e.name=d,e.label=c.aggregates[b].label||
|
||||
d):(e.name=a.text,e.label="_r_Totals"===a.text?c.rowTotalsText:a.text);h.push(e);b++}}}var m,D,a,y=q.length,s,l,z,k,p=0;c.rowTotals&&0<c.yDimension.length&&(c.yDimension.splice(0,0,{dataName:c.yDimension[0].dataName}),c.yDimension[0].converter=function(){return"_r_Totals"});s=d.isArray(c.xDimension)?c.xDimension.length:0;l=c.yDimension.length;z=d.isArray(c.aggregates)?c.aggregates.length:0;if(0===s||0===z)throw"xDimension or aggregates optiona are not set!";var x;for(a=0;a<s;a++)x={name:c.xDimension[a].dataName,
|
||||
frozen:c.frozenStaticCols},x=d.extend(!0,x,c.xDimension[a]),h.push(x);x=s-1;for(var A={};p<y;){m=q[p];var t=[],u=[];k={};a=0;do t[a]=d.trim(m[c.xDimension[a].dataName]),k[c.xDimension[a].dataName]=t[a],a++;while(a<s);var g=0;D=-1;a=n(e,J,t);if(!a){g=0;if(1<=l){for(g=0;g<l;g++)u[g]=d.trim(m[c.yDimension[g].dataName]),c.yDimension[g].converter&&d.isFunction(c.yDimension[g].converter)&&(u[g]=c.yDimension[g].converter.call(this,u[g],t,u));k=E(m,c.aggregates,u,k)}else 0===l&&(k=E(m,c.aggregates,null,k));
|
||||
e.push(k)}else if(0<=D){g=0;if(1<=l){for(g=0;g<l;g++)u[g]=d.trim(m[c.yDimension[g].dataName]),c.yDimension[g].converter&&d.isFunction(c.yDimension[g].converter)&&(u[g]=c.yDimension[g].converter.call(this,u[g],t,u));a=E(m,c.aggregates,u,a)}else 0===l&&(a=E(m,c.aggregates,null,a));e[D]=a}m=0;var t=k=null,B;for(B in r){if(0===m)A.children&&void 0!==A.children||(A={text:B,level:0,children:[]}),k=A.children;else{t=null;for(a=0;a<k.length;a++)if(k[a].text===B){t=k[a];break}t?k=t.children:(k.push({children:[],
|
||||
text:B,level:m,fields:r[B]}),k=k[k.length-1].children)}m++}p++}var F=[],G=h.length,K=G;0<l&&(f[l-1]={useColSpanStyle:!1,groupHeaders:[]});H(A,0);if(c.colTotals)for(p=e.length;p--;)for(a=s;a<h.length;a++)y=h[a].name,v[y]=v[y]?v[y]+parseFloat(e[p][y]||0):parseFloat(e[p][y]||0);if(0<x)for(a=0;a<x;a++)b.groupingView.groupField[a]=h[a].name,b.groupingView.groupSummary[a]=c.groupSummary,b.groupingView.groupSummaryPos[a]=c.groupSummaryPos;else b.grouping=!1;b.sortname=h[x].name;b.groupingView.hideFirstGroupCol=
|
||||
!0});return{colModel:h,rows:e,groupOptions:b,groupHeaders:f,summary:v}},jqPivot:function(q,n,h,e){return this.each(function(){function v(b){var f=jQuery(r).jqGrid("pivotSetup",b,n),c=0<d.assocArraySize(f.summary)?!0:!1,e=d.jgrid.from(f.rows);for(b=0;b<f.groupOptions.groupingView.groupField.length;b++)e.orderBy(f.groupOptions.groupingView.groupField[b],"a","text","");jQuery(r).jqGrid(d.extend({datastr:d.extend(e.select(),c?{userdata:f.summary}:{}),datatype:"jsonstring",footerrow:c,userDataOnFooter:c,
|
||||
colModel:f.colModel,viewrecords:!0,sortname:n.xDimension[0].dataName},h||{},f.groupOptions));f=f.groupHeaders;if(f.length)for(b=0;b<f.length;b++)f[b]&&f[b].groupHeaders.length&&jQuery(r).jqGrid("setGroupHeaders",f[b]);n.frozenStaticCols&&jQuery(r).jqGrid("setFrozenColumns")}var r=this;"string"===typeof q?d.ajax(d.extend({url:q,dataType:"json",success:function(b){v(d.jgrid.getAccessor(b,e&&e.reader?e.reader:"rows"))}},e||{})):v(q)})}})})(jQuery);
|
||||
(function(c){c.jgrid.extend({jqGridImport:function(a){a=c.extend({imptype:"xml",impstring:"",impurl:"",mtype:"GET",impData:{},xmlGrid:{config:"roots>grid",data:"roots>rows"},jsonGrid:{config:"grid",data:"data"},ajaxOptions:{}},a||{});return this.each(function(){var d=this,f=function(a,b){var e=c(b.xmlGrid.config,a)[0],h=c(b.xmlGrid.data,a)[0],f,g;if(xmlJsonClass.xml2json&&c.jgrid.parse){e=xmlJsonClass.xml2json(e," ");e=c.jgrid.parse(e);for(g in e)e.hasOwnProperty(g)&&(f=e[g]);h?(h=e.grid.datatype,
|
||||
e.grid.datatype="xmlstring",e.grid.datastr=a,c(d).jqGrid(f).jqGrid("setGridParam",{datatype:h})):c(d).jqGrid(f)}else alert("xml2json or parse are not present")},b=function(a,b){if(a&&"string"===typeof a){var e=!1;c.jgrid.useJSON&&(c.jgrid.useJSON=!1,e=!0);var f=c.jgrid.parse(a);e&&(c.jgrid.useJSON=!0);e=f[b.jsonGrid.config];if(f=f[b.jsonGrid.data]){var g=e.datatype;e.datatype="jsonstring";e.datastr=f;c(d).jqGrid(e).jqGrid("setGridParam",{datatype:g})}else c(d).jqGrid(e)}};switch(a.imptype){case "xml":c.ajax(c.extend({url:a.impurl,
|
||||
type:a.mtype,data:a.impData,dataType:"xml",complete:function(b,g){"success"===g&&(f(b.responseXML,a),c(d).triggerHandler("jqGridImportComplete",[b,a]),c.isFunction(a.importComplete)&&a.importComplete(b))}},a.ajaxOptions));break;case "xmlstring":if(a.impstring&&"string"===typeof a.impstring){var g=c.parseXML(a.impstring);g&&(f(g,a),c(d).triggerHandler("jqGridImportComplete",[g,a]),c.isFunction(a.importComplete)&&a.importComplete(g),a.impstring=null);g=null}break;case "json":c.ajax(c.extend({url:a.impurl,
|
||||
type:a.mtype,data:a.impData,dataType:"json",complete:function(f){try{b(f.responseText,a),c(d).triggerHandler("jqGridImportComplete",[f,a]),c.isFunction(a.importComplete)&&a.importComplete(f)}catch(g){}}},a.ajaxOptions));break;case "jsonstring":a.impstring&&"string"===typeof a.impstring&&(b(a.impstring,a),c(d).triggerHandler("jqGridImportComplete",[a.impstring,a]),c.isFunction(a.importComplete)&&a.importComplete(a.impstring),a.impstring=null)}})},jqGridExport:function(a){a=c.extend({exptype:"xmlstring",
|
||||
root:"grid",ident:"\t"},a||{});var d=null;this.each(function(){if(this.grid){var f,b=c.extend(!0,{},c(this).jqGrid("getGridParam"));b.rownumbers&&(b.colNames.splice(0,1),b.colModel.splice(0,1));b.multiselect&&(b.colNames.splice(0,1),b.colModel.splice(0,1));b.subGrid&&(b.colNames.splice(0,1),b.colModel.splice(0,1));b.knv=null;if(b.treeGrid)for(f in b.treeReader)b.treeReader.hasOwnProperty(f)&&(b.colNames.splice(b.colNames.length-1),b.colModel.splice(b.colModel.length-1));switch(a.exptype){case "xmlstring":d=
|
||||
"<"+a.root+">"+xmlJsonClass.json2xml(b,a.ident)+"</"+a.root+">";break;case "jsonstring":d="{"+xmlJsonClass.toJson(b,a.root,a.ident,!1)+"}",void 0!==b.postData.filters&&(d=d.replace(/filters":"/,'filters":'),d=d.replace(/}]}"/,"}]}"))}}});return d},excelExport:function(a){a=c.extend({exptype:"remote",url:null,oper:"oper",tag:"excel",exportOptions:{}},a||{});return this.each(function(){if(this.grid){var d;"remote"===a.exptype&&(d=c.extend({},this.p.postData),d[a.oper]=a.tag,d=jQuery.param(d),d=-1!==
|
||||
a.url.indexOf("?")?a.url+"&"+d:a.url+"?"+d,window.location=d)}})}})})(jQuery);
|
||||
var xmlJsonClass={xml2json:function(a,b){9===a.nodeType&&(a=a.documentElement);var g=this.removeWhite(a),g=this.toObj(g),g=this.toJson(g,a.nodeName,"\t");return"{\n"+b+(b?g.replace(/\t/g,b):g.replace(/\t|\n/g,""))+"\n}"},json2xml:function(a,b){var g=function(a,b,e){var d="",f,k;if(a instanceof Array)if(0===a.length)d+=e+"<"+b+">__EMPTY_ARRAY_</"+b+">\n";else for(f=0,k=a.length;f<k;f+=1)var n=e+g(a[f],b,e+"\t")+"\n",d=d+n;else if("object"===typeof a){f=!1;d+=e+"<"+b;for(k in a)a.hasOwnProperty(k)&&
|
||||
("@"===k.charAt(0)?d+=" "+k.substr(1)+'="'+a[k].toString()+'"':f=!0);d+=f?">":"/>";if(f){for(k in a)a.hasOwnProperty(k)&&("#text"===k?d+=a[k]:"#cdata"===k?d+="<![CDATA["+a[k]+"]]\x3e":"@"!==k.charAt(0)&&(d+=g(a[k],k,e+"\t")));d+=("\n"===d.charAt(d.length-1)?e:"")+"</"+b+">"}}else"function"===typeof a?d+=e+"<"+b+"><![CDATA["+a+"]]\x3e</"+b+">":(void 0===a&&(a=""),d='""'===a.toString()||0===a.toString().length?d+(e+"<"+b+">__EMPTY_STRING_</"+b+">"):d+(e+"<"+b+">"+a.toString()+"</"+b+">"));return d},
|
||||
f="",e;for(e in a)a.hasOwnProperty(e)&&(f+=g(a[e],e,""));return b?f.replace(/\t/g,b):f.replace(/\t|\n/g,"")},toObj:function(a){var b={},g=/function/i;if(1===a.nodeType){if(a.attributes.length){var f;for(f=0;f<a.attributes.length;f+=1)b["@"+a.attributes[f].nodeName]=(a.attributes[f].nodeValue||"").toString()}if(a.firstChild){var e=f=0,h=!1,c;for(c=a.firstChild;c;c=c.nextSibling)1===c.nodeType?h=!0:3===c.nodeType&&c.nodeValue.match(/[^ \f\n\r\t\v]/)?f+=1:4===c.nodeType&&(e+=1);if(h)if(2>f&&2>e)for(this.removeWhite(a),
|
||||
c=a.firstChild;c;c=c.nextSibling)3===c.nodeType?b["#text"]=this.escape(c.nodeValue):4===c.nodeType?g.test(c.nodeValue)?b[c.nodeName]=[b[c.nodeName],c.nodeValue]:b["#cdata"]=this.escape(c.nodeValue):b[c.nodeName]?b[c.nodeName]instanceof Array?b[c.nodeName][b[c.nodeName].length]=this.toObj(c):b[c.nodeName]=[b[c.nodeName],this.toObj(c)]:b[c.nodeName]=this.toObj(c);else a.attributes.length?b["#text"]=this.escape(this.innerXml(a)):b=this.escape(this.innerXml(a));else if(f)a.attributes.length?b["#text"]=
|
||||
this.escape(this.innerXml(a)):(b=this.escape(this.innerXml(a)),"__EMPTY_ARRAY_"===b?b="[]":"__EMPTY_STRING_"===b&&(b=""));else if(e)if(1<e)b=this.escape(this.innerXml(a));else for(c=a.firstChild;c;c=c.nextSibling)if(g.test(a.firstChild.nodeValue)){b=a.firstChild.nodeValue;break}else b["#cdata"]=this.escape(c.nodeValue)}a.attributes.length||a.firstChild||(b=null)}else 9===a.nodeType?b=this.toObj(a.documentElement):alert("unhandled node type: "+a.nodeType);return b},toJson:function(a,b,g,f){void 0===
|
||||
f&&(f=!0);var e=b?'"'+b+'"':"",h="\t",c="\n";f||(c=h="");if("[]"===a)e+=b?":[]":"[]";else if(a instanceof Array){var l,d,m=[];d=0;for(l=a.length;d<l;d+=1)m[d]=this.toJson(a[d],"",g+h,f);e+=(b?":[":"[")+(1<m.length?c+g+h+m.join(","+c+g+h)+c+g:m.join(""))+"]"}else if(null===a)e+=(b&&":")+"null";else if("object"===typeof a){l=[];for(d in a)a.hasOwnProperty(d)&&(l[l.length]=this.toJson(a[d],d,g+h,f));e+=(b?":{":"{")+(1<l.length?c+g+h+l.join(","+c+g+h)+c+g:l.join(""))+"}"}else e="string"===typeof a?e+
|
||||
((b&&":")+'"'+a.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"'):e+((b&&":")+a.toString());return e},innerXml:function(a){var b="";if("innerHTML"in a)b=a.innerHTML;else{var g=function(a){var b="",h;if(1===a.nodeType){b+="<"+a.nodeName;for(h=0;h<a.attributes.length;h+=1)b+=" "+a.attributes[h].nodeName+'="'+(a.attributes[h].nodeValue||"").toString()+'"';if(a.firstChild){b+=">";for(h=a.firstChild;h;h=h.nextSibling)b+=g(h);b+="</"+a.nodeName+">"}else b+="/>"}else 3===a.nodeType?b+=a.nodeValue:4===a.nodeType&&
|
||||
(b+="<![CDATA["+a.nodeValue+"]]\x3e");return b};for(a=a.firstChild;a;a=a.nextSibling)b+=g(a)}return b},escape:function(a){return a.replace(/[\\]/g,"\\\\").replace(/[\"]/g,'\\"').replace(/[\n]/g,"\\n").replace(/[\r]/g,"\\r")},removeWhite:function(a){a.normalize();var b;for(b=a.firstChild;b;)if(3===b.nodeType)if(b.nodeValue.match(/[^ \f\n\r\t\v]/))b=b.nextSibling;else{var g=b.nextSibling;a.removeChild(b);b=g}else 1===b.nodeType&&this.removeWhite(b),b=b.nextSibling;return a}};
|
||||
function tableToGrid(l,m){jQuery(l).each(function(){if(!this.grid){jQuery(this).width("99%");var b=jQuery(this).width(),c=jQuery("tr td:first-child input[type=checkbox]:first",jQuery(this)),a=jQuery("tr td:first-child input[type=radio]:first",jQuery(this)),c=0<c.length,a=!c&&0<a.length,k=c||a,d=[],e=[];jQuery("th",jQuery(this)).each(function(){0===d.length&&k?(d.push({name:"__selection__",index:"__selection__",width:0,hidden:!0}),e.push("__selection__")):(d.push({name:jQuery(this).attr("id")||jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"),
|
||||
index:jQuery(this).attr("id")||jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"),width:jQuery(this).width()||150}),e.push(jQuery(this).html()))});var f=[],g=[],h=[];jQuery("tbody > tr",jQuery(this)).each(function(){var b={},a=0;jQuery("td",jQuery(this)).each(function(){if(0===a&&k){var c=jQuery("input",jQuery(this)),e=c.attr("value");g.push(e||f.length);c.is(":checked")&&h.push(e);b[d[a].name]=c.attr("value")}else b[d[a].name]=jQuery(this).html();a++});0<a&&f.push(b)});
|
||||
jQuery(this).empty();jQuery(this).addClass("scroll");jQuery(this).jqGrid(jQuery.extend({datatype:"local",width:b,colNames:e,colModel:d,multiselect:c},m||{}));for(b=0;b<f.length;b++)a=null,0<g.length&&(a=g[b])&&a.replace&&(a=encodeURIComponent(a).replace(/[.\-%]/g,"_")),null===a&&(a=b+1),jQuery(this).jqGrid("addRowData",a,f[b]);for(b=0;b<h.length;b++)jQuery(this).jqGrid("setSelection",h[b])}})};
|
||||
(function(b){b.jgrid.msie&&8===b.jgrid.msiever()&&(b.expr[":"].hidden=function(b){return 0===b.offsetWidth||0===b.offsetHeight||"none"===b.style.display});b.jgrid._multiselect=!1;if(b.ui&&b.ui.multiselect){if(b.ui.multiselect.prototype._setSelected){var r=b.ui.multiselect.prototype._setSelected;b.ui.multiselect.prototype._setSelected=function(a,d){var c=r.call(this,a,d);if(d&&this.selectedList){var e=this.element;this.selectedList.find("li").each(function(){b(this).data("optionLink")&&b(this).data("optionLink").remove().appendTo(e)})}return c}}b.ui.multiselect.prototype.destroy&&
|
||||
(b.ui.multiselect.prototype.destroy=function(){this.element.show();this.container.remove();void 0===b.Widget?b.widget.prototype.destroy.apply(this,arguments):b.Widget.prototype.destroy.apply(this,arguments)});b.jgrid._multiselect=!0}b.jgrid.extend({sortableColumns:function(a){return this.each(function(){function d(){c.p.disableClick=!0}var c=this,e=b.jgrid.jqID(c.p.id),e={tolerance:"pointer",axis:"x",scrollSensitivity:"1",items:">th:not(:has(#jqgh_"+e+"_cb,#jqgh_"+e+"_rn,#jqgh_"+e+"_subgrid),:hidden)",
|
||||
placeholder:{element:function(a){return b(document.createElement(a[0].nodeName)).addClass(a[0].className+" ui-sortable-placeholder ui-state-highlight").removeClass("ui-sortable-helper")[0]},update:function(b,a){a.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10));a.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||0,10))}},update:function(a,
|
||||
e){var d=b(e.item).parent(),d=b(">th",d),f={},g=c.p.id+"_";b.each(c.p.colModel,function(b){f[this.name]=b});var l=[];d.each(function(){var a=b(">div",this).get(0).id.replace(/^jqgh_/,"").replace(g,"");f.hasOwnProperty(a)&&l.push(f[a])});b(c).jqGrid("remapColumns",l,!0,!0);b.isFunction(c.p.sortable.update)&&c.p.sortable.update(l);setTimeout(function(){c.p.disableClick=!1},50)}};c.p.sortable.options?b.extend(e,c.p.sortable.options):b.isFunction(c.p.sortable)&&(c.p.sortable={update:c.p.sortable});if(e.start){var g=
|
||||
e.start;e.start=function(b,a){d();g.call(this,b,a)}}else e.start=d;c.p.sortable.exclude&&(e.items+=":not("+c.p.sortable.exclude+")");a.sortable(e).data("sortable").floating=!0})},columnChooser:function(a){function d(a,c){a&&("string"===typeof a?b.fn[a]&&b.fn[a].apply(c,b.makeArray(arguments).slice(2)):b.isFunction(a)&&a.apply(c,b.makeArray(arguments).slice(2)))}var c=this;if(!b("#colchooser_"+b.jgrid.jqID(c[0].p.id)).length){var e=b('<div id="colchooser_'+c[0].p.id+'" style="position:relative;overflow:hidden"><div><select multiple="multiple"></select></div></div>'),
|
||||
g=b("select",e);a=b.extend({width:420,height:240,classname:null,done:function(b){b&&c.jqGrid("remapColumns",b,!0)},msel:"multiselect",dlog:"dialog",dialog_opts:{minWidth:470},dlog_opts:function(a){var c={};c[a.bSubmit]=function(){a.apply_perm();a.cleanup(!1)};c[a.bCancel]=function(){a.cleanup(!0)};return b.extend(!0,{buttons:c,close:function(){a.cleanup(!0)},modal:a.modal||!1,resizable:a.resizable||!0,width:a.width+20},a.dialog_opts||{})},apply_perm:function(){b("option",g).each(function(){this.selected?
|
||||
c.jqGrid("showCol",k[this.value].name):c.jqGrid("hideCol",k[this.value].name)});var e=[];b("option:selected",g).each(function(){e.push(parseInt(this.value,10))});b.each(e,function(){delete p[k[parseInt(this,10)].name]});b.each(p,function(){var b=parseInt(this,10);var a=e,c=b;if(0<=c){var d=a.slice(),k=d.splice(c,Math.max(a.length-c,c));c>a.length&&(c=a.length);d[c]=b;e=d.concat(k)}else e=void 0});a.done&&a.done.call(c,e)},cleanup:function(b){d(a.dlog,e,"destroy");d(a.msel,g,"destroy");e.remove();
|
||||
b&&a.done&&a.done.call(c)},msel_opts:{}},b.jgrid.col,a||{});if(b.ui&&b.ui.multiselect&&"multiselect"===a.msel){if(!b.jgrid._multiselect){alert("Multiselect plugin loaded after jqGrid. Please load the plugin before the jqGrid!");return}a.msel_opts=b.extend(b.ui.multiselect.defaults,a.msel_opts)}a.caption&&e.attr("title",a.caption);a.classname&&(e.addClass(a.classname),g.addClass(a.classname));a.width&&(b(">div",e).css({width:a.width,margin:"0 auto"}),g.css("width",a.width));a.height&&(b(">div",e).css("height",
|
||||
a.height),g.css("height",a.height-10));var k=c.jqGrid("getGridParam","colModel"),t=c.jqGrid("getGridParam","colNames"),p={},f=[];g.empty();b.each(k,function(a){p[this.name]=a;this.hidedlg?this.hidden||f.push(a):g.append("<option value='"+a+"' "+(this.hidden?"":"selected='selected'")+">"+b.jgrid.stripHtml(t[a])+"</option>")});var q=b.isFunction(a.dlog_opts)?a.dlog_opts.call(c,a):a.dlog_opts;d(a.dlog,e,q);q=b.isFunction(a.msel_opts)?a.msel_opts.call(c,a):a.msel_opts;d(a.msel,g,q)}},sortableRows:function(a){return this.each(function(){var d=
|
||||
this;d.grid&&!d.p.treeGrid&&b.fn.sortable&&(a=b.extend({cursor:"move",axis:"y",items:".jqgrow"},a||{}),a.start&&b.isFunction(a.start)?(a._start_=a.start,delete a.start):a._start_=!1,a.update&&b.isFunction(a.update)?(a._update_=a.update,delete a.update):a._update_=!1,a.start=function(c,e){b(e.item).css("border-width","0");b("td",e.item).each(function(b){this.style.width=d.grid.cols[b].style.width});if(d.p.subGrid){var g=b(e.item).attr("id");try{b(d).jqGrid("collapseSubGridRow",g)}catch(k){}}a._start_&&
|
||||
a._start_.apply(this,[c,e])},a.update=function(c,e){b(e.item).css("border-width","");!0===d.p.rownumbers&&b("td.jqgrid-rownum",d.rows).each(function(a){b(this).html(a+1+(parseInt(d.p.page,10)-1)*parseInt(d.p.rowNum,10))});a._update_&&a._update_.apply(this,[c,e])},b("tbody:first",d).sortable(a),b("tbody:first",d).disableSelection())})},gridDnD:function(a){return this.each(function(){function d(){var a=b.data(c,"dnd");b("tr.jqgrow:not(.ui-draggable)",c).draggable(b.isFunction(a.drag)?a.drag.call(b(c),
|
||||
a):a.drag)}var c=this,e,g;if(c.grid&&!c.p.treeGrid&&b.fn.draggable&&b.fn.droppable)if(void 0===b("#jqgrid_dnd")[0]&&b("body").append("<table id='jqgrid_dnd' class='ui-jqgrid-dnd'></table>"),"string"===typeof a&&"updateDnD"===a&&!0===c.p.jqgdnd)d();else if(a=b.extend({drag:function(a){return b.extend({start:function(e,d){var f;if(c.p.subGrid){f=b(d.helper).attr("id");try{b(c).jqGrid("collapseSubGridRow",f)}catch(g){}}for(f=0;f<b.data(c,"dnd").connectWith.length;f++)0===b(b.data(c,"dnd").connectWith[f]).jqGrid("getGridParam",
|
||||
"reccount")&&b(b.data(c,"dnd").connectWith[f]).jqGrid("addRowData","jqg_empty_row",{});d.helper.addClass("ui-state-highlight");b("td",d.helper).each(function(b){this.style.width=c.grid.headers[b].width+"px"});a.onstart&&b.isFunction(a.onstart)&&a.onstart.call(b(c),e,d)},stop:function(e,d){var f;d.helper.dropped&&!a.dragcopy&&(f=b(d.helper).attr("id"),void 0===f&&(f=b(this).attr("id")),b(c).jqGrid("delRowData",f));for(f=0;f<b.data(c,"dnd").connectWith.length;f++)b(b.data(c,"dnd").connectWith[f]).jqGrid("delRowData",
|
||||
"jqg_empty_row");a.onstop&&b.isFunction(a.onstop)&&a.onstop.call(b(c),e,d)}},a.drag_opts||{})},drop:function(a){return b.extend({accept:function(a){if(!b(a).hasClass("jqgrow"))return a;a=b(a).closest("table.ui-jqgrid-btable");return 0<a.length&&void 0!==b.data(a[0],"dnd")?(a=b.data(a[0],"dnd").connectWith,-1!==b.inArray("#"+b.jgrid.jqID(this.id),a)?!0:!1):!1},drop:function(e,d){if(b(d.draggable).hasClass("jqgrow")){var f=b(d.draggable).attr("id"),f=d.draggable.parent().parent().jqGrid("getRowData",
|
||||
f);if(!a.dropbyname){var g=0,l={},h,n,s=b("#"+b.jgrid.jqID(this.id)).jqGrid("getGridParam","colModel");try{for(n in f)f.hasOwnProperty(n)&&(h=s[g].name,"cb"!==h&&"rn"!==h&&"subgrid"!==h&&f.hasOwnProperty(n)&&s[g]&&(l[h]=f[n]),g++);f=l}catch(r){}}d.helper.dropped=!0;a.beforedrop&&b.isFunction(a.beforedrop)&&(h=a.beforedrop.call(this,e,d,f,b("#"+b.jgrid.jqID(c.p.id)),b(this)),void 0!==h&&null!==h&&"object"===typeof h&&(f=h));if(d.helper.dropped){var m;a.autoid&&(b.isFunction(a.autoid)?m=a.autoid.call(this,
|
||||
f):(m=Math.ceil(1E3*Math.random()),m=a.autoidprefix+m));b("#"+b.jgrid.jqID(this.id)).jqGrid("addRowData",m,f,a.droppos)}a.ondrop&&b.isFunction(a.ondrop)&&a.ondrop.call(this,e,d,f)}}},a.drop_opts||{})},onstart:null,onstop:null,beforedrop:null,ondrop:null,drop_opts:{activeClass:"ui-state-active",hoverClass:"ui-state-hover"},drag_opts:{revert:"invalid",helper:"clone",cursor:"move",appendTo:"#jqgrid_dnd",zIndex:5E3},dragcopy:!1,dropbyname:!1,droppos:"first",autoid:!0,autoidprefix:"dnd_"},a||{}),a.connectWith)for(a.connectWith=
|
||||
a.connectWith.split(","),a.connectWith=b.map(a.connectWith,function(a){return b.trim(a)}),b.data(c,"dnd",a),0===c.p.reccount||c.p.jqgdnd||d(),c.p.jqgdnd=!0,e=0;e<a.connectWith.length;e++)g=a.connectWith[e],b(g).droppable(b.isFunction(a.drop)?a.drop.call(b(c),a):a.drop)})},gridResize:function(a){return this.each(function(){var d=this,c=b.jgrid.jqID(d.p.id);d.grid&&b.fn.resizable&&(a=b.extend({},a||{}),a.alsoResize?(a._alsoResize_=a.alsoResize,delete a.alsoResize):a._alsoResize_=!1,a.stop&&b.isFunction(a.stop)?
|
||||
(a._stop_=a.stop,delete a.stop):a._stop_=!1,a.stop=function(e,g){b(d).jqGrid("setGridParam",{height:b("#gview_"+c+" .ui-jqgrid-bdiv").height()});b(d).jqGrid("setGridWidth",g.size.width,a.shrinkToFit);a._stop_&&a._stop_.call(d,e,g)},a.alsoResize=a._alsoResize_?eval("("+("{'#gview_"+c+" .ui-jqgrid-bdiv':true,'"+a._alsoResize_+"':true}")+")"):b(".ui-jqgrid-bdiv","#gview_"+c),delete a._alsoResize_,b("#gbox_"+c).resizable(a))})}})})(jQuery);
|
||||
|
|
|
@ -878,10 +878,11 @@ $(document).ready(function () {
|
|||
}
|
||||
|
||||
function addHoverEffect(selector, normalStyle, overStyle) {
|
||||
return $(selector).addClass(normalStyle).live('mouseover', function () {
|
||||
$(document).on('mouseenter', selector, function () {
|
||||
$(this).removeClass(normalStyle).addClass(overStyle);
|
||||
}).live('mouseout', function () {
|
||||
}).on('mouseleave', selector, function () {
|
||||
$(this).removeClass(overStyle).addClass(normalStyle);
|
||||
})
|
||||
});
|
||||
return $(selector).addClass(normalStyle);
|
||||
}
|
||||
});
|
Loading…
Reference in New Issue