Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 685

Přidáno uživatelem Michal Kliment před více než 14 roky(ů)

Pridany nove tabulky approval_templates, approval_template_items a approval_types. U zobrazeni zarizeni pridani vypisu clena a jeho ID. Zakomentovani importu exportu z DHCP serveru Mikrotiku. Oprava javascriptu u pridavani vykazu prace.

Zobrazit rozdíly:

freenetis/trunk/kohana/application/controllers/work_reports.php
$view = new View('main');
$view->extra_scripts = 'var i = 1;
$view->extra_scripts = '
$(document).ready(function(){
var i = 1;
var table = document.getElementById("form_table");
var tbody = table.children[0];
var new_tr = document.createElement("tr");
......
new_a.appendChild(new_text);
new_a.setAttribute("href", "#");
new_a.setAttribute("onclick", "return add_work_row("+i+", new Array(\''.url_lang::lang('texts.Work').'\', \''.url_lang::lang('texts.Description').'\', \''.url_lang::lang('texts.Date').'\', \''.url_lang::lang('texts.Hours').'\', \''.url_lang::lang('texts.Km').'\', \''.url_lang::lang('texts.Suggest amount').'\'));");
new_a.setAttribute("id", "add_work_row_link");';
new_a.setAttribute("id", "add_work_row_link");
});';
$view->title = url_lang::lang('texts.Add new work report');
$view->content = new View('form');
freenetis/trunk/kohana/application/controllers/approval_templates.php
$view->render(TRUE);
}
public function add()
{
$view = new View('main');
$view->title = url_lang::lang('texts.Add new approval template');
$view->content = new View('form');
$view->content->headline = url_lang::lang('texts.Add new approval template');
$view->content->link_back = html::anchor(url_lang::base().'approval_templates/show_all', url_lang::lang('texts.Back to list of all approval templates'));
$view->content->form = '';
$view->render(TRUE);
}
public static function name_field($item, $name)
{
echo html::anchor(url_lang::base().'approval_templates/show/'.$item->id, $item->name, array('title' => url_lang::lang('texts.Show approval template')));
freenetis/trunk/kohana/application/controllers/devices.php
$grid->add_new_button(url_lang::base().'devices/add_whole', url_lang::lang('texts.Add new whole device'));
if ($this->acl_check_new(get_class($this),'devices'))
$grid->add_new_button(url_lang::base().'devices/add', url_lang::lang('texts.Add new device'));
if ($this->acl_check_new(get_class($this),'devices'))
$grid->add_new_button(url_lang::base().'devices/import_dhcp_export_from_mikrotik', url_lang::lang('texts.Import DHCP export from Mikrotik'));
/**
* Remove from revision 685 - it never works correctly
*/
//if ($this->acl_check_new(get_class($this),'devices'))
// $grid->add_new_button(url_lang::base().'devices/import_dhcp_export_from_mikrotik', url_lang::lang('texts.Import DHCP export from Mikrotik'));
$grid->order_field('device_id')->label('ID')->class('center');
$grid->order_callback_field('device_name')->label(url_lang::lang('texts.Name'))->callback('Devices_Controller::device_field');
$grid->order_field('type')->label(url_lang::lang('texts.Type'));
freenetis/trunk/kohana/application/upgrade_sql/upgrade_sql_672.php
<?php
// array of sql queries that upgrade database
$upgrade_sql[672] = array(
"ALTER TABLE `jobs` ADD `create_date` DATETIME NOT NULL COMMENT 'date of creation of work in IS' AFTER `date`;",
"UPDATE `jobs` SET `create_date` = `date`;",
"CREATE TABLE `votes` (
`id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`user_id` INT( 11 ) NOT NULL COMMENT 'id of voter',
`type` INT( 11 ) NOT NULL COMMENT 'type of vote',
`fk_id` INT( 11 ) NOT NULL COMMENT 'id of foreign key',
`vote` TINYINT( 1 ) NULL DEFAULT NULL COMMENT 'value of user vote',
`comment` MEDIUMTEXT NOT NULL
) ENGINE = INNODB;",
"INSERT INTO votes (user_id, type, fk_id, vote) SELECT confirmed_by_id, 1, id, 1 FROM jobs j
WHERE j.confirmed_by_id IS NOT NULL;",
"ALTER TABLE `jobs` ADD `locked` BOOLEAN NOT NULL COMMENT 'flag if work is locked to editing' AFTER `km`;",
"UPDATE `jobs` SET `locked` = 1 WHERE `confirmed_by_id` IS NOT NULL;",
"ALTER TABLE `jobs` DROP `confirmed_by_id`;",
"ALTER TABLE `jobs` ADD `suggest_amount` INT(11) NOT NULL COMMENT 'suggest amount by user' AFTER `description`;",
"UPDATE jobs j, transfers t SET j.suggest_amount = t.amount
WHERE j.transfer_id = t.id;",
"ALTER TABLE `jobs` ADD `job_report_id` INT( 11 ) NULL DEFAULT NULL COMMENT 'belongs to job report' AFTER `id`;",
"CREATE TABLE `job_reports` (
`id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`description` VARCHAR( 255 ) NOT NULL
) ENGINE = INNODB;",
"INSERT INTO `axo_sections` (`id`, `value`, `order_value`, `name`, `hidden`) VALUES ('23', 'Votes_Controller', '1', 'Approval', '0');",
"INSERT INTO `axo` (`id`, `section_value`, `value`, `order_value`, `name`, `hidden`) VALUES ('159', 'Votes_Controller', 'work', '0', 'Approval of work', '0');",
"INSERT INTO `aco_map` (`acl_id`, `section_value`, `value`) VALUES ('60', 'freenetis', 'delete_own');",
"DELETE FROM `aco_map` WHERE `aco_map`.`acl_id` = 63 AND `aco_map`.`section_value` = 'freenetis' AND `aco_map`.`value` = 'confirm_all';",
"INSERT INTO `aco_map` (`acl_id` ,`section_value` ,`value`) VALUES ('63', 'freenetis', 'view_all'), ('63', 'freenetis', 'view_own');",
"INSERT INTO `aco_map` (`acl_id` ,`section_value` ,`value`) VALUES ('63', 'freenetis', 'new_own'), ('63', 'freenetis', 'edit_own');",
"INSERT INTO `aco_map` (`acl_id` ,`section_value` ,`value`) VALUES ('63', 'freenetis', 'delete_own');",
"DELETE FROM `aro_groups_map` WHERE `aro_groups_map`.`acl_id` = 63 AND `aro_groups_map`.`group_id` = 32;",
"INSERT INTO `aro_groups_map` (`acl_id`, `group_id`) VALUES ('63', '24');",
"DELETE FROM `axo_map` WHERE `axo_map`.`acl_id` = 63 AND `axo_map`.`section_value` = 'Users_Controller' AND `axo_map`.`value` = 'work';",
"INSERT INTO `axo_map` (`acl_id`, `section_value`, `value`) VALUES ('63', 'Votes_Controller', 'work');");
?>
freenetis/trunk/kohana/application/upgrade_sql/upgrade_sql.php
// array of sql queries that upgrade database
$upgrade_sql[get_SVN_rev()] = array(
"ALTER TABLE `jobs` ADD `create_date` DATETIME NOT NULL COMMENT 'date of creation of work in IS' AFTER `date`;",
"CREATE TABLE IF NOT EXISTS `approval_types` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) COLLATE utf8_czech_ci NOT NULL,
`comment` mediumtext COLLATE utf8_czech_ci NOT NULL,
`type` int(11) NOT NULL,
`aro_group_id` int(11) NOT NULL,
`interval` datetime NOT NULL,
`min_suggest_amount` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;",
"UPDATE `jobs` SET `create_date` = `date`;",
"CREATE TABLE IF NOT EXISTS `approval_templates` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) COLLATE utf8_czech_ci NOT NULL,
`comment` mediumtext COLLATE utf8_czech_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;",
"CREATE TABLE `votes` (
`id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`user_id` INT( 11 ) NOT NULL COMMENT 'id of voter',
`type` INT( 11 ) NOT NULL COMMENT 'type of vote',
`fk_id` INT( 11 ) NOT NULL COMMENT 'id of foreign key',
`vote` TINYINT( 1 ) NULL DEFAULT NULL COMMENT 'value of user vote',
`comment` MEDIUMTEXT NOT NULL
) ENGINE = INNODB;",
"INSERT INTO votes (user_id, type, fk_id, vote) SELECT confirmed_by_id, 1, id, 1 FROM jobs j
WHERE j.confirmed_by_id IS NOT NULL;",
"ALTER TABLE `jobs` ADD `locked` BOOLEAN NOT NULL COMMENT 'flag if work is locked to editing' AFTER `km`;",
"UPDATE `jobs` SET `locked` = 1 WHERE `confirmed_by_id` IS NOT NULL;",
"ALTER TABLE `jobs` DROP `confirmed_by_id`;",
"ALTER TABLE `jobs` ADD `suggest_amount` INT(11) NOT NULL COMMENT 'suggest amount by user' AFTER `description`;",
"UPDATE jobs j, transfers t SET j.suggest_amount = t.amount
WHERE j.transfer_id = t.id;",
"ALTER TABLE `jobs` ADD `job_report_id` INT( 11 ) NULL DEFAULT NULL COMMENT 'belongs to job report' AFTER `id`;",
"CREATE TABLE `job_reports` (
`id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`description` VARCHAR( 255 ) NOT NULL
) ENGINE = INNODB;",
"INSERT INTO `axo_sections` (`id`, `value`, `order_value`, `name`, `hidden`) VALUES ('23', 'Votes_Controller', '1', 'Approval', '0');",
"INSERT INTO `axo` (`id`, `section_value`, `value`, `order_value`, `name`, `hidden`) VALUES ('159', 'Votes_Controller', 'work', '0', 'Approval of work', '0');",
"INSERT INTO `aco_map` (`acl_id`, `section_value`, `value`) VALUES ('60', 'freenetis', 'delete_own');",
"DELETE FROM `aco_map` WHERE `aco_map`.`acl_id` = 63 AND `aco_map`.`section_value` = 'freenetis' AND `aco_map`.`value` = 'confirm_all';",
"INSERT INTO `aco_map` (`acl_id` ,`section_value` ,`value`) VALUES ('63', 'freenetis', 'view_all'), ('63', 'freenetis', 'view_own');",
"INSERT INTO `aco_map` (`acl_id` ,`section_value` ,`value`) VALUES ('63', 'freenetis', 'new_own'), ('63', 'freenetis', 'edit_own');",
"INSERT INTO `aco_map` (`acl_id` ,`section_value` ,`value`) VALUES ('63', 'freenetis', 'delete_own');",
"DELETE FROM `aro_groups_map` WHERE `aro_groups_map`.`acl_id` = 63 AND `aro_groups_map`.`group_id` = 32;",
"INSERT INTO `aro_groups_map` (`acl_id`, `group_id`) VALUES ('63', '24');",
"DELETE FROM `axo_map` WHERE `axo_map`.`acl_id` = 63 AND `axo_map`.`section_value` = 'Users_Controller' AND `axo_map`.`value` = 'work';",
"INSERT INTO `axo_map` (`acl_id`, `section_value`, `value`) VALUES ('63', 'Votes_Controller', 'work');");
"CREATE TABLE IF NOT EXISTS `approval_template_items` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`approval_template_id` int(11) NOT NULL,
`approval_type_id` int(11) NOT NULL,
`priority` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;"
);
?>
freenetis/trunk/kohana/application/views/devices_show.php
<td><?php echo $device->id ?></td>
</tr>
<tr>
<th><?php echo url_lang::lang('texts.Member') ?></th>
<td><?php echo html::anchor(url_lang::base().'users/show/'.$device->user->member_id,$device->user->member->name.' ('.$device->user->member_id.')'); ?></td>
</tr>
<tr>
<th><?php echo url_lang::lang('texts.User') ?></th>
<td><?php echo html::anchor(url_lang::base().'users/show/'.$device->user->id,$device->user->name.' '.$device->user->surname); ?></td>
</tr>

Také k dispozici: Unified diff