views:

125

answers:

0

Hi. Want to use the codeigniters smiley pack .

I am creating the messaging window with this code

in controller I use the code from Documentation

$this->load->helper('smiley');
    $this->load->library('table');

    $image_array = get_clickable_smileys('/files/smileys/', 'fieldMessage');

    $col_array = $this->table->make_columns($image_array, 8);

    $data['smiley_table'] = $this->table->generate($col_array);

And the View is

<?php header('Content-type: text/html; charset=utf-8');?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
<html>
<head>
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>GET USER NAME HERE | Private Messages</title>
<link rel="stylesheet" type="text/css" href="/css/main.min.css" />
<link rel="stylesheet" type="text/css" href="/css/skin.min.css" />
<link rel="stylesheet" type="text/css" href="/css/pm_main.min.css" />
<link rel="stylesheet" type="text/css" href="/css/pm_skin.min.css" />
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />

<script type="text/javascript" src="/js/jquery-1.3.2.min.js"></script>



</head>
<body id="messaging" scroll="no" >

<script type="text/javascript" src="/js/tiny_mce/tiny_mce.js"></script>

<!--  <script type="text/javascript" src="/js/editor_template.js"></script>

<script type="text/javascript" src="/js/editor_plugin.js"></script>-->

<script type="text/javascript">
tinyMCE.init({
    theme : "advanced",
    mode : "exact",
    elements: 'fieldMessage',
    language : 'en',
    plugins : "safari,lengthcounter",
    lengthCounterElementId : 'fm_len',
    lengthCounterMax : '1000',
    submitFormName : 'messageForm',
    object_resizing : false,
    force_p_newlines : true,
    convert_fonts_to_spans : false,
    entities : '160,nbsp',
    verify_html : true,
    valid_elements : 'strong/b[class|style],-em/-i[class|style],-strike[class|style],-u[class|style],-p[id|style|class|align],br,img[src|border|alt=|title|hspace|vspace|width|height|align],-div[id|class|align|style],-span[style|class|align|color],-pre,-font[face|size|style|id|class|color],-li[class|style],-ol[class|style],-ul[class|style]',
    invalid_elements : "a",
    icons : "icons-x",

    // Theme options
    theme_advanced_buttons1 : "fontselect,fontsizeselect,cut,copy,paste",
    theme_advanced_buttons2 : "bold,italic,underline,strikethrough,|,forecolor,backcolor,|,justifyleft,justifycenter,justifyright,|,undo,redo" ,
    theme_advanced_buttons3 : "",
    theme_advanced_buttons4 : "",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "none",
    theme_advanced_resizing : false,
    theme_advanced_fonts : "Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact,chicago;Wingdings=wingdings,zapf dingbats",
    theme_advanced_font_sizes : "1,2,3,4"
});




</script>






<table id="pm_container">
<tr>
<td id="pm_header">
<table id="pmh_data">

<tr>
<td>

<div class="user_brief_box">
<div class="ubb_userpic">

<?=$this->profile_model->user_mail_icon($stacox_id);?>
</div><div class="ubb_data">
<?=$this->profile_model->isOnlineOnlyPic($stacox_id);?><?=$this->profile_model->get_user_link($stacox_id);?><br><br></div>
</div>


</td>
<td id="pmhd_r">
<input id="refresh" name="refresh" type="checkbox" value="1" class="checkbox" OnClick="document.location.href = '1'" /><label for="refresh">Автообновление</label><br />
<!--  <input id="sound" name="sound" type="checkbox" value="1" class="checkbox" OnClick="document.location.href = '/'" /><label for="sound">Звуковой сигнал</label><br />-->
<br />
<div align="right"><a href="">Refresh</a>&nbsp; |&nbsp; <a href="javascript: window.close()">Close</a></div>

</td>
</tr>
</table>
</td>
</tr>
<tr>
<td id="pm_item_info">Some Ad Link Here</td>
</tr>
<tr>
<td id="pm_body">
<iframe width="100%" height="100%" scrolling="yes" frameborder="0" src="/messages/perepiska/<?=$stacox_id?>" name="perepiska"></iframe>
</td>
</tr>

<tr>
<td id="pm_footer">

<form  method="post" action="sadfas"  name="messageForm"><div>
<input id="stacox_id" value="<?=$stacox_id;?>" type="hidden">
<input id="token" value="<?=$token;?>" type="hidden">
</div>
<table style="margin: 1em auto;"><tr>
<td>

<?php echo smiley_js(); ?>
 <textarea id="fieldMessage" onkeyup="Messages.changeTextArea(document.messageForm,event,1000)" cols="35" style="width: 405px;" rows="6" name="message"></textarea></td>

 <?php echo $smiley_table; ?>


 </tr><tr><td><table><tr><td id="fm_len" style="padding: 3px; width: 20px; border: 1px solid #9F9F9F;"></td>
 <td>Characters Left</td></tr></table></td></tr><tr><td id="smiles-area"></td></tr><tr><td><hr>
 </td></tr><tr><td><input value="Send" onclick="javascript:sendMessage();return false;" type="button" name="button_save">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 <input value="Cancel" onclick="top.window.close(); return false;" type="submit" name="button_cancel"></td></tr><tr>
 <td></td></tr></table></form>
 <script>
 function sendMessage(){
     tinyMCE.triggerSave();
var message=$("#fieldMessage").val();
var stacox_id=$('#stacox_id').val();
var token=$('#token').val();
$.ajax({
    type: "POST",
    url: "/messages/send_it/",
    data: "message="+ message +"&stacox_id="+ stacox_id +"&token="+token,

    success: function(data){
    //location.reload(true);
        $("#fieldMessage").val('');
        tinyMCE.getInstanceById('fieldMessage').getBody().innerHTML=' '; 
        window.frames["perepiska"].location.reload();
    }
});

     }

 </script>

</td>
</tr>
</table>
</body>
</html>

and I get on click this error

uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLTextAreaElement.selectionStart]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://madrasti.com/messages/send/870 :: insert_smiley :: line 136" data: no]

Any Idea how to make the click work. While with drag and drop i can put smiles inside the text