diff --git a/ad-code-manager.php b/ad-code-manager.php index 412147f..8a008f1 100644 --- a/ad-code-manager.php +++ b/ad-code-manager.php @@ -3,8 +3,8 @@ Plugin Name: Ad Code Manager Plugin URI: http://automattic.com Description: Easy ad code management -Author: Daniel Bachhuber, Automattic, Rinat Khaziev, doejo -Version: 0.1.3 +Author: Rinat Khaziev, Jeremy Felt, Daniel Bachhuber, Automattic, doejo +Version: 0.2 Author URI: http://automattic.com GNU General Public License, Free Software Foundation @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -define( 'AD_CODE_MANAGER_VERSION', '0.1.3' ); +define( 'AD_CODE_MANAGER_VERSION', '0.2' ); define( 'AD_CODE_MANAGER_ROOT' , dirname( __FILE__ ) ); define( 'AD_CODE_MANAGER_FILE_PATH' , AD_CODE_MANAGER_ROOT . '/' . basename( __FILE__ ) ); define( 'AD_CODE_MANAGER_URL' , plugins_url( '/', __FILE__ ) ); @@ -32,6 +32,7 @@ // Bootsrap require_once( AD_CODE_MANAGER_ROOT .'/common/lib/acm-provider.php' ); require_once( AD_CODE_MANAGER_ROOT .'/common/lib/acm-wp-list-table.php' ); +require_once( AD_CODE_MANAGER_ROOT .'/common/lib/acm-widget.php' ); class Ad_Code_Manager { @@ -45,7 +46,7 @@ class Ad_Code_Manager public $logical_operator; public $ad_tag_ids; public $providers; - public $current_provider_slug = 'doubleclick_for_publishers'; // @todo this should be an option set via UI, probably. + public $current_provider_slug; public $current_provider; public $wp_list_table; @@ -55,29 +56,30 @@ class Ad_Code_Manager * @since 0.1 */ function __construct() { - add_action('wp_ajax_acm_ajax_handler', array( $this, 'ajax_handler' ) ); + add_action( 'init', array( $this, 'action_load_providers' ) ); add_action( 'init', array( $this, 'action_init' ) ); add_action( 'current_screen', array( $this, 'action_admin_init' ) ); - // Incorporate the link to our admin menu add_action( 'admin_menu' , array( $this, 'action_admin_menu' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'register_scripts_and_styles' ) ); add_action( 'admin_print_scripts', array( $this, 'post_admin_header' ) ); + add_action( 'wp_ajax_acm_admin_action', array( $this, 'handle_admin_action' ) ); + + add_action('current_screen', array( $this, 'contextual_help' ) ); + add_action( 'widgets_init', array( $this, 'register_widget' ) ); + add_shortcode( 'acm-tag' , array( $this, 'shortcode' ) ); } - + /** - * Initialize our subclass of WP_List_Table and set $items + * Initialize our subclass of WP_List_Table and set $items * Hooked to current_screen */ function action_admin_init() { - if ( is_admin() ) { - $this->wp_list_table = new $this->providers->{$this->current_provider_slug}['table']; - $this->wp_list_table->items = $this->get_ad_codes(); - } + $this->wp_list_table = new $this->providers->{$this->current_provider_slug}['table']; } - + /** * Load all available ad providers * and set selected as ACM_Provider $current_provider @@ -90,7 +92,7 @@ function action_load_providers() { if ( file_exists( AD_CODE_MANAGER_ROOT . "/providers/$module_dir.php" ) ) { include_once( AD_CODE_MANAGER_ROOT . "/providers/$module_dir.php" ); } - + $tmp = explode( '-', $module_dir ); $class_name = ''; $slug_name = ''; @@ -102,32 +104,39 @@ function action_load_providers() { $table_class_name = $class_name . 'ACM_WP_List_Table'; $class_name .= 'ACM_Provider'; $slug_name = rtrim( $slug_name, '_' ); - + // Store class names, but don't instantiate // We don't need them all at once if ( class_exists( $class_name ) ) { $this->providers->$slug_name = array( 'provider' => $class_name, 'table' => $table_class_name, ); - } - + } + } - // Instantiate one that we need - if ( isset( $this->providers->{$this->current_provider_slug} ) ) { + /** + * Configuration filter: acm_provider_slug + * + * By default we use doubleclick-for-publishers provider + * To switch to a different ad provider use this filter + */ + $this->current_provider_slug = apply_filters( 'acm_provider_slug', 'doubleclick_for_publishers' ); + + // Instantiate one that we need + if ( isset( $this->providers->{$this->current_provider_slug} ) ) $this->current_provider = new $this->providers->{$this->current_provider_slug}['provider']; - } - - // Nothing to do without a provider + + // Nothing to do without a provider if ( !is_object( $this->current_provider ) ) - return ; - + return ; + /** * Configuration filter: acm_whitelisted_script_urls * A security filter to whitelist which ad code script URLs can be added in the admin */ - $this->current_provider->whitelisted_script_urls = apply_filters( 'acm_whitelisted_script_urls', $this->current_provider->whitelisted_script_urls ); - + $this->current_provider->whitelisted_script_urls = apply_filters( 'acm_whitelisted_script_urls', $this->current_provider->whitelisted_script_urls ); + } /** @@ -136,7 +145,7 @@ function action_load_providers() { * @since 0.1 */ function action_init() { - + $this->post_type_labels = array( 'name' => __( 'DFP Ad Codes' ), 'singular_name' => __( 'DFP Ad Codes' ), @@ -158,7 +167,7 @@ function action_init() { */ $this->whitelisted_conditionals = apply_filters( 'acm_whitelisted_conditionals', $this->whitelisted_conditionals ); // Allow users to filter default logical operator - $this->logical_operator = apply_filters( 'acm_logical_operator', 'OR' ); + $this->logical_operator = apply_filters( 'acm_logical_operator', 'OR' ); // Allow the ad management cap to be filtered if need be $this->manage_ads_cap = apply_filters( 'acm_manage_ads_cap', $this->manage_ads_cap ); @@ -194,100 +203,109 @@ function register_acm_post_type() { } /** - * Handles all admin ajax requests: getting, updating, creating and deleting + * Handle any Add, Edit, or Delete actions from the admin interface + * Hooks into admin ajax because it's the proper context for these sort of actions * - * @since 0.1 + * @since 0.2 */ - function ajax_handler() { - if ( ! isset( $_REQUEST['nonce'] ) || ! wp_verify_nonce( $_REQUEST['nonce'], 'acm_nonce' ) ) - return; - + function handle_admin_action() { + + if ( !wp_verify_nonce( $_REQUEST['nonce'], 'acm-admin-action' ) ) + wp_die( __( 'Doing something fishy, eh?', 'ad-code-manager' ) ); + if ( !current_user_can( $this->manage_ads_cap ) ) - return; + wp_die( __( 'You do not have the necessary permissions to perform this action', 'ad-code-manager' ) ); - switch( $_GET['acm-action'] ) { - case 'datasource': - $this->get_ad_codes_ajax(); - break; - case 'datasource-conditionals': - $this->get_conditionals_ajax(); - break; + // Depending on the method we're performing, sanitize the requisite data and do it + switch( $_REQUEST['method'] ) { + case 'add': case 'edit': - $this->ad_code_edit_actions(); - $this->flush_cache(); + $id = ( isset( $_REQUEST['id'] ) ) ? (int)$_REQUEST['id'] : 0; + $priority = ( isset( $_REQUEST['priority'] ) ) ? (int)$_REQUEST['priority'] : 10; + $ad_code_vals = array( + 'priority' => $priority, + ); + foreach( $this->current_provider->columns as $slug => $title ) { + $ad_code_vals[$slug] = sanitize_text_field( $_REQUEST['acm-column'][$slug] ); + } + if ( $_REQUEST['method'] == 'add') + $id = $this->create_ad_code( $ad_code_vals ); + else + $id = $this->edit_ad_code( $id, $ad_code_vals ); + if ( is_wp_error( $id ) ) { + $message = 'error-adding-editing-ad-code'; + break; + } + $new_conditionals = array(); + $unsafe_conditionals = ( isset( $_REQUEST['acm-conditionals'] ) ) ? $_REQUEST['acm-conditionals'] : array(); + foreach( $unsafe_conditionals as $index => $unsafe_conditional ) { + $index = (int)$index; + $arguments = ( isset( $_REQUEST['acm-arguments'][$index] ) ) ? sanitize_text_field( $_REQUEST['acm-arguments'][$index] ) : ''; + $conditional = array( + 'function' => sanitize_key( $unsafe_conditional ), + 'arguments' => $arguments, + ); + if ( !empty( $conditional['function'] ) ) { + $new_conditionals[] = $conditional; + } + } + if ( $_REQUEST['method'] == 'add' ) { + foreach( $new_conditionals as $new_conditional ) { + $this->create_conditional( $id, $new_conditional ); + } + $message = 'ad-code-added'; + } else { + $this->edit_conditionals( $id, $new_conditionals ); + $message = 'ad-code-updated'; + } break; - case 'edit-conditionals': - $this->conditionals_edit_actions(); + case 'delete': + $id = (int)$_REQUEST['id']; + $this->delete_ad_code( $id ); $this->flush_cache(); + $message = 'ad-code-deleted'; break; } - return; - } - /** - * Returns json encoded ad code - * This is the datasource for jqGRID - * - * @todo refactor, jqGrid won't be used in v0.2 - */ - function get_ad_codes_ajax() { - // These are params that should be managed via UI - /** - * NB! - * $response is an object with following properties - * $response->page = current page - * $response->total = total pages - * $response->record = count of rows - * $response->rows = nested array of assoc arrays - */ - $response; - if ( isset( $_GET['acm-action'] ) && $_GET['acm-action'] == 'datasource' ) { - $response->page = isset( $_GET['acm-grid-page'] ) ? sanitize_key( $_GET['acm-grid-page'] ) : 1 ; - $query_args = array(); - - // We need to pass offset to get_ad_codes offset for jqGrid to work correctly - if ( 1 < $response->page ) - $query_args['offset'] = ( $response->page - 1 ) * intval( $_GET['rows'] ); - - $ad_codes = $this->get_ad_codes( $query_args ) ; - // prepare data in jqGrid specific format - $pass = array(); - foreach ( $ad_codes as $ad_code ) { - $to_pass = array( - 'id' => $ad_code['post_id'], - 'priority' => $ad_code['priority'], - 'act' => '', - ); - foreach ( $this->current_provider->columns as $slug => $title ) { - $to_pass[$slug] = $ad_code['url_vars'][$slug]; - } - $pass[] = $to_pass; + if ( isset( $_REQUEST['doing_ajax'] ) && $_REQUEST['doing_ajax'] ){ + switch( $_REQUEST['method'] ) { + case 'edit': + set_current_screen( 'ad-code-manager' ); + $this->wp_list_table = new $this->providers->{$this->current_provider_slug}['table']; + $this->wp_list_table->prepare_items(); + $new_ad_code = $this->get_ad_code( $id ); + echo $this->wp_list_table->single_row( $new_ad_code ); + break; } - $response->rows = $pass; - $count_object = wp_count_posts( $this->post_type ); - $total_pages = ceil ( $count_object->publish / $_GET['rows'] ); - $response->total = $total_pages; - $response->records = $count_object->publish; - $this->print_json( $response ); + } else { + // @todo support ajax and non-ajax requests + $redirect_url = add_query_arg( 'message', $message, remove_query_arg( 'message', wp_get_referer() ) ); + wp_safe_redirect( $redirect_url ); } - return; + exit; } - /** * Get the ad codes stored in our custom post type * */ function get_ad_codes( $query_args = array() ) { - + $ad_codes_formatted = array(); $allowed_query_params = apply_filters( 'acm_allowed_get_posts_args', array( 'offset' ) ); + + /** + * Configuration filter: acm_ad_code_count + * + * By default we limit query to 50 ad codes + * Use this filter to change limit + */ $args = array( 'post_type' => $this->post_type, 'numberposts' => apply_filters( 'acm_ad_code_count', 50 ), ); - + foreach ( (array) $query_args as $query_key => $query_value ) { if ( ! in_array( $query_key, $allowed_query_params ) ) { unset( $query_args[$query_key] ); @@ -295,16 +313,16 @@ function get_ad_codes( $query_args = array() ) { $args[$query_key] = $query_value; } } - $cache_key = 'ad_codes_' . implode('_', $query_args ); - if ( false === ($ad_codes_formatted = wp_cache_get( $cache_key , 'acm' ) ) ) { + + if ( false === ( $ad_codes_formatted = wp_cache_get( 'ad_codes' , 'acm' ) ) ) { $ad_codes = get_posts( $args ); foreach ( $ad_codes as $ad_code_cpt ) { - $provider_url_vars = array(); + foreach ( $this->current_provider->columns as $slug => $title ) { $provider_url_vars[$slug] = get_post_meta( $ad_code_cpt->ID, $slug, true ); } - + $ad_codes_formatted[] = array( 'conditionals' => $this->get_conditionals( $ad_code_cpt->ID ), 'url_vars' => $provider_url_vars, @@ -312,128 +330,64 @@ function get_ad_codes( $query_args = array() ) { 'post_id' => $ad_code_cpt->ID ); } - wp_cache_add( $cache_key, $ad_codes_formatted, 'acm', 3600 ); - $this->add_cache_key_to_index( $cache_key ); - } + wp_cache_add( 'ad_codes', $ad_codes_formatted, 'acm', 3600 ); + } return $ad_codes_formatted; } - function get_conditionals_ajax() { - if ( 0 !== intval( $_GET['id'] ) ) { - $conditionals = (array) $this->get_conditionals( intval( $_GET['id'] ) ); - $response; - if ( !empty($conditionals ) ) { - foreach ( $conditionals as $index => $item ) { - if ( isset( $item['arguments'] ) && is_array( $item['arguments'] ) ) { - $item['arguments'] = implode(";", $item['arguments'] ); - } - $response->rows[] = $item; - } - } - $count = count( $response->rows ); - $total_pages = ceil ( $count / $_GET['rows'] ); - - $response->page = isset( $_GET['acm-grid-page'] ) ? sanitize_text_field( $_GET['acm-grid-page'] ) : 1 ; - $response->total = $total_pages; - $response->records = $count; - $this->print_json( $response ); - } - } /** - * Temporary workaround for flush cache dilemma: - * Add $key to site options + * Get a single ad code + * + * @param int $post_id Post ID for the ad code that we want + * @return array $ad_code Ad code representation of the data */ - function add_cache_key_to_index( $key = '' ) { - if ( '' == $key ) - return; - $cache_keys = (array) get_option( 'acm_cache_keys' ); - $cache_keys[] = $key; - update_option( 'acm_cache_keys', $cache_keys ); - } + function get_ad_code( $post_id ) { + + $post = get_post( $post_id ); + if ( !$post ) + return false; + + $provider_url_vars = array(); + foreach ( $this->current_provider->columns as $slug => $title ) { + $provider_url_vars[$slug] = get_post_meta( $post->ID, $slug, true ); + } + $ad_code_formatted = array( + 'conditionals' => $this->get_conditionals( $post->ID ), + 'url_vars' => $provider_url_vars, + 'priority' => get_post_meta( $post->ID, 'priority', true ), + 'post_id' => $post->ID + ); + return $ad_code_formatted; + + } + /** - * Temporary workaround for flush cache dilemma: - * Flush cache + * Flush cache */ function flush_cache() { - $cache_keys = (array) get_option( 'acm_cache_keys' ); - if ( !empty($cache_keys ) ) { - foreach ($cache_keys as $key ) { - wp_cache_delete($key, 'acm' ); - } - } + wp_cache_delete('ad_codes', 'acm' ); } /** * Get the conditional values for an ad code */ function get_conditionals( $ad_code_id ) { - return get_post_meta( $ad_code_id, 'conditionals', true ); - } - - /** - * Handles AJAX Create, Update, Delete actions for Ad Codes - */ - function ad_code_edit_actions() { - // Noncing happens in $this->ajax_handler() - if ( ! empty( $_POST ) ) { - //this is jqGrid param - $ad_code_vals = array( - 'priority' => intval( $_POST['priority'] ), - ); - foreach ( $this->current_provider->columns as $slug => $title ) { - $ad_code_vals[$slug] = sanitize_text_field( $_POST[$slug] ); - } - switch ( $_POST['oper'] ) { - case 'add': - $this->create_ad_code( $ad_code_vals ); - break; - case 'edit': - $this->edit_ad_code( intval( $_POST['id'] ), $ad_code_vals ); - break; - case 'del': - $this->delete_ad_code( intval( $_POST['id'] ) ); - break; - } - exit; // exit, jqGrid sends another request to fetch new data - } - return; + $conditionals = get_post_meta( $ad_code_id, 'conditionals', true ); + if ( empty( $conditionals ) ) + $conditionals = array(); + return $conditionals; } - function conditionals_edit_actions() { - if ( ! empty( $_POST ) ) { - $conditional_vals = array( - 'function' => sanitize_key( $_POST['function'] ), - //arguments from jqGrid are passed as string, need to check arguments type before choosing the way to sanitize the value - 'arguments' => is_array( $_POST['arguments'] ) ? array_map( 'sanitize_text_field', $_POST['arguments'] ) : sanitize_text_field( $_POST['arguments'] ), - ); - switch ( $_POST['oper'] ) { - case 'add': - $result = $this->create_conditional( intval( $_GET['id'] ), $conditional_vals ); - break; - case 'edit': - $conditional_vals['id'] = intval( $_POST['id'] ); // we need this for edit action to work correctly - $result = $this->edit_conditional( intval( $_GET['id'] ), $conditional_vals, true ); - break; - case 'del': - // That's confusing: $_GET['id'] refers to CPT ID, $_POST['id'] refers to indices that should be - // removed from array of conditionals - $result = $this->delete_conditional( intval( $_GET['id'] ), intval( $_POST['id'] ), true ); - break; - } - exit($result); - } - return; - } /** * Create a new ad code in the database * * @uses register_ad_code() * - * @todo validation / nonce - * * @param array $ad_code + * + * @return int|false post_id or false */ function create_ad_code( $ad_code = array() ) { $titles = array(); @@ -452,25 +406,26 @@ function create_ad_code( $ad_code = array() ) { 'ping_status' => 'closed', 'post_type' => $this->post_type, ); - + if ( ! is_wp_error( $acm_inserted_post_id = wp_insert_post( $acm_post, true ) ) ) { foreach ( $this->current_provider->columns as $slug => $title ) { update_post_meta( $acm_inserted_post_id, $slug, $ad_code[$slug] ); } update_post_meta( $acm_inserted_post_id, 'priority', $ad_code['priority'] ); + return $acm_inserted_post_id; } - return; + return false; } /** * Update an existing ad code */ - function edit_ad_code( $ad_code_id, $ad_code = array() ) { + function edit_ad_code( $ad_code_id, $ad_code = array()) { foreach ( $this->current_provider->columns as $slug => $title ) { // We shouldn't update an ad code, // If any of required fields is not set if ( ! $ad_code[$slug] ) { - return; + return new WP_Error(); } } if ( 0 !== $ad_code_id ) { @@ -478,16 +433,19 @@ function edit_ad_code( $ad_code_id, $ad_code = array() ) { update_post_meta( $ad_code_id, $slug, $ad_code[$slug] ); } update_post_meta( $ad_code_id, 'priority', $ad_code['priority'] ); - } - return; + } + $this->flush_cache(); + return $ad_code_id; } /** * Delete an existing ad code */ function delete_ad_code( $ad_code_id ) { - if ( 0 !== $ad_code_id ) + if ( 0 !== $ad_code_id ) { wp_delete_post( $ad_code_id , true ); //force delete post + return true; + } return; } /** @@ -506,7 +464,7 @@ function create_conditional( $ad_code_id, $conditional ) { } $existing_conditionals[] = array( 'function' => $conditional['function'], - 'arguments' => explode(';', $conditional['arguments'] ), + 'arguments' => explode(';', $conditional['arguments'] ), ); return update_post_meta( $ad_code_id, 'conditionals', $existing_conditionals ); } @@ -514,61 +472,29 @@ function create_conditional( $ad_code_id, $conditional ) { } /** - * Update conditional + * Update all conditionals for ad code * * @param int $ad_code_id id of our CPT post - * @param array $conditional - * - */ - function edit_conditional( $ad_code_id, $conditional, $from_ajax = false ) { - if ( 0 !== $ad_code_id && !empty( $conditional ) ) { - $existing_conditionals = (array) get_post_meta( $ad_code_id, 'conditionals', true ); - if ( $from_ajax && isset( $conditional ['id'] ) ) { // jqGrid starts with one, PHP starts with 0 - $conditional['id']--; - } - foreach ( $existing_conditionals as $conditional_index => $existing_conditional ) { - // $id is not an actual unique ID, but rather index of conditional in array of them - if ( isset( $conditional['id'] ) && $conditional['id'] === $conditional_index ) { - $existing_conditionals[$conditional_index] = array( - 'function' => $conditional['function'], - 'arguments' => (array) $conditional['arguments'], - ); - } - } - return update_post_meta( $ad_code_id, 'conditionals', array_values($existing_conditionals) ); - } - return false; - } - - /** - * This is a bit tricky as we really don't use any ID for conditionals - * To remove conditional we need to specify array index + * @param array of $conditionals * - * @param int $ad_code_id - * @param string $conditional_indices string of comma separated indices + * @since v0.2 + * @return bool */ - function delete_conditional( $ad_code_id, $conditional_indices = '', $from_ajax = false ) { - if ( 0 !== $ad_code_id ) { - $existing_conditionals = get_post_meta( $ad_code_id, 'conditionals', true ); - $ids_to_delete = explode(',', $conditional_indices ); // - foreach ($ids_to_delete as $index_to_delete ) { - if ( $from_ajax ) { // jqGrid starts with one, PHP starts with 0 - $index_to_delete--; - } - unset( $existing_conditionals[$index_to_delete] ); + function edit_conditionals( $ad_code_id, $conditionals = array() ) { + if ( 0 !== $ad_code_id && !empty( $conditionals ) ) { + $new_conditionals = array(); + foreach( $conditionals as $conditional ) { + if ( '' == $conditional['function'] ) + continue; + $new_conditionals[] = array( + 'function' => $conditional['function'], + 'arguments' => (array) $conditional['arguments'], + ); } - return update_post_meta( $ad_code_id, 'conditionals', array_values( $existing_conditionals ) ); //array_values to keep indices consistent + return update_post_meta( $ad_code_id, 'conditionals', $new_conditionals ); + } elseif ( 0 !== $ad_code_id ) { + return update_post_meta( $ad_code_id, 'conditionals', array() ); } - return false; - } - - /** - * encode as json any given $data - */ - function print_json( $data = array() ) { - header( 'Content-type: application/json;' ); - echo json_encode( $data ); - exit; } /** @@ -587,6 +513,7 @@ function post_admin_header() { var acm_url = 'plugin_slug ) ) ?>'; var acm_conditionals = ''; var acm_ajax_nonce = ''; + var acm_conditionals_index = 0; title, $this->title, $this->manage_ads_cap, $this->plugin_slug, array( &$this, 'admin_view_controller' ) ); + add_submenu_page( 'tools.php', $this->title, $this->title, $this->manage_ads_cap, $this->plugin_slug, array( $this, 'admin_view_controller' ) ); } /** * Print the admin interface for managing the ad codes * - * @todo remove html to views */ function admin_view_controller() { - ?> -
-

Ad Code Manager

- -

Quick start note: Create an ad code, then click on the row and start adding conditionals.

- - - +

Ad Code Manager gives non-developers an interface in the WordPress admin for configuring your complex set of ad codes.

+

We tried to streamline the process and make everyday AdOps a little bit easier

+

Depending on ad network you use, you will see a set of required fields to fill in (generally, "Ad Code" is a set of parameters you need to pass to ad server, so it could serve proper ad). Then you set conditionals. You can create ad code with conditionals in one easy step

+

Priorities work pretty much the same way they work in WordPress. Lower numbers correspond with higher priority. +

Once you've done creating ad codes, you can easily implement them in your theme using:

+ -require_once( AD_CODE_MANAGER_ROOT . '/common/views/ad-code-manager.tpl.php' ); + +

There are some filters which will allow you to easily customize output of the plugin. You should place these filters in your themes functions.php file or someplace safe.

+ +Check out this gist to see all of the filters in action. + +

acm_default_url

+ +

Currently, we don't store tokenized script URL anywhere so this filter is a nice place to set default value.

+ +

Arguments:
+* string $url The tokenized url of Ad Code

+

Example usage: Set your default ad code URL

+
+add_filter( 'acm_default_url', 'my_acm_default_url' ); 
+function my_acm_default_url( $url ) { 
+	if ( 0 === strlen( $url )  ) {
+		return "http://ad.doubleclick.net/adj/%site_name%/%zone1%;s1=%zone1%;s2=;pid=%permalink%;fold=%fold%;kw=;test=%test%;ltv=ad;pos=%pos%;dcopt=%dcopt%;tile=%tile%;sz=%sz%;";
+	}
+}
+
+ +

acm_output_tokens

+ +

Register output tokens depending on the needs of your setup. Tokens are the keys to be replaced in your script URL.

+ +

Arguments:
+* array $output_tokens Any existing output tokens
+* string $tag_id Unique tag id
+* array $code_to_display Ad Code that matched conditionals +

+

Example usage: Test to determine whether you're in test or production by passing ?test=on query argument

