diff --git a/include/ajax.config.php b/include/ajax.config.php index 5a1ff54206a27c2540baa6664875005a9ffbf03e..7f2be0617f3d37f7df7484c5b4e2e5d44f98b407 100644 --- a/include/ajax.config.php +++ b/include/ajax.config.php @@ -23,10 +23,11 @@ class ConfigAjaxAPI extends AjaxController { global $cfg; $config=array( - 'lock_time' => ($cfg->getLockTime()*3600), - 'max_file_uploads'=> (int) $cfg->getStaffMaxFileUploads(), - 'html_thread' => (bool) $cfg->isHtmlThreadEnabled(), - ); + 'lock_time' => ($cfg->getLockTime()*3600), + 'max_file_uploads'=> (int) $cfg->getStaffMaxFileUploads(), + 'html_thread' => (bool) $cfg->isHtmlThreadEnabled(), + 'allow_attachments' => (bool) $cfg->allowAttachments(), + ); return $this->json_encode($config); } @@ -34,11 +35,12 @@ class ConfigAjaxAPI extends AjaxController { global $cfg; $config=array( - 'file_types' => $cfg->getAllowedFileTypes(), - 'max_file_size' => (int) $cfg->getMaxFileSize(), - 'max_file_uploads'=> (int) $cfg->getClientMaxFileUploads(), - 'html_thread' => (bool) $cfg->isHtmlThreadEnabled(), - ); + 'allow_attachments' => (bool) $cfg->allowOnlineAttachments, + 'file_types' => $cfg->getAllowedFileTypes(), + 'max_file_size' => (int) $cfg->getMaxFileSize(), + 'max_file_uploads'=> (int) $cfg->getClientMaxFileUploads(), + 'html_thread' => (bool) $cfg->isHtmlThreadEnabled(), + ); return $this->json_encode($config); } diff --git a/include/ajax.kbase.php b/include/ajax.kbase.php index adf136ffcea81a75a99e31369b1f852d1d3de99e..ba0cf1d1cc523f3030017b5cbbc821aed8185933 100644 --- a/include/ajax.kbase.php +++ b/include/ajax.kbase.php @@ -41,8 +41,10 @@ class KbaseAjaxAPI extends AjaxController { : $canned->getResponseWithImages(); $resp['files'] = $canned->attachments->getSeparates(); - if (!$cfg->isHtmlThreadEnabled()) + if (!$cfg->isHtmlThreadEnabled()) { $resp['response'] = convert_html_to_text($resp['response'], 90); + $resp['files'] += $canned->attachments->getInlines(); + } $response = $this->json_encode($resp); break; diff --git a/include/class.attachment.php b/include/class.attachment.php index 36d197bb53d1d85e722e28cf62e89591ff73489e..a46028d83c085241461771a0b3faaf091777273d 100644 --- a/include/class.attachment.php +++ b/include/class.attachment.php @@ -157,25 +157,26 @@ class GenericAttachments { function _getList($separate=false, $inlines=false) { if(!isset($this->attachments)) { $this->attachments = array(); - $sql='SELECT f.id, f.size, f.hash, f.name ' + $sql='SELECT f.id, f.size, f.hash, f.name, a.inline ' .' FROM '.FILE_TABLE.' f ' .' INNER JOIN '.ATTACHMENT_TABLE.' a ON(f.id=a.file_id) ' .' WHERE a.`type`='.db_input($this->getType()) .' AND a.object_id='.db_input($this->getId()); - if ($inlines && !$separate) - $sql .= ' AND a.inline'; - elseif (!$inlines && $separate) - $sql .= ' AND NOT a.inline'; - if(($res=db_query($sql)) && db_num_rows($res)) { while($rec=db_fetch_array($res)) { - $rec['key'] = md5($rec['id'].session_id().$rec['hash']); - $rec['file_id'] = $rec['id']; $this->attachments[] = $rec; } } } - return $this->attachments; + $attachments = array(); + foreach ($this->attachments as $a) { + if ($a['inline'] != $separate || $a['inline'] == $inlines) { + $a['key'] = md5($a['id'].session_id().$a['hash']); + $a['file_id'] = $a['id']; + $attachments[] = $a; + } + } + return $attachments; } function delete($file_id) { diff --git a/include/class.canned.php b/include/class.canned.php index d67e8a03e952aa35a0a382796c75305c4464adb0..b8aa297d77c9387e95793253af50599fd97c84a6 100644 --- a/include/class.canned.php +++ b/include/class.canned.php @@ -186,7 +186,6 @@ class Canned { global $cfg; $vars['title']=Format::striptags(trim($vars['title'])); - $vars['notes']=Format::striptags(trim($vars['notes'])); if($id && $id!=$vars['id']) $errors['err']='Internal error. Try again'; @@ -207,9 +206,8 @@ class Canned { ',dept_id='.db_input($vars['dept_id']?$vars['dept_id']:0). ',isenabled='.db_input($vars['isenabled']). ',title='.db_input($vars['title']). - ',response='.db_input(Format::sanitize($vars['response'], - !$cfg->isHtmlThreadEnabled())). - ',notes='.db_input($vars['notes']); + ',response='.db_input(Format::sanitize($vars['response'])). + ',notes='.db_input(Format::sanitize($vars['notes'])); if($id) { $sql='UPDATE '.CANNED_TABLE.' SET '.$sql.' WHERE canned_id='.db_input($id); diff --git a/include/class.category.php b/include/class.category.php index 62209673780135fdfdf23acc3b46f49709151cba..ba705b41296cc816fbc290a4e08072f071ccec3f 100644 --- a/include/class.category.php +++ b/include/class.category.php @@ -143,8 +143,8 @@ class Category { $sql=' updated=NOW() '. ',ispublic='.db_input(isset($vars['ispublic'])?$vars['ispublic']:0). ',name='.db_input($vars['name']). - ',description='.db_input(Format::safe_html($vars['description'])). - ',notes='.db_input($vars['notes']); + ',description='.db_input(Format::sanitize($vars['description'])). + ',notes='.db_input(Format::sanitize($vars['notes'])); if($id) { $sql='UPDATE '.FAQ_CATEGORY_TABLE.' SET '.$sql.' WHERE category_id='.db_input($id); diff --git a/include/class.draft.php b/include/class.draft.php index b183736c705293a3695c0bad71775b0256443141..6796428b6d0a51ea0c5777331190c2e942e987b8 100644 --- a/include/class.draft.php +++ b/include/class.draft.php @@ -25,20 +25,18 @@ class Draft { function getNamespace() { return $this->ht['namespace']; } function getAttachmentIds($body=false) { - if (!isset($this->_attachments)) { - $this->_attachments = array(); - if (!$body) - $body = $this->getBody(); - $body = Format::localizeInlineImages($body); - $matches = array(); - if (preg_match_all('/"cid:([\\w.-]{32})"/', $body, $matches)) { - foreach ($matches[1] as $hash) { - if ($file_id = AttachmentFile::getIdByHash($hash)) - $this->_attachments[] = $file_id; - } + $attachments = array(); + if (!$body) + $body = $this->getBody(); + $body = Format::localizeInlineImages($body); + $matches = array(); + if (preg_match_all('/"cid:([\\w.-]{32})"/', $body, $matches)) { + foreach ($matches[1] as $hash) { + if ($file_id = AttachmentFile::getIdByHash($hash)) + $attachments[] = $file_id; } } - return $this->_attachments; + return $attachments; } /* diff --git a/include/class.faq.php b/include/class.faq.php index 4069ebd7b57cf5a2d699ea19271ea0712061d387..7cb3c9a950ee9e2461fabf79d5f8b3ec57c07f62 100644 --- a/include/class.faq.php +++ b/include/class.faq.php @@ -35,8 +35,8 @@ class FAQ { .' FROM '.FAQ_TABLE.' faq ' .' LEFT JOIN '.FAQ_CATEGORY_TABLE.' cat ON(cat.category_id=faq.category_id) ' .' LEFT JOIN '.ATTACHMENT_TABLE.' attach - ON(attach.object_id=faq.faq_id AND attach.`type`=\'F\') ' - .' WHERE attach.inline=0 AND faq.faq_id='.db_input($id) + ON(attach.object_id=faq.faq_id AND attach.`type`=\'F\' AND attach.inline=0) ' + .' WHERE faq.faq_id='.db_input($id) .' GROUP BY faq.faq_id'; if (!($res=db_query($sql)) || !db_num_rows($res)) @@ -306,7 +306,7 @@ class FAQ { .', answer='.db_input(Format::sanitize($vars['answer'], false)) .', category_id='.db_input($vars['category_id']) .', ispublished='.db_input(isset($vars['ispublished'])?$vars['ispublished']:0) - .', notes='.db_input($vars['notes']); + .', notes='.db_input(Format::sanitize($vars['notes'])); if($id) { $sql='UPDATE '.FAQ_TABLE.' SET '.$sql.' WHERE faq_id='.db_input($id); diff --git a/include/class.format.php b/include/class.format.php index a327f1289737c8dc6c15477ab3b4ddfaf8f31927..251b1b1f96045de0a38cae3fd79240e517b50f4d 100644 --- a/include/class.format.php +++ b/include/class.format.php @@ -197,7 +197,7 @@ class Format { } //Format text for display.. - function display($text) { + function display($text, $inline_images=true) { global $cfg; //make urls clickable. @@ -212,14 +212,19 @@ class Format { # $text); // Make showing offsite images optional - return preg_replace_callback('/<img ([^>]*)(src="http.+)\/>/', + $text = preg_replace_callback('/<img ([^>]*)(src="http[^"]+")([^>]*)\/>/', function($match) { // Drop embedded classes -- they don't refer to ours $match = preg_replace('/class="[^"]*"/', '', $match); - return sprintf('<div %s class="non-local-image" data-%s></div>', - $match[1], $match[2]); + return sprintf('<div %s class="non-local-image" data-%s %s></div>', + $match[1], $match[2], $match[3]); }, $text); + + if ($inline_images) + return self::viewableImages($text); + + return $text; } function striptags($var, $decode=true) { diff --git a/include/client/view.inc.php b/include/client/view.inc.php index 97202f4d0ee962d879c3c3e9b0cb2d8516c6750c..0b6950c395c6356955b98a36ad301d6623c03bb5 100644 --- a/include/client/view.inc.php +++ b/include/client/view.inc.php @@ -107,10 +107,7 @@ if($ticket->getThreadCount() && ($thread=$ticket->getClientThread())) { <input type="hidden" name="a" value="reply"> <table border="0" cellspacing="0" cellpadding="3" width="800"> <tr> - <td width="160"> - <label>Message:</label> - </td> - <td width="640"> + <td colspan="2"> <?php if($ticket->isClosed()) { $msg='<b>Ticket will be reopened on message post</b>'; diff --git a/include/html2text.php b/include/html2text.php index fb84a7b3801acd2ef4234be98f4a89c6870077fb..51137d002ea4440549c988d35b46fdc3cfc6d855 100644 --- a/include/html2text.php +++ b/include/html2text.php @@ -392,7 +392,7 @@ class HtmlImgElement extends HtmlInlineElement { if ($title) $title = ": $title"; $alt = $this->node->getAttribute("alt"); - return "[$alt$title] "; + return "[image:$alt$title] "; } function getWeight() { return parent::getWeight() + 4; } } diff --git a/include/i18n/en_US/email_template_group.yaml b/include/i18n/en_US/email_template_group.yaml index 41c5aca7038e43d773568f21ea8b7c6a08c3b6cf..4a76150ffeb1840a81680a6704b440c7acf20b7c 100644 --- a/include/i18n/en_US/email_template_group.yaml +++ b/include/i18n/en_US/email_template_group.yaml @@ -14,6 +14,6 @@ # --- - isactive: 1 - name: osTicket Default Template + name: osTicket Default Template (HTML) notes: | Default osTicket templates diff --git a/include/i18n/en_US/templates/email/ticket.alert.yaml b/include/i18n/en_US/templates/email/ticket.alert.yaml index 70283804456896704e14a39d552ecf8a938f7466..97e2a5dfbe904ebb1171cf6ac9932823894dcbfc 100644 --- a/include/i18n/en_US/templates/email/ticket.alert.yaml +++ b/include/i18n/en_US/templates/email/ticket.alert.yaml @@ -49,5 +49,5 @@ body: | <em>Your friendly Customer Support System <br/> <a href="http://osticket.com/"><img width="126" height="23" - alt="Powered By osTicket" src="cid:QURBOEMxRUY4QjcyRTFFMyIvPiA8L3Jk"/></a> + alt="Powered By osTicket" src="cid:b56944cb4722cc5cda9d1e23a3ea7fbc"/></a> </p> diff --git a/include/i18n/en_US/templates/email/ticket.autoreply.yaml b/include/i18n/en_US/templates/email/ticket.autoreply.yaml index 20a74ca7e1c3c5c5ced218ca83482cdc3d5ad468..19f833ea5f3ae926719408217c92addf58499a2f 100644 --- a/include/i18n/en_US/templates/email/ticket.autoreply.yaml +++ b/include/i18n/en_US/templates/email/ticket.autoreply.yaml @@ -75,7 +75,7 @@ body: | support requests and responses.</span> </p> <p> - <span style="color: rgb(127, 127, 127);">Visit our</span> + <span style="color: rgb(127, 127, 127);">Visit our </span> <a href="%{url}/kb"><span style="color: rgb(84, 141, 212);">knowledgebase</span></a> </p> diff --git a/include/i18n/en_US/templates/email/ticket.notice.yaml b/include/i18n/en_US/templates/email/ticket.notice.yaml index b1a8a788db78ea896fe08a286e873c856074129b..3bcf76611a9c50ed5a96999d5f138aa374f5c9cb 100644 --- a/include/i18n/en_US/templates/email/ticket.notice.yaml +++ b/include/i18n/en_US/templates/email/ticket.notice.yaml @@ -19,7 +19,7 @@ body: | <td style="vertical-align: middle; border-bottom: 1px solid #ddd; height: 48pt"> <span style="color: rgb(127, 127, 127); font-family: Georgia; - font-size: 28pt; font-weight: normal;">We Hear You</span> + font-size: 28pt; font-weight: normal;">We're Here For You</span> </td> <td style="border-bottom: 1px solid #ddd;"> <img src="cid:6fe1efdea357534d238b86e7860a7c5a" width="94" diff --git a/include/i18n/en_US/templates/email/ticket.reply.yaml b/include/i18n/en_US/templates/email/ticket.reply.yaml index ad343e6882a79b033641759ada8700ca6da70970..a73a75ff0ba6a64e84886e952950ed95b5f9756f 100644 --- a/include/i18n/en_US/templates/email/ticket.reply.yaml +++ b/include/i18n/en_US/templates/email/ticket.reply.yaml @@ -10,13 +10,12 @@ notes: | Sent to users when a staff members makes a reply to their ticket. Replies are only generated by staff members. -subject: | - Re\: %{ticket.subject} +subject: "Re: %{ticket.subject}" body: | <img src="cid:6fe1efdea357534d238b86e7860a7c5a" alt="osTicket Logo (kangaroo)" width="113" height="64" style="float: right; width: 113px; margin: 0px 0px 10px 10px;"> <h3><span style="color: rgb(127, 127, 127); font-weight: normal; - font-family: Georgia; font-size: 30pt">Title text here</span></h3> + font-family: Georgia; font-size: 30pt">We're Here For You</span></h3> <p> <strong>Dear %{ticket.name},</strong> </p> diff --git a/include/i18n/en_US/templates/email/transfer.alert.yaml b/include/i18n/en_US/templates/email/transfer.alert.yaml index aa9b68d21b6e802ecb7dac3c65d08e74407ce29b..43d293931ec9f871ba1bc942215ecd3f4f2f7917 100644 --- a/include/i18n/en_US/templates/email/transfer.alert.yaml +++ b/include/i18n/en_US/templates/email/transfer.alert.yaml @@ -30,5 +30,5 @@ body: | <em>Your friendly Customer Support System <br/> <a href="http://osticket.com/"><img width="126" height="23" - alt="Powered By osTicket" src="cid:QURBOEMxRUY4QjcyRTFFMyIvPiA8L3Jk"/></a> + alt="Powered By osTicket" src="cid:b56944cb4722cc5cda9d1e23a3ea7fbc"/></a> </p> diff --git a/include/staff/cannedresponse.inc.php b/include/staff/cannedresponse.inc.php index f540c3f7dfb1fd1d6d800328a60ea28dcf160ca7..4e38ff9649cb3447e3d4a6d98b6277ea144c32d4 100644 --- a/include/staff/cannedresponse.inc.php +++ b/include/staff/cannedresponse.inc.php @@ -11,6 +11,7 @@ if($canned && $_REQUEST['a']!='add'){ $qstr.='&id='.$canned->getId(); // Replace cid: scheme with downloadable URL for inline images $info['response'] = $canned->getResponseWithImages(); + $info['notes'] = Format::viewableImages($info['notes']); }else { $title='Add New Canned Response'; $action='create'; @@ -75,7 +76,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); <br><br><div style="margin-bottom:0.5em"><b>Canned Response</b> <font class="error">* <?php echo $errors['response']; ?></font> (<a class="tip" href="ticket_variables">Supported Variables</a>) </div> - <textarea name="response ifhtml draft draft-delete" cols="21" rows="12" + <textarea name="response" class="richtext draft draft-delete" cols="21" rows="12" data-draft-namespace="canned" data-draft-object-id="<?php if (isset($canned)) echo $canned->getId(); ?>" style="width:98%;" class="richtext draft"><?php diff --git a/include/staff/category.inc.php b/include/staff/category.inc.php index f5a153dbc7f312cb68ee9a87cd3e1e4604bc9081..76659bde6ffb6b13e6ba639a5f0cf14712ca0ee2 100644 --- a/include/staff/category.inc.php +++ b/include/staff/category.inc.php @@ -8,6 +8,7 @@ if($category && $_REQUEST['a']!='add'){ $submit_text='Save Changes'; $info=$category->getHashtable(); $info['id']=$category->getId(); + $info['notes'] = Format::viewableImages($category->getNotes()); $qstr.='&id='.$category->getId(); }else { $title='Add New Category'; @@ -67,7 +68,8 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); </tr> <tr> <td colspan=2> - <textarea name="notes" cols="21" rows="8" style="width: 80%;"><?php echo $info['notes']; ?></textarea> + <textarea class="richtext no-bar" name="notes" cols="21" + rows="8" style="width: 80%;"><?php echo $info['notes']; ?></textarea> </td> </tr> </tbody> diff --git a/include/staff/faq-category.inc.php b/include/staff/faq-category.inc.php index 8bf9e7a9db544667312bec87b02ad86e4cc2f0e5..39f70e6884139c738ee19330dfe3f1eeb9a97eee 100644 --- a/include/staff/faq-category.inc.php +++ b/include/staff/faq-category.inc.php @@ -14,7 +14,7 @@ if(!defined('OSTSTAFFINC') || !$category || !$thisstaff) die('Access Denied'); <time>Last updated <?php echo Format::db_daydatetime($category->getUpdateDate()); ?></time> </div> <div class="cat-desc"> -<?php echo Format::safe_html($category->getDescription()); ?> +<?php echo Format::display($category->getDescription()); ?> </div> <?php if($thisstaff->canManageFAQ()) { diff --git a/include/staff/faq.inc.php b/include/staff/faq.inc.php index b24ca665a255413d59264a12f94b1379e3395dee..e700bd429b8eaa20bb3c2ac5fa1816d798b39425 100644 --- a/include/staff/faq.inc.php +++ b/include/staff/faq.inc.php @@ -10,6 +10,7 @@ if($faq){ $info['id']=$faq->getId(); $info['topics']=$faq->getHelpTopicsIds(); $info['answer']=$faq->getAnswer(); + $info['notes']=Format::viewableImages($faq->getNotes()); $qstr='id='.$faq->getId(); }else { $title='Add New FAQ'; @@ -144,7 +145,8 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); </tr> <tr> <td colspan=2> - <textarea name="notes" cols="21" rows="8" style="width: 80%;"><?php echo $info['notes']; ?></textarea> + <textarea class="richtext no-bar" name="notes" cols="21" + rows="8" style="width: 80%;"><?php echo $info['notes']; ?></textarea> </td> </tr> </tbody> diff --git a/include/staff/tpl.inc.php b/include/staff/tpl.inc.php index 9527b5a3469ea382b0000cad6d30607ab616ba3d..b4dd330548b8d156205b26334b21fa0d39f0dcbf 100644 --- a/include/staff/tpl.inc.php +++ b/include/staff/tpl.inc.php @@ -15,7 +15,7 @@ if (is_a($template, EmailTemplateGroup)) { $default = @$template->getMsgTemplate($selected); if ($default) { $info['subject'] = $default->getSubject(); - $info['body'] = $default->getBody(); + $info['body'] = Format::viewableImages($default->getBody()); } } else { // Template edit diff --git a/include/upgrader/streams/core/16fcef4a-ec19794f.patch.sql b/include/upgrader/streams/core/d51f303a-ec19794f.patch.sql similarity index 97% rename from include/upgrader/streams/core/16fcef4a-ec19794f.patch.sql rename to include/upgrader/streams/core/d51f303a-ec19794f.patch.sql index bae4ac7150cd595ba97f41e836a3798db3442fcd..52449d9aa9d177796fb29f93b3f3d7481c0117ae 100644 --- a/include/upgrader/streams/core/16fcef4a-ec19794f.patch.sql +++ b/include/upgrader/streams/core/d51f303a-ec19794f.patch.sql @@ -103,10 +103,10 @@ UPDATE `%TABLE_PREFIX%team` -- Migrate canned responses to HTML UPDATE `%TABLE_PREFIX%canned_response` - SET `body` = REPLACE('\n', '<br/>', + SET `notes` = REPLACE('\n', '<br/>', REPLACE('<', '<', REPLACE('>', '>', - REPLACE('&', '&', `body`)))), + REPLACE('&', '&', `notes`)))), `response` = REPLACE('\n', '<br/>', REPLACE('<', '<', REPLACE('>', '>', diff --git a/include/upgrader/streams/core/d51f303a-ec19794f.task.php b/include/upgrader/streams/core/d51f303a-ec19794f.task.php new file mode 100644 index 0000000000000000000000000000000000000000..2786e3b10384dd97e9fe02bad43ca8516a512f9f --- /dev/null +++ b/include/upgrader/streams/core/d51f303a-ec19794f.task.php @@ -0,0 +1,15 @@ +<?php + +class NewHtmlTemplate extends MigrationTask { + var $description = "Adding new super-awesome HTML templates"; + + function run($runtime) { + $i18n = new Internationalization('en_US'); + $tpls = $i18n->getTemplate('email_template_group.yaml')->getData(); + foreach ($tpls as $t) + EmailTemplateGroup::create($t); + } +} +return 'NewHtmlTemplate'; + +?> diff --git a/js/osticket.js b/js/osticket.js index 653af24ba892de0603eaf2341b8e94a69904a6e1..58cb765eb2027ae8a242d2dbc774f14fe2a37e61 100644 --- a/js/osticket.js +++ b/js/osticket.js @@ -110,14 +110,13 @@ $(document).ready(function(){ showImagesInline = function(urls, thread_id) { var selector = (thread_id == undefined) - ? '.thread-body img[src^=cid]' - : '.thread-body#thread-id-'+thread_id+' img[src^=cid]'; + ? '.thread-body img[data-cid]' + : '.thread-body#thread-id-'+thread_id+' img[data-cid]'; $(selector).each(function(i, el) { - var hash = $(el).attr('src').slice(4), - info = urls[hash], + var cid = $(el).data('cid'), + info = urls[cid], e = $(el); - if (info && e.attr('src') == 'cid:' + hash) { - e.attr('src', info.url); + if (info) { // Add a hover effect with the filename var caption = $('<div class="image-hover">') .hover( diff --git a/js/redactor-osticket.js b/js/redactor-osticket.js index a9c68e0b54902a7697913aae24fc2b48eec1b103..96c8204c66ee97b98e96e2f369d63c33445ce538 100644 --- a/js/redactor-osticket.js +++ b/js/redactor-osticket.js @@ -74,10 +74,16 @@ RedactorPlugins.draft = { .val(data.draft_id); this.draft_id = data.draft_id; - this.opts.clipboardUploadUrl = - this.opts.imageUpload = - 'ajax.php/draft/'+data.draft_id+'/attach'; - this.opts.imageUploadErrorCallback = this.displayError; + var self = this; + getConfig().then(function(c) { + console.log(c); + if (c.allow_attachments) { + self.opts.clipboardUploadUrl = + self.opts.imageUpload = + 'ajax.php/draft/'+data.draft_id+'/attach'; + self.opts.imageUploadErrorCallback = self.displayError; + } + }); this.opts.autosave = 'ajax.php/draft/'+data.draft_id; }, diff --git a/scp/js/ticket.js b/scp/js/ticket.js index 451c7675a199e6ce11164a2f1264b675ed35a1e4..cbe042f4435d8bb46af55f4506947a9d04fab0ef 100644 --- a/scp/js/ticket.js +++ b/scp/js/ticket.js @@ -390,6 +390,7 @@ jQuery(function($) { showNonLocalImage(img); $(img).removeClass('non-local-image') // Remove placeholder sizing + .css({'display':'inline-block'}) .width('auto') .height('auto') .removeAttr('width') @@ -405,15 +406,13 @@ jQuery(function($) { var $img = $(img); // Save a copy of the original styling $img.data('style', $img.attr('style')); + $img.removeAttr('style'); // If the image has a 'height' attribute, use it, otherwise, use // 40px - if ($img.attr('height')) - $img.height($img.attr('height')); - else - $img.height('40px'); + $img.height(($img.attr('height') || '40') + 'px'); // Ensure the image placeholder is visible width-wise if (!$img.width()) - $img.width('80px'); + $img.width(($img.attr('width') || '80') + 'px'); // TODO: Add a hover-button to show just one image }); });