Version: , by Mutt
Developer Last Online: Mar 2013
Version: Unknown
Rating:
Released: 06-27-2001
Last Update: Never
Installs: 1
No support by the author.
Ok don't give me a bunch of crap if I'm posting this wrong, this is my first little contribution to VB.
In the short time I've been playing around with VB, I've already become annoyed at editing templates. I added two little javascript buttons to the page to make things easier.
Copy - click the button to highlight all the text in the textarea and copy it to the clipboard in one step
Preview - opens a new window displaying the html from the message area. It doesn't replace the variables with any value, but does gives you an idea of layout and color changes
for VB v2.0.1
updated attachment below
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
$ButtonExtra="
<SCRIPT LANGUAGE=\"JavaScript\">
function displayHTML() {
var inf = document.name.template.value;
wintwo = window.open(\", \", 'popup', 'toolbar = no, status = no, scrollbars=yes');
wintwo.document.write(\"\" + inf + \"\");
}
function HighlightAll() {
var tempval=eval(\"document.name.template\")
tempval.focus()
tempval.select()
if (document.all){
therange=tempval.createTextRange()
therange.execCommand(\"Copy\")
window.status=\"Contents highlighted and copied to clipboard!\"
setTimeout(\"window.status=''\",1800)
}
}
var NS4 = (document.layers); // Which browser?
var IE4 = (document.all);
var win = window; // window to search.
var n = 0;
function findInPage(str) {
var txt, i, found;
if (str == '')
return false;
if (NS4) {
if (!win.find(str))
while(win.find(str, false, true))
n++;
else
n++;
if (n == 0)
alert('Not found.');
}
if (IE4) {
txt = win.document.body.createTextRange();
for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
txt.moveStart('character', 1);
txt.moveEnd('textedit');
}
if (found) {
txt.moveStart('character', -1);
txt.findText(str);
txt.select();
txt.scrollIntoView();
n++;
} else {
if (n > 0) {
n = 0;
findInPage(str);
}
else
alert('Not found.');
}
}
return false;
}
</script>
<input name='string' type='text' size=20 onChange='n=0;'>
<input type='button' value='Find' onClick='javascript:findInPage(document.name.string.value)'>
<input type='button' value='Preview' onclick='javascript:displayHTML()'>
<input type='button' value='Copy' onclick='javascript:HighlightAll()'>";
Originally posted by FWC
Here's exactly what I have added:
PHP Code:
$ButtonExtra="
<SCRIPT LANGUAGE=\"JavaScript\">
function displayHTML() {
var inf = document.name.template.value;
wintwo = window.open(\", \", 'popup', 'toolbar = no, status = no, scrollbars=yes');
wintwo.document.write(\"\" + inf + \"\");
}
function HighlightAll() {
var tempval=eval(\"document.name.template\")
tempval.focus()
tempval.select()
if (document.all){
therange=tempval.createTextRange()
therange.execCommand(\"Copy\")
window.status=\"Contents highlighted and copied to clipboard!\"
setTimeout(\"window.status=''\",1800)
}
}
var NS4 = (document.layers); // Which browser?
var IE4 = (document.all);
var win = window; // window to search.
var n = 0;
function findInPage(str) {
var txt, i, found;
if (str == '')
return false;
if (NS4) {
if (!win.find(str))
while(win.find(str, false, true))
n++;
else
n++;
if (n == 0)
alert('Not found.');
}
if (IE4) {
txt = win.document.body.createTextRange();
for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
txt.moveStart('character', 1);
txt.moveEnd('textedit');
}
if (found) {
txt.moveStart('character', -1);
txt.findText(str);
txt.select();
txt.scrollIntoView();
n++;
} else {
if (n > 0) {
n = 0;
findInPage(str);
}
else
alert('Not found.');
}
}
return false;
}
</script>
<input name='string' type='text' size=20 onChange='n=0;'>
<input type='button' value='Find' onClick='javascript:findInPage(document.name.string.value)'>
<input type='button' value='Preview' onclick='javascript:displayHTML()'>
<input type='button' value='Copy' onclick='javascript:HighlightAll()'>";
Then the normal admin/template.php begins again.
Ok, there is the first opening lines of the script...than a person does the other two little mods, and that should be it...
Thanks for your help..it is greatly appreciated. If anything, we helped document this mess for him.
i will go try it out, and if this doesnt work, i am not going to bother with it. lol...had enough of it, as i am sure you have had enough of me asking for help.
again, thanks FWC, and LuBi for your time and concern to my moronic ignorance that has plagued me with this hack.
We're out of my league now. I compared my modified file with my original file. That code was all I added. The first couple lines of the original template.php after the hack are:
PHP Code:
f ($action=="customize") $action="add";
if (isset($action) and $action=="generate") {
$noheader=1;
}
require("./global.php");
adminlog(iif($templateid!=0,"template id = $templateid",iif($templatesetid!=0,"templateset id = $templatesetid","")));
$ButtonExtra="
<SCRIPT LANGUAGE=\"JavaScript\">
function displayHTML() {
var inf = document.name.template.value;
wintwo = window.open(\", \", 'popup', 'toolbar = no, status = no, scrollbars=yes');
wintwo.document.write(\"\" + inf + \"\");
}
function HighlightAll() {
var tempval=eval(\"document.name.template\")
tempval.focus()
tempval.select()
if (document.all){
therange=tempval.createTextRange()
therange.execCommand(\"Copy\")
window.status=\"Contents highlighted and copied to clipboard!\"
setTimeout(\"window.status=''\",1800)
}
}
var NS4 = (document.layers); // Which browser?
var IE4 = (document.all);
var win = window; // window to search.
var n = 0;
function findInPage(str) {
var txt, i, found;
if (str == '')
return false;
if (NS4) {
if (!win.find(str))
while(win.find(str, false, true))
n++;
else
n++;
if (n == 0)
alert('Not found.');
}
if (IE4) {
txt = win.document.body.createTextRange();
for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
txt.moveStart('character', 1);
txt.moveEnd('textedit');
}
if (found) {
txt.moveStart('character', -1);
txt.findText(str);
txt.select();
txt.scrollIntoView();
n++;
} else {
if (n > 0) {
n = 0;
findInPage(str);
}
else
alert('Not found.');
}
}
return false;
}
</script>
<input name='string' type='text' size=20 onChange='n=0;'>
<input type='button' value='Find' onClick='java script:findInPage(document.name.string.value)'>
<input type='button' value='Preview' onclick='java script:displayHTML()'>
<input type='button' value='Copy' onclick='java script:HighlightAll()'>";
Find //////// start search///////////
and the line within that that reads:
Originally posted by FWC We're out of my league now. I compared my modified file with my original file. That code was all I added. The first couple lines of the original template.php after the hack are:
PHP Code:
f ($action=="customize") $action="add";
if (isset($action) and $action=="generate") {
$noheader=1;
}
require("./global.php");
adminlog(iif($templateid!=0,"template id = $templateid",iif($templatesetid!=0,"templateset id = $templatesetid","")));
ok, that explains a huge void here. You only added that chunk of code. I have two extra things that were supposed to be entered......this is my biggest bitch and complaint on some of these hacks...piss poor documentation.
I will give that a whirl FW, and if that doesnt do it, fuc* it..it gets ripped out.