Commit fd735c15 authored by Vladislav Bolshakov's avatar Vladislav Bolshakov

barbass:

parent a458c50f
# 404 # 404
ErrorDocument 404 /index.php ErrorDocument 404 /index.php
# #
DirectoryIndex index.php DirectoryIndex index.php
# mod_rewrite # mod_rewrite
<IfModule mod_rewrite.c> <IfModule mod_rewrite.c>
RewriteEngine on RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [L] RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
\ No newline at end of file </IfModule>
<?php defined('BASEPATH') OR exit('No direct script access allowed'); <?php defined('BASEPATH') OR exit('No direct script access allowed');
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Enable/Disable Migrations | Enable/Disable Migrations
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Migrations are disabled by default but should be enabled | Migrations are disabled by default but should be enabled
| whenever you intend to do a schema migration. | whenever you intend to do a schema migration.
| |
*/ */
$config['migration_enabled'] = FALSE; $config['migration_enabled'] = FALSE;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Migrations version | Migrations version
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| This is used to set migration version that the file system should be on. | This is used to set migration version that the file system should be on.
| If you run $this->migration->latest() this is the version that schema will | If you run $this->migration->latest() this is the version that schema will
| be upgraded / downgraded to. | be upgraded / downgraded to.
| |
*/ */
$config['migration_version'] = 0; $config['migration_version'] = 0;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Migrations Path | Migrations Path
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Path to your migrations folder. | Path to your migrations folder.
| Typically, it will be within your application path. | Typically, it will be within your application path.
| Also, writing permission is required within the migrations path. | Also, writing permission is required within the migrations path.
| |
*/ */
$config['migration_path'] = APPPATH . 'migrations/'; $config['migration_path'] = APPPATH . 'migrations/';
/* End of file migration.php */ /* End of file migration.php */
/* Location: ./application/config/migration.php */ /* Location: ./application/config/migration.php */
\ No newline at end of file
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*TYPOS super admin*/ /*TYPOS super admin*/
$config['typos_admin_login'] = 'barbass'; $config['typos_admin_login'] = 'barbass';
$config['typos_admin_password'] = 'barbass'; $config['typos_admin_password'] = 'barbass';
$config['typos_admin_email'] = 'barbass@etersoft.ru'; $config['typos_admin_email'] = 'barbass@etersoft.ru';
$config['pass']['key_1'] = "ghuHJGOuiар"; $config['pass']['key_1'] = "ghuHJGOuiар";
$config['pass']['key_2'] = "vD%F&Bv8bcvjnb%65"; $config['pass']['key_2'] = "vD%F&Bv8bcvjnb%65";
$config['pass']['key_3'] = "&^^%$%$*Gposwорапо7д"; $config['pass']['key_3'] = "&^^%$%$*Gposwорапо7д";
$config['error_login_count'] = 3; $config['error_login_count'] = 3;
$config['error_login_time'] = 600; //10 минут $config['error_login_time'] = 600; //10 минут
<?php <?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed'); if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/** /**
* Работа с сайтами - администратор * Работа с сайтами - администратор
* - удаление пользователей с ответственности за сайт * - удаление пользователей с ответственности за сайт
* - удаление/добавление/редактирование сайтов * - удаление/добавление/редактирование сайтов
**/ **/
class Sites extends CI_Controller { class Sites extends CI_Controller {
function __construct() { function __construct() {
parent::__construct(); parent::__construct();
$this->user_id = $this->mdl_session->getData('user_id'); $this->user_id = $this->mdl_session->getData('user_id');
$this->usertype = $this->mdl_session->getData('usertype'); $this->usertype = $this->mdl_session->getData('usertype');
if ($this->usertype != 'admin') { if ($this->usertype != 'admin') {
redirect('users/typos'); redirect('users/typos');
} }
$this->load->model('admins/mdl_sites'); $this->load->model('admins/mdl_sites');
} }
/*Создаем шаблон*/ /*Создаем шаблон*/
function index() { function index() {
$views['body']['url'] = "admins/sites"; $views['body']['url'] = "admins/sites";
$views['menu']['url'] = "menu"; $views['menu']['url'] = "menu";
$views['menu']['data']['items'] = $this->mdl_menu->admin(); $views['menu']['data']['items'] = $this->mdl_menu->admin();
$this->mdl_views->view($views); $this->mdl_views->view($views);
return true; return true;
} }
function typos() { function typos() {
$this->index(); $this->index();
return; return;
} }
/** /**
* Получить сайты * Получить сайты
**/ **/
function getListSites() { function getListSites() {
$data = $this->mdl_jqgrid->collectionData(); $data = $this->mdl_jqgrid->collectionData();
$data['user_id'] = $this->user_id; $data['user_id'] = $this->user_id;
echo json_encode($this->mdl_sites->getListSites($data)); echo json_encode($this->mdl_sites->getListSites($data));
return; return;
} }
/** /**
* Получить пользователей по сайту * Получить пользователей по сайту
**/ **/
function getListUsers() { function getListUsers() {
$data = $this->mdl_jqgrid->collectionData(); $data = $this->mdl_jqgrid->collectionData();
$data['site_id'] = $this->mdl_request->int("id"); $data['site_id'] = $this->mdl_request->int("id");
$data['user_id'] = $this->user_id; $data['user_id'] = $this->user_id;
echo json_encode($this->mdl_sites->getListUsers($data)); echo json_encode($this->mdl_sites->getListUsers($data));
return; return;
} }
/** /**
* Управление сайтами * Управление сайтами
**/ **/
function panelSites() { function panelSites() {
$oper = $this->mdl_request->string('oper'); $oper = $this->mdl_request->string('oper');
if ($oper == 'add') { if ($oper == 'add') {
$data['site'] = Url::getFormatingUrl($this->mdl_request->string('site')); $data['site'] = Url::getFormatingUrl($this->mdl_request->string('site'));
$data['status'] = $this->mdl_request->int('status'); $data['status'] = $this->mdl_request->int('status');
$result = $this->mdl_validate->validateSite($data); $result = $this->mdl_validate->validateSite($data);
if (is_array($result)) { if (is_array($result)) {
echo json_encode($result); echo json_encode($result);
return; return;
} }
$result = $this->mdl_sites->addSite($data); $result = $this->mdl_sites->addSite($data);
if (is_array($result)) { if (is_array($result)) {
echo json_encode($result); echo json_encode($result);
return; return;
} }
} elseif ($oper == 'edit') { } elseif ($oper == 'edit') {
$data['site_id'] = $this->mdl_request->int('id'); $data['site_id'] = $this->mdl_request->int('id');
$data['site'] = Url::getFormatingUrl($this->mdl_request->string('site')); $data['site'] = Url::getFormatingUrl($this->mdl_request->string('site'));
$data['status'] = $this->mdl_request->int('status'); $data['status'] = $this->mdl_request->int('status');
$result = $this->mdl_validate->validateSite($data); $result = $this->mdl_validate->validateSite($data);
if (is_array($result)) { if (is_array($result)) {
echo json_encode($result); echo json_encode($result);
return; return;
} }
$result = $this->mdl_sites->editSite($data); $result = $this->mdl_sites->editSite($data);
if (is_array($result)) { if (is_array($result)) {
echo json_encode($result); echo json_encode($result);
return; return;
} }
} elseif ($oper == 'del') { } elseif ($oper == 'del') {
$data['site_id'] = $this->mdl_request->int('id'); $data['site_id'] = $this->mdl_request->int('id');
$result = $this->mdl_sites->deleteSite($data); $result = $this->mdl_sites->deleteSite($data);
if (is_array($result)) { if (is_array($result)) {
echo json_encode($result); echo json_encode($result);
return; return;
} }
} }
return true; return true;
} }
/** /**
* Управление пользователями (ответственность за сайты) * Управление пользователями (ответственность за сайты)
**/ **/
function panelUsers() { function panelUsers() {
$oper = $this->mdl_request->string('oper'); $oper = $this->mdl_request->string('oper');
if ($oper == 'del') { if ($oper == 'del') {
$this->load->model('admins/mdl_users'); $this->load->model('admins/mdl_users');
$data['user_id'] = $this->mdl_request->int('id'); $data['user_id'] = $this->mdl_request->int('id');
$data['site_id'] = $this->mdl_request->int('site_id'); $data['site_id'] = $this->mdl_request->int('site_id');
$result = $this->mdl_users->deleteResponsible($data); $result = $this->mdl_users->deleteResponsible($data);
if (is_array($result)) { if (is_array($result)) {
echo json_encode($result); echo json_encode($result);
return; return;
} }
} }
} }
} }
<?php <?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed'); if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*Авторизация пользователя*/ /*Авторизация пользователя*/
class Authorized extends CI_Controller { class Authorized extends CI_Controller {
function __construct() { function __construct() {
parent::__construct(); parent::__construct();
$this->load->model('mdl_authorized');; $this->load->model('mdl_authorized');;
} }
function index() { function index() {
$this->load->model('mdl_authorized'); $this->load->model('mdl_authorized');
$views['body']['url'] = "authorized"; $views['body']['url'] = "authorized";
$views['body']['data']['auth_url'] = $this->config->base_url()."authorized/login"; $views['body']['data']['auth_url'] = $this->config->base_url()."authorized/login";
$this->mdl_views->view($views); $this->mdl_views->view($views);
} }
function login() { function login() {
$views['body']['data']['auth_url'] = $this->config->base_url()."authorized/login"; $views['body']['data']['auth_url'] = $this->config->base_url()."authorized/login";
$views['body']['url'] = "authorized"; $views['body']['url'] = "authorized";
if (!$this->_validateCountErrorLogin()) { if (!$this->_validateCountErrorLogin()) {
$views['body']['data']['error_message'] = "Вы превысили число попыток"; $views['body']['data']['error_message'] = "Вы превысили число попыток";
$this->mdl_views->view($views); $this->mdl_views->view($views);
return; return;
} }
$login = $this->mdl_request->string('login'); $login = $this->mdl_request->string('login');
$password = $this->mdl_request->string('password'); $password = $this->mdl_request->string('password');
if ($login == "" || $password == "") { if ($login == "" || $password == "") {
$views['body']['data']['error_message'] = "Логин/пароль пустой"; $views['body']['data']['error_message'] = "Логин/пароль пустой";
$this->mdl_views->view($views); $this->mdl_views->view($views);
return; return;
} }
/*Если совпадает с данными администратора по-умолчанию (см. typos_congig.php)*/ /*Если совпадает с данными администратора по-умолчанию (см. typos_congig.php)*/
if ($this->config->item('typos_admin_login') && $this->config->item('typos_admin_password') && $this->config->item('typos_admin_email')) { if ($this->config->item('typos_admin_login') && $this->config->item('typos_admin_password') && $this->config->item('typos_admin_email')) {
if ($login == $this->config->item('typos_admin_login') && $password == $this->config->item('typos_admin_password')) { if ($login == $this->config->item('typos_admin_login') && $password == $this->config->item('typos_admin_password')) {
$this->mdl_session->setData('login', $login); $this->mdl_session->setData('login', $login);
$this->mdl_session->setData('usertype', 'admin'); $this->mdl_session->setData('usertype', 'admin');
$this->mdl_session->setData('email', $this->config->item('typos_admin_email')); $this->mdl_session->setData('email', $this->config->item('typos_admin_email'));
$this->mdl_session->setData('user_id', -1); $this->mdl_session->setData('user_id', -1);
$this->session->set_userdata('user_id', -1); $this->session->set_userdata('user_id', -1);
redirect('admins/sites/'); redirect('admins/sites/');
} }
} }
$user_info = $this->mdl_authorized->getInfo($login); $user_info = $this->mdl_authorized->getInfo($login);
$password = getHashPass($password, $this->config->item('pass')); $password = getHashPass($password, $this->config->item('pass'));
if (!$user_info) { if (!$user_info) {
$this->_errorLogin(); $this->_errorLogin();
$views['body']['data']['error_message'] = "Пароль/логин не верен"; $views['body']['data']['error_message'] = "Пароль/логин не верен";
$this->mdl_views->view($views); $this->mdl_views->view($views);
return; return;
} else { } else {
if ($password == $user_info['password']) { if ($password == $user_info['password']) {
if ((int)$user_info['activity'] == 1) { if ((int)$user_info['activity'] == 1) {
$this->mdl_session->setData('login', $login); $this->mdl_session->setData('login', $login);
$this->mdl_session->setData('usertype', $user_info['type']); $this->mdl_session->setData('usertype', $user_info['type']);
$this->mdl_session->setData('user_id', $user_info['user_id']); $this->mdl_session->setData('user_id', $user_info['user_id']);
$this->session->set_userdata('user_id', $user_info['user_id']); $this->session->set_userdata('user_id', $user_info['user_id']);
/*Перенаправлям в зависимости от типа пользователя*/ /*Перенаправлям в зависимости от типа пользователя*/
if ($user_info['type'] == 'admin') { if ($user_info['type'] == 'admin') {
redirect('admins/sites/'); redirect('admins/sites/');
} elseif ($user_info['type'] == 'user') { } elseif ($user_info['type'] == 'user') {
redirect('users/typos/'); redirect('users/typos/');
} }
} }
} else { } else {
$this->_errorLogin(); $this->_errorLogin();
$views['body']['data']['error_message'] = "Пароль/логин не верен"; $views['body']['data']['error_message'] = "Пароль/логин не верен";
$this->mdl_views->view($views); $this->mdl_views->view($views);
return; return;
} }
} }
} }
function logout() { function logout() {
$this->session->sess_destroy(); $this->session->sess_destroy();
$this->mdl_session->deleteAllData(); $this->mdl_session->deleteAllData();
redirect("authorized"); redirect("authorized");
} }
/*Устанавливаем счетчики ошибок входа*/ /*Устанавливаем счетчики ошибок входа*/
function _errorLogin() { function _errorLogin() {
$this->mdl_session->setData('error_login', (int)$this->mdl_session->getData('error_login_count') + 1); $this->mdl_session->setData('error_login', (int)$this->mdl_session->getData('error_login_count') + 1);
$this->mdl_session->setData('error_login_time', time()); $this->mdl_session->setData('error_login_time', time());
$this->session->set_userdata('error_login', (int)$this->session->userdata('error_login') + 1); $this->session->set_userdata('error_login', (int)$this->session->userdata('error_login') + 1);
$this->session->set_userdata('error_login_time', time()); $this->session->set_userdata('error_login_time', time());
} }
function _validateCountErrorLogin() { function _validateCountErrorLogin() {
if (!$this->mdl_session->getData('error_login') && !$this->session->userdata('error_login')) { if (!$this->mdl_session->getData('error_login') && !$this->session->userdata('error_login')) {
return true; return true;
} else { } else {
$count_error = max((int)$this->mdl_session->getData('error_login'), (int)$this->session->userdata('error_login')); $count_error = max((int)$this->mdl_session->getData('error_login'), (int)$this->session->userdata('error_login'));
$config_count = ($this->config->item('error_login_count')) ? $this->config->item('error_login_count') : 3; $config_count = ($this->config->item('error_login_count')) ? $this->config->item('error_login_count') : 3;
$config_time = ($this->config->item('error_login_time')) ?$this->config->item('error_login_time') : 10000; $config_time = ($this->config->item('error_login_time')) ?$this->config->item('error_login_time') : 10000;
$time_error = max((int)$this->mdl_session->getData('error_login_time'), (int)$this->session->userdata('error_login_time')); $time_error = max((int)$this->mdl_session->getData('error_login_time'), (int)$this->session->userdata('error_login_time'));
$time_error = time() - $time_error; $time_error = time() - $time_error;
/*Если время бана прошло, обнуляем*/ /*Если время бана прошло, обнуляем*/
if ($time_error > $config_time) { if ($time_error > $config_time) {
$this->mdl_session->setData('error_login_count', 0); $this->mdl_session->setData('error_login_count', 0);
$this->session->userdata('error_login_count', 0); $this->session->userdata('error_login_count', 0);
return true; return true;
} }
if ($time_error <= $config_time && $count_error >= $config_count) { if ($time_error <= $config_time && $count_error >= $config_count) {
return false; return false;
} else { } else {
return true; return true;
} }
} }
return true; return true;
} }
} }
<?php <?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed'); if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*Работа с опечатками - пользователь*/ /*Работа с опечатками - пользователь*/
class Typos extends CI_Controller { class Typos extends CI_Controller {
function __construct() { function __construct() {
parent::__construct(); parent::__construct();
$this->load->model('users/mdl_typos'); $this->load->model('users/mdl_typos');
$this->user_id = $this->mdl_session->getData('user_id'); $this->user_id = $this->mdl_session->getData('user_id');
} }
/*Создаем шаблон*/ /*Создаем шаблон*/
function index() { function index() {
if ($this->mdl_session->getData('usertype') == 'admin') { if ($this->mdl_session->getData('usertype') == 'admin') {
$views['menu']['data']['items'] = $this->mdl_menu->admin(); $views['menu']['data']['items'] = $this->mdl_menu->admin();
} }
if ($this->mdl_session->getData('usertype') == 'user') { if ($this->mdl_session->getData('usertype') == 'user') {
$views['menu']['data']['items'] = $this->mdl_menu->user(); $views['menu']['data']['items'] = $this->mdl_menu->user();
} }
$views['body']['url'] = "users/typos"; $views['body']['url'] = "users/typos";
$views['menu']['url'] = "menu"; $views['menu']['url'] = "menu";
$this->mdl_views->view($views); $this->mdl_views->view($views);
return; return;
} }
function typos() { function typos() {
$this->index(); $this->index();
return; return;
} }
/*Получить список сайтов для пользователя*/ /*Получить список сайтов для пользователя*/
function getListSites() { function getListSites() {
$data = $this->mdl_jqgrid->collectionData(); $data = $this->mdl_jqgrid->collectionData();
$data['user_id'] = $this->user_id; $data['user_id'] = $this->user_id;
echo json_encode($this->mdl_typos->getUserSites($data)); echo json_encode($this->mdl_typos->getUserSites($data));
return; return;
} }
/*Получить список сообщений об опечатках для пользователя*/ /*Получить список сообщений об опечатках для пользователя*/
function getListMessages() { function getListMessages() {
$data = $this->mdl_jqgrid->collectionData(); $data = $this->mdl_jqgrid->collectionData();
$data['site_id'] = $this->mdl_request->int("id"); $data['site_id'] = $this->mdl_request->int("id");
$data['user_id'] = $this->user_id; $data['user_id'] = $this->user_id;
echo json_encode($this->mdl_typos->getListMessages($data)); echo json_encode($this->mdl_typos->getListMessages($data));
return; return;
} }
/*Управление сайтами*/ /*Управление сайтами*/
function panelSites() { function panelSites() {
$oper = $this->mdl_request->string("oper"); $oper = $this->mdl_request->string("oper");
$data['site_id'] = $this->mdl_request->int("id"); $data['site_id'] = $this->mdl_request->int("id");
$data['status'] = $this->mdl_request->int("rstatus"); $data['status'] = $this->mdl_request->int("rstatus");
$data['user_id'] = $this->user_id; $data['user_id'] = $this->user_id;
if ($oper == 'edit') { if ($oper == 'edit') {
if ($data['status'] != 0 && $data['status'] != 1) { if ($data['status'] != 0 && $data['status'] != 1) {
return array('success' => 'false', 'message' => 'Не верный статус сообщения'); return array('success' => 'false', 'message' => 'Не верный статус сообщения');
} }
$this->mdl_typos->updateStatus($data); $this->mdl_typos->updateStatus($data);
return; return;
} }
} }
/*Управление сообщениями*/ /*Управление сообщениями*/
function panelMessages() { function panelMessages() {
$oper = $this->mdl_request->string('oper'); $oper = $this->mdl_request->string('oper');
$data = array(); $data = array();
if ($oper == 'add') { if ($oper == 'add') {
$data['site_id'] = $this->mdl_request->int('site_id'); $data['site_id'] = $this->mdl_request->int('site_id');
$data['link'] = Url::getFormatingUrl($this->mdl_request->string('link')); $data['link'] = Url::getFormatingUrl($this->mdl_request->string('link'));
$data['text'] = $this->mdl_request->string('text'); $data['text'] = $this->mdl_request->string('text');
$data['comment'] = $this->mdl_request->string('comment'); $data['comment'] = $this->mdl_request->string('comment');
$data['status'] = $this->mdl_request->int('status'); $data['status'] = $this->mdl_request->int('status');
$data['user_id'] = $this->user_id; $data['user_id'] = $this->user_id;
$result = $this->mdl_validate->validateMessage($data); $result = $this->mdl_validate->validateMessage($data);
if (is_array($result)) { if (is_array($result)) {
echo json_encode($result); echo json_encode($result);
return; return;
} }
if (!$this->mdl_validate->validateUserLinkOnSite($data)) { if (!$this->mdl_validate->validateUserLinkOnSite($data)) {
echo json_encode(array('success' => 'false', 'message' => 'Ссылка не принадлежит данному сайту')); echo json_encode(array('success' => 'false', 'message' => 'Ссылка не принадлежит данному сайту'));
return; return;
} }
$result = $this->mdl_typos->addMessage($data); $result = $this->mdl_typos->addMessage($data);
if (is_array($result)) { if (is_array($result)) {
echo json_encode($result); echo json_encode($result);
return; return;
} }
return; return;
} elseif ($oper == 'del') { } elseif ($oper == 'del') {
$data['message_id'] = $this->mdl_request->int('id'); $data['message_id'] = $this->mdl_request->int('id');
$data['site_id'] = $this->mdl_request->int('site_id'); $data['site_id'] = $this->mdl_request->int('site_id');
$data['user_id'] = $this->user_id; $data['user_id'] = $this->user_id;
$result = $this->mdl_typos->deleteMessage($data); $result = $this->mdl_typos->deleteMessage($data);
if (is_array($result)) { if (is_array($result)) {
echo json_encode($result); echo json_encode($result);
return; return;
} }
return; return;
} elseif ($oper == 'edit') { } elseif ($oper == 'edit') {
$data['message_id'] = $this->mdl_request->int('id'); $data['message_id'] = $this->mdl_request->int('id');
$data['site_id'] = $this->mdl_request->int('site_id'); $data['site_id'] = $this->mdl_request->int('site_id');
$data['status'] = $this->mdl_request->int('status'); $data['status'] = $this->mdl_request->int('status');
$data['link'] = Url::getFormatingUrl($this->mdl_request->string('link')); $data['link'] = Url::getFormatingUrl($this->mdl_request->string('link'));
$data['text'] = $this->mdl_request->string('text'); $data['text'] = $this->mdl_request->string('text');
$data['comment'] = $this->mdl_request->string('comment'); $data['comment'] = $this->mdl_request->string('comment');
$data['user_id'] = $this->user_id; $data['user_id'] = $this->user_id;
$result = $this->mdl_validate->validateMessage($data); $result = $this->mdl_validate->validateMessage($data);
if (is_array($result)) { if (is_array($result)) {
echo json_encode($result); echo json_encode($result);
return; return;
} }
if (!$this->mdl_validate->validateUserLinkOnSite($data)) { if (!$this->mdl_validate->validateUserLinkOnSite($data)) {
echo json_encode(array('success' => 'false', 'message' => 'Ссылка не принадлежит данному сайту')); echo json_encode(array('success' => 'false', 'message' => 'Ссылка не принадлежит данному сайту'));
return; return;
} }
$result = $this->mdl_typos->editMessage($data); $result = $this->mdl_typos->editMessage($data);
if (is_array($result)) { if (is_array($result)) {
echo json_encode($result); echo json_encode($result);
return; return;
} }
return; return;
} }
return; return;
} }
} }
<?php <?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed'); if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*Включение сессий*/ /*Включение сессий*/
class Session { class Session {
function __construct() { function __construct() {
if (!session_id()) { if (!session_id()) {
ini_set('session.use_cookies', 'On'); ini_set('session.use_cookies', 'On');
ini_set('session.use_trans_sid', 'Off'); ini_set('session.use_trans_sid', 'Off');
session_set_cookie_params(0, '/'); session_set_cookie_params(0, '/');
session_start(); session_start();
} }
} }
} }
/**/ /**/
\ No newline at end of file
<?php <?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed'); if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*Проверка авторизированности пользователя*/ /*Проверка авторизированности пользователя*/
class Validate_authorized extends CI_Controller { class Validate_authorized extends CI_Controller {
/*Если не страница авторизации/проверки логина/пароля - перенаправляем на главную*/ /*Если не страница авторизации/проверки логина/пароля - перенаправляем на главную*/
function index() { function index() {
$class = $this->uri->segment(1); $class = $this->uri->segment(1);
$method = $this->uri->segment(2); $method = $this->uri->segment(2);
if ((!$class) || if ((!$class) ||
($class == 'authorized') || ($class == 'authorized') ||
($class.'/'.$method == 'authorized/check') || ($class.'/'.$method == 'authorized/check') ||
($class.'/'.$method == 'authorized/logout') || ($class.'/'.$method == 'authorized/logout') ||
($class.'/'.$method == 'server/processData') ($class.'/'.$method == 'server/processData')
) { ) {
return true; return true;
} else { } else {
if (!$this->session->userdata('user_id')) { if (!$this->session->userdata('user_id')) {
redirect('authorized'); redirect('authorized');
return; return;
} }
} }
return; return;
} }
} }
<?php <?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed'); if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*Работа с пользователями*/ /*Работа с пользователями*/
class Mdl_users extends CI_Model { class Mdl_users extends CI_Model {
/* /*
* Получаем всех пользователей * Получаем всех пользователей
**/ **/
function getListUsers($data) { function getListUsers($data) {
/*Данные для pagination jqGrid*/ /*Данные для pagination jqGrid*/
if ($data['querysearchstring'] != "") { if ($data['querysearchstring'] != "") {
$data['querysearchstring'] = " WHERE ".$data['querysearchstring']." "; $data['querysearchstring'] = " WHERE ".$data['querysearchstring']." ";
} }
$data['query_count'] = "SELECT COUNT(user_id) AS count FROM user ".$data['querysearchstring']." "; $data['query_count'] = "SELECT COUNT(user_id) AS count FROM user ".$data['querysearchstring']." ";
$data_pagination = $this->mdl_jqgrid->Pagination($data); $data_pagination = $this->mdl_jqgrid->Pagination($data);
/**/ /**/
$return_data = array( $return_data = array(
'page' => $data_pagination['page'], 'page' => $data_pagination['page'],
'total' => $data_pagination['total'], 'total' => $data_pagination['total'],
'records' => $data_pagination['records'], 'records' => $data_pagination['records'],
'rows' => array(), 'rows' => array(),
); );
$query_users = "SELECT user_id, $query_users = "SELECT user_id,
login, login,
type, type,
email, email,
firstname, firstname,
middlename, middlename,
lastname, lastname,
activity, activity,
datetime_add datetime_add
FROM user AS u FROM user AS u
".$data['querysearchstring']." ".$data['querysearchstring']."
ORDER BY ".$data['sidx']." ".$data['sord']." ORDER BY ".$data['sidx']." ".$data['sord']."
LIMIT ".$data_pagination['start']." , ".$data_pagination['limit']." "; LIMIT ".$data_pagination['start']." , ".$data_pagination['limit']." ";
$query = $this->db->query($query_users); $query = $this->db->query($query_users);
if ($query->num_rows() > 0) { if ($query->num_rows() > 0) {
foreach($query->result_array() as $row) { foreach($query->result_array() as $row) {
$return_data['rows'][] = array( $return_data['rows'][] = array(
'id' => $row['user_id'], 'id' => $row['user_id'],
'cell' => array( 'cell' => array(
$row['user_id'], $row['user_id'],
$row['login'], $row['login'],
$row['type'], $row['type'],
$row['email'], $row['email'],
'******', '******',
$row['firstname'], $row['firstname'],
$row['middlename'], $row['middlename'],
$row['lastname'], $row['lastname'],
$row['activity'], $row['activity'],
$row['datetime_add'] $row['datetime_add']
) )
); );
} }
} }
return $return_data; return $return_data;
} }
/* /*
* Добавляем пользователя * Добавляем пользователя
**/ **/
function addUser($data) { function addUser($data) {
$data['password'] = getHashPass($data['password'], $this->config->item('pass')); $data['password'] = getHashPass($data['password'], $this->config->item('pass'));
return $this->mdl_stored_query->insertUser($data); return $this->mdl_stored_query->insertUser($data);
} }
/* Редактирование данных о клиенте /* Редактирование данных о клиенте
* если пароль не новый (т.е. равен ******), то в запросе не обновляем его * если пароль не новый (т.е. равен ******), то в запросе не обновляем его
**/ **/
function editUser($data) { function editUser($data) {
if ($data['password'] != '******') { if ($data['password'] != '******') {
$data['password'] = getHashPass($data['password'], $this->config->item('pass')); $data['password'] = getHashPass($data['password'], $this->config->item('pass'));
} }
return $this->mdl_stored_query->updateUser($data); return $this->mdl_stored_query->updateUser($data);
} }
/* /*
* Удаляем пользователя * Удаляем пользователя
**/ **/
function deleteUser($data) { function deleteUser($data) {
return $this->mdl_stored_query->deleteUser($data); return $this->mdl_stored_query->deleteUser($data);
} }
/*Добавляем ответственного за сайт*/ /*Добавляем ответственного за сайт*/
function addResponsible($data) { function addResponsible($data) {
if (!$this->mdl_validate->validateUserOnId($data)) { if (!$this->mdl_validate->validateUserOnId($data)) {
return array('success'=> 'false', 'message' => "Пользователь не существует"); return array('success'=> 'false', 'message' => "Пользователь не существует");
} }
if (!$this->mdl_validate->validateResponsibleToSite($data)) { if (!$this->mdl_validate->validateResponsibleToSite($data)) {
return array('success'=> 'false', 'message' => "Этот сайт уже назначен"); return array('success'=> 'false', 'message' => "Этот сайт уже назначен");
} }
if (!$this->mdl_validate->validateSiteOnId($data)) { if (!$this->mdl_validate->validateSiteOnId($data)) {
return array('success'=> 'false', 'message' => "Сайт не существует"); return array('success'=> 'false', 'message' => "Сайт не существует");
} }
return $this->mdl_stored_query->insertResponsible($data); return $this->mdl_stored_query->insertResponsible($data);
} }
/* /*
* Обновляем статус ответственного за сайт (email-рассылка) * Обновляем статус ответственного за сайт (email-рассылка)
**/ **/
function editResponsible($data) { function editResponsible($data) {
return $this->mdl_stored_query->updateResponsibleStatus($data); return $this->mdl_stored_query->updateResponsibleStatus($data);
} }
/* /*
* Снимаем ответсвенного * Снимаем ответсвенного
**/ **/
function deleteResponsible($data) { function deleteResponsible($data) {
return $this->mdl_stored_query->deleteResponsible($data); return $this->mdl_stored_query->deleteResponsible($data);
} }
/* /*
* Получаем сайты для пользователя, кроме уже принадлежащих * Получаем сайты для пользователя, кроме уже принадлежащих
**/ **/
function getSites($user_id) { function getSites($user_id) {
$query = $this->db->query("SELECT site_id, site $query = $this->db->query("SELECT site_id, site
FROM site FROM site
WHERE site_id NOT IN (SELECT site_id WHERE site_id NOT IN (SELECT site_id
FROM responsible FROM responsible
WHERE user_id = '".(int)$user_id."' WHERE user_id = '".(int)$user_id."'
) )
"); ");
return ($query->num_rows() > 0) ? $query->result_array() : false; return ($query->num_rows() > 0) ? $query->result_array() : false;
} }
} }
<?php <?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed'); if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*Работа с пользовательскими данными*/ /*Работа с пользовательскими данными*/
class Mdl_authorized extends CI_Model { class Mdl_authorized extends CI_Model {
/*Информация о пользователе*/ /*Информация о пользователе*/
function getInfo($login) { function getInfo($login) {
$query = "SELECT * FROM user WHERE login = ".$this->db->escape($login)." LIMIT 1"; $query = "SELECT * FROM user WHERE login = ".$this->db->escape($login)." LIMIT 1";
$query = $this->db->query($query); $query = $this->db->query($query);
if (!$query) {return false;} if (!$query) {return false;}
if ($query->num_rows > 0) { if ($query->num_rows > 0) {
return $query->row_array(); return $query->row_array();
} }
return false; return false;
} }
} }
<?php <?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed'); if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*Построение поискового запроса*/ /*Построение поискового запроса*/
class Mdl_jqgrid extends CI_Model { class Mdl_jqgrid extends CI_Model {
//Построение части запроса (поле->значение) //Построение части запроса (поле->значение)
function createSearch($data) { function createSearch($data) {
$search = $data['search']; $search = $data['search'];
$searchstring = ""; $searchstring = "";
if ($search != "true") { if ($search != "true") {
return $searchstring; return $searchstring;
} }
$searchField = $data['searchField']; $searchField = $data['searchField'];
$searchOper = $data['searchOper']; $searchOper = $data['searchOper'];
$searchString = $data['searchString']; $searchString = $data['searchString'];
$s = " ".$searchField." "; $s = " ".$searchField." ";
switch ($searchOper) { switch ($searchOper) {
case 'eq': case 'eq':
$s .= " = ".$this->db->escape($searchString); $s .= " = ".$this->db->escape($searchString);
break; break;
case 'ne': case 'ne':
$s .= " != ".$this->db->escape($searchString); $s .= " != ".$this->db->escape($searchString);
break; break;
case 'lt': case 'lt':
$s .= " < ".$this->db->escape($searchString); $s .= " < ".$this->db->escape($searchString);
break; break;
case 'le': case 'le':
$s .= " <= ".$this->db->escape($searchString); $s .= " <= ".$this->db->escape($searchString);
break; break;
case 'gt': case 'gt':
$s .= " > ".$this->db->escape($searchString); $s .= " > ".$this->db->escape($searchString);
break; break;
case 'ge': case 'ge':
$s .= " >= ".$this->db->escape($searchString); $s .= " >= ".$this->db->escape($searchString);
break; break;
case 'bw': case 'bw':
$s .= "LIKE ".$this->db->escape($searchString."%"); $s .= "LIKE ".$this->db->escape($searchString."%");
break; break;
case 'bn': case 'bn':
$s .= "NOT LIKE ".$this->db->escape($searchString."%"); $s .= "NOT LIKE ".$this->db->escape($searchString."%");
break; break;
case 'ew': case 'ew':
$s .= "LIKE ".$this->db->escape("%".$searchString); $s .= "LIKE ".$this->db->escape("%".$searchString);
break; break;
case 'en': case 'en':
$s .= "NOT LIKE ".$this->db->escape("%".$searchString); $s .= "NOT LIKE ".$this->db->escape("%".$searchString);
break; break;
case 'cn': case 'cn':
$s .= "LIKE ".$this->db->escape("%".$searchString."%"); $s .= "LIKE ".$this->db->escape("%".$searchString."%");
break; break;
case 'nc': case 'nc':
$s .= "NOT LIKE ".$this->db->escape("%".$searchString."%"); $s .= "NOT LIKE ".$this->db->escape("%".$searchString."%");
break; break;
case 'nu': case 'nu':
$s .= "IS NULL"; $s .= "IS NULL";
break; break;
case 'nn': case 'nn':
$s .= "IS NOT NULL"; $s .= "IS NOT NULL";
break; break;
case 'in': case 'in':
$str_array = explode(',', $searchString); $str_array = explode(',', $searchString);
$str_array = array_map(function($value) {return $this->db->escape($value);}, $str_array); $str_array = array_map(function($value) {return $this->db->escape($value);}, $str_array);
$string = implode(',', $str_array); $string = implode(',', $str_array);
$s .= "IN (".$searchString.")"; $s .= "IN (".$searchString.")";
break; break;
case 'ni': case 'ni':
$str_array = explode(',', $searchString); $str_array = explode(',', $searchString);
$str_array = array_map(function($value) {return $this->db->escape($value);}, $str_array); $str_array = array_map(function($value) {return $this->db->escape($value);}, $str_array);
$string = implode(',', $str_array); $string = implode(',', $str_array);
$s .= "NOT IN (".$searchString.")"; $s .= "NOT IN (".$searchString.")";
break; break;
default: default:
$s = ""; $s = "";
break; break;
} }
return $s." "; return $s." ";
} }
//Собираем параметры, общие для плагина //Собираем параметры, общие для плагина
function collectionData() { function collectionData() {
$data['page'] = $this->mdl_request->int('page', 1); $data['page'] = $this->mdl_request->int('page', 1);
$data['limit'] = $this->mdl_request->int('rows', 10); $data['limit'] = $this->mdl_request->int('rows', 10);
if ($data['limit'] <= 0) {$data['limit'] = 10;} if ($data['limit'] <= 0) {$data['limit'] = 10;}
$data['sord'] = $this->mdl_request->string('sord'); $data['sord'] = $this->mdl_request->string('sord');
$data['sidx'] = $this->mdl_request->string('sidx'); $data['sidx'] = $this->mdl_request->string('sidx');
$data['search'] = $this->mdl_request->string('_search', 'false'); $data['search'] = $this->mdl_request->string('_search', 'false');
$data['searchField'] = $this->mdl_request->string('searchField'); $data['searchField'] = $this->mdl_request->string('searchField');
$data['searchOper'] = $this->mdl_request->string('searchOper'); $data['searchOper'] = $this->mdl_request->string('searchOper');
$data['searchString'] = $this->mdl_request->string('searchString'); $data['searchString'] = $this->mdl_request->string('searchString');
$data['querysearchstring'] = $this->createSearch($data); $data['querysearchstring'] = $this->createSearch($data);
return $data; return $data;
} }
function Pagination($data) { function Pagination($data) {
$page = (int)$data['page']; $page = (int)$data['page'];
$limit = (int)$data['limit']; $limit = (int)$data['limit'];
$sord = $data['sord']; $sord = $data['sord'];
$sidx = $data['sidx']; $sidx = $data['sidx'];
$query = $this->db->query($data['query_count']); $query = $this->db->query($data['query_count']);
if ($query->num_rows() > 0) { if ($query->num_rows() > 0) {
$count = $query->row_array()['count']; $count_arr = $query->row_array();
} else { $count = $count_arr['count'];
$count = 0; } else {
} $count = 0;
}
if ($count > 0) {
$total_pages = ceil($count/$limit); if ($count > 0) {
} else { $total_pages = ceil($count/$limit);
$total_pages = 0; } else {
} $total_pages = 0;
if ($page > $total_pages) { }
$page = $total_pages; if ($page > $total_pages) {
} $page = $total_pages;
}
$start = $limit*$page - $limit;
if ($start < 0) { $start = $limit*$page - $limit;
$start = 0; if ($start < 0) {
} $start = 0;
}
return array(
'page' => $page, return array(
'total' => $total_pages, 'page' => $page,
'records' => $count, 'total' => $total_pages,
'start' => $start, 'records' => $count,
'limit' => $limit 'start' => $start,
); 'limit' => $limit
} );
}
}
}
<?php <?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed'); if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*Создание меню*/ /*Создание меню*/
class Mdl_menu extends CI_Model { class Mdl_menu extends CI_Model {
function admin() { function admin() {
$data['sites'] = "<a href='".$this->config->base_url()."index.php/admins/sites'>Сайты</a>"; $data['sites'] = "<a href='".$this->config->base_url()."index.php/admins/sites'>Сайты</a>";
$data['users'] = "<a href='".$this->config->base_url()."index.php/admins/users'>Пользователи</a>"; $data['users'] = "<a href='".$this->config->base_url()."index.php/admins/users'>Пользователи</a>";
$data['typos'] = "<a href='".$this->config->base_url()."index.php/users/typos'>Опечатки</a>"; $data['typos'] = "<a href='".$this->config->base_url()."index.php/users/typos'>Опечатки</a>";
$data['logout'] = "<a href='".$this->config->base_url()."index.php/authorized/logout'>Выйти</a>"; $data['logout'] = "<a href='".$this->config->base_url()."index.php/authorized/logout'>Выйти</a>";
return $data; return $data;
} }
function user() { function user() {
$data['logout'] = "<a href='".$this->config->base_url()."index.php/authorized/logout'>Выйти</a>"; $data['logout'] = "<a href='".$this->config->base_url()."index.php/authorized/logout'>Выйти</a>";
return $data; return $data;
} }
} }
\ No newline at end of file
<?php <?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed'); if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*Обработка входящих данных*/ /*Обработка входящих данных*/
class Mdl_request extends CI_Model { class Mdl_request extends CI_Model {
function data($key = '', $default = '') { function data($key = '', $default = '') {
if (!$this->input->get_post($key)) { if (!$this->input->get_post($key)) {
return $default; return $default;
} else { } else {
return $this->input->get_post($key, TRUE); return $this->input->get_post($key, TRUE);
} }
return false; return false;
} }
function int($key = '', $default = 0) { function int($key = '', $default = 0) {
if (!$this->input->get_post($key)) { if (!$this->input->get_post($key)) {
return $default; return $default;
} else { } else {
return (int)$this->input->get_post($key); return (int)$this->input->get_post($key);
} }
return false; return false;
} }
function float($key = '', $default = 0) { function float($key = '', $default = 0) {
if (!$this->input->get_post($key)) { if (!$this->input->get_post($key)) {
return $default; return $default;
} else { } else {
return (float)$this->input->get_post($key); return (float)$this->input->get_post($key);
} }
return false; return false;
} }
function string($key, $default = '') { function string($key, $default = '') {
if (!$this->input->get_post($key)) { if (!$this->input->get_post($key)) {
return $default; return $default;
} else { } else {
return trim(strval($this->input->get_post($key, TRUE))); return trim(strval($this->input->get_post($key, TRUE)));
} }
return false; return false;
} }
function request() { function request() {
return $this->input->get_post(NULL, TRUE); return $this->input->get_post(NULL, TRUE);
} }
} }
<?php <?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed'); if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*Работа с сессиями*/ /*Работа с сессиями*/
class Mdl_session extends CI_Model { class Mdl_session extends CI_Model {
function __construct() { function __construct() {
if (!session_id()) { if (!session_id()) {
return false; return false;
} }
} }
/*Установить данные*/ /*Установить данные*/
function setData($key, $value) { function setData($key, $value) {
$_SESSION[strval($key)] = serialize($value); $_SESSION[strval($key)] = serialize($value);
} }
/*Получить данные*/ /*Получить данные*/
function getData($key) { function getData($key) {
if ($this->validateData($key)) { if ($this->validateData($key)) {
return unserialize($_SESSION[strval($key)]); return unserialize($_SESSION[strval($key)]);
} else { } else {
return false; return false;
} }
} }
/*Проверить существование данных*/ /*Проверить существование данных*/
function validateData($key) { function validateData($key) {
if (!isset($_SESSION[strval($key)])) { if (!isset($_SESSION[strval($key)])) {
return false; return false;
} else { } else {
return true; return true;
} }
} }
/*Удаляем данные*/ /*Удаляем данные*/
function deleteData($key) { function deleteData($key) {
unset($_SESSION[strval($key)]); unset($_SESSION[strval($key)]);
} }
/*Удаляем все данные сессии*/ /*Удаляем все данные сессии*/
function deleteAllData() { function deleteAllData() {
unset($_SESSION); unset($_SESSION);
} }
} }
<?php <?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed'); if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*Работа с шаблонами*/ /*Работа с шаблонами*/
class Mdl_views extends CI_Model { class Mdl_views extends CI_Model {
/*Загружаем основные шаблоны*/ /*Загружаем основные шаблоны*/
function view($data = array()) { function view($data = array()) {
$url = $this->config->item('base_url'); $url = $this->config->item('base_url');
$data['header']['base_url'] = $url; $data['header']['base_url'] = $url;
$data['menu']['base_url'] = $url; $data['menu']['base_url'] = $url;
$data['body']['base_url'] = $url; $data['body']['base_url'] = $url;
$data['footer']['base_url'] = $url; $data['footer']['base_url'] = $url;
/**/ /**/
$this->load->view('header', $data['header']); $this->load->view('header', $data['header']);
if (isset($data['menu']['url']) && isset($data['menu']['data'])) { if (isset($data['menu']['url']) && isset($data['menu']['data'])) {
$this->load->view($data['menu']['url'], $data['menu']['data']); $this->load->view($data['menu']['url'], $data['menu']['data']);
} }
if (!isset($data['body']['data'])) { if (!isset($data['body']['data'])) {
$data['body']['data'] = array(); $data['body']['data'] = array();
} }
$this->load->view($data['body']['url'], $data['body']['data']); $this->load->view($data['body']['url'], $data['body']['data']);
$this->load->view('footer', $data['footer']); $this->load->view('footer', $data['footer']);
/**/ /**/
} }
} }
/**/ /**/
\ No newline at end of file
<?php if (isset($error_message)) { ?> <?php if (isset($error_message)) { ?>
<div class="warning"><?php echo $error_message;?></div> <div class="warning"><?php echo $error_message;?></div>
<?php } ?> <?php } ?>
<form action="<?php echo $auth_url;?>" method="POST"> <form action="<?php echo $auth_url;?>" method="POST">
<table> <table>
<tr> <tr>
<td>Логин:</td> <td>Логин:</td>
<td><input name="login" type="text" required/></td> <td><input name="login" type="text" required/></td>
</tr> </tr>
<tr> <tr>
<td>Пароль:</td> <td>Пароль:</td>
<td><input name="password" type="password" required/></td> <td><input name="password" type="password" required/></td>
</tr> </tr>
<tr> <tr>
<td><input type="submit" value="Войти"/></td> <td><input type="submit" value="Войти"/></td>
</tr> </tr>
</table> </table>
</form> </form>
</div> </div>
</div> </div>
<footer id="footer"> <footer id="footer">
<p>Copyright (c) barbass 2012</p> <p>Copyright (c) barbass 2012</p>
</footer> </footer>
</body> </body>
</html> </html>
\ No newline at end of file
<!DOCTYPE html> <!DOCTYPE html>
<html lang="ru"> <html lang="ru">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>TYPOS@ETERSOFT - Сервис опечаток</title> <title>TYPOS@ETERSOFT - Сервис опечаток</title>
<!--Скрипты и стили--> <!--Скрипты и стили-->
<!--<script src="<?=$base_url;?>javascript/typos.config.js" type="text/javascript"></script>--> <!--<script src="<?=$base_url;?>javascript/typos.config.js" type="text/javascript"></script>-->
<script src="<?=$base_url;?>javascript/jquery/jquery-1.9.0.min.js" type="text/javascript"></script> <script src="<?=$base_url;?>javascript/jquery/jquery-1.9.0.min.js" type="text/javascript"></script>
<script src="<?=$base_url;?>javascript/jquery_plugins/jquery-ui/jquery-ui-1.10.3/ui/minified/jquery-ui.min.js" type="text/javascript"></script> <script src="<?=$base_url;?>javascript/jquery_plugins/jquery-ui/jquery-ui-1.10.3/ui/minified/jquery-ui.min.js" type="text/javascript"></script>
<link type="text/css" href="<?=$base_url;?>javascript/jquery_plugins/jquery-ui/jquery-ui-1.10.3/themes/ui-lightness/jquery-ui-1.10.3.custom.min.css" rel="stylesheet" /> <link type="text/css" href="<?=$base_url;?>javascript/jquery_plugins/jquery-ui/jquery-ui-1.10.3/themes/ui-lightness/jquery-ui-1.10.3.custom.min.css" rel="stylesheet" />
<link type="text/css" href="<?=$base_url;?>stylesheet/stylesheet.css" rel="stylesheet" /> <link type="text/css" href="<?=$base_url;?>stylesheet/stylesheet.css" rel="stylesheet" />
</head> </head>
<body> <body>
<!-- Шапка --> <!-- Шапка -->
<div id="head"> <div id="head">
<h3> TYPOS </h3> <h3> TYPOS </h3>
</div> </div>
<div id="page"> <div id="page">
<div id="content"> <div id="content">
<div class="left"> <div class="left">
<div id="menu"> <div id="menu">
<span class="heading">Меню</span> <span class="heading">Меню</span>
<div class="items"> <div class="items">
<ul> <ul>
<?php <?php
if ($items) { if ($items) {
foreach ($items as $item) { foreach ($items as $item) {
echo "<li>".$item."</li>"; echo "<li>".$item."</li>";
} }
} }
?> ?>
</ul> </ul>
</div> </div>
</div> </div>
</div> </div>
\ No newline at end of file
...@@ -78,6 +78,9 @@ ETYPOS.prototype = { ...@@ -78,6 +78,9 @@ ETYPOS.prototype = {
openWindow: function() { openWindow: function() {
var main_div = document.querySelector(".e_typos_div"); var main_div = document.querySelector(".e_typos_div");
this.userdata['text'] = this.getSelectText();
main_div.querySelector(".e_typos_desc .e_typos_desc_text").innerHTML = this.userdata['text'];
//Определяем на какой позиции X, Y всплывет элемент //Определяем на какой позиции X, Y всплывет элемент
var top = window.pageYOffset + window.innerHeight/3; var top = window.pageYOffset + window.innerHeight/3;
var left = window.pageXOffset + window.innerWidth/3; var left = window.pageXOffset + window.innerWidth/3;
...@@ -133,7 +136,7 @@ ETYPOS.prototype = { ...@@ -133,7 +136,7 @@ ETYPOS.prototype = {
/*Сбор данных*/ /*Сбор данных*/
postData: function() { postData: function() {
this.userdata['url'] = window.location.href; this.userdata['url'] = window.location.href;
this.userdata['text'] = this.getSelectText(); //this.userdata['text'] = this.getSelectText();
this.userdata['comment'] = (document.querySelector(".e_typos_div .e_typos_comment")) ? document.querySelector(".e_typos_div .e_typos_comment").value : ''; this.userdata['comment'] = (document.querySelector(".e_typos_div .e_typos_comment")) ? document.querySelector(".e_typos_div .e_typos_comment").value : '';
try { try {
......
...@@ -2,12 +2,18 @@ ...@@ -2,12 +2,18 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>Сервис опечаток</title> <title>Сервис опечаток</title>
<!-- Этот код прописываем в head -->
<script src="etersoft_typos.js"></script> <script src="etersoft_typos.js"></script>
<link type="text/css" href="etersoft_typos.css" rel="stylesheet" />
<!-- По умолчанию русский язык уже встроен -->
<script src="etersoft_typos_language-ru.js"></script> <script src="etersoft_typos_language-ru.js"></script>
<link type="text/css" href="stylesheet.css" rel="stylesheet" />
</head> </head>
<body> <body>
<!-- Этот js вставляе в страницу -->
<script type='text/javascript'> <script type='text/javascript'>
window.onload = function() { window.onload = function() {
var typos = new ETYPOS(); var typos = new ETYPOS();
...@@ -23,14 +29,19 @@ ...@@ -23,14 +29,19 @@
}; };
} }
</script> </script>
<!-- end -->
<!-- Этот html-код вставляем на страницу -->
<div class="e_typos_div"> <div class="e_typos_div">
<div class="e_typos_title"> <div class="e_typos_title">
<span>Сервис опечаток</span> <span>Сервис опечаток</span>
<span title="Закрыть окно" class="e_typos_close"><b>х</b></span> <span title="Закрыть окно" class="e_typos_close"><b>х</b></span>
</div> </div>
<p class="e_typos_desc">Выделите текст и нажмите кнопку "Отправить"</p> <p class="e_typos_desc">
Вы выделили:
<b class='e_typos_desc_text'></b>
</p>
<p> <p>
<nobr>Комментарий: <input type="text" class="e_typos_comment" size='19' maxlength="50" placeholder="Должна быть буква..."/></nobr> <nobr>Комментарий: <input type="text" class="e_typos_comment" size='19' maxlength="50" placeholder="Должна быть буква..."/></nobr>
...@@ -44,6 +55,7 @@ ...@@ -44,6 +55,7 @@
<input type="button" title="Закрыть окно" value="Закрыть" class="e_typos_button e_typos_close" /> <input type="button" title="Закрыть окно" value="Закрыть" class="e_typos_button e_typos_close" />
</p> </p>
</div> </div>
<!-- end -->
<div> <div>
Казахста́н (официально Респу́блика Казахста́н, каз. Қазақстан [qɑzɑqˈstɑn]) — государство, располагающееся в центре Евразии, бо́льшая часть которого относится к Азии, а меньшая — к Европе, Казахстан располагается между Каспийским морем, Нижним Поволжьем, Уралом, Сибирью, Китаем и Средней Азией. Казахста́н (официально Респу́блика Казахста́н, каз. Қазақстан [qɑzɑqˈstɑn]) — государство, располагающееся в центре Евразии, бо́льшая часть которого относится к Азии, а меньшая — к Европе, Казахстан располагается между Каспийским морем, Нижним Поволжьем, Уралом, Сибирью, Китаем и Средней Азией.
......
<?xml version="1.0"?> <?xml version="1.0"?>
<bindings <bindings
xmlns="http://www.mozilla.org/xbl" xmlns="http://www.mozilla.org/xbl"
xmlns:xbl="http://www.mozilla.org/xbl" xmlns:xbl="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<binding id="ellipsis"> <binding id="ellipsis">
<content> <content>
<xul:window><!-- xul:window tag required for FF2 --> <xul:window><!-- xul:window tag required for FF2 -->
<xul:description crop="end" xbl:inherits="value=xbl:text"><children/></xul:description> <xul:description crop="end" xbl:inherits="value=xbl:text"><children/></xul:description>
</xul:window> </xul:window>
</content> </content>
</binding> </binding>
</bindings> </bindings>
Installation Installation
Download the jqGrid package from the www.trirand/blog site section downloads. Download the jqGrid package from the www.trirand/blog site section downloads.
Note the new download manager where you can choose which modules you want to Note the new download manager where you can choose which modules you want to
include in the download. include in the download.
In order to use jqGrid 3.5, first a UI theme css file should be loaded. In order to use jqGrid 3.5, first a UI theme css file should be loaded.
Download the desired theme (or build a custom one) from jQueryUI site Download the desired theme (or build a custom one) from jQueryUI site
(www.jqueryui.com) and point in your link tag in head section the path to the (www.jqueryui.com) and point in your link tag in head section the path to the
theme css theme css
<link rel="stylesheet" type="text/css" media="screen" href="path_to_ui_css_file/jquery-ui-1.7.1.custom.css" /> <link rel="stylesheet" type="text/css" media="screen" href="path_to_ui_css_file/jquery-ui-1.7.1.custom.css" />
where the path_to_ui_css_file is a valid path to the ui theme file where the path_to_ui_css_file is a valid path to the ui theme file
Extract the jqGrid package and copy the ui.jqgrid.css from css directory to Extract the jqGrid package and copy the ui.jqgrid.css from css directory to
your webserver directory. It is not necessary that the jqgrid css file is in your webserver directory. It is not necessary that the jqgrid css file is in
the same directory as those of the jquery ui css. the same directory as those of the jquery ui css.
<link rel="stylesheet" type="text/css" media="screen" href="path_to_jqgrid_css_file/ui.jqgrid.css" /> <link rel="stylesheet" type="text/css" media="screen" href="path_to_jqgrid_css_file/ui.jqgrid.css" />
Starting with this version, jqGrid does not use a loader (which loads the Starting with this version, jqGrid does not use a loader (which loads the
needed files one by one), but all the needed code is contained in one file. needed files one by one), but all the needed code is contained in one file.
The desired modules can be built using the jqGrid download manager from the The desired modules can be built using the jqGrid download manager from the
site pointed above. In order to use this, first a language file should be site pointed above. In order to use this, first a language file should be
loaded and then the jqgrid file. loaded and then the jqgrid file.
Copy the desired language file from js/i18n directory to your web server Copy the desired language file from js/i18n directory to your web server
directory where you store the java script files. Every language file is directory where you store the java script files. Every language file is
named grid.locale-XX.js, where XX is a two-letter code for the language. named grid.locale-XX.js, where XX is a two-letter code for the language.
Copy the jquery.jqGid.min.js file to the same or other valid directory in Copy the jquery.jqGid.min.js file to the same or other valid directory in
your web server your web server
Include both the files in script tags in the head section Include both the files in script tags in the head section
<script src="path_to_js_files/grid.locale-en.js" type="text/javascript"></script> <script src="path_to_js_files/grid.locale-en.js" type="text/javascript"></script>
<script src="path_to_js_files/jquery.jqGrid.min.js" type="text/javascript"></script> <script src="path_to_js_files/jquery.jqGrid.min.js" type="text/javascript"></script>
For debugging purposes, I have created a grid.loader.js which does the same For debugging purposes, I have created a grid.loader.js which does the same
loading of the files as in previous versions. The location of the file is in loading of the files as in previous versions. The location of the file is in
src directory of the package. In order to use this, the variable pathojsfiles src directory of the package. In order to use this, the variable pathojsfiles
should be adjusted to point to the appropriate folder - see 3.4.x docs. should be adjusted to point to the appropriate folder - see 3.4.x docs.
This source diff could not be displayed because it is too large. You can view the blob instead.
;(function($){ ;(function($){
/** /**
* jqGrid extension * jqGrid extension
* Paul Tiseo ptiseo@wasteconsultants.com * Paul Tiseo ptiseo@wasteconsultants.com
* *
* Dual licensed under the MIT and GPL licenses: * Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html * http://www.gnu.org/licenses/gpl-2.0.html
**/ **/
$.jgrid.extend({ $.jgrid.extend({
getPostData : function(){ getPostData : function(){
var $t = this[0]; var $t = this[0];
if(!$t.grid) { return; } if(!$t.grid) { return; }
return $t.p.postData; return $t.p.postData;
}, },
setPostData : function( newdata ) { setPostData : function( newdata ) {
var $t = this[0]; var $t = this[0];
if(!$t.grid) { return; } if(!$t.grid) { return; }
// check if newdata is correct type // check if newdata is correct type
if ( typeof(newdata) === 'object' ) { if ( typeof(newdata) === 'object' ) {
$t.p.postData = newdata; $t.p.postData = newdata;
} }
else { else {
alert("Error: cannot add a non-object postData value. postData unchanged."); alert("Error: cannot add a non-object postData value. postData unchanged.");
} }
}, },
appendPostData : function( newdata ) { appendPostData : function( newdata ) {
var $t = this[0]; var $t = this[0];
if(!$t.grid) { return; } if(!$t.grid) { return; }
// check if newdata is correct type // check if newdata is correct type
if ( typeof(newdata) === 'object' ) { if ( typeof(newdata) === 'object' ) {
$.extend($t.p.postData, newdata); $.extend($t.p.postData, newdata);
} }
else { else {
alert("Error: cannot append a non-object postData value. postData unchanged."); alert("Error: cannot append a non-object postData value. postData unchanged.");
} }
}, },
setPostDataItem : function( key, val ) { setPostDataItem : function( key, val ) {
var $t = this[0]; var $t = this[0];
if(!$t.grid) { return; } if(!$t.grid) { return; }
$t.p.postData[key] = val; $t.p.postData[key] = val;
}, },
getPostDataItem : function( key ) { getPostDataItem : function( key ) {
var $t = this[0]; var $t = this[0];
if(!$t.grid) { return; } if(!$t.grid) { return; }
return $t.p.postData[key]; return $t.p.postData[key];
}, },
removePostDataItem : function( key ) { removePostDataItem : function( key ) {
var $t = this[0]; var $t = this[0];
if(!$t.grid) { return; } if(!$t.grid) { return; }
delete $t.p.postData[key]; delete $t.p.postData[key];
}, },
getUserData : function(){ getUserData : function(){
var $t = this[0]; var $t = this[0];
if(!$t.grid) { return; } if(!$t.grid) { return; }
return $t.p.userData; return $t.p.userData;
}, },
getUserDataItem : function( key ) { getUserDataItem : function( key ) {
var $t = this[0]; var $t = this[0];
if(!$t.grid) { return; } if(!$t.grid) { return; }
return $t.p.userData[key]; return $t.p.userData[key];
} }
}); });
})(jQuery); })(jQuery);
\ No newline at end of file
/* /*
* ContextMenu - jQuery plugin for right-click context menus * ContextMenu - jQuery plugin for right-click context menus
* *
* Author: Chris Domigan * Author: Chris Domigan
* Contributors: Dan G. Switzer, II * Contributors: Dan G. Switzer, II
* Parts of this plugin are inspired by Joern Zaefferer's Tooltip plugin * Parts of this plugin are inspired by Joern Zaefferer's Tooltip plugin
* *
* Dual licensed under the MIT and GPL licenses: * Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html * http://www.gnu.org/licenses/gpl.html
* *
* Version: r2 * Version: r2
* Date: 16 July 2007 * Date: 16 July 2007
* *
* For documentation visit http://www.trendskitchens.co.nz/jquery/contextmenu/ * For documentation visit http://www.trendskitchens.co.nz/jquery/contextmenu/
* *
*/ */
(function($) { (function($) {
var menu, shadow, content, hash, currentTarget; var menu, shadow, content, hash, currentTarget;
var defaults = { var defaults = {
menuStyle: { menuStyle: {
listStyle: 'none', listStyle: 'none',
padding: '1px', padding: '1px',
margin: '0px', margin: '0px',
backgroundColor: '#fff', backgroundColor: '#fff',
border: '1px solid #999', border: '1px solid #999',
width: '100px' width: '100px'
}, },
itemStyle: { itemStyle: {
margin: '0px', margin: '0px',
color: '#000', color: '#000',
display: 'block', display: 'block',
cursor: 'default', cursor: 'default',
padding: '3px', padding: '3px',
border: '1px solid #fff', border: '1px solid #fff',
backgroundColor: 'transparent' backgroundColor: 'transparent'
}, },
itemHoverStyle: { itemHoverStyle: {
border: '1px solid #0a246a', border: '1px solid #0a246a',
backgroundColor: '#b6bdd2' backgroundColor: '#b6bdd2'
}, },
eventPosX: 'pageX', eventPosX: 'pageX',
eventPosY: 'pageY', eventPosY: 'pageY',
shadow : true, shadow : true,
onContextMenu: null, onContextMenu: null,
onShowMenu: null onShowMenu: null
}; };
$.fn.contextMenu = function(id, options) { $.fn.contextMenu = function(id, options) {
if (!menu) { // Create singleton menu if (!menu) { // Create singleton menu
menu = $('<div id="jqContextMenu"></div>') menu = $('<div id="jqContextMenu"></div>')
.hide() .hide()
.css({position:'absolute', zIndex:'500'}) .css({position:'absolute', zIndex:'500'})
.appendTo('body') .appendTo('body')
.bind('click', function(e) { .bind('click', function(e) {
e.stopPropagation(); e.stopPropagation();
}); });
} }
if (!shadow) { if (!shadow) {
shadow = $('<div></div>') shadow = $('<div></div>')
.css({backgroundColor:'#000',position:'absolute',opacity:0.2,zIndex:499}) .css({backgroundColor:'#000',position:'absolute',opacity:0.2,zIndex:499})
.appendTo('body') .appendTo('body')
.hide(); .hide();
} }
hash = hash || []; hash = hash || [];
hash.push({ hash.push({
id : id, id : id,
menuStyle: $.extend({}, defaults.menuStyle, options.menuStyle || {}), menuStyle: $.extend({}, defaults.menuStyle, options.menuStyle || {}),
itemStyle: $.extend({}, defaults.itemStyle, options.itemStyle || {}), itemStyle: $.extend({}, defaults.itemStyle, options.itemStyle || {}),
itemHoverStyle: $.extend({}, defaults.itemHoverStyle, options.itemHoverStyle || {}), itemHoverStyle: $.extend({}, defaults.itemHoverStyle, options.itemHoverStyle || {}),
bindings: options.bindings || {}, bindings: options.bindings || {},
shadow: options.shadow || options.shadow === false ? options.shadow : defaults.shadow, shadow: options.shadow || options.shadow === false ? options.shadow : defaults.shadow,
onContextMenu: options.onContextMenu || defaults.onContextMenu, onContextMenu: options.onContextMenu || defaults.onContextMenu,
onShowMenu: options.onShowMenu || defaults.onShowMenu, onShowMenu: options.onShowMenu || defaults.onShowMenu,
eventPosX: options.eventPosX || defaults.eventPosX, eventPosX: options.eventPosX || defaults.eventPosX,
eventPosY: options.eventPosY || defaults.eventPosY eventPosY: options.eventPosY || defaults.eventPosY
}); });
var index = hash.length - 1; var index = hash.length - 1;
$(this).bind('contextmenu', function(e) { $(this).bind('contextmenu', function(e) {
// Check if onContextMenu() defined // Check if onContextMenu() defined
var bShowContext = (!!hash[index].onContextMenu) ? hash[index].onContextMenu(e) : true; var bShowContext = (!!hash[index].onContextMenu) ? hash[index].onContextMenu(e) : true;
currentTarget = e.target; currentTarget = e.target;
if (bShowContext) { if (bShowContext) {
display(index, this, e ); display(index, this, e );
return false; return false;
} }
}); });
return this; return this;
}; };
function display(index, trigger, e ) { function display(index, trigger, e ) {
var cur = hash[index]; var cur = hash[index];
content = $('#'+cur.id).find('ul:first').clone(true); content = $('#'+cur.id).find('ul:first').clone(true);
content.css(cur.menuStyle).find('li').css(cur.itemStyle).hover( content.css(cur.menuStyle).find('li').css(cur.itemStyle).hover(
function() { function() {
$(this).css(cur.itemHoverStyle); $(this).css(cur.itemHoverStyle);
}, },
function(){ function(){
$(this).css(cur.itemStyle); $(this).css(cur.itemStyle);
} }
).find('img').css({verticalAlign:'middle',paddingRight:'2px'}); ).find('img').css({verticalAlign:'middle',paddingRight:'2px'});
// Send the content to the menu // Send the content to the menu
menu.html(content); menu.html(content);
// if there's an onShowMenu, run it now -- must run after content has been added // if there's an onShowMenu, run it now -- must run after content has been added
// if you try to alter the content variable before the menu.html(), IE6 has issues // if you try to alter the content variable before the menu.html(), IE6 has issues
// updating the content // updating the content
if (!!cur.onShowMenu) menu = cur.onShowMenu(e, menu); if (!!cur.onShowMenu) menu = cur.onShowMenu(e, menu);
$.each(cur.bindings, function(id, func) { $.each(cur.bindings, function(id, func) {
$('#'+id, menu).bind('click', function() { $('#'+id, menu).bind('click', function() {
hide(); hide();
func(trigger, currentTarget); func(trigger, currentTarget);
}); });
}); });
menu.css({'left':e[cur.eventPosX],'top':e[cur.eventPosY]}).show(); menu.css({'left':e[cur.eventPosX],'top':e[cur.eventPosY]}).show();
if (cur.shadow) shadow.css({width:menu.width(),height:menu.height(),left:e.pageX+2,top:e.pageY+2}).show(); if (cur.shadow) shadow.css({width:menu.width(),height:menu.height(),left:e.pageX+2,top:e.pageY+2}).show();
$(document).one('click', hide); $(document).one('click', hide);
} }
function hide() { function hide() {
menu.hide(); menu.hide();
shadow.hide(); shadow.hide();
} }
// Apply defaults // Apply defaults
$.contextMenu = { $.contextMenu = {
defaults : function(userDefaults) { defaults : function(userDefaults) {
$.each(userDefaults, function(i, val) { $.each(userDefaults, function(i, val) {
if (typeof val == 'object' && defaults[i]) { if (typeof val == 'object' && defaults[i]) {
$.extend(defaults[i], val); $.extend(defaults[i], val);
} }
else defaults[i] = val; else defaults[i] = val;
}); });
} }
}; };
})(jQuery); })(jQuery);
$(function() { $(function() {
$('div.contextMenu').hide(); $('div.contextMenu').hide();
}); });
\ No newline at end of file
.ui-searchFilter { display: none; position: absolute; z-index: 770; overflow: visible;} .ui-searchFilter { display: none; position: absolute; z-index: 770; overflow: visible;}
.ui-searchFilter table {position:relative; margin:0em; width:auto} .ui-searchFilter table {position:relative; margin:0em; width:auto}
.ui-searchFilter table td {margin: 0em; padding: 1px;} .ui-searchFilter table td {margin: 0em; padding: 1px;}
.ui-searchFilter table td input, .ui-searchFilter table td select {margin: 0.1em;} .ui-searchFilter table td input, .ui-searchFilter table td select {margin: 0.1em;}
.ui-searchFilter .ui-state-default { cursor: pointer; } .ui-searchFilter .ui-state-default { cursor: pointer; }
.ui-searchFilter .divider hr {margin: 1px; } .ui-searchFilter .divider hr {margin: 1px; }
\ No newline at end of file
/* Multiselect /* Multiselect
----------------------------------*/ ----------------------------------*/
.ui-multiselect { border: solid 1px; font-size: 0.8em; } .ui-multiselect { border: solid 1px; font-size: 0.8em; }
.ui-multiselect ul { -moz-user-select: none; } .ui-multiselect ul { -moz-user-select: none; }
.ui-multiselect li { margin: 0; padding: 0; cursor: default; line-height: 20px; height: 20px; font-size: 11px; list-style: none; } .ui-multiselect li { margin: 0; padding: 0; cursor: default; line-height: 20px; height: 20px; font-size: 11px; list-style: none; }
.ui-multiselect li a { color: #999; text-decoration: none; padding: 0; display: block; float: left; cursor: pointer;} .ui-multiselect li a { color: #999; text-decoration: none; padding: 0; display: block; float: left; cursor: pointer;}
.ui-multiselect li.ui-draggable-dragging { padding-left: 10px; } .ui-multiselect li.ui-draggable-dragging { padding-left: 10px; }
.ui-multiselect div.selected { position: relative; padding: 0; margin: 0; border: 0; float:left; } .ui-multiselect div.selected { position: relative; padding: 0; margin: 0; border: 0; float:left; }
.ui-multiselect ul.selected { position: relative; padding: 0; overflow: auto; overflow-x: hidden; background: #fff; margin: 0; list-style: none; border: 0; position: relative; width: 100%; } .ui-multiselect ul.selected { position: relative; padding: 0; overflow: auto; overflow-x: hidden; background: #fff; margin: 0; list-style: none; border: 0; position: relative; width: 100%; }
.ui-multiselect ul.selected li { } .ui-multiselect ul.selected li { }
.ui-multiselect div.available { position: relative; padding: 0; margin: 0; border: 0; float:left; border-left: 1px solid; } .ui-multiselect div.available { position: relative; padding: 0; margin: 0; border: 0; float:left; border-left: 1px solid; }
.ui-multiselect ul.available { position: relative; padding: 0; overflow: auto; overflow-x: hidden; background: #fff; margin: 0; list-style: none; border: 0; width: 100%; } .ui-multiselect ul.available { position: relative; padding: 0; overflow: auto; overflow-x: hidden; background: #fff; margin: 0; list-style: none; border: 0; width: 100%; }
.ui-multiselect ul.available li { padding-left: 10px; } .ui-multiselect ul.available li { padding-left: 10px; }
.ui-multiselect .ui-state-default { border: none; margin-bottom: 1px; position: relative; padding-left: 20px;} .ui-multiselect .ui-state-default { border: none; margin-bottom: 1px; position: relative; padding-left: 20px;}
.ui-multiselect .ui-state-hover { border: none; } .ui-multiselect .ui-state-hover { border: none; }
.ui-multiselect .ui-widget-header {border: none; font-size: 11px; margin-bottom: 1px;} .ui-multiselect .ui-widget-header {border: none; font-size: 11px; margin-bottom: 1px;}
.ui-multiselect .add-all { float: right; padding: 7px;} .ui-multiselect .add-all { float: right; padding: 7px;}
.ui-multiselect .remove-all { float: right; padding: 7px;} .ui-multiselect .remove-all { float: right; padding: 7px;}
.ui-multiselect .search { float: left; padding: 4px;} .ui-multiselect .search { float: left; padding: 4px;}
.ui-multiselect .count { float: left; padding: 7px;} .ui-multiselect .count { float: left; padding: 7px;}
.ui-multiselect li span.ui-icon-arrowthick-2-n-s { position: absolute; left: 2px; } .ui-multiselect li span.ui-icon-arrowthick-2-n-s { position: absolute; left: 2px; }
.ui-multiselect li a.action { position: absolute; right: 2px; top: 2px; } .ui-multiselect li a.action { position: absolute; right: 2px; top: 2px; }
.ui-multiselect input.search { height: 14px; padding: 1px; opacity: 0.5; margin: 4px; width: 100px; } .ui-multiselect input.search { height: 14px; padding: 1px; opacity: 0.5; margin: 4px; width: 100px; }
\ No newline at end of file
<?xml version="1.0"?> <?xml version="1.0"?>
<bindings <bindings
xmlns="http://www.mozilla.org/xbl" xmlns="http://www.mozilla.org/xbl"
xmlns:xbl="http://www.mozilla.org/xbl" xmlns:xbl="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<binding id="ellipsis"> <binding id="ellipsis">
<content> <content>
<xul:window><!-- xul:window tag required for FF2 --> <xul:window><!-- xul:window tag required for FF2 -->
<xul:description crop="end" xbl:inherits="value=xbl:text"><children/></xul:description> <xul:description crop="end" xbl:inherits="value=xbl:text"><children/></xul:description>
</xul:window> </xul:window>
</content> </content>
</binding> </binding>
</bindings> </bindings>
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
//This file should be used if you want to debug and develop //This file should be used if you want to debug and develop
function jqGridInclude() function jqGridInclude()
{ {
var pathtojsfiles = "js/"; // need to be ajusted var pathtojsfiles = "js/"; // need to be ajusted
// set include to false if you do not want some modules to be included // set include to false if you do not want some modules to be included
var modules = [ var modules = [
{ include: true, incfile:'i18n/grid.locale-en.js'}, // jqGrid translation { include: true, incfile:'i18n/grid.locale-en.js'}, // jqGrid translation
{ include: true, incfile:'grid.base.js'}, // jqGrid base { include: true, incfile:'grid.base.js'}, // jqGrid base
{ include: true, incfile:'grid.common.js'}, // jqGrid common for editing { include: true, incfile:'grid.common.js'}, // jqGrid common for editing
{ include: true, incfile:'grid.formedit.js'}, // jqGrid Form editing { include: true, incfile:'grid.formedit.js'}, // jqGrid Form editing
{ include: true, incfile:'grid.inlinedit.js'}, // jqGrid inline editing { include: true, incfile:'grid.inlinedit.js'}, // jqGrid inline editing
{ include: true, incfile:'grid.celledit.js'}, // jqGrid cell editing { include: true, incfile:'grid.celledit.js'}, // jqGrid cell editing
{ include: true, incfile:'grid.subgrid.js'}, //jqGrid subgrid { include: true, incfile:'grid.subgrid.js'}, //jqGrid subgrid
{ include: true, incfile:'grid.treegrid.js'}, //jqGrid treegrid { include: true, incfile:'grid.treegrid.js'}, //jqGrid treegrid
{ include: true, incfile:'grid.grouping.js'}, //jqGrid grouping { include: true, incfile:'grid.grouping.js'}, //jqGrid grouping
{ include: true, incfile:'grid.custom.js'}, //jqGrid custom { include: true, incfile:'grid.custom.js'}, //jqGrid custom
{ include: true, incfile:'grid.tbltogrid.js'}, //jqGrid table to grid { include: true, incfile:'grid.tbltogrid.js'}, //jqGrid table to grid
{ include: true, incfile:'grid.import.js'}, //jqGrid import { include: true, incfile:'grid.import.js'}, //jqGrid import
{ include: true, incfile:'jquery.fmatter.js'}, //jqGrid formater { include: true, incfile:'jquery.fmatter.js'}, //jqGrid formater
{ include: true, incfile:'JsonXml.js'}, //xmljson utils { include: true, incfile:'JsonXml.js'}, //xmljson utils
{ include: true, incfile:'grid.jqueryui.js'}, //jQuery UI utils { include: true, incfile:'grid.jqueryui.js'}, //jQuery UI utils
{ include: true, incfile:'grid.filter.js'} // filter Plugin { include: true, incfile:'grid.filter.js'} // filter Plugin
]; ];
var filename; var filename;
for(var i=0;i<modules.length; i++) for(var i=0;i<modules.length; i++)
{ {
if(modules[i].include === true) { if(modules[i].include === true) {
filename = pathtojsfiles+modules[i].incfile; filename = pathtojsfiles+modules[i].incfile;
if(jQuery.browser.safari) { if(jQuery.browser.safari) {
jQuery.ajax({url:filename,dataType:'script', async:false, cache: true}); jQuery.ajax({url:filename,dataType:'script', async:false, cache: true});
} else { } else {
if (jQuery.browser.msie) { if (jQuery.browser.msie) {
document.write('<script charset="utf-8" type="text/javascript" src="'+filename+'"></script>'); document.write('<script charset="utf-8" type="text/javascript" src="'+filename+'"></script>');
} else { } else {
IncludeJavaScript(filename); IncludeJavaScript(filename);
} }
} }
} }
} }
function IncludeJavaScript(jsFile) function IncludeJavaScript(jsFile)
{ {
var oHead = document.getElementsByTagName('head')[0]; var oHead = document.getElementsByTagName('head')[0];
var oScript = document.createElement('script'); var oScript = document.createElement('script');
oScript.setAttribute('type', 'text/javascript'); oScript.setAttribute('type', 'text/javascript');
oScript.setAttribute('language', 'javascript'); oScript.setAttribute('language', 'javascript');
oScript.setAttribute('src', jsFile); oScript.setAttribute('src', jsFile);
oHead.appendChild(oScript); oHead.appendChild(oScript);
} }
} }
jqGridInclude(); jqGridInclude();
/* /*
Transform a table to a jqGrid. Transform a table to a jqGrid.
Peter Romianowski <peter.romianowski@optivo.de> Peter Romianowski <peter.romianowski@optivo.de>
If the first column of the table contains checkboxes or If the first column of the table contains checkboxes or
radiobuttons then the jqGrid is made selectable. radiobuttons then the jqGrid is made selectable.
*/ */
// Addition - selector can be a class or id // Addition - selector can be a class or id
function tableToGrid(selector, options) { function tableToGrid(selector, options) {
jQuery(selector).each(function() { jQuery(selector).each(function() {
if(this.grid) {return;} //Adedd from Tony Tomov if(this.grid) {return;} //Adedd from Tony Tomov
// This is a small "hack" to make the width of the jqGrid 100% // This is a small "hack" to make the width of the jqGrid 100%
jQuery(this).width("99%"); jQuery(this).width("99%");
var w = jQuery(this).width(); var w = jQuery(this).width();
// Text whether we have single or multi select // Text whether we have single or multi select
var inputCheckbox = jQuery('tr td:first-child input[type=checkbox]:first', jQuery(this)); var inputCheckbox = jQuery('tr td:first-child input[type=checkbox]:first', jQuery(this));
var inputRadio = jQuery('tr td:first-child input[type=radio]:first', jQuery(this)); var inputRadio = jQuery('tr td:first-child input[type=radio]:first', jQuery(this));
var selectMultiple = inputCheckbox.length > 0; var selectMultiple = inputCheckbox.length > 0;
var selectSingle = !selectMultiple && inputRadio.length > 0; var selectSingle = !selectMultiple && inputRadio.length > 0;
var selectable = selectMultiple || selectSingle; var selectable = selectMultiple || selectSingle;
//var inputName = inputCheckbox.attr("name") || inputRadio.attr("name"); //var inputName = inputCheckbox.attr("name") || inputRadio.attr("name");
// Build up the columnModel and the data // Build up the columnModel and the data
var colModel = []; var colModel = [];
var colNames = []; var colNames = [];
jQuery('th', jQuery(this)).each(function() { jQuery('th', jQuery(this)).each(function() {
if (colModel.length === 0 && selectable) { if (colModel.length === 0 && selectable) {
colModel.push({ colModel.push({
name: '__selection__', name: '__selection__',
index: '__selection__', index: '__selection__',
width: 0, width: 0,
hidden: true hidden: true
}); });
colNames.push('__selection__'); colNames.push('__selection__');
} else { } else {
colModel.push({ colModel.push({
name: jQuery(this).attr("id") || jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(' ').join('_'), name: jQuery(this).attr("id") || jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(' ').join('_'),
index: jQuery(this).attr("id") || jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(' ').join('_'), index: jQuery(this).attr("id") || jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(' ').join('_'),
width: jQuery(this).width() || 150 width: jQuery(this).width() || 150
}); });
colNames.push(jQuery(this).html()); colNames.push(jQuery(this).html());
} }
}); });
var data = []; var data = [];
var rowIds = []; var rowIds = [];
var rowChecked = []; var rowChecked = [];
jQuery('tbody > tr', jQuery(this)).each(function() { jQuery('tbody > tr', jQuery(this)).each(function() {
var row = {}; var row = {};
var rowPos = 0; var rowPos = 0;
jQuery('td', jQuery(this)).each(function() { jQuery('td', jQuery(this)).each(function() {
if (rowPos === 0 && selectable) { if (rowPos === 0 && selectable) {
var input = jQuery('input', jQuery(this)); var input = jQuery('input', jQuery(this));
var rowId = input.attr("value"); var rowId = input.attr("value");
rowIds.push(rowId || data.length); rowIds.push(rowId || data.length);
if (input.is(":checked")) { if (input.is(":checked")) {
rowChecked.push(rowId); rowChecked.push(rowId);
} }
row[colModel[rowPos].name] = input.attr("value"); row[colModel[rowPos].name] = input.attr("value");
} else { } else {
row[colModel[rowPos].name] = jQuery(this).html(); row[colModel[rowPos].name] = jQuery(this).html();
} }
rowPos++; rowPos++;
}); });
if(rowPos >0) { data.push(row); } if(rowPos >0) { data.push(row); }
}); });
// Clear the original HTML table // Clear the original HTML table
jQuery(this).empty(); jQuery(this).empty();
// Mark it as jqGrid // Mark it as jqGrid
jQuery(this).addClass("scroll"); jQuery(this).addClass("scroll");
jQuery(this).jqGrid(jQuery.extend({ jQuery(this).jqGrid(jQuery.extend({
datatype: "local", datatype: "local",
width: w, width: w,
colNames: colNames, colNames: colNames,
colModel: colModel, colModel: colModel,
multiselect: selectMultiple multiselect: selectMultiple
//inputName: inputName, //inputName: inputName,
//inputValueCol: imputName != null ? "__selection__" : null //inputValueCol: imputName != null ? "__selection__" : null
}, options || {})); }, options || {}));
// Add data // Add data
var a; var a;
for (a = 0; a < data.length; a++) { for (a = 0; a < data.length; a++) {
var id = null; var id = null;
if (rowIds.length > 0) { if (rowIds.length > 0) {
id = rowIds[a]; id = rowIds[a];
if (id && id.replace) { if (id && id.replace) {
// We have to do this since the value of a checkbox // We have to do this since the value of a checkbox
// or radio button can be anything // or radio button can be anything
id = encodeURIComponent(id).replace(/[.\-%]/g, "_"); id = encodeURIComponent(id).replace(/[.\-%]/g, "_");
} }
} }
if (id === null) { if (id === null) {
id = a + 1; id = a + 1;
} }
jQuery(this).jqGrid("addRowData",id, data[a]); jQuery(this).jqGrid("addRowData",id, data[a]);
} }
// Set the selection // Set the selection
for (a = 0; a < rowChecked.length; a++) { for (a = 0; a < rowChecked.length; a++) {
jQuery(this).jqGrid("setSelection",rowChecked[a]); jQuery(this).jqGrid("setSelection",rowChecked[a]);
} }
}); });
}; };
/* /*
* jqDnR - Minimalistic Drag'n'Resize for jQuery. * jqDnR - Minimalistic Drag'n'Resize for jQuery.
* *
* Copyright (c) 2007 Brice Burgess <bhb@iceburg.net>, http://www.iceburg.net * Copyright (c) 2007 Brice Burgess <bhb@iceburg.net>, http://www.iceburg.net
* Licensed under the MIT License: * Licensed under the MIT License:
* http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/mit-license.php
* *
* $Version: 2007.08.19 +r2 * $Version: 2007.08.19 +r2
*/ */
(function($){ (function($){
$.fn.jqDrag=function(h){return i(this,h,'d');}; $.fn.jqDrag=function(h){return i(this,h,'d');};
$.fn.jqResize=function(h,ar){return i(this,h,'r',ar);}; $.fn.jqResize=function(h,ar){return i(this,h,'r',ar);};
$.jqDnR={ $.jqDnR={
dnr:{}, dnr:{},
e:0, e:0,
drag:function(v){ drag:function(v){
if(M.k == 'd'){E.css({left:M.X+v.pageX-M.pX,top:M.Y+v.pageY-M.pY});} if(M.k == 'd'){E.css({left:M.X+v.pageX-M.pX,top:M.Y+v.pageY-M.pY});}
else { else {
E.css({width:Math.max(v.pageX-M.pX+M.W,0),height:Math.max(v.pageY-M.pY+M.H,0)}); E.css({width:Math.max(v.pageX-M.pX+M.W,0),height:Math.max(v.pageY-M.pY+M.H,0)});
if(M1){E1.css({width:Math.max(v.pageX-M1.pX+M1.W,0),height:Math.max(v.pageY-M1.pY+M1.H,0)});} if(M1){E1.css({width:Math.max(v.pageX-M1.pX+M1.W,0),height:Math.max(v.pageY-M1.pY+M1.H,0)});}
} }
return false; return false;
}, },
stop:function(){ stop:function(){
//E.css('opacity',M.o); //E.css('opacity',M.o);
$(document).unbind('mousemove',J.drag).unbind('mouseup',J.stop); $(document).unbind('mousemove',J.drag).unbind('mouseup',J.stop);
} }
}; };
var J=$.jqDnR,M=J.dnr,E=J.e,E1,M1, var J=$.jqDnR,M=J.dnr,E=J.e,E1,M1,
i=function(e,h,k,aR){ i=function(e,h,k,aR){
return e.each(function(){ return e.each(function(){
h=(h)?$(h,e):e; h=(h)?$(h,e):e;
h.bind('mousedown',{e:e,k:k},function(v){ h.bind('mousedown',{e:e,k:k},function(v){
var d=v.data,p={};E=d.e;E1 = aR ? $(aR) : false; var d=v.data,p={};E=d.e;E1 = aR ? $(aR) : false;
// attempt utilization of dimensions plugin to fix IE issues // attempt utilization of dimensions plugin to fix IE issues
if(E.css('position') != 'relative'){try{E.position(p);}catch(e){}} if(E.css('position') != 'relative'){try{E.position(p);}catch(e){}}
M={ M={
X:p.left||f('left')||0, X:p.left||f('left')||0,
Y:p.top||f('top')||0, Y:p.top||f('top')||0,
W:f('width')||E[0].scrollWidth||0, W:f('width')||E[0].scrollWidth||0,
H:f('height')||E[0].scrollHeight||0, H:f('height')||E[0].scrollHeight||0,
pX:v.pageX, pX:v.pageX,
pY:v.pageY, pY:v.pageY,
k:d.k k:d.k
//o:E.css('opacity') //o:E.css('opacity')
}; };
// also resize // also resize
if(E1 && d.k != 'd'){ if(E1 && d.k != 'd'){
M1={ M1={
X:p.left||f1('left')||0, X:p.left||f1('left')||0,
Y:p.top||f1('top')||0, Y:p.top||f1('top')||0,
W:E1[0].offsetWidth||f1('width')||0, W:E1[0].offsetWidth||f1('width')||0,
H:E1[0].offsetHeight||f1('height')||0, H:E1[0].offsetHeight||f1('height')||0,
pX:v.pageX, pX:v.pageX,
pY:v.pageY, pY:v.pageY,
k:d.k k:d.k
}; };
} else {M1 = false;} } else {M1 = false;}
//E.css({opacity:0.8}); //E.css({opacity:0.8});
if($("input.hasDatepicker",E[0])[0]) { if($("input.hasDatepicker",E[0])[0]) {
try {$("input.hasDatepicker",E[0]).datepicker('hide');}catch (dpe){} try {$("input.hasDatepicker",E[0]).datepicker('hide');}catch (dpe){}
} }
$(document).mousemove($.jqDnR.drag).mouseup($.jqDnR.stop); $(document).mousemove($.jqDnR.drag).mouseup($.jqDnR.stop);
return false; return false;
}); });
}); });
}, },
f=function(k){return parseInt(E.css(k),10)||false;}, f=function(k){return parseInt(E.css(k),10)||false;},
f1=function(k){return parseInt(E1.css(k),10)||false;}; f1=function(k){return parseInt(E1.css(k),10)||false;};
})(jQuery); })(jQuery);
\ No newline at end of file
/* /*
* jqModal - Minimalist Modaling with jQuery * jqModal - Minimalist Modaling with jQuery
* (http://dev.iceburg.net/jquery/jqmodal/) * (http://dev.iceburg.net/jquery/jqmodal/)
* *
* Copyright (c) 2007,2008 Brice Burgess <bhb@iceburg.net> * Copyright (c) 2007,2008 Brice Burgess <bhb@iceburg.net>
* Dual licensed under the MIT and GPL licenses: * Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html * http://www.gnu.org/licenses/gpl.html
* *
* $Version: 07/06/2008 +r13 * $Version: 07/06/2008 +r13
*/ */
(function($) { (function($) {
$.fn.jqm=function(o){ $.fn.jqm=function(o){
var p={ var p={
overlay: 50, overlay: 50,
closeoverlay : true, closeoverlay : true,
overlayClass: 'jqmOverlay', overlayClass: 'jqmOverlay',
closeClass: 'jqmClose', closeClass: 'jqmClose',
trigger: '.jqModal', trigger: '.jqModal',
ajax: F, ajax: F,
ajaxText: '', ajaxText: '',
target: F, target: F,
modal: F, modal: F,
toTop: F, toTop: F,
onShow: F, onShow: F,
onHide: F, onHide: F,
onLoad: F onLoad: F
}; };
return this.each(function(){if(this._jqm)return H[this._jqm].c=$.extend({},H[this._jqm].c,o);s++;this._jqm=s; return this.each(function(){if(this._jqm)return H[this._jqm].c=$.extend({},H[this._jqm].c,o);s++;this._jqm=s;
H[s]={c:$.extend(p,$.jqm.params,o),a:F,w:$(this).addClass('jqmID'+s),s:s}; H[s]={c:$.extend(p,$.jqm.params,o),a:F,w:$(this).addClass('jqmID'+s),s:s};
if(p.trigger)$(this).jqmAddTrigger(p.trigger); if(p.trigger)$(this).jqmAddTrigger(p.trigger);
});}; });};
$.fn.jqmAddClose=function(e){return hs(this,e,'jqmHide');}; $.fn.jqmAddClose=function(e){return hs(this,e,'jqmHide');};
$.fn.jqmAddTrigger=function(e){return hs(this,e,'jqmShow');}; $.fn.jqmAddTrigger=function(e){return hs(this,e,'jqmShow');};
$.fn.jqmShow=function(t){return this.each(function(){$.jqm.open(this._jqm,t);});}; $.fn.jqmShow=function(t){return this.each(function(){$.jqm.open(this._jqm,t);});};
$.fn.jqmHide=function(t){return this.each(function(){$.jqm.close(this._jqm,t)});}; $.fn.jqmHide=function(t){return this.each(function(){$.jqm.close(this._jqm,t)});};
$.jqm = { $.jqm = {
hash:{}, hash:{},
open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-index')));z=(z>0)?z:3000;var o=$('<div></div>').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});if(h.a)return F;h.t=t;h.a=true;h.w.css('z-index',z); open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-index')));z=(z>0)?z:3000;var o=$('<div></div>').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});if(h.a)return F;h.t=t;h.a=true;h.w.css('z-index',z);
if(c.modal) {if(!A[0])setTimeout(function(){L('bind');},1);A.push(s);} if(c.modal) {if(!A[0])setTimeout(function(){L('bind');},1);A.push(s);}
else if(c.overlay > 0) {if(c.closeoverlay) h.w.jqmAddClose(o);} else if(c.overlay > 0) {if(c.closeoverlay) h.w.jqmAddClose(o);}
else o=F; else o=F;
h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):F; h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):F;
if(c.ajax) {var r=c.target||h.w,u=c.ajax;r=(typeof r == 'string')?$(r,h.w):$(r);u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u; if(c.ajax) {var r=c.target||h.w,u=c.ajax;r=(typeof r == 'string')?$(r,h.w):$(r);u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u;
r.html(c.ajaxText).load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});} r.html(c.ajaxText).load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});}
else if(cc)h.w.jqmAddClose($(cc,h.w)); else if(cc)h.w.jqmAddClose($(cc,h.w));
if(c.toTop&&h.o)h.w.before('<span id="jqmP'+h.w[0]._jqm+'"></span>').insertAfter(h.o); if(c.toTop&&h.o)h.w.before('<span id="jqmP'+h.w[0]._jqm+'"></span>').insertAfter(h.o);
(c.onShow)?c.onShow(h):h.w.show();e(h);return F; (c.onShow)?c.onShow(h):h.w.show();e(h);return F;
}, },
close:function(s){var h=H[s];if(!h.a)return F;h.a=F; close:function(s){var h=H[s];if(!h.a)return F;h.a=F;
if(A[0]){A.pop();if(!A[0])L('unbind');} if(A[0]){A.pop();if(!A[0])L('unbind');}
if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove(); if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove();
if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return F; if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return F;
}, },
params:{}}; params:{}};
var s=0,H=$.jqm.hash,A=[],F=false, var s=0,H=$.jqm.hash,A=[],F=false,
e=function(h){f(h);}, e=function(h){f(h);},
f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(_){}}, f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(_){}},
L=function(t){$(document)[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);}, L=function(t){$(document)[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);},
m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r){$('.jqmID'+h.s).each(function(){var $self=$(this),offset=$self.offset();if(offset.top<=e.pageY && e.pageY<=offset.top+$self.height() && offset.left<=e.pageX && e.pageX<=offset.left+$self.width()){r=false;return false;}});f(h);}return !r;}, m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r){$('.jqmID'+h.s).each(function(){var $self=$(this),offset=$self.offset();if(offset.top<=e.pageY && e.pageY<=offset.top+$self.height() && offset.left<=e.pageX && e.pageX<=offset.left+$self.width()){r=false;return false;}});f(h);}return !r;},
hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function() { hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function() {
if(!this[c]){this[c]=[];$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return F;});}this[c].push(s);});});}; if(!this[c]){this[c]=[];$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return F;});}this[c].push(s);});});};
})(jQuery); })(jQuery);
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
<div style="font-size:12px;"> <div style="font-size:12px;">
In 3.6 we have done so that the developer can controll full the ajax requests to the server. For this purpose<br> In 3.6 we have done so that the developer can controll full the ajax requests to the server. For this purpose<br>
we created a 3 level of settings <br/> we created a 3 level of settings <br/>
1. common ajax settings for all modules that use ajax requests <br/> 1. common ajax settings for all modules that use ajax requests <br/>
2. specific ajax settings for every module<br/> 2. specific ajax settings for every module<br/>
3. serialize function which can be used to serialize the data to the server in a way that the developer want<br/> 3. serialize function which can be used to serialize the data to the server in a way that the developer want<br/>
In this example we set the grid to use a POST to the server and in the serialize function we set the things so<br> In this example we set the grid to use a POST to the server and in the serialize function we set the things so<br>
that only the first page should be returned<br> that only the first page should be returned<br>
<br /> <br />
<table id="jqgajax"></table> <table id="jqgajax"></table>
<div id="pjqgajax"></div> <div id="pjqgajax"></div>
<script src="36ajaxing.js" type="text/javascript"> </script> <script src="36ajaxing.js" type="text/javascript"> </script>
<br /> <br />
<div style="font-size:12px;"> <div style="font-size:12px;">
<b> HTML </b> <b> HTML </b>
<XMP> <XMP>
<table id="jqgajax"></table> <table id="jqgajax"></table>
<div id="jqgajax"></div> <div id="jqgajax"></div>
</XMP> </XMP>
<b>Java Scrpt code</b> <b>Java Scrpt code</b>
<XMP> <XMP>
jQuery("#jqgajax").jqGrid({ jQuery("#jqgajax").jqGrid({
ajaxGridOptions : {type:"POST"}, ajaxGridOptions : {type:"POST"},
serializeGridData : function(postdata) { serializeGridData : function(postdata) {
postdata.page = 1; postdata.page = 1;
return postdata; return postdata;
}, },
url:'server.php?q=2', url:'server.php?q=2',
datatype: "json", datatype: "json",
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[ colModel:[
{name:'id',index:'id', width:55}, {name:'id',index:'id', width:55},
{name:'invdate',index:'invdate', width:90}, {name:'invdate',index:'invdate', width:90},
{name:'name',index:'name asc, invdate', width:100}, {name:'name',index:'name asc, invdate', width:100},
{name:'amount',index:'amount', width:80, align:"right"}, {name:'amount',index:'amount', width:80, align:"right"},
{name:'tax',index:'tax', width:80, align:"right"}, {name:'tax',index:'tax', width:80, align:"right"},
{name:'total',index:'total', width:80,align:"right"}, {name:'total',index:'total', width:80,align:"right"},
{name:'note',index:'note', width:150, sortable:false} {name:'note',index:'note', width:150, sortable:false}
], ],
rowNum:10, rowNum:10,
width:700, width:700,
rowList:[10,20,30], rowList:[10,20,30],
pager: '#pjqgajax', pager: '#pjqgajax',
sortname: 'invdate', sortname: 'invdate',
viewrecords: true, viewrecords: true,
sortorder: "desc", sortorder: "desc",
caption:"New API Example" caption:"New API Example"
}); });
jQuery("#pjqgajax").jqGrid('navGrid','#pjqgajax',{edit:false,add:false,del:false}); jQuery("#pjqgajax").jqGrid('navGrid','#pjqgajax',{edit:false,add:false,del:false});
</XMP> </XMP>
</div> </div>
\ No newline at end of file
jQuery("#jqgajax").jqGrid({ jQuery("#jqgajax").jqGrid({
ajaxGridOptions : {type:"POST"}, ajaxGridOptions : {type:"POST"},
serializeGridData : function(postdata) { serializeGridData : function(postdata) {
postdata.page = 1; postdata.page = 1;
return postdata; return postdata;
}, },
url:'server.php?q=2', url:'server.php?q=2',
datatype: "json", datatype: "json",
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[ colModel:[
{name:'id',index:'id', width:55}, {name:'id',index:'id', width:55},
{name:'invdate',index:'invdate', width:90}, {name:'invdate',index:'invdate', width:90},
{name:'name',index:'name asc, invdate', width:100}, {name:'name',index:'name asc, invdate', width:100},
{name:'amount',index:'amount', width:80, align:"right"}, {name:'amount',index:'amount', width:80, align:"right"},
{name:'tax',index:'tax', width:80, align:"right"}, {name:'tax',index:'tax', width:80, align:"right"},
{name:'total',index:'total', width:80,align:"right"}, {name:'total',index:'total', width:80,align:"right"},
{name:'note',index:'note', width:150, sortable:false} {name:'note',index:'note', width:150, sortable:false}
], ],
rowNum:10, rowNum:10,
width:700, width:700,
rowList:[10,20,30], rowList:[10,20,30],
pager: '#pjqgajax', pager: '#pjqgajax',
sortname: 'invdate', sortname: 'invdate',
viewrecords: true, viewrecords: true,
sortorder: "desc", sortorder: "desc",
caption:"New API Example" caption:"New API Example"
}); });
jQuery("#pjqgajax").jqGrid('navGrid','#pjqgajax',{edit:false,add:false,del:false}); jQuery("#pjqgajax").jqGrid('navGrid','#pjqgajax',{edit:false,add:false,del:false});
<div style="font-size:12px;"> <div style="font-size:12px;">
Thanks to Mark Williams we have another great feature - Column Reordering.<br> Thanks to Mark Williams we have another great feature - Column Reordering.<br>
This is done again just with setting one options - sortable. Click on header column and try to move it to another location.<br> This is done again just with setting one options - sortable. Click on header column and try to move it to another location.<br>
This feature depend on jQuery UI sortable widget.<br> This feature depend on jQuery UI sortable widget.<br>
Since we have other great stuffs which are depend on jQuery UI we have created a separated module<br> Since we have other great stuffs which are depend on jQuery UI we have created a separated module<br>
grid.jqueryui.js grid.jqueryui.js
<br /> <br />
<table id="colr"></table> <table id="colr"></table>
<div id="pcolr"></div> <div id="pcolr"></div>
<script src="36colreorder.js" type="text/javascript"> </script> <script src="36colreorder.js" type="text/javascript"> </script>
<br /> <br />
<div style="font-size:12px;"> <div style="font-size:12px;">
<b> HTML </b> <b> HTML </b>
<XMP> <XMP>
<table id="colr"></table> <table id="colr"></table>
<div id="pcolr"></div> <div id="pcolr"></div>
</XMP> </XMP>
<b>Java Scrpt code</b> <b>Java Scrpt code</b>
<XMP> <XMP>
jQuery("#colr").jqGrid({ jQuery("#colr").jqGrid({
sortable: true, sortable: true,
url:'server.php?q=2', url:'server.php?q=2',
datatype: "json", datatype: "json",
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[ colModel:[
{name:'id',index:'id', width:55}, {name:'id',index:'id', width:55},
{name:'invdate',index:'invdate', width:90}, {name:'invdate',index:'invdate', width:90},
{name:'name',index:'name asc, invdate', width:100}, {name:'name',index:'name asc, invdate', width:100},
{name:'amount',index:'amount', width:80, align:"right"}, {name:'amount',index:'amount', width:80, align:"right"},
{name:'tax',index:'tax', width:80, align:"right"}, {name:'tax',index:'tax', width:80, align:"right"},
{name:'total',index:'total', width:80,align:"right"}, {name:'total',index:'total', width:80,align:"right"},
{name:'note',index:'note', width:150, sortable:false} {name:'note',index:'note', width:150, sortable:false}
], ],
rowNum:10, rowNum:10,
rowList:[10,20,30], rowList:[10,20,30],
pager: '#pcolr', pager: '#pcolr',
sortname: 'invdate', sortname: 'invdate',
viewrecords: true, viewrecords: true,
sortorder: "desc", sortorder: "desc",
caption:"Column Reordering Example" caption:"Column Reordering Example"
}); });
jQuery("#colr").jqGrid('navGrid','#pcolr',{add:false,edit:false,del:false}); jQuery("#colr").jqGrid('navGrid','#pcolr',{add:false,edit:false,del:false});
</XMP> </XMP>
</div> </div>
\ No newline at end of file
jQuery("#colr").jqGrid({ jQuery("#colr").jqGrid({
sortable: true, sortable: true,
url:'server.php?q=2', url:'server.php?q=2',
datatype: "json", datatype: "json",
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[ colModel:[
{name:'id',index:'id', width:55}, {name:'id',index:'id', width:55},
{name:'invdate',index:'invdate', width:90}, {name:'invdate',index:'invdate', width:90},
{name:'name',index:'name asc, invdate', width:100}, {name:'name',index:'name asc, invdate', width:100},
{name:'amount',index:'amount', width:80, align:"right"}, {name:'amount',index:'amount', width:80, align:"right"},
{name:'tax',index:'tax', width:80, align:"right"}, {name:'tax',index:'tax', width:80, align:"right"},
{name:'total',index:'total', width:80,align:"right"}, {name:'total',index:'total', width:80,align:"right"},
{name:'note',index:'note', width:150, sortable:false} {name:'note',index:'note', width:150, sortable:false}
], ],
rowNum:10, rowNum:10,
rowList:[10,20,30], rowList:[10,20,30],
pager: '#pcolr', pager: '#pcolr',
sortname: 'invdate', sortname: 'invdate',
viewrecords: true, viewrecords: true,
sortorder: "desc", sortorder: "desc",
caption:"Column Reordering Example" caption:"Column Reordering Example"
}); });
jQuery("#colr").jqGrid('navGrid','#pcolr',{add:false,edit:false,del:false}); jQuery("#colr").jqGrid('navGrid','#pcolr',{add:false,edit:false,del:false});
<div style="font-size:12px;"> <div style="font-size:12px;">
Thanks again to Mark Williams we have other great feature - Column Chooser and Reordering.<br> Thanks again to Mark Williams we have other great feature - Column Chooser and Reordering.<br>
This is done with a simple method call like jQuery("#colch").jqGrid('columnChooser');<br> This is done with a simple method call like jQuery("#colch").jqGrid('columnChooser');<br>
This feature depend on jQuery UI sortable widget, jQuery UI dilog widget <br/> This feature depend on jQuery UI sortable widget, jQuery UI dilog widget <br/>
and multiselect plugin provided from Michael Aufreiter and Yanick Rochon.<br/> and multiselect plugin provided from Michael Aufreiter and Yanick Rochon.<br/>
Click on Columns button in the navigator and enjoy.<br/> Click on Columns button in the navigator and enjoy.<br/>
<br /> <br />
<table id="colch"></table> <table id="colch"></table>
<div id="pcolch"></div> <div id="pcolch"></div>
<script src="36columnchoice.js" type="text/javascript"> </script> <script src="36columnchoice.js" type="text/javascript"> </script>
<br /> <br />
<div style="font-size:12px;"> <div style="font-size:12px;">
<b> HTML </b> <b> HTML </b>
<XMP> <XMP>
<table id="colch"></table> <table id="colch"></table>
<div id="pcolch"></div> <div id="pcolch"></div>
</XMP> </XMP>
<b>Java Scrpt code</b> <b>Java Scrpt code</b>
<XMP> <XMP>
jQuery("#colch").jqGrid({ jQuery("#colch").jqGrid({
url:'server.php?q=2', url:'server.php?q=2',
datatype: "json", datatype: "json",
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[ colModel:[
{name:'id',index:'id', width:55}, {name:'id',index:'id', width:55},
{name:'invdate',index:'invdate', width:90}, {name:'invdate',index:'invdate', width:90},
{name:'name',index:'name asc, invdate', width:100}, {name:'name',index:'name asc, invdate', width:100},
{name:'amount',index:'amount', width:80, align:"right"}, {name:'amount',index:'amount', width:80, align:"right"},
{name:'tax',index:'tax', width:80, align:"right"}, {name:'tax',index:'tax', width:80, align:"right"},
{name:'total',index:'total', width:80,align:"right"}, {name:'total',index:'total', width:80,align:"right"},
{name:'note',index:'note', width:150, sortable:false, hidden:true} {name:'note',index:'note', width:150, sortable:false, hidden:true}
], ],
rowNum:10, rowNum:10,
width:700, width:700,
rowList:[10,20,30], rowList:[10,20,30],
pager: '#pcolch', pager: '#pcolch',
sortname: 'invdate', sortname: 'invdate',
shrinkToFit :false, shrinkToFit :false,
viewrecords: true, viewrecords: true,
sortorder: "desc", sortorder: "desc",
caption:"Column Chooser Example" caption:"Column Chooser Example"
}); });
jQuery("#colch").jqGrid('navGrid','#pcolch',{add:false,edit:false,del:false,search:false,refresh:false}); jQuery("#colch").jqGrid('navGrid','#pcolch',{add:false,edit:false,del:false,search:false,refresh:false});
jQuery("#colch").jqGrid('navButtonAdd','#pcolch',{ jQuery("#colch").jqGrid('navButtonAdd','#pcolch',{
caption: "Columns", caption: "Columns",
title: "Reorder Columns", title: "Reorder Columns",
onClickButton : function (){ onClickButton : function (){
jQuery("#colch").jqGrid('columnChooser'); jQuery("#colch").jqGrid('columnChooser');
} }
}); });
</XMP> </XMP>
</div> </div>
\ No newline at end of file
jQuery("#colch").jqGrid({ jQuery("#colch").jqGrid({
url:'server.php?q=2', url:'server.php?q=2',
datatype: "json", datatype: "json",
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[ colModel:[
{name:'id',index:'id', width:55}, {name:'id',index:'id', width:55},
{name:'invdate',index:'invdate', width:90}, {name:'invdate',index:'invdate', width:90},
{name:'name',index:'name asc, invdate', width:100}, {name:'name',index:'name asc, invdate', width:100},
{name:'amount',index:'amount', width:80, align:"right"}, {name:'amount',index:'amount', width:80, align:"right"},
{name:'tax',index:'tax', width:80, align:"right"}, {name:'tax',index:'tax', width:80, align:"right"},
{name:'total',index:'total', width:80,align:"right"}, {name:'total',index:'total', width:80,align:"right"},
{name:'note',index:'note', width:150, sortable:false, hidden:true} {name:'note',index:'note', width:150, sortable:false, hidden:true}
], ],
rowNum:10, rowNum:10,
width:700, width:700,
rowList:[10,20,30], rowList:[10,20,30],
pager: '#pcolch', pager: '#pcolch',
sortname: 'invdate', sortname: 'invdate',
shrinkToFit :false, shrinkToFit :false,
viewrecords: true, viewrecords: true,
sortorder: "desc", sortorder: "desc",
caption:"Column Chooser Example" caption:"Column Chooser Example"
}); });
jQuery("#colch").jqGrid('navGrid','#pcolch',{add:false,edit:false,del:false,search:false,refresh:false}); jQuery("#colch").jqGrid('navGrid','#pcolch',{add:false,edit:false,del:false,search:false,refresh:false});
jQuery("#colch").jqGrid('navButtonAdd','#pcolch',{ jQuery("#colch").jqGrid('navButtonAdd','#pcolch',{
caption: "Columns", caption: "Columns",
title: "Reorder Columns", title: "Reorder Columns",
onClickButton : function (){ onClickButton : function (){
jQuery("#colch").jqGrid('columnChooser'); jQuery("#colch").jqGrid('columnChooser');
} }
}); });
\ No newline at end of file
<div style="font-size:12px;"> <div style="font-size:12px;">
Another great feature which is requested many times from the community - custom cretion of editable elements<br> Another great feature which is requested many times from the community - custom cretion of editable elements<br>
This is done with the following settings in colModel - edittype:'custom' and two functions - one to create the element and <br> This is done with the following settings in colModel - edittype:'custom' and two functions - one to create the element and <br>
another to get the value from it<br> another to get the value from it<br>
In this exmple click on row to edit it and see what is happen when you perform saving in the column Client.. In this exmple click on row to edit it and see what is happen when you perform saving in the column Client..
<br/> <br/>
<br /> <br />
<table id="cinput"></table> <table id="cinput"></table>
<div id="pcinput"></div> <div id="pcinput"></div>
<script src="36custinput.js" type="text/javascript"> </script> <script src="36custinput.js" type="text/javascript"> </script>
<br /> <br />
<div style="font-size:12px;"> <div style="font-size:12px;">
<b> HTML </b> <b> HTML </b>
<XMP> <XMP>
<table id="cinput"></table> <table id="cinput"></table>
<div id="pcinput"></div> <div id="pcinput"></div>
</XMP> </XMP>
<b>Java Scrpt code</b> <b>Java Scrpt code</b>
<XMP> <XMP>
var lastsel; var lastsel;
function my_input(value, options) { function my_input(value, options) {
return $("<input type='text' size='10' value='"+value+"'/>"); return $("<input type='text' size='10' value='"+value+"'/>");
} }
function my_value(value) { function my_value(value) {
return "My value: "+value.val(); return "My value: "+value.val();
} }
jQuery("#cinput").jqGrid({ jQuery("#cinput").jqGrid({
url:'server.php?q=2', url:'server.php?q=2',
datatype: "json", datatype: "json",
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[ colModel:[
{name:'id',index:'id', width:55, editable:true}, {name:'id',index:'id', width:55, editable:true},
{name:'invdate',index:'invdate', width:90,editable:true}, {name:'invdate',index:'invdate', width:90,editable:true},
{ {
name:'name', name:'name',
index:'name', index:'name',
width:100, width:100,
editable:true, editable:true,
edittype:'custom', edittype:'custom',
editoptions:{ editoptions:{
custom_element:my_input, custom_element:my_input,
custom_value:my_value custom_value:my_value
} }
}, },
{name:'amount',index:'amount', width:80, align:"right",editable:true}, {name:'amount',index:'amount', width:80, align:"right",editable:true},
{name:'tax',index:'tax', width:80, align:"right",editable:true}, {name:'tax',index:'tax', width:80, align:"right",editable:true},
{name:'total',index:'total', width:80,align:"right",editable:true}, {name:'total',index:'total', width:80,align:"right",editable:true},
{name:'note',index:'note', width:150, sortable:false,editable:true} {name:'note',index:'note', width:150, sortable:false,editable:true}
], ],
onSelectRow: function(id){ onSelectRow: function(id){
if(id && id!==lastsel){ if(id && id!==lastsel){
jQuery('#cinput').jqGrid('restoreRow',lastsel); jQuery('#cinput').jqGrid('restoreRow',lastsel);
jQuery('#cinput').jqGrid('editRow',id,true); jQuery('#cinput').jqGrid('editRow',id,true);
lastsel=id; lastsel=id;
} }
}, },
rowNum:10, rowNum:10,
rowList:[10,20,30], rowList:[10,20,30],
pager: '#pcinput', pager: '#pcinput',
sortname: 'invdate', sortname: 'invdate',
viewrecords: true, viewrecords: true,
sortorder: "desc", sortorder: "desc",
caption:"Custom Input", caption:"Custom Input",
editurl: "server.php?q=dummy" editurl: "server.php?q=dummy"
}); });
</XMP> </XMP>
</div> </div>
\ No newline at end of file
var lastsel; var lastsel;
function my_input(value, options) { function my_input(value, options) {
return $("<input type='text' size='10' value='"+value+"'/>"); return $("<input type='text' size='10' value='"+value+"'/>");
} }
function my_value(value) { function my_value(value) {
return "My value: "+value.val(); return "My value: "+value.val();
} }
jQuery("#cinput").jqGrid({ jQuery("#cinput").jqGrid({
url:'server.php?q=2', url:'server.php?q=2',
datatype: "json", datatype: "json",
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[ colModel:[
{name:'id',index:'id', width:55, editable:true}, {name:'id',index:'id', width:55, editable:true},
{name:'invdate',index:'invdate', width:90,editable:true}, {name:'invdate',index:'invdate', width:90,editable:true},
{name:'name',index:'name asc, invdate', width:100,editable:true, edittype:'custom', editoptions:{custom_element:my_input,custom_value:my_value}}, {name:'name',index:'name asc, invdate', width:100,editable:true, edittype:'custom', editoptions:{custom_element:my_input,custom_value:my_value}},
{name:'amount',index:'amount', width:80, align:"right",editable:true}, {name:'amount',index:'amount', width:80, align:"right",editable:true},
{name:'tax',index:'tax', width:80, align:"right",editable:true}, {name:'tax',index:'tax', width:80, align:"right",editable:true},
{name:'total',index:'total', width:80,align:"right",editable:true}, {name:'total',index:'total', width:80,align:"right",editable:true},
{name:'note',index:'note', width:150, sortable:false,editable:true} {name:'note',index:'note', width:150, sortable:false,editable:true}
], ],
onSelectRow: function(id){ onSelectRow: function(id){
if(id && id!==lastsel){ if(id && id!==lastsel){
jQuery('#cinput').jqGrid('restoreRow',lastsel); jQuery('#cinput').jqGrid('restoreRow',lastsel);
jQuery('#cinput').jqGrid('editRow',id,true); jQuery('#cinput').jqGrid('editRow',id,true);
lastsel=id; lastsel=id;
} }
}, },
rowNum:10, rowNum:10,
rowList:[10,20,30], rowList:[10,20,30],
pager: '#pcinput', pager: '#pcinput',
sortname: 'invdate', sortname: 'invdate',
viewrecords: true, viewrecords: true,
sortorder: "desc", sortorder: "desc",
caption:"Custom Input", caption:"Custom Input",
editurl: "server.php?q=dummy" editurl: "server.php?q=dummy"
}); });
<div style="font-size:12px;"> <div style="font-size:12px;">
Since it is not possible to meat every user requirement in the validation when we use editing<br> Since it is not possible to meat every user requirement in the validation when we use editing<br>
we have created a possibility to create one defined from the developer<br> we have created a possibility to create one defined from the developer<br>
This is done just with two options in colModel - custom:true (which initialize this) and custo_func which should perform validation<br> This is done just with two options in colModel - custom:true (which initialize this) and custo_func which should perform validation<br>
In our example the amount value should have values between 200 and 300 when we perform editing and adding. In our example the amount value should have values between 200 and 300 when we perform editing and adding.
<br/> <br/>
<br /> <br />
<table id="custv"></table> <table id="custv"></table>
<div id="pcustv"></div> <div id="pcustv"></div>
<script src="36custvalid.js" type="text/javascript"> </script> <script src="36custvalid.js" type="text/javascript"> </script>
<br /> <br />
<div style="font-size:12px;"> <div style="font-size:12px;">
<b> HTML </b> <b> HTML </b>
<XMP> <XMP>
<table id="custv"></table> <table id="custv"></table>
<div id="pcustv"></div> <div id="pcustv"></div>
</XMP> </XMP>
<b>Java Scrpt code</b> <b>Java Scrpt code</b>
<XMP> <XMP>
function mycheck(value) { function mycheck(value) {
if(parseFloat(value) >= 200 && parseFloat(value)<=300) { if(parseFloat(value) >= 200 && parseFloat(value)<=300) {
return [true,"",""]; return [true,"",""];
} else { } else {
return [false,"The value should be between 200 and 300!",""]; return [false,"The value should be between 200 and 300!",""];
} }
} }
jQuery("#custv").jqGrid({ jQuery("#custv").jqGrid({
url:'server.php?q=2', url:'server.php?q=2',
datatype: "json", datatype: "json",
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[ colModel:[
{name:'id',index:'id', width:55, editable:true}, {name:'id',index:'id', width:55, editable:true},
{name:'invdate',index:'invdate', width:90,editable:true}, {name:'invdate',index:'invdate', width:90,editable:true},
{name:'name',index:'name asc, invdate', width:100,editable:true}, {name:'name',index:'name asc, invdate', width:100,editable:true},
{name:'amount',index:'amount', width:80, align:"right",editable:true,editrules:{custom:true,custom_func:mycheck}}, {name:'amount',index:'amount', width:80, align:"right",editable:true,editrules:{custom:true,custom_func:mycheck}},
{name:'tax',index:'tax', width:80, align:"right",editable:true}, {name:'tax',index:'tax', width:80, align:"right",editable:true},
{name:'total',index:'total', width:80,align:"right",editable:true}, {name:'total',index:'total', width:80,align:"right",editable:true},
{name:'note',index:'note', width:150, sortable:false,editable:true} {name:'note',index:'note', width:150, sortable:false,editable:true}
], ],
rowNum:10, rowNum:10,
rowList:[10,20,30], rowList:[10,20,30],
pager: '#pcustv', pager: '#pcustv',
sortname: 'invdate', sortname: 'invdate',
viewrecords: true, viewrecords: true,
sortorder: "desc", sortorder: "desc",
caption:"Custom Validation", caption:"Custom Validation",
editurl: "server.php?q=dummy" editurl: "server.php?q=dummy"
}); });
jQuery("#custv").jqGrid('navGrid','#pcustv',{del:false},{reloadAfterSubmit:false},{reloadAfterSubmit:false}); jQuery("#custv").jqGrid('navGrid','#pcustv',{del:false},{reloadAfterSubmit:false},{reloadAfterSubmit:false});
</XMP> </XMP>
</div> </div>
\ No newline at end of file
function mycheck(value, name) { function mycheck(value, name) {
if(parseFloat(value) >= 200 && parseFloat(value)<=300) { if(parseFloat(value) >= 200 && parseFloat(value)<=300) {
return [true,"",""]; return [true,"",""];
} else { } else {
return [false,name+": The value should be between 200 and 300!",""]; return [false,name+": The value should be between 200 and 300!",""];
} }
} }
jQuery("#custv").jqGrid({ jQuery("#custv").jqGrid({
url:'server.php?q=2', url:'server.php?q=2',
datatype: "json", datatype: "json",
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[ colModel:[
{name:'id',index:'id', width:55, editable:true}, {name:'id',index:'id', width:55, editable:true},
{name:'invdate',index:'invdate', width:90,editable:true}, {name:'invdate',index:'invdate', width:90,editable:true},
{name:'name',index:'name asc, invdate', width:100,editable:true}, {name:'name',index:'name asc, invdate', width:100,editable:true},
{name:'amount',index:'amount', width:80, align:"right",editable:true,editrules:{custom:true,custom_func:mycheck}}, {name:'amount',index:'amount', width:80, align:"right",editable:true,editrules:{custom:true,custom_func:mycheck}},
{name:'tax',index:'tax', width:80, align:"right",editable:true}, {name:'tax',index:'tax', width:80, align:"right",editable:true},
{name:'total',index:'total', width:80,align:"right",editable:true}, {name:'total',index:'total', width:80,align:"right",editable:true},
{name:'note',index:'note', width:150, sortable:false,editable:true} {name:'note',index:'note', width:150, sortable:false,editable:true}
], ],
rowNum:10, rowNum:10,
rowList:[10,20,30], rowList:[10,20,30],
pager: '#pcustv', pager: '#pcustv',
sortname: 'invdate', sortname: 'invdate',
viewrecords: true, viewrecords: true,
sortorder: "desc", sortorder: "desc",
caption:"Custom Validation", caption:"Custom Validation",
editurl: "server.php?q=dummy" editurl: "server.php?q=dummy"
}); });
jQuery("#custv").jqGrid('navGrid','#pcustv',{del:false},{reloadAfterSubmit:false},{reloadAfterSubmit:false}); jQuery("#custv").jqGrid('navGrid','#pcustv',{del:false},{reloadAfterSubmit:false},{reloadAfterSubmit:false});
<div style="font-size:12px;"> <div style="font-size:12px;">
Last, but not least we develop a row drag and drop method, which allow exchanging information between<br> Last, but not least we develop a row drag and drop method, which allow exchanging information between<br>
grids in visual maner.<br> grids in visual maner.<br>
This feature uses the jQuery UI draggable and droppable widgets<br> This feature uses the jQuery UI draggable and droppable widgets<br>
In this exmple try to drag rows between the grids following the allowed directions In this exmple try to drag rows between the grids following the allowed directions
<br> <br>
<br /> <br />
<table> <table>
<tbody> <tbody>
<tr> <tr>
<td><table id="grid1"></table><div id="pgrid1"></div></td> <td><table id="grid1"></table><div id="pgrid1"></div></td>
<td align="center"> &lt;===&gt;</td> <td align="center"> &lt;===&gt;</td>
<td><table id="grid2"></table><div id="pgrid2"></div></td> <td><table id="grid2"></table><div id="pgrid2"></div></td>
</tr> </tr>
<tr> <tr>
<td align= "center"> || </td> <td align= "center"> || </td>
<td align= "center">&nbsp;</td> <td align= "center">&nbsp;</td>
<td align= "center"> &nbsp; </td> <td align= "center"> &nbsp; </td>
</tr> </tr>
<tr> <tr>
<td align= "center"> \/ </td> <td align= "center"> \/ </td>
<td align= "center">&nbsp;</td> <td align= "center">&nbsp;</td>
<td align= "center"> &nbsp; </td> <td align= "center"> &nbsp; </td>
</tr> </tr>
<tr> <tr>
<td align= "center"> <td align= "center">
<table id="grid3"></table> <table id="grid3"></table>
<div id="pgrid3"></div> <div id="pgrid3"></div>
</td> </td>
<td>&nbsp;</td> <td>&nbsp;</td>
<td> &nbsp; </td> <td> &nbsp; </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<script src="36draganddrop.js" type="text/javascript"> </script> <script src="36draganddrop.js" type="text/javascript"> </script>
<br /> <br />
<div style="font-size:12px;"> <div style="font-size:12px;">
<b>Java Scrpt code</b> <b>Java Scrpt code</b>
<XMP> <XMP>
jQuery("#grid1").jqGrid({ jQuery("#grid1").jqGrid({
datatype: "local", datatype: "local",
height: 100, height: 100,
colNames: ['Id1', 'Name1', 'Values1'], colNames: ['Id1', 'Name1', 'Values1'],
colModel: [{ colModel: [{
name: 'id1', name: 'id1',
index: 'id', index: 'id',
width: 100 width: 100
}, { }, {
name: 'name1', name: 'name1',
index: 'name', index: 'name',
width: 100 width: 100
}, { }, {
name: 'values1', name: 'values1',
index: 'values', index: 'values',
width: 200 width: 200
}], }],
caption: 'Grid 1', caption: 'Grid 1',
pager: '#pgrid1' pager: '#pgrid1'
}); });
jQuery("#grid2").jqGrid({ jQuery("#grid2").jqGrid({
datatype: "local", datatype: "local",
height: 100, height: 100,
colNames: ['Id2', 'Name2', 'Values2'], colNames: ['Id2', 'Name2', 'Values2'],
colModel: [{ colModel: [{
name: 'id2', name: 'id2',
index: 'id', index: 'id',
width: 100 width: 100
}, { }, {
name: 'name2', name: 'name2',
index: 'name', index: 'name',
width: 100 width: 100
}, { }, {
name: 'values2', name: 'values2',
index: 'values', index: 'values',
width: 200 width: 200
}], }],
caption: 'Grid 2', caption: 'Grid 2',
pager: '#pgrid2' pager: '#pgrid2'
}); });
jQuery("#grid3").jqGrid({ jQuery("#grid3").jqGrid({
datatype: "local", datatype: "local",
height: 'auto', height: 'auto',
colNames: ['Id3', 'Name3', 'Values3'], colNames: ['Id3', 'Name3', 'Values3'],
colModel: [{ colModel: [{
name: 'id3', name: 'id3',
index: 'id', index: 'id',
width: 100 width: 100
}, { }, {
name: 'name3', name: 'name3',
index: 'name', index: 'name',
width: 100 width: 100
}, { }, {
name: 'values3', name: 'values3',
index: 'values', index: 'values',
width: 200 width: 200
}], }],
caption: 'Grid 3', caption: 'Grid 3',
pager: '#pgrid3' pager: '#pgrid3'
}); });
var mydata1 = [ var mydata1 = [
{id1:"1",name1:"test1",values1:'One'}, {id1:"1",name1:"test1",values1:'One'},
{id1:"2",name1:"test2",values1:'Two'}, {id1:"2",name1:"test2",values1:'Two'},
{id1:"3",name1:"test3",values1:'Three'} {id1:"3",name1:"test3",values1:'Three'}
]; ];
var mydata2 = [ var mydata2 = [
{id2:"11",name2:"test11",values2:'One1'}, {id2:"11",name2:"test11",values2:'One1'},
{id2:"21",name2:"test21",values2:'Two1'}, {id2:"21",name2:"test21",values2:'Two1'},
{id2:"31",name2:"test31",values2:'Three1'} {id2:"31",name2:"test31",values2:'Three1'}
]; ];
var mydata3 = [ var mydata3 = [
{id3:"12",name3:"test12",values3:'One2'}, {id3:"12",name3:"test12",values3:'One2'},
{id3:"22",name3:"test22",values3:'Two2'}, {id3:"22",name3:"test22",values3:'Two2'},
{id3:"32",name3:"test32",values3:'Three2'} {id3:"32",name3:"test32",values3:'Three2'}
]; ];
for (var i = 0; i <= mydata1.length; i++) { for (var i = 0; i <= mydata1.length; i++) {
jQuery("#grid1").jqGrid('addRowData',i + 1, mydata1[i]); jQuery("#grid1").jqGrid('addRowData',i + 1, mydata1[i]);
jQuery("#grid2").jqGrid('addRowData',i + 1, mydata2[i]); jQuery("#grid2").jqGrid('addRowData',i + 1, mydata2[i]);
jQuery("#grid3").jqGrid('addRowData',i + 1, mydata3[i]); jQuery("#grid3").jqGrid('addRowData',i + 1, mydata3[i]);
} }
jQuery("#grid1").jqGrid('gridDnD',{connectWith:'#grid2,#grid3'}); jQuery("#grid1").jqGrid('gridDnD',{connectWith:'#grid2,#grid3'});
jQuery("#grid2").jqGrid('gridDnD',{connectWith:'#grid1'}); jQuery("#grid2").jqGrid('gridDnD',{connectWith:'#grid1'});
</XMP> </XMP>
</div> </div>
\ No newline at end of file
jQuery("#grid1").jqGrid({ jQuery("#grid1").jqGrid({
datatype: "local", datatype: "local",
height: 100, height: 100,
colNames: ['Id1', 'Name1', 'Values1'], colNames: ['Id1', 'Name1', 'Values1'],
colModel: [{ colModel: [{
name: 'id1', name: 'id1',
index: 'id', index: 'id',
width: 100 width: 100
}, { }, {
name: 'name1', name: 'name1',
index: 'name', index: 'name',
width: 100 width: 100
}, { }, {
name: 'values1', name: 'values1',
index: 'values', index: 'values',
width: 200 width: 200
}], }],
caption: 'Grid 1', caption: 'Grid 1',
pager: '#pgrid1' pager: '#pgrid1'
}); });
jQuery("#grid2").jqGrid({ jQuery("#grid2").jqGrid({
datatype: "local", datatype: "local",
height: 100, height: 100,
colNames: ['Id2', 'Name2', 'Values2'], colNames: ['Id2', 'Name2', 'Values2'],
colModel: [{ colModel: [{
name: 'id2', name: 'id2',
index: 'id', index: 'id',
width: 100 width: 100
}, { }, {
name: 'name2', name: 'name2',
index: 'name', index: 'name',
width: 100 width: 100
}, { }, {
name: 'values2', name: 'values2',
index: 'values', index: 'values',
width: 200 width: 200
}], }],
caption: 'Grid 2', caption: 'Grid 2',
pager: '#pgrid2' pager: '#pgrid2'
}); });
jQuery("#grid3").jqGrid({ jQuery("#grid3").jqGrid({
datatype: "local", datatype: "local",
height: 'auto', height: 'auto',
colNames: ['Id3', 'Name3', 'Values3'], colNames: ['Id3', 'Name3', 'Values3'],
colModel: [{ colModel: [{
name: 'id3', name: 'id3',
index: 'id', index: 'id',
width: 100 width: 100
}, { }, {
name: 'name3', name: 'name3',
index: 'name', index: 'name',
width: 100 width: 100
}, { }, {
name: 'values3', name: 'values3',
index: 'values', index: 'values',
width: 200 width: 200
}], }],
caption: 'Grid 3', caption: 'Grid 3',
pager: '#pgrid3' pager: '#pgrid3'
}); });
var mydata1 = [ var mydata1 = [
{id1:"1",name1:"test1",values1:'One'}, {id1:"1",name1:"test1",values1:'One'},
{id1:"2",name1:"test2",values1:'Two'}, {id1:"2",name1:"test2",values1:'Two'},
{id1:"3",name1:"test3",values1:'Three'} {id1:"3",name1:"test3",values1:'Three'}
]; ];
var mydata2 = [ var mydata2 = [
{id2:"11",name2:"test11",values2:'One1'}, {id2:"11",name2:"test11",values2:'One1'},
{id2:"21",name2:"test21",values2:'Two1'}, {id2:"21",name2:"test21",values2:'Two1'},
{id2:"31",name2:"test31",values2:'Three1'} {id2:"31",name2:"test31",values2:'Three1'}
]; ];
var mydata3 = [ var mydata3 = [
{id3:"12",name3:"test12",values3:'One2'}, {id3:"12",name3:"test12",values3:'One2'},
{id3:"22",name3:"test22",values3:'Two2'}, {id3:"22",name3:"test22",values3:'Two2'},
{id3:"32",name3:"test32",values3:'Three2'} {id3:"32",name3:"test32",values3:'Three2'}
]; ];
for (var i = 0; i <= mydata1.length; i++) { for (var i = 0; i <= mydata1.length; i++) {
jQuery("#grid1").jqGrid('addRowData',i + 1, mydata1[i]); jQuery("#grid1").jqGrid('addRowData',i + 1, mydata1[i]);
jQuery("#grid2").jqGrid('addRowData',i + 1, mydata2[i]); jQuery("#grid2").jqGrid('addRowData',i + 1, mydata2[i]);
jQuery("#grid3").jqGrid('addRowData',i + 1, mydata3[i]); jQuery("#grid3").jqGrid('addRowData',i + 1, mydata3[i]);
} }
jQuery("#grid1").jqGrid('gridDnD',{connectWith:'#grid2,#grid3'}); jQuery("#grid1").jqGrid('gridDnD',{connectWith:'#grid2,#grid3'});
jQuery("#grid2").jqGrid('gridDnD',{connectWith:'#grid1'}); jQuery("#grid2").jqGrid('gridDnD',{connectWith:'#grid1'});
<div style="font-size:12px;"> <div style="font-size:12px;">
From 3.6 we introduce new API, which is similar to jQuery UI. Using the new API saves a namespace<br> From 3.6 we introduce new API, which is similar to jQuery UI. Using the new API saves a namespace<br>
conflicts with other plugins and make using jqGrid more natural in the code, showing that this is connected conflicts with other plugins and make using jqGrid more natural in the code, showing that this is connected
with jqGrid methods.<br> with jqGrid methods.<br>
The calling convension is <br> The calling convension is <br>
<p><b>(jqgridelement).jqGrid( method ,parameter1,...,parameterN);</b></p> <p><b>(jqgridelement).jqGrid( method ,parameter1,...,parameterN);</b></p>
Where method is exiting jqGrid method<br/> Where method is exiting jqGrid method<br/>
In the example above we do: <br/> In the example above we do: <br/>
<div style="color:blue"> <div style="color:blue">
<code> <code>
jQuery("#newapi").jqGrid('navGrid','#pnewapi',{edit:false,add:false,del:false}); jQuery("#newapi").jqGrid('navGrid','#pnewapi',{edit:false,add:false,del:false});
</code> </code>
</div> </div>
<p style="width:750px;"> <p style="width:750px;">
To enjoy full of this API a new variable is used in $.jgrid namespace - called $.jgrid.no_legacy_api, To enjoy full of this API a new variable is used in $.jgrid namespace - called $.jgrid.no_legacy_api,
which default value is false. The variable should be set before including jqGrid Java Script file or which default value is false. The variable should be set before including jqGrid Java Script file or
can be added in the language file. can be added in the language file.
</p> </p>
<br /> <br />
<table id="newapi"></table> <table id="newapi"></table>
<div id="pnewapi"></div> <div id="pnewapi"></div>
<script src="36newapi.js" type="text/javascript"> </script> <script src="36newapi.js" type="text/javascript"> </script>
<br /> <br />
<div style="font-size:12px;"> <div style="font-size:12px;">
<b> HTML </b> <b> HTML </b>
<XMP> <XMP>
<table id="newapi"></table> <table id="newapi"></table>
<div id="pnewapi"></div> <div id="pnewapi"></div>
</XMP> </XMP>
<b>Java Scrpt code</b> <b>Java Scrpt code</b>
<XMP> <XMP>
jQuery("#newapi").jqGrid({ jQuery("#newapi").jqGrid({
url:'server.php?q=2', url:'server.php?q=2',
datatype: "json", datatype: "json",
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[ colModel:[
{name:'id',index:'id', width:55}, {name:'id',index:'id', width:55},
{name:'invdate',index:'invdate', width:90}, {name:'invdate',index:'invdate', width:90},
{name:'name',index:'name asc, invdate', width:100}, {name:'name',index:'name asc, invdate', width:100},
{name:'amount',index:'amount', width:80, align:"right"}, {name:'amount',index:'amount', width:80, align:"right"},
{name:'tax',index:'tax', width:80, align:"right"}, {name:'tax',index:'tax', width:80, align:"right"},
{name:'total',index:'total', width:80,align:"right"}, {name:'total',index:'total', width:80,align:"right"},
{name:'note',index:'note', width:150, sortable:false} {name:'note',index:'note', width:150, sortable:false}
], ],
rowNum:10, rowNum:10,
rowList:[10,20,30], rowList:[10,20,30],
pager: '#pnewapi', pager: '#pnewapi',
sortname: 'invdate', sortname: 'invdate',
viewrecords: true, viewrecords: true,
sortorder: "desc", sortorder: "desc",
caption:"New API Example" caption:"New API Example"
}); });
</XMP> </XMP>
<div style="color:blue"> <div style="color:blue">
<code> <code>
jQuery("#newapi").jqGrid('navGrid','#pnewapi',{edit:false,add:false,del:false}); jQuery("#newapi").jqGrid('navGrid','#pnewapi',{edit:false,add:false,del:false});
</code> </code>
</div> </div>
</div> </div>
\ No newline at end of file
jQuery("#newapi").jqGrid({ jQuery("#newapi").jqGrid({
url:'server.php?q=2', url:'server.php?q=2',
datatype: "json", datatype: "json",
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[ colModel:[
{name:'id',index:'id', width:55}, {name:'id',index:'id', width:55},
{name:'invdate',index:'invdate', width:90}, {name:'invdate',index:'invdate', width:90},
{name:'name',index:'name asc, invdate', width:100}, {name:'name',index:'name asc, invdate', width:100},
{name:'amount',index:'amount', width:80, align:"right"}, {name:'amount',index:'amount', width:80, align:"right"},
{name:'tax',index:'tax', width:80, align:"right"}, {name:'tax',index:'tax', width:80, align:"right"},
{name:'total',index:'total', width:80,align:"right"}, {name:'total',index:'total', width:80,align:"right"},
{name:'note',index:'note', width:150, sortable:false} {name:'note',index:'note', width:150, sortable:false}
], ],
rowNum:10, rowNum:10,
width:700, width:700,
rowList:[10,20,30], rowList:[10,20,30],
pager: '#pnewapi', pager: '#pnewapi',
sortname: 'invdate', sortname: 'invdate',
viewrecords: true, viewrecords: true,
sortorder: "desc", sortorder: "desc",
caption:"New API Example" caption:"New API Example"
}); });
jQuery("#newapi").jqGrid('navGrid','#pnewapi',{edit:false,add:false,del:false}); jQuery("#newapi").jqGrid('navGrid','#pnewapi',{edit:false,add:false,del:false});
<div style="font-size:12px;"> <div style="font-size:12px;">
This is experimental method which resizes the grid<br> This is experimental method which resizes the grid<br>
This feature uses the jQuery UI resizable widget<br> This feature uses the jQuery UI resizable widget<br>
<br> <br>
<table id="resize"></table> <table id="resize"></table>
<div id="presize"></div> <div id="presize"></div>
<script src="36resize.js" type="text/javascript"> </script> <script src="36resize.js" type="text/javascript"> </script>
<br /> <br />
<br /> <br />
<div style="font-size:12px;"> <div style="font-size:12px;">
<b> HTML </b> <b> HTML </b>
<XMP> <XMP>
<table id="newapi"></table> <table id="newapi"></table>
<div id="pnewapi"></div> <div id="pnewapi"></div>
</XMP> </XMP>
<b>Java Scrpt code</b> <b>Java Scrpt code</b>
<XMP> <XMP>
jQuery("#resize").jqGrid({ jQuery("#resize").jqGrid({
url:'server.php?q=2', url:'server.php?q=2',
datatype: "json", datatype: "json",
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[ colModel:[
{name:'id',index:'id', width:55}, {name:'id',index:'id', width:55},
{name:'invdate',index:'invdate', width:90}, {name:'invdate',index:'invdate', width:90},
{name:'name',index:'name asc, invdate', width:100}, {name:'name',index:'name asc, invdate', width:100},
{name:'amount',index:'amount', width:80, align:"right"}, {name:'amount',index:'amount', width:80, align:"right"},
{name:'tax',index:'tax', width:80, align:"right"}, {name:'tax',index:'tax', width:80, align:"right"},
{name:'total',index:'total', width:80,align:"right"}, {name:'total',index:'total', width:80,align:"right"},
{name:'note',index:'note', width:150, sortable:false} {name:'note',index:'note', width:150, sortable:false}
], ],
rowNum:10, rowNum:10,
width:700, width:700,
rowList:[10,20,30], rowList:[10,20,30],
pager: '#presize', pager: '#presize',
sortname: 'invdate', sortname: 'invdate',
viewrecords: true, viewrecords: true,
sortorder: "desc", sortorder: "desc",
caption:"New API Example" caption:"New API Example"
}); });
jQuery("#resize").jqGrid('navGrid','#presize',{edit:false,add:false,del:false}); jQuery("#resize").jqGrid('navGrid','#presize',{edit:false,add:false,del:false});
jQuery("#resize").jqGrid('gridResize',{minWidth:350,maxWidth:800,minHeight:80, maxHeight:350});</XMP> jQuery("#resize").jqGrid('gridResize',{minWidth:350,maxWidth:800,minHeight:80, maxHeight:350});</XMP>
</div> </div>
\ No newline at end of file
jQuery("#resize").jqGrid({ jQuery("#resize").jqGrid({
url:'server.php?q=2', url:'server.php?q=2',
datatype: "json", datatype: "json",
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[ colModel:[
{name:'id',index:'id', width:55}, {name:'id',index:'id', width:55},
{name:'invdate',index:'invdate', width:90}, {name:'invdate',index:'invdate', width:90},
{name:'name',index:'name asc, invdate', width:100}, {name:'name',index:'name asc, invdate', width:100},
{name:'amount',index:'amount', width:80, align:"right"}, {name:'amount',index:'amount', width:80, align:"right"},
{name:'tax',index:'tax', width:80, align:"right"}, {name:'tax',index:'tax', width:80, align:"right"},
{name:'total',index:'total', width:80,align:"right"}, {name:'total',index:'total', width:80,align:"right"},
{name:'note',index:'note', width:150, sortable:false} {name:'note',index:'note', width:150, sortable:false}
], ],
rowNum:10, rowNum:10,
width:700, width:700,
rowList:[10,20,30], rowList:[10,20,30],
pager: '#presize', pager: '#presize',
sortname: 'invdate', sortname: 'invdate',
viewrecords: true, viewrecords: true,
sortorder: "desc", sortorder: "desc",
caption:"New API Example" caption:"New API Example"
}); });
jQuery("#resize").jqGrid('navGrid','#presize',{edit:false,add:false,del:false}); jQuery("#resize").jqGrid('navGrid','#presize',{edit:false,add:false,del:false});
jQuery("#resize").jqGrid('gridResize',{minWidth:350,maxWidth:800,minHeight:100, maxHeight:350}); jQuery("#resize").jqGrid('gridResize',{minWidth:350,maxWidth:800,minHeight:100, maxHeight:350});
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment