News:

Get the latest news and updates on SimpleDesk!

Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - cristianlf

#16
SimpleDesk Support / Attachment Validation ?_?
January 19, 2011, 04:17:23 PM
Hello every1 

I was trying to validate that the attachment files were .zip, .rar, etc so I change the default and add the files I want,

then I try it, but do not work :S  some advise where to look ???

Regards.
#17
SimpleDesk Support / Re: Insert user fields
January 19, 2011, 02:58:01 PM
thanks for your answer,

Well I think that way, but my boss want to limit to 250 because is a way to make users write the main problem withouth unimportant details,
Besides I disable bbc and html editing I need just plain text ... 

if you can help me with the javascript part to be more eficient pleaaase do,

thanks :)

I will try to do it without calling a php file ... do not how but i will :)

Regards,
#18
SimpleDesk Support / Re: Insert user fields
January 19, 2011, 12:21:17 PM
Well my Friends, I want to share that I did it :)
but I have a Question about  this  function:  "storeCaret(this);"

I don't know what is the purpose of that function so I just erase it ;)

My javascript knowledge is not that good, so Im going to explain what i did maybe some one could help me to improve it :)

First:
@GenericControls.template.php
   @template_control_richedit

before <textarea class ...
add this
<label id="Caracteres">250 caracteres restantes</label><br/>

In texarea tag
change onkeyup="storeCaret(this);"
for this:  onkeyup="showCar(this.value)"

then add maxlength="250"   //the number of characters you want ...

then I review the textarea id to insert it to my javascript ....
/***************JAVASCRIPT***********************/
var xmlHttp

function showCar(str)
{
   alert (str);
   xmlHttp=GetXmlHttpObject()
   if (xmlHttp==null)
   {
      alert ("Browser does not support HTTP Request")
      return
   }
   var textarea =document.getElementById('shd_message')
   var largomaximo =textarea.getAttribute('maxlength')
   
   var url= "http://mysite/Sources/count.php" //"count.php"
   url=url+"?q="+str+"&lm="+largomaximo
   xmlHttp.onreadystatechange=stateChangedChar
   xmlHttp.open("GET",url,true)
   xmlHttp.send(null)
//   alert (str.length+1)
}

function stateChangedChar()
{
   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
   {
      var label = document.getElementById('Caracteres')
      label.innerHTML =xmlHttp.responseText
   }
}

function GetXmlHttpObject()
{
   var xmlHttp=null;
   try
   {
      // Firefox, Opera 8.0+, Safari
      xmlHttp=new XMLHttpRequest();
   }
   catch (e)
   {
      //Internet Explorer
      try
        {
           xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
      catch (e)
        {
           xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
   }
   return xmlHttp;
}
/***************JAVASCRIPT***********************/

As you see I use count.php  but this is the part  i want to remove but i do not know how ?_? 

this is count.php

/**********count.php*******************/
<?
   $q=$_REQUEST['q'];
   $lm=$_REQUEST['lm'];
   $resta =$lm-strlen($q);
   if ($resta>1)
      $leyenda =" caracteres restantes";
   elseif ($resta==1)
      $leyenda=" caracter restante";
   else
      $leyenda =" caracteres restantes";
   
   echo $resta.$leyenda;
?>

well If there are somethig you can recomend to me please do,

Regards

#19
SimpleDesk Support / Re: Insert user fields
January 18, 2011, 08:50:31 PM
Quote from: Gruffen on January 18, 2011, 05:44:58 PM
Well, the validation is going to be needed in shd_save_ticket (which is when the error handling is done) - look for the array building of $context['shd_errors']. Add to that, then it'll trigger being redisplayed to the user. Make sure to repopulate $context['ticket_form'] though so it's put back into the template.

Thanks for the answer,  I did before you answer but I apreciate your help,  i do something like this:
@SimpleDesk-Post.php
   @shd_save_ticket


if (!isset($_POST['myvariable']) || $smcFunc['htmltrim']($smcFunc['htmlspecialchars']($_POST['myvariable'])) === ''
   ||$_POST['producto']=="..." )  // this is because my variables ...
   {
      $context['shd_errors'][] = 'no_myvariable';   // this is the name of the error
      $_POST['myvariable'] = '';
   }

then

@Error.english.php
$txt['no_myvariable']     = 'My Error Message ...';//'';


and then everithing works like a charm :) 


Wel Im traying to write all I done because maybe later I will need it again or  maybe help to someone else.

by the way Im trying to add some function to the text area, I need to limit to a #  and nee to display how characters are remaining,  Im stuck with the display  the remaining chars ... if someone could help  pleaase  !!!


Regards,
#20
SimpleDesk Support / Re: Insert user fields
January 18, 2011, 10:24:17 AM
No worries ...

I was trying to add 5  <selects>  that are dependant ... so I had to insert an js file in the header a then change the functions that I explained before,

well I just need to add now a validation because the fields are not optional,  and I still working on that ... if you have some sugestions please tell me about it :)

Regards
#21
SimpleDesk Support / Re: Insert user fields
January 17, 2011, 01:33:36 AM
Hello guys!!

Well I reaaly try to use shd_ functions to insert the data but ... 

I finaly do this .:

@ SimpleDesk-Post.php
     @shd_save_ticket()
                                        $context['Name_group_own_variables'] = array(
                                          'Variable 1' =>  $_POST['variable1'],
                                          'Variable 2' =>  $_POST['variable2']
                                          );

then
@ Subs-SimpleDeskPost.php
       @ shd_create_ticket_post
                          After if (empty($ticketOptions['id'])) {...}   I add te code:
                           else {
                                     $update ="update ....  ".
                                     "where id_ticket =".$ticketOptions['id'];
                           }
             

I know this is not the best way to do that  if you help me to get it better i'll apreciate it ,  I still need to display the values when someone see the ticket ... 

Well this was dificult to me, thanks every1 that helps me  someway ...

Regards
#22
SimpleDesk Support / Re: Insert user fields
January 16, 2011, 11:25:31 PM
well i need to add 5 fields, that will be related and the user need to select, besides the  options will be store in the DB ... 

#23
SimpleDesk Support / Re: Insert user fields
January 16, 2011, 03:07:17 PM
Thanks for the help, 

I need to add my variables in here

   $context['ticket_form'] = array( // yes, everything goes in here.
      'form_title' => $new_ticket ? $txt['shd_create_ticket'] : $txt['shd_edit_ticket'],
      'form_action' => $scripturl . '?action=helpdesk;sa=saveticket',
      'first_msg' => $new_ticket ? 0 : $ticketinfo['id_first_msg'],
      'message' => $new_ticket ? '' : $ticketinfo['body'],
      'subject' => $new_ticket ? '' : $ticketinfo['subject'],
      'ticket' => $new_ticket ? 0 : $context['ticket_id'],
      'link' => $new_ticket ? 0 : '<a href="' . $scripturl . '?action=helpdesk;sa=ticket;ticket=' . $context['ticket_id'] . '">' . $ticketinfo['subject'] . '</a>',
      'msg' => $new_ticket ? 0 : $ticketinfo['id_first_msg'],
      'display_id' => $new_ticket ? '' : str_pad($context['ticket_id'], 5, '0', STR_PAD_LEFT),
      'status' => $new_ticket ? TICKET_STATUS_NEW : $ticketinfo['status'],
      'urgency' => array(
         'setting' => $new_ticket ? TICKET_URGENCY_LOW : $ticketinfo['urgency'],
      ),
      'private' => array(
         'setting' => $new_ticket ? false : ($ticketinfo['private'] == 1),
         'can_change' => shd_allowed_to('shd_alter_privacy_any') || (shd_allowed_to('shd_alter_privacy_own') && ($new_ticket || !empty($ticketinfo['is_own']))),
         'options' => array(
            0 => 'shd_ticket_notprivate',
            1 => 'shd_ticket_private',
         ),
      ),
      'errors' => array(),
      'num_replies' => $new_ticket ? 0 : $ticketinfo['num_replies'],
      'do_attach' => shd_allowed_to('shd_post_attachment'),
      'num_allowed_attachments' => empty($modSettings['attachmentNumPerPostLimit']) || $modSettings['shd_attachments_mode'] == 'ticket' ? -1 : $modSettings['attachmentNumPerPostLimit'],
      'return_to_ticket' => isset($_REQUEST['goback']),
      'disable_smileys' => $new_ticket ? !empty($_REQUEST['no_smileys']) : ($ticketinfo['smileys_enabled'] == 0),
   );


is correct?

but then I need to add and something to  ->  $ticketinfo
$newticket ? 0 : $ticket['myvariables']   

then I was seeing the $smcFunc['db_query']($identifier, $db_string, $db_values, $connection) but i dont get it quite well.

I was tryng (just as a debugging) to get the variables i made with $_REQUEST['myvariables'] bt I cant write the result using javacript alert  ....   

I ll keep trying doing the way you are sugesting, please if you could give me some more guidline .... 

Regards
#24
SimpleDesk Support / Re: Insert user fields
January 15, 2011, 10:54:21 AM
Quote from: cσσкιє мσηѕтєя on January 15, 2011, 10:50:53 AM
The files you'll need to look in are:

SimpleDesk-Post.php
Subs-SimpleDesk-Post.php
SimpleDesk-Display.php
SimpleDesk-Display.template.php
SimpleDesk-Post.template.php

Thanks :)  i will let you know
#25
SimpleDesk Support / Re: Insert user fields
January 15, 2011, 10:46:30 AM
Thaks but the answers,

i will see Sources\SimpleDesk-Post.php

i will comment in a short time ...

regards,

#26
SimpleDesk Support / Insert user fields
January 14, 2011, 09:49:47 PM
Hello friends,
I have a trouble in the office, my boss wants to add some fields to the ticket form and I added (at display level) but when I try to post the ticket i dont know how to add my fields into the insert function ??

I  mean I already add fields and tables to the Database, and just need to add some fields to the insert of new Tickets
well if you can help me pleaaase, this has to be done to monday :S

by the way i want to ask where is $context[] defined ??

regards
#27
SimpleDesk Support / Re: Language
January 13, 2011, 06:27:05 PM
Thanks :)
#28
SimpleDesk Support / Re: Language
January 12, 2011, 09:19:16 PM
Ok that  wierd ,  I justr try 3 different Themes
and works fine in every case but the one i want ...

the theme is Dino Light V.2

Sorry for the mistake,
#29
SimpleDesk Support / Re: Language
January 12, 2011, 09:09:07 PM
Thanks for your answer. 
I will try to clarify:

I edit the file :  SimpleDesk.english.php

I traslate from english to spanish ... 


Then i uplaoded the file ....   then any text change at all  (wierd i think)

then I decide to erase all the files from themes/default/language  (I supposed that no text should appear)
surprise my site exactly the same without language pack ???


so Im a bit confused because i need to change from english to spanish ....

Regards
#30
SimpleDesk Support / Language
January 12, 2011, 08:46:08 PM
I was writing in spanish the message but when I upload the files nothing happen, I even deleted all "english" files from default/language  and nothing happened...


some idea or advise?