1 (edited by 2013-08-30 12:35:07)

Topic: Quick Tags

Ok, after tweaking around in the code, i managed to restore Quicktags link in addnews and editnews in cutenews 1.5.3 and also some other things.

So if you're like me and $matches[1], and want that useful link back, here is the deal.

Replace in
skins/base_skin/addnews/index.tpl, on line 74
and in
skins/base_skin/editnews/editnews/index.tpl, on line 83
this line
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>
<p>[url= onclick=]
[insert image][/url]</p>
</div>

with this
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>
<p>[quick tags]
        [url= onclick=]
[insert image][/url]</p>
</div>

Replace in
skins/base_skin/addnews/index.tpl, on line 89
and in
skins/base_skin/editnews/editnews/index.tpl, on line 110
this line
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>
<p>[url= onclick=]
[insert image][/url]</p>
</div>

with this
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>
<p>[quick tags]
        [url= onclick=]
[insert image][/url]</p>
</div>

Next in skins/base_skin/about/cutecode.tpl, replace on line 16 to 70 the whole javascript with this
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>
<script type="text/javascript">
        <!--
            function insertcode(type,var1,var2) {

            if(var1 != null){
            if(var2 == null){ var2='  '; }

            switch(type) {
            case 'link':
                code = '[url=]' +var2+ '[/url]';
                break;
            case 'image':
                code = '<img src=\"' +var1+ '\" alt=\"\" />';
                break;
            case 'bold':
                code = '<span class=\"bolding\">' +var1+ '</span>';
                break;
            case 'italic':
                code = '<span class=\"italing\">' +var1+ '</span>';
                break;
            case 'underline':
                code = '<span class=\"underlying\">' +var1+ '</span>';
                break;
            case 'color':
                code = '<span style=\"color: ' +var1+ '\">' +var2+ '</span>';
                break;
            case 'size':
                code = '<span style=\"font-size: ' +var1+ 'pt\">' +var2+ '</span>';
                break;
            case 'font':
                code = '<span style=\"font-family: ' +var1+ '\">' +var2+ '</span>';
                break;
            case 'align':
                code = '<div style=\"text-align: ' +var1+ '\">' +var2+ '</div>';
                break;
            case 'quote':
                code = '[qu0te]' +var1+ '[/qu0te]';
                break;
            case 'list':
                code = '
\\n * Text1
\\n * Text2
\\n * Text3
\\n
';
                alert('Sample List will be inserted into the textarea');
                break;
            default:
            }


            code = ' ' + code + ' ';
            opener.document.addnews.{$area}.value  += code;
            if(document.my.ifClose.checked == true){
                opener.document.addnews.{$area}.focus();
                window.close();
                opener.document.addnews.{$area}.focus();
            }
            }
            }
        //-->
        </script>
</div>
On this last one, remember to replace the "0" in qu0te and /qu0te by regular "o". I had to do this because the code interpreter here was messing it.

Done, now it should be back and working.

Also if you want a valid img tag, with a regular /> closing slash, when you insert an image, go in
skins/base_skin/image/quick.up.tpl, replace line 44 with :
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>
finalImage = ' <img '+ appends +' align=\"'+ imageAlign +'\" alt=\"'+ alternativeText +'\" src=\"{$config_http_script_dir}/uploads/'+ selectedImage +'\" />';
</div>

Now finishing with $matches[1].
I think you all see that the captcha bit when you want to insert a comment is appearing under the whole form and that you can't decide where to put it. That's the feeling i have and i don't like it, it is less flexible than the old ones.
To resolve this, here is what i have done.
Open skins/base_skin/captcha_comments.tpl and take the bit you want, like :

If your server don't have GD enable use this code :
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>
<td width="64"> <div>Captcha</div> </td>
        <td>
            <div><iframe src="captcha.php" style="border: 0" scrolling="no" width="200" height="70"></iframe></div>
            <div> <input type="text" name="captcha" value="" /></div>
        </td>
</div>
Remember to verify the adress of the captcha.php file here and modify it to match yours.

If your server have GD enable use this code :
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>
<td width="64">
            <div>Captcha</div>
            <div>Refresh</div>
        </td>
        <td>
            <div> <img id="comments_captcha" src="{$config_http_script_dir}/captcha.php?r={$captha_rand}" alt="" /> </div>
            <div> <input type="text" name="captcha" value="" /></div>
        </td>
</div>
On this last one, remember to replace the {$config_http_script_dir} with your cutnews installation path (e.g. http://www.yoursite.com/cutenews). It won't work otherwise.

After taking the code bit you want to use, put it in your cdata/default.tpl (or the skin you're using) at the place you want in the comment form.

To finish, cancel everything in skins/base_skin/captcha_comments.tpl so that the captcha won't appear twice.

Hope this help some of you.