+ +
+add_filter( 'acm_output_tokens', 'my_acm_output_tokens', 10, 3 );
+function my_acm_output_tokens( $output_tokens, $tag_id, $code_to_display ) {
+	$output_tokens['%test%'] = isset( $_GET['test'] ) && $_GET['test'] == 'on' ? 'on' : '';
+	return $output_tokens;
+}`
+
+ +

acm_ad_tag_ids

+ +

Extend set of default tag ids. Ad tag ids are used as a parameter for your template tag (e.g. do_action( 'acm_tag', 'my_top_leaderboard' ))

+

Arguments:
+* array $tag_ids array of default tag ids

+ +

Example usage: Add a new ad tag called 'my_top_leaderboard'

+ +
+add_filter( 'acm_ad_tag_ids', 'my_acm_ad_tag_ids' );
+function my_acm_ad_tag_ids( $tag_ids ) {
+	$tag_ids[] = array(
+		'tag' => 'my_top_leaderboard', // tag_id 
+		'url_vars' => array(
+			'sz' => '728x90', // %sz% token
+			'fold' => 'atf', // %fold% token
+			'my_custom_token' => 'something' // %my_custom_token% will be replaced with 'something'
+		);
+	return $tag_ids;
+}
+
+ +

acm_output_html

+ +

Support multiple ad formats ( e.g. Javascript ad tags, or simple HTML tags ) by adjusting the HTML rendered for a given ad tag.

+ +

Arguments:
+* string $output_html The original output HTML
+* string $tag_id Ad tag currently being accessed
+

+

Example usage:

+
+add_filter( 'acm_output_html', 'my_acm_output_html', 10, 2 );
+function my_acm_output_html( $output_html, $tag_id ) {
+	switch ( $tag_id ) {
+		case 'my_leaderboard':
+			$output_html = '<a href="%url%"> <img src="%image_url%" /></a>';
+			break;
+		case 'rich_media_leaderboard':
+			$output_html = '<script> // omitted </script>';
+			break;
+		default:
+			break;
+	}
+	return $output_html;
+}
+
+

acm_whitelisted_conditionals

+ +

Extend the list of usable conditional functions with your own awesome ones. We whitelist these so users can't execute random PHP functions.

+ +

Arguments:
+* array $conditionals Default conditionals

+ +

Example usage: Register a few custom conditional callbacks

+ +
+add_filter( 'acm_whitelisted_conditionals', 'my_acm_whitelisted_conditionals' );
+function my_acm_whitelisted_conditionals( $conditionals ) {
+	$conditionals[] = 'my_is_post_type';
+	$conditionals[] = 'is_post_type_archive';
+	$conditionals[] = 'my_page_is_child_of';
+	return $conditionals;
+}
+
+ +

acm_conditional_args

+ +

For certain conditionals (has_tag, has_category), you might need to pass additional arguments.

+ +

Arguments:
+* array $cond_args Existing conditional arguments
+* string $cond_func Conditional function (is_category, is_page, etc) +

+ +

Example usage: has_category() and has_tag() use has_term(), which requires the object ID to function properly

+ +
+add_filter( 'acm_conditional_args', 'my_acm_conditional_args', 10, 2 );
+function my_acm_conditional_args( $cond_args, $cond_func ) {
+	global $wp_query;
+	// has_category and has_tag use has_term
+	// we should pass queried object id for it to produce correct result
+	if ( in_array( $cond_func, array( 'has_category', 'has_tag' ) ) ) {
+		if ( $wp_query->is_single == true ) {
+			$cond_args[] = $wp_query->queried_object->ID;
+		}
+	}
+	// my_page_is_child_of is our custom WP conditional tag and we have to pass queried object ID to it
+	if ( in_array( $cond_func, array( 'my_page_is_child_of' ) ) && $wp_query->is_page ) {
+		$cond_args[] = $cond_args[] = $wp_query->queried_object->ID;
+	}
+
+	return $cond_args;
+}
+
+ +

acm_whitelisted_script_urls

+ +

A security filter to whitelist which ad code script URLs can be added in the admin

+ +

Arguments:
+* array $whitelisted_urls Existing whitelisted ad code URLs

+ +

Example usage: Allow Doubleclick for Publishers ad codes to be used

+ +
add_filter( 'acm_whitelisted_script_urls', 'my_acm_whitelisted_script_urls' );
+function my_acm_whiltelisted_script_urls( $whitelisted_urls ) {
+	$whitelisted_urls = array( 'ad.doubleclick.net' );
+	return $whitelisted_urls;
+}
+
+ +

acm_display_ad_codes_without_conditionals

+ +

Change the behavior of Ad Code Manager so that ad codes without conditionals display on the frontend. The default behavior is that each ad code requires a conditional to be included in the presentation logic.

+ +

Arguments:
+* bool $behavior Whether or not to display the ad codes that don't have conditionals

+ +

Example usage:

+ +
add_filter( 'acm_display_ad_codes_without_conditionals', '__return_true' );
+ +

acm_provider_slug

+ +

By default we use our bundled doubleclick_for_publishers config ( check it in /providers/doubleclick-for-publishers.php ). If you want to add your own flavor of DFP or even implement configuration for some another ad network, you'd have to apply a filter to correct the slug.

+ +

Example usage:

+ +
add_filter( 'acm_provider_slug', function() { return 'my-ad-network-slug'; })
+ +

acm_logical_operator

+ +

By default logical operator is set to "OR", that is, ad code will be displayed if at least one conditional returns true. + You can change it to "AND", so that ad code will be displayed only if ALL of the conditionals match

+ +

Example usage:

+ +
add_filter( 'acm_provider_slug', function( $slug ) { return 'my-ad-network-slug'; })
+ +

acm_manage_ads_cap

+ +

By default user has to have "manage_options" cap. This filter comes in handy, if you want to relax the requirements.

+ +

Example usage:

+ +
add_filter( 'acm_manage_ads_cap', function( $cap ) { return 'edit_others_posts'; })
+ +

acm_allowed_get_posts_args

+ +

This filter is only for edge cases. Most likely you won't have to touch it. Allows to include additional query args for Ad_Code_Manager->get_ad_codes() method.

+

Example usage:

+ +add_filter( 'acm_allowed_get_posts_args', function( $args_array ) { return array( 'offset', 'exclude' ); }) + +

acm_ad_code_count

+ +

By default the total number of ad codes to get is 50, which is reasonable for any small to mid site. However, in some certain cases you would want to increase the limit. This will affect Ad_Code_Manager->get_ad_codes() 'numberposts' query argument.

+ +

Example usage:

+ +
add_filter( 'acm_ad_code_count', function( $total ) { return 100; })
+ +

acm_list_table_columns

+ +

This filter can alter table columns that are displayed in ACM UI.

+ +

Example usage:

+ +
add_filter( 'acm_list_table_columns', function ( $columns ) {
+			$columns = array(
+				'id'             => __( 'ID', 'ad-code-manager' ),
+				'name'           => __( 'Name', 'ad-code-manager' ),
+				'priority'       => __( 'Priority', 'ad-code-manager' ),
+				'conditionals'   => __( 'Conditionals', 'ad-code-manager' ),
+			);
+			return $columns;
+	} )
+	
+

acm_provider_columns

+ +

This filter comes in pair with previous one, it should return array of ad network specific parameters. E.g. in acm_list_table_columns example we have + 'id', 'name', 'priority', 'conditionals'. All of them except name are generic for Ad Code Manager. Hence acm_provider_columns should return only "name"

+ +

Example usage:

+
add_filter( 'acm_provider_columns', function ( $columns ) {
+			$columns = array(
+				'name'           => __( 'Name', 'ad-code-manager' ),
+			);
+			return $columns;
+	} )
+add_help_tab( + array( + 'id' => 'acm-overview', + 'title' => 'Overview', + 'content' => $overview, + ) + ); + get_current_screen()->add_help_tab( + array( + 'id' => 'acm-config', + 'title' => 'Configuration', + 'content' => $configuration, + ) + ); + get_current_screen()->add_help_tab( + array( + 'id' => 'acm-conditionals', + 'title' => 'Conditionals', + 'content' => $contextual_help, + ) + ); + } + + /** + * Register a custom widget to display ad zones + * + */ + function register_widget() { + register_widget( 'ACM_Ad_Zones' ); } /** @@ -658,10 +860,7 @@ function register_scripts_and_styles() { if ( 'tools.php' != $pagenow || !isset( $_GET['page'] ) || $_GET['page'] != $this->plugin_slug ) return; - wp_enqueue_style( 'acm-jquery-ui-theme', AD_CODE_MANAGER_URL . '/common/css/jquery-ui-1.8.17.custom.css' ); - wp_enqueue_style( 'acm-jqgrid', AD_CODE_MANAGER_URL . '/common/css/ui.jqgrid.css' ); - wp_enqueue_script( 'acm-jqgrid-locale-en', AD_CODE_MANAGER_URL . '/common/js/grid.locale-en.js', array( 'jquery', 'jquery-ui-core' ) ); - wp_enqueue_script( 'acm-jqgrid', AD_CODE_MANAGER_URL . '/common/js/jquery.jqGrid.min.js', array( 'jquery', 'jquery-ui-core' ) ); + wp_enqueue_style( 'acm-style', AD_CODE_MANAGER_URL . '/common/css/acm.css' ); wp_enqueue_script( 'acm', AD_CODE_MANAGER_URL . '/common/js/acm.js', array( 'jquery', 'jquery-ui-core' ) ); } @@ -691,7 +890,7 @@ function register_ad_code( $tag, $url, $conditionals = array(), $url_vars = arra // @todo Sanitize all of the other input // Make sure our priority is an integer - if ( !is_int( $priority ) ) + if ( !is_int( $priority ) ) $priority = 10; // Save the ad code to our set of ad codes @@ -759,11 +958,19 @@ function action_acm_tag( $tag_id ) { // If the ad code doesn't have any conditionals // we should add it to the display list - if ( empty( $ad_code['conditionals'] ) ) { + if ( empty( $ad_code['conditionals'] ) && apply_filters( 'acm_display_ad_codes_without_conditionals', false ) ) { $display_codes[] = $ad_code; continue; } + // If the ad code doesn't have any conditionals + // and configuration filter acm_display_ad_codes_without_conditionals returns false + // We should should skip it + + if ( empty( $ad_code['conditionals'] ) && ! apply_filters( 'acm_display_ad_codes_without_conditionals', false ) ) { + continue; + } + $include = true; foreach( $ad_code['conditionals'] as $conditional ) { // If the conditional was passed as an array, then we have a complex rule @@ -813,11 +1020,14 @@ function action_acm_tag( $tag_id ) { else $include = true; - // // If we have matching conditional and $this->logical_operator equals OR just break from the loop and do not try to evaluate others if ( $include && $this->logical_operator == 'OR' ) break; + // If $this->logical_operator equals AND and one conditional evaluates false, skip this ad code + if ( !$include && $this->logical_operator == 'AND' ) + break; + } // If we're supposed to include the ad code even after we've run the conditionals, @@ -911,6 +1121,25 @@ function validate_script_url( $url ) { } return $valid; } + + /** + * Shortcode function + * + * @since 0.2 + */ + function shortcode( $atts ) { + $atts = shortcode_atts( + array( + 'id' => '', + ), $atts ); + + $id = sanitize_text_field( $atts['id'] ); + if ( empty( $id ) ) + return; + + $this->action_acm_tag( $id ); + } + } global $ad_code_manager; diff --git a/common/css/acm.css b/common/css/acm.css new file mode 100755 index 0000000..7af76fa --- /dev/null +++ b/common/css/acm.css @@ -0,0 +1,163 @@ +.acm-conditionals-wrapper { + margin-top: 20px; +} + +.acm-ui-wrapper .button { + margin-right: 10px; +} + +.acm-ui-wrapper p { + +} + +#conditionals-help { + width: 600px; +} + +tr:hover .row-actions { + visibility: visible; +} + +.conditional-single-field { + clear: both; +} + +.acm-remove-conditional { + float: right; + color: #D54E21; +} + +.conditional-single-field .conditional-function { + float: left; +} + +#add-adcode .conditional-single-field .conditional-function { + width: 50%; +} + +#add-adcode .conditional-single-field .conditional-arguments { + float: left; + width: 45%; + margin-bottom: 5px; +} + +.inline-edit-col .acm-section-label { + margin-bottom: 5px; + text-transform: none; +} + +.inline-edit-col .acm-float-left { + float: left; +} + +.inline-edit-col .acm-column-fields, +.inline-edit-col .acm-priority-field { + width: 250px; +} + +.inline-edit-col .acm-column-fields label { + float: left; + width: 75px; +} + +.inline-edit-col .acm-column-fields input { + margin-bottom: 5px; +} + +.inline-edit-col .acm-conditional-fields { + float: left; + min-width: 270px; +} + +.inline-edit-col .acm-conditional-fields .conditional-arguments { + margin-left: 140px; +} + +.inline-edit-col .acm-conditional-fields .conditional-arguments input { + width: 70%; + margin-bottom: 5px; +} + +.inline-edit-col .acm-conditional-fields .form-add-more { + margin-top: 10px; + clear: both; +} + +#add-adcode .form-add-more { + clear:left; + width: 90%; +} + +.acm-edit-field { + position: relative; + max-width: 200px; + float: left; + margin: 15px 0 0 15px; +} + +.acm-edit-field label { + position: relative; + float: left; + font-weight: 700; + color: #333; +} + +.acm-edit-cond, +.acm-cancel-button, +.acm-edit-field input, +.acm-conditional-label { + position: relative; + float: left; + clear: left; +} + +.acm-edit-cond { + margin: 5px 0 0 15px; +} + +.acm-edit-cond input { + margin-left: 15px; +} + +.acm-conditional-label { + width: 100%; + font-weight: 700; + color: #333; + margin: 10px 0 0 15px; +} + +.acm-cancel-button { + margin: 10px 0 30px 15px; +} + +.acm-edit-button { + float: left; + margin: 10px 0 30px 15px; +} + +.acm-x-cond { + font-size: 14px; + padding-left: 5px; + color: #888; + cursor: pointer; + font-family: sans-serif +} + +.acm-x-cond:hover { + color: #333; + text-decoration: underline; +} + +#acm-add-inline-cond { + display: block; + float: left; + clear: left; + padding-top: 5px; + width: 295px; + text-align: right; + cursor:pointer; +} + +#acm-add-inline-cond:hover { + text-decoration: underline; +} \ No newline at end of file diff --git a/common/css/images/ui-bg_flat_0_aaaaaa_40x100.png b/common/css/images/ui-bg_flat_0_aaaaaa_40x100.png deleted file mode 100755 index 5b5dab2..0000000 Binary files a/common/css/images/ui-bg_flat_0_aaaaaa_40x100.png and /dev/null differ diff --git a/common/css/images/ui-bg_flat_75_ffffff_40x100.png b/common/css/images/ui-bg_flat_75_ffffff_40x100.png deleted file mode 100755 index ac8b229..0000000 Binary files a/common/css/images/ui-bg_flat_75_ffffff_40x100.png and /dev/null differ diff --git a/common/css/images/ui-bg_glass_55_fbf9ee_1x400.png b/common/css/images/ui-bg_glass_55_fbf9ee_1x400.png deleted file mode 100755 index ad3d634..0000000 Binary files a/common/css/images/ui-bg_glass_55_fbf9ee_1x400.png and /dev/null differ diff --git a/common/css/images/ui-bg_glass_65_ffffff_1x400.png b/common/css/images/ui-bg_glass_65_ffffff_1x400.png deleted file mode 100755 index 42ccba2..0000000 Binary files a/common/css/images/ui-bg_glass_65_ffffff_1x400.png and /dev/null differ diff --git a/common/css/images/ui-bg_glass_75_dadada_1x400.png b/common/css/images/ui-bg_glass_75_dadada_1x400.png deleted file mode 100755 index 1d43b47..0000000 Binary files a/common/css/images/ui-bg_glass_75_dadada_1x400.png and /dev/null differ diff --git a/common/css/images/ui-bg_glass_75_e6e6e6_1x400.png b/common/css/images/ui-bg_glass_75_e6e6e6_1x400.png deleted file mode 100755 index 86c2baa..0000000 Binary files a/common/css/images/ui-bg_glass_75_e6e6e6_1x400.png and /dev/null differ diff --git a/common/css/images/ui-bg_glass_95_fef1ec_1x400.png b/common/css/images/ui-bg_glass_95_fef1ec_1x400.png deleted file mode 100755 index 4443fdc..0000000 Binary files a/common/css/images/ui-bg_glass_95_fef1ec_1x400.png and /dev/null differ diff --git a/common/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/common/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png deleted file mode 100755 index 7c9fa6c..0000000 Binary files a/common/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png and /dev/null differ diff --git a/common/css/images/ui-icons_222222_256x240.png b/common/css/images/ui-icons_222222_256x240.png deleted file mode 100755 index b273ff1..0000000 Binary files a/common/css/images/ui-icons_222222_256x240.png and /dev/null differ diff --git a/common/css/images/ui-icons_2e83ff_256x240.png b/common/css/images/ui-icons_2e83ff_256x240.png deleted file mode 100755 index 09d1cdc..0000000 Binary files a/common/css/images/ui-icons_2e83ff_256x240.png and /dev/null differ diff --git a/common/css/images/ui-icons_454545_256x240.png b/common/css/images/ui-icons_454545_256x240.png deleted file mode 100755 index 59bd45b..0000000 Binary files a/common/css/images/ui-icons_454545_256x240.png and /dev/null differ diff --git a/common/css/images/ui-icons_888888_256x240.png b/common/css/images/ui-icons_888888_256x240.png deleted file mode 100755 index 6d02426..0000000 Binary files a/common/css/images/ui-icons_888888_256x240.png and /dev/null differ diff --git a/common/css/images/ui-icons_cd0a0a_256x240.png b/common/css/images/ui-icons_cd0a0a_256x240.png deleted file mode 100755 index 2ab019b..0000000 Binary files a/common/css/images/ui-icons_cd0a0a_256x240.png and /dev/null differ diff --git a/common/css/jquery-ui-1.8.17.custom.css b/common/css/jquery-ui-1.8.17.custom.css deleted file mode 100755 index 3a4da39..0000000 --- a/common/css/jquery-ui-1.8.17.custom.css +++ /dev/null @@ -1,565 +0,0 @@ -/* - * jQuery UI CSS Framework 1.8.17 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Theming/API - */ - -/* Layout helpers -----------------------------------*/ -.ui-helper-hidden { display: none; } -.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); } -.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } -.ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; } -.ui-helper-clearfix:after { clear: both; } -.ui-helper-clearfix { zoom: 1; } -.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } - - -/* Interaction Cues -----------------------------------*/ -.ui-state-disabled { cursor: default !important; } - - -/* Icons -----------------------------------*/ - -/* states and images */ -.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } - - -/* Misc visuals -----------------------------------*/ - -/* Overlays */ -.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } - - -/* - * jQuery UI CSS Framework 1.8.17 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Theming/API - * - * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px - */ - - -/* Component containers -----------------------------------*/ -.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; } -.ui-widget .ui-widget { font-size: 1em; } -.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; } -.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; } -.ui-widget-content a { color: #222222; } -.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; } -.ui-widget-header a { color: #222222; } - -/* Interaction states -----------------------------------*/ -.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; } -.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; } -.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; } -.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; } -.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; } -.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; } -.ui-widget :active { outline: none; } - -/* Interaction Cues -----------------------------------*/ -.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; } -.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; } -.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; } -.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; } -.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; } -.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; } -.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } -.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } - -/* Icons -----------------------------------*/ - -/* states and images */ -.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); } -.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); } -.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); } -.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); } -.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); } -.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); } -.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); } -.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); } - -/* positioning */ -.ui-icon-carat-1-n { background-position: 0 0; } -.ui-icon-carat-1-ne { background-position: -16px 0; } -.ui-icon-carat-1-e { background-position: -32px 0; } -.ui-icon-carat-1-se { background-position: -48px 0; } -.ui-icon-carat-1-s { background-position: -64px 0; } -.ui-icon-carat-1-sw { background-position: -80px 0; } -.ui-icon-carat-1-w { background-position: -96px 0; } -.ui-icon-carat-1-nw { background-position: -112px 0; } -.ui-icon-carat-2-n-s { background-position: -128px 0; } -.ui-icon-carat-2-e-w { background-position: -144px 0; } -.ui-icon-triangle-1-n { background-position: 0 -16px; } -.ui-icon-triangle-1-ne { background-position: -16px -16px; } -.ui-icon-triangle-1-e { background-position: -32px -16px; } -.ui-icon-triangle-1-se { background-position: -48px -16px; } -.ui-icon-triangle-1-s { background-position: -64px -16px; } -.ui-icon-triangle-1-sw { background-position: -80px -16px; } -.ui-icon-triangle-1-w { background-position: -96px -16px; } -.ui-icon-triangle-1-nw { background-position: -112px -16px; } -.ui-icon-triangle-2-n-s { background-position: -128px -16px; } -.ui-icon-triangle-2-e-w { background-position: -144px -16px; } -.ui-icon-arrow-1-n { background-position: 0 -32px; } -.ui-icon-arrow-1-ne { background-position: -16px -32px; } -.ui-icon-arrow-1-e { background-position: -32px -32px; } -.ui-icon-arrow-1-se { background-position: -48px -32px; } -.ui-icon-arrow-1-s { background-position: -64px -32px; } -.ui-icon-arrow-1-sw { background-position: -80px -32px; } -.ui-icon-arrow-1-w { background-position: -96px -32px; } -.ui-icon-arrow-1-nw { background-position: -112px -32px; } -.ui-icon-arrow-2-n-s { background-position: -128px -32px; } -.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } -.ui-icon-arrow-2-e-w { background-position: -160px -32px; } -.ui-icon-arrow-2-se-nw { background-position: -176px -32px; } -.ui-icon-arrowstop-1-n { background-position: -192px -32px; } -.ui-icon-arrowstop-1-e { background-position: -208px -32px; } -.ui-icon-arrowstop-1-s { background-position: -224px -32px; } -.ui-icon-arrowstop-1-w { background-position: -240px -32px; } -.ui-icon-arrowthick-1-n { background-position: 0 -48px; } -.ui-icon-arrowthick-1-ne { background-position: -16px -48px; } -.ui-icon-arrowthick-1-e { background-position: -32px -48px; } -.ui-icon-arrowthick-1-se { background-position: -48px -48px; } -.ui-icon-arrowthick-1-s { background-position: -64px -48px; } -.ui-icon-arrowthick-1-sw { background-position: -80px -48px; } -.ui-icon-arrowthick-1-w { background-position: -96px -48px; } -.ui-icon-arrowthick-1-nw { background-position: -112px -48px; } -.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } -.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } -.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } -.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } -.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } -.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } -.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } -.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } -.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } -.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } -.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } -.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } -.ui-icon-arrowreturn-1-w { background-position: -64px -64px; } -.ui-icon-arrowreturn-1-n { background-position: -80px -64px; } -.ui-icon-arrowreturn-1-e { background-position: -96px -64px; } -.ui-icon-arrowreturn-1-s { background-position: -112px -64px; } -.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } -.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } -.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } -.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } -.ui-icon-arrow-4 { background-position: 0 -80px; } -.ui-icon-arrow-4-diag { background-position: -16px -80px; } -.ui-icon-extlink { background-position: -32px -80px; } -.ui-icon-newwin { background-position: -48px -80px; } -.ui-icon-refresh { background-position: -64px -80px; } -.ui-icon-shuffle { background-position: -80px -80px; } -.ui-icon-transfer-e-w { background-position: -96px -80px; } -.ui-icon-transferthick-e-w { background-position: -112px -80px; } -.ui-icon-folder-collapsed { background-position: 0 -96px; } -.ui-icon-folder-open { background-position: -16px -96px; } -.ui-icon-document { background-position: -32px -96px; } -.ui-icon-document-b { background-position: -48px -96px; } -.ui-icon-note { background-position: -64px -96px; } -.ui-icon-mail-closed { background-position: -80px -96px; } -.ui-icon-mail-open { background-position: -96px -96px; } -.ui-icon-suitcase { background-position: -112px -96px; } -.ui-icon-comment { background-position: -128px -96px; } -.ui-icon-person { background-position: -144px -96px; } -.ui-icon-print { background-position: -160px -96px; } -.ui-icon-trash { background-position: -176px -96px; } -.ui-icon-locked { background-position: -192px -96px; } -.ui-icon-unlocked { background-position: -208px -96px; } -.ui-icon-bookmark { background-position: -224px -96px; } -.ui-icon-tag { background-position: -240px -96px; } -.ui-icon-home { background-position: 0 -112px; } -.ui-icon-flag { background-position: -16px -112px; } -.ui-icon-calendar { background-position: -32px -112px; } -.ui-icon-cart { background-position: -48px -112px; } -.ui-icon-pencil { background-position: -64px -112px; } -.ui-icon-clock { background-position: -80px -112px; } -.ui-icon-disk { background-position: -96px -112px; } -.ui-icon-calculator { background-position: -112px -112px; } -.ui-icon-zoomin { background-position: -128px -112px; } -.ui-icon-zoomout { background-position: -144px -112px; } -.ui-icon-search { background-position: -160px -112px; } -.ui-icon-wrench { background-position: -176px -112px; } -.ui-icon-gear { background-position: -192px -112px; } -.ui-icon-heart { background-position: -208px -112px; } -.ui-icon-star { background-position: -224px -112px; } -.ui-icon-link { background-position: -240px -112px; } -.ui-icon-cancel { background-position: 0 -128px; } -.ui-icon-plus { background-position: -16px -128px; } -.ui-icon-plusthick { background-position: -32px -128px; } -.ui-icon-minus { background-position: -48px -128px; } -.ui-icon-minusthick { background-position: -64px -128px; } -.ui-icon-close { background-position: -80px -128px; } -.ui-icon-closethick { background-position: -96px -128px; } -.ui-icon-key { background-position: -112px -128px; } -.ui-icon-lightbulb { background-position: -128px -128px; } -.ui-icon-scissors { background-position: -144px -128px; } -.ui-icon-clipboard { background-position: -160px -128px; } -.ui-icon-copy { background-position: -176px -128px; } -.ui-icon-contact { background-position: -192px -128px; } -.ui-icon-image { background-position: -208px -128px; } -.ui-icon-video { background-position: -224px -128px; } -.ui-icon-script { background-position: -240px -128px; } -.ui-icon-alert { background-position: 0 -144px; } -.ui-icon-info { background-position: -16px -144px; } -.ui-icon-notice { background-position: -32px -144px; } -.ui-icon-help { background-position: -48px -144px; } -.ui-icon-check { background-position: -64px -144px; } -.ui-icon-bullet { background-position: -80px -144px; } -.ui-icon-radio-off { background-position: -96px -144px; } -.ui-icon-radio-on { background-position: -112px -144px; } -.ui-icon-pin-w { background-position: -128px -144px; } -.ui-icon-pin-s { background-position: -144px -144px; } -.ui-icon-play { background-position: 0 -160px; } -.ui-icon-pause { background-position: -16px -160px; } -.ui-icon-seek-next { background-position: -32px -160px; } -.ui-icon-seek-prev { background-position: -48px -160px; } -.ui-icon-seek-end { background-position: -64px -160px; } -.ui-icon-seek-start { background-position: -80px -160px; } -/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ -.ui-icon-seek-first { background-position: -80px -160px; } -.ui-icon-stop { background-position: -96px -160px; } -.ui-icon-eject { background-position: -112px -160px; } -.ui-icon-volume-off { background-position: -128px -160px; } -.ui-icon-volume-on { background-position: -144px -160px; } -.ui-icon-power { background-position: 0 -176px; } -.ui-icon-signal-diag { background-position: -16px -176px; } -.ui-icon-signal { background-position: -32px -176px; } -.ui-icon-battery-0 { background-position: -48px -176px; } -.ui-icon-battery-1 { background-position: -64px -176px; } -.ui-icon-battery-2 { background-position: -80px -176px; } -.ui-icon-battery-3 { background-position: -96px -176px; } -.ui-icon-circle-plus { background-position: 0 -192px; } -.ui-icon-circle-minus { background-position: -16px -192px; } -.ui-icon-circle-close { background-position: -32px -192px; } -.ui-icon-circle-triangle-e { background-position: -48px -192px; } -.ui-icon-circle-triangle-s { background-position: -64px -192px; } -.ui-icon-circle-triangle-w { background-position: -80px -192px; } -.ui-icon-circle-triangle-n { background-position: -96px -192px; } -.ui-icon-circle-arrow-e { background-position: -112px -192px; } -.ui-icon-circle-arrow-s { background-position: -128px -192px; } -.ui-icon-circle-arrow-w { background-position: -144px -192px; } -.ui-icon-circle-arrow-n { background-position: -160px -192px; } -.ui-icon-circle-zoomin { background-position: -176px -192px; } -.ui-icon-circle-zoomout { background-position: -192px -192px; } -.ui-icon-circle-check { background-position: -208px -192px; } -.ui-icon-circlesmall-plus { background-position: 0 -208px; } -.ui-icon-circlesmall-minus { background-position: -16px -208px; } -.ui-icon-circlesmall-close { background-position: -32px -208px; } -.ui-icon-squaresmall-plus { background-position: -48px -208px; } -.ui-icon-squaresmall-minus { background-position: -64px -208px; } -.ui-icon-squaresmall-close { background-position: -80px -208px; } -.ui-icon-grip-dotted-vertical { background-position: 0 -224px; } -.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } -.ui-icon-grip-solid-vertical { background-position: -32px -224px; } -.ui-icon-grip-solid-horizontal { background-position: -48px -224px; } -.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } -.ui-icon-grip-diagonal-se { background-position: -80px -224px; } - - -/* Misc visuals -----------------------------------*/ - -/* Corner radius */ -.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; } -.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-right-radius: 4px; } -.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } -.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } - -/* Overlays */ -.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); } -.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/* - * jQuery UI Resizable 1.8.17 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Resizable#theming - */ -.ui-resizable { position: relative;} -.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; } -.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } -.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } -.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } -.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; } -.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; } -.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } -.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } -.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } -.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* - * jQuery UI Selectable 1.8.17 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Selectable#theming - */ -.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; } -/* - * jQuery UI Accordion 1.8.17 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Accordion#theming - */ -/* IE/Win - Fix animation bug - #4615 */ -.ui-accordion { width: 100%; } -.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; } -.ui-accordion .ui-accordion-li-fix { display: inline; } -.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; } -.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; } -.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; } -.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; } -.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; } -.ui-accordion .ui-accordion-content-active { display: block; } -/* - * jQuery UI Autocomplete 1.8.17 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Autocomplete#theming - */ -.ui-autocomplete { position: absolute; cursor: default; } - -/* workarounds */ -* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */ - -/* - * jQuery UI Menu 1.8.17 - * - * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Menu#theming - */ -.ui-menu { - list-style:none; - padding: 2px; - margin: 0; - display:block; - float: left; -} -.ui-menu .ui-menu { - margin-top: -3px; -} -.ui-menu .ui-menu-item { - margin:0; - padding: 0; - zoom: 1; - float: left; - clear: left; - width: 100%; -} -.ui-menu .ui-menu-item a { - text-decoration:none; - display:block; - padding:.2em .4em; - line-height:1.5; - zoom:1; -} -.ui-menu .ui-menu-item a.ui-state-hover, -.ui-menu .ui-menu-item a.ui-state-active { - font-weight: normal; - margin: -1px; -} -/* - * jQuery UI Button 1.8.17 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Button#theming - */ -.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */ -.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */ -button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */ -.ui-button-icons-only { width: 3.4em; } -button.ui-button-icons-only { width: 3.7em; } - -/*button text element */ -.ui-button .ui-button-text { display: block; line-height: 1.4; } -.ui-button-text-only .ui-button-text { padding: .4em 1em; } -.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; } -.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; } -.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; } -.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; } -/* no icon support for input elements, provide padding by default */ -input.ui-button { padding: .4em 1em; } - -/*button icon element(s) */ -.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; } -.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; } -.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; } -.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } -.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } - -/*button sets*/ -.ui-buttonset { margin-right: 7px; } -.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; } - -/* workarounds */ -button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */ -/* - * jQuery UI Dialog 1.8.17 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Dialog#theming - */ -.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; } -.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; } -.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; } -.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; } -.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; } -.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; } -.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; } -.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; } -.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; } -.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; } -.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } -.ui-draggable .ui-dialog-titlebar { cursor: move; } -/* - * jQuery UI Slider 1.8.17 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Slider#theming - */ -.ui-slider { position: relative; text-align: left; } -.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } -.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } - -.ui-slider-horizontal { height: .8em; } -.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } -.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } -.ui-slider-horizontal .ui-slider-range-min { left: 0; } -.ui-slider-horizontal .ui-slider-range-max { right: 0; } - -.ui-slider-vertical { width: .8em; height: 100px; } -.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } -.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } -.ui-slider-vertical .ui-slider-range-min { bottom: 0; } -.ui-slider-vertical .ui-slider-range-max { top: 0; }/* - * jQuery UI Tabs 1.8.17 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Tabs#theming - */ -.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ -.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; } -.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; } -.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; } -.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; } -.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; } -.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ -.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; } -.ui-tabs .ui-tabs-hide { display: none !important; } -/* - * jQuery UI Datepicker 1.8.17 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Datepicker#theming - */ -.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; } -.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; } -.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; } -.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; } -.ui-datepicker .ui-datepicker-prev { left:2px; } -.ui-datepicker .ui-datepicker-next { right:2px; } -.ui-datepicker .ui-datepicker-prev-hover { left:1px; } -.ui-datepicker .ui-datepicker-next-hover { right:1px; } -.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; } -.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; } -.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; } -.ui-datepicker select.ui-datepicker-month-year {width: 100%;} -.ui-datepicker select.ui-datepicker-month, -.ui-datepicker select.ui-datepicker-year { width: 49%;} -.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; } -.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; } -.ui-datepicker td { border: 0; padding: 1px; } -.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; } -.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; } -.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; } -.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; } - -/* with multiple calendars */ -.ui-datepicker.ui-datepicker-multi { width:auto; } -.ui-datepicker-multi .ui-datepicker-group { float:left; } -.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; } -.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; } -.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; } -.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; } -.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; } -.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; } -.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; } -.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; } - -/* RTL support */ -.ui-datepicker-rtl { direction: rtl; } -.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; } -.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; } -.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; } -.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; } -.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; } -.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; } -.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; } -.ui-datepicker-rtl .ui-datepicker-group { float:right; } -.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; } -.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; } - -/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */ -.ui-datepicker-cover { - display: none; /*sorry for IE5*/ - display/**/: block; /*sorry for IE5*/ - position: absolute; /*must have*/ - z-index: -1; /*must have*/ - filter: mask(); /*must have*/ - top: -4px; /*must have*/ - left: -4px; /*must have*/ - width: 200px; /*must have*/ - height: 200px; /*must have*/ -}/* - * jQuery UI Progressbar 1.8.17 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Progressbar#theming - */ -.ui-progressbar { height:2em; text-align: left; overflow: hidden; } -.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } \ No newline at end of file diff --git a/common/css/ui.jqgrid.css b/common/css/ui.jqgrid.css deleted file mode 100755 index 3ba8da1..0000000 --- a/common/css/ui.jqgrid.css +++ /dev/null @@ -1,152 +0,0 @@ -/*Grid*/ -.ui-jqgrid {position: relative; font-size:12;} -.ui-jqgrid .ui-jqgrid-view {position: relative;left:0px; top: 0px; padding: .0em;} -/* 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-close:hover { padding: 0; } -/* header*/ -.ui-jqgrid .ui-jqgrid-hdiv {position: relative; margin: 0em;padding: 0em; overflow-x: hidden; border-left: 0px none !important; border-top : 0px none !important; border-right : 0px 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 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 : 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-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-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-desc {margin-top:3px;height:12px;} -.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-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} -/* 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; 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: 4px 4px;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;} -/* 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 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-pager-control {position: relative;} -.ui-jqgrid .ui-pg-table {position: relative; padding-bottom:2px; width:auto; margin: 0em;} -.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-state-disabled:hover {padding:1px;} -.ui-jqgrid .ui-pg-input { height:20px;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-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-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 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-btable .ui-sgcollapsed span {display: block;} -.ui-jqgrid .ui-subgrid {margin:0em;padding:0em; 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-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 .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');} -/* end loading div */ -/* toolbar */ -.ui-jqgrid .ui-userdata {border-left: 0px none; border-right: 0px 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 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;} -/* 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;} -.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 input.FormElement {padding:.3em} -.ui-jqdialog-content .data-line {padding-top:.1em;border: 0px none;} - -.ui-jqdialog-content .CaptionTD {text-align: left; vertical-align: middle;border: 0px none; padding: 2px;white-space: nowrap;} -.ui-jqdialog-content .DataTD {padding: 2px; border: 0px 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; } -.fm-button-icon-right { padding-right: 1.9em; } -.fm-button-icon-left .ui-icon { right: auto; left: .2em; margin-left: 0; position: absolute; top: 50%; margin-top: -8px; } -.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;} -/* 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 */ -* 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-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 .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');} - -.acm-conditionals-wrapper { - margin-top: 20px; -} - -.acm-ui-wrapper .button { - margin-right: 10px; -} - -.acm-ui-wrapper p { - -} - -#conditionals-help { - width: 600px; -} \ No newline at end of file diff --git a/common/js/acm.js b/common/js/acm.js index 3dda938..eda9bbb 100644 --- a/common/js/acm.js +++ b/common/js/acm.js @@ -1,105 +1,138 @@ -jQuery( document ).ready( function( $ ) { - var last_selected, subgrid_lastsel; - var base_url = acm_url; - var grid_selector = jQuery("#acm-codes-list"); //avoid unnecessary selector calls - var subgrid_selector = jQuery( '#acm-codes-conditionals-list' ); - // this is ghetto - var actions = { - codes_datasource: ajaxurl + '?acm-action=datasource&action=acm_ajax_handler&nonce=' + acm_ajax_nonce, - codes_edit: ajaxurl + '?acm-action=edit&action=acm_ajax_handler&nonce=' + acm_ajax_nonce, - conditionals_datasource: ajaxurl + '?acm-action=datasource-conditionals&action=acm_ajax_handler&nonce=' + acm_ajax_nonce, - conditionals_edit: ajaxurl + '?acm-action=edit-conditionals&action=acm_ajax_handler&nonce=' + acm_ajax_nonce - }; - var conditionals_options = acm_conditionals; - - grid_selector.jqGrid({ - datatype: "json", - url: actions.codes_datasource, - editurl: actions.codes_edit, - height: 400, - width: 600, - multiselect: false, - // @todo remove hardcode, colNames and colModel should be set in provider config and printed in head section - colNames:['ID', 'Site Name', 'Zone1', 'Priority', 'Actions'], - colModel:[ - {name:'id',index:'id', width:40, align: 'center' }, - {name:'site_name',index:'site_name', width:200, editable: true, edittype:'text'}, - {name:'zone1',index:'zone1', width:100, editable: true}, - {name:'priority',index:'priority', width:100, editable: true}, - {name:'act',index:'act', width:125,sortable:false, align: 'center'}, - ], - prmNames:{ page: 'acm-grid-page' }, - rowNum:50, - rowList:[20,50,100], - pager: '#acm-codes-pager', - sortname: 'id', - viewrecords: true, - sortorder: "desc", - caption:"Ad Codes", - jsonReader : { repeatitems: false }, // workaround for jqGrid issue - gridComplete: function(){ - var ids = grid_selector.jqGrid( 'getDataIDs' ); - for(var i=0;i < ids.length;i++){ - var cl = ids[i]; - be = ""; - se = ""; - grid_selector.jqGrid( 'setRowData',ids[i],{act:be+se}); - } - - }, - onSelectRow: function(ids) { - if (ids == null) { - ids=0; - if (subgrid_selector.jqGrid( 'getGridParam','records' ) > 0 ) - { - subgrid_selector.jqGrid( 'setGridParam',{ url:actions.conditionals_datasource + "&id="+ids, page:1, editurl: actions.conditionals_edit + "&id="+ids } ); - subgrid_selector.jqGrid( 'setCaption',"Conditionals for Ad Code #: "+ids) - .trigger( 'reloadGrid' ); - } - } else { - subgrid_selector.jqGrid( 'setGridParam',{ url:actions.conditionals_datasource + "&id="+ids, page:1, editurl: actions.conditionals_edit + "&id="+ids } ); - subgrid_selector.jqGrid( 'setCaption',"Conditionals for Ad Code # "+ids) - .trigger( 'reloadGrid' ); +(function($) { +inlineEditAdCodes = { + + init : function() { + var t = this, row = $('#inline-edit'); + + t.what = '#ad-code-'; + + $('.acm-ajax-edit').live('click', function(){ + inlineEditAdCodes.edit(this); + jQuery('.add-more-conditionals').off( 'click.acm_add_more_conditionals', acm_add_more_conditionals ); + jQuery('.add-more-conditionals').on( 'click.acm_add_more_conditionals', acm_add_more_conditionals ); + jQuery('.acm-remove-conditional').on( 'click.acm_remove_conditional', acm_remove_conditional ); + return false; + }); + + // prepare the edit row + row.keyup(function(e) { if(e.which == 27) return inlineEditAdCodes.revert(); }); + + $('a.cancel', row).click(function() { return inlineEditAdCodes.revert(); }); + $('a.save', row).click(function() { return inlineEditAdCodes.save(this); }); + $('input, select', row).keydown(function(e) { if(e.which == 13) return inlineEditAdCodes.save(this); }); + + $('#posts-filter input[type="submit"]').mousedown(function(e){ + t.revert(); + }); + }, + + toggle : function(el) { + var t = this; + $(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el); + }, + + edit : function(id) { + var t = this, editRow; + t.revert(); + + if ( typeof(id) == 'object' ) + id = t.getId(id); + + editRow = $('#inline-edit').clone(true), rowData = $('#inline_'+id); + $('td', editRow).attr('colspan', $('.widefat:first thead th:visible').length); + + if ( $(t.what+id).hasClass('alternate') ) + $(editRow).addClass('alternate'); + + $(t.what+id).hide().after(editRow); + + $('input[name="id"]', editRow).val( $('.id', rowData).text() ); + $('.acm-conditional-fields', editRow).html( $('.acm-conditional-fields', rowData).html() ); + $('.acm-column-fields', editRow).html( $('.acm-column-fields', rowData).html() ); + $('.acm-priority-field', editRow).html( $('.acm-priority-field', rowData).html() ); + + $(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show(); + $('.ptitle', editRow).eq(0).focus(); + + return false; + }, + + save : function(id) { + + if( typeof(id) == 'object' ) + id = this.getId(id); + + $('table.widefat .inline-edit-save .waiting').show(); + // Get all of our field parameters + inline_edit = $('#edit-'+id ).find('fieldset').wrap('
'); + params = inline_edit.closest('form').serializeArray(); + + // make ajax request + $.post(ajaxurl, params, + function(r) { + var row, new_id; + $('table.widefat .inline-edit-save .waiting').hide(); + + if (r) { + if ( -1 != r.indexOf('Remove' ); + jQuery(this).closest('.acm-conditional-fields').find('.form-new-row').append(temp); + jQuery('.acm-remove-conditional').off( 'click.acm_remove_conditional', acm_remove_conditional ); + jQuery('.acm-remove-conditional').on( 'click.acm_remove_conditional', acm_remove_conditional ); + return false; +} + +var acm_remove_conditional = function() { + jQuery(this).closest('.conditional-single-field').remove(); + return false; +} + +jQuery( document ).ready( function( $ ) { + + jQuery('.add-more-conditionals').on( 'click.acm_add_more_conditionals', acm_add_more_conditionals ); + $('#conditionals-help-toggler').click( function( e ) { var el = jQuery('#conditionals-help'); el.toggleClass('hidden'); }); -} ); +}); \ No newline at end of file diff --git a/common/js/grid.locale-en.js b/common/js/grid.locale-en.js deleted file mode 100755 index 64dc885..0000000 --- a/common/js/grid.locale-en.js +++ /dev/null @@ -1,128 +0,0 @@ -;(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 = { - 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 (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 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' - } -}; -})(jQuery); diff --git a/common/js/jquery.jqGrid.min.js b/common/js/jquery.jqGrid.min.js deleted file mode 100755 index 5e4f791..0000000 --- a/common/js/jquery.jqGrid.min.js +++ /dev/null @@ -1,510 +0,0 @@ -/* -* jqGrid 4.3.1 - 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:2011-12-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.import.js; JsonXml.js; grid.tbltogrid.js; grid.jqueryui.js; -*/ -/* - jqGrid 4.3.1 - 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: 2011-12-20 -*/ -(function(b){b.jgrid=b.jgrid||{};b.extend(b.jgrid,{htmlDecode:function(d){if(d&&(d==" "||d==" "||d.length===1&&d.charCodeAt(0)===160))return"";return!d?d:String(d).replace(/>/g,">").replace(/</g,"<").replace(/"/g,'"').replace(/&/g,"&")},htmlEncode:function(d){return!d?d:String(d).replace(/&/g,"&").replace(/\"/g,""").replace(//g,">")},format:function(d){var i=b.makeArray(arguments).slice(1);if(d===undefined)d="";return d.replace(/\{(\d+)\}/g, -function(g,c){return i[c]})},getCellIndex:function(d){d=b(d);if(d.is("tr"))return-1;d=(!d.is("td")&&!d.is("th")?d.closest("td,th"):d)[0];if(b.browser.msie)return b.inArray(d,d.parentNode.cells);return d.cellIndex},stripHtml:function(d){d+="";var i=/<("[^"]*"|'[^']*'|[^'">])*>/gi;if(d)return(d=d.replace(i,""))&&d!==" "&&d!==" "?d.replace(/\"/g,"'"):"";else return d},realType:function(d){return Object.prototype.toString.call(d).slice(8,-1)},stripPref:function(d,i){var g=this.realType(d);if(g== -"String"||g=="Number"){d=String(d);i=d!==""?String(i).replace(String(d),""):i}return i},stringToDoc:function(d){var i;if(typeof d!=="string")return d;try{i=(new DOMParser).parseFromString(d,"text/xml")}catch(g){i=new ActiveXObject("Microsoft.XMLDOM");i.async=false;i.loadXML(d)}return i&&i.documentElement&&i.documentElement.tagName!="parsererror"?i:null},parse:function(d){if(d.substr(0,9)=="while(1);")d=d.substr(9);if(d.substr(0,2)=="/*")d=d.substr(2,d.length-4);d||(d="{}");return b.jgrid.useJSON=== -true&&typeof JSON==="object"&&typeof JSON.parse==="function"?JSON.parse(d):eval("("+d+")")},parseDate:function(d,i){var g={m:1,d:1,y:1970,h:0,i:0,s:0,u:0},c,h,k;c=/[\\\/:_;.,\t\T\s-]/;if(i&&i!==null&&i!==undefined){i=b.trim(i);i=i.split(c);d=d.split(c);var l=b.jgrid.formatter.date.monthNames,a=b.jgrid.formatter.date.AmPm,q=function(x,y){if(x===0){if(y===12)y=0}else if(y!==12)y+=12;return y};c=0;for(h=d.length;c11)i[c]=k+1-12}if(d[c]=="a"){k=b.inArray(i[c],a);if(k!==-1&&k<2&&i[c]==a[k]){i[c]=k;g.h=q(i[c],g.h)}}if(d[c]=="A"){k=b.inArray(i[c],a);if(k!==-1&&k>1&&i[c]==a[k]){i[c]=k-2;g.h=q(i[c],g.h)}}if(i[c]!==undefined)g[d[c].toLowerCase()]=parseInt(i[c],10)}g.m=parseInt(g.m,10)-1;c=g.y;if(c>=70&&c<=99)g.y=1900+g.y;else if(c>=0&&c<=69)g.y=2E3+g.y}return new Date(g.y,g.m,g.d,g.h,g.i,g.s,g.u)},jqID:function(d){return String(d).replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g,"\\$&")},guid:1,uidPref:"jqg", -randId:function(d){return(d?d:b.jgrid.uidPref)+b.jgrid.guid++},getAccessor:function(d,i){var g,c,h=[],k;if(typeof i==="function")return i(d);g=d[i];if(g===undefined)try{if(typeof i==="string")h=i.split(".");if(k=h.length)for(g=d;g&&k--;){c=h.shift();g=g[c]}}catch(l){}return g},getXmlData:function(d,i,g){var c=typeof i==="string"?i.match(/^(.*)\[(\w+)\]$/):null;if(typeof i==="function")return i(d);if(c&&c[2])return c[1]?b(c[1],d).attr(c[2]):b(d).attr(c[2]);else{d=b(i,d);if(g)return d;return d.length> -0?b(d).text():undefined}},ajaxOptions:{},from:function(d){return new function(i,g){if(typeof i=="string")i=b.data(i);var c=this,h=i,k=true,l=false,a=g,q=/[\$,%]/g,x=null,y=null,E=0,I=false,M="",N=[],V=true;if(typeof i=="object"&&i.push){if(i.length>0)V=typeof i[0]!="object"?false:true}else throw"data provides is not an array";this._hasData=function(){return h===null?false:h.length===0?false:true};this._getStr=function(o){var n=[];l&&n.push("jQuery.trim(");n.push("String("+o+")");l&&n.push(")");k|| -n.push(".toLowerCase()");return n.join("")};this._strComp=function(o){return typeof o=="string"?".toString()":""};this._group=function(o,n){return{field:o.toString(),unique:n,items:[]}};this._toStr=function(o){if(l)o=b.trim(o);k||(o=o.toLowerCase());return o=o.toString().replace(/\\/g,"\\\\").replace(/\"/g,'\\"')};this._funcLoop=function(o){var n=[];b.each(h,function(t,F){n.push(o(F))});return n};this._append=function(o){var n;if(a===null)a="";else a+=M===""?" && ":M;for(n=0;nn)return t;return 0};this._performSort=function(){if(N.length!==0)h=c._doSort(h,0)};this._doSort=function(o,n){var t=N[n].by,F=N[n].dir,T=N[n].type,J=N[n].datefmt;if(n==N.length-1)return c._getOrder(o,t,F,T,J);n++;t=c._getGroup(o,t,F,T,J);F=[];for(T=0;T -0};this.andNot=function(o,n,t){I=!I;return c.and(o,n,t)};this.orNot=function(o,n,t){I=!I;return c.or(o,n,t)};this.not=function(o,n,t){return c.andNot(o,n,t)};this.and=function(o,n,t){M=" && ";if(o===undefined)return c;return c._repeatCommand(o,n,t)};this.or=function(o,n,t){M=" || ";if(o===undefined)return c;return c._repeatCommand(o,n,t)};this.orBegin=function(){E++;return c};this.orEnd=function(){if(a!==null)a+=")";return c};this.isNot=function(o){I=!I;return c.is(o)};this.is=function(o){c._append("this."+ -o);c._resetNegate();return c};this._compareValues=function(o,n,t,F,T){var J;J=V?"jQuery.jgrid.getAccessor(this,'"+n+"')":"this";if(t===undefined)t=null;var D=t,ca=T.stype===undefined?"text":T.stype;if(t!==null)switch(ca){case "int":case "integer":D=isNaN(Number(D))||D===""?"0":D;J="parseInt("+J+",10)";D="parseInt("+D+",10)";break;case "float":case "number":case "numeric":D=String(D).replace(q,"");D=isNaN(Number(D))||D===""?"0":D;J="parseFloat("+J+")";D="parseFloat("+D+")";break;case "date":case "datetime":D= -String(b.jgrid.parseDate(T.newfmt||"Y-m-d",D).getTime());J='jQuery.jgrid.parseDate("'+T.srcfmt+'",'+J+").getTime()";break;default:J=c._getStr(J);D=c._getStr('"'+c._toStr(D)+'"')}c._append(J+" "+F+" "+D);c._setCommand(o,n);c._resetNegate();return c};this.equals=function(o,n,t){return c._compareValues(c.equals,o,n,"==",t)};this.notEquals=function(o,n,t){return c._compareValues(c.equals,o,n,"!==",t)};this.isNull=function(o,n,t){return c._compareValues(c.equals,o,null,"===",t)};this.greater=function(o, -n,t){return c._compareValues(c.greater,o,n,">",t)};this.less=function(o,n,t){return c._compareValues(c.less,o,n,"<",t)};this.greaterOrEquals=function(o,n,t){return c._compareValues(c.greaterOrEquals,o,n,">=",t)};this.lessOrEquals=function(o,n,t){return c._compareValues(c.lessOrEquals,o,n,"<=",t)};this.startsWith=function(o,n){var t=n===undefined||n===null?o:n;t=l?b.trim(t.toString()).length:t.toString().length;if(V)c._append(c._getStr("jQuery.jgrid.getAccessor(this,'"+o+"')")+".substr(0,"+t+") == "+ -c._getStr('"'+c._toStr(n)+'"'));else{t=l?b.trim(n.toString()).length:n.toString().length;c._append(c._getStr("this")+".substr(0,"+t+") == "+c._getStr('"'+c._toStr(o)+'"'))}c._setCommand(c.startsWith,o);c._resetNegate();return c};this.endsWith=function(o,n){var t=n===undefined||n===null?o:n;t=l?b.trim(t.toString()).length:t.toString().length;V?c._append(c._getStr("jQuery.jgrid.getAccessor(this,'"+o+"')")+".substr("+c._getStr("jQuery.jgrid.getAccessor(this,'"+o+"')")+".length-"+t+","+t+') == "'+c._toStr(n)+ -'"'):c._append(c._getStr("this")+".substr("+c._getStr("this")+'.length-"'+c._toStr(o)+'".length,"'+c._toStr(o)+'".length) == "'+c._toStr(o)+'"');c._setCommand(c.endsWith,o);c._resetNegate();return c};this.contains=function(o,n){V?c._append(c._getStr("jQuery.jgrid.getAccessor(this,'"+o+"')")+'.indexOf("'+c._toStr(n)+'",0) > -1'):c._append(c._getStr("this")+'.indexOf("'+c._toStr(o)+'",0) > -1');c._setCommand(c.contains,o);c._resetNegate();return c};this.groupBy=function(o,n,t,F){if(!c._hasData())return null; -return c._getGroup(h,o,n,t,F)};this.orderBy=function(o,n,t,F){n=n===undefined||n===null?"a":b.trim(n.toString().toLowerCase());if(t===null||t===undefined)t="text";if(F===null||F===undefined)F="Y-m-d";if(n=="desc"||n=="descending")n="d";if(n=="asc"||n=="ascending")n="a";N.push({by:o,dir:n,type:t,datefmt:F});return c};return c}(d,null)},extend:function(d){b.extend(b.fn.jqGrid,d);this.no_legacy_api||b.fn.extend(d)}});b.fn.jqGrid=function(d){if(typeof d=="string"){var i=b.jgrid.getAccessor(b.fn.jqGrid, -d);if(!i)throw"jqGrid - No such method: "+d;var g=b.makeArray(arguments).slice(1);return i.apply(this,g)}return this.each(function(){if(!this.grid){var c=b.extend(true,{url:"",height:150,page:1,rowNum:20,rowTotal:null,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,beforeProcessing: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,totalrows:"totalrows"},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:40,data:[],_index:{},grouping:false,groupingView:{groupField:[],groupOrder:[],groupText:[],groupColumnShow:[],groupSummary:[],showSummaryOnHide:false,sortitems:[],sortnames:[],groupDataSorted:false, -summary:[],summaryval:[],plusicon:"ui-icon-circlesmall-plus",minusicon:"ui-icon-circlesmall-minus"},ignoreCase:false,cmTemplate:{},idPrefix:""},b.jgrid.defaults,d||{}),h={headers:[],cols:[],footers:[],dragStart:function(e,f,j){this.resizing={idx:e,startX:f.clientX,sOL:j[0]};this.hDiv.style.cursor="col-resize";this.curGbox=b("#rs_m"+b.jgrid.jqID(c.id),"#gbox_"+b.jgrid.jqID(c.id));this.curGbox.css({display:"block",left:j[0],top:j[1],height:j[2]});b.isFunction(c.resizeStart)&&c.resizeStart.call(this, -f,e);document.onselectstart=function(){return false}},dragMove:function(e){if(this.resizing){var f=e.clientX-this.resizing.startX;e=this.headers[this.resizing.idx];var j=c.direction==="ltr"?e.width+f:e.width-f,m;if(j>33){this.curGbox.css({left:this.resizing.sOL+f});if(c.forceFit===true){m=this.headers[this.resizing.idx+c.nv];f=c.direction==="ltr"?m.width-f:m.width+f;if(f>33){e.newWidth=j;m.newWidth=f}}else{this.newWidth=c.direction==="ltr"?c.tblwidth+f:c.tblwidth-f;e.newWidth=j}}}},dragEnd:function(){this.hDiv.style.cursor= -"default";if(this.resizing){var e=this.resizing.idx,f=this.headers[e].newWidth||this.headers[e].width;f=parseInt(f,10);this.resizing=false;b("#rs_m"+b.jgrid.jqID(c.id)).css("display","none");c.colModel[e].width=f;this.headers[e].width=f;this.headers[e].el.style.width=f+"px";this.cols[e].style.width=f+"px";if(this.footers.length>0)this.footers[e].style.width=f+"px";if(c.forceFit===true){f=this.headers[e+c.nv].newWidth||this.headers[e+c.nv].width;this.headers[e+c.nv].width=f;this.headers[e+c.nv].el.style.width= -f+"px";this.cols[e+c.nv].style.width=f+"px";if(this.footers.length>0)this.footers[e+c.nv].style.width=f+"px";c.colModel[e+c.nv].width=f}else{c.tblwidth=this.newWidth||c.tblwidth;b("table:first",this.bDiv).css("width",c.tblwidth+"px");b("table:first",this.hDiv).css("width",c.tblwidth+"px");this.hDiv.scrollLeft=this.bDiv.scrollLeft;if(c.footerrow){b("table:first",this.sDiv).css("width",c.tblwidth+"px");this.sDiv.scrollLeft=this.bDiv.scrollLeft}}b.isFunction(c.resizeStop)&&c.resizeStop.call(this,f,e)}this.curGbox= -null;document.onselectstart=function(){return true}},populateVisible:function(){h.timer&&clearTimeout(h.timer);h.timer=null;var e=b(h.bDiv).height();if(e){var f=b("table:first",h.bDiv),j,m;if(f[0].rows.length)try{m=(j=f[0].rows[1])?b(j).outerHeight()||h.prevRowHeight:h.prevRowHeight}catch(p){m=h.prevRowHeight}if(m){h.prevRowHeight=m;var C=c.rowNum;j=h.scrollTop=h.bDiv.scrollTop;var s=Math.round(f.position().top)-j,A=s+f.height();m*=C;var z,u,w;if(A=0||u<2||c.scroll===true){z=Math.round((A+j)/m)+1;s=-1}else s=1}if(s>0){z=parseInt(j/m,10)+1;u=parseInt((j+e)/m,10)+2-z;w=true}if(u)if(!(c.lastpage&&z>c.lastpage||c.lastpage==1||z===c.page&&z===c.lastpage))if(h.hDiv.loading)h.timer=setTimeout(h.populateVisible,c.scrollTimeout);else{c.page=z;if(w){h.selectionPreserver(f[0]);h.emptyRows(h.bDiv,false,false)}h.populate(u)}}}},scrollGrid:function(e){if(c.scroll){var f=h.bDiv.scrollTop;if(h.scrollTop=== -undefined)h.scrollTop=0;if(f!=h.scrollTop){h.scrollTop=f;h.timer&&clearTimeout(h.timer);h.timer=setTimeout(h.populateVisible,c.scrollTimeout)}}h.hDiv.scrollLeft=h.bDiv.scrollLeft;if(c.footerrow)h.sDiv.scrollLeft=h.bDiv.scrollLeft;e&&e.stopPropagation()},selectionPreserver:function(e){var f=e.p,j=f.selrow,m=f.selarrrow?b.makeArray(f.selarrrow):null,p=e.grid.bDiv.scrollLeft,C=f.gridComplete;f.gridComplete=function(){f.selrow=null;f.selarrrow=[];if(f.multiselect&&m&&m.length>0)for(var s=0;s
"),x,y=b.browser.msie?true:false,E=b.browser.webkit||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";l=a.p.direction;b(q).insertBefore(this);b(this).appendTo(q).removeClass("scroll");var I=b("
");b(I).insertBefore(q).attr({id:"gbox_"+this.id,dir:l});b(q).appendTo(I).attr("id","gview_"+ -this.id);x=y&&b.browser.version<=6?'':"";b("
").append(x).insertBefore(q);b("
"+this.p.loadtext+"
").insertBefore(q);b(this).attr({cellspacing:"0",cellpadding:"0",border:"0",role:"grid","aria-multiselectable":!!this.p.multiselect, -"aria-labelledby":"gbox_"+this.id});var M=function(e,f){e=parseInt(e,10);return isNaN(e)?f?f:0:e},N=function(e,f,j,m,p,C){var s=a.p.colModel[e],A=s.align,z='style="',u=s.classes,w=s.name,r=[];if(A)z+="text-align:"+A+";";if(s.hidden===true)z+="display:none;";if(f===0)z+="width: "+h.headers[e].width+"px;";else if(s.cellattr&&b.isFunction(s.cellattr))if((e=s.cellattr.call(a,p,j,m,s,C))&&typeof e==="string"){e=e.replace(/style/i,"style").replace(/title/i,"title");if(e.indexOf("title")>-1)s.title=false; -if(e.indexOf("class")>-1)u=undefined;r=e.split("style");if(r.length===2){r[1]=b.trim(r[1].replace("=",""));if(r[1].indexOf("'")===0||r[1].indexOf('"')===0)r[1]=r[1].substring(1);z+=r[1].replace(/'/gi,'"')}else z+='"'}if(!r.length){r[0]="";z+='"'}z+=(u!==undefined?' class="'+u+'"':"")+(s.title&&j?' title="'+b.jgrid.stripHtml(j)+'"':"");z+=' aria-describedby="'+a.p.id+"_"+w+'"';return z+r[0]},V=function(e){return e===undefined||e===null||e===""?" ":a.p.autoencode?b.jgrid.htmlEncode(e):e+""},o= -function(e,f,j,m,p){var C=a.p.colModel[j];if(typeof C.formatter!=="undefined"){e={rowId:e,colModel:C,gid:a.p.id,pos:j};f=b.isFunction(C.formatter)?C.formatter.call(a,f,e,m,p):b.fmatter?b.fn.fmatter(C.formatter,f,e,m,p):V(f)}else f=V(f);return f},n=function(e,f,j,m,p){f=o(e,f,j,p,"add");return'"+f+""},t=function(e,f,j){var m='';return'"+m+""},F=function(e,f,j,m){j=(parseInt(j,10)-1)*parseInt(m,10)+1+f;return'"+j+""},T=function(e){var f,j=[],m=0,p;for(p=0;pdiv:first",e).css({height:"auto"}).children("div:first").css({height:0,display:"none"});e.scrollTop=0}if(j===true)if(a.p.treeGrid===true){a.p.data=[];a.p._index={}}},ca=function(){var e= -a.p.data.length,f,j,m;f=a.p.rownumbers===true?1:0;j=a.p.multiselect===true?1:0;m=a.p.subGrid===true?1:0;f=a.p.keyIndex===false||a.p.loadonce===true?a.p.localReader.id:a.p.colModel[a.p.keyIndex+j+m+f].name;for(j=0;j1?j:1;var u,w,r=0,G,O=0,S=0,K=0,L,Z=[],P,v={},B,H,U=[],ia=a.p.altRows===true?" "+a.p.altclass:"";A.repeatitems||(Z=T(z));L=a.p.keyIndex===false?A.id:a.p.keyIndex;if(Z.length>0&&!isNaN(L)){if(a.p.remapColumns&&a.p.remapColumns.length)L=b.inArray(L,a.p.remapColumns);L=Z[L]}z=(L+"").indexOf("[")===-1?Z.length?function(ga,ba){return b(L,ga).text()||ba}:function(ga,ba){return b(A.cell,ga).eq(L).text()||ba}:function(ga, -ba){return ga.getAttribute(L.replace(/[\[\]]/g,""))||ba};a.p.userData={};a.p.page=b.jgrid.getXmlData(e,A.page)||0;a.p.lastpage=b.jgrid.getXmlData(e,A.total);if(a.p.lastpage===undefined)a.p.lastpage=1;a.p.records=b.jgrid.getXmlData(e,A.records)||0;if(b.isFunction(A.userdata))a.p.userData=A.userdata.call(a,e)||{};else b.jgrid.getXmlData(e,A.userdata,true).each(function(){a.p.userData[this.getAttribute("name")]=b(this).text()});e=b.jgrid.getXmlData(e,A.root,true);(e=b.jgrid.getXmlData(e,A.row,true))|| -(e=[]);var $=e.length,W=0,ha={},ja=parseInt(a.p.rowNum,10);if($>0&&a.p.page<=0)a.p.page=1;if(e&&$){var qa=a.p.scroll?b.jgrid.randId():1;if(p)ja*=p+1;p=b.isFunction(a.p.afterInsertRow);var ya="";if(a.p.grouping&&a.p.groupingView.groupCollapse===true)ya=' style="display:none;"';for(;W<$;){B=e[W];H=z(B,qa+W);H=a.p.idPrefix+H;u=j===0?0:j+1;u=(u+W)%2==1?ia:"";U.push("');if(a.p.rownumbers===true){U.push(F(0, -W,a.p.page,a.p.rowNum));K=1}if(a.p.multiselect===true){U.push(t(H,K,W));O=1}if(a.p.subGrid===true){U.push(b(a).jqGrid("addSubGridCell",O+K,W+j));S=1}if(A.repeatitems){P||(P=J(O+S+K));var Ca=b.jgrid.getXmlData(B,A.cell,true);b.each(P,function(ga){var ba=Ca[this];if(!ba)return false;G=ba.textContent||ba.text;v[a.p.colModel[ga+O+S+K].name]=G;U.push(n(H,G,ga+O+S+K,W+j,B))})}else for(u=0;u"); -if(a.p.grouping){u=a.p.groupingView.groupField.length;for(var Da=[],za=0;za-1?a.p.treeANode:0;if(a.p.grouping){b(a).jqGrid("groupingRender",ha, -a.p.colModel.length);ha=null}else a.p.treeGrid===true&&w>0?b(a.rows[w]).after(U.join("")):b("tbody:first",f).append(U.join(""))}if(a.p.subGrid===true)try{b(a).jqGrid("addSubGrid",O+K)}catch(Ka){}a.p.totaltime=new Date-C;if(r>0)if(a.p.records===0)a.p.records=$;U=null;if(a.p.treeGrid===true)try{b(a).jqGrid("setTreeNode",w+1,r+w+1)}catch(La){}if(!a.p.treeGrid&&!a.p.scroll)a.grid.bDiv.scrollTop=0;a.p.reccount=r;a.p.treeANode=-1;a.p.userDataOnFooter&&b(a).jqGrid("footerData","set",a.p.userData,true);if(s){a.p.records= -$;a.p.lastpage=Math.ceil($/ja)}m||a.updatepager(false,true);if(s)for(;r<$;){B=e[r];H=z(B,r);H=a.p.idPrefix+H;if(A.repeatitems){P||(P=J(O+S+K));var Ha=b.jgrid.getXmlData(B,A.cell,true);b.each(P,function(ga){var ba=Ha[this];if(!ba)return false;G=ba.textContent||ba.text;v[a.p.colModel[ga+O+S+K].name]=G})}else for(u=0;u1?j:1;var s,A=a.p.datatype!="local"&&a.p.loadonce||a.p.datatype=="jsonstring";if(A){a.p.data=[];a.p._index={};a.p.localReader.id="_id_"}a.p.reccount=0;if(a.p.datatype=="local"){f=a.p.localReader;s="local"}else{f=a.p.jsonReader;s="json"}var z=0,u,w,r=[],G,O=0,S=0,K=0,L,Z,P={},v,B,H=[],U=a.p.altRows===true?" "+a.p.altclass:"";a.p.page=b.jgrid.getAccessor(e,f.page)||0;L=b.jgrid.getAccessor(e,f.total);a.p.lastpage=L===undefined?1: -L;a.p.records=b.jgrid.getAccessor(e,f.records)||0;a.p.userData=b.jgrid.getAccessor(e,f.userdata)||{};f.repeatitems||(G=r=T(s));s=a.p.keyIndex===false?f.id:a.p.keyIndex;if(r.length>0&&!isNaN(s)){if(a.p.remapColumns&&a.p.remapColumns.length)s=b.inArray(s,a.p.remapColumns);s=r[s]}(Z=b.jgrid.getAccessor(e,f.root))||(Z=[]);L=Z.length;e=0;if(L>0&&a.p.page<=0)a.p.page=1;var ia=parseInt(a.p.rowNum,10),$=a.p.scroll?b.jgrid.randId():1;if(p)ia*=p+1;var W=b.isFunction(a.p.afterInsertRow),ha={},ja="";if(a.p.grouping&& -a.p.groupingView.groupCollapse===true)ja=' style="display:none;"';for(;e');if(a.p.rownumbers===true){H.push(F(0,e,a.p.page,a.p.rowNum));K=1}if(a.p.multiselect){H.push(t(B,K,e));O=1}if(a.p.subGrid){H.push(b(a).jqGrid("addSubGridCell", -O+K,e+j));S=1}if(f.repeatitems){if(f.cell)p=b.jgrid.getAccessor(p,f.cell);G||(G=J(O+S+K))}for(w=0;w");if(a.p.grouping){u=a.p.groupingView.groupField.length;w=[];for(var qa=0;qa-1?a.p.treeANode:0;if(a.p.grouping)b(a).jqGrid("groupingRender",ha,a.p.colModel.length);else a.p.treeGrid===true&&v>0?b(a.rows[v]).after(H.join("")):b("#"+b.jgrid.jqID(a.p.id)+" tbody:first").append(H.join(""))}if(a.p.subGrid===true)try{b(a).jqGrid("addSubGrid",O+K)}catch(ya){}a.p.totaltime=new Date-C;if(z>0)if(a.p.records===0)a.p.records= -L;if(a.p.treeGrid===true)try{b(a).jqGrid("setTreeNode",v+1,z+v+1)}catch(Ca){}if(!a.p.treeGrid&&!a.p.scroll)a.grid.bDiv.scrollTop=0;a.p.reccount=z;a.p.treeANode=-1;a.p.userDataOnFooter&&b(a).jqGrid("footerData","set",a.p.userData,true);if(A){a.p.records=L;a.p.lastpage=Math.ceil(L/ia)}m||a.updatepager(false,true);if(A)for(;z0&&U&&r.or();try{e(v.groups[H])}catch(ha){alert(ha)}B++}U&&r.orEnd()}if(v.rules!==undefined){if(B>0){U=r.select();r=b.jgrid.from(U); -if(a.p.ignoreCase)r=r.ignoreCase()}try{(ia=v.rules.length&&v.groupOp.toString().toUpperCase()==="OR")&&r.orBegin();for(H=0;H0&&$&&$==="OR")r=r.or();r=w[W.op](r,$)(W.field,W.data,m[W.field])}B++}ia&&r.orEnd()}catch(ja){alert(ja)}}}var f,j=false,m={},p=[],C=[],s,A,z;if(b.isArray(a.p.data)){var u=a.p.grouping?a.p.groupingView:false;b.each(a.p.colModel,function(){A=this.sorttype||"text";if(A=="date"||A=="datetime"){if(this.formatter&& -typeof this.formatter==="string"&&this.formatter=="date"){s=this.formatoptions&&this.formatoptions.srcformat?this.formatoptions.srcformat:b.jgrid.formatter.date.srcformat;z=this.formatoptions&&this.formatoptions.newformat?this.formatoptions.newformat:b.jgrid.formatter.date.newformat}else s=z=this.datefmt||"Y-m-d";m[this.name]={stype:A,srcfmt:s,newfmt:z}}else m[this.name]={stype:A,srcfmt:"",newfmt:""};if(a.p.grouping&&this.name==u.groupField[0]){var v=this.name;if(typeof this.index!="undefined")v= -this.index;p[0]=m[v];C.push(v)}if(!j&&(this.index==a.p.sortname||this.name==a.p.sortname)){f=this.name;j=true}});if(a.p.treeGrid)b(a).jqGrid("SortTree",f,a.p.sortorder,m[f].stype,m[f].srcfmt);else{var w={eq:function(v){return v.equals},ne:function(v){return v.notEquals},lt:function(v){return v.less},le:function(v){return v.lessOrEquals},gt:function(v){return v.greater},ge:function(v){return v.greaterOrEquals},cn:function(v){return v.contains},nc:function(v,B){return B==="OR"?v.orNot().contains:v.andNot().contains}, -bw:function(v){return v.startsWith},bn:function(v,B){return B==="OR"?v.orNot().startsWith:v.andNot().startsWith},en:function(v,B){return B==="OR"?v.orNot().endsWith:v.andNot().endsWith},ew:function(v){return v.endsWith},ni:function(v,B){return B==="OR"?v.orNot().equals:v.andNot().equals},"in":function(v){return v.equals},nu:function(v){return v.isNull},nn:function(v,B){return B==="OR"?v.orNot().isNull:v.andNot().isNull}},r=b.jgrid.from(a.p.data);if(a.p.ignoreCase)r=r.ignoreCase();if(a.p.search=== -true){var G=a.p.postData.filters;if(G){if(typeof G=="string")G=b.jgrid.parse(G);e(G)}else try{r=w[a.p.postData.searchOper](r)(a.p.postData.searchField,a.p.postData.searchString,m[a.p.postData.searchField])}catch(O){}}if(a.p.grouping){r.orderBy(C,u.groupOrder[0],p[0].stype,p[0].srcfmt);u.groupDataSorted=true}if(f&&a.p.sortorder&&j)a.p.sortorder.toUpperCase()=="DESC"?r.orderBy(a.p.sortname,"d",m[f].stype,m[f].srcfmt):r.orderBy(a.p.sortname,"a",m[f].stype,m[f].srcfmt);G=r.select();var S=parseInt(a.p.rowNum, -10),K=G.length,L=parseInt(a.p.page,10),Z=Math.ceil(K/S),P={};G=G.slice((L-1)*S,L*S);m=r=null;P[a.p.localReader.total]=Z;P[a.p.localReader.page]=L;P[a.p.localReader.records]=K;P[a.p.localReader.root]=G;P[a.p.localReader.userdata]=a.p.userData;G=null;return P}}},R=function(){a.grid.hDiv.loading=true;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()}},aa=function(){a.grid.hDiv.loading= -false;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()}},ka=function(e){if(!a.grid.hDiv.loading){var f=a.p.scroll&&e===false,j={},m,p=a.p.prmNames;if(a.p.page<=0)a.p.page=1;if(p.search!==null)j[p.search]=a.p.search;if(p.nd!==null)j[p.nd]=(new Date).getTime();if(p.rows!==null)j[p.rows]=a.p.rowNum;if(p.page!==null)j[p.page]=a.p.page;if(p.sort!==null)j[p.sort]=a.p.sortname;if(p.order!== -null)j[p.order]=a.p.sortorder;if(a.p.rowTotal!==null&&p.totalrows!==null)j[p.totalrows]=a.p.rowTotal;var C=a.p.loadComplete,s=b.isFunction(C);s||(C=null);var A=0;e=e||1;if(e>1)if(p.npage!==null){j[p.npage]=e;A=e-1;e=1}else C=function(u){a.p.page++;a.grid.hDiv.loading=false;s&&a.p.loadComplete.call(a,u);ka(e-1)};else p.npage!==null&&delete a.p.postData[p.npage];if(a.p.grouping){b(a).jqGrid("groupingSetup");if(a.p.groupingView.groupDataSorted===true)j[p.sort]=a.p.groupingView.groupField[0]+" "+a.p.groupingView.groupOrder[0]+ -", "+j[p.sort]}b.extend(a.p.postData,j);var z=!a.p.scroll?1:a.rows.length-1;if(b.isFunction(a.p.datatype))a.p.datatype.call(a,a.p.postData,"load_"+a.p.id);else{if(b.isFunction(a.p.beforeRequest)){j=a.p.beforeRequest.call(a);if(j===undefined)j=true;if(j===false)return}m=a.p.datatype.toLowerCase();switch(m){case "json":case "jsonp":case "xml":case "script":b.ajax(b.extend({url:a.p.url,type:a.p.mtype,dataType:m,data:b.isFunction(a.p.serializeGridData)?a.p.serializeGridData.call(a,a.p.postData):a.p.postData, -success:function(u,w,r){b.isFunction(a.p.beforeProcessing)&&a.p.beforeProcessing.call(a,u,w,r);m==="xml"?X(u,a.grid.bDiv,z,e>1,A):fa(u,a.grid.bDiv,z,e>1,A);C&&C.call(a,u);f&&a.grid.populateVisible();if(a.p.loadonce||a.p.treeGrid)a.p.datatype="local";e===1&&aa()},error:function(u,w,r){b.isFunction(a.p.loadError)&&a.p.loadError.call(a,u,w,r);e===1&&aa()},beforeSend:function(u,w){var r=true;if(b.isFunction(a.p.loadBeforeSend))r=a.p.loadBeforeSend.call(a,u,w);if(r===undefined)r=true;if(r===false)return false; -else R()}},b.jgrid.ajaxOptions,a.p.ajaxGridOptions));break;case "xmlstring":R();j=b.jgrid.stringToDoc(a.p.datastr);X(j,a.grid.bDiv);s&&a.p.loadComplete.call(a,j);a.p.datatype="local";a.p.datastr=null;aa();break;case "jsonstring":R();j=typeof a.p.datastr=="string"?b.jgrid.parse(a.p.datastr):a.p.datastr;fa(j,a.grid.bDiv);s&&a.p.loadComplete.call(a,j);a.p.datatype="local";a.p.datastr=null;aa();break;case "local":case "clientside":R();a.p.datatype="local";j=pa();fa(j,a.grid.bDiv,z,e>1,A);C&&C.call(a, -j);f&&a.grid.populateVisible();aa()}}}},sa=function(e){b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv)[a.p.useProp?"prop":"attr"]("checked",e);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",e)};x=function(e,f){var j="",m="",p="",C,s,A,z,u=function(w){var r;if(b.isFunction(a.p.onPaging))r=a.p.onPaging.call(a,w);a.p.selrow=null; -if(a.p.multiselect){a.p.selarrrow=[];sa(false)}a.p.savedRow=[];if(r=="stop")return false;return true};e=e.substr(1);f+="_"+e;C="pg_"+e;s=e+"_left";A=e+"_center";z=e+"_right";b("#"+b.jgrid.jqID(e)).append("
").attr("dir","ltr");if(a.p.rowList.length>0){p="";p+=""}if(l=="rtl")m+=p;if(a.p.pginput===true)j=""+b.jgrid.format(a.p.pgtext||"","", -"")+"";if(a.p.pgbuttons===true){s=["first"+f,"prev"+f,"next"+f,"last"+f];l=="rtl"&&s.reverse();m+="";m+="";m+=j!==""?""+j+"": -"";m+="";m+=""}else if(j!=="")m+=j;if(l=="ltr")m+=p;m+="";a.p.viewrecords===true&&b("td#"+e+"_"+a.p.recordpos,"#"+C).append("
");b("td#"+e+"_"+a.p.pagerpos,"#"+C).append(m);p=b(".ui-jqgrid").css("font-size")|| -"11px";b(document.body).append("");m=b(m).clone().appendTo("#testpg").width();b("#testpg").remove();if(m>0){if(j!=="")m+=50;b("td#"+e+"_"+a.p.pagerpos,"#"+C).width(m)}a.p._nvtd=[];a.p._nvtd[0]=m?Math.floor((a.p.width-m)/2):Math.floor(a.p.width/3);a.p._nvtd[1]=0;m=null;b(".ui-pg-selbox","#"+C).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(f)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(!u("records"))return false;ka();return false});if(a.p.pgbuttons===true){b(".ui-pg-button","#"+C).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"+b.jgrid.jqID(f)+", #prev"+b.jgrid.jqID(f)+", #next"+b.jgrid.jqID(f)+", #last"+b.jgrid.jqID(f)).click(function(){var w=M(a.p.page,1),r=M(a.p.lastpage,1),G=false,O=true,S=true,K=true,L=true;if(r===0||r===1)L=K=S=O=false;else if(r>1&&w>=1)if(w===1)S=O=false;else{if(w===r)L=K=false}else if(r>1&&w===0){L=K=false;w=r-1}if(this.id==="first"+f&&O){a.p.page=1;G=true}if(this.id==="prev"+f&&S){a.p.page=w-1;G=true}if(this.id==="next"+f&&K){a.p.page=w+1;G=true}if(this.id==="last"+f&&L){a.p.page=r;G= -true}if(G){if(!u(this.id))return false;ka()}return false})}a.p.pginput===true&&b("input.ui-pg-input","#"+C).keypress(function(w){if((w.charCode?w.charCode:w.keyCode?w.keyCode:0)==13){a.p.page=b(this).val()>0?b(this).val():a.p.page;if(!u("user"))return false;ka();return false}return this})};var Ea=function(e,f,j,m){if(a.p.colModel[f].sortable)if(!(a.p.savedRow.length>0)){if(!j){if(a.p.lastsort==f)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[f].firstsortorder||"asc";a.p.page=1}if(m)if(a.p.lastsort==f&&a.p.sortorder==m&&!j)return;else a.p.sortorder=m;j=a.grid.headers[a.p.lastsort].el;m=a.grid.headers[f].el;b("span.ui-grid-ico-sort",j).addClass("ui-state-disabled");b(j).attr("aria-selected","false");b("span.ui-icon-"+a.p.sortorder,m).removeClass("ui-state-disabled");b(m).attr("aria-selected","true");if(!a.p.viewsortcols[0])if(a.p.lastsort!=f){b("span.s-ico",j).hide();b("span.s-ico",m).show()}e=e.substring(5+a.p.id.length+1); -a.p.sortname=a.p.colModel[f].index||e;j=a.p.sortorder;if(b.isFunction(a.p.onSortCol))if(a.p.onSortCol.call(a,e,f,j)=="stop"){a.p.lastsort=f;return}if(a.p.datatype=="local")a.p.deselectAfterSort&&b(a).jqGrid("resetSelection");else{a.p.selrow=null;a.p.multiselect&&sa(false);a.p.selarrrow=[];a.p.savedRow=[]}if(a.p.scroll){j=a.grid.bDiv.scrollLeft;D(a.grid.bDiv,true,false);a.grid.hDiv.scrollLeft=j}a.p.subGrid&&a.p.datatype=="local"&&b("td.sgexpanded","#"+b.jgrid.jqID(a.p.id)).each(function(){b(this).trigger("click")}); -ka();a.p.lastsort=f;if(a.p.sortname!=e&&f)a.p.lastsort=f}},Ia=function(e){var f,j={},m=E?0:a.p.cellLayout;for(f=j[0]=j[1]=j[2]=0;f<=e;f++)if(a.p.colModel[f].hidden===false)j[0]+=a.p.colModel[f].width+m;if(a.p.direction=="rtl")j[0]=a.p.width-j[0];j[0]-=a.grid.bDiv.scrollLeft;if(b(a.grid.cDiv).is(":visible"))j[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"))j[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)j[1]+=b(a.grid.topDiv).height()+parseInt(b(a.grid.topDiv).css("border-bottom-width"),10);j[2]+=b(a.grid.bDiv).height()+b(a.grid.hDiv).height();return j},Fa=function(e){var f,j=a.grid.headers,m=b.jgrid.getCellIndex(e);for(f=0;f");this.p.colModel.unshift({name:"cb",width:E?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);a.p.localReader=b.extend(true,{root:"rows",page:"page",total:"total",records:"records",repeatitems:false,cell:"cell",id:"id",userdata:"userdata",subgrid:{root:"rows",repeatitems:true,cell:"cell"}},a.p.localReader);if(a.p.scroll){a.p.pgbuttons=false;a.p.pginput=false;a.p.rowList=[]}a.p.data.length&&ca();var da="",Ga,na,ta,ra,ua,Y,Q,oa;na=oa="";if(a.p.shrinkToFit===true&&a.p.forceFit===true)for(k=a.p.colModel.length-1;k>=0;k--)if(!a.p.colModel[k].hidden){a.p.colModel[k].resizable= -false;break}if(a.p.viewsortcols[1]=="horizontal"){oa=" ui-i-asc";na=" ui-i-desc"}Ga=y?"class='ui-th-div-ie'":"";oa="";for(k=0;k";na=a.p.colModel[k].index||a.p.colModel[k].name;da+="
"+a.p.colNames[k];a.p.colModel[k].width=a.p.colModel[k].width?parseInt(a.p.colModel[k].width,10):150;if(typeof a.p.colModel[k].title!=="boolean")a.p.colModel[k].title=true;if(na==a.p.sortname)a.p.lastsort=k;da+=oa+"
"}da+="";oa=null; -b(this).append(da);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 Aa=[],va;b("#cb_"+b.jgrid.jqID(a.p.id),this).bind("click",function(){a.p.selarrrow=[];var e=a.p.frozenColumns===true?a.p.id+"_frozen":"";if(this.checked){b(a.rows).each(function(f){if(f>0)if(!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",true);b(this).addClass("ui-state-highlight").attr("aria-selected","true");a.p.selarrrow.push(this.id);a.p.selrow=this.id;if(e){b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+b.jgrid.jqID(this.id),a.grid.fbDiv)[a.p.useProp?"prop":"attr"]("checked",true);b("#"+b.jgrid.jqID(this.id),a.grid.fbDiv).addClass("ui-state-highlight")}}});va=true;Aa=[]}else{b(a.rows).each(function(f){if(f>0)if(!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",false);b(this).removeClass("ui-state-highlight").attr("aria-selected","false");Aa.push(this.id);if(e){b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+b.jgrid.jqID(this.id),a.grid.fbDiv)[a.p.useProp?"prop":"attr"]("checked",false);b("#"+b.jgrid.jqID(this.id),a.grid.fbDiv).removeClass("ui-state-highlight")}}});a.p.selrow=null;va=false}if(b.isFunction(a.p.onSelectAll))a.p.onSelectAll.call(a,va?a.p.selarrrow:Aa,va)})}if(a.p.autowidth=== -true){da=b(I).innerWidth();a.p.width=da>0?da:"nw"}(function(){var e=0,f=E?0:a.p.cellLayout,j=0,m,p=a.p.scrollOffset,C,s=false,A,z=0,u=0,w;b.each(a.p.colModel,function(){if(typeof this.hidden==="undefined")this.hidden=false;this.widthOrg=C=M(this.width,0);if(this.hidden===false){e+=C+f;if(this.fixed)z+=C+f;else j++;u++}});if(isNaN(a.p.width))a.p.width=h.width=e;else h.width=a.p.width;a.p.tblwidth=e;if(a.p.shrinkToFit===false&&a.p.forceFit===true)a.p.forceFit=false;if(a.p.shrinkToFit===true&&j>0){A= -h.width-f*j-z;if(!isNaN(a.p.height)){A-=p;s=true}e=0;b.each(a.p.colModel,function(r){if(this.hidden===false&&!this.fixed){this.width=C=Math.round(A*this.width/(a.p.tblwidth-f*j-z));e+=C;m=r}});w=0;if(s){if(h.width-z-(e+f*j)!==p)w=h.width-z-(e+f*j)-p}else if(!s&&Math.abs(h.width-z-(e+f*j))!==1)w=h.width-z-(e+f*j);a.p.colModel[m].width+=w;a.p.tblwidth=e+w+f*j+z;if(a.p.tblwidth>a.p.width){a.p.colModel[m].width-=a.p.tblwidth-parseInt(a.p.width,10);a.p.tblwidth=a.p.width}}})();b(I).css("width",h.width+ -"px").append("
 
");b(q).css("width",h.width+"px");da=b("thead:first",a).get(0);var wa="";if(a.p.footerrow)wa+="";q=b("tr:first",da);var xa="";a.p.disableClick=false;b("th",q).each(function(e){ta= -a.p.colModel[e].width;if(typeof a.p.colModel[e].resizable==="undefined")a.p.colModel[e].resizable=true;if(a.p.colModel[e].resizable){ra=document.createElement("span");b(ra).html(" ").addClass("ui-jqgrid-resize ui-jqgrid-resize-"+l);b.browser.opera||b(ra).css("cursor","col-resize");b(this).addClass(a.p.resizeclass)}else ra="";b(this).css("width",ta+"px").prepend(ra);var f="";if(a.p.colModel[e].hidden){b(this).css("display","none");f="display:none;"}xa+="";h.headers[e]={width:ta,el:this};ua=a.p.colModel[e].sortable;if(typeof ua!=="boolean")ua=a.p.colModel[e].sortable=true;f=a.p.colModel[e].name;f=="cb"||f=="subgrid"||f=="rn"||a.p.viewsortcols[2]&&b(">div",this).addClass("ui-jqgrid-sortable");if(ua)if(a.p.viewsortcols[0]){b("div span.s-ico",this).show();e==a.p.lastsort&&b("div span.ui-icon-"+a.p.sortorder,this).removeClass("ui-state-disabled")}else if(e==a.p.lastsort){b("div span.s-ico",this).show();b("div span.ui-icon-"+a.p.sortorder, -this).removeClass("ui-state-disabled")}if(a.p.footerrow)wa+=""}).mousedown(function(e){if(b(e.target).closest("th>span.ui-jqgrid-resize").length==1){var f=Fa(this);if(a.p.forceFit===true){var j=a.p,m=f,p;for(p=f+1;p
 
").append(da);var ea=a.p.caption&&a.p.hiddengrid===true?true:false;k=b("
");da=null;h.hDiv=document.createElement("div");b(h.hDiv).css({width:h.width+"px"}).addClass("ui-state-default ui-jqgrid-hdiv").append(k);b(k).append(q);q=null;ea&&b(h.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:h.width+"px"}).appendTo(I).addClass("ui-state-default ui-jqgrid-pager ui-corner-bottom");ea&&b(a.p.pager).hide();x(a.p.pager,"")}a.p.cellEdit===false&&a.p.hoverrows===true&&b(a).bind("mouseover",function(e){Q=b(e.target).closest("tr.jqgrow");b(Q).attr("class")!=="ui-subgrid"&&b(Q).addClass("ui-state-hover")}).bind("mouseout",function(e){Q=b(e.target).closest("tr.jqgrow");b(Q).removeClass("ui-state-hover")});var la,ma;b(a).before(h.hDiv).click(function(e){Y=e.target;Q=b(Y,a.rows).closest("tr.jqgrow"); -if(b(Q).length===0||Q[0].className.indexOf("ui-state-disabled")>-1||b(Y,a).closest("table.ui-jqgrid-btable")[0].id.replace("_frozen","")!==a.id)return this;var f=b(Y).hasClass("cbox"),j=true;if(b.isFunction(a.p.beforeSelectRow))j=a.p.beforeSelectRow.call(a,Q[0].id,e);if(Y.tagName=="A"||(Y.tagName=="INPUT"||Y.tagName=="TEXTAREA"||Y.tagName=="OPTION"||Y.tagName=="SELECT")&&!f)return this;if(j===true){if(a.p.cellEdit===true)if(a.p.multiselect&&f)b(a).jqGrid("setSelection",Q[0].id,true);else{la=Q[0].rowIndex; -ma=b.jgrid.getCellIndex(Y);try{b(a).jqGrid("editCell",la,ma,true)}catch(m){}}else if(a.p.multikey)if(e[a.p.multikey])b(a).jqGrid("setSelection",Q[0].id,true);else{if(a.p.multiselect&&f){f=b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+Q[0].id).is(":checked");b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+Q[0].id)[a.p.useProp?"prop":"attr"]("checked",f)}}else{if(a.p.multiselect&&a.p.multiboxonly)if(!f){var p=a.p.frozenColumns?a.p.id+"_frozen":"";b(a.p.selarrrow).each(function(C,s){var A=a.rows.namedItem(s);b(A).removeClass("ui-state-highlight"); -b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+b.jgrid.jqID(s))[a.p.useProp?"prop":"attr"]("checked",false);if(p){b("#"+b.jgrid.jqID(s),"#"+b.jgrid.jqID(p)).removeClass("ui-state-highlight");b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+b.jgrid.jqID(s),"#"+b.jgrid.jqID(p))[a.p.useProp?"prop":"attr"]("checked",false)}});a.p.selarrrow=[]}b(a).jqGrid("setSelection",Q[0].id,true)}if(b.isFunction(a.p.onCellSelect)){la=Q[0].id;ma=b.jgrid.getCellIndex(Y);a.p.onCellSelect.call(a,la,ma,b(Y).html(),e)}}return this}).bind("reloadGrid", -function(e,f){if(a.p.treeGrid===true)a.p.datatype=a.p.treedatatype;f&&f.current&&a.grid.selectionPreserver(a);if(a.p.datatype=="local"){b(a).jqGrid("resetSelection");a.p.data.length&&ca()}else if(!a.p.treeGrid){a.p.selrow=null;if(a.p.multiselect){a.p.selarrrow=[];sa(false)}a.p.savedRow=[]}a.p.scroll&&D(a.grid.bDiv,true,false);if(f&&f.page){var j=f.page;if(j>a.p.lastpage)j=a.p.lastpage;if(j<1)j=1;a.p.page=j;a.grid.bDiv.scrollTop=a.grid.prevRowHeight?(j-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(e){Y=e.target;Q=b(Y,a.rows).closest("tr.jqgrow");if(b(Q).length===0)return false;la=Q[0].rowIndex;ma=b.jgrid.getCellIndex(Y);a.p.ondblClickRow.call(a,b(Q).attr("id"),la,ma,e);return false});b.isFunction(this.p.onRightClickRow)&&b(this).bind("contextmenu",function(e){Y=e.target;Q=b(Y,a.rows).closest("tr.jqgrow");if(b(Q).length===0)return false; -a.p.multiselect||b(a).jqGrid("setSelection",Q[0].id,true);la=Q[0].rowIndex;ma=b.jgrid.getCellIndex(Y);a.p.onRightClickRow.call(a,b(Q).attr("id"),la,ma,e);return false});h.bDiv=document.createElement("div");if(y)if(String(a.p.height).toLowerCase()==="auto")a.p.height="100%";b(h.bDiv).append(b('
').append("
").append(this)).addClass("ui-jqgrid-bdiv").css({height:a.p.height+(isNaN(a.p.height)?"":"px"),width:h.width+ -"px"}).scroll(h.scrollGrid);b("table:first",h.bDiv).css({width:a.p.tblwidth+"px"});if(y){b("tbody",this).size()==2&&b("tbody:gt(0)",this).remove();a.p.multikey&&b(h.bDiv).bind("selectstart",function(){return false})}else a.p.multikey&&b(h.bDiv).bind("mousedown",function(){return false});ea&&b(h.bDiv).hide();h.cDiv=document.createElement("div");var Ba=a.p.hidegrid===true?b("").addClass("ui-jqgrid-titlebar-close HeaderButton").hover(function(){Ba.addClass("ui-state-hover")}, -function(){Ba.removeClass("ui-state-hover")}).append("").css(l=="rtl"?"left":"right","0px"):"";b(h.cDiv).append(Ba).append(""+a.p.caption+"").addClass("ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix");b(h.cDiv).insertBefore(h.hDiv);if(a.p.toolbar[0]){h.uDiv=document.createElement("div");if(a.p.toolbar[1]=="top")b(h.uDiv).insertBefore(h.hDiv);else a.p.toolbar[1]== -"bottom"&&b(h.uDiv).insertAfter(h.hDiv);if(a.p.toolbar[1]=="both"){h.ubDiv=document.createElement("div");b(h.uDiv).insertBefore(h.hDiv).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);b(h.ubDiv).insertAfter(h.hDiv).addClass("ui-userdata ui-state-default").attr("id","tb_"+this.id);ea&&b(h.ubDiv).hide()}else b(h.uDiv).width(h.width).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);ea&&b(h.uDiv).hide()}if(a.p.toppager){a.p.toppager=b.jgrid.jqID(a.p.id)+"_toppager";h.topDiv= -b("
")[0];a.p.toppager="#"+a.p.toppager;b(h.topDiv).insertBefore(h.hDiv).addClass("ui-state-default ui-jqgrid-toppager").width(h.width);x(a.p.toppager,"_t")}if(a.p.footerrow){h.sDiv=b("
")[0];k=b("
");b(h.sDiv).append(k).insertAfter(h.hDiv).width(h.width);b(k).append(wa);h.footers=b(".ui-jqgrid-ftable",h.sDiv)[0].rows[0].cells;if(a.p.rownumbers)h.footers[0].className="ui-state-default jqgrid-rownum"; -ea&&b(h.sDiv).hide()}k=null;if(a.p.caption){var Ja=a.p.datatype;if(a.p.hidegrid===true){b(".ui-jqgrid-titlebar-close",h.cDiv).click(function(e){var f=b.isFunction(a.p.onHeaderClick),j=".ui-jqgrid-bdiv, .ui-jqgrid-hdiv, .ui-jqgrid-pager, .ui-jqgrid-sdiv",m,p=this;if(a.p.toolbar[0]===true){if(a.p.toolbar[1]=="both")j+=", #"+b(h.ubDiv).attr("id");j+=", #"+b(h.uDiv).attr("id")}m=b(j,"#gview_"+b.jgrid.jqID(a.p.id)).length;if(a.p.gridstate=="visible")b(j,"#gbox_"+b.jgrid.jqID(a.p.id)).slideUp("fast",function(){m--; -if(m===0){b("span",p).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();if(f)ea||a.p.onHeaderClick.call(a,a.p.gridstate,e)}});else a.p.gridstate=="hidden"&&b(j,"#gbox_"+b.jgrid.jqID(a.p.id)).slideDown("fast",function(){m--;if(m===0){b("span",p).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");if(ea){a.p.datatype= -Ja;ka();ea=false}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();if(f)ea||a.p.onHeaderClick.call(a,a.p.gridstate,e)}});return false});if(ea){a.p.datatype="local";b(".ui-jqgrid-titlebar-close",h.cDiv).trigger("click")}}}else b(h.cDiv).hide();b(h.hDiv).after(h.bDiv).mousemove(function(e){if(h.resizing){h.dragMove(e);return false}});b(".ui-jqgrid-labels",h.hDiv).bind("selectstart",function(){return false}); -b(document).mouseup(function(){if(h.resizing){h.dragEnd();return false}return true});a.formatCol=N;a.sortData=Ea;a.updatepager=function(e,f){var j,m,p,C,s,A,z,u="",w=a.p.pager?"_"+b.jgrid.jqID(a.p.pager.substr(1)):"",r=a.p.toppager?"_"+a.p.toppager.substr(1):"";p=parseInt(a.p.page,10)-1;if(p<0)p=0;p*=parseInt(a.p.rowNum,10);s=p+a.p.reccount;if(a.p.scroll){j=b("tbody:first > tr:gt(0)",a.grid.bDiv);p=s-j.length;a.p.reccount=j.length;if(m=j.outerHeight()||a.grid.prevRowHeight){j=p*m;m*=parseInt(a.p.records, -10);b(">div:first",a.grid.bDiv).css({height:m}).children("div:first").css({height:j,display:j?"":"none"})}a.grid.bDiv.scrollLeft=a.grid.hDiv.scrollLeft}u=a.p.pager?a.p.pager:"";u+=a.p.toppager?u?","+a.p.toppager:a.p.toppager:"";if(u){z=b.jgrid.formatter.integer||{};j=M(a.p.page);m=M(a.p.lastpage);b(".selbox",u)[this.p.useProp?"prop":"attr"]("disabled",false);if(a.p.pginput===true){b(".ui-pg-input",u).val(a.p.page);C=a.p.toppager?"#sp_1"+w+",#sp_1"+r:"#sp_1"+w;b(C).html(b.fmatter?b.fmatter.util.NumberFormat(a.p.lastpage, -z):a.p.lastpage)}if(a.p.viewrecords)if(a.p.reccount===0)b(".ui-paging-info",u).html(a.p.emptyrecords);else{C=p+1;A=a.p.records;if(b.fmatter){C=b.fmatter.util.NumberFormat(C,z);s=b.fmatter.util.NumberFormat(s,z);A=b.fmatter.util.NumberFormat(A,z)}b(".ui-paging-info",u).html(b.jgrid.format(a.p.recordtext,C,s,A))}if(a.p.pgbuttons===true){if(j<=0)j=m=0;if(j==1||j===0){b("#first"+w+", #prev"+w).addClass("ui-state-disabled").removeClass("ui-state-hover");a.p.toppager&&b("#first_t"+r+", #prev_t"+r).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{b("#first"+ -w+", #prev"+w).removeClass("ui-state-disabled");a.p.toppager&&b("#first_t"+r+", #prev_t"+r).removeClass("ui-state-disabled")}if(j==m||j===0){b("#next"+w+", #last"+w).addClass("ui-state-disabled").removeClass("ui-state-hover");a.p.toppager&&b("#next_t"+r+", #last_t"+r).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{b("#next"+w+", #last"+w).removeClass("ui-state-disabled");a.p.toppager&&b("#next_t"+r+", #last_t"+r).removeClass("ui-state-disabled")}}}e===true&&a.p.rownumbers===true&& -b("td.jqgrid-rownum",a.rows).each(function(G){b(this).html(p+1+G)});f&&a.p.jqgdnd&&b(a).jqGrid("gridDnD","updateDnD");b.isFunction(a.p.gridComplete)&&a.p.gridComplete.call(a);b.isFunction(a.p._complete)&&a.p._complete.call(a)};a.refreshIndex=ca;a.setHeadCheckBox=sa;a.formatter=function(e,f,j,m,p){return o(e,f,j,m,p)};b.extend(h,{populate:ka,emptyRows:D});this.grid=h;a.addXmlData=function(e){X(e,a.grid.bDiv)};a.addJSONData=function(e){fa(e,a.grid.bDiv)};this.grid.cols=this.rows[0].cells;ka();a.p.hiddengrid= -false;b(window).unload(function(){a=null})}}}})};b.jgrid.extend({getGridParam:function(d){var i=this[0];if(i&&i.grid)return d?typeof i.p[d]!="undefined"?i.p[d]:null:i.p},setGridParam:function(d){return this.each(function(){this.grid&&typeof d==="object"&&b.extend(true,this.p,d)})},getDataIDs:function(){var d=[],i=0,g,c=0;this.each(function(){if((g=this.rows.length)&&g>0)for(;i=y+E)b(c.grid.bDiv)[0].scrollTop=I-(y+E)+x+E;else if(I-1)){if(c.p.scrollrows===true){h=c.rows.namedItem(d).rowIndex;h>=0&&g(h)}if(c.p.frozenColumns===true)q=c.p.id+"_frozen";if(c.p.multiselect){c.setHeadCheckBox(false); -c.p.selrow=k.id;l=b.inArray(c.p.selrow,c.p.selarrrow);if(l===-1){k.className!=="ui-subgrid"&&b(k).addClass("ui-state-highlight").attr("aria-selected","true");h=true;b("#jqg_"+b.jgrid.jqID(c.p.id)+"_"+b.jgrid.jqID(c.p.selrow))[c.p.useProp?"prop":"attr"]("checked",h);c.p.selarrrow.push(c.p.selrow)}else{k.className!=="ui-subgrid"&&b(k).removeClass("ui-state-highlight").attr("aria-selected","false");h=false;b("#jqg_"+b.jgrid.jqID(c.p.id)+"_"+b.jgrid.jqID(c.p.selrow))[c.p.useProp?"prop":"attr"]("checked", -h);c.p.selarrrow.splice(l,1);a=c.p.selarrrow[0];c.p.selrow=a===undefined?null:a}if(q){l===-1?b("#"+b.jgrid.jqID(d),"#"+b.jgrid.jqID(q)).addClass("ui-state-highlight"):b("#"+b.jgrid.jqID(d),"#"+b.jgrid.jqID(q)).removeClass("ui-state-highlight");b("#jqg_"+b.jgrid.jqID(c.p.id)+"_"+b.jgrid.jqID(d),"#"+b.jgrid.jqID(q))[c.p.useProp?"prop":"attr"]("checked",h)}c.p.onSelectRow&&i&&c.p.onSelectRow.call(c,k.id,h)}else if(k.className!=="ui-subgrid"){if(c.p.selrow!=k.id){b(c.rows.namedItem(c.p.selrow)).removeClass("ui-state-highlight").attr({"aria-selected":"false", -tabindex:"-1"});b(k).addClass("ui-state-highlight").attr({"aria-selected":"true",tabindex:"0"});if(q){b("#"+b.jgrid.jqID(c.p.selrow),"#"+b.jgrid.jqID(q)).removeClass("ui-state-highlight");b("#"+b.jgrid.jqID(d),"#"+b.jgrid.jqID(q)).addClass("ui-state-highlight")}h=true}else h=false;c.p.selrow=k.id;c.p.onSelectRow&&i&&c.p.onSelectRow.call(c,k.id,h)}}}})},resetSelection:function(d){return this.each(function(){var i=this,g,c;if(typeof d!=="undefined"){c=d===i.p.selrow?i.p.selrow:d;b("#"+b.jgrid.jqID(i.p.id)+ -" tbody:first tr#"+b.jgrid.jqID(c)).removeClass("ui-state-highlight").attr("aria-selected","false");if(i.p.multiselect){b("#jqg_"+b.jgrid.jqID(i.p.id)+"_"+b.jgrid.jqID(c))[i.p.useProp?"prop":"attr"]("checked",false);i.setHeadCheckBox(false)}c=null}else if(i.p.multiselect){b(i.p.selarrrow).each(function(h,k){g=i.rows.namedItem(k);b(g).removeClass("ui-state-highlight").attr("aria-selected","false");b("#jqg_"+b.jgrid.jqID(i.p.id)+"_"+b.jgrid.jqID(k))[i.p.useProp?"prop":"attr"]("checked",false)});i.setHeadCheckBox(false); -i.p.selarrrow=[]}else if(i.p.selrow){b("#"+b.jgrid.jqID(i.p.id)+" tbody:first tr#"+b.jgrid.jqID(i.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected","false");i.p.selrow=null}if(i.p.cellEdit===true)if(parseInt(i.p.iCol,10)>=0&&parseInt(i.p.iRow,10)>=0){b("td:eq("+i.p.iCol+")",i.rows[i.p.iRow]).removeClass("edit-cell ui-state-highlight");b(i.rows[i.p.iRow]).removeClass("selected-row ui-state-hover")}i.p.savedRow=[]})},getRowData:function(d){var i={},g,c=false,h,k=0;this.each(function(){var l= -this,a,q;if(typeof d=="undefined"){c=true;g=[];h=l.rows.length}else{q=l.rows.namedItem(d);if(!q)return i;h=2}for(;k span:first",q).html(a).attr(k):b("td:eq("+N+")",q).html(a).attr(k)}});if(l.p.datatype=="local"){var E=l.p._index[d];if(l.p.treeGrid)for(var I in l.p.treeReader)y.hasOwnProperty(l.p.treeReader[I])&&delete y[l.p.treeReader[I]];if(typeof E!="undefined")l.p.data[E]=b.extend(true,l.p.data[E],y);y=null}}catch(M){h=false}if(h){if(x==="string")b(q).addClass(g);else x==="object"&&b(q).css(g);b.isFunction(l.p._complete)&&l.p._complete.call(l)}}); -return h},addRowData:function(d,i,g,c){g||(g="last");var h=false,k,l,a,q,x,y,E,I,M="",N,V,o,n,t;if(i){if(b.isArray(i)){N=true;g="last";V=d}else{i=[i];N=false}this.each(function(){var F=i.length;x=this.p.rownumbers===true?1:0;a=this.p.multiselect===true?1:0;q=this.p.subGrid===true?1:0;if(!N)if(typeof d!="undefined")d+="";else{d=b.jgrid.randId();if(this.p.keyIndex!==false){V=this.p.colModel[this.p.keyIndex+a+q+x].name;if(typeof i[0][V]!="undefined")d=i[0][V]}}o=this.p.altclass;for(var T=0,J="",D={}, -ca=b.isFunction(this.p.afterInsertRow)?true:false;T0"}if(a){I='';M=this.formatCol(x,1,"",null,d,true);l+='"+I+""}if(q)l+=b(this).jqGrid("addSubGridCell",a+x,1);for(E=a+q+x;E"+I+""}l=''+l+"";if(this.rows.length===0)b("table:first",this.grid.bDiv).append(l);else switch(g){case "last":b(this.rows[this.rows.length-1]).after(l);y=this.rows.length-1;break;case "first":b(this.rows[0]).after(l);y=1;break;case "after":if(y=this.rows.namedItem(c))b(this.rows[y.rowIndex+1]).hasClass("ui-subgrid")?b(this.rows[y.rowIndex+1]).after(l):b(y).after(l);y++;break;case "before":if(y=this.rows.namedItem(c)){b(y).before(l);y=y.rowIndex}y--}this.p.subGrid===true&&b(this).jqGrid("addSubGrid", -a+x,y);this.p.records++;this.p.reccount++;ca&&this.p.afterInsertRow.call(this,d,n,n);T++;if(this.p.datatype=="local"){D[this.p.localReader.id]=d;this.p._index[d]=this.p.data.length;this.p.data.push(D);D={}}}if(this.p.altRows===true&&!N)if(g=="last")(this.rows.length-1)%2==1&&b(this.rows[this.rows.length-1]).addClass(o);else b(this.rows).each(function(fa){fa%2==1?b(this).addClass(o):b(this).removeClass(o)});this.updatepager(true,true);h=true})}return h},footerData:function(d,i,g){function c(q){for(var x in q)if(q.hasOwnProperty(x))return false; -return true}var h,k=false,l={},a;if(typeof d=="undefined")d="get";if(typeof g!="boolean")g=true;d=d.toLowerCase();this.each(function(){var q=this,x;if(!q.grid||!q.p.footerrow)return false;if(d=="set")if(c(i))return false;k=true;b(this.p.colModel).each(function(y){h=this.name;if(d=="set"){if(i[h]!==undefined){x=g?q.formatter("",i[h],y,i,"edit"):i[h];a=this.title?{title:b.jgrid.stripHtml(x)}:{};b("tr.footrow td:eq("+y+")",q.grid.sDiv).html(x).attr(a);k=true}}else if(d=="get")l[h]=b("tr.footrow td:eq("+ -y+")",q.grid.sDiv).html()})});return d=="get"?l:k},showHideCol:function(d,i){return this.each(function(){var g=this,c=false,h=b.browser.webkit||b.browser.safari?0:g.p.cellLayout,k;if(g.grid){if(typeof d==="string")d=[d];i=i!="none"?"":"none";var l=i===""?true:false,a=g.p.groupHeader&&(typeof g.p.groupHeader==="object"||b.isFunction(g.p.groupHeader));a&&b(g).jqGrid("destroyGroupHeader",false);b(this.p.colModel).each(function(q){if(b.inArray(this.name,d)!==-1&&this.hidden===l){if(g.p.frozenColumns=== -true&&this.frozen===true)return true;b("tr",g.grid.hDiv).each(function(){b(this.cells[q]).css("display",i)});b(g.rows).each(function(){b(this.cells[q]).css("display",i)});g.p.footerrow&&b("tr.footrow td:eq("+q+")",g.grid.sDiv).css("display",i);k=this.widthOrg?this.widthOrg:parseInt(this.width,10);if(i==="none")g.p.tblwidth-=k+h;else g.p.tblwidth+=k+h;this.hidden=!l;c=true}});if(c===true)b(g).jqGrid("setGridWidth",g.p.shrinkToFit===true?g.p.tblwidth:g.p.width);a&&b(g).jqGrid("setGroupHeaders",g.p.groupHeader)}})}, -hideCol:function(d){return this.each(function(){b(this).jqGrid("showHideCol",d,"none")})},showCol:function(d){return this.each(function(){b(this).jqGrid("showHideCol",d,"")})},remapColumns:function(d,i,g){function c(l){var a;a=l.length?b.makeArray(l):b.extend({},l);b.each(d,function(q){l[q]=a[this]})}function h(l,a){b(">tr"+(a||""),l).each(function(){var q=this,x=b.makeArray(q.cells);b.each(d,function(){var y=x[this];y&&q.appendChild(y)})})}var k=this.get(0);c(k.p.colModel);c(k.p.colNames);c(k.grid.headers); -h(b("thead:first",k.grid.hDiv),g&&":not(.ui-jqgrid-labels)");i&&h(b("#"+b.jgrid.jqID(k.p.id)+" tbody:first"),".jqgfirstrow, tr.jqgrow, tr.jqfoot");k.p.footerrow&&h(b("tbody:first",k.grid.sDiv));if(k.p.remapColumns)if(k.p.remapColumns.length)c(k.p.remapColumns);else k.p.remapColumns=b.makeArray(d);k.p.lastsort=b.inArray(k.p.lastsort,d);if(k.p.treeGrid)k.p.expColInd=b.inArray(k.p.expColInd,d)},setGridWidth:function(d,i){return this.each(function(){if(this.grid){var g=this,c,h=0,k=b.browser.webkit|| -b.browser.safari?0:g.p.cellLayout,l,a=0,q=false,x=g.p.scrollOffset,y,E=0,I=0,M;if(typeof i!="boolean")i=g.p.shrinkToFit;if(!isNaN(d)){d=parseInt(d,10);g.grid.width=g.p.width=d;b("#gbox_"+b.jgrid.jqID(g.p.id)).css("width",d+"px");b("#gview_"+b.jgrid.jqID(g.p.id)).css("width",d+"px");b(g.grid.bDiv).css("width",d+"px");b(g.grid.hDiv).css("width",d+"px");g.p.pager&&b(g.p.pager).css("width",d+"px");g.p.toppager&&b(g.p.toppager).css("width",d+"px");if(g.p.toolbar[0]===true){b(g.grid.uDiv).css("width",d+ -"px");g.p.toolbar[1]=="both"&&b(g.grid.ubDiv).css("width",d+"px")}g.p.footerrow&&b(g.grid.sDiv).css("width",d+"px");if(i===false&&g.p.forceFit===true)g.p.forceFit=false;if(i===true){b.each(g.p.colModel,function(){if(this.hidden===false){c=this.widthOrg?this.widthOrg:parseInt(this.width,10);h+=c+k;if(this.fixed)E+=c+k;else a++;I++}});if(a===0)return;g.p.tblwidth=h;y=d-k*a-E;if(!isNaN(g.p.height))if(b(g.grid.bDiv)[0].clientHeight0;b.each(g.p.colModel,function(V){if(this.hidden===false&&!this.fixed){c=this.widthOrg?this.widthOrg:parseInt(this.width,10);c=Math.round(y*c/(g.p.tblwidth-k*a-E));if(!(c<0)){this.width=c;h+=c;g.grid.headers[V].width=c;g.grid.headers[V].el.style.width=c+"px";if(g.p.footerrow)g.grid.footers[V].style.width=c+"px";if(N)g.grid.cols[V].style.width=c+"px";l=V}}});if(!l)return;M=0;if(q){if(d-E-(h+k*a)!==x)M=d-E-(h+k*a)-x}else if(Math.abs(d-E-(h+k*a))!==1)M=d-E-(h+k*a);g.p.colModel[l].width+= -M;g.p.tblwidth=h+M+k*a+E;if(g.p.tblwidth>d){q=g.p.tblwidth-parseInt(d,10);g.p.tblwidth=d;c=g.p.colModel[l].width-=q}else c=g.p.colModel[l].width;g.grid.headers[l].width=c;g.grid.headers[l].el.style.width=c+"px";if(N)g.grid.cols[l].style.width=c+"px";if(g.p.footerrow)g.grid.footers[l].style.width=c+"px"}if(g.p.tblwidth){b("table:first",g.grid.bDiv).css("width",g.p.tblwidth+"px");b("table:first",g.grid.hDiv).css("width",g.p.tblwidth+"px");g.grid.hDiv.scrollLeft=g.grid.bDiv.scrollLeft;g.p.footerrow&& -b("table:first",g.grid.sDiv).css("width",g.p.tblwidth+"px")}}}})},setGridHeight:function(d){return this.each(function(){if(this.grid){var i=b(this.grid.bDiv);i.css({height:d+(isNaN(d)?"":"px")});this.p.frozenColumns===true&&b("#"+this.p.id+"_frozen").parent().height(i.height()-16);this.p.height=d;this.p.scroll&&this.grid.populateVisible()}})},setCaption:function(d){return this.each(function(){this.p.caption=d;b("span.ui-jqgrid-title, span.ui-jqgrid-title-rtl",this.grid.cDiv).html(d);b(this.grid.cDiv).show()})}, -setLabel:function(d,i,g,c){return this.each(function(){var h=-1;if(this.grid)if(typeof d!="undefined"){b(this.p.colModel).each(function(a){if(this.name==d){h=a;return false}});if(h>=0){var k=b("tr.ui-jqgrid-labels th:eq("+h+")",this.grid.hDiv);if(i){var l=b(".s-ico",k);b("[id^=jqgh_]",k).empty().html(i).append(l);this.p.colNames[h]=i}if(g)typeof g==="string"?b(k).addClass(g):b(k).css(g);typeof c==="object"&&b(k).attr(c)}}})},setCell:function(d,i,g,c,h,k){return this.each(function(){var l=-1,a,q;if(this.grid){if(isNaN(i))b(this.p.colModel).each(function(y){if(this.name== -i){l=y;return false}});else l=parseInt(i,10);if(l>=0)if(a=this.rows.namedItem(d)){var x=b("td:eq("+l+")",a);if(g!==""||k===true){a=this.formatter(d,g,l,a,"edit");q=this.p.colModel[l].title?{title:b.jgrid.stripHtml(a)}:{};this.p.treeGrid&&b(".tree-wrap",b(x)).length>0?b("span",b(x)).html(a).attr(q):b(x).html(a).attr(q);if(this.p.datatype=="local"){a=this.p.colModel[l];g=a.formatter&&typeof a.formatter==="string"&&a.formatter=="date"?b.unformat.date(g,a):g;q=this.p._index[d];if(typeof q!="undefined")this.p.data[q][a.name]= -g}}if(typeof c==="string")b(x).addClass(c);else c&&b(x).css(c);typeof h==="object"&&b(x).attr(h)}}})},getCell:function(d,i){var g=false;this.each(function(){var c=-1;if(this.grid){if(isNaN(i))b(this.p.colModel).each(function(l){if(this.name===i){c=l;return false}});else c=parseInt(i,10);if(c>=0){var h=this.rows.namedItem(d);if(h)try{g=b.unformat(b("td:eq("+c+")",h),{rowId:h.id,colModel:this.p.colModel[c]},c)}catch(k){g=b.jgrid.htmlDecode(b("td:eq("+c+")",h).html())}}}});return g},getCol:function(d, -i,g){var c=[],h,k=0,l,a,q;i=typeof i!="boolean"?false:i;if(typeof g=="undefined")g=false;this.each(function(){var x=-1;if(this.grid){if(isNaN(d))b(this.p.colModel).each(function(M){if(this.name===d){x=M;return false}});else x=parseInt(d,10);if(x>=0){var y=this.rows.length,E=0;if(y&&y>0){for(;E=0)i=this.p.data[g]}});return i}})})(jQuery); -(function(b){b.fmatter={};b.extend(b.fmatter,{isBoolean:function(a){return typeof a==="boolean"},isObject:function(a){return a&&(typeof a==="object"||b.isFunction(a))||false},isString:function(a){return typeof a==="string"},isNumber:function(a){return typeof a==="number"&&isFinite(a)},isNull:function(a){return a===null},isUndefined:function(a){return typeof a==="undefined"},isValue:function(a){return this.isObject(a)||this.isString(a)||this.isNumber(a)||this.isBoolean(a)},isEmpty:function(a){if(!this.isString(a)&& -this.isValue(a))return false;else if(!this.isValue(a))return true;a=b.trim(a).replace(/\ \;/ig,"").replace(/\ \;/ig,"");return a===""}});b.fn.fmatter=function(a,c,d,f,g){var e=c;d=b.extend({},b.jgrid.formatter,d);if(b.fn.fmatter[a])e=b.fn.fmatter[a](c,d,f,g);return e};b.fmatter.util={NumberFormat:function(a,c){b.fmatter.isNumber(a)||(a*=1);if(b.fmatter.isNumber(a)){var d=a<0,f=a+"",g=c.decimalSeparator?c.decimalSeparator:".",e;if(b.fmatter.isNumber(c.decimalPlaces)){var h=c.decimalPlaces; -f=Math.pow(10,h);f=Math.round(a*f)/f+"";e=f.lastIndexOf(".");if(h>0){if(e<0){f+=g;e=f.length-1}else if(g!==".")f=f.replace(".",g);for(;f.length-1-e-1?e:f.length;g=f.substring(e);for(var i=-1,j=e;j>0;j--){i++;if(i%3===0&&j!==e&&(!d||j>1))g=h+g;g=f.charAt(j-1)+g}f=g}f=c.prefix?c.prefix+f:f;return f=c.suffix?f+c.suffix:f}else return a},DateFormat:function(a,c,d,f){var g=/^\/Date\((([-+])?[0-9]+)(([-+])([0-9]{2})([0-9]{2}))?\)\/$/, -e=typeof c==="string"?c.match(g):null;g=function(m,r){m=String(m);for(r=parseInt(r,10)||2;m.length11)c[e]=i+1-12}if(c[e])h[a[e].toLowerCase()]=parseInt(c[e],10)}if(h.f)h.m=h.f;if(h.m===0&&h.y===0&&h.d===0)return" ";h.m=parseInt(h.m,10)-1;i=h.y;if(i>=70&&i<=99)h.y=1900+h.y;else if(i>=0&&i<=69)h.y=2E3+h.y;i=new Date(h.y,h.m,h.d,h.h,h.i,h.s,h.u)}if(d in -f.masks)d=f.masks[d];else d||(d="Y-m-d");a=i.getHours();c=i.getMinutes();h=i.getDate();e=i.getMonth()+1;j=i.getTimezoneOffset();var l=i.getSeconds(),n=i.getMilliseconds(),o=i.getDay(),p=i.getFullYear(),q=(o+6)%7+1,s=(new Date(p,e-1,h)-new Date(p,0,1))/864E5,t={d:g(h),D:k.i18n.dayNames[o],j:h,l:k.i18n.dayNames[o+7],N:q,S:f.S(h),w:o,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:k.i18n.monthNames[e-1+12],m:g(e),M:k.i18n.monthNames[e-1],n:e,t:"?", -L:"?",o:"?",Y:p,y:String(p).substring(2),a:a<12?f.AmPm[0]:f.AmPm[1],A:a<12?f.AmPm[2]:f.AmPm[3],B:"?",g:a%12||12,G:a,h:g(a%12||12),H:g(a),i:g(c),s:g(l),u:n,e:"?",I:"?",O:(j>0?"-":"+")+g(Math.floor(Math.abs(j)/60)*100+Math.abs(j)%60,4),P:"?",T:(String(i).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(i/1E3)};return d.replace(/\\.|[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/g, -function(m){return m in t?t[m]:m.substring(1)})}};b.fn.fmatter.defaultFormat=function(a,c){return b.fmatter.isValue(a)&&a!==""?a:c.defaultValue?c.defaultValue:" "};b.fn.fmatter.email=function(a,c){return b.fmatter.isEmpty(a)?b.fn.fmatter.defaultFormat(a,c):'
'+a+""};b.fn.fmatter.checkbox=function(a,c){var d=b.extend({},c.checkbox),f;b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend({},d,c.colModel.formatoptions));f=d.disabled===true?'disabled="disabled"': -"";if(b.fmatter.isEmpty(a)||b.fmatter.isUndefined(a))a=b.fn.fmatter.defaultFormat(a,d);a+="";a=a.toLowerCase();return'"};b.fn.fmatter.link=function(a,c){var d={target:c.target},f="";b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend({},d,c.colModel.formatoptions));if(d.target)f="target="+d.target;return b.fmatter.isEmpty(a)?b.fn.fmatter.defaultFormat(a,c):"'+a+""};b.fn.fmatter.showlink=function(a,c){var d={baseLinkUrl:c.baseLinkUrl,showAction:c.showAction,addParam:c.addParam||"",target:c.target,idName:c.idName},f="";b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend({},d,c.colModel.formatoptions));if(d.target)f="target="+d.target;d=d.baseLinkUrl+d.showAction+"?"+d.idName+"="+c.rowId+d.addParam;return b.fmatter.isString(a)||b.fmatter.isNumber(a)?"'+a+"":b.fn.fmatter.defaultFormat(a,c)};b.fn.fmatter.integer= -function(a,c){var d=b.extend({},c.integer);b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend({},d,c.colModel.formatoptions));if(b.fmatter.isEmpty(a))return d.defaultValue;return b.fmatter.util.NumberFormat(a,d)};b.fn.fmatter.number=function(a,c){var d=b.extend({},c.number);b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend({},d,c.colModel.formatoptions));if(b.fmatter.isEmpty(a))return d.defaultValue;return b.fmatter.util.NumberFormat(a,d)};b.fn.fmatter.currency=function(a,c){var d= -b.extend({},c.currency);b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend({},d,c.colModel.formatoptions));if(b.fmatter.isEmpty(a))return d.defaultValue;return b.fmatter.util.NumberFormat(a,d)};b.fn.fmatter.date=function(a,c,d,f){d=b.extend({},c.date);b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend({},d,c.colModel.formatoptions));return!d.reformatAfterEdit&&f=="edit"?b.fn.fmatter.defaultFormat(a,c):b.fmatter.isEmpty(a)?b.fn.fmatter.defaultFormat(a,c):b.fmatter.util.DateFormat(d.srcformat, -a,d.newformat,d)};b.fn.fmatter.select=function(a,c){a+="";var d=false,f=[],g;if(b.fmatter.isUndefined(c.colModel.formatoptions)){if(!b.fmatter.isUndefined(c.colModel.editoptions)){d=c.colModel.editoptions.value;g=c.colModel.editoptions.separator===undefined?":":c.colModel.editoptions.separator}}else{d=c.colModel.formatoptions.value;g=c.colModel.formatoptions.separator===undefined?":":c.colModel.formatoptions.separator}if(d){var e=c.colModel.editoptions.multiple===true?true:false,h=[],i;if(e){h=a.split(","); -h=b.map(h,function(n){return b.trim(n)})}if(b.fmatter.isString(d))for(var j=d.split(";"),k=0,l=0;l2)i[1]=jQuery.map(i,function(n,o){if(o>0)return n}).join(":");if(e){if(jQuery.inArray(i[0],h)>-1){f[k]=i[1];k++}}else if(b.trim(i[0])==b.trim(a)){f[0]=i[1];break}}else if(b.fmatter.isObject(d))if(e)f=jQuery.map(h,function(n){return d[n]});else f[0]=d[a]||""}a=f.join(", ");return a===""?b.fn.fmatter.defaultFormat(a,c):a};b.fn.fmatter.rowactions=function(a,c,d, -f){var g={keys:false,onEdit:null,onSuccess:null,afterSave:null,onError:null,afterRestore:null,extraparam:{},url:null,delOptions:{},editOptions:{}};a=b.jgrid.jqID(a);c=b.jgrid.jqID(c);f=b("#"+c)[0].p.colModel[f];b.fmatter.isUndefined(f.formatoptions)||(g=b.extend(g,f.formatoptions));if(!b.fmatter.isUndefined(b("#"+c)[0].p.editOptions))g.editOptions=b("#"+c)[0].p.editOptions;if(!b.fmatter.isUndefined(b("#"+c)[0].p.delOptions))g.delOptions=b("#"+c)[0].p.delOptions;var e=b("#"+c)[0];f=function(j,k){g.afterSave&& -g.afterSave.call(e,j,k);b("tr#"+a+" div.ui-inline-edit, tr#"+a+" div.ui-inline-del","#"+c+".ui-jqgrid-btable:first").show();b("tr#"+a+" div.ui-inline-save, tr#"+a+" div.ui-inline-cancel","#"+c+".ui-jqgrid-btable:first").hide()};var h=function(j){g.afterRestore&&g.afterRestore.call(e,j);b("tr#"+a+" div.ui-inline-edit, tr#"+a+" div.ui-inline-del","#"+c+".ui-jqgrid-btable:first").show();b("tr#"+a+" div.ui-inline-save, tr#"+a+" div.ui-inline-cancel","#"+c+".ui-jqgrid-btable:first").hide()};if(b("#"+a, -"#"+c).hasClass("jqgrid-new-row")){var i=e.p.prmNames;g.extraparam[i.oper]=i.addoper}switch(d){case "edit":b("#"+c).jqGrid("editRow",a,g.keys,g.onEdit,g.onSuccess,g.url,g.extraparam,f,g.onError,h);b("tr#"+a+" div.ui-inline-edit, tr#"+a+" div.ui-inline-del","#"+c+".ui-jqgrid-btable:first").hide();b("tr#"+a+" div.ui-inline-save, tr#"+a+" div.ui-inline-cancel","#"+c+".ui-jqgrid-btable:first").show();b.isFunction(e.p._complete)&&e.p._complete.call(e);break;case "save":if(b("#"+c).jqGrid("saveRow",a,g.onSuccess, -g.url,g.extraparam,f,g.onError,h)){b("tr#"+a+" div.ui-inline-edit, tr#"+a+" div.ui-inline-del","#"+c+".ui-jqgrid-btable:first").show();b("tr#"+a+" div.ui-inline-save, tr#"+a+" div.ui-inline-cancel","#"+c+".ui-jqgrid-btable:first").hide();b.isFunction(e.p._complete)&&e.p._complete.call(e)}break;case "cancel":b("#"+c).jqGrid("restoreRow",a,h);b("tr#"+a+" div.ui-inline-edit, tr#"+a+" div.ui-inline-del","#"+c+".ui-jqgrid-btable:first").show();b("tr#"+a+" div.ui-inline-save, tr#"+a+" div.ui-inline-cancel", -"#"+c+".ui-jqgrid-btable:first").hide();b.isFunction(e.p._complete)&&e.p._complete.call(e);break;case "del":b("#"+c).jqGrid("delGridRow",a,g.delOptions);break;case "formedit":b("#"+c).jqGrid("setSelection",a);b("#"+c).jqGrid("editGridRow",a,g.editOptions)}};b.fn.fmatter.actions=function(a,c){var d={keys:false,editbutton:true,delbutton:true,editformbutton:false};b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend(d,c.colModel.formatoptions));var f=c.rowId,g="",e;if(typeof f=="undefined"|| -b.fmatter.isEmpty(f))return"";if(d.editformbutton){e="onclick=jQuery.fn.fmatter.rowactions('"+f+"','"+c.gid+"','formedit',"+c.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";g=g+"
"}else if(d.editbutton){e="onclick=jQuery.fn.fmatter.rowactions('"+f+"','"+c.gid+"','edit',"+ -c.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover') ";g=g+"
"}if(d.delbutton){e="onclick=jQuery.fn.fmatter.rowactions('"+f+"','"+c.gid+"','del',"+c.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";g=g+"
"}e="onclick=jQuery.fn.fmatter.rowactions('"+f+"','"+c.gid+"','save',"+c.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";g=g+""; -e="onclick=jQuery.fn.fmatter.rowactions('"+f+"','"+c.gid+"','cancel',"+c.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";g=g+"";return"
"+g+"
"};b.unformat=function(a,c,d,f){var g,e=c.colModel.formatter,h=c.colModel.formatoptions|| -{},i=/([\.\*\_\'\(\)\{\}\+\?\\])/g,j=c.colModel.unformat||b.fn.fmatter[e]&&b.fn.fmatter[e].unformat;if(typeof j!=="undefined"&&b.isFunction(j))g=j(b(a).text(),c,a);else if(!b.fmatter.isUndefined(e)&&b.fmatter.isString(e)){g=b.jgrid.formatter||{};switch(e){case "integer":h=b.extend({},g.integer,h);c=h.thousandsSeparator.replace(i,"\\$1");g=b(a).text().replace(RegExp(c,"g"),"");break;case "number":h=b.extend({},g.number,h);c=h.thousandsSeparator.replace(i,"\\$1");g=b(a).text().replace(RegExp(c,"g"), -"").replace(h.decimalSeparator,".");break;case "currency":h=b.extend({},g.currency,h);c=h.thousandsSeparator.replace(i,"\\$1");g=b(a).text().replace(RegExp(c,"g"),"").replace(h.decimalSeparator,".").replace(h.prefix,"").replace(h.suffix,"");break;case "checkbox":h=c.colModel.editoptions?c.colModel.editoptions.value.split(":"):["Yes","No"];g=b("input",a).is(":checked")?h[0]:h[1];break;case "select":g=b.unformat.select(a,c,d,f);break;case "actions":return"";default:g=b(a).text()}}return g!==undefined? -g:f===true?b(a).text():b.jgrid.htmlDecode(b(a).html())};b.unformat.select=function(a,c,d,f){d=[];a=b(a).text();if(f===true)return a;c=b.extend({},c.colModel.editoptions);if(c.value){var g=c.value;c=c.multiple===true?true:false;f=[];var e;if(c){f=a.split(",");f=b.map(f,function(k){return b.trim(k)})}if(b.fmatter.isString(g))for(var h=g.split(";"),i=0,j=0;j2)e[1]=jQuery.map(e,function(k,l){if(l>0)return k}).join(":");if(c){if(jQuery.inArray(e[1],f)>-1){d[i]= -e[0];i++}}else if(b.trim(e[1])==b.trim(a)){d[0]=e[0];break}}else if(b.fmatter.isObject(g)||b.isArray(g)){c||(f[0]=a);d=jQuery.map(f,function(k){var l;b.each(g,function(n,o){if(o==k){l=n;return false}});if(typeof l!="undefined")return l})}return d.join(", ")}else return a||""};b.unformat.date=function(a,c){var d=b.jgrid.formatter.date||{};b.fmatter.isUndefined(c.formatoptions)||(d=b.extend({},d,c.formatoptions));return b.fmatter.isEmpty(a)?b.fn.fmatter.defaultFormat(a,c):b.fmatter.util.DateFormat(d.newformat, -a,d.srcformat,d)}})(jQuery); -(function(a){a.jgrid.extend({getColProp:function(b){var e={},c=this[0];if(!c.grid)return false;c=c.p.colModel;for(var j=0;j0?true:false;if(b.stringResult===true||c.p.datatype=="local"){var l='{"groupOp":"'+b.groupOp+'","rules":[',t=0;a.each(d,function(r,v){if(t>0)l+=",";l+='{"field":"'+r+'",';l+='"op":"'+i[r]+'",';v+="";l+='"data":"'+v.replace(/\\/g,"\\\\").replace(/\"/g, -'\\"')+'"}';t++});l+="]}";a.extend(c.p.postData,{filters:l});a.each(["searchField","searchString","searchOper"],function(r,v){c.p.postData.hasOwnProperty(v)&&delete c.p.postData[v]})}else a.extend(c.p.postData,d);var o;if(c.p.searchurl){o=c.p.url;a(c).jqGrid("setGridParam",{url:c.p.searchurl})}var q=false;if(a.isFunction(b.beforeSearch))q=b.beforeSearch.call(c);q||a(c).jqGrid("setGridParam",{search:n}).trigger("reloadGrid",[{page:1}]);o&&a(c).jqGrid("setGridParam",{url:o});a.isFunction(b.afterSearch)&& -b.afterSearch()},k=a(""),p;a.each(c.p.colModel,function(){var d=this,g,h,f,i;h=a("");g=a("
");this.hidden===true&&a(h).css("display","none");this.search=this.search===false?false:true;if(typeof this.stype=="undefined")this.stype="text";f=a.extend({},this.searchoptions||{});if(this.search)switch(this.stype){case "select":if(i= -this.surl||f.dataUrl)a.ajax(a.extend({url:i,dataType:"html",success:function(o){if(f.buildSelect!==undefined)(o=f.buildSelect(o))&&a(g).append(o);else a(g).append(o);f.defaultValue&&a("select",g).val(f.defaultValue);a("select",g).attr({name:d.index||d.name,id:"gs_"+d.name});f.attr&&a("select",g).attr(f.attr);a("select",g).css({width:"100%"});f.dataInit!==undefined&&f.dataInit(a("select",g)[0]);f.dataEvents!==undefined&&e(a("select",g)[0],f.dataEvents);b.autosearch===true&&a("select",g).change(function(){j(); -return false});o=null}},a.jgrid.ajaxOptions,c.p.ajaxSelectOptions||{}));else{var m;if(d.searchoptions&&d.searchoptions.value)m=d.searchoptions.value;else if(d.editoptions&&d.editoptions.value)m=d.editoptions.value;if(m){i=document.createElement("select");i.style.width="100%";a(i).attr({name:d.index||d.name,id:"gs_"+d.name});var n,l;if(typeof m==="string"){m=m.split(";");for(var t=0;t");f.attr&&a("input",g).attr(f.attr);f.dataInit!==undefined&&f.dataInit(a("input",g)[0]);f.dataEvents!==undefined&&e(a("input",g)[0],f.dataEvents);if(b.autosearch===true)b.searchOnEnter?a("input",g).keypress(function(o){if((o.charCode?o.charCode:o.keyCode?o.keyCode:0)==13){j();return false}return this}):a("input",g).keydown(function(o){switch(o.which){case 13:return false;case 9:case 16:case 37:case 38:case 39:case 40:case 27:break;default:p&&clearTimeout(p);p=setTimeout(function(){j()}, -500)}})}a(h).append(g);a(k).append(h)});a("table thead",c.grid.hDiv).append(k);this.ftoolbar=true;this.triggerToolbar=j;this.clearToolbar=function(d){var g={},h,f=0,i;d=typeof d!="boolean"?true:d;a.each(c.p.colModel,function(){h=this.searchoptions&&this.searchoptions.defaultValue?this.searchoptions.defaultValue:"";i=this.index||this.name;switch(this.stype){case "select":var q;a("#gs_"+a.jgrid.jqID(this.name)+" option",this.frozen===true&&c.p.frozenColumns===true?c.grid.fhDiv:c.grid.hDiv).each(function(s){if(s=== -0)this.selected=true;if(a(this).text()==h){this.selected=true;q=a(this).val();return false}});if(q){g[i]=q;f++}else try{delete c.p.postData[i]}catch(r){}break;case "text":a("#gs_"+a.jgrid.jqID(this.name),this.frozen===true&&c.p.frozenColumns===true?c.grid.fhDiv:c.grid.hDiv).val(h);if(h){g[i]=h;f++}else try{delete c.p.postData[i]}catch(v){}}});var m=f>0?true:false;if(b.stringResult===true||c.p.datatype=="local"){var n='{"groupOp":"'+b.groupOp+'","rules":[',l=0;a.each(g,function(q,r){if(l>0)n+=","; -n+='{"field":"'+q+'",';n+='"op":"eq",';r+="";n+='"data":"'+r.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"}';l++});n+="]}";a.extend(c.p.postData,{filters:n});a.each(["searchField","searchString","searchOper"],function(q,r){c.p.postData.hasOwnProperty(r)&&delete c.p.postData[r]})}else a.extend(c.p.postData,g);var t;if(c.p.searchurl){t=c.p.url;a(c).jqGrid("setGridParam",{url:c.p.searchurl})}var o=false;if(a.isFunction(b.beforeClear))o=b.beforeClear.call(c);o||d&&a(c).jqGrid("setGridParam",{search:m}).trigger("reloadGrid", -[{page:1}]);t&&a(c).jqGrid("setGridParam",{url:t});a.isFunction(b.afterClear)&&b.afterClear()};this.toggleToolbar=function(){var d=a("tr.ui-search-toolbar",c.grid.hDiv),g=c.p.frozenColumns===true?a("tr.ui-search-toolbar",c.grid.hDiv):false;if(d.css("display")=="none"){d.show();g&&g.show()}else{d.hide();g&&g.hide()}}}})},destroyGroupHeader:function(b){if(typeof b=="undefined")b=true;return this.each(function(){var e,c,j,k,p,d;c=this.grid;var g=a("table.ui-jqgrid-htable thead",c.hDiv),h=this.p.colModel; -if(c){e=a("",{role:"rowheader"}).addClass("ui-jqgrid-labels");k=c.headers;c=0;for(j=k.length;c0)d[0].style.height="";p.children("div")[0].style.top=""}a(g).children("tr.ui-jqgrid-labels").remove();a(g).prepend(e);b===true&&a(this).jqGrid("setGridParam",{groupHeader:null})}})},setGroupHeaders:function(b){b= -a.extend({useColSpanStyle:false,groupHeaders:[]},b||{});return this.each(function(){this.p.groupHeader=b;var e=this,c,j,k=0,p,d,g,h,f,i=e.p.colModel,m=i.length,n=e.grid.headers,l=a("table.ui-jqgrid-htable",e.grid.hDiv),t=l.children("thead").children("tr.ui-jqgrid-labels:last").addClass("jqg-second-row-header");p=l.children("thead");var o,q=l.find(".jqg-first-row-header");if(q.html()===null)q=a("",{role:"row","aria-hidden":"true"}).addClass("jqg-first-row-header").css("height","auto");else q.empty(); -var r,v=function(s,u){for(var w=0,x=u.length;w",{role:"rowheader"}).addClass("ui-jqgrid-labels jqg-third-row-header");for(c=0;c",{role:"gridcell"}).css(d).addClass("ui-first-th-"+e.p.direction).appendTo(q);g.style.width="";d=v(j.name,b.groupHeaders);if(d>=0){d=b.groupHeaders[d];k=d.numberOfColumns;f=d.titleText;for(d= -j=0;d").attr({role:"columnheader"}).addClass("ui-state-default ui-th-column-header ui-th-"+e.p.direction).css({height:"22px","border-top":"0px none"}).html(f);j>0&&d.attr("colspan",String(j));e.p.headertitles&&d.attr("title",d.text());j===0&&d.hide();h.before(d);p.append(g);k-=1}else if(k===0)if(b.useColSpanStyle)h.attr("rowspan","2");else{a("",{role:"columnheader"}).addClass("ui-state-default ui-th-column-header ui-th-"+e.p.direction).css({display:j.hidden? -"none":"","border-top":"0px none"}).insertBefore(h);p.append(g)}else{p.append(g);k--}}i=a(e).children("thead");i.prepend(q);p.insertAfter(t);l.append(i);if(b.useColSpanStyle){l.find("span.ui-jqgrid-resize").each(function(){var s=a(this).parent();if(s.is(":visible"))this.style.cssText="height: "+s.height()+"px !important; cursor: col-resize;"});l.find("div.ui-jqgrid-sortable").each(function(){var s=a(this),u=s.parent();u.is(":visible")&&u.is(":has(span.ui-jqgrid-resize)")&&s.css("top",(u.height()- -s.outerHeight())/2+"px")})}if(a.isFunction(e.p.resizeStop))o=e.p.resizeStop;r=i.find("tr.jqg-first-row-header");e.p.resizeStop=function(s,u){r.find("th").eq(u).width(s);a.isFunction(o)&&o.call(e,s,u)}})},setFrozenColumns:function(){return this.each(function(){if(this.grid){var b=this,e=b.p.colModel,c=0,j=e.length,k=-1,p=false;if(!(b.p.subGrid==true||b.p.treeGrid===true||b.p.cellEdit==true||b.p.sortable||b.p.scroll||b.p.grouping)){b.p.rownumbers&&c++;for(b.p.multiselect&&c++;c=0&&p){e=b.p.caption?a(b.grid.cDiv).outerHeight():0;c=a(".ui-jqgrid-htable","#gview_"+a.jgrid.jqID(b.p.id)).height();b.p.orgEvents={};if(b.p.toppager)e+=a(b.grid.topDiv).outerHeight();if(b.p.toolbar[0]==true)if(b.p.toolbar[1]!="bottom")e+=a(b.grid.uDiv).outerHeight();b.grid.fhDiv=a('
');b.grid.fbDiv=a('
');a("#gview_"+a.jgrid.jqID(b.p.id)).append(b.grid.fhDiv);e=a(".ui-jqgrid-htable","#gview_"+a.jgrid.jqID(b.p.id)).clone(true);if(b.p.groupHeader){a("tr.jqg-first-row-header, tr.jqg-third-row-header",e).each(function(){a("th:gt("+k+")",this).remove()});var d=-1,g=-1;a("tr.jqg-second-row-header th",e).each(function(){var h=parseInt(a(this).attr("colspan"),10);if(h){d+=h;g++}if(d===k)return false});if(d!== -k)g=k;a("tr.jqg-second-row-header",e).each(function(){a("th:gt("+g+")",this).remove()})}else a("tr",e).each(function(){a("th:gt("+k+")",this).remove()});a(e).width(1);a(b.grid.fhDiv).append(e).mousemove(function(h){if(b.grid.resizing){b.grid.dragMove(h);return false}});if(a.isFunction(b.p.resizeStop))b.p.orgEvents.resizeStop=b.p.resizeStop;b.p.resizeStop=function(h,f){var i=a(".ui-jqgrid-htable",b.grid.fhDiv);a("th:eq("+f+")",i).width(h);i=a(".ui-jqgrid-btable",b.grid.fbDiv);a("tr:first td:eq("+f+ -")",i).width(h);if(a.isFunction(b.p.orgEvents.resizeStop))b.p.orgEvents.resizeStop.call(b,h,f);else b.p.orgEvents.resizeStop=null};b.p.orgEvents.onSortCol=a.isFunction(b.p.onSortCol)?b.p.onSortCol:null;b.p.onSortCol=function(h,f,i){var m=a("tr.ui-jqgrid-labels:last th:eq("+b.p.lastsort+")",b.grid.fhDiv),n=a("tr.ui-jqgrid-labels:last th:eq("+f+")",b.grid.fhDiv);a("span.ui-grid-ico-sort",m).addClass("ui-state-disabled");a(m).attr("aria-selected","false");a("span.ui-icon-"+b.p.sortorder,n).removeClass("ui-state-disabled"); -a(n).attr("aria-selected","true");if(!b.p.viewsortcols[0])if(b.p.lastsort!=f){a("span.s-ico",m).hide();a("span.s-ico",n).show()}a.isFunction(b.p.orgEvents.onSortCol)&&b.p.orgEvents.onSortCol.call(b,h,f,i)};a("#gview_"+a.jgrid.jqID(b.p.id)).append(b.grid.fbDiv);jQuery(b.grid.bDiv).scroll(function(){jQuery(b.grid.fbDiv).scrollTop(jQuery(this).scrollTop())});b.p.orgEvents.complete=a.isFunction(b.p._complete)?b.p._complete:null;b.p.hoverrows===true&&a("#"+a.jgrid.jqID(b.p.id)).unbind("mouseover").unbind("mouseout"); -b.p._complete=function(){a("#"+a.jgrid.jqID(b.p.id)+"_frozen").remove();jQuery(b.grid.fbDiv).height(jQuery(b.grid.bDiv).height()-16);var h=a("#"+a.jgrid.jqID(b.p.id)).clone(true);a("tr",h).each(function(){a("td:gt("+k+")",this).remove()});a(h).width(1).attr("id",a.jgrid.jqID(b.p.id)+"_frozen");a(b.grid.fbDiv).append(h);if(b.p.hoverrows===true){a("tr.jqgrow",h).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")})}h=null;a.isFunction(b.p.orgEvents.complete)&&b.p.orgEvents.complete.call(b)};b.p.frozenColumns= -true}}}})},destroyFrozenColumns:function(){return this.each(function(){if(this.grid)if(this.p.frozenColumns===true){a(this.grid.fhDiv).remove();a(this.grid.fbDiv).remove();this.grid.fhDiv=null;this.grid.fbDiv=null;this.p._complete=this.p.orgEvents.complete;this.p.resizeStop=this.p.orgEvents.resizeStop;this.p.onSortCol=this.p.orgEvents.onSortCol;this.p.orgEvents=null;if(this.p.hoverrows==true){var b;a("#"+a.jgrid.jqID(this.p.id)).bind("mouseover",function(e){b=a(e.target).closest("tr.jqgrow");a(b).attr("class")!== -"ui-subgrid"&&a(b).addClass("ui-state-hover")}).bind("mouseout",function(e){b=a(e.target).closest("tr.jqgrow");a(b).removeClass("ui-state-hover")})}this.p.frozenColumns=false}})}})})(jQuery); -(function(a){a.extend(a.jgrid,{showModal:function(b){b.w.show()},closeModal:function(b){b.w.hide().attr("aria-hidden","true");b.o&&b.o.remove()},hideModal:function(b,c){c=a.extend({jqm:true,gb:""},c||{});if(c.onClose){var d=c.onClose(b);if(typeof d=="boolean"&&!d)return}if(a.fn.jqm&&c.jqm===true)a(b).attr("aria-hidden","true").jqmHide();else{if(c.gb!=="")try{a(".jqgrid-overlay:first",c.gb).hide()}catch(f){}a(b).hide().attr("aria-hidden","true")}},findPos:function(b){var c=0,d=0;if(b.offsetParent){do{c+= -b.offsetLeft;d+=b.offsetTop}while(b=b.offsetParent)}return[c,d]},createModal:function(b,c,d,f,g,h,j){var e=document.createElement("div"),k,q=this;j=a.extend({},j||{});k=a(d.gbox).attr("dir")=="rtl"?true:false;e.className="ui-widget ui-widget-content ui-corner-all ui-jqdialog";e.id=b.themodal;var i=document.createElement("div");i.className="ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix";i.id=b.modalhead;a(i).append(""+d.caption+"");var n= -a("").hover(function(){n.addClass("ui-state-hover")},function(){n.removeClass("ui-state-hover")}).append("");a(i).append(n);if(k){e.dir="rtl";a(".ui-jqdialog-title",i).css("float","right");a(".ui-jqdialog-titlebar-close",i).css("left","0.3em")}else{e.dir="ltr";a(".ui-jqdialog-title",i).css("float","left");a(".ui-jqdialog-titlebar-close",i).css("right","0.3em")}var r=document.createElement("div"); -a(r).addClass("ui-jqdialog-content ui-widget-content").attr("id",b.modalcontent);a(r).append(c);e.appendChild(r);a(e).prepend(i);if(h===true)a("body").append(e);else typeof h=="string"?a(h).append(e):a(e).insertBefore(f);a(e).css(j);if(typeof d.jqModal==="undefined")d.jqModal=true;c={};if(a.fn.jqm&&d.jqModal===true){if(d.left===0&&d.top===0&&d.overlay){j=[];j=this.findPos(g);d.left=j[0]+4;d.top=j[1]+4}c.top=d.top+"px";c.left=d.left}else if(d.left!==0||d.top!==0){c.left=d.left;c.top=d.top+"px"}a("a.ui-jqdialog-titlebar-close", -i).click(function(){var o=a("#"+b.themodal).data("onClose")||d.onClose,s=a("#"+b.themodal).data("gbox")||d.gbox;q.hideModal("#"+b.themodal,{gb:s,jqm:d.jqModal,onClose:o});return false});if(d.width===0||!d.width)d.width=300;if(d.height===0||!d.height)d.height=200;if(!d.zIndex){f=a(f).parents("*[role=dialog]").filter(":first").css("z-index");d.zIndex=f?parseInt(f,10)+2:950}f=0;if(k&&c.left&&!h){f=a(d.gbox).width()-(!isNaN(d.width)?parseInt(d.width,10):0)-8;c.left=parseInt(c.left,10)+parseInt(f,10)}if(c.left)c.left+= -"px";a(e).css(a.extend({width:isNaN(d.width)?"auto":d.width+"px",height:isNaN(d.height)?"auto":d.height+"px",zIndex:d.zIndex,overflow:"hidden"},c)).attr({tabIndex:"-1",role:"dialog","aria-labelledby":b.modalhead,"aria-hidden":"true"});if(typeof d.drag=="undefined")d.drag=true;if(typeof d.resize=="undefined")d.resize=true;if(d.drag){a(i).css("cursor","move");if(a.fn.jqDrag)a(e).jqDrag(i);else try{a(e).draggable({handle:a("#"+i.id)})}catch(m){}}if(d.resize)if(a.fn.jqResize){a(e).append("
"); -a("#"+b.themodal).jqResize(".jqResize",b.scrollelm?"#"+b.scrollelm:false)}else try{a(e).resizable({handles:"se, sw",alsoResize:b.scrollelm?"#"+b.scrollelm:false})}catch(l){}d.closeOnEscape===true&&a(e).keydown(function(o){if(o.which==27){o=a("#"+b.themodal).data("onClose")||d.onClose;q.hideModal(this,{gb:d.gbox,jqm:d.jqModal,onClose:o})}})},viewModal:function(b,c){c=a.extend({toTop:true,overlay:10,modal:false,overlayClass:"ui-widget-overlay",onShow:this.showModal,onHide:this.closeModal,gbox:"",jqm:true, -jqM:true},c||{});if(a.fn.jqm&&c.jqm===true)c.jqM?a(b).attr("aria-hidden","false").jqm(c).jqmShow():a(b).attr("aria-hidden","false").jqmShow();else{if(c.gbox!==""){a(".jqgrid-overlay:first",c.gbox).show();a(b).data("gbox",c.gbox)}a(b).show().attr("aria-hidden","false");try{a(":input:visible",b)[0].focus()}catch(d){}}},info_dialog:function(b,c,d,f){var g={width:290,height:"auto",dataheight:"auto",drag:true,resize:false,caption:""+b+"",left:250,top:170,zIndex:1E3,jqModal:true,modal:false,closeOnEscape:true, -align:"center",buttonalign:"center",buttons:[]};a.extend(g,f||{});var h=g.jqModal,j=this;if(a.fn.jqm&&!h)h=false;b="";if(g.buttons.length>0)for(f=0;f"+g.buttons[f].text+""}f=isNaN(g.dataheight)?g.dataheight:g.dataheight+"px";var e="
";e+="
"+c+"
";e+=d?"
"+d+""+b+"
":b!==""?"
"+ -b+"
":"";e+="
";try{a("#info_dialog").attr("aria-hidden")=="false"&&this.hideModal("#info_dialog",{jqm:h});a("#info_dialog").remove()}catch(k){}this.createModal({themodal:"info_dialog",modalhead:"info_head",modalcontent:"info_content",scrollelm:"infocnt"},e,g,"","",true);b&&a.each(g.buttons,function(i){a("#"+this.id,"#info_id").bind("click",function(){g.buttons[i].onClick.call(a("#info_dialog"));return false})});a("#closedialog","#info_id").click(function(){j.hideModal("#info_dialog",{jqm:h}); -return false});a(".fm-button","#info_dialog").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});a.isFunction(g.beforeOpen)&&g.beforeOpen();this.viewModal("#info_dialog",{onHide:function(i){i.w.hide().remove();i.o&&i.o.remove()},modal:g.modal,jqm:h});a.isFunction(g.afterOpen)&&g.afterOpen();try{a("#info_dialog").focus()}catch(q){}},createEl:function(b,c,d,f,g){function h(m,l){a.isFunction(l.dataInit)&&l.dataInit(m);l.dataEvents&&a.each(l.dataEvents, -function(){this.data!==undefined?a(m).bind(this.type,this.data,this.fn):a(m).bind(this.type,this.fn)});return l}function j(m,l,o){var s=["dataInit","dataEvents","dataUrl","buildSelect","sopt","searchhidden","defaultValue","attr"];if(typeof o!="undefined"&&a.isArray(o))s=a.extend(s,o);a.each(l,function(p,t){a.inArray(p,s)===-1&&a(m).attr(p,t)});l.hasOwnProperty("id")||a(m).attr("id",a.jgrid.randId())}var e="";switch(b){case "textarea":e=document.createElement("textarea");if(f)c.cols||a(e).css({width:"98%"}); -else if(!c.cols)c.cols=20;if(!c.rows)c.rows=2;if(d==" "||d==" "||d.length==1&&d.charCodeAt(0)==160)d="";e.value=d;j(e,c);c=h(e,c);a(e).attr({role:"textbox",multiline:"true"});break;case "checkbox":e=document.createElement("input");e.type="checkbox";if(c.value){b=c.value.split(":");if(d===b[0]){e.checked=true;e.defaultChecked=true}e.value=b[0];a(e).attr("offval",b[1])}else{b=d.toLowerCase();if(b.search(/(false|0|no|off|undefined)/i)<0&&b!==""){e.checked=true;e.defaultChecked=true;e.value= -d}else e.value="on";a(e).attr("offval","off")}j(e,c,["value"]);c=h(e,c);a(e).attr("role","checkbox");break;case "select":e=document.createElement("select");e.setAttribute("role","select");f=[];if(c.multiple===true){b=true;e.multiple="multiple";a(e).attr("aria-multiselectable","true")}else b=false;if(typeof c.dataUrl!="undefined")a.ajax(a.extend({url:c.dataUrl,type:"GET",dataType:"html",context:{elem:e,options:c,vl:d},success:function(m){var l=[],o=this.elem,s=this.vl,p=a.extend({},this.options),t= -p.multiple===true;if(typeof p.buildSelect!="undefined")m=p.buildSelect(m);if(m=a(m).html()){a(o).append(m);j(o,p);p=h(o,p);if(typeof p.size==="undefined")p.size=t?3:1;if(t){l=s.split(",");l=a.map(l,function(u){return a.trim(u)})}else l[0]=a.trim(s);setTimeout(function(){a("option",o).each(function(){a(this).attr("role","option");if(a.inArray(a.trim(a(this).text()),l)>-1||a.inArray(a.trim(a(this).val()),l)>-1)this.selected="selected"})},0)}}},g||{}));else if(c.value){var k;if(typeof c.size==="undefined")c.size= -b?3:1;if(b){f=d.split(",");f=a.map(f,function(m){return a.trim(m)})}if(typeof c.value==="function")c.value=c.value();var q,i,n=c.separator===undefined?":":c.separator;if(typeof c.value==="string"){q=c.value.split(";");for(k=0;k2)i[1]=a.map(i,function(m,l){if(l>0)return m}).join(":");g=document.createElement("option");g.setAttribute("role","option");g.value=i[0];g.innerHTML=i[1];e.appendChild(g);if(!b&&(a.trim(i[0])==a.trim(d)||a.trim(i[1])==a.trim(d)))g.selected= -"selected";if(b&&(a.inArray(a.trim(i[1]),f)>-1||a.inArray(a.trim(i[0]),f)>-1))g.selected="selected"}}else if(typeof c.value==="object"){n=c.value;for(k in n)if(n.hasOwnProperty(k)){g=document.createElement("option");g.setAttribute("role","option");g.value=k;g.innerHTML=n[k];e.appendChild(g);if(!b&&(a.trim(k)==a.trim(d)||a.trim(n[k])==a.trim(d)))g.selected="selected";if(b&&(a.inArray(a.trim(n[k]),f)>-1||a.inArray(a.trim(k),f)>-1))g.selected="selected"}}j(e,c,["value"]);c=h(e,c)}break;case "text":case "password":case "button":k= -b=="button"?"button":"textbox";e=document.createElement("input");e.type=b;e.value=d;j(e,c);c=h(e,c);if(b!="button")if(f)c.size||a(e).css({width:"98%"});else if(!c.size)c.size=20;a(e).attr("role",k);break;case "image":case "file":e=document.createElement("input");e.type=b;j(e,c);c=h(e,c);break;case "custom":e=document.createElement("span");try{if(a.isFunction(c.custom_element))if(n=c.custom_element.call(this,d,c)){n=a(n).addClass("customelement").attr({id:c.id,name:c.name});a(e).empty().append(n)}else throw"e2"; -else throw"e1";}catch(r){r=="e1"&&this.info_dialog(a.jgrid.errors.errcap,"function 'custom_element' "+a.jgrid.edit.msg.nodefined,a.jgrid.edit.bClose);r=="e2"?this.info_dialog(a.jgrid.errors.errcap,"function 'custom_element' "+a.jgrid.edit.msg.novalue,a.jgrid.edit.bClose):this.info_dialog(a.jgrid.errors.errcap,typeof r==="string"?r:r.message,a.jgrid.edit.bClose)}}return e},checkDate:function(b,c){var d={},f;b=b.toLowerCase();f=b.indexOf("/")!=-1?"/":b.indexOf("-")!=-1?"-":b.indexOf(".")!=-1?".":"/"; -b=b.split(f);c=c.split(f);if(c.length!=3)return false;f=-1;for(var g,h=-1,j=-1,e=0;e12)return false}if(h===-1)return false;else{k=d[b[h]].toString();if(k.length<1||d[b[h]]<1||d[b[h]]>31||d[b[j]]==2&&d[b[h]]>(d[b[f]]%4===0&&(d[b[f]]%100!==0||d[b[f]]%400===0)?29:28)||d[b[h]]>e[d[b[j]]])return false}return true},isEmpty:function(b){return b.match(/^\s+$/)||b===""?true:false},checkTime:function(b){var c=/^(\d{1,2}):(\d{2})([ap]m)?$/;if(!this.isEmpty(b))if(b=b.match(c)){if(b[3]){if(b[1]< -1||b[1]>12)return false}else if(b[1]>23)return false;if(b[2]>59)return false}else return false;return true},checkValues:function(b,c,d,f,g){var h,j;if(typeof f==="undefined")if(typeof c=="string"){f=0;for(g=d.p.colModel.length;f=0)h=d.p.colModel[c].editrules}else{h=f;j=g===undefined?"_":g}if(h){j||(j=d.p.colNames[c]);if(h.required===true)if(this.isEmpty(b))return[false, -j+": "+a.jgrid.edit.msg.required,""];f=h.required===false?false:true;if(h.number===true)if(!(f===false&&this.isEmpty(b)))if(isNaN(b))return[false,j+": "+a.jgrid.edit.msg.number,""];if(typeof h.minValue!="undefined"&&!isNaN(h.minValue))if(parseFloat(b)parseFloat(h.maxValue))return[false,j+": "+a.jgrid.edit.msg.maxValue+" "+h.maxValue,""];if(h.email=== -true)if(!(f===false&&this.isEmpty(b))){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(b))return[false,j+": "+a.jgrid.edit.msg.email,""]}if(h.integer===true)if(!(f===false&&this.isEmpty(b))){if(isNaN(b))return[false,j+": "+a.jgrid.edit.msg.integer,""];if(b%1!==0||b.indexOf(".")!=-1)return[false,j+": "+a.jgrid.edit.msg.integer,""]}if(h.date===true)if(!(f===false&&this.isEmpty(b))){c=d.p.colModel[c].formatoptions&&d.p.colModel[c].formatoptions.newformat?d.p.colModel[c].formatoptions.newformat:d.p.colModel[c].datefmt||"Y-m-d";if(!this.checkDate(c,b))return[false,j+": "+a.jgrid.edit.msg.date+ -" - "+c,""]}if(h.time===true)if(!(f===false&&this.isEmpty(b)))if(!this.checkTime(b))return[false,j+": "+a.jgrid.edit.msg.date+" - hh:mm (am/pm)",""];if(h.url===true)if(!(f===false&&this.isEmpty(b))){g=/^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;if(!g.test(b))return[false,j+": "+a.jgrid.edit.msg.url,""]}if(h.custom===true)if(!(f===false&&this.isEmpty(b)))if(a.isFunction(h.custom_func)){b=h.custom_func.call(d,b,j);return a.isArray(b)? -b:[false,a.jgrid.edit.msg.customarray,""]}else return[false,a.jgrid.edit.msg.customfcheck,""]}return[true,"",""]}})})(jQuery); -(function(a){var d={};a.jgrid.extend({searchGrid:function(f){f=a.extend({recreateFilter:false,drag:true,sField:"searchField",sValue:"searchString",sOper:"searchOper",sFilter:"filters",loadDefaults:true,beforeShowSearch:null,afterShowSearch:null,onInitializeSearch:null,afterRedraw:null,closeAfterSearch:false,closeAfterReset:false,closeOnEscape:false,multipleSearch:false,multipleGroup:false,top:0,left:0,jqModal:true,modal:false,resize:true,width:450,height:"auto",dataheight:"auto",showQuery:false,errorcheck:true, -sopt:null,stringResult:undefined,onClose:null,onSearch:null,onReset:null,toTop:true,overlay:30,columns:[],tmplNames:null,tmplFilters:null,tmplLabel:" Template: ",showOnLoad:false,layer:null},a.jgrid.search,f||{});return this.each(function(){function b(){if(a.isFunction(f.beforeShowSearch)){x=f.beforeShowSearch(a("#"+q));if(typeof x==="undefined")x=true}if(x){a.jgrid.viewModal("#"+G.themodal,{gbox:"#gbox_"+q,jqm:f.jqModal,modal:f.modal,overlay:f.overlay,toTop:f.toTop});a.isFunction(f.afterShowSearch)&& -f.afterShowSearch(a("#"+q))}}var e=this;if(e.grid){var q="fbox_"+e.p.id,x=true,G={themodal:"searchmod"+q,modalhead:"searchhd"+q,modalcontent:"searchcnt"+q,scrollelm:q},B=e.p.postData[f.sFilter];if(typeof B==="string")B=a.jgrid.parse(B);f.recreateFilter===true&&a("#"+G.themodal).remove();if(a("#"+G.themodal).html()!==null)b();else{var w=a("
").insertBefore("#gview_"+e.p.id),n="left",j="";if(e.p.direction=="rtl"){n="right";j= -" style='text-align:left'";w.attr("dir","rtl")}var s=a.extend([],e.p.colModel),M=""+f.Find+"",c=""+f.Reset+"",t="",o="",i,m=false,H=-1;if(f.showQuery)t= -"Query";if(f.columns.length)s=f.columns;else a.each(s,function(u,C){if(!C.label)C.label=e.p.colNames[u];if(!m){var A=typeof C.search==="undefined"?true:C.search,l=C.hidden===true;if(C.searchoptions&&C.searchoptions.searchhidden===true&&A||A&&!l){m=true;i=C.index||C.name;H=u}}});if(!B&&i||f.multipleSearch===false){var J="eq";if(H>=0&&s[H].searchoptions&& -s[H].searchoptions.sopt)J=s[H].searchoptions.sopt[0];else if(f.sopt&&f.sopt.length)J=f.sopt[0];B={groupOp:"AND",rules:[{field:i,op:J,data:""}]}}m=false;if(f.tmplNames&&f.tmplNames.length){m=true;o=f.tmplLabel;o+=""}n="

"+c+o+""+t+M+"
";a("#"+q).jqFilter({columns:s,filter:f.loadDefaults?B:null,showQuery:f.showQuery,errorcheck:f.errorcheck,sopt:f.sopt,groupButton:f.multipleGroup,ruleButtons:f.multipleSearch,afterRedraw:f.afterRedraw,_gridsopt:a.jgrid.search.odata,ajaxSelectOptions:e.p.ajaxSelectOptions,onChange:function(){this.p.showQuery&&a(".query",this).html(this.toUserFriendlyString())},direction:e.p.direction});w.append(n);m&&f.tmplFilters&&f.tmplFilters.length&& -a(".ui-template",w).bind("change",function(){var u=a(this).val();u=="default"?a("#"+q).jqFilter("addFilter",B):a("#"+q).jqFilter("addFilter",f.tmplFilters[parseInt(u,10)]);return false});if(f.multipleGroup===true)f.multipleSearch=true;if(a.isFunction(f.onInitializeSearch))f.onInitializeSearch(a("#"+q));f.gbox="#gbox_"+q;f.layer?a.jgrid.createModal(G,w,f,"#gview_"+e.p.id,a("#gbox_"+e.p.id)[0],"#"+f.layer,{position:"relative"}):a.jgrid.createModal(G,w,f,"#gview_"+e.p.id,a("#gbox_"+e.p.id)[0]);t&&a("#"+ -q+"_query").bind("click",function(){a(".queryresult",w).toggle();return false});if(f.stringResult===undefined)f.stringResult=f.multipleSearch;a("#"+q+"_search").bind("click",function(){var u=a("#"+q),C={},A,l=u.jqFilter("filterData");if(f.errorcheck){u[0].hideError();f.showQuery||u.jqFilter("toSQLString");if(u[0].p.error){u[0].showError();return false}}if(f.stringResult){try{A=xmlJsonClass.toJson(l,"","",false)}catch(y){try{A=JSON.stringify(l)}catch(h){}}if(typeof A==="string"){C[f.sFilter]=A;a.each([f.sField, -f.sValue,f.sOper],function(){C[this]=""})}}else if(f.multipleSearch){C[f.sFilter]=l;a.each([f.sField,f.sValue,f.sOper],function(){C[this]=""})}else{C[f.sField]=l.rules[0].field;C[f.sValue]=l.rules[0].data;C[f.sOper]=l.rules[0].op;C[f.sFilter]=""}e.p.search=true;a.extend(e.p.postData,C);if(a.isFunction(f.onSearch))f.onSearch();a(e).trigger("reloadGrid",[{page:1}]);f.closeAfterSearch&&a.jgrid.hideModal("#"+G.themodal,{gb:"#gbox_"+e.p.id,jqm:f.jqModal,onClose:f.onClose});return false});a("#"+q+"_reset").bind("click", -function(){var u={},C=a("#"+q);e.p.search=false;if(f.multipleSearch===false)u[f.sField]=u[f.sValue]=u[f.sOper]="";else u[f.sFilter]="";C[0].resetFilter();m&&a(".ui-template",w).val("default");a.extend(e.p.postData,u);if(a.isFunction(f.onReset))f.onReset();a(e).trigger("reloadGrid",[{page:1}]);return false});b();a(".fm-button:not(.ui-state-disabled)",w).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")})}}})},editGridRow:function(f,b){b=a.extend({top:0, -left:0,width:300,height:"auto",dataheight:"auto",modal:false,overlay:30,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||{});d[a(this)[0].p.id]=b;return this.each(function(){function e(){a("#"+i+" > tbody > tr > td > .FormElement").each(function(){var g=a(".customelement",this);if(g.length){var k=a(g[0]).attr("name");a.each(c.p.colModel,function(){if(this.name===k&&this.editoptions&&a.isFunction(this.editoptions.custom_value)){try{h[k]= -this.editoptions.custom_value(a("#"+a.jgrid.jqID(k),"#"+i),"get");if(h[k]===undefined)throw"e1";}catch(p){p==="e1"?a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,p.message,jQuery.jgrid.edit.bClose)}return true}})}else{switch(a(this).get(0).type){case "checkbox":if(a(this).is(":checked"))h[this.name]=a(this).val();else{g=a(this).attr("offval");h[this.name]=g}break;case "select-one":h[this.name]= -a("option:selected",this).val();O[this.name]=a("option:selected",this).text();break;case "select-multiple":h[this.name]=a(this).val();h[this.name]=h[this.name]?h[this.name].join(","):"";var v=[];a("option:selected",this).each(function(p,E){v[p]=a(E).text()});O[this.name]=v.join(",");break;case "password":case "text":case "textarea":case "button":h[this.name]=a(this).val()}if(c.p.autoencode)h[this.name]=a.jgrid.htmlEncode(h[this.name])}});return true}function q(g,k,v,p){var E,D,z,L=0,r,R,F,T=[],I= -false,ca="",P;for(P=1;P<=p;P++)ca+="  ";if(g!="_empty")I=a(k).jqGrid("getInd",g);a(k.p.colModel).each(function(S){E=this.name;R=(D=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(I===false)r="";else if(E==k.p.ExpandColumn&&k.p.treeGrid===true)r=a("td:eq("+S+")",k.rows[I]).text();else{try{r=a.unformat(a("td:eq("+ -S+")",k.rows[I]),{rowId:g,colModel:this},S)}catch(ea){r=this.edittype&&this.edittype=="textarea"?a("td:eq("+S+")",k.rows[I]).text():a("td:eq("+S+")",k.rows[I]).html()}if(!r||r==" "||r==" "||r.length==1&&r.charCodeAt(0)==160)r=""}var X=a.extend({},this.editoptions||{},{id:E,name:E}),Y=a.extend({},{elmprefix:"",elmsuffix:"",rowabove:false,rowcontent:""},this.formoptions||{}),da=parseInt(Y.rowpos,10)||L+1,fa=parseInt((parseInt(Y.colpos,10)||1)*2,10);if(g=="_empty"&&X.defaultValue)r=a.isFunction(X.defaultValue)? -X.defaultValue():X.defaultValue;if(!this.edittype)this.edittype="text";if(c.p.autoencode)r=a.jgrid.htmlDecode(r);F=a.jgrid.createEl(this.edittype,X,r,false,a.extend({},a.jgrid.ajaxOptions,k.p.ajaxSelectOptions||{}));if(r===""&&this.edittype=="checkbox")r=a(F).attr("offval");if(r===""&&this.edittype=="select")r=a("option:eq(0)",F).text();if(d[c.p.id].checkOnSubmit||d[c.p.id].checkOnUpdate)d[c.p.id]._savedData[E]=r;a(F).addClass("FormElement");if(this.edittype=="text"||this.edittype=="textarea")a(F).addClass("ui-widget-content ui-corner-all"); -z=a(v).find("tr[rowpos="+da+"]");if(Y.rowabove){X=a(""+Y.rowcontent+"");a(v).append(X);X[0].rp=da}if(z.length===0){z=a("").addClass("FormData").attr("id","tr_"+E);a(z).append(ca);a(v).append(z);z[0].rp=da}a("td:eq("+(fa-2)+")",z[0]).html(typeof Y.label==="undefined"?k.p.colNames[S]:Y.label);a("td:eq("+(fa-1)+")",z[0]).append(Y.elmprefix).append(F).append(Y.elmsuffix);T[L]=S;L++}});if(L>0){P=a("");P[0].rp=L+999;a(v).append(P);if(d[c.p.id].checkOnSubmit||d[c.p.id].checkOnUpdate)d[c.p.id]._savedData[k.p.id+"_id"]=g}return T}function x(g,k,v){var p,E=0,D,z,L,r,R;if(d[c.p.id].checkOnSubmit||d[c.p.id].checkOnUpdate){d[c.p.id]._savedData={};d[c.p.id]._savedData[k.p.id+"_id"]=g}var F=k.p.colModel;if(g=="_empty"){a(F).each(function(){p=this.name;L=a.extend({},this.editoptions|| -{});if((z=a("#"+a.jgrid.jqID(p),"#"+v))&&z.length&&z[0]!==null){r="";if(L.defaultValue){r=a.isFunction(L.defaultValue)?L.defaultValue():L.defaultValue;if(z[0].type=="checkbox"){R=r.toLowerCase();if(R.search(/(false|0|no|off|undefined)/i)<0&&R!==""){z[0].checked=true;z[0].defaultChecked=true;z[0].value=r}else{z[0].checked=false;z[0].defaultChecked=false}}else z.val(r)}else if(z[0].type=="checkbox"){z[0].checked=false;z[0].defaultChecked=false;r=a(z).attr("offval")}else if(z[0].type&&z[0].type.substr(0, -6)=="select")z[0].selectedIndex=0;else z.val(r);if(d[c.p.id].checkOnSubmit===true||d[c.p.id].checkOnUpdate)d[c.p.id]._savedData[p]=r}});a("#id_g","#"+v).val(g)}else{var T=a(k).jqGrid("getInd",g,true);if(T){a('td[role="gridcell"]',T).each(function(I){p=F[I].name;if(p!=="cb"&&p!=="subgrid"&&p!=="rn"&&F[I].editable===true){if(p==k.p.ExpandColumn&&k.p.treeGrid===true)D=a(this).text();else try{D=a.unformat(a(this),{rowId:g,colModel:F[I]},I)}catch(ca){D=F[I].edittype=="textarea"?a(this).text():a(this).html()}if(c.p.autoencode)D= -a.jgrid.htmlDecode(D);if(d[c.p.id].checkOnSubmit===true||d[c.p.id].checkOnUpdate)d[c.p.id]._savedData[p]=D;p=a.jgrid.jqID(p);switch(F[I].edittype){case "password":case "text":case "button":case "image":case "textarea":if(D==" "||D==" "||D.length==1&&D.charCodeAt(0)==160)D="";a("#"+p,"#"+v).val(D);break;case "select":var P=D.split(",");P=a.map(P,function(ea){return a.trim(ea)});a("#"+p+" option","#"+v).each(function(){this.selected=!F[I].editoptions.multiple&&(a.trim(D)==a.trim(a(this).text())|| -P[0]==a.trim(a(this).text())||P[0]==a.trim(a(this).val()))?true:F[I].editoptions.multiple?a.inArray(a.trim(a(this).text()),P)>-1||a.inArray(a.trim(a(this).val()),P)>-1?true:false:false});break;case "checkbox":D+="";if(F[I].editoptions&&F[I].editoptions.value)if(F[I].editoptions.value.split(":")[0]==D){a("#"+p,"#"+v)[c.p.useProp?"prop":"attr"]("checked",true);a("#"+p,"#"+v)[c.p.useProp?"prop":"attr"]("defaultChecked",true)}else{a("#"+p,"#"+v)[c.p.useProp?"prop":"attr"]("checked",false);a("#"+p,"#"+ -v)[c.p.useProp?"prop":"attr"]("defaultChecked",false)}else{D=D.toLowerCase();if(D.search(/(false|0|no|off|undefined)/i)<0&&D!==""){a("#"+p,"#"+v)[c.p.useProp?"prop":"attr"]("checked",true);a("#"+p,"#"+v)[c.p.useProp?"prop":"attr"]("defaultChecked",true)}else{a("#"+p,"#"+v)[c.p.useProp?"prop":"attr"]("checked",false);a("#"+p,"#"+v)[c.p.useProp?"prop":"attr"]("defaultChecked",false)}}break;case "custom":try{if(F[I].editoptions&&a.isFunction(F[I].editoptions.custom_value))F[I].editoptions.custom_value(a("#"+ -p,"#"+v),"set",D);else throw"e1";}catch(S){S=="e1"?a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose):a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,S.message,jQuery.jgrid.edit.bClose)}}E++}});E>0&&a("#id_g","#"+i).val(g)}}}function G(){a.each(c.p.colModel,function(g,k){if(k.editoptions&&k.editoptions.NullIfEmpty===true)if(h.hasOwnProperty(k.name)&&h[k.name]==="")h[k.name]="null"})}function B(){var g,k=[true,"",""],v={},p= -c.p.prmNames,E,D,z,L,r;if(a.isFunction(d[c.p.id].beforeCheckValues)){var R=d[c.p.id].beforeCheckValues(h,a("#"+o),h[c.p.id+"_id"]=="_empty"?p.addoper:p.editoper);if(R&&typeof R==="object")h=R}for(z in h)if(h.hasOwnProperty(z)){k=a.jgrid.checkValues(h[z],z,c);if(k[0]===false)break}G();if(k[0]){if(a.isFunction(d[c.p.id].onclickSubmit))v=d[c.p.id].onclickSubmit(d[c.p.id],h)||{};if(a.isFunction(d[c.p.id].beforeSubmit))k=d[c.p.id].beforeSubmit(h,a("#"+o))}if(k[0]&&!d[c.p.id].processing){d[c.p.id].processing= -true;a("#sData","#"+i+"_2").addClass("ui-state-active");D=p.oper;E=p.id;h[D]=a.trim(h[c.p.id+"_id"])=="_empty"?p.addoper:p.editoper;if(h[D]!=p.addoper)h[E]=h[c.p.id+"_id"];else if(h[E]===undefined)h[E]=h[c.p.id+"_id"];delete h[c.p.id+"_id"];h=a.extend(h,d[c.p.id].editData,v);if(c.p.treeGrid===true){if(h[D]==p.addoper){L=a(c).jqGrid("getGridParam","selrow");h[c.p.treeGridModel=="adjacency"?c.p.treeReader.parent_id_field:"parent_id"]=L}for(r in c.p.treeReader)if(c.p.treeReader.hasOwnProperty(r)){v= -c.p.treeReader[r];if(h.hasOwnProperty(v))h[D]==p.addoper&&r==="parent_id_field"||delete h[v]}}h[E]=a.jgrid.stripPref(c.p.idPrefix,h[E]);r=a.extend({url:d[c.p.id].url?d[c.p.id].url:a(c).jqGrid("getGridParam","editurl"),type:d[c.p.id].mtype,data:a.isFunction(d[c.p.id].serializeEditData)?d[c.p.id].serializeEditData(h):h,complete:function(F,T){h[E]=c.p.idPrefix+h[E];if(T!="success"){k[0]=false;k[1]=a.isFunction(d[c.p.id].errorTextFormat)?d[c.p.id].errorTextFormat(F):T+" Status: '"+F.statusText+"'. Error code: "+ -F.status}else if(a.isFunction(d[c.p.id].afterSubmit))k=d[c.p.id].afterSubmit(F,h);if(k[0]===false){a("#FormError>td","#"+i).html(k[1]);a("#FormError","#"+i).show()}else{a.each(c.p.colModel,function(){if(O[this.name]&&this.formatter&&this.formatter=="select")try{delete O[this.name]}catch(P){}});h=a.extend(h,O);c.p.autoencode&&a.each(h,function(P,S){h[P]=a.jgrid.htmlDecode(S)});if(h[D]==p.addoper){k[2]||(k[2]=a.jgrid.randId());h[E]=k[2];if(d[c.p.id].closeAfterAdd){if(d[c.p.id].reloadAfterSubmit)a(c).trigger("reloadGrid"); -else if(c.p.treeGrid===true)a(c).jqGrid("addChildNode",k[2],L,h);else{a(c).jqGrid("addRowData",k[2],h,b.addedrow);a(c).jqGrid("setSelection",k[2])}a.jgrid.hideModal("#"+m.themodal,{gb:"#gbox_"+t,jqm:b.jqModal,onClose:d[c.p.id].onClose})}else if(d[c.p.id].clearAfterAdd){if(d[c.p.id].reloadAfterSubmit)a(c).trigger("reloadGrid");else c.p.treeGrid===true?a(c).jqGrid("addChildNode",k[2],L,h):a(c).jqGrid("addRowData",k[2],h,b.addedrow);x("_empty",c,o)}else if(d[c.p.id].reloadAfterSubmit)a(c).trigger("reloadGrid"); -else c.p.treeGrid===true?a(c).jqGrid("addChildNode",k[2],L,h):a(c).jqGrid("addRowData",k[2],h,b.addedrow)}else{if(d[c.p.id].reloadAfterSubmit){a(c).trigger("reloadGrid");d[c.p.id].closeAfterEdit||setTimeout(function(){a(c).jqGrid("setSelection",h[E])},1E3)}else c.p.treeGrid===true?a(c).jqGrid("setTreeRow",h[E],h):a(c).jqGrid("setRowData",h[E],h);d[c.p.id].closeAfterEdit&&a.jgrid.hideModal("#"+m.themodal,{gb:"#gbox_"+t,jqm:b.jqModal,onClose:d[c.p.id].onClose})}if(a.isFunction(d[c.p.id].afterComplete)){g= -F;setTimeout(function(){d[c.p.id].afterComplete(g,h,a("#"+o));g=null},500)}if(d[c.p.id].checkOnSubmit||d[c.p.id].checkOnUpdate){a("#"+o).data("disabled",false);if(d[c.p.id]._savedData[c.p.id+"_id"]!="_empty")for(var I in d[c.p.id]._savedData)if(h[I])d[c.p.id]._savedData[I]=h[I]}}d[c.p.id].processing=false;a("#sData","#"+i+"_2").removeClass("ui-state-active");try{a(":input:visible","#"+o)[0].focus()}catch(ca){}}},a.jgrid.ajaxOptions,d[c.p.id].ajaxEditOptions);if(!r.url&&!d[c.p.id].useDataProxy)if(a.isFunction(c.p.dataProxy))d[c.p.id].useDataProxy= -true;else{k[0]=false;k[1]+=" "+a.jgrid.errors.nourl}if(k[0])if(d[c.p.id].useDataProxy){v=c.p.dataProxy.call(c,r,"set_"+c.p.id);if(typeof v=="undefined")v=[true,""];if(v[0]===false){k[0]=false;k[1]=v[1]||"Error deleting the selected row!"}else{r.data.oper==p.addoper&&d[c.p.id].closeAfterAdd&&a.jgrid.hideModal("#"+m.themodal,{gb:"#gbox_"+t,jqm:b.jqModal,onClose:d[c.p.id].onClose});r.data.oper==p.editoper&&d[c.p.id].closeAfterEdit&&a.jgrid.hideModal("#"+m.themodal,{gb:"#gbox_"+t,jqm:b.jqModal,onClose:d[c.p.id].onClose})}}else a.ajax(r)}if(k[0]=== -false){a("#FormError>td","#"+i).html(k[1]);a("#FormError","#"+i).show()}}function w(g,k){var v=false,p;for(p in g)if(g[p]!=k[p]){v=true;break}return v}function n(){var g=true;a("#FormError","#"+i).hide();if(d[c.p.id].checkOnUpdate){h={};O={};e();N=a.extend({},h,O);if(U=w(N,d[c.p.id]._savedData)){a("#"+o).data("disabled",true);a(".confirm","#"+m.themodal).show();g=false}}return g}function j(){if(f!=="_empty"&&typeof c.p.savedRow!=="undefined"&&c.p.savedRow.length>0&&a.isFunction(a.fn.jqGrid.restoreRow))for(var g= -0;g").data("disabled",false);var V=a("
");if(u){A=u(a("#"+o));if(typeof A=="undefined")A=true}if(A===false)return;j();a(c.p.colModel).each(function(){var g=this.formoptions;l=Math.max(l,g?g.colpos||0:0);y=Math.max(y,g?g.rowpos||0:0)});a(K).append(V);u=a("");u[0].rp=0;a(V).append(u);u=a(""+d[c.p.id].topinfo+"");u[0].rp=0;a(V).append(u);A=(u=c.p.direction=="rtl"?true:false)?"nData":"pData";var W=u?"pData":"nData";q(f,c,V,l);A="";W="";var $=""+ -b.bSubmit+"",Z=""+b.bCancel+"";A="";A+="";A+="

"+$+Z+"
";if(y>0){var aa=[];a.each(a(V)[0].rows,function(g,k){aa[g]=k});aa.sort(function(g,k){if(g.rp>k.rp)return 1;if(g.rp").append(K).append(A);a.jgrid.createModal(m,K,b,"#gview_"+c.p.id,a("#gbox_"+c.p.id)[0]);if(u){a("#pData, #nData","#"+i+"_2").css("float","right");a(".EditButton","#"+i+"_2").css("text-align", -"left")}d[c.p.id].topinfo&&a(".tinfo","#"+i).show();d[c.p.id].bottominfo&&a(".binfo","#"+i+"_2").show();A=K=null;a("#"+m.themodal).keydown(function(g){var k=g.target;if(a("#"+o).data("disabled")===true)return false;if(d[c.p.id].savekey[0]===true&&g.which==d[c.p.id].savekey[1])if(k.tagName!="TEXTAREA"){a("#sData","#"+i+"_2").trigger("click");return false}if(g.which===27){if(!n())return false;ba&&a.jgrid.hideModal(this,{gb:b.gbox,jqm:b.jqModal,onClose:d[c.p.id].onClose});return false}if(d[c.p.id].navkeys[0]=== -true){if(a("#id_g","#"+i).val()=="_empty")return true;if(g.which==d[c.p.id].navkeys[1]){a("#pData","#"+i+"_2").trigger("click");return false}if(g.which==d[c.p.id].navkeys[2]){a("#nData","#"+i+"_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(!n())return false;a.jgrid.hideModal("#"+m.themodal,{gb:"#gbox_"+t,jqm:b.jqModal,onClose:d[c.p.id].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","#"+i+"_2").addClass(b.saveicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("");if(b.closeicon[0]===true)a("#cData","#"+i+"_2").addClass(b.closeicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append(""); -if(d[c.p.id].checkOnSubmit||d[c.p.id].checkOnUpdate){$=""+b.bYes+"";W=""+b.bNo+"";Z=""+b.bExit+"";K=b.zIndex||999;K++;a("
"+b.saveData+"

"+$+W+Z+"
").insertAfter("#"+o);a("#sNew","#"+m.themodal).click(function(){B();a("#"+o).data("disabled",false);a(".confirm","#"+m.themodal).hide();return false});a("#nNew","#"+m.themodal).click(function(){a(".confirm", -"#"+m.themodal).hide();a("#"+o).data("disabled",false);setTimeout(function(){a(":input","#"+o)[0].focus()},0);return false});a("#cNew","#"+m.themodal).click(function(){a(".confirm","#"+m.themodal).hide();a("#"+o).data("disabled",false);a.jgrid.hideModal("#"+m.themodal,{gb:"#gbox_"+t,jqm:b.jqModal,onClose:d[c.p.id].onClose});return false})}C&&C(a("#"+o));f=="_empty"||!d[c.p.id].viewPagerButtons?a("#pData,#nData","#"+i+"_2").hide():a("#pData,#nData","#"+i+"_2").show();H&&H(a("#"+o));a("#"+m.themodal).data("onClose", -d[c.p.id].onClose);a.jgrid.viewModal("#"+m.themodal,{gbox:"#gbox_"+t,jqm:b.jqModal,overlay:b.overlay,modal:b.modal});Q||a(".jqmOverlay").click(function(){if(!n())return false;a.jgrid.hideModal("#"+m.themodal,{gb:"#gbox_"+t,jqm:b.jqModal,onClose:d[c.p.id].onClose});return false});J&&J(a("#"+o));a(".fm-button","#"+m.themodal).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});a("#sData","#"+i+"_2").click(function(){h={};O={};a("#FormError","#"+i).hide(); -e();if(h[c.p.id+"_id"]=="_empty")B();else if(b.checkOnSubmit===true){N=a.extend({},h,O);if(U=w(N,d[c.p.id]._savedData)){a("#"+o).data("disabled",true);a(".confirm","#"+m.themodal).show()}else B()}else B();return false});a("#cData","#"+i+"_2").click(function(){if(!n())return false;a.jgrid.hideModal("#"+m.themodal,{gb:"#gbox_"+t,jqm:b.jqModal,onClose:d[c.p.id].onClose});return false});a("#nData","#"+i+"_2").click(function(){if(!n())return false;a("#FormError","#"+i).hide();var g=M();g[0]=parseInt(g[0], -10);if(g[0]!=-1&&g[1][g[0]+1]){if(a.isFunction(b.onclickPgButtons))b.onclickPgButtons("next",a("#"+o),g[1][g[0]]);x(g[1][g[0]+1],c,o);a(c).jqGrid("setSelection",g[1][g[0]+1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("next",a("#"+o),g[1][g[0]+1]);s(g[0]+1,g[1].length-1)}return false});a("#pData","#"+i+"_2").click(function(){if(!n())return false;a("#FormError","#"+i).hide();var g=M();if(g[0]!=-1&&g[1][g[0]-1]){if(a.isFunction(b.onclickPgButtons))b.onclickPgButtons("prev",a("#"+o), -g[1][g[0]]);x(g[1][g[0]-1],c,o);a(c).jqGrid("setSelection",g[1][g[0]-1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("prev",a("#"+o),g[1][g[0]-1]);s(g[0]-1,g[1].length-1)}return false})}H=M();s(H[0],H[1].length-1)}})},viewGridRow:function(f,b){b=a.extend({top:0,left:0,width:0,height:"auto",dataheight:"auto",modal:false,overlay:30,drag:true,resize:true,jqModal:true,closeOnEscape:false,labelswidth:"30%",closeicon:[],navkeys:[false,38,40],onClose:null,beforeShowForm:null,beforeInitData:null, -viewPagerButtons:true},a.jgrid.view,b||{});return this.each(function(){function e(){if(b.closeOnEscape===true||b.navkeys[0]===true)setTimeout(function(){a(".ui-jqdialog-titlebar-close","#"+M.modalhead).focus()},0)}function q(l,y,h,O){for(var N,U,Q,K=0,V,W,$=[],Z=false,aa="  ",ba="",g=["integer","number","currency"],k=0,v=0,p,E,D, -z=1;z<=O;z++)ba+=z==1?aa:"  ";a(y.p.colModel).each(function(){U=this.editrules&&this.editrules.edithidden===true?false:this.hidden===true?true:false;if(!U&&this.align==="right")if(this.formatter&&a.inArray(this.formatter,g)!==-1)k=Math.max(k,parseInt(this.width,10));else v=Math.max(v,parseInt(this.width,10))});p=k!==0?k:v!==0?v:0;Z=a(y).jqGrid("getInd",l);a(y.p.colModel).each(function(L){N= -this.name;E=false;W=(U=this.editrules&&this.editrules.edithidden===true?false:this.hidden===true?true:false)?"style='display:none'":"";D=typeof this.viewable!="boolean"?true:this.viewable;if(N!=="cb"&&N!=="subgrid"&&N!=="rn"&&D){V=Z===false?"":N==y.p.ExpandColumn&&y.p.treeGrid===true?a("td:eq("+L+")",y.rows[Z]).text():a("td:eq("+L+")",y.rows[Z]).html();E=this.align==="right"&&p!==0?true:false;a.extend({},this.editoptions||{},{id:N,name:N});var r=a.extend({},{rowabove:false,rowcontent:""},this.formoptions|| -{}),R=parseInt(r.rowpos,10)||K+1,F=parseInt((parseInt(r.colpos,10)||1)*2,10);if(r.rowabove){var T=a(""+r.rowcontent+"");a(h).append(T);T[0].rp=R}Q=a(h).find("tr[rowpos="+R+"]");if(Q.length===0){Q=a("").addClass("FormData").attr("id","trv_"+N);a(Q).append(ba);a(h).append(Q);Q[0].rp=R}a("td:eq("+(F-2)+")",Q[0]).html(""+(typeof r.label==="undefined"?y.p.colNames[L]:r.label)+"");a("td:eq("+(F-1)+")",Q[0]).append(""+ -V+"").attr("id","v_"+N);E&&a("td:eq("+(F-1)+") span",Q[0]).css({"text-align":"right",width:p+"px"});$[K]=L;K++}});if(K>0){l=a("");l[0].rp=K+99;a(h).append(l)}return $}function x(l,y){var h,O,N=0,U,Q;if(Q=a(y).jqGrid("getInd",l,true)){a("td",Q).each(function(K){h=y.p.colModel[K].name;O=y.p.colModel[K].editrules&& -y.p.colModel[K].editrules.edithidden===true?false:y.p.colModel[K].hidden===true?true:false;if(h!=="cb"&&h!=="subgrid"&&h!=="rn"){U=h==y.p.ExpandColumn&&y.p.treeGrid===true?a(this).text():a(this).html();a.extend({},y.p.colModel[K].editoptions||{});h=a.jgrid.jqID("v_"+h);a("#"+h+" span","#"+s).html(U);O&&a("#"+h,"#"+s).parents("tr:first").hide();N++}});N>0&&a("#id_g","#"+s).val(l)}}function G(l,y){l===0?a("#pData","#"+s+"_2").addClass("ui-state-disabled"):a("#pData","#"+s+"_2").removeClass("ui-state-disabled"); -l==y?a("#nData","#"+s+"_2").addClass("ui-state-disabled"):a("#nData","#"+s+"_2").removeClass("ui-state-disabled")}function B(){var l=a(w).jqGrid("getDataIDs"),y=a("#id_g","#"+s).val();return[a.inArray(y,l),l]}var w=this;if(w.grid&&f){var n=w.p.id,j="ViewGrid_"+n,s="ViewTbl_"+n,M={themodal:"viewmod"+n,modalhead:"viewhd"+n,modalcontent:"viewcnt"+n,scrollelm:j},c=a.isFunction(b.beforeInitData)?b.beforeInitData:false,t=true,o=1,i=0;if(a("#"+M.themodal).html()!==null){if(c){t=c(a("#"+j));if(typeof t== -"undefined")t=true}if(t===false)return;a(".ui-jqdialog-title","#"+M.modalhead).html(b.caption);a("#FormError","#"+s).hide();x(f,w);a.isFunction(b.beforeShowForm)&&b.beforeShowForm(a("#"+j));a.jgrid.viewModal("#"+M.themodal,{gbox:"#gbox_"+n,jqm:b.jqModal,jqM:false,overlay:b.overlay,modal:b.modal});e()}else{var m=isNaN(b.dataheight)?b.dataheight:b.dataheight+"px";m=a("
");var H=a("
");if(c){t=c(a("#"+j));if(typeof t=="undefined")t=true}if(t===false)return;a(w.p.colModel).each(function(){var l=this.formoptions;o=Math.max(o,l?l.colpos||0:0);i=Math.max(i,l?l.rowpos||0:0)});a(m).append(H);q(f,w,H,o);c=w.p.direction=="rtl"?true:false;t=""; -var J="",u=""+b.bClose+"";if(i>0){var C=[];a.each(a(H)[0].rows,function(l,y){C[l]=y});C.sort(function(l,y){if(l.rp>y.rp)return 1;if(l.rp").append(m).append("
"+u+"
");a.jgrid.createModal(M,m,b,"#gview_"+w.p.id,a("#gview_"+w.p.id)[0]);if(c){a("#pData, #nData","#"+s+"_2").css("float","right");a(".EditButton","#"+s+"_2").css("text-align","left")}b.viewPagerButtons||a("#pData, #nData","#"+s+"_2").hide(); -m=null;a("#"+M.themodal).keydown(function(l){if(l.which===27){A&&a.jgrid.hideModal(this,{gb:b.gbox,jqm:b.jqModal,onClose:b.onClose});return false}if(b.navkeys[0]===true){if(l.which===b.navkeys[1]){a("#pData","#"+s+"_2").trigger("click");return false}if(l.which===b.navkeys[2]){a("#nData","#"+s+"_2").trigger("click");return false}}});b.closeicon=a.extend([true,"left","ui-icon-close"],b.closeicon);if(b.closeicon[0]===true)a("#cData","#"+s+"_2").addClass(b.closeicon[1]=="right"?"fm-button-icon-right": -"fm-button-icon-left").append("");a.isFunction(b.beforeShowForm)&&b.beforeShowForm(a("#"+j));a.jgrid.viewModal("#"+M.themodal,{gbox:"#gbox_"+n,jqm:b.jqModal,modal:b.modal});a(".fm-button:not(.ui-state-disabled)","#"+s+"_2").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});e();a("#cData","#"+s+"_2").click(function(){a.jgrid.hideModal("#"+M.themodal,{gb:"#gbox_"+n,jqm:b.jqModal,onClose:b.onClose}); -return false});a("#nData","#"+s+"_2").click(function(){a("#FormError","#"+s).hide();var l=B();l[0]=parseInt(l[0],10);if(l[0]!=-1&&l[1][l[0]+1]){if(a.isFunction(b.onclickPgButtons))b.onclickPgButtons("next",a("#"+j),l[1][l[0]]);x(l[1][l[0]+1],w);a(w).jqGrid("setSelection",l[1][l[0]+1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("next",a("#"+j),l[1][l[0]+1]);G(l[0]+1,l[1].length-1)}e();return false});a("#pData","#"+s+"_2").click(function(){a("#FormError","#"+s).hide();var l=B();if(l[0]!= --1&&l[1][l[0]-1]){if(a.isFunction(b.onclickPgButtons))b.onclickPgButtons("prev",a("#"+j),l[1][l[0]]);x(l[1][l[0]-1],w);a(w).jqGrid("setSelection",l[1][l[0]-1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("prev",a("#"+j),l[1][l[0]-1]);G(l[0]-1,l[1].length-1)}e();return false})}m=B();G(m[0],m[1].length-1)}})},delGridRow:function(f,b){b=a.extend({top:0,left:0,width:240,height:"auto",dataheight:"auto",modal:false,overlay:30,drag:true,resize:true,url:"",mtype:"POST",reloadAfterSubmit:true, -beforeShowForm:null,beforeInitData: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||{});d[a(this)[0].p.id]=b;return this.each(function(){var e=this;if(e.grid)if(f){var q=a.isFunction(d[e.p.id].beforeShowForm),x=a.isFunction(d[e.p.id].afterShowForm),G=a.isFunction(d[e.p.id].beforeInitData)?d[e.p.id].beforeInitData: -false,B=e.p.id,w={},n=true,j="DelTbl_"+B,s,M,c,t,o={themodal:"delmod"+B,modalhead:"delhd"+B,modalcontent:"delcnt"+B,scrollelm:j};if(jQuery.isArray(f))f=f.join();if(a("#"+o.themodal).html()!==null){if(G){n=G(a("#"+j));if(typeof n=="undefined")n=true}if(n===false)return;a("#DelData>td","#"+j).text(f);a("#DelError","#"+j).hide();if(d[e.p.id].processing===true){d[e.p.id].processing=false;a("#dData","#"+j).removeClass("ui-state-active")}q&&d[e.p.id].beforeShowForm(a("#"+j));a.jgrid.viewModal("#"+o.themodal, -{gbox:"#gbox_"+B,jqm:d[e.p.id].jqModal,jqM:false,overlay:d[e.p.id].overlay,modal:d[e.p.id].modal})}else{var i=isNaN(d[e.p.id].dataheight)?d[e.p.id].dataheight:d[e.p.id].dataheight+"px";i="
";i+="";i+="";i+="";i+='";i+="
'+ -d[e.p.id].msg+"
 
";i+="

"+(""+b.bSubmit+"")+" "+(""+b.bCancel+ -"")+"
";b.gbox="#gbox_"+B;a.jgrid.createModal(o,i,b,"#gview_"+e.p.id,a("#gview_"+e.p.id)[0]);if(G){n=G(a("#"+j));if(typeof n=="undefined")n=true}if(n===false)return;a(".fm-button","#"+j+"_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"],d[e.p.id].delicon);b.cancelicon=a.extend([true,"left","ui-icon-cancel"],d[e.p.id].cancelicon);if(b.delicon[0]===true)a("#dData", -"#"+j+"_2").addClass(b.delicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("");if(b.cancelicon[0]===true)a("#eData","#"+j+"_2").addClass(b.cancelicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("");a("#dData","#"+j+"_2").click(function(){var m=[true,""];w={};var H=a("#DelData>td","#"+j).text();if(a.isFunction(d[e.p.id].onclickSubmit))w=d[e.p.id].onclickSubmit(d[e.p.id], -H)||{};if(a.isFunction(d[e.p.id].beforeSubmit))m=d[e.p.id].beforeSubmit(H);if(m[0]&&!d[e.p.id].processing){d[e.p.id].processing=true;a(this).addClass("ui-state-active");c=e.p.prmNames;s=a.extend({},d[e.p.id].delData,w);t=c.oper;s[t]=c.deloper;M=c.id;H=H.split(",");for(var J in H)if(H.hasOwnProperty(J))H[J]=a.jgrid.stripPref(e.p.idPrefix,H[J]);s[M]=H.join();J=a.extend({url:d[e.p.id].url?d[e.p.id].url:a(e).jqGrid("getGridParam","editurl"),type:d[e.p.id].mtype,data:a.isFunction(d[e.p.id].serializeDelData)? -d[e.p.id].serializeDelData(s):s,complete:function(u,C){if(C!="success"){m[0]=false;m[1]=a.isFunction(d[e.p.id].errorTextFormat)?d[e.p.id].errorTextFormat(u):C+" Status: '"+u.statusText+"'. Error code: "+u.status}else if(a.isFunction(d[e.p.id].afterSubmit))m=d[e.p.id].afterSubmit(u,s);if(m[0]===false){a("#DelError>td","#"+j).html(m[1]);a("#DelError","#"+j).show()}else{if(d[e.p.id].reloadAfterSubmit&&e.p.datatype!="local")a(e).trigger("reloadGrid");else{var A=[];A=H.split(",");if(e.p.treeGrid===true)try{a(e).jqGrid("delTreeNode", -e.p.idPrefix+A[0])}catch(l){}else for(var y=0;ytd","#"+j).html(m[1]);a("#DelError","#"+j).show()}return false});a("#eData","#"+j+"_2").click(function(){a.jgrid.hideModal("#"+ -o.themodal,{gb:"#gbox_"+B,jqm:d[e.p.id].jqModal,onClose:d[e.p.id].onClose});return false});q&&d[e.p.id].beforeShowForm(a("#"+j));a.jgrid.viewModal("#"+o.themodal,{gbox:"#gbox_"+B,jqm:d[e.p.id].jqModal,overlay:d[e.p.id].overlay,modal:d[e.p.id].modal})}x&&d[e.p.id].afterShowForm(a("#"+j));d[e.p.id].closeOnEscape===true&&setTimeout(function(){a(".ui-jqdialog-titlebar-close","#"+o.modalhead).focus()},0)}})},navGrid:function(f,b,e,q,x,G,B){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,alertwidth:200,alertheight:"auto",alerttop:null,alertleft:null,alertzIndex:null},a.jgrid.nav,b||{});return this.each(function(){if(!this.nav){var w={themodal:"alertmod",modalhead:"alerthd",modalcontent:"alertcnt"},n=this,j;if(!(!n.grid|| -typeof f!="string")){if(a("#"+w.themodal).html()===null){if(!b.alerttop&&!b.alertleft){if(typeof window.innerWidth!="undefined"){b.alertleft=window.innerWidth;b.alerttop=window.innerHeight}else if(typeof document.documentElement!="undefined"&&typeof document.documentElement.clientWidth!="undefined"&&document.documentElement.clientWidth!==0){b.alertleft=document.documentElement.clientWidth;b.alerttop=document.documentElement.clientHeight}else{b.alertleft=1024;b.alerttop=768}b.alertleft=b.alertleft/ -2-parseInt(b.alertwidth,10)/2;b.alerttop=b.alerttop/2-25}a.jgrid.createModal(w,"
"+b.alerttext+"
",{gbox:"#gbox_"+n.p.id,jqModal:true,drag:true,resize:true,caption:b.alertcap,top:b.alerttop,left:b.alertleft,width:b.alertwidth,height:b.alertheight,closeOnEscape:b.closeOnEscape,zIndex:b.alertzIndex},"","",true)}var s=1;if(b.cloneToTop&&n.p.toppager)s=2;for(var M=0;M"), -t,o;if(M===0){t=f;o=n.p.id;if(t==n.p.toppager){o+="_top";s=1}}else{t=n.p.toppager;o=n.p.id+"_top"}n.p.direction=="rtl"&&a(c).attr("dir","rtl").css("float","right");if(b.add){q=q||{};j=a("");a(j).append("
"+b.addtext+"
");a("tr",c).append(j);a(j,c).attr({title:b.addtitle||"",id:q.id||"add_"+o}).click(function(){a(this).hasClass("ui-state-disabled")||(a.isFunction(b.addfunc)?b.addfunc(): -a(n).jqGrid("editGridRow","new",q));return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});j=null}if(b.edit){j=a("");e=e||{};a(j).append("
"+b.edittext+"
");a("tr",c).append(j);a(j,c).attr({title:b.edittitle||"",id:e.id||"edit_"+o}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var i= -n.p.selrow;if(i)a.isFunction(b.editfunc)?b.editfunc(i):a(n).jqGrid("editGridRow",i,e);else{a.jgrid.viewModal("#"+w.themodal,{gbox:"#gbox_"+n.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")});j=null}if(b.view){j=a("");B=B||{};a(j).append("
"+b.viewtext+ -"
");a("tr",c).append(j);a(j,c).attr({title:b.viewtitle||"",id:B.id||"view_"+o}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var i=n.p.selrow;if(i)a.isFunction(b.viewfunc)?b.viewfunc(i):a(n).jqGrid("viewGridRow",i,B);else{a.jgrid.viewModal("#"+w.themodal,{gbox:"#gbox_"+n.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")});j=null}if(b.del){j= -a("");x=x||{};a(j).append("
"+b.deltext+"
");a("tr",c).append(j);a(j,c).attr({title:b.deltitle||"",id:x.id||"del_"+o}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var i;if(n.p.multiselect){i=n.p.selarrrow;if(i.length===0)i=null}else i=n.p.selrow;if(i)"function"==typeof b.delfunc?b.delfunc(i):a(n).jqGrid("delGridRow",i,x);else{a.jgrid.viewModal("#"+w.themodal,{gbox:"#gbox_"+ -n.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")});j=null}if(b.add||b.edit||b.del||b.view)a("tr",c).append("");if(b.search){j=a("");G=G||{};a(j).append("
"+b.searchtext+"
");a("tr",c).append(j);a(j,c).attr({title:b.searchtitle||"",id:G.id||"search_"+o}).click(function(){a(this).hasClass("ui-state-disabled")||a(n).jqGrid("searchGrid",G);return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});G.showOnLoad&&G.showOnLoad===true&&a(j,c).click();j=null}if(b.refresh){j=a("");a(j).append("
"+b.refreshtext+"
");a("tr",c).append(j);a(j,c).attr({title:b.refreshtitle||"",id:"refresh_"+o}).click(function(){if(!a(this).hasClass("ui-state-disabled")){a.isFunction(b.beforeRefresh)&&b.beforeRefresh();n.p.search=false;try{var i=n.p.id;n.p.postData.filters="";a("#fbox_"+i).jqFilter("resetFilter");a.isFunction(n.clearToolbar)&&n.clearToolbar(false)}catch(m){}switch(b.refreshstate){case "firstpage":a(n).trigger("reloadGrid",[{page:1}]);break;case "current":a(n).trigger("reloadGrid", -[{current:true}])}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")});j=null}j=a(".ui-jqgrid").css("font-size")||"11px";a("body").append("");j=a(c).clone().appendTo("#testpg2").width();a("#testpg2").remove();a(t+"_"+b.position,t).append(c); -if(n.p._nvtd){if(j>n.p._nvtd[0]){a(t+"_"+b.position,t).width(j);n.p._nvtd[0]=j}n.p._nvtd[1]=j}c=j=j=null;this.nav=true}}}})},navButtonAdd:function(f,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(f.indexOf("#")!==0)f="#"+f;var e=a(".navtable",f)[0],q=this;if(e)if(!(b.id&&a("#"+b.id,e).html()!==null)){var x=a("");b.buttonicon.toString().toUpperCase()=="NONE"?a(x).addClass("ui-pg-button ui-corner-all").append("
"+ -b.caption+"
"):a(x).addClass("ui-pg-button ui-corner-all").append("
"+b.caption+"
");b.id&&a(x).attr("id",b.id);if(b.position=="first")e.rows[0].cells.length===0?a("tr",e).append(x):a("tr td:eq(0)",e).before(x);else a("tr",e).append(x);a(x,e).attr("title",b.title||"").click(function(G){a(this).hasClass("ui-state-disabled")||a.isFunction(b.onClickButton)&&b.onClickButton.call(q,G);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(f,b){b=a.extend({sepclass:"ui-separator",sepcontent:""},b||{});return this.each(function(){if(this.grid){if(f.indexOf("#")!==0)f="#"+f;var e=a(".navtable",f)[0];if(e){var q=""+b.sepcontent+"";a("tr",e).append(q)}}})},GridToForm:function(f,b){return this.each(function(){var e=this; -if(e.grid){var q=a(e).jqGrid("getRowData",f);if(q)for(var x in q)a("[name="+a.jgrid.jqID(x)+"]",b).is("input:radio")||a("[name="+a.jgrid.jqID(x)+"]",b).is("input:checkbox")?a("[name="+a.jgrid.jqID(x)+"]",b).each(function(){if(a(this).val()==q[x])a(this)[e.p.useProp?"prop":"attr"]("checked",true);else a(this)[e.p.useProp?"prop":"attr"]("checked",false)}):a("[name="+a.jgrid.jqID(x)+"]",b).val(q[x])}})},FormToGrid:function(f,b,e,q){return this.each(function(){if(this.grid){e||(e="set");q||(q="first"); -var x=a(b).serializeArray(),G={};a.each(x,function(B,w){G[w.name]=w.value});if(e=="add")a(this).jqGrid("addRowData",f,G,q);else e=="set"&&a(this).jqGrid("setRowData",f,G)}})}})})(jQuery); -(function(c){c.fn.jqFilter=function(k){if(typeof k==="string"){var w=c.fn.jqFilter[k];if(!w)throw"jqFilter - No such method: "+k;var B=c.makeArray(arguments).slice(1);return w.apply(this,B)}var o=c.extend(true,{filter:null,columns:[],onChange:null,afterRedraw:null,checkValues:null,error:false,errmsg:"",errorcheck:true,showQuery:true,sopt:null,ops:[{name:"eq",description:"equal",operator:"="},{name:"ne",description:"not equal",operator:"<>"},{name:"lt",description:"less",operator:"<"},{name:"le",description:"less or equal", -operator:"<="},{name:"gt",description:"greater",operator:">"},{name:"ge",description:"greater or equal",operator:">="},{name:"bw",description:"begins with",operator:"LIKE"},{name:"bn",description:"does not begin with",operator:"NOT LIKE"},{name:"in",description:"in",operator:"IN"},{name:"ni",description:"not in",operator:"NOT IN"},{name:"ew",description:"ends with",operator:"LIKE"},{name:"en",description:"does not end with",operator:"NOT LIKE"},{name:"cn",description:"contains",operator:"LIKE"},{name:"nc", -description:"does not contain",operator:"NOT LIKE"},{name:"nu",description:"is null",operator:"IS NULL"},{name:"nn",description:"is not null",operator:"IS NOT NULL"}],numopts:["eq","ne","lt","le","gt","ge","nu","nn","in","ni"],stropts:["eq","ne","bw","bn","ew","en","cn","nc","nu","nn","in","ni"],_gridsopt:[],groupOps:[{op:"AND",text:"AND"},{op:"OR",text:"OR"}],groupButton:true,ruleButtons:true,direction:"ltr"},k||{});return this.each(function(){if(!this.filter){this.p=o;if(this.p.filter===null||this.p.filter=== -undefined)this.p.filter={groupOp:this.p.groupOps[0].op,rules:[],groups:[]};var q,x=this.p.columns.length,j,y=/msie/i.test(navigator.userAgent)&&!window.opera;if(this.p._gridsopt.length)for(q=0;q");var z=function(d,g){var a=[true,""];if(c.isFunction(g.searchrules))a= -g.searchrules(d,g);else if(c.jgrid&&c.jgrid.checkValues)try{a=c.jgrid.checkValues(d,-1,null,g.searchrules,g.label)}catch(b){}if(a&&a.length&&a[0]===false){o.error=!a[0];o.errmsg=a[1]}};this.onchange=function(){this.p.error=false;this.p.errmsg="";return c.isFunction(this.p.onChange)?this.p.onChange.call(this,this.p):false};this.reDraw=function(){c("table.group:first",this).remove();var d=this.createTableForGroup(o.filter,null);c(this).append(d);c.isFunction(this.p.afterRedraw)&&this.p.afterRedraw.call(this, -this.p)};this.createTableForGroup=function(d,g){var a=this,b,e=c("
"),i="left";if(this.p.direction=="rtl"){i="right";e.attr("dir","rtl")}g===null&&e.append("");var f=c("");e.append(f);i=c("");f.append(i);if(this.p.ruleButtons===true){var h=c(""); -i.append(h);f="";var l;for(b=0;b"+a.p.groupOps[b].text+""}h.append(f).bind("change",function(){d.groupOp=c(h).val();a.onchange()})}f="";if(this.p.groupButton){f=c("");f.bind("click",function(){if(d.groups===undefined)d.groups=[];d.groups.push({groupOp:o.groupOps[0].op,rules:[], -groups:[]});a.reDraw();a.onchange();return false})}i.append(f);if(this.p.ruleButtons===true){f=c("");var m;f.bind("click",function(){if(d.rules===undefined)d.rules=[];for(b=0;b");i.append(f);f.bind("click",function(){for(b=0;b");e.append(i);f=c(""); -i.append(f);f=c("");f.append(this.createTableForGroup(d.groups[b],d));i.append(f)}if(d.groupOp===undefined)d.groupOp=a.p.groupOps[0].op;if(d.rules!==undefined)for(b=0;b"),e,i,f,h,l="",m;b.append("");var n=c("");b.append(n);var s=c(""),p,t=[];n.append(s);s.bind("change", -function(){d.field=c(s).val();f=c(this).parents("tr:first");for(e=0;e"+a.p.ops[p].description+"";A++}}c(".selectopts",f).empty().append(u);c(".selectopts",f)[0].selectedIndex=0;if(c.browser.msie&&c.browser.version<9){u=parseInt(c("select.selectopts",f)[0].offsetWidth)+1;c(".selectopts",f).width(u);c(".selectopts",f).css("width","auto")}c(".data",f).empty().append(r);c(".input-elm", -f).bind("change",function(){d.data=c(this).val();a.onchange()});setTimeout(function(){d.data=c(r).val();a.onchange()},0)}});for(e=n=0;e"+a.p.columns[e].label+""}}s.append(l);l=c(""); -b.append(l);h=o.columns[n];h.searchoptions.id=c.jgrid.randId();if(y&&h.inputtype==="text")if(!h.searchoptions.size)h.searchoptions.size=10;n=c.jgrid.createEl(h.inputtype,h.searchoptions,d.data,true,a.p.ajaxSelectOptions,true);var v=c("");l.append(v);v.bind("change",function(){d.op=c(v).val();f=c(this).parents("tr:first");var r=c(".input-elm",f)[0];if(d.op==="nu"||d.op==="nn"){d.data="";r.value="";r.setAttribute("readonly","true");r.setAttribute("disabled","true")}else{r.removeAttribute("readonly"); -r.removeAttribute("disabled")}a.onchange()});i=h.searchoptions.sopt?h.searchoptions.sopt:a.p.sopt?a.p.sopt:h.searchtype==="string"?o.stropts:a.p.numopts;l="";c.each(a.p.ops,function(){t.push(this.name)});for(e=0;e"+a.p.ops[p].description+""}}v.append(l);l=c("");b.append(l);l.append(n);c(n).addClass("input-elm").bind("change",function(){d.data= -c(this).val();a.onchange()});l=c("");b.append(l);if(this.p.ruleButtons===true){n=c("");l.append(n);n.bind("click",function(){for(e=0;e1)g+=" "+d.groupOp+" ";try{g+=this.getStringForGroup(d.groups[a])}catch(b){alert(b)}}if(d.rules!== -undefined)try{for(a=0;a1)g+=" "+d.groupOp+" ";g+=this.getStringForRule(d.rules[a])}}catch(e){alert(e)}g+=")";return g==="()"?"":g};this.getStringForRule=function(d){var g="",a="",b,e;for(b=0;b1)b+=a.groupOp==="OR"?" || ":" && ";b+=d(a.groups[e])}if(a.rules!==undefined)for(e=0;e1)b+=a.groupOp==="OR"?" || ":" && ";var i=a.rules[e];if(g.p.errorcheck){var f=void 0,h=void 0;for(f=0;f0){v.id=c;i.p.savedRow.push(v);a(r).attr("editable","1");a("td:eq("+x+") input",r).focus();m.keys===true&&a(r).bind("keydown",function(k){if(k.keyCode===27){a(i).jqGrid("restoreRow", -c,f);return false}if(k.keyCode===13){if(k.target.tagName=="TEXTAREA")return true;a(i).jqGrid("saveRow",c,m);return false}});a.isFunction(m.oneditfunc)&&m.oneditfunc.call(i,c)}}}})},saveRow:function(c,d,b,h,l,n,s){var o=a.makeArray(arguments).slice(1),f={};if(a.jgrid.realType(o[0])==="Object")f=o[0];else{if(a.isFunction(d))f.successfunc=d;if(typeof b!=="undefined")f.url=b;if(typeof h!=="undefined")f.extraparam=h;if(a.isFunction(l))f.aftersavefunc=l;if(a.isFunction(n))f.errorfunc=n;if(a.isFunction(s))f.afterrestorefunc= -s}f=a.extend(true,{successfunc:null,url:null,extraparam:{},aftersavefunc:null,errorfunc:null,afterrestorefunc:null,restoreAfterError:true,mtype:"POST"},a.jgrid.inlineEdit,f);var m=false,g=this[0],i,e={},q={},w={},x,v,r;if(!g.grid)return m;r=a(g).jqGrid("getInd",c,true);if(r===false)return m;o=a(r).attr("editable");f.url=f.url?f.url:g.p.editurl;if(o==="1"){var j;a('td[role="gridcell"]',r).each(function(p){j=g.p.colModel[p];i=j.name;if(i!="cb"&&i!="subgrid"&&j.editable===true&&i!="rn"&&!a(this).hasClass("not-editable-cell")){switch(j.edittype){case "checkbox":var t= -["Yes","No"];if(j.editoptions)t=j.editoptions.value.split(":");e[i]=a("input",this).is(":checked")?t[0]:t[1];break;case "text":case "password":case "textarea":case "button":e[i]=a("input, textarea",this).val();break;case "select":if(j.editoptions.multiple){t=a("select",this);var u=[];e[i]=a(t).val();e[i]=e[i]?e[i].join(","):"";a("select option:selected",this).each(function(B,C){u[B]=a(C).text()});q[i]=u.join(",")}else{e[i]=a("select option:selected",this).val();q[i]=a("select option:selected",this).text()}if(j.formatter&& -j.formatter=="select")q={};break;case "custom":try{if(j.editoptions&&a.isFunction(j.editoptions.custom_value)){e[i]=j.editoptions.custom_value.call(g,a(".customelement",this),"get");if(e[i]===undefined)throw"e2";}else throw"e1";}catch(y){y=="e1"&&a.jgrid.info_dialog(a.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,a.jgrid.edit.bClose);y=="e2"?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, -y.message,a.jgrid.edit.bClose)}}v=a.jgrid.checkValues(e[i],p,g);if(v[0]===false){v[1]=e[i]+" "+v[1];return false}if(g.p.autoencode)e[i]=a.jgrid.htmlEncode(e[i]);if(f.url!=="clientArray"&&j.editoptions&&j.editoptions.NullIfEmpty===true)if(e[i]==="")w[i]="null"}});if(v[0]===false){try{var k=a.jgrid.findPos(a("#"+a.jgrid.jqID(c),g.grid.bDiv)[0]);a.jgrid.info_dialog(a.jgrid.errors.errcap,v[1],a.jgrid.edit.bClose,{left:k[0],top:k[1]})}catch(z){alert(v[1])}return m}var A;o=g.p.prmNames;A=o.oper;k=o.id; -if(e){e[A]=o.editoper;e[k]=c;if(typeof g.p.inlineData=="undefined")g.p.inlineData={};e=a.extend({},e,g.p.inlineData,f.extraparam)}if(f.url=="clientArray"){e=a.extend({},e,q);g.p.autoencode&&a.each(e,function(p,t){e[p]=a.jgrid.htmlDecode(t)});k=a(g).jqGrid("setRowData",c,e);a(r).attr("editable","0");for(o=0;o=0&&g.p.savedRow.splice(x,1);a.isFunction(f.aftersavefunc)&&f.aftersavefunc.call(g,c,k);m=true;a(r).unbind("keydown")}else{a("#lui_"+ -g.p.id).show();w=a.extend({},e,w);w[k]=a.jgrid.stripPref(g.p.idPrefix,w[k]);a.ajax(a.extend({url:f.url,data:a.isFunction(g.p.serializeRowData)?g.p.serializeRowData.call(g,w):w,type:f.mtype,async:false,complete:function(p,t){a("#lui_"+g.p.id).hide();if(t==="success"){var u=true,y;if(a.isFunction(f.successfunc)){y=f.successfunc.call(g,p);if(a.isArray(y)){u=y[0];e=y[1]?y[1]:e}else u=y}if(u===true){g.p.autoencode&&a.each(e,function(B,C){e[B]=a.jgrid.htmlDecode(C)});e=a.extend({},e,q);a(g).jqGrid("setRowData", -c,e);a(r).attr("editable","0");for(u=0;u=0&&g.p.savedRow.splice(x,1);a.isFunction(f.aftersavefunc)&&f.aftersavefunc.call(g,c,p);m=true;a(r).unbind("keydown")}else{a.isFunction(f.errorfunc)&&f.errorfunc.call(g,c,p,t);f.restoreAfterError===true&&a(g).jqGrid("restoreRow",c,f.afterrestorefunc)}}},error:function(p,t){a("#lui_"+g.p.id).hide();if(a.isFunction(f.errorfunc))f.errorfunc.call(g,c,p,t);else try{a.jgrid.info_dialog(a.jgrid.errors.errcap, -'
'+p.responseText+"
",a.jgrid.edit.bClose,{buttonalign:"right"})}catch(u){alert(p.responseText)}f.restoreAfterError===true&&a(g).jqGrid("restoreRow",c,f.afterrestorefunc)}},a.jgrid.ajaxOptions,g.p.ajaxRowOptions||{}))}}return m},restoreRow:function(c,d){var b=a.makeArray(arguments).slice(1),h={};if(a.jgrid.realType(b[0])==="Object")h=b[0];else if(a.isFunction(d))h.afterrestorefunc=d;h=a.extend(true,a.jgrid.inlineEdit,h);return this.each(function(){var l=this,n,s,o= -{};if(l.grid){s=a(l).jqGrid("getInd",c,true);if(s!==false){for(var f=0;f=0){if(a.isFunction(a.fn.datepicker))try{a("input.hasDatepicker","#"+a.jgrid.jqID(s.id)).datepicker("hide")}catch(m){}a.each(l.p.colModel,function(){if(this.editable===true&&this.name in l.p.savedRow[n]&&!a(this).hasClass("not-editable-cell"))o[this.name]=l.p.savedRow[n][this.name]});a(l).jqGrid("setRowData",c,o);a(s).attr("editable","0").unbind("keydown");l.p.savedRow.splice(n, -1);a("#"+a.jgrid.jqID(c),"#"+a.jgrid.jqID(l.p.id)).hasClass("jqgrid-new-row")&&setTimeout(function(){a(l).jqGrid("delRowData",c)},0)}a.isFunction(h.afterrestorefunc)&&h.afterrestorefunc.call(l,c)}}})},addRow:function(c){c=a.extend(true,{rowID:"new_row",initdata:{},position:"first",useDefValues:true,useFormatter:false,addRowParams:{extraparam:{}}},c||{});return this.each(function(){if(this.grid){var d=this;c.useDefValues===true&&a(d.p.colModel).each(function(){if(this.editoptions&&this.editoptions.defaultValue){var h= -this.editoptions.defaultValue;h=a.isFunction(h)?h.call(d):h;c.initdata[this.name]=h}});a(d).jqGrid("addRowData",c.rowID,c.initdata,c.position);a("#"+a.jgrid.jqID(c.rowID),"#"+a.jgrid.jqID(d.p.id)).addClass("jqgrid-new-row");if(c.useFormatter)a("#"+a.jgrid.jqID(c.rowID)+" .ui-inline-edit","#"+a.jgrid.jqID(d.p.id)).click();else{var b=d.p.prmNames;c.addRowParams.extraparam[b.oper]=b.addoper;a(d).jqGrid("editRow",c.rowID,c.addRowParams);a(d).jqGrid("setSelection",c.rowID)}}})},inlineNav:function(c,d){d= -a.extend({edit:true,editicon:"ui-icon-pencil",add:true,addicon:"ui-icon-plus",save:true,saveicon:"ui-icon-disk",cancel:true,cancelicon:"ui-icon-cancel",addParams:{useFormatter:false},editParams:{}},a.jgrid.nav,d||{});return this.each(function(){if(this.grid){var b=this;if(d.addParams.useFormatter===true){var h=b.p.colModel,l;for(l=0;l0){if(a===true)if(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("#"+c.p.knv).attr("tabindex","-1").focus()},0);i=c.p.colModel[f];h=i.name;if(!(h=="subgrid"||h=="cb"||h=="rn")){g=b("td:eq("+ -f+")",c.rows[d]);if(i.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{e=b.unformat(g,{rowId:c.rows[d].id,colModel:i},f)}catch(k){e=i.edittype&&i.edittype=="textarea"?b(g).text():b(g).html()}if(c.p.autoencode)e= -b.jgrid.htmlDecode(e);if(!i.edittype)i.edittype="text";c.p.savedRow.push({id:d,ic:f,name:h,v:e});if(e==" "||e==" "||e.length==1&&e.charCodeAt(0)==160)e="";if(b.isFunction(c.p.formatCell)){var j=c.p.formatCell.call(c,c.rows[d].id,h,e,d,f);if(j!==undefined)e=j}j=b.extend({},i.editoptions||{},{id:d+"_"+h,name:h});var m=b.jgrid.createEl(i.edittype,j,e,true,b.extend({},b.jgrid.ajaxOptions,c.p.ajaxSelectOptions||{}));b.isFunction(c.p.beforeEditCell)&&c.p.beforeEditCell.call(c,c.rows[d].id,h,e, -d,f);b(g).html("").append(m).attr("tabindex","0");window.setTimeout(function(){b(m).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,f):b("input.hasDatepicker",g).datepicker("hide");else b(c).jqGrid("restoreCell",d,f);l.keyCode===13&&b(c).jqGrid("saveCell",d,f);if(l.keyCode==9)if(c.grid.hDiv.loading)return false;else l.shiftKey?b(c).jqGrid("prevCell",d,f):b(c).jqGrid("nextCell", -d,f);l.stopPropagation()});b.isFunction(c.p.afterEditCell)&&c.p.afterEditCell.call(c,c.rows[d].id,h,e,d,f)}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)){e=g.html().replace(/\ \;/ig,"");c.p.onSelectCell.call(c, -c.rows[d].id,h,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||a.p.cellEdit!==true)){c=a.p.savedRow.length>=1?0:null;if(c!==null){var h=b("td:eq("+f+")",a.rows[d]),e,g,i=a.p.colModel[f],k=i.name,j=b.jgrid.jqID(k);switch(i.edittype){case "select":if(i.editoptions.multiple){j=b("#"+d+"_"+j,a.rows[d]);var m=[];if(e=b(j).val())e.join(",");else e="";b("option:selected",j).each(function(o,p){m[o]=b(p).text()});g=m.join(",")}else{e=b("#"+d+ -"_"+j+">option:selected",a.rows[d]).val();g=b("#"+d+"_"+j+">option:selected",a.rows[d]).text()}if(i.formatter)g=e;break;case "checkbox":var l=["Yes","No"];if(i.editoptions)l=i.editoptions.value.split(":");g=e=b("#"+d+"_"+j,a.rows[d]).is(":checked")?l[0]:l[1];break;case "password":case "text":case "textarea":case "button":g=e=b("#"+d+"_"+j,a.rows[d]).val();break;case "custom":try{if(i.editoptions&&b.isFunction(i.editoptions.custom_value)){e=i.editoptions.custom_value.call(a,b(".customelement",h),"get"); -if(e===undefined)throw"e2";else g=e}else throw"e1";}catch(q){q=="e1"&&b.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+b.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose);q=="e2"?b.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+b.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):b.jgrid.info_dialog(jQuery.jgrid.errors.errcap,q.message,jQuery.jgrid.edit.bClose)}}if(g!==a.p.savedRow[c].v){if(b.isFunction(a.p.beforeSaveCell))if(c=a.p.beforeSaveCell.call(a, -a.rows[d].id,k,e,d,f))g=e=c;var r=b.jgrid.checkValues(e,f,a);if(r[0]===true){c={};if(b.isFunction(a.p.beforeSubmitCell))(c=a.p.beforeSubmitCell.call(a,a.rows[d].id,k,e,d,f))||(c={});b("input.hasDatepicker",h).length>0&&b("input.hasDatepicker",h).datepicker("hide");if(a.p.cellsubmit=="remote")if(a.p.cellurl){var n={};if(a.p.autoencode)e=b.jgrid.htmlEncode(e);n[k]=e;l=a.p.prmNames;i=l.id;j=l.oper;n[i]=b.jgrid.stripPref(a.p.idPrefix,a.rows[d].id);n[j]=l.editoper;n=b.extend(c,n);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.call(a,n):n,type:"POST",complete:function(o,p){b("#lui_"+a.p.id).hide();a.grid.hDiv.loading=false;if(p=="success")if(b.isFunction(a.p.afterSubmitCell)){var s=a.p.afterSubmitCell.call(a,o,n.id,k,e,d,f);if(s[0]===true){b(h).empty();b(a).jqGrid("setCell",a.rows[d].id,f,g,false,false,true);b(h).addClass("dirty-cell");b(a.rows[d]).addClass("edited");b.isFunction(a.p.afterSaveCell)&& -a.p.afterSaveCell.call(a,a.rows[d].id,k,e,d,f);a.p.savedRow.splice(0,1)}else{b.jgrid.info_dialog(b.jgrid.errors.errcap,s[1],b.jgrid.edit.bClose);b(a).jqGrid("restoreCell",d,f)}}else{b(h).empty();b(a).jqGrid("setCell",a.rows[d].id,f,g,false,false,true);b(h).addClass("dirty-cell");b(a.rows[d]).addClass("edited");b.isFunction(a.p.afterSaveCell)&&a.p.afterSaveCell.call(a,a.rows[d].id,k,e,d,f);a.p.savedRow.splice(0,1)}},error:function(o,p){b("#lui_"+a.p.id).hide();a.grid.hDiv.loading=false;b.isFunction(a.p.errorCell)? -a.p.errorCell.call(a,o,p):b.jgrid.info_dialog(b.jgrid.errors.errcap,o.status+" : "+o.statusText+"
"+p,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){}if(a.p.cellsubmit=="clientArray"){b(h).empty();b(a).jqGrid("setCell",a.rows[d].id,f,g,false,false,true);b(h).addClass("dirty-cell");b(a.rows[d]).addClass("edited"); -b.isFunction(a.p.afterSaveCell)&&a.p.afterSaveCell.call(a,a.rows[d].id,k,e,d,f);a.p.savedRow.splice(0,1)}}else try{window.setTimeout(function(){b.jgrid.info_dialog(b.jgrid.errors.errcap,e+" "+r[1],b.jgrid.edit.bClose)},100);b(a).jqGrid("restoreCell",d,f)}catch(u){}}else b(a).jqGrid("restoreCell",d,f)}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,f){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("+f+")",a.rows[d]);if(b.isFunction(b.fn.datepicker))try{b("input.hasDatepicker",h).datepicker("hide")}catch(e){}b(h).empty().attr("tabindex","-1");b(a).jqGrid("setCell",a.rows[d].id,f,a.p.savedRow[c].v,false,false,true);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=false;if(!(!this.grid||this.p.cellEdit!==true)){for(var c=f+1;c0&&b(this).jqGrid("saveCell",d,f)}})},prevCell:function(d,f){return this.each(function(){var a=false;if(!(!this.grid||this.p.cellEdit!==true)){for(var c=f-1;c>=0;c--)if(this.p.colModel[c].editable===true){a= -c;break}if(a!==false)b(this).jqGrid("editCell",d,a,true);else this.p.savedRow.length>0&&b(this).jqGrid("saveCell",d,f)}})},GridNav:function(){return this.each(function(){function d(g,i,k){if(k.substr(0,1)=="v"){var j=b(a.grid.bDiv)[0].clientHeight,m=b(a.grid.bDiv)[0].scrollTop,l=a.rows[g].offsetTop+a.rows[g].clientHeight,q=a.rows[g].offsetTop;if(k=="vd")if(l>=j)b(a.grid.bDiv)[0].scrollTop=b(a.grid.bDiv)[0].scrollTop+a.rows[g].clientHeight;if(k=="vu")if(q=k+parseInt(j,10))b(a.grid.bDiv)[0].scrollLeft=b(a.grid.bDiv)[0].scrollLeft+a.rows[g].cells[i].clientWidth;else if(m=0;j--)if(a.p.colModel[j].hidden!==true){k=j;break}}if(i== -"rgt"){k=g-1;for(j=g;j"),h,e;b(c).insertBefore(a.grid.cDiv);b("#"+a.p.knv).focus().keydown(function(g){e=g.keyCode;if(a.p.direction=="rtl")if(e==37)e=39;else if(e==39)e=37; -switch(e){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=f(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=f(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;default:return true}return false})}})},getChangedCells:function(d){var f=[];d||(d="all");this.each(function(){var a=this,c;!a.grid||a.p.cellEdit!==true||b(a.rows).each(function(h){var e={};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{e[c]=b.unformat(this,{rowId:a.rows[h].id,colModel:a.p.colModel[g]}, -g)}catch(i){e[c]=b.jgrid.htmlDecode(b(this).html())}}else try{e[c]=b.unformat(this,{rowId:a.rows[h].id,colModel:a.p.colModel[g]},g)}catch(k){e[c]=b.jgrid.htmlDecode(b(this).html())}});e.id=this.id;f.push(e)}})});return f}})})(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 j[this._jqm].c=b.extend({},j[this._jqm].c,a);l++;this._jqm=l;j[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=j[a],d=c.c,i="."+d.closeClass,g=parseInt(c.w.css("z-index"));g=g>0?g:3E3;var h=b("
").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(h);else h=e;c.o=h?h.addClass(d.overlayClass).prependTo("body"):e;if(q){b("html,body").css({height:"100%",width:"100%"});if(h){h=h.css({position:"absolute"})[0];for(var m in{Top:1,Left:1})h.style.setExpression(m.toLowerCase(),"(_=(document.documentElement.scroll"+m+" || document.body.scroll"+m+"))+'px'")}}if(d.ajax){g=d.target||c.w;h=d.ajax;g=typeof g=="string"?b(g,c.w):b(g);h=h.substr(0,1)=="@"?b(f).attr(h.substring(1)): -h;g.html(d.ajaxText).load(h,function(){d.onLoad&&d.onLoad.call(this,c);i&&c.w.jqmAddClose(b(i,c.w));r(c)})}else i&&c.w.jqmAddClose(b(i,c.w));d.toTop&&c.o&&c.w.before('').insertAfter(c.o);d.onShow?d.onShow(c):c.w.show();r(c);return e},close:function(a){a=j[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,j=b.jqm.hash,k=[],q=b.browser.msie&&b.browser.version=="6.0",e=false,r=function(a){var f=b('').css({opacity:0});if(q)if(a.o)a.o.html('

').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=j[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 i in{jqmShow:1,jqmHide:1})for(var g in this[i])if(j[this[i][g]])j[this[i][g]].w[i](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;if(b("input.hasDatepicker",d[0])[0])try{b("input.hasDatepicker",d[0]).datepicker("hide")}catch(p){}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(b){b.jgrid.extend({setSubGrid:function(){return this.each(function(){var f;this.p.subGridOptions=b.extend({plusicon:"ui-icon-plus",minusicon:"ui-icon-minus",openicon:"ui-icon-carat-1-sw",expandOnLoad:false,delayOnLoad:50,selectOnExpand:false,reloadOnExpand:true},this.p.subGridOptions||{});this.p.colNames.unshift("");this.p.colModel.unshift({name:"subgrid",width:b.browser.safari?this.p.subGridWidth+this.p.cellLayout:this.p.subGridWidth,sortable:false,resizable:false,hidedlg:true,search:false, -fixed:true});f=this.p.subGridModel;if(f[0]){f[0].align=b.extend([],f[0].align||[]);for(var d=0;d"},addSubGrid:function(f,d){return this.each(function(){var a= -this;if(a.grid){var n=function(g,j,e){j=b("").html(j);b(g).append(j)},s=function(g,j){var e,c,h,k=b("
"),i=b("");for(c=0;c");b(e).html(a.p.subGridModel[0].name[c]);b(e).width(a.p.subGridModel[0].width[c]);b(i).append(e)}b(k).append(i);if(g){h= -a.p.xmlReader.subgrid;b(h.root+" "+h.row,g).each(function(){i=b("");if(h.repeatitems===true)b(h.cell,this).each(function(m){n(i,b(this).text()||" ",m)});else{var o=a.p.subGridModel[0].mapping||a.p.subGridModel[0].name;if(o)for(c=0;c"),m=b("");for(c=0;c");b(e).html(a.p.subGridModel[0].name[c]);b(e).width(a.p.subGridModel[0].width[c]);b(m).append(e)}b(o).append(m);if(g){k=a.p.jsonReader.subgrid;e=g[k.root];if(typeof e!=="undefined")for(c=0;c"); -if(k.repeatitems===true){if(k.cell)h=h[k.cell];for(i=0;i0){r=d;y=d+1}for(;r=1?" ":"";p=true;if(b.isFunction(a.p.subGridBeforeExpand))p=a.p.subGridBeforeExpand.call(a,t+"_"+l,l);if(p===false)return false;b(g).after(""+w+"

");b.isFunction(a.p.subGridRowExpanded)?a.p.subGridRowExpanded.call(a,t+"_"+l,l):z(g)}else b(q).show();b(this).html("").removeClass("sgcollapsed").addClass("sgexpanded");a.p.subGridOptions.selectOnExpand&&b(a).jqGrid("setSelection", -l)}else if(b(this).hasClass("sgexpanded")){p=true;if(b.isFunction(a.p.subGridRowColapsed)){l=g.id;p=a.p.subGridRowColapsed.call(a,t+"_"+l,l)}if(p===false)return false;if(a.p.subGridOptions.reloadOnExpand===true)b(q).remove(".ui-subgrid");else b(q).hasClass("ui-subgrid")&&b(q).hide();b(this).html("").removeClass("sgexpanded").addClass("sgcollapsed")}return false});a.p.subGridOptions.expandOnLoad===true&& -b(a.rows[r].cells[f]).trigger("click");r++}a.subGridXml=function(g,j){s(g,j)};a.subGridJson=function(g,j){v(g,j)}}})},expandSubGridRow:function(f){return this.each(function(){if(this.grid||f)if(this.p.subGrid===true){var d=b(this).jqGrid("getInd",f,true);if(d)(d=b("td.sgcollapsed",d)[0])&&b(d).trigger("click")}})},collapseSubGridRow:function(f){return this.each(function(){if(this.grid||f)if(this.p.subGrid===true){var d=b(this).jqGrid("getInd",f,true);if(d)(d=b("td.sgexpanded",d)[0])&&b(d).trigger("click")}})}, -toggleSubGridRow:function(f){return this.each(function(){if(this.grid||f)if(this.p.subGrid===true){var d=b(this).jqGrid("getInd",f,true);if(d){var a=b("td.sgcollapsed",d)[0];if(a)b(a).trigger("click");else(a=b("td.sgexpanded",d)[0])&&b(a).trigger("click")}}})}})})(jQuery); -(function(e){e.jgrid.extend({groupingSetup:function(){return this.each(function(){var a=this.p.groupingView;if(a!==null&&(typeof a==="object"||e.isFunction(a)))if(a.groupField.length){if(typeof a.visibiltyOnNextGrouping=="undefined")a.visibiltyOnNextGrouping=[];for(var c=0;c";try{l=b.formatter(f,d.sortnames[0][o],r,d.sortitems[0])}catch(v){l=d.sortnames[0][o]}g+= -''+h+e.jgrid.format(d.groupText[0],l,a[n].length)+"";for(var i=0;i