SimpleDesk

SimpleDesk! => SimpleDesk Support => Topic started by: cristianlf on January 19, 2011, 04:17:23 PM

Title: Attachment Validation ?_?
Post by: cristianlf on 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.
Title: Re: Attachment Validation ?_?
Post by: cristianlf on January 20, 2011, 12:47:15 PM
Hello the this is the fucntion that is not working properly: 

<script type="text/javascript"><!-- // --><![CDATA[
   var oAttach = new shd_attach_select({
      file_item: "shd_attach",
      file_container: "shd_attachlist_container",
      max: ', $context['ticket_form']['num_allowed_attachments'], ',
      message_txt_delete: ', JavaScriptEscape($txt['remove']);
      
      if (!empty($modSettings['attachmentExtensions']) && !empty($modSettings['attachmentCheckExtensions']))
      {
         $ext = explode(',', $modSettings['attachmentExtensions']);
         foreach ($ext as $k => $v)
            $ext[$k] = JavaScriptEscape($v);

         echo ',
      message_ext_error: ', JavaScriptEscape(str_replace('{attach_exts}', $context['allowed_extensions'], $txt['shd_cannot_attach_ext'])), ',
      attachment_ext: [', implode(',', $ext), ']';
      }


      echo '
   });
                  // ]]></script>';
   }


well I would try to fix it, then  I comment,  if someone know how to solve this problem be my guest and post it ...
Title: Re: Attachment Validation ?_?
Post by: cristianlf on January 20, 2011, 02:03:53 PM
Ok there is a lot of thing to do here -_- 
I had  to change  the helpdesk.js  to validate the extension i want,
but there is an error in this funtion  ...
var func = Array.prototype.indexOf ?
      function(arr, obj) { return arr.indexOf(obj) !== -1; } :
      function(arr, obj) {
         for(var i = -1, j = arr.length; ++i < j;)
            if(arr === obj) return true;
         return false;
    };

well I will keep trying ...
Title: Re: Attachment Validation ?_?
Post by: Gruffen on January 20, 2011, 02:14:40 PM
What exactly are you trying to do with the function?

If you want to limit the files to being given extensions, set that in the admin panel under Attachments and Avatars.
Title: Re: Attachment Validation ?_?
Post by: cristianlf on January 20, 2011, 02:24:44 PM
Quote from: Gruffen on January 20, 2011, 02:14:40 PM
What exactly are you trying to do with the function?

If you want to limit the files to being given extensions, set that in the admin panel under Attachments and Avatars.

well thats the problem I already try this, but nothing happended .... so I have to see the code and  I found this ... so dunno why this is happening ...

regards,
Title: Re: Attachment Validation ?_?
Post by: Gruffen on January 21, 2011, 06:48:51 AM
It works just fine for me (except in IE where it doesn't clear the file input selector on wrong extension)
Title: Re: Attachment Validation ?_?
Post by: cristianlf on January 21, 2011, 01:37:19 PM
mm ok I think I forgot to check somethig at the page of attachments ...

my  mistake ...   


thanks.