92 lines
3.7 KiB
Diff
92 lines
3.7 KiB
Diff
|
--- upm_file_popper-0.2.2.orig 2016-01-01 17:13:48.000000000 +0100
|
||
|
+++ upm_file_popper-0.2.2.new 2016-01-01 17:13:48.000000000 +0100
|
||
|
@@ -1,6 +1,6 @@
|
||
|
-if (txpinterface == 'admin')
|
||
|
+if (@txpinterface == 'admin')
|
||
|
{
|
||
|
add_privs('upm_file_popper', '1,2,3,4,5');
|
||
|
register_callback('upm_file_popper', 'upm_file_popper');
|
||
|
|
||
|
add_privs('upm_file_popper_link', '1,2,3,4,5');
|
||
|
@@ -9,12 +9,25 @@
|
||
|
add_privs('upm_file_popper_js', '1,2,3,4,5');
|
||
|
register_callback('upm_file_popper_js', 'upm_file_popper_js', '', 1);
|
||
|
|
||
|
add_privs('upm_file_popper_img', '1,2,3,4,5');
|
||
|
register_callback('upm_file_popper_img', 'upm_file_popper_img', '', 1);
|
||
|
+
|
||
|
+ register_callback('upm_file_popper_menu', 'article_ui', 'extend_col_1');
|
||
|
+
|
||
|
}
|
||
|
|
||
|
+ /**
|
||
|
+ * Insert upm_file_popper link in column 1 on the write-tab
|
||
|
+ *
|
||
|
+ * @param string $event (article_ui)
|
||
|
+ * @param string $step (extend_col_1)
|
||
|
+ */
|
||
|
+ function upm_file_popper_menu($event, $step) {
|
||
|
+ return '<div id="qupm_file_popper_group"><h3 class="plain lever"><a href="#qupm_file_popper-link">'.upm_file_popper_gTxt('attach_file').'</a></h3><div id="qupm_file_popper-link" class="toggle" style="display:none"><ul class="qupm_file_popper plain-list"><li><a id="qupm_file_popper-open" class="qupm_file_popper-open" href="#" onclick="myFunction();return false;">'.upm_file_popper_gTxt('attach_file').'</a></li></ul></div><script>function myFunction() {var w=700;var h=700;var t = (screen.height) ? (screen.height - h) / 2 : 0;var l = (screen.width) ? (screen.width - w) / 2 : 0;window.open("?event=upm_file_popper&bm=1&sort=id&dir=desc", "upm_file_popper", "menubar=0,toolbar=0,resizable=1,top="+t+",left="+l+",width="+w+",height="+h+"");}</script></div>';
|
||
|
+ }
|
||
|
+
|
||
|
// -------------------------------------------------------------
|
||
|
|
||
|
function upm_file_popper()
|
||
|
{
|
||
|
global $step, $prefs;
|
||
|
@@ -88,13 +101,14 @@
|
||
|
|
||
|
<script type="text/javascript" src="index.php?event=upm_file_popper_js&name=pop"></script>
|
||
|
css;
|
||
|
|
||
|
extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
|
||
|
+ if ($sort === '') $sort = get_pref('file_sort_column', 'filename');
|
||
|
+ if ($dir === '') $dir = get_pref('file_sort_dir', 'asc');
|
||
|
+ $dir = ($dir == 'desc') ? 'desc' : 'asc';
|
||
|
|
||
|
- $dir = ($dir == 'desc') ? 'desc' : 'asc';
|
||
|
-
|
||
|
switch ($sort)
|
||
|
{
|
||
|
case 'id':
|
||
|
$sort_sql = "id $dir, filename asc";
|
||
|
break;
|
||
|
@@ -183,11 +197,11 @@
|
||
|
|
||
|
if ($rs)
|
||
|
{
|
||
|
$sort_link = 'upm_file_popper'.a.'bm=true';
|
||
|
|
||
|
- echo startTable('list'),
|
||
|
+ echo startTable('','','txp-list'),
|
||
|
tr(
|
||
|
column_head('ID', 'id', $sort_link, true, $switch_dir, $crit, $search_method).
|
||
|
column_head('file_name', 'filename', $sort_link, true, $switch_dir, $crit, $search_method).
|
||
|
column_head('description', 'description', $sort_link, true, $switch_dir, $crit, $search_method).
|
||
|
column_head('file_category', 'category', $sort_link, true, $switch_dir, $crit, $search_method).
|
||
|
@@ -397,21 +411,21 @@
|
||
|
$('#upm_file_popper_start').val( $('body').val() );
|
||
|
|
||
|
// ------------------------------
|
||
|
// create and insert popup link
|
||
|
|
||
|
- var w = 575;
|
||
|
- var h = 375;
|
||
|
+ var w = 800;
|
||
|
+ var h = 500;
|
||
|
|
||
|
var t = (screen.height) ? (screen.height - h) / 2 : 0;
|
||
|
var l = (screen.width) ? (screen.width - w) / 2 : 0;
|
||
|
|
||
|
var a = $(document.createElement('a')).
|
||
|
text('$lang_attach_file').
|
||
|
attr({
|
||
|
target: '_blank',
|
||
|
- href: '?event=upm_file_popper\u0026bm=1'
|
||
|
+ href: '?event=upm_file_popper\u0026bm=1\u0026sort=id\u0026dir=desc'
|
||
|
}).
|
||
|
click(function () {
|
||
|
var upm_file_popper = window.open(this.href, 'upm_file_popper', 'top = '+t+', left = '+l+', width = '+w+', height = '+h+', toolbar = no, location = no, directories = no, status = yes, menubar = no, scrollbars = yes, copyhistory = no, resizable = yes');
|
||
|
upm_file_popper.focus();
|
||
|
return false;
|