Commit fb0bd9a0a3fd54e9ddf9089988cdeaa99365844f
1 parent
e5403e6f
Brand server without requiring access to FS
PT: 1243391 Upgraded selectImage to use the jquery plugin. This is used when scaling an image. Updated by: Charl Joseph Mert
Showing
3 changed files
with
134 additions
and
0 deletions
resources/js/kt_selectimage.js
0 โ 100755
thirdpartyjs/jquery/plugins/selectimage/css/selectimage.css
0 โ 100644
| 1 | +#selectimage_container img { | |
| 2 | + cursor: pointer; | |
| 3 | + text-decoration: none; | |
| 4 | + border: 10px solid white; | |
| 5 | +} | |
| 6 | + | |
| 7 | +#selectimage_container img:hover { | |
| 8 | + text-decoration: none; | |
| 9 | + border: 10px solid white; | |
| 10 | +} | |
| 11 | + | |
| 12 | +.jq_select_image { | |
| 13 | + float: left; | |
| 14 | + border: 1px solid #cccccc; | |
| 15 | + margin-right: 5px; | |
| 16 | + padding: 0px; | |
| 17 | + display:inline; | |
| 18 | + height:70px; | |
| 19 | +} | |
| 20 | + | |
| 21 | +.selectimage_border_background { | |
| 22 | + border: 10px solid white; | |
| 23 | +} | |
| 24 | + | |
| 25 | +.selectimage_border_hover { | |
| 26 | + border: 10px solid #9c9c9c; | |
| 27 | +} | |
| 28 | + | |
| 29 | +.selectimage_border_click { | |
| 30 | + border: 10px solid #f2943a; | |
| 31 | +} | |
| 0 | 32 | \ No newline at end of file | ... | ... |
thirdpartyjs/jquery/plugins/selectimage/jquery.selectimage.js
0 โ 100755
| 1 | +/** | |
| 2 | + * jQuery Select Image Plugin | |
| 3 | + * | |
| 4 | + * @author Charl Mert <charl@knowledgetree.com> | |
| 5 | + * | |
| 6 | + * KnowledgeTree Community Edition | |
| 7 | + * Document Management Made Simple | |
| 8 | + * Copyright (C) 2009, 2010 KnowledgeTree Inc. | |
| 9 | + * | |
| 10 | + * This program is free software; you can redistribute it and/or modify it under | |
| 11 | + * the terms of the GNU General Public License version 3 as published by the | |
| 12 | + * Free Software Foundation. | |
| 13 | + * | |
| 14 | + * This program is distributed in the hope that it will be useful, but WITHOUT | |
| 15 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
| 16 | + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
| 17 | + * details. | |
| 18 | + * | |
| 19 | + * You should have received a copy of the GNU General Public License | |
| 20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 21 | + * | |
| 22 | + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | |
| 23 | + * California 94120-7775, or email info@knowledgetree.com. | |
| 24 | + * | |
| 25 | + * The interactive user interfaces in modified source and object code versions | |
| 26 | + * of this program must display Appropriate Legal Notices, as required under | |
| 27 | + * Section 5 of the GNU General Public License version 3. | |
| 28 | + * | |
| 29 | + * In accordance with Section 7(b) of the GNU General Public License version 3, | |
| 30 | + * these Appropriate Legal Notices must retain the display of the "Powered by | |
| 31 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 32 | + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | |
| 33 | + * must display the words "Powered by KnowledgeTree" and retain the original | |
| 34 | + * copyright notice. | |
| 35 | + * Contributor( s): ______________________________________ | |
| 36 | + */ | |
| 37 | + | |
| 38 | +jQuery.fn.selectImage = function() { | |
| 39 | + return this.each(function(){ | |
| 40 | + | |
| 41 | + var opt = jQuery.extend({ | |
| 42 | + passBackNamespace : 'selectimage', //TODO: Let plugin detect parent form and produce the hidden inputs. For now the user has to place the predefined hidden inputs onto the form manually. | |
| 43 | + multiselect : false, | |
| 44 | + hover : '#e2e2e2', | |
| 45 | + click : '#f2943a', //Orange | |
| 46 | + background : 'white', | |
| 47 | + selected : '' | |
| 48 | + }, opt); | |
| 49 | + | |
| 50 | + var containerId = this.id; | |
| 51 | + var custId = 0; | |
| 52 | + | |
| 53 | + //Setting up border | |
| 54 | + jQuery('#' + containerId + ' img' ).css('border', '10px solid ' + opt.background); | |
| 55 | + | |
| 56 | + jQuery('#' + containerId + ' img').each(function(){ | |
| 57 | + //Assigning custom id's to attach event handlers to | |
| 58 | + if (this.id == '') { | |
| 59 | + this.id = 'select_image_img_' + custId; | |
| 60 | + custId++; | |
| 61 | + } | |
| 62 | + | |
| 63 | + var toggle = 1; | |
| 64 | + | |
| 65 | + //Click to select | |
| 66 | + jQuery('#' + this.id).click(function(){ | |
| 67 | + opt.selected = this.id; | |
| 68 | + jQuery('#' + opt.passBackNamespace + '_src').val(this.src); | |
| 69 | + jQuery('#' + opt.passBackNamespace + '_alt').val(this.alt); | |
| 70 | + jQuery('#' + opt.passBackNamespace + '_title').val(this.title); | |
| 71 | + | |
| 72 | + //Resetting background: | |
| 73 | + jQuery('#' + containerId + ' img' ).css('border', '10px solid ' + opt.background); | |
| 74 | + jQuery('#' + this.id).css('border', '10px solid ' + opt.click); | |
| 75 | + }) | |
| 76 | + | |
| 77 | + //Hover Effect | |
| 78 | + jQuery('#' + this.id).mouseenter(function(){ | |
| 79 | + if (this.id != opt.selected) { | |
| 80 | + jQuery('#' + this.id).css('border', '10px solid ' + opt.hover).show("slow"); | |
| 81 | + } | |
| 82 | + }) | |
| 83 | + | |
| 84 | + jQuery('#' + this.id).mouseleave(function(){ | |
| 85 | + if (this.id != opt.selected) { | |
| 86 | + jQuery('#' + this.id).css('border', '10px solid ' + opt.background).show("slow"); | |
| 87 | + } | |
| 88 | + }) | |
| 89 | + | |
| 90 | + }); | |
| 91 | + }); | |
| 92 | +}; | |
| 93 | + | |
| 94 | +jQuery.log = function(message) { | |
| 95 | + if(window.console) { | |
| 96 | + console.debug(message); | |
| 97 | + } else { | |
| 98 | + alert(message); | |
| 99 | + } | |
| 100 | +}; | |
| 0 | 101 | \ No newline at end of file | ... | ... |