diff --git a/assets/default/css/theme.css b/assets/default/css/theme.css index 88c4898a80b62ae5be6ede550948a3e217fd3a8a..b59f6af8955857d2008dff647e8e4d83d4924e72 100644 --- a/assets/default/css/theme.css +++ b/assets/default/css/theme.css @@ -106,10 +106,12 @@ table { border-spacing: 0; } -td { +th, td { vertical-align: top; } +th { text-align: left; font-weight: normal; } + h1, h2, h3, h4, h5, h6, form, fieldset { margin: 0; padding: 0; @@ -516,17 +518,23 @@ body { display: block; float: left; } + +#ticketForm div input[type=file] { + border: 0; +} + #ticketForm div select, #clientLogin div select { display: block; float: left; } -#ticketForm div textarea, #clientLogin div textarea { +#ticketForm td textarea, #clientLogin div textarea { width: 600px; } -#ticketForm div em, #clientLogin div em { + +#ticketForm td em, #clientLogin div em { color: #777; } -#ticketForm div .captcha, #clientLogin div .captcha { +#ticketForm td .captcha, #clientLogin div .captcha { width: 88px; height: 31px; background: #000; @@ -534,20 +542,33 @@ body { float: left; margin-right: 20px; } -#ticketForm div label.inline, #clientLogin div label.inline { +#ticketForm td label.inline, #clientLogin div label.inline { width: auto; padding: 0 10px; } -#ticketForm div label.required, #clientLogin div label.required { + +#ticketTable table tr th { + width: 160px; + font-weight: normal; + text-align: left; +} + +#ticketForm table th.required, #ticketForm table td.required, #clientLogin div label.required { font-weight: bold; + text-align: left; } -#ticketForm div.captchaRow, #clientLogin div.captchaRow { + + + +#ticketForm tr.captchaRow, #clientLogin div.captchaRow { line-height: 31px; } -#ticketForm div.captchaRow input, #clientLogin div.captchaRow input { + +.captchaRow td input, #clientLogin div.captchaRow input { position: relative; top: 6px; } + #ticketForm div.error input, #clientLogin div.error input { border: 1px solid #a00; } @@ -797,6 +818,14 @@ a.refresh { font-family:helvetica, arial, sans-serif; } + +.uploads { + display:inline-block; + padding-right:20px; +} + +.uploads label { padding:3px; padding-right:10px; width: auto !important } + .button:hover { background-color: #111; color: #fff; } .button:active { top: 1px; box-shadow:none; -moz-box-shadow:none; -webkit-box-shadow:none; } .button, .button:visited, diff --git a/include/client/header.inc.php b/include/client/header.inc.php index 969e9e66b8d977256e8087fc8cba2dadebb8fc62..da763a7bbf7b1e5b9481b8d26a0dfca2c79a9997 100644 --- a/include/client/header.inc.php +++ b/include/client/header.inc.php @@ -12,8 +12,9 @@ header("Content-Type: text/html; charset=UTF-8\r\n"); <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <link rel="stylesheet" href="<?php echo ASSETS_PATH; ?>css/theme.css" media="screen"> <link rel="stylesheet" href="<?php echo ASSETS_PATH; ?>css/print.css" media="print"> - <script src="./js/jquery-1.7.2.min.js"></script> - <script src="./js/osticket.js"></script> + <script src="<?php echo ROOT_PATH; ?>js/jquery-1.7.2.min.js"></script> + <script src="<?php echo ROOT_PATH; ?>js/jquery.multifile.js"></script> + <script src="<?php echo ROOT_PATH; ?>js/osticket.js"></script> </head> <body> <div id="container"> diff --git a/include/client/open.inc.php b/include/client/open.inc.php index b85c1e337eac2894c2246a94c623cea6717b42d2..42cf10c92d6eb3a45fdbf3775fc3cde7103d247b 100644 --- a/include/client/open.inc.php +++ b/include/client/open.inc.php @@ -13,99 +13,111 @@ $info=($_POST && $errors)?Format::htmlchars($_POST):$info; <h1>Open a New Ticket</h1> <p>Please fill in the form below to open a new ticket.</p> <form id="ticketForm" method="post" action="open.php" enctype="multipart/form-data"> - <?php csrf_token(); ?> - <input type="hidden" name="a" value="open"> - <div> - <label for="name" class="required">Full Name:</label> - <?php - if($thisclient && $thisclient->isValid()) { - echo $thisclient->getName(); - } else { ?> - <input id="name" type="text" name="name" size="30" value="<?php echo $info['name']; ?>"> - <font class="error">* <?php echo $errors['name']; ?></font> - <?php - } ?> - </div> - <div> - <label for="email" class="required">Email Address:</label> - <?php - if($thisclient && $thisclient->isValid()) { - echo $thisclient->getEmail(); - } else { ?> - <input id="email" type="text" name="email" size="30" value="<?php echo $info['email']; ?>"> - <font class="error">* <?php echo $errors['email']; ?></font> - <?php - } ?> - </div> - <div> - <label for="phone">Telephone:</label> - <input id="phone" type="text" name="phone" size="17" value="<?php echo $info['phone']; ?>"> - <label for="ext" class="inline">Ext.:</label> - <input id="ext" type="text" name="phone_ext" size="3" value="<?php echo $info['phone_ext']; ?>"> - <font class="error"> <?php echo $errors['phone']; ?> <?php echo $errors['phone_ext']; ?></font> - </div> - <br> - <div> - <label for="topicId" class="required">Help Topic:</label> - <select id="topicId" name="topicId"> - <option value="" selected="selected">— Select a Help Topics —</option> + <?php csrf_token(); ?> + <input type="hidden" name="a" value="open"> + <table width="800" cellpadding="1" cellspacing="0" border="0"> + <tr> + <th class="required" width="160">Full Name:</th> + <td> <?php - if($topics=Topic::getPublicHelpTopics()) { - foreach($topics as $id =>$name) { - echo sprintf('<option value="%d" %s>%s</option>', - $id, ($info['topicId']==$id)?'selected="selected"':'', $name); - } + if($thisclient && $thisclient->isValid()) { + echo $thisclient->getName(); } else { ?> - <option value="0" >General Inquiry</option> - <?php } ?> - </select> - <font class="error">* <?php echo $errors['topicId']; ?></font> - </div> - <div> - <label for="subject" class="required">Subject:</label> - <input id="subject" type="text" name="subject" size="40" value="<?php echo $info['subject']; ?>"> - <font class="error">* <?php echo $errors['subject']; ?></font> - </div> - <div> - <label for="msg" class="required">Message:</label> - <span id="msg"> - <em>Please provide as much details as possible so we can best assist you.</em> <font class="error">* <?php echo $errors['message']; ?></font></span> - </div> - <div> - <label for="message" class="required"> </label> - <textarea id="message" cols="60" rows="8" name="message"><?php echo $info['message']; ?></textarea> - </div> + <input id="name" type="text" name="name" size="30" value="<?php echo $info['name']; ?>"> + <font class="error">* <?php echo $errors['name']; ?></font> + <?php + } ?> + </td> + </tr> + <tr> + <th class="required" width="160">Email Address:</th> + <td> + <?php + if($thisclient && $thisclient->isValid()) { + echo $thisclient->getEmail(); + } else { ?> + <input id="email" type="text" name="email" size="30" value="<?php echo $info['email']; ?>"> + <font class="error">* <?php echo $errors['email']; ?></font> + <?php + } ?> + </td> + </tr> + <tr> + <th>Telephone:</th> + <td> + + <input id="phone" type="text" name="phone" size="17" value="<?php echo $info['phone']; ?>"> + <label for="ext" class="inline">Ext.:</label> + <input id="ext" type="text" name="phone_ext" size="3" value="<?php echo $info['phone_ext']; ?>"> + <font class="error"> <?php echo $errors['phone']; ?> <?php echo $errors['phone_ext']; ?></font> + </td> + </tr> + <tr><td colspan=2> </td></tr> + <tr> + <td class="required">Help Topic:</td> + <td> + <select id="topicId" name="topicId"> + <option value="" selected="selected">— Select a Help Topics —</option> + <?php + if($topics=Topic::getPublicHelpTopics()) { + foreach($topics as $id =>$name) { + echo sprintf('<option value="%d" %s>%s</option>', + $id, ($info['topicId']==$id)?'selected="selected"':'', $name); + } + } else { ?> + <option value="0" >General Inquiry</option> + <?php + } ?> + </select> + <font class="error">* <?php echo $errors['topicId']; ?></font> + </td> + </tr> + <tr> + <td class="required">Subject:</td> + <td> + <input id="subject" type="text" name="subject" size="40" value="<?php echo $info['subject']; ?>"> + <font class="error">* <?php echo $errors['subject']; ?></font> + </td> + </tr> + <tr> + <td class="required">Message:</td> + <td> + <div><em>Please provide as much details as possible so we can best assist you.</em> <font class="error">* <?php echo $errors['message']; ?></font></div> + <textarea id="message" cols="60" rows="8" name="message"><?php echo $info['message']; ?></textarea> + </td> + </tr> + <?php if(($cfg->allowOnlineAttachments() && !$cfg->allowAttachmentsOnlogin()) || ($cfg->allowAttachmentsOnlogin() && ($thisclient && $thisclient->isValid()))) { ?> - <div> - <label for="attachments">Attachments:</label> - <span id="uploads"></span> - <input type="file" class="multifile" name="attachments[]" id="attachments" size="30" value="" /> - <font class="error"> <?php echo $errors['attachments']; ?></font> - </div> + <tr> + <td>Attachments:</td> + <td> + <div class="uploads"></div><br> + <input type="file" class="multifile" name="attachments[]" id="attachments" size="30" value="" /> + <font class="error"> <?php echo $errors['attachments']; ?></font> + </td> + </tr> + <tr><td colspan=2> </td></tr> <?php } ?> <?php if($cfg->allowPriorityChange() && ($priorities=Priority::getPriorities())) { ?> - <div> - <label for="priority">Ticket Priority:</label> - <select id="priority" name="priorityId"> - <?php - if(!$info['priorityId']) - $info['priorityId'] = $cfg->getDefaultPriorityId(); //System default. - foreach($priorities as $id =>$name) { - echo sprintf('<option value="%d" %s>%s</option>', - $id, ($info['priorityId']==$id)?'selected="selected"':'', $name); + <tr> + <td>Ticket Priority:</td> + <td> + <select id="priority" name="priorityId"> + <?php + if(!$info['priorityId']) + $info['priorityId'] = $cfg->getDefaultPriorityId(); //System default. + foreach($priorities as $id =>$name) { + echo sprintf('<option value="%d" %s>%s</option>', + $id, ($info['priorityId']==$id)?'selected="selected"':'', $name); - } - ?> - - - - </select> - - <font class="error"> <?php echo $errors['priorityId']; ?></font> - - </div> + } + ?> + </select> + <font class="error"> <?php echo $errors['priorityId']; ?></font> + </td> + </tr> <?php } ?> @@ -114,20 +126,23 @@ $info=($_POST && $errors)?Format::htmlchars($_POST):$info; if($_POST && $errors && !$errors['captcha']) $errors['captcha']='Please re-enter the text again'; ?> - <br> - <div class="captchaRow"> - <label for="captcha" class="required">CAPTCHA Text:</label> - <span class="captcha"><img src="captcha.php" border="0" align="left"></span> - <input id="captcha" type="text" name="captcha" size="6"> - <em>Enter the text shown on the image.</em> - <font class="error">* <?php echo $errors['captcha']; ?></font> - </div> + <tr class="captchaRow"> + <td class="required">CAPTCHA Text:</td> + <td> + <span class="captcha"><img src="captcha.php" border="0" align="left"></span> + + <input id="captcha" type="text" name="captcha" size="6"> + <em>Enter the text shown on the image.</em> + <font class="error">* <?php echo $errors['captcha']; ?></font> + </td> + </tr> <?php } ?> - <br> - <p style="padding-left:150px;"> + <tr><td colspan=2> </td></tr> + </table> + <p style="padding-left:150px;"> <input type="submit" value="Create Ticket"> <input type="reset" value="Reset"> <input type="button" value="Cancel" onClick='window.location.href="index.php"'> - </p> + </p> </form> diff --git a/include/client/view.inc.php b/include/client/view.inc.php index 5aba461fc8f8a129138ed406d1319bb66d1ca9cb..ccea4c927cfdf31793ae325f79572a743fa35f26 100644 --- a/include/client/view.inc.php +++ b/include/client/view.inc.php @@ -122,7 +122,7 @@ if($ticket->getThreadCount() && ($thread=$ticket->getClientThread())) { <div class="uploads"> </div> <div class="file_input"> - <input type="file" name="attachments[]" size="30" value="" /> + <input class="multifile" type="file" name="attachments[]" size="30" value="" /> </div> </td> </tr> diff --git a/open.php b/open.php index 11d3a0a9d3397d64941886169a5fa2892ea663a1..7bdc8fc8ffccfee37516c5ec60c0e1d16119df75 100644 --- a/open.php +++ b/open.php @@ -32,6 +32,14 @@ if($_POST): //Ticket::create...checks for errors.. if(($ticket=Ticket::create($_POST,$errors,SOURCE))){ $msg='Support ticket request created'; + //Upload attachments... + if($cfg->allowOnlineAttachments() + && $_FILES['attachments'] + && ($files=Format::files($_FILES['attachments']))) { + $ost->validateFileUploads($files); //Validator sets errors - if any. + $ticket->uploadAttachments($files, $ticket->getLastMsgId(), 'M'); + } + //Logged in...simply view the newly created ticket. if($thisclient && $thisclient->isValid()) { if(!$cfg->showRelatedTickets()) diff --git a/tickets.php b/tickets.php index 81b8ed68f153b551c4b063d2fa6860ea84070ac1..4ee69a8ef51f5b2b274df224fac4ed195330da5a 100644 --- a/tickets.php +++ b/tickets.php @@ -38,26 +38,15 @@ if($_POST && is_object($ticket) && $ticket->getId()): if(!$_POST['message']) $errors['message']='Message required'; - //check attachment..if any is set - $files=($cfg->allowOnlineAttachments() && $_FILES['attachments'])?Format::files($_FILES['attachments']):array(); - if($files) { - - foreach($files as $file) { - if(!$file['name']) continue; - - if(!$cfg->canUploadFileType($file['name'])) - $errors['attachment']='Invalid file type [ '.$file['name'].' ]'; - elseif($file['size']>$cfg->getMaxFileSize()) - $errors['attachment']='File '.$file['name'].'is too big. Max '.$cfg->getMaxFileSize().' bytes allowed'; - } - } - if(!$errors) { //Everything checked out...do the magic. if(($msgid=$ticket->postMessage($_POST['message'],'Web'))) { - if($files && $cfg->allowOnlineAttachments()) - $ticket->uploadAttachments($files,$msgid,'M'); - + if($cfg->allowOnlineAttachments() + && $_FILES['attachments'] + && ($files=Format::files($_FILES['attachments']))) { + $ost->validateFileUploads($files); //Validator sets errors - if any. + $ticket->uploadAttachments($files, $msgid, 'M'); + } $msg='Message Posted Successfully'; } else { $errors['err']='Unable to post the message. Try again'; @@ -68,7 +57,7 @@ if($_POST && is_object($ticket) && $ticket->getId()): } break; default: - $errors['err']='Uknown action'; + $errors['err']='Unknown action'; } $ticket->reload(); endif;