News: TinyPortal Release Schedule. Please read this update for More Info.

Login  |  Register
HTML5 Icon HTML5 Icon
TP on Social Media
Welcome, Guest. Please login or register.
Did you miss your activation email?

September 19, 2019, 11:33:34 AM

Login with username, password and session length

Recent

Members
  • Total Members: 3752
  • Latest: Alizee
Stats
  • Total Posts: 188917
  • Total Topics: 20754
  • Online Today: 126
  • Online Ever: 629
  • (November 08, 2018, 01:36:54 PM)
Users Online
Users: 2
Guests: 71
Total: 73

Author Topic: [Block] WoW Progression Block  (Read 22167 times)

0 Members and 1 Guest are viewing this topic.

Raugturi

  • Guest
[Block] WoW Progression Block
« on: April 02, 2009, 04:01:23 PM »
First, before I forget, the inspiration for this block is here: http://bollklubben.mine.nu/Community/

I can't read a word of that, but it's pretty. :)

Anyway, here is a block to display WoW progress that is easily customizable for new content.

Code: [Select]
// SMF-TinyPortal WoW Progress Block - ver. 0.1

// Author: Raugturi (Raugturi@gmail.com)
// Created: April 02, 2009
// Last Update: April 02, 2009

// Code to display Boss Progress for multiple instances for WoW.
// Lists each instance you define (in the order you define them)
// as well as counts for currently cleared/total bosses for that instance.
// Tooltip on mouseover shows list of bosses with strikethrough over
// the cleared ones.
//
// Requires wz_tooltip to be loaded in the page
// http://www.walterzorn.com/tooltip/tooltip_e.htm

// ******************
// * Config Section *
// ******************

// Progress Page: Path to Progress page if you have one and want
// to link to it. Using javascript:void(0); will cause the links
// to be disabled but still allow the tooltip. If you want them to
// look like the rest of your links you will also want to remove
// this: style="text-decoration: none;" in the code at the bottom.
$progress_page = 'javascript:void(0);';

// Instance Arrays
// Variables:
// Name   - Type: Text,  Value: Instance name
// Bosses - Type: Array, Element Format: Key = Name, Value = Boolean (true=cleared,false=not cleared)
$instancelist = array(
array(
'name' => 'Naxxramas-10',
'bosses' => array(
'Anub´Rekhan' => true,
'Grand Widow Faerlina' => true,
'Maexxna' => true,
'Noth the Plaguebringer' => true,
'Heigan the Unclean' => true,
'Loatheb' => true,
'Instructor Razuvious' => true,
'Gothik the Harvester' => true,
'The Four Horsemen' => true,
'Patchwerk' => true,
'Grobbulus' => true,
'Gluth' => true,
'Thaddius' => true,
'Sapphiron' => true,
'Kel´Thuzad' => true)),
array(
'name' => 'Naxxramas-25',
'bosses' => array(
'Anub´Rekhan' => true,
'Grand Widow Faerlina' => true,
'Maexxna' => true,
'Noth the Plaguebringer' => true,
'Heigan the Unclean' => true,
'Loatheb' => true,
'Instructor Razuvious' => true,
'Gothik the Harvester' => true,
'The Four Horsemen' => true,
'Patchwerk' => true,
'Grobbulus' => true,
'Gluth' => true,
'Thaddius' => true,
'Sapphiron' => true,
'Kel´Thuzad' => true)),
array(
'name' => 'Eye of Eternity-10',
'bosses' => array(
'Malygos' => true)),
array(
'name' => 'Eye of Eternity-25',
'bosses' => array(
'Malygos' => true)),
array(
'name' => 'Obsidian Sanctum-10',
'bosses' => array(
'Sartharion' => true,
'Sartharion + 1 Drake' => true,
'Sartharion + 2 Drakes' => true,
'Sartharion + 3 Drakes' => false)),
array(
'name' => 'Obsidian Sanctum-25',
'bosses' => array(
'Sartharion' => true,
'Sartharion + 1 Drake' => true,
'Sartharion + 2 Drakes' => true,
'Sartharion + 3 Drakes' => false)),
array(
'name' => 'Vault of Archavon-10',
'bosses' => array(
'Archavon the Stone Watcher' => true)),
array(
'name' => 'Vault of Archavon-25',
'bosses' => array(
'Archavon the Stone Watcher' => true))
);

//**********************
//* END Config Section *
//**********************

//*********************************
//* Do not edit below here unless *
//* you know what you are doing!! *
//*********************************

echo '
<table width="100%">';

foreach ($instancelist as $instance) {

// Used to display overall progress in front of instance name.
$clear_count = 0;
$total_count = 0;

$tooltip = '<table width=100% cellpadding=0 cellspacing=0>';

foreach ($instance['bosses'] as $key => $value) {
$tooltip .= '<tr><td>';
if ($value) {
++$clear_count;
$tooltip .= '<s>' . $key . '</s>';
} else {
$tooltip .= $key;
}
$tooltip .= '</td></tr>';
++$total_count;
}

$tooltip .= '</table>';

echo '
  <tr><td><a style="text-decoration: none;" href="' . $progress_page . '" onmouseover="Tip(\'' . $tooltip . '\')" onmouseout="UnTip()">[' . $clear_count . '/' . $total_count . '] ' . $instance['name'] . '</a></td></tr>';

}

echo '
<tr><td align="center"><hr /><font size="-2">Mouseover instance<br />for details.</font></td></tr>
</table>
';

Hopefully the array definitions are fairly straightforward.  I suck at comments.

Based off the same code as my Recruitment block here:
http://www.tinyportal.net/index.php/topic,19751.msg232164.html#msg232164

If you want to see it in action, check out my guild's new website (a work in progress):
http://www.summit-wow.com/

GreenX

  • Guest
Re: [Block] WoW Progression Block
« Reply #1 on: April 03, 2009, 03:36:29 AM »
That is some awesome blocks!

BUT OMG How did you get that DKP link working like that to show with using the forum headers/footer style! I so can't figure that out and I would love to be able to have that function on my website. Can you share :D :D


Inny

  • Guest
Re: [Block] WoW Progression Block
« Reply #2 on: April 03, 2009, 04:40:50 AM »
That is some awesome blocks!

BUT OMG How did you get that DKP link working like that to show with using the forum headers/footer style! I so can't figure that out and I would love to be able to have that function on my website. Can you share :D :D



Create new HTML article in TP

Use:
Code: [Select]
<iframe id="myframe" src="/your_EQDKP_Path/" marginwidth="0" marginheight="0" vspace="0" hspace="0" scrolling="no" width="100%" frameborder="0">none</iframe>

Additionally with that code you can put:
Code: [Select]
<script type="text/javascript">

/***********************************************
* IFrame SSI script II- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of original DHTML scripts
* This notice must stay intact for legal use
***********************************************/

//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
var iframeids=["myframe"]

//Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="yes"

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight;
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller

</script>

So the complete code is:
Code: [Select]
<script type="text/javascript">

/***********************************************
* IFrame SSI script II- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of original DHTML scripts
* This notice must stay intact for legal use
***********************************************/

//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
var iframeids=["myframe"]

//Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="yes"

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight;
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller

</script>

<iframe id="myframe" src="/your_EQDKP_Path/" marginwidth="0" marginheight="0" vspace="0" hspace="0" scrolling="no" width="100%" frameborder="0">none</iframe>

Don't forget to change the path in the iframe tag

Raugturi

  • Guest
Re: [Block] WoW Progression Block
« Reply #3 on: April 03, 2009, 12:50:21 PM »
That is some awesome blocks!

BUT OMG How did you get that DKP link working like that to show with using the forum headers/footer style! I so can't figure that out and I would love to be able to have that function on my website. Can you share :D :D


Thanks!  And I did exactly what Inny said pretty much.  The only change I had to make was to add an onload to the iframe telling it to call the resizeCaller function.  For some reason when I first went to the site it wouldn't resize, but then using back/forward would get it to jump to the right height.  Adding the resize call on the iframe onload fixed it though.

Once you get that working just modify the DKP system to not display its own headers and logos and crap.  My next goal is to use the integration hooks to automatically log users into the DKP page when they login to SMF and grant anyone who is an admin on the forum admin priveledges in eqDKP-plus as well.  It's umm...not going well so far.

GreenX

  • Guest
Re: [Block] WoW Progression Block
« Reply #4 on: April 03, 2009, 01:42:11 PM »
If I could ask how did you make the it so all the links inside your iframe stay inside the frame? When I do the above and I click on any member or top menu part of eqdkp it jumps me out and away from SMF unlike your, Im pretty sure there are some files I need to mod in eqdkp but I dunno which ones or the code.

Thanks!


Inny

  • Guest
Re: [Block] WoW Progression Block
« Reply #5 on: April 03, 2009, 01:46:07 PM »
its in eqdkp.php dont remember where, i will find out and reply to your PM.

GreenX

  • Guest
Re: [Block] WoW Progression Block
« Reply #6 on: April 03, 2009, 02:35:53 PM »
It works! I am so in your debt!

Inny

  • Guest
Re: [Block] WoW Progression Block
« Reply #7 on: April 03, 2009, 03:20:40 PM »
My next goal is to use the integration hooks to automatically log users into the DKP page when they login to SMF and grant anyone who is an admin on the forum admin priveledges in eqDKP-plus as well.  It's umm...not going well so far.

Much more easier since you already removed the headers and footer to implement a block to only shown for admins with the EQDKP menu. That will need some php includes i guess but instead of messing with fetching the membergroups from smf tables is better to use the TP block instead.


Or you can do it simpler and just use admin links in the block using (above Iframe script is needed):
Code: [Select]
<a href="javascript:loadintoIframe('myframe', 'external.htm')">Link</a>

Those are just my ideas, im using EQDKP the last 3 years and i never had anyone with an account besides me and the DKP Officer. (pretty much useless for me to have accounts for guild members :P)

It works! I am so in your debt!

No problem.

Kazie

  • Guest
Re: [Block] WoW Progression Block
« Reply #8 on: April 12, 2009, 12:33:53 PM »
I just hate beeing a newb..

But i made a PHP block in TP and downloaded that tooltip thing, but i just can't figure out where the hell to put that line it says i should put in some file at the start of the Body tag.

Cuz i can't find any body tacs :O!

CAll me a newb, but i just started using TP today! :)

Raugturi

  • Guest
Re: [Block] WoW Progression Block
« Reply #9 on: April 12, 2009, 12:48:14 PM »
I just hate beeing a newb..

But i made a PHP block in TP and downloaded that tooltip thing, but i just can't figure out where the hell to put that line it says i should put in some file at the start of the Body tag.

Cuz i can't find any body tacs :O!

CAll me a newb, but i just started using TP today! :)

I'm assuming you mean where to put the links to the javascript that comes with the WoW Tooltip mod for SMF.  If so, you go to your Templates section, Modify Themes, find your them and click to browse the files.  Index.template.php is the one to edit.