<?php
/*
Extension Name: YShout
Extension Url: http://www.matchbox360.co.uk
Description: Adds YShout ajax shoutbox to the panel
Version: 1.0
Author: David Du Cros
Author Url: http://www.matchbox360.co.uk
*/
$Context->Dictionary["DisplayShoutBox"] = "Display Shoutbox on Discussions Page";
$Context->Dictionary["ShoutBox"] = "ShoutBox";
if ($Context->SelfUrl == "account.php") {
$Context->AddToDelegate("PreferencesForm", "PreRender", "PreferencesForm_AddShoutbox");
function PreferencesForm_AddShoutbox(&$PreferencesForm) {
$PreferencesForm->AddPreference("ShoutBox", "DisplayShoutBox", "ShowShoutBox");
}
}
if ($Context->Session->User->UserID > 0 && in_array($Context->SelfUrl, array('index.php'))) {
if ($Context->Session->User->Preference("ShowShoutBox")) {
$Head->AddScript('extensions/YShout/src/js/jquery.js');
$Head->AddScript('extensions/YShout/src/js/yshout.js');
$Head->AddStyleSheet('extensions/YShout/src/css/yshout.css');
$Head->AddString('
<script type="text/javascript">
$(document).ready(function(){
new YShout({
yPath: \'extensions/YShout/src/\',
user: \'' . $Context->Session->User->Name . '\'
});
});</script>
');
$Panel->AddString("<h2>Chat</h2>
<ul><li>
<div id='yshout'></div>
</li></ul>", 20);
}
}
?>
i also editted the constructor to put that value into the options struct, and to use it to build the html form (with a hidden text field of course :P). see, told you it was dirty
Comments
<?php /* Extension Name: YShout Extension Url: http://www.matchbox360.co.uk Description: Adds YShout ajax shoutbox to the panel Version: 1.0 Author: David Du Cros Author Url: http://www.matchbox360.co.uk */ $Context->Dictionary["DisplayShoutBox"] = "Display Shoutbox on Discussions Page"; $Context->Dictionary["ShoutBox"] = "ShoutBox"; if ($Context->SelfUrl == "account.php") { $Context->AddToDelegate("PreferencesForm", "PreRender", "PreferencesForm_AddShoutbox"); function PreferencesForm_AddShoutbox(&$PreferencesForm) { $PreferencesForm->AddPreference("ShoutBox", "DisplayShoutBox", "ShowShoutBox"); } } if ($Context->Session->User->UserID > 0 && in_array($Context->SelfUrl, array('index.php'))) { if ($Context->Session->User->Preference("ShowShoutBox")) { $Head->AddScript('extensions/YShout/src/js/jquery.js'); $Head->AddScript('extensions/YShout/src/js/yshout.js'); $Head->AddStyleSheet('extensions/YShout/src/css/yshout.css'); $Head->AddString(' <script type="text/javascript"> $(document).ready(function(){ new YShout({ yPath: \'extensions/YShout/src/\', user: \'' . $Context->Session->User->Name . '\' }); });</script> '); $Panel->AddString("<h2>Chat</h2> <ul><li> <div id='yshout'></div> </li></ul>", 20); } } ?>
i also editted the constructor to put that value into the options struct, and to use it to build the html form (with a hidden text field of course :P). see, told you it was dirty
i WILL get to it soon though.
Can I offer any help?
Sorry to bother you again, but the one I threw together is really gross. It slows the pageload, and frequently won't open at all
Thanks.