diff --git a/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/js/saimod_mojotrollz_npc_vendor_template.js b/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/js/saimod_mojotrollz_npc_vendor_template.js index 90e32be..e060f6b 100644 --- a/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/js/saimod_mojotrollz_npc_vendor_template.js +++ b/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/js/saimod_mojotrollz_npc_vendor_template.js @@ -1,2 +1,23 @@ function init_saimod_mojotrollz_npc_vendor_template(){ + $('.btn_comment').click(function(){ + entry = $(this).attr('entry'); + $.ajax({ type :'POST', + url : './sai.php?sai_mod=.SAI.saimod_mojotrollz_npc_vendor_template&action=comment', + data : { entry: entry, + comment: $('#input_comment_'+entry).val()}, + success : function(data) { + if(data.status){ + system.reload(); + }else{ + alert('Problem: '+data);} + } + }); + }); + + $('#btn_search').click(function(){ + search = { entry: $('#input_search_entry').val(), + items: $('#input_search_items').val(), + comments: $('#input_search_comments').val()} + system.load('mojotrollz_npc_vendor_template;search.'+JSON.stringify(search),true); + }); } \ No newline at end of file diff --git a/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/saimod_mojotrollz_npc_vendor_template.php b/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/saimod_mojotrollz_npc_vendor_template.php index 38ae2ee..42c5b63 100644 --- a/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/saimod_mojotrollz_npc_vendor_template.php +++ b/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/saimod_mojotrollz_npc_vendor_template.php @@ -1,10 +1,75 @@ 0){ + $count = $con->prepare('count_npc_vendor_template',$query_count,$query_vars)->next()['count']; + $res = $con->prepare('select_npc_vendor_template', $query, $query_vars); + } else { + $count = $con->query($query_count)->next()['count']; + $res = $con->query($query);} + + $vars['entries'] = ''; + $count_filtered = 0; + $res->seek(100*$page); + while(($row = $res->next()) && ($count_filtered < 100)){ + $vars['entries'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \PSAI(),'saimod_mojotrollz_npc_vendor_template/tpl/npc_vendor_template_entry.tpl'), $row); + $count_filtered++; + } + $vars['pagination'] = ''; + $vars['page'] = $page; + $vars['page_last'] = ceil($count/100)-1; + for($i=0;$i < ceil($count/100);$i++){ + $data = array('page' => $i,'search' => $search, 'active' => ($i == $page) ? 'active' : ''); + $vars['pagination'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \PSAI(),'saimod_mojotrollz_npc_vendor_template/tpl/npc_vendor_template_pagination.tpl'), $data); + } + $vars['search'] = $search; + $vars['count'] = $count_filtered.'/'.$count; + $vars = array_merge($vars, \SYSTEM\PAGE\text::tag('basic')); + return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \PSAI(),'saimod_mojotrollz_npc_vendor_template/tpl/npc_vendor_template.tpl'), $vars); + } public static function html_li_menu(){return '
  •   Vendor Template
  • ';} public static function right_public(){return false;} public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI);} diff --git a/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/sql/mysql/schema_mojotrollz_npc_vendor_template.sql b/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/sql/mysql/schema_mojotrollz_npc_vendor_template.sql new file mode 100644 index 0000000..68287c3 --- /dev/null +++ b/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/sql/mysql/schema_mojotrollz_npc_vendor_template.sql @@ -0,0 +1,8 @@ +CREATE TABLE `mojotrollz_npc_vendor_template` ( + `entry` MEDIUMINT(8) UNSIGNED NOT NULL, + `comments` TEXT NULL, + PRIMARY KEY (`entry`) +) +COLLATE='utf8_general_ci' +ENGINE=InnoDB +; \ No newline at end of file diff --git a/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/sql/mysql/system_api.sql b/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/sql/mysql/system_api.sql index c06bcc2..6f208bc 100644 --- a/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/sql/mysql/system_api.sql +++ b/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/sql/mysql/system_api.sql @@ -1 +1,5 @@ -INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5300, 42, 0, 0, '_SAI_saimod_mojotrollz_npc_vendor_template', 'action', NULL); \ No newline at end of file +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5300, 42, 0, 0, '_SAI_saimod_mojotrollz_npc_vendor_template', 'action', NULL); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5301, 42, 3, 0, '_SAI_saimod_mojotrollz_npc_vendor_template', 'search', 'JSON'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5302, 42, 3, 0, '_SAI_saimod_mojotrollz_npc_vendor_template', 'page', 'INT'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5310, 42, 2, 5300, 'comment', 'entry', 'INT'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5311, 42, 2, 5300, 'comment', 'comment', 'STRING'); \ No newline at end of file diff --git a/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/sql/mysql/system_page.sql b/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/sql/mysql/system_page.sql index b9cf50e..57664a3 100644 --- a/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/sql/mysql/system_page.sql +++ b/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/sql/mysql/system_page.sql @@ -1 +1 @@ -INSERT INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (530, 42, 'mojotrollz_npc_vendor_template', 'mojotrollz_npc_vendor_template', -1, 0, 0, '#content', './sai.php?sai_mod=.SAI.saimod_mojotrollz_npc_vendor_template', 'init_saimod_mojotrollz_npc_vendor_template', '\\SAI\\saimod_mojotrollz_npc_vendor_template'); \ No newline at end of file +INSERT INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (530, 42, 'mojotrollz_npc_vendor_template', 'mojotrollz_npc_vendor_template', -1, 0, 0, '#content', './sai.php?sai_mod=.SAI.saimod_mojotrollz_npc_vendor_template&search=${search}&page=${page}', 'init_saimod_mojotrollz_npc_vendor_template', '\\SAI\\saimod_mojotrollz_npc_vendor_template'); \ No newline at end of file diff --git a/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/sql/qq/NPC_VENDOR_TEMPLATE_COMMENT.php b/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/sql/qq/NPC_VENDOR_TEMPLATE_COMMENT.php new file mode 100644 index 0000000..3b0cfe2 --- /dev/null +++ b/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/sql/qq/NPC_VENDOR_TEMPLATE_COMMENT.php @@ -0,0 +1,10 @@ +${basic_rows}: ${count} ${basic_page}: ${page} - - - - - + + + + + + + + + ${entries} -
    entryitemmaxcountincrtimeExtendedCostcondition_iditemscommentsactions
    + + + + + + + +
    \ No newline at end of file + + \ No newline at end of file diff --git a/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/tpl/npc_vendor_template_entry.tpl b/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/tpl/npc_vendor_template_entry.tpl index 1123057..09c976a 100644 --- a/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/tpl/npc_vendor_template_entry.tpl +++ b/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/tpl/npc_vendor_template_entry.tpl @@ -1,8 +1,10 @@ - ${entry} - ${item} - ${maxcount} - ${incrtime} - ${ExtendedCost} - ${condition_id} + ${entry} + ${items} + + + + + + \ No newline at end of file diff --git a/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/tpl/npc_vendor_template_pagination.tpl b/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/tpl/npc_vendor_template_pagination.tpl new file mode 100644 index 0000000..de6c7aa --- /dev/null +++ b/mojotrollz/sai/saimod_mojotrollz_npc_vendor_template/tpl/npc_vendor_template_pagination.tpl @@ -0,0 +1 @@ +
  • ${page}
  • \ No newline at end of file diff --git a/mojotrollz/sql/mangos_one_world.php b/mojotrollz/sql/mangos_one_world.php new file mode 100644 index 0000000..3218f67 --- /dev/null +++ b/mojotrollz/sql/mangos_one_world.php @@ -0,0 +1,8 @@ +