Signature Limit Mod - Postet den (4243 Views)
New Member
Sonic
Innlegg: 82
82
idea from --> http://forum.snitz.com/forum/topic.asp?TOPIC_ID=55547

in this mod you can edit the maximal height from the signature anything that is higher will be hidden

__________________________________________________

to install:

go to admin pannel and add this to the database:

Code:
[INSERT]
CONFIG_NEW
(C_VARIABLE, C_VALUE)#('STRSIGMAXHEIGHT', 65)
[END]

open the config.asp and ad this:
search --> Dim strSignatures, strDSignatures,
replase --> Dim strSignatures, strDSignatures, strSIGMaxHeight, search --> strDSignatures = Application(strCookieURL & "STRDSIGNATURES")
add below --> strSIGMaxHeight = Application(strCookieURL & "STRSIGMAXHEIGHT")
open admin_config_features.asp and ad:
(you may modificate it because i speak german!)
ad after --> Err_Msg = ""

if Request.Form("strSIGMaxHeight") = "" then
Err_Msg = Err_Msg & "max. Signaturhöhe fehlt<br>"
elseif IsNumeric(Request.Form("strSIGMaxHeight")) = False then
Err_Msg = Err_Msg & "max. Signaturhöhe muß eine Nummer sein<br>"
elseif cLng(Request.Form("strSIGMaxHeight")) = 0 then
Err_Msg = Err_Msg & "max. Signaturhöhe darf <FONT class=font4>nicht 0</FONT> sein<br>"
end if

add after the allow signature option (in the middle of the page):
(You may modificate it because i have a other design of the page!)
<TR>
<TD><FONT class="font1">Max. Signaturen Höhe:</FONT></TD>
<TD colspan=2><FONT class="font0"><input type="text" name="strSIGMaxHeight" size="3" maxLength="3" value="<% = chkExistElse(strSIGMaxHeight,65) %>"> Pixel</FONT></TD>
</TR>

and at last open topic.asp:
search --> <font color=""" & strForumFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & formatStr(Reply_MemberSig) & "</span></font></td>" & vbNewLine & _

replace --> <font color=""" & strForumFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><div style=""max-height: " & strSIGMaxHeight & "px; height: expression( this.scrollHeight > " & strSIGMaxHeight & "? '" & strSIGMaxHeight & "px' : 'auto' ); overflow:hidden;""><span class=""spnMessageText"">" & formatStr(Reply_MemberSig) & "</span></div></font></td>" & vbNewLine & _

search --> <font color=""" & strForumFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><span class=""spnMessageText"">" & formatStr(Topic_MemberSig) & "</span></div></font></td>" & vbNewLine & _

replace --> <font color=""" & strForumFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><div style=""max-height: " & strSIGMaxHeight & "px; height: expression( this.scrollHeight > " & strSIGMaxHeight & "? '" & strSIGMaxHeight & "px' : 'auto' ); overflow:hidden;""><span class=""spnMessageText"">" & formatStr(Topic_MemberSig) & "</span></div></font></td>" & vbNewLine & _

this code work with netscape, mozilla, and with IE :-)
it is a little script... and can be modificated too...<
ich finds genial... bei uns ist es ratzekuz dunkel und bei dene alle heller nachmittag smile
   
 Sidestørrelse 
Postet den
New Member
Sonic
Innlegg: 82
82
update:
this script count the chars in the signatur and limit the textbox
amount of chars can be edit in the admin features page


--> save this script as: count_chars.js
Code:
var ns6=document.getElementById&&!document.all

function restrictinput(maxlength,e,placeholder){
if (window.event&&event.srcElement.value.length>=maxlength)
return false
else if (e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength){
var pressedkey=/[a-zA-Z0-9\.\,\/]/ //detect alphanumeric keys
if (pressedkey.test(String.fromCharCode(e.which)))
e.stopPropagation()
}
}

function countlimit(maxlength,e,placeholder){
var theform=eval(placeholder)
var lengthleft=maxlength-theform.value.length
var placeholderobj=document.all? document.all[placeholder] : document.getElementById(placeholder)
if (window.event||e.target&&e.target==eval(placeholder)){
if (lengthleft<0)
theform.value=theform.value.substring(0,maxlength)
placeholderobj.innerHTML=lengthleft
}
}

function displaylimit(theform,thelimit){
var limit_text='<b><span id="'+theform.toString()+'">'+thelimit+'</span></b> Zeichen übrig'
if (document.all||ns6)
document.write(limit_text)
if (document.all){
eval(theform).onkeypress=function(){ return restrictinput(thelimit,event,theform)}
eval(theform).onkeyup=function(){ countlimit(thelimit,event,theform)}
}
else if (ns6){
document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true);
document.body.addEventListener('keyup', function(event) { countlimit(thelimit,event,theform) }, true);
}
}

open --> inc_profile.asp add line 1 --> <SCRIPT language=JavaScript src="count_chars.js" type=text/javascript></SCRIPT>
search --> <textarea name=""Sig"" cols=""25"" rows=""4"">" & Trim(cleancode(strTxtSig)) & "</textarea></td>" & vbNewLine & _

replace --> <textarea name=""Sig"" cols=""25"" rows=""4"">" & Trim(cleancode(strTxtSig)) & "</textarea><br><script>displaylimit(""document.Form1.Sig""," & strSIGMaxChars & ")</script></td>" & vbNewLine & _

open admin_config_features.asp
add error messages: (near top)
if Request.Form("strSIGMaxChars") = "" then
Err_Msg = Err_Msg & "max. Zeichenanzahl für die Signatur fehlt<br>"
elseif IsNumeric(Request.Form("strSIGMaxHeight")) = False then
Err_Msg = Err_Msg & "max. Zeichenanzahl für die Signatur muß eine Nummer sein<br>"
elseif cLng(Request.Form("strSIGMaxHeight")) = 0 then
Err_Msg = Err_Msg & "max. Zeichenanzahl für die Signatur darf <FONT class=font4>nicht 0</FONT> sein<br>"
end if

add line to enter the max chars :
<input type="text" name="strSIGMaxChars" size="3" maxLength="3" value="<% = chkExistElse(strSIGMaxChars,200) %>"> Zeichen

and at last open the config.asp add this (red) --> Dim strSignatures, strDSignatures, strSIGMaxHeight, strSIGMaxChars,
and near top this -->
strSIGMaxChars = Application(strCookieURL & "STRSIGMAXCHARS")
oh of corse edit the database:

Code:
[INSERT]
CONFIG_NEW
(C_VARIABLE, C_VALUE)#('STRSIGMAXCHARS', 200)
[END]
<
ich finds genial... bei uns ist es ratzekuz dunkel und bei dene alle heller nachmittag smile
Postet den
Medlem er låst
laser
Innlegg: 3859
3859
Can I ask for a few translations ?
max. Signaturhöhe muß eine Nummer sein --> max. signature height must be a number

max. Signaturhöhe darf nicht 0 sein --> max. signature height may not be 0

Max. Signaturen Höhe --> Max. signatures height


OK, I'll add it soon and check it out smile<
Postet den
Retired Support Moderator
MarcelG
Innlegg: 2625
2625
Originally posted by laser
Can I ask for a few translations ?
max. Signaturhöhe muß eine Nummer sein --> max. signature height must be a number

max. Signaturhöhe darf nicht 0 sein --> max. signature height may not be 0

Max. Signaturen Höhe --> Max. signatures height


OK, I'll add it soon and check it out smile
Correctly translated!
And sonic ; great mod!!!! This calls for basecode (at least the max sig height mod ; i'm not sure with the max characters mod) bigsmile<
Postet den
Junior Member
rasure
Innlegg: 289
289
Been trying to install this to test it and up till now this... value="<% = chkExistElse(strSIGMaxHeight,65) %>">

needs to be
value=""" & chkExistElse(strSIGMaxHeight,65) & """>
and I'm assuming the same will apply to this... value="<% = chkExistElse(strSIGMaxChars,200) %>"><
Postet den
New Member
Sonic
Innlegg: 82
82
- i convert the whole code to normal html and asp code
- because i won't use the response.write code
--> i often forget any --> " " in the code so i decided to write all code normal.... if you use the current version you may delete my --> <% %> tags and replace them with " "
---------------------------------

2 updates are following:

ad the code in --> pop_previev.asp for the signature line too

Code:
<div style=""max-height: " & strSIGMaxHeight & "px; height: expression( this.scrollHeight > " & strSIGMaxHeight & "? '" & strSIGMaxHeight & "px' : 'auto' ); overflow:hidden;""><span class=""spnMessageText"">" & formatStr(Topic_MemberSig) & "</span></div>

and the last update is following these days: to prevent somebody to "hack" the client side code (html code viewed by user)
where somebody can change the limit of the chars and store more chars at his profile... (this will working on firefox or netscape, with a certain plugin)

----------------------------------------------

the traslation is correct
don't forget to change in the count_chars.js the text
--> span id="'+theform.toString()+'">'+thelimit+'</span></b> Zeichen übrig'
to --> span id="'+theform.toString()+'">'+thelimit+'</span></b> chars left'<
ich finds genial... bei uns ist es ratzekuz dunkel und bei dene alle heller nachmittag smile
Postet den
New Member
Sonic
Innlegg: 82
82
2nd update finished:

open --> pop_profile.asp
search 2 times--> if not IsValidURL(trim(Request.Form("Photo_URL"))) then
Err_Msg = Err_Msg & "<li>Photo URL: Invalid URL" & strURLError & "</li>"
end if
(ca. on line 1322 and 1640)

ad after 2 times-->
if strSignatures = "1" and Len(Request.Form("Sig")) > strSIGMaxChars then
Err_Msg = Err_Msg & "<li>Your Signature is too long</li>"
end if

finish smile
these days i make a complete mod in a zip file with doku<
ich finds genial... bei uns ist es ratzekuz dunkel und bei dene alle heller nachmittag smile
Postet den
Medlem er låst
laser
Innlegg: 3859
3859
Well, I have installed it and it's working fairly well (renders the same in IE & FF as mentioned smile), but it still takes up the strSIGMaxHeight for everyone with a sig.

Oh well, small price to pay really smile<
Postet den
Retired Support Moderator
MarcelG
Innlegg: 2625
2625
Originally posted by laser
... but it still takes up the strSIGMaxHeight for everyone with a sig.
Oh well, small price to pay really smile
Is that so ??? That shouldn't be the case. I've got it running too at oxle, and as you can see here it doesn't take up the maxheight of 110 pixels for every sig.<
Postet den
Medlem er låst
laser
Innlegg: 3859
3859
hmmmm ... ok, I'll review the code.<
Postet den
Medlem er låst
laser
Innlegg: 3859
3859
Must have been an optical illusion, or I was looking at the wrong sig's tongue<
Du må legge inn en melding