Skip to content

Commit

Permalink
[208] Add debug log. Use this ONLY for debugging (disable on live ser…
Browse files Browse the repository at this point in the history
…ver, clear error log (cache/_debug/dbg.tmp)). You need to add permissions to cache/_debug folder to allow script write debug info (same as cache system). To clear log open http://armory_url/cache/_debug/?clearLog
  • Loading branch information
Shadez committed May 26, 2010
1 parent 383e48c commit 5aeb4e5
Show file tree
Hide file tree
Showing 9 changed files with 357 additions and 104 deletions.
140 changes: 130 additions & 10 deletions _js/character/character-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function initializeCharacterSelect(numChars){
});

//adding from the bottom
/*$(".add_on").click(function(){
$(".add_on").click(function(){
var currUrl = $(this).next().attr("href");

//secondary are set to 2 or 3
Expand All @@ -43,7 +43,7 @@ function initializeCharacterSelect(numChars){
currUrl = currUrl.replace("n=","n"+(charsSelected+1)+"=");

updateCharIcons(getCollectedCharUrls() + currUrl);
});*/
});
}

//get the urls of the primary and secondary chars
Expand Down Expand Up @@ -89,7 +89,7 @@ function getCollectedCharUrls(){

//send ajax request to update characters and reload page
function updateCharIcons(charUrls){
/*

$.ajax({
type: "GET",
url: 'character-select-submit.xml?' + charUrls,
Expand All @@ -101,14 +101,134 @@ function updateCharIcons(charUrls){
error: function(msg){
window.location.reload(); //refresh page
}
});*/
});
}

char_arr = new Array();
realm_arr = new Array();
var lastfield, ajaxinit, default_realm
function add_rss_char(somefield)
{ var char_req = ochar_req = $("#character"+somefield).val()

if(char_req == '') { if(char_arr[somefield-1] && char_arr[somefield-1].length > 0)
{ addchar_error(str_removed+" "+char_req,somefield);
char_arr[somefield-1] = realm_arr[somefield-1] = null;
refresh_rss_url()
//$(".ajax_error:eq("+(somefield-1)+")").html('')
}
else addchar_error(str_err_char,somefield);
return;
}
if(char_req.indexOf("@") < 0 && (!default_realm || default_realm=='')) { addchar_error(str_err_realm,somefield); return }

char_req = char_req.split("@")
if(!char_req[1] && default_realm) char_req[1] = default_realm
char_req[0] = jQuery.trim(char_req[0])
char_req[1] = jQuery.trim(char_req[1]).replace(/\s/g,"+")
var char_req_url = "character-feed.xml?r="+char_req[1]+"&cn="+char_req[0]+"&skipCache"

lastfield = somefield;

$.get(char_req_url, {},
function(data,textStatus){
//alert("Data Loaded: " + data + "\nStatus:"+textStatus);
if(textStatus=="success")
{ char_arr[somefield-1] = char_req[0]
realm_arr[somefield-1] = char_req[1]
refresh_rss_url()
$(".ajax_error:eq("+(somefield-1)+")").html('')
$(".character_row:eq("+(somefield-1)+") > a").hide();
$(".character_row:eq("+(somefield-1)+")").addClass("ok");
if(somefield<6) $(".character_row:eq("+(somefield)+")").fadeIn("fast",function(){ $("#character"+(Number(somefield)+1)).focus();})
var charattr = {}
var charInfo = data.getElementsByTagName("character")[0]
var charLvl = Number(charInfo.getAttribute("level"))
var charLvlRg = (charLvl < 60)?"-default":(charLvl < 70)?"":(charLvl < 80)?"-70":"-80"
var charimg = '<a href="javascript:;" class="staticTip" onmouseover="setTipText(str_remove)" onclick="rss_remove('+somefield+')"><img class="" src="images/portraits/wow'+charLvlRg+'/'+charInfo.getAttribute("genderId")+"-"+charInfo.getAttribute("raceId")+"-"+charInfo.getAttribute("classId")+'.gif"/></a>'
$(".character_row:eq("+(somefield-1)+") > .rss_port").html(charimg)
bindToolTips()
}
});
if(!ajaxinit) { bind_ajax_error(); ajaxinit = true }

}

function rss_remove(somefield)
{ $("#character"+somefield).val('')
add_rss_char(somefield)
}

function bind_ajax_error()
{
$(".custom_rss_container").ajaxError(function(event, request, settings){
if(ochar_req.indexOf("@")==-1){ ochar_req += " on " + default_realm}
addchar_error(str_cantfind.replace('XXX'," <b>" + ochar_req + "</b>"),lastfield);
});
}

function addchar_error(some_err,somefield)
{ var err_field = $(".ajax_error:eq("+(somefield-1)+")")
err_field.parent().removeClass("ok");
err_field.html(some_err);
err_field.stop();
err_field.animate({color:"red"},"fast").animate({color:"black"},3000)

}

var focusval
function char_check(targ,option)
{ if(!option)
{ focusval = targ.value
}
else
{ if(targ.value != focusval){ add_rss_char(targ.id.slice(-1)) }
}

}

function check_action()
{ $(this).toggleClass('checked');
if($(this).parent().hasClass('sub')){ $(this).parent().toggleClass('deselected'); }
refresh_rss_url()
}

var base_rss_url = location.href.split("custom-rss.xml")[0]+ "character-feed.atom"
function refresh_rss_url()
{ var opt_arr = new Array()
var achieve_arr = new Array()
var opt = $(".check_box.checked").each(function(){ if($(this).parent().hasClass("sub")) achieve_arr.push(this.id);
else opt_arr.push(this.id.toUpperCase());
})
var feed_url = base_rss_url + "?r="+realm_arr.join(",").replace(/(,+$)+|(^,+)+/g,'')+"&cn="+char_arr.join(",").replace(/(,+$)+|(^,+)/g,'')
if(opt_arr.length > 0 && opt_arr.length != $(".top_level > .check_box").length) feed_url += "&filters="+opt_arr.join(",")
if(achieve_arr.length > 0 && $('#achievement').hasClass('checked') && achieve_arr.length != $(".sub > .check_box").length)
feed_url += "&achCategories="+achieve_arr.join(",")
if(achieve_arr.length == 0 && $('#achievement').hasClass('checked')) $('#achievement').removeClass('checked')
if($('#loot').hasClass('checked')){
item_qual = $('#loot_rarity').val(); if(item_qual!='') feed_url += "&itemQuality="+ item_qual.toUpperCase();
item_level = $('#loot_ilvl').val(); if(item_level!='') feed_url += "&itemLevel="+ item_level
}
feed_url = feed_url.replace(/(,+)/g,',')+"&locale="+lang;
if(char_arr.length > 0 && char_arr.join('') != '') $("#customfeed_url").val(feed_url)
if(char_arr.join('') == '') $("#customfeed_url").val('')
//$("#rss_link_copy").attr("href",feed_url)
}


function check_default_char()
{
if((armory_query.n || armory_query.cn) && armory_query.r){
def_chr = armory_query.n||armory_query.cn
def_rlm = armory_query.r.replace(/\+/g," ")
$("#character1").val(def_chr+"@"+def_rlm);
$(".character_row:first > a").click()

$("#feed_return").html(backhtml.replace("default_chr",def_chr)).attr('href',"character-sheet.xml?r="+armory_query.r+"&cn="+def_chr);
}
}

//boolean for displaying dual tooltips or not
function setDualTooltipCookie() {
if (document.getElementById('checkboxDualTooltip').checked)
setcookie("armory.cookieDualTooltip", 1);
else
setcookie("armory.cookieDualTooltip", 0);
function toggle_subfilter(which, targ)
{ $(targ).toggleClass('less')
$('#'+which).toggle();
}
//Moved setDualTooltipCookie to common.js
32 changes: 32 additions & 0 deletions cache/_debug/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

/**
* @package World of Warcraft Armory
* @version Release Candidate 1
* @revision 208
* @copyright (c) 2009-2010 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
**/

if(isset($_GET['clearLog'])) {
@file_put_contents('tmp.dbg', null);
header('Location: index.php');
}
echo '<html><head><title>WoWArmory Debug Log</title></head><body>';
@include('tmp.dbg');
echo '</body></html>';
?>
Empty file added cache/_debug/tmp.dbg
Empty file.
26 changes: 14 additions & 12 deletions character-achievements.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release Candidate 1
* @revision 203
* @revision 208
* @copyright (c) 2009-2010 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
Expand Down Expand Up @@ -223,19 +223,21 @@
// root
$xml->XMLWriter()->startElement('rootCategories');
$root_categories = $achievements->BuildCategoriesTree();
foreach($root_categories as $category) {
$xml->XMLWriter()->startElement('category');
$xml->XMLWriter()->writeAttribute('id', $category['id']);
$xml->XMLWriter()->writeAttribute('name', $category['name']);
if(isset($category['child']) && is_array($category['child'])) {
foreach($category['child'] as $category_child) {
$xml->XMLWriter()->startElement('category');
$xml->XMLWriter()->writeAttribute('name', $category_child['name']);
$xml->XMLWriter()->writeAttribute('id', $category_child['id']);
$xml->XMLWriter()->endElement(); //category
if($root_categories && is_array($root_categories)) {
foreach($root_categories as $category) {
$xml->XMLWriter()->startElement('category');
$xml->XMLWriter()->writeAttribute('id', $category['id']);
$xml->XMLWriter()->writeAttribute('name', $category['name']);
if(isset($category['child']) && is_array($category['child'])) {
foreach($category['child'] as $category_child) {
$xml->XMLWriter()->startElement('category');
$xml->XMLWriter()->writeAttribute('name', $category_child['name']);
$xml->XMLWriter()->writeAttribute('id', $category_child['id']);
$xml->XMLWriter()->endElement(); //category
}
}
$xml->XMLWriter()->endElement(); //category
}
$xml->XMLWriter()->endElement(); //category
}
$xml->XMLWriter()->endElement(); //rootCategories
$xml->XMLWriter()->endElement(); //achievements
Expand Down
Loading

0 comments on commit 5aeb4e5

Please sign in to comment.