quicktags quest&object
This commit is contained in:
parent
16dc6c1e37
commit
bf796a9f51
@ -9,6 +9,23 @@ function init_saimod_mojotrollz_db_object(){
|
||||
init_saimod_mojotrollz_db_object();
|
||||
});
|
||||
});
|
||||
$('.btn_tags_edit').click(function(e){
|
||||
e.preventDefault();
|
||||
var id = $(this).attr('_id');
|
||||
var tags = {};
|
||||
$('.search_tag_filter_'+id+' option:selected').each(function(){
|
||||
var type = $(this).attr('_type');
|
||||
tags[type] = $(this).val();});
|
||||
$.ajax({ type :'GET',
|
||||
url : SAI_ENDPOINT+'sai_mod=saimod_mojotrollz_db_object&action=tag'+
|
||||
'&id='+id+
|
||||
'&tags='+JSON.stringify(tags),
|
||||
success : function(data) {
|
||||
if(!data.status){
|
||||
alert('Problem: '+data);}
|
||||
}
|
||||
});
|
||||
});
|
||||
$('.wow_object').click(function(){
|
||||
load_object($(this).attr('_id'));
|
||||
});
|
||||
|
||||
@ -53,11 +53,14 @@ class saimod_mojotrollz_db_object extends \SYSTEM\SAI\SaiModule {
|
||||
if(!$tags){
|
||||
$tags = array();}
|
||||
|
||||
$tags_select = array();
|
||||
$tags_types = tags::get_type(tags::TAG_TABLE_OBJECT);
|
||||
while($tag = $tags_types->next()){
|
||||
$tags_select[$tag['id']]['type'] = $tag;
|
||||
$tag['options'] = '';
|
||||
$tags_values = tags::get_value($tag['id']);
|
||||
while($value = $tags_values->next()){
|
||||
$tags_select[$tag['id']]['values'][] = $value;
|
||||
$value['selected'] = '';
|
||||
if( array_key_exists($value['type'], $tags) &&
|
||||
$tags[$value['type']] == $value['id']){
|
||||
@ -83,6 +86,25 @@ class saimod_mojotrollz_db_object extends \SYSTEM\SAI\SaiModule {
|
||||
' (`entry` LIKE ? OR `name` LIKE ?) LIMIT 100;',
|
||||
array($search,$search));
|
||||
while($row = $res->next()){
|
||||
$row['tags'] = '';
|
||||
//Creature Tags
|
||||
$tags_res = tags::get(tags::TAG_TABLE_OBJECT, $row['entry']);
|
||||
$tags = array();
|
||||
while($tag = $tags_res->next()){
|
||||
$tags[$tag['type']] = $tag;}
|
||||
|
||||
//Tag Types
|
||||
foreach($tags_select as $tag_){
|
||||
$tag = $tag_['type'];
|
||||
$tag['options'] = '';
|
||||
foreach($tags_select[$tag['id']]['values'] as $value){
|
||||
$tag['entry'] = $row['entry'];
|
||||
$value['selected'] = '';
|
||||
if( array_key_exists($value['type'], $tags) &&
|
||||
$tags[$value['type']]['value'] == $value['id']){
|
||||
$value['selected'] = 'selected';}
|
||||
$tag['options'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new PSAI(),'saimod_mojotrollz_db_object/tpl/tag_entry_option.tpl'), $value);}
|
||||
$row['tags'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new PSAI(),'saimod_mojotrollz_db_object/tpl/search_tag_entry.tpl'), $tag);}
|
||||
$vars['entries'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new PSAI(),'saimod_mojotrollz_db_object/tpl/search_entry.tpl'), $row);}
|
||||
|
||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new PSAI(),'saimod_mojotrollz_db_object/tpl/search.tpl'), $vars);
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
<th>Faction</th>
|
||||
<th>MinGold</th>
|
||||
<th>MaxGold</th>
|
||||
<th>Tags</th>
|
||||
</tr>
|
||||
${entries}
|
||||
</table>
|
||||
@ -1,9 +1,13 @@
|
||||
<tr class="wow_object" _id="${entry}">
|
||||
<tr>
|
||||
<td>${entry}</td>
|
||||
<td>${name}</td>
|
||||
<td><a class="wow_object" _id="${entry}" href="#">${name}</a></td>
|
||||
<td>${type}</td>
|
||||
<td>${displayId}</td>
|
||||
<td>${faction}</td>
|
||||
<td>${mingold}</td>
|
||||
<td>${maxgold}</td>
|
||||
<td>
|
||||
${tags}
|
||||
<button class="btn btn-danger btn_tags_edit" type="button" _id="${entry}">Edit</button>
|
||||
</td>
|
||||
</tr>
|
||||
@ -0,0 +1,4 @@
|
||||
<select class="search_tag_filter_${entry}">
|
||||
<option value="-2" _type="${id}">No Tag</option>
|
||||
${options}
|
||||
</select>
|
||||
@ -9,6 +9,23 @@ function init_saimod_mojotrollz_db_quest(){
|
||||
init_saimod_mojotrollz_db_quest();
|
||||
});
|
||||
});
|
||||
$('.btn_tags_edit').click(function(e){
|
||||
e.preventDefault();
|
||||
var id = $(this).attr('_id');
|
||||
var tags = {};
|
||||
$('.search_tag_filter_'+id+' option:selected').each(function(){
|
||||
var type = $(this).attr('_type');
|
||||
tags[type] = $(this).val();});
|
||||
$.ajax({ type :'GET',
|
||||
url : SAI_ENDPOINT+'sai_mod=saimod_mojotrollz_db_quest&action=tag'+
|
||||
'&id='+id+
|
||||
'&tags='+JSON.stringify(tags),
|
||||
success : function(data) {
|
||||
if(!data.status){
|
||||
alert('Problem: '+data);}
|
||||
}
|
||||
});
|
||||
});
|
||||
$('.wow_quest').click(function(){
|
||||
load_quest($(this).attr('_id'));
|
||||
});
|
||||
|
||||
@ -53,11 +53,14 @@ class saimod_mojotrollz_db_quest extends \SYSTEM\SAI\SaiModule {
|
||||
if(!$tags){
|
||||
$tags = array();}
|
||||
|
||||
$tags_select = array();
|
||||
$tags_types = tags::get_type(tags::TAG_TABLE_QUEST);
|
||||
while($tag = $tags_types->next()){
|
||||
$tags_select[$tag['id']]['type'] = $tag;
|
||||
$tag['options'] = '';
|
||||
$tags_values = tags::get_value($tag['id']);
|
||||
while($value = $tags_values->next()){
|
||||
$tags_select[$tag['id']]['values'][] = $value;
|
||||
$value['selected'] = '';
|
||||
if( array_key_exists($value['type'], $tags) &&
|
||||
$tags[$value['type']] == $value['id']){
|
||||
@ -83,6 +86,25 @@ class saimod_mojotrollz_db_quest extends \SYSTEM\SAI\SaiModule {
|
||||
' (`entry` LIKE ? OR `title` LIKE ?) LIMIT 100;',
|
||||
array($search,$search));
|
||||
while($row = $res->next()){
|
||||
$row['tags'] = '';
|
||||
//Creature Tags
|
||||
$tags_res = tags::get(tags::TAG_TABLE_QUEST, $row['entry']);
|
||||
$tags = array();
|
||||
while($tag = $tags_res->next()){
|
||||
$tags[$tag['type']] = $tag;}
|
||||
|
||||
//Tag Types
|
||||
foreach($tags_select as $tag_){
|
||||
$tag = $tag_['type'];
|
||||
$tag['options'] = '';
|
||||
foreach($tags_select[$tag['id']]['values'] as $value){
|
||||
$tag['entry'] = $row['entry'];
|
||||
$value['selected'] = '';
|
||||
if( array_key_exists($value['type'], $tags) &&
|
||||
$tags[$value['type']]['value'] == $value['id']){
|
||||
$value['selected'] = 'selected';}
|
||||
$tag['options'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new PSAI(),'saimod_mojotrollz_db_quest/tpl/tag_entry_option.tpl'), $value);}
|
||||
$row['tags'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new PSAI(),'saimod_mojotrollz_db_quest/tpl/search_tag_entry.tpl'), $tag);}
|
||||
$vars['entries'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new PSAI(),'saimod_mojotrollz_db_quest/tpl/search_entry.tpl'), $row);}
|
||||
|
||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new PSAI(),'saimod_mojotrollz_db_quest/tpl/search.tpl'), $vars);
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
<th>Title</th>
|
||||
<th>Details</th>
|
||||
<th>Objectives</th>
|
||||
<th>Tags</th>
|
||||
</tr>
|
||||
${entries}
|
||||
</table>
|
||||
@ -1,6 +1,10 @@
|
||||
<tr class="wow_quest" _id="${entry}">
|
||||
<tr>
|
||||
<td>${entry}</td>
|
||||
<td>${Title}</td>
|
||||
<td><a class="wow_quest" _id="${entry}" href="#">${Title}</a></td>
|
||||
<td>${Details}</td>
|
||||
<td>${Objectives}</td>
|
||||
<td>
|
||||
${tags}
|
||||
<button class="btn btn-danger btn_tags_edit" type="button" _id="${entry}">Edit</button>
|
||||
</td>
|
||||
</tr>
|
||||
@ -0,0 +1,4 @@
|
||||
<select class="search_tag_filter_${entry}">
|
||||
<option value="-2" _type="${id}">No Tag</option>
|
||||
${options}
|
||||
</select>
|
||||
Loading…
x
Reference in New Issue
Block a user