Changeset 23236
- Timestamp:
- Jun 16, 2013, 1:09:12 AM (11 years ago)
- Location:
- extensions/SmiliesSupport
- Files:
-
- 2 added
- 9 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
extensions/SmiliesSupport/admin.php
r23234 r23236 66 66 } 67 67 } 68 69 if (file_exists(SMILIES_DIR.$_POST['folder'].'/smilies.txt'))70 {71 @copy(SMILIES_DIR.$_POST['folder'].'/smilies.txt', SMILIES_DIR.$_POST['folder'].'/smilies.bak');72 }73 68 74 if (@!file_put_contents(SMILIES_DIR.$_POST['folder'].'/smilies .txt', $content))69 if (@!file_put_contents(SMILIES_DIR.$_POST['folder'].'/smilies-custom.txt', $content)) 75 70 { 76 $page['errors'][] = l10n('File/directory read error').' : '.SMILIES_DIR.$_POST['folder'].'/smilies .txt';71 $page['errors'][] = l10n('File/directory read error').' : '.SMILIES_DIR.$_POST['folder'].'/smilies-custom.txt'; 77 72 } 78 73 } -
extensions/SmiliesSupport/include/functions.inc.php
r23234 r23236 20 20 } 21 21 22 function smiliessupport_ get_list()22 function smiliessupport_action() 23 23 { 24 if (!isset($_GET['action']) || $_GET['action']!='ss_preview') return; 24 if (!isset($_GET['action'])) return; 25 if (strpos($_GET['action'], 'ss_') !== 0) return; 25 26 26 27 global $conf; … … 28 29 $folder = SMILIES_DIR . ltrim($_GET['folder'], '/') . '/'; 29 30 30 $short = array(); 31 if (file_exists($folder.'smilies.txt')) 31 if ($_GET['action'] == 'ss_reset') 32 32 { 33 foreach (file($folder.'smilies.txt', FILE_IGNORE_NEW_LINES) as $v) 33 @unlink($folder.'smilies-custom.txt'); 34 $_GET['action'] = 'ss_list'; 35 } 36 37 if ($_GET['action'] == 'ss_list') 38 { 39 $short = array(); 40 if (file_exists($folder.'smilies-custom.txt')) 34 41 { 35 if (preg_match('#^([^\s]+)[\s]+(.+)$#', trim($v), $matches)) 42 $file = file($folder.'smilies-custom.txt', FILE_IGNORE_NEW_LINES); 43 } 44 else if (file_exists($folder.'smilies.txt')) 45 { 46 $file = file($folder.'smilies.txt', FILE_IGNORE_NEW_LINES); 47 } 48 if (!empty($file)) 49 { 50 foreach ($file as $v) 36 51 { 37 $short[ $matches[2] ][] = $matches[1]; 52 if (preg_match('#^([^\s]+)[\s]+(.+)$#', trim($v), $matches)) 53 { 54 $short[ $matches[2] ][] = $matches[1]; 55 } 38 56 } 39 57 } 58 59 $smilies = array(); 60 $handle = opendir($folder); 61 while (false !== ($file = readdir($handle))) 62 { 63 if ( $file != '.' && $file != '..' && in_array(get_extension($file), $conf['smiliessupport']['ext']) ) 64 { 65 $smilies[$file] = array('title'=>':'.get_filename_wo_extension($file).':', 'file'=>$file, 'short'=>@$short[$file]); 66 } 67 } 68 closedir($handle); 69 70 echo json_encode(array('path'=>$folder, 'smilies'=>$smilies)); 40 71 } 41 42 $smilies = array();43 $handle = opendir($folder);44 while (false !== ($file = readdir($handle)))45 {46 if ( $file != '.' && $file != '..' && in_array(get_extension($file), $conf['smiliessupport']['ext']) )47 {48 $smilies[$file] = array('title'=>':'.get_filename_wo_extension($file).':', 'file'=>$file, 'short'=>@$short[$file]);49 }50 }51 closedir($handle);52 72 53 echo json_encode(array('path'=>$folder, 'smilies'=>$smilies));54 73 exit; 55 74 } -
extensions/SmiliesSupport/include/smiliessupport.inc.php
r23234 r23236 79 79 } 80 80 81 if (file_exists($folder.'smilies .txt'))81 if (file_exists($folder.'smilies-custom.txt')) 82 82 { 83 foreach (file($folder.'smilies.txt', FILE_IGNORE_NEW_LINES) as $v) 83 $file = file($folder.'smilies-custom.txt', FILE_IGNORE_NEW_LINES); 84 } 85 else if (file_exists($folder.'smilies.txt')) 86 { 87 $file = file($folder.'smilies.txt', FILE_IGNORE_NEW_LINES); 88 } 89 if (!empty($file)) 90 { 91 foreach ($file as $v) 84 92 { 85 93 $v = trim($v); -
extensions/SmiliesSupport/language/en_UK/plugin.lang.php
r23234 r23236 2 2 3 3 $lang['Smilies set'] = 'Smilies set'; 4 $lang['Smiley'] = 'Smiley';5 4 $lang['Shortcuts'] = 'Shortcuts'; 6 5 $lang['Columns'] = 'Columns'; 7 6 $lang['Smilies'] = 'Smilies'; 8 7 $lang['Edit shorcuts'] = 'Edit shorcuts'; 8 $lang['Reset defaults'] = 'Reset defaults'; 9 9 $lang['If you change current set you will lost every shortcuts changes.'] = 'If you change current set you will lost every shortcuts changes.'; 10 10 -
extensions/SmiliesSupport/language/fr_FR/plugin.lang.php
r23234 r23236 2 2 3 3 $lang['Smilies set'] = 'Set de smileys'; 4 $lang['Smiley'] = 'Smiley';5 4 $lang['Shortcuts'] = 'Raccourcis'; 6 5 $lang['Columns'] = 'Colonnes'; 7 6 $lang['Smilies'] = 'Smileys'; 8 7 $lang['Edit shorcuts'] = 'Modifier les raccouris'; 8 $lang['Reset defaults'] = 'Réinitialiser'; 9 9 $lang['If you change current set you will lost every shortcuts changes.'] = 'Si vous changez de set, vous perdrez les modifications des raccourcis.'; 10 10 -
extensions/SmiliesSupport/main.inc.php
r23234 r23236 73 73 { 74 74 add_event_handler('get_admin_plugin_menu_links', 'smiliessupport_admin_menu'); 75 add_event_handler('init', 'smiliessupport_ get_list');75 add_event_handler('init', 'smiliessupport_action'); 76 76 77 77 function smiliessupport_admin_menu($menu) -
extensions/SmiliesSupport/smilies/pidgin/smilies.txt
r23234 r23236 13 13 :) happy.png 14 14 :-) happy.png 15 <3 in _love.png15 <3 in-love.png 16 16 :| neutral.png 17 17 :-| neutral.png -
extensions/SmiliesSupport/template/smiliessupport_admin.tpl
r23234 r23236 44 44 }); 45 45 46 // reset defaults 47 jQuery(".reset").click(function() { 48 var ok = confirm("{/literal}{'Are you sure?'|@translate}{literal}"); 49 if (!ok) return false; 50 51 jQuery.ajax({ 52 url: 'admin.php', 53 type: 'GET', 54 dataType: 'json', 55 data: { 56 action: 'ss_reset', 57 folder: jQuery("select[name='folder']").val(), 58 }, 59 success: function(result) { 60 data = result; 61 edited = false; 62 update(); 63 } 64 }); 65 66 return false; 67 }); 68 46 69 // display edit form before submit 47 70 jQuery("#smiliesupport").submit(function() { … … 57 80 dataType: 'json', 58 81 data: { 59 action: 'ss_ preview',82 action: 'ss_list', 60 83 folder: jQuery("select[name='folder']").val(), 61 84 }, … … 74 97 if (!edit) { 75 98 html+= '<tr>'; 99 76 100 var cols = parseInt(jQuery("input[name='cols']").val()); 77 101 var i=0; … … 80 104 var smiley = data.smilies[file]; 81 105 html+= '<td><a href="#" title="'+ smiley.title +'"><img src="'+ data.path + smiley.file +'"/></a></td>'; 82 if ((parseInt(i)+1)%cols == 0) html+= '</tr><tr>';106 html+= (i+1)%cols==0 ? '</tr><tr>' : ''; 83 107 i++; 84 108 } 85 109 86 110 html+= '</tr>'; 111 112 jQuery(".reset").hide(); 87 113 } 88 114 else { 89 115 {/literal} 90 116 html+= '<tr>' 91 +'<th> {'Smiley'|@translate}</th>'117 +'<th></th>' 92 118 +'<th>{'Name'|@translate}</th>' 93 119 +'<th>{'Shortcuts'|@translate}</th>' 94 +'</tr>'; 120 +'<th class="spacer"></th>' 121 +'<th></th>' 122 +'<th>{'Name'|@translate}</th>' 123 +'<th>{'Shortcuts'|@translate}</th>' 124 +'</tr>' 125 126 +'<tr>'; 95 127 {literal} 128 129 var i=0; 96 130 97 131 for (var file in data.smilies) { 98 132 var smiley = data.smilies[file]; 99 html+= '<tr data-file="'+ smiley.file +'">' 100 +'<td><img src="'+ data.path + smiley.file +'"/></td>' 101 +'<td>'+ smiley.title +'</td>' 102 +'<td>' 103 +'<select name="shortcuts['+ smiley.file +']" class="shortcuts">'; 133 134 html+= 135 '<td><img src="'+ data.path + smiley.file +'"/></td>' 136 +'<td>'+ smiley.title +'</td>' 137 +'<td data-file="'+ smiley.file +'">' 138 +'<select name="shortcuts['+ smiley.file +']" class="shortcuts">'; 139 140 for (var j in smiley.short) { 141 html+= '<option value="'+ smiley.short[j] +'" selected>'+ smiley.short[j] +'</option>'; 142 } 104 143 105 for (var j in smiley.short) { 106 html+= '<option value="'+ smiley.short[j] +'" selected>'+ smiley.short[j] +'</option>'; 107 } 108 109 html+= '</select>' 110 +'</td>' 111 +'</tr>'; 112 } 144 html+= 145 '</select>' 146 +'</td>'; 147 148 html+= (i+1)%2==0 ? '</tr><tr>' : '<td></td>'; 149 i++; 150 } 151 152 html+= '</tr>'; 153 154 jQuery(".reset").show(); 113 155 } 114 156 … … 128 170 onAdd: function(item) { 129 171 edited = true; 130 var file = $(this).parent s("tr").data("file");172 var file = $(this).parent("td").data("file"); 131 173 132 174 if (data.smilies[file].short == null) { … … 139 181 onDelete: function(item) { 140 182 edited = true; 141 var file = $(this).parent s("tr").data("file");183 var file = $(this).parent("td").data("file"); 142 184 143 185 for (var i in data.smilies[file].short) { … … 191 233 <a href="#" class="edit buttonLike">{'Edit shorcuts'|@translate}</a> 192 234 <table id="preview"></table> 235 <a href="#" class="reset buttonLike" style="display:none;">{'Reset defaults'|@translate}</a> 193 236 </fieldset> 194 237 -
extensions/SmiliesSupport/template/style.css
r23234 r23236 6 6 } 7 7 8 .token-input-list li { 9 clear:none !important; 10 padding: 1px 3px !important; 11 margin-bottom: 3px !important; 8 .token-input-list { 9 width:250px !important; 12 10 } 11 .token-input-list li { 12 clear:none !important; 13 padding: 1px 3px !important; 14 margin-bottom: 3px !important; 15 } 13 16 14 17 table#preview { 15 margin:10px 0 0 0;18 margin:10px 0; 16 19 } 20 table#preview .spacer { 21 width:30px; 22 } 17 23 18 input , select {24 input[type=text], select, .token-input-list { 19 25 border-radius:3px; 20 26 }
Note: See TracChangeset
for help on using the changeset viewer.