Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: smilies in popup box  (Read 5246 times)

0 Members and 1 Guest are viewing this topic.

Justttt

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 170
    • Trippy-ILLusion.Co.Uk
smilies in popup box
« on: June 24, 2006, 02:31:00 pm »

if you would like your smiles to show in popup box

simply edit you (include/smilies.inc.php)



find
Code: [Select]
$html .= '                <td width="5%"><img src="images/smiles/' . $smiley[1] . '" alt="' . $caption . '" width="15" height="15" border="0" style="cursor:pointer;" title="' . $caption . '" onclick="javascript:emoticon_' . $form . '(\'' . $smiley[0] . '\')" /></td>' . "\n";

replace with
Code: [Select]
$html = '<table width="100%" border="0" cellspacing="0" cellpadding="0">' . "\n" . '        <tr align="center" valign="middle">' . "\n";
    $html .= '<td align=center><a href="javascript:smilieswin()">Add Smilies</a></td>     
   
    </tr>' . "\n" . '</table>' . "\n";
    $html .= <<<EOT
<script language="JavaScript" type="text/javascript">
<!--
function smilieswin()
{
window.open('display_smilies.php', 'BoxSmilies', 'width=370,height=400,toolbar=0,location=0,menubar=0,directories=0,scrollbars=1');
}

//-->
EOT;
    $html .= "</script>\n";
    return $html;


and then create a new page called display_smilies.php (stramms Work)
and insert
Code: [Select]
$html = '<table width="100%" border="0" cellspacing="0" cellpadding="0">' . "\n" . '        <tr align="center" valign="middle">' . "\n";
    $html .= '<td align=center><a href="javascript:smilieswin()"><iframe name="iwindow" style="border:1px dotted orange" scrolling=auto width=600 height=150 align=top frameborder=0 src="smiles.php"></iframe></a></td>     
   
    </tr>' . "\n" . '</table>' . "\n";
    $html .= <<<EOT
<script language="JavaScript" type="text/javascript">
<!--
function smilieswin()
{
window.open('display_smilies.php', 'BoxSmilies', 'width=370,height=400,toolbar=0,location=0,menubar=0,directories=0,scrollbars=1');
}

//-->
EOT;
    $html .= "</script>\n";
    return $html;
}


also add to your themes css (stramms work)
Code: [Select]
.pms_linecolor3
{
background-color: #EFEFEF;
font-size: 10px;
}
.pms_linecolor4
{
background-color: #D1D7DC;
font-size: 10px;
}

:)
« Last Edit: June 26, 2006, 11:21:51 am by Justttt »
Logged
J U S T T T T

xplicit

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 214
Re: smilies in popup box
« Reply #1 on: July 19, 2006, 02:17:57 am »

Since there is no link to a gallery I wanted to ask one question:

Does this one work correct when editing existing comments?

Or does the smiley appear in the new comment box instead of the comment you want to edit?

Can somebody confirm correct behaviour?
Logged
Don't ask me: Can you do this .... or Give me that...or I need Quick help in PM's. I'm not Santaclaus so post your questions on the board so it will be in the benefit for everyone.

owein

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: smilies in popup box
« Reply #2 on: July 20, 2006, 07:18:25 am »

just tested it out...the smiley shows up in the new comment box.
Logged

xplicit

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 214
Re: smilies in popup box
« Reply #3 on: July 20, 2006, 09:15:44 am »

Yeah that is the kind of behaviour I expected.  :(

I have seen this behaviour before and have even checked the code to see if I could think of a soulution for this but unfortunately javascript is not one of my best skills...  :'( and haven't figured it out yet how to solve this.

The only thing I now can think of is just make it an inactive popup without interaction so the people have to enter the code themself.  And use the popup as a reminder for the smiley codes since the code is displayed next to it. I tend to favour the last for the time being

 




Logged
Don't ask me: Can you do this .... or Give me that...or I need Quick help in PM's. I'm not Santaclaus so post your questions on the board so it will be in the benefit for everyone.

Justttt

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 170
    • Trippy-ILLusion.Co.Uk
Re: smilies in popup box
« Reply #4 on: July 23, 2006, 01:02:48 pm »

hmm i dont under stand is somthing not going right ? ...

www.trippy-illusion.co.uk/album

user test
pass test123


and if you goto a image you will notice i have some smilies showing and a link saying click here for more smiles.. and all works fine so i dont understand your problem ?..

, justttt
« Last Edit: July 23, 2006, 01:08:43 pm by Justttt »
Logged
J U S T T T T

xplicit

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 214
Re: smilies in popup box
« Reply #5 on: July 23, 2006, 02:29:20 pm »

and if you goto a image you will notice i have some smilies showing and a link saying click here for more smiles.. and all works fine so i dont understand your problem ?..
, justttt

No it does not work fine. Try this page with the password and username you gave:

http://www.trippy-illusion.co.uk/album/displayimage.php?pos=-375

try to edit the comment and try to add a big smily from the popup. The code of the smiley will NOT appear in the box you want to edit but in the box of new comment
Logged
Don't ask me: Can you do this .... or Give me that...or I need Quick help in PM's. I'm not Santaclaus so post your questions on the board so it will be in the benefit for everyone.

Justttt

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 170
    • Trippy-ILLusion.Co.Uk
Re: smilies in popup box
« Reply #6 on: July 23, 2006, 02:32:48 pm »

hmmm i never noticed that before , sorry . ok i will check on this see what i can do (Y)
Logged
J U S T T T T

xplicit

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 214
Re: smilies in popup box
« Reply #7 on: September 12, 2006, 02:37:32 am »

Well its been a long time but I finaly got time to look at the code :)

Since my knowledge of javascript was close to 0, it took a while and a lot of reading and learning javascript but I now know the basic javascript things so I analysed the problem and found a fix for it :)

The code can also fix the original post http://forum.coppermine-gallery.net/index.php?topic=21863.0

Here is the "problem" and explanation how to fix it :

WARNING ONLY FOR EXPERIENCED USERS
the warning is mainly because I will describe how to fix it instead of posting the complete pages here since my pages are completely different and experienced users will understand what I mean by the following parts. (see it as a guideline)

The problem was that :

* Popup clickable (and replace code transfering) smileys only worked for the new entry
* Editing existing comments would add the replace codes in the new entry instead of in the edit screen

Here is the solution and explanation

The popup screen was called by the function:

Code: [Select]
function smilieswin()
{
window.open('display_smilies.php', 'BoxSmilies', 'width=370,height=400,toolbar=0,location=0,menubar=0,directories=0,scrollbars=1');
}

this seems correct but there is a slight information thing missing in this call namely the name of the form for which the code is intended. The original function used for this

Code: [Select]
onclick="javascript:emoticon_' . $form . '(\'' . $smiley[0] . '\')"
and as you can see the $form was used in the original but disappeared in the new code. In the file display_smilies.php the name of the form was hardcode as "post" in the function:

Code: [Select]
function smilie(smilietext) {
opener.document.post.msg_body.value += " "+smilietext+" ";
}

(Extra information about this function : post = the name of the form you want to use, msg_body is the fieldname in the form you want to use )

As you seein this part the form name will always be post (which is the form name of the new entry) but when you edit comments this form name will never be called "post" but will have the name of the comment id : f{MSG_ID}

So what we need to do is to get the $form back in the function call and pass it on to the pop up screen

I used for that the following function in smilies.inc.php:

Code: [Select]
function smilieswin(from_msg)
{

var url = "display_smilies.php?message="+from_msg
window.open(url, 'BoxSmilies', 'left=0,top=0,width=300,height=800,toolbar=0,location=0,menubar=0,directories=0,scrollbars=1');
}

and renamed the generate smilies function into :

Code: [Select]
function generate_smilies($form, $field = 'message')
and used

Code: [Select]
<a href="javascript:smilieswin(\'' . $form . '\')">instead of
Code: [Select]
><a href="javascript:smilieswin()">
to call the smilieswin function. The value of message will now be used and can be determined in the file display_smilies.php with the function

Code: [Select]
$message_id = $HTTP_GET_VARS['message'];

to pass it back to the main page edit the smilie function in this file with the following:

Code: [Select]
function smilie(smilietext,$message_id) {
opener.document.$message_id.msg_body.value += " "+smilietext+" ";

}

To get it fullly working you need to add another extra line of code in your smilies.inc.php file just at the start of the function generate_smilies, this will replace the blank values of $form and replace it with post for using at new comment entries

Code: [Select]
if ($form == "") { $form = "post"; }
Thats it!
« Last Edit: September 12, 2006, 02:42:54 am by xplicit »
Logged
Don't ask me: Can you do this .... or Give me that...or I need Quick help in PM's. I'm not Santaclaus so post your questions on the board so it will be in the benefit for everyone.

xplicit

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 214
Re: smilies in popup box
« Reply #8 on: September 14, 2006, 01:52:33 am »

as an extra feature you can also add this the the ecards,

(if you leave the code as I sugested it will otherwise also say argument missing)

So add the same technique to your ecard.

But remember to change the form field for your ecard text into "msg_body" instead of "message"

Find
Code: [Select]
  <textarea name="message" class="textinput"change into
Code: [Select]
  <textarea name="msg_body" class="textinput"
also remember to change the part were the data is proceeded
find:
Code: [Select]
$message = get_post_var('message');change into:
Code: [Select]
$message = get_post_var('msg_body');
greetz! and happy coding!

Logged
Don't ask me: Can you do this .... or Give me that...or I need Quick help in PM's. I'm not Santaclaus so post your questions on the board so it will be in the benefit for everyone.

MasterOD

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: smilies in popup box
« Reply #9 on: July 17, 2007, 08:19:10 am »

so is there now a solution for the popup window problem which works with the newest (1.4.12) Version?

Or does the solution, described by xplicit still work?
Anyone got any experience with that?

greetings

MasterOD
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: smilies in popup box
« Reply #10 on: July 17, 2007, 09:03:07 am »

Why don't you try it and report back? We could hardly go through all modification suggestions in thousands of postings once a new version gets released, trying to figure out if the modification suggested by users works with the new release. Usually, modifications designed for cpg1.4.X work for cpg1.4.Y as well.
Logged

MasterOD

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: smilies in popup box
« Reply #11 on: July 17, 2007, 02:03:24 pm »

Yeah Sry... but this thread is that complicated... whatever I tried this outdated thread

http://forum.coppermine-gallery.net/index.php?topic=21863

which i used some time ago...

and it still works...
Logged
Pages: [1]   Go Up
 

Page created in 0.073 seconds with 19 queries.