Skip to content

Commit

Permalink
Added some autocompletes
Browse files Browse the repository at this point in the history
  • Loading branch information
GodMod committed Jan 14, 2019
1 parent cac4ae4 commit a7ab762
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 5 deletions.
25 changes: 24 additions & 1 deletion includes/rli_item.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ public function display($with_form=false) {
'DISPLAY' => 'style="display: none;"',
'S_IP_SAVE' => $this->config('itempool_save')
));

$item_names = array_unique ($this->pdh->aget('item', 'name', 0, array($this->pdh->get('item', 'id_list'))));
$itemids = array_unique($this->pdh->aget('item', 'name', 0, array($this->pdh->get('game_itemid', 'id_list'))));
$strItemNames = $this->jquery->implode_wrapped('"','"', ",", $item_names);
$strItemIDs = $this->jquery->implode_wrapped('"','"', ",", $itemids);

$this->tpl->add_js(
"var rli_key = ".($key+1).";
$('#items').on('click', '.del_item', function() {
Expand All @@ -207,7 +213,24 @@ public function display($with_form=false) {
item.removeAttr('style');
$('#item_999').before(item);
rli_key++;
});", 'docready');
bindAutocomplete();
});
var jquiac_items = [".$strItemNames."];
var jquiac_itemids = [".$strItemIDs."];
function bindAutocomplete(){
$('.autocomplete_items').autocomplete({
source: jquiac_items
});
$('.autocomplete_itemids').autocomplete({
source: jquiac_itemids
});
}
bindAutocomplete();
", 'docready');
}
if($end && $end <= $p) {
$next_button = '<button type="submit" name="checkitem" value="'.$this->user->lang('rli_itempage').(($page) ? $page : 2).'"><i class="fa fa-arrow-right"></i> '.$this->user->lang('rli_itempage').(($page) ? $page : 2).'</button>';
Expand Down
23 changes: 22 additions & 1 deletion includes/rli_member.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,9 @@ public function display($with_form=false) {
if(isset($detail_raid_list)) $this->detailed_times_list(999, array());
unset($this->members[999]);
$this->jquery->qtip('#dt_help', $this->user->lang('rli_help_dt_member'), array('my' => 'center right', 'at' => 'left center'));
$members = $this->pdh->aget('member', 'name', 0, array($this->pdh->sort($this->pdh->get('member', 'id_list', array(false,true,false)), 'member', 'name', 'asc')));
$js_array = $this->jquery->implode_wrapped('"','"', ",", $members);

$this->tpl->add_js(
"var rli_key = ".(($key) ? $key : 1).";
$('.del_mem').click(function() {
Expand All @@ -326,8 +329,26 @@ public function display($with_form=false) {
mem.removeAttr('style');
mem.find('td:first').html((rli_key+1)+$.trim(mem.find('td:first').html()));
$('#memberrow_999').before(mem);
bindAutocomplete();
rli_key++;
});", 'docready');
});
var jquiac_members = [".$js_array."];
function bindAutocomplete(){
$('.autocomplete_members').autocomplete({
source: jquiac_members
});
}
bindAutocomplete();
", 'docready');

$this->returnJScache['autocomplete'][$id] = 'var jquiac_'.$id.' = ['.$js_array.'];
$("#'.$ids.'").autocomplete({
source: jquiac_'.$id.'
});';

if($this->config('member_display') == 1){
$this->tpl->add_js("
Expand Down
4 changes: 2 additions & 2 deletions templates/base_template/items.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
&nbsp;<i class="fa fa-trash-o fa-lg del_item hand" title="{L_delte}" data-id="item_{loots.KEY}"></i>
<input type="hidden" id="item_{loots.KEY}submit" name="loots[{loots.KEY}][delete]" value="true" {loots.DELDIS} />
</td>
<td><input type="text" name="loots[{loots.KEY}][name]" class="input" value="{loots.LOOTNAME}" size="40" {loots.READONLY} /></td>
<td><input type="text" name="loots[{loots.KEY}][game_id]" class="input" value="{loots.ITEMID}" /></td>
<td><input type="text" name="loots[{loots.KEY}][name]" class="input autocomplete_items" value="{loots.LOOTNAME}" size="40" {loots.READONLY} /></td>
<td><input type="text" name="loots[{loots.KEY}][game_id]" class="input autocomplete_itemids" value="{loots.ITEMID}" /></td>
<td>{loots.LOOTER}</td>
<td>{loots.RAID}</td>
<td>{loots.ITEMPOOL}</td>
Expand Down
2 changes: 1 addition & 1 deletion templates/base_template/members_raids.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
{player.NR}&nbsp;<i class="fa fa-trash-o fa-lg del_mem" title="{L_delete}" data-id="memberrow_{player.KEY}"></i>
<input type="hidden" id="memberrow_{player.KEY}submit" name="members[{player.KEY}][delete]" value="true" {player.DELDIS} />
</td>
<td width="300"><input type="text" name="members[{player.KEY}][name]" value="{player.MITGLIED}" /> {player.ALIAS} {player.RANK}</td>
<td width="300"><input type="text" name="members[{player.KEY}][name]" value="{player.MITGLIED}" class="autocomplete_members" /> {player.ALIAS} {player.RANK}</td>
{player.RAID_LIST}
<!-- IF S_ATT_BEGIN -->
<td align="right"><input type="checkbox" name="members[{player.KEY}][att_begin]" class="maininput" value="true" {player.ATT_BEGIN} size="5" /></td>
Expand Down

0 comments on commit a7ab762

Please sign in to comment.