| 1 |
var lists={ |
| 2 |
title:"List Group Shortcode", |
| 3 |
id :'oscitas-form-lists', |
| 4 |
pluginName: 'lists' |
| 5 |
}; |
| 6 |
(function() { |
| 7 |
_create_tinyMCE_options(lists); |
| 8 |
})(); |
| 9 |
|
| 10 |
function ebs_return_html_lists(pluginObj){ |
| 11 |
var form = jQuery('<div id="'+pluginObj.id+'" class="oscitas-container" title="'+pluginObj.title+'"><table id="oscitas-table" class="form-table ebs-default-options">\ |
| 12 |
<tr>\ |
| 13 |
<th><label for="oscitas-type">'+ebsjstrans.list+' '+ebsjstrans.style+'</label></th>\ |
| 14 |
<td><select name="type" id="oscitas-type">\ |
| 15 |
<option value="">None</option>\ |
| 16 |
<option value="glyphicon-arrow-right">'+ebsjstrans.arrow+'</option>\ |
| 17 |
<option value="glyphicon-ok">'+ebsjstrans.check+'</option>\ |
| 18 |
<option value="glyphicon-plus">'+ebsjstrans.plus+'</option>\ |
| 19 |
<option value="glyphicon-minus">'+ebsjstrans.minus+'</option>\ |
| 20 |
</select><br />\ |
| 21 |
</td>\ |
| 22 |
</tr>\ |
| 23 |
<tr>\ |
| 24 |
<th><label for="oscitas-line">'+ebsjstrans.noof+' '+ebsjstrans.list+' '+ebsjstrans.item+'</label></th>\ |
| 25 |
<td><input type="text" name="line" id="oscitas-list-item" value="3"/><br /><small>'+ebsjstrans.enternumval+'</small>\ |
| 26 |
</td>\ |
| 27 |
</tr>\ |
| 28 |
<tr>\ |
| 29 |
<th><label for="oscitas-list-class">'+ebsjstrans.customclass+':</label></th>\ |
| 30 |
<td><input type="text" name="line" id="oscitas-list-class" value=""/><br />\ |
| 31 |
</td>\ |
| 32 |
</tr>\ |
| 33 |
</table>\ |
| 34 |
<p class="submit ebs-default-options">\ |
| 35 |
<input type="button" id="oscitas-submit" class="button-primary" value="'+ebsjstrans.insert+' '+ebsjstrans.list+'" name="submit" />\ |
| 36 |
</p>\ |
| 37 |
<div class="pro-version-image aligncenter" style="display: none;"><img src="'+ebs_url+'shortcode/lists/screenshot.jpg"/></div>\ |
| 38 |
</div>'); |
| 39 |
return form; |
| 40 |
} |
| 41 |
function create_oscitas_lists(pluginObj){ |
| 42 |
|
| 43 |
var form=jQuery(pluginObj.hashId); |
| 44 |
|
| 45 |
var table = form.find('table'); |
| 46 |
|
| 47 |
|
| 48 |
// handles the click event of the submit button |
| 49 |
form.find('#oscitas-submit').click(function(){ |
| 50 |
// defines the options and their default values |
| 51 |
// again, this is not the most elegant way to do this |
| 52 |
// but well, this gets the job done nonetheless |
| 53 |
var options = { |
| 54 |
'type' : 'arrow' |
| 55 |
},list=0,list_type; |
| 56 |
var cusclass=''; |
| 57 |
if(table.find('#oscitas-list-class').val()!=''){ |
| 58 |
cusclass= ' class="'+table.find('#oscitas-list-class').val()+'"'; |
| 59 |
} |
| 60 |
var shortcode = '['+$ebs_prefix+'list'+cusclass; |
| 61 |
var list_item=jQuery('#oscitas-list-item').val(); |
| 62 |
if(isNaN(list_item)==false){ |
| 63 |
list=list_item; |
| 64 |
} else{ |
| 65 |
list=3; |
| 66 |
} |
| 67 |
|
| 68 |
|
| 69 |
shortcode += ']<br/>'; |
| 70 |
if(table.find('#oscitas-type').val()!=''){ |
| 71 |
list_type=' type="'+table.find('#oscitas-type').val()+'"'; |
| 72 |
} |
| 73 |
else{ |
| 74 |
list_type=''; |
| 75 |
} |
| 76 |
for(var i=1;i<=list;i++){ |
| 77 |
shortcode +='['+$ebs_prefix+'li'+list_type+']your list content[/'+$ebs_prefix+'li]<br/>' |
| 78 |
} |
| 79 |
shortcode +='[/'+$ebs_prefix+'list]'; |
| 80 |
|
| 81 |
// inserts the shortcode into the active editor |
| 82 |
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode); |
| 83 |
|
| 84 |
close_dialogue(pluginObj.hashId); |
| 85 |
}); |
| 86 |
} |
| 87 |
|
| 88 |
|