From b8de20ef012aa7b4e2e4abcfa0a3d2c77d695d41 Mon Sep 17 00:00:00 2001 From: Redduck911 Date: Mon, 25 Feb 2013 13:54:13 +0600 Subject: [PATCH 01/14] =?UTF-8?q?=D0=A2=D0=B5=D1=81=D1=82=D0=BE=D0=B2?= =?UTF-8?q?=D1=8B=D0=B9=20=D1=84=D0=B0=D0=B9=D0=BB,=20=D0=B8=D1=81=D0=BF?= =?UTF-8?q?=D1=8B=D1=82=D1=8B=D0=B2=D0=B0=D1=8E.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README_RUS.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 README_RUS.txt diff --git a/README_RUS.txt b/README_RUS.txt new file mode 100644 index 0000000..92891fe --- /dev/null +++ b/README_RUS.txt @@ -0,0 +1 @@ +Ìîäèôèöèðîâàííûé HAK_TINYMCE \ No newline at end of file From cd302342d8424ebdffdc589f0210006f9256ad86 Mon Sep 17 00:00:00 2001 From: Andrew Lebedev Date: Mon, 25 Feb 2013 13:55:31 +0600 Subject: [PATCH 02/14] Update README_RUS.txt --- README_RUS.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README_RUS.txt b/README_RUS.txt index 92891fe..5580fb1 100644 --- a/README_RUS.txt +++ b/README_RUS.txt @@ -1 +1 @@ -Ìîäèôèöèðîâàííûé HAK_TINYMCE \ No newline at end of file +Модифицированный HAK_TINYMCE From 3aae06e1f53c3fc7acbc9b1a33848328641b3b6c Mon Sep 17 00:00:00 2001 From: Redduck911 Date: Mon, 25 Feb 2013 15:15:24 +0600 Subject: [PATCH 03/14] =?UTF-8?q?=D0=A3=D0=B2=D0=B5=D0=BB=D0=B8=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D1=88=D0=B8=D1=80=D0=B8=D0=BD=D0=B0=20?= =?UTF-8?q?=D0=B8=20=D0=B2=D1=8B=D1=81=D0=BE=D1=82=D0=B0=20=D0=BE=D0=BA?= =?UTF-8?q?=D0=BD=D0=B0=20Increase=20the=20width=20and=20height=20of=20the?= =?UTF-8?q?=20window?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- txpimage/editor_plugin.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/txpimage/editor_plugin.js b/txpimage/editor_plugin.js index cb3fa49..92e513e 100644 --- a/txpimage/editor_plugin.js +++ b/txpimage/editor_plugin.js @@ -19,8 +19,8 @@ ed.windowManager.open({ file : url + '/image.htm', - width : 480 + parseInt(ed.getLang('advimage.delta_width', 0), 10), - height : 480 + parseInt(ed.getLang('advimage.delta_height', 0), 10), + width : 530 + parseInt(ed.getLang('advimage.delta_width', 0), 10), + height : 510 + parseInt(ed.getLang('advimage.delta_height', 0), 10), inline : 1 }, { plugin_url : url From d199d54a21a3b76aec8fc4057fe09a7f098f420a Mon Sep 17 00:00:00 2001 From: Redduck911 Date: Mon, 25 Feb 2013 15:17:38 +0600 Subject: [PATCH 04/14] =?UTF-8?q?=D0=B4=D0=BE=D0=BF=D0=BE=D0=BB=D0=BD?= =?UTF-8?q?=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B=D0=B5=20=D1=81=D1=82?= =?UTF-8?q?=D0=B8=D0=BB=D0=B8=20more=20styles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- txpimage/css/txpimage.css | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/txpimage/css/txpimage.css b/txpimage/css/txpimage.css index ff7de93..5488a2f 100644 --- a/txpimage/css/txpimage.css +++ b/txpimage/css/txpimage.css @@ -72,4 +72,7 @@ input {width: 280px;} border:1px solid silver; background:white; } - +#left_panel{float:left;width:140px;} +#labelCategory, #labelAuthor, #labelLimit {font-size: 8px;} +ul.pagination {margin: 1em 0; padding: 0.5em; text-align: left;} +ul.pagination li {display: inline; padding: 0.1em; border:none;} From bc35ba761d94851a0a5b11dddb765c2cb22bf783 Mon Sep 17 00:00:00 2001 From: Redduck911 Date: Mon, 25 Feb 2013 15:26:55 +0600 Subject: [PATCH 05/14] =?UTF-8?q?=D0=B4=D0=BE=D0=BF=D0=BE=D0=BB=D0=BD?= =?UTF-8?q?=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D0=B0=D1=8F=20=D0=B8=D0=BA?= =?UTF-8?q?=D0=BE=D0=BD=D0=BA=D0=B0=20=D0=B4=D0=BB=D1=8F=20fancybox=20Addi?= =?UTF-8?q?tional=20icons=20for=20the=20fancybox?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- txpimage/img/picturef.png | Bin 0 -> 604 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 txpimage/img/picturef.png diff --git a/txpimage/img/picturef.png b/txpimage/img/picturef.png new file mode 100644 index 0000000000000000000000000000000000000000..791212fb203349a1d5f4ee8dc57feb3212b06761 GIT binary patch literal 604 zcmV-i0;BzjP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_0005+Nkl& z|9OEg-vTOOL__t6?5f+g;mE!$V~2Nj0?mF8ICCP8=XnTW{WW{2AyQ4Ay_rt}RcjHh z>+$4OK*$OeF+*{93EwHBjAnJ+=hN&~(&ivGS#Dk`qO?f1)>I&+g%r?`C5pKv+|*af z^$IFd*sjaS?mY8zTNq5`(7F#t02+`|P&dn@oPf1jnR*n`Pzq%>a9x*;x=+@Z7)%Fo zNgyFGN^|At?VkKxdw3sP3c6L(F@9rOKpxwfe0?uIzcqcHJ1;K-kVzG=ED1*RZ_Sui zYZ+@N3#G;Qd_W9QT}^X+@)6n02(}dcb!6IsoE;SWV{y>L*(m_-K7B{V%M)qcEvsZj zGb`gnS`)R6<-^oP=6)>mqB? Date: Mon, 25 Feb 2013 16:19:19 +0600 Subject: [PATCH 06/14] =?UTF-8?q?=D0=A2=D0=B5=D1=81=D1=82=D0=BE=D0=B2?= =?UTF-8?q?=D1=8B=D0=B9=20=D1=84=D0=B0=D0=B9=D0=BB,=20=D0=B8=D1=81=D0=BF?= =?UTF-8?q?=D1=8B=D1=82=D1=8B=D0=B2=D0=B0=D1=8E.=20(reverse-merged=20from?= =?UTF-8?q?=20commit=20b8de20ef012aa7b4e2e4abcfa0a3d2c77d695d41)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README_RUS.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 README_RUS.txt diff --git a/README_RUS.txt b/README_RUS.txt deleted file mode 100644 index 5580fb1..0000000 --- a/README_RUS.txt +++ /dev/null @@ -1 +0,0 @@ -Модифицированный HAK_TINYMCE From de01aa0e76cff235284ceb049987a6c428d318fe Mon Sep 17 00:00:00 2001 From: Redduck911 Date: Tue, 26 Feb 2013 15:08:41 +0600 Subject: [PATCH 07/14] =?UTF-8?q?=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- txpimage/js/txpimage.js | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/txpimage/js/txpimage.js b/txpimage/js/txpimage.js index 3d148b6..733803e 100644 --- a/txpimage/js/txpimage.js +++ b/txpimage/js/txpimage.js @@ -464,18 +464,46 @@ var TxpImageDialog = { success: function (response) { tinyMCEPopup.dom.setHTML('catselect', response); tinymce.dom.Event.add(tinyMCEPopup.dom.get('txpCategory'), 'change', function (e) { - this.loadImageBrowser(e.target.value); + tinyMCEPopup.dom.setHTML('image_browse', ''); + this.loadCountBrowser(e.target.value, tinyMCEPopup.dom.get('txpAuthor').value || '0', tinyMCEPopup.dom.get('txpLimitImages').value || '0', '0'); }, this); - this.loadImageBrowser(); + tinymce.dom.Event.add(tinyMCEPopup.dom.get('txpAuthor'), 'change', function (e) { + tinyMCEPopup.dom.setHTML('image_browse', ''); + this.loadCountBrowser(tinyMCEPopup.dom.get('txpCategory').value || '0', e.target.value, tinyMCEPopup.dom.get('txpLimitImages').value || '0', '0'); + }, this); + tinymce.dom.Event.add(tinyMCEPopup.dom.get('txpLimitImages'), 'change', function (e) { + tinyMCEPopup.dom.setHTML('image_browse', ''); + this.loadCountBrowser(tinyMCEPopup.dom.get('txpCategory').value || '0', tinyMCEPopup.dom.get('txpAuthor').value || '0', e.target.value, '0'); + }, this); + this.loadCountBrowser(); } }); }, + loadCountBrowser: function (category, author, limit, limcount) { + var selCat = category || ""; + var selAuthor = author || ""; + var selLimit = limit || 10; + var selLimCount = limcount || 0; + var src = tinyMCEPopup.dom.get('src').value || ''; + tinymce.util.XHR.send({ + url:this.txpEndPoint + '?event=hak_txpcountselect&src='+ src + '&c='+ selCat + '&a=' + selAuthor + '&limimg=' + selLimit + '&limcount=' + selLimCount + '&_rnd=' + new Date().getTime(), + type: 'GET', + scope: this, + success: function (response) { + tinyMCEPopup.dom.setHTML("imagesmax", response); + this.loadImageBrowser(selCat,selAuthor,selLimit,selLimCount); + } + }); + }, loadImageBrowser: function (category) { var selCat = category || ""; + var selAuthor = author || ""; + var selLimit = limit || 10; + var selLimCount = limcount || 0; var src = tinyMCEPopup.dom.get('src').value || ''; tinymce.util.XHR.send({ - url:this.txpEndPoint + '?event=hak_txpimage&src='+ src + '&c='+ selCat + '&_rnd=' + new Date().getTime(), + url:this.txpEndPoint + '?event=hak_txpimage&src='+ src + '&c='+ selCat + '&a=' + selAuthor + '&limimg=' + selLimit + '&limcount=' + selLimCount + '&_rnd=' + new Date().getTime(), type: 'GET', success: function (response) { tinyMCEPopup.dom.setHTML("image_browse", response); From d4a8ade50c9c0da0deaca370bf77d40107d1d546 Mon Sep 17 00:00:00 2001 From: Redduck911 Date: Fri, 1 Mar 2013 15:13:21 +0600 Subject: [PATCH 08/14] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=BD=D0=BE?= =?UTF-8?q?=D1=81=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hak_tinymce.php | 168 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 163 insertions(+), 5 deletions(-) diff --git a/hak_tinymce.php b/hak_tinymce.php index c7621ec..5a2222b 100644 --- a/hak_tinymce.php +++ b/hak_tinymce.php @@ -57,12 +57,13 @@ add_privs('hak_tinymce_compressor_js','1,2,3,4,5,6'); add_privs('hak_txpimage','1,2,3,4,5,6'); add_privs('hak_txpcatselect','1,2,3,4,5,6'); - + add_privs('hak_txpcountselect','1,2,3,4,5,6'); register_callback(array("hak_tinymce","js_prep"), "hak_tinymce_js"); register_callback(array("hak_tinymce","compressor_js_prep"), "hak_tinymce_compressor_js"); register_callback("hak_txpimage", "hak_txpimage"); register_callback("hak_txpcatselect", "hak_txpcatselect"); + register_callback("hak_txpcountselect", "hak_txpcountselect"); register_tab('extensions', 'hak_tinymce_prefs', 'hak_tinymce'); register_callback(array('hak_tinymce','prefs'), 'hak_tinymce_prefs'); @@ -557,7 +558,7 @@ function install() { $hak_mceSettings_default .= "theme_advanced_buttons3 : \"\",\n"; $hak_mceSettings_default .= "theme_advanced_toolbar_location : \"top\",\n"; $hak_mceSettings_default .= "theme_advanced_toolbar_align : \"left\","; - $hak_mceSettings_default .= "entity_encoding : \"numeric\","; + $hak_mceSettings_default .= "entity_encoding : \"raw\","; $hak_mceSettings_compressor = "theme : \"advanced\",\n"; $hak_mceSettings_compressor .= "plugins : \"searchreplace,txpimage\",\n"; @@ -656,7 +657,26 @@ function hak_compressor_path($file) { function hak_txpimage() { global $img_dir,$path_to_site,$txpcfg; $category = gps("c"); - $category = (!empty($category)) ? "and category='".doSlash($category)."'" : ""; + $author = gps("a"); + $limit_image = gps("limimg"); + $limit_img_count = gps("limcount"); + + if(empty($author) || $author=='0') { $author = ""; } + else { $author = " and author='".doSlash($author)."' "; } + if(empty($category) || $category=='0') { $category = ""; } + else { $category = " and category='".doSlash($category)."' "; } + + if(empty($limit_img_count)) { $limit_img_count = 0; } + else { $limit_img_count = intval($limit_img_count); } + if($limit_image=='0') { $limit_image = ""; } + elseif(empty($limit_image)) { $limit_image = " limit 0,10"; } + else { + if(intval($limit_image)==0) { $limit_image = " limit 0,10"; } + else { $limit_image = " limit ".$limit_img_count*intval($limit_image).",".intval($limit_image); } + } + $srcf2 = gps("srcf2"); + $srcf2 = (!empty($srcf2))? true : false; + $rs = safe_rows_start("*", "txp_image","1=1 ".$category." order by category,name"); $src = gps("src"); @@ -684,7 +704,11 @@ function hak_txpimage() { $thumb["caption"] = $image["caption"]; $preview = $thumb; $thumbclick = 'onclick=\'TxpImageDialog.insertImage(this,'.hak_tinymce::map_attribs($thumb).');return'.n.'false;\''; + $thumbclickf = 'onclick=\'TxpImageDialog.insertImage(this,'.hak_tinymce::map_attribsf($thumbf).');return'.n.'false;\''; $thumbclick = ''.hak_tinymce::mce_gTxt('insert_thumb').''; + if($srcf2) { + $thumbclick .= ''.hak_tinymce::mce_gTxt('insert_fancy').''; + } } //$desiredheight = $preview["height"]; @@ -719,16 +743,150 @@ function hak_txpimage() { } function hak_txpcatselect() { + global $img_dir,$path_to_site,$txpcfg; + $num = 10; + $category = gps("c"); + $author = gps("a"); + $limit_image = gps("limimg"); + $limit_img_count = gps("limcount"); + + if(empty($author) || $author=='0') { $author = ""; } + else { $author = " and author='".doSlash($author)."' "; } + if(empty($category) || $category=='0') { $category = ""; } + else { $category = " and category='".doSlash($category)."' "; } + $rs = getTree("root",'image'); + + $a_out = array(); + $a_out[] = array('name'=>'0','title'=>'All','level'=>0); + $rs_author = safe_rows_start("name, RealName", "txp_users","1=1"); + if($rs_author) { + while ($a = nextRow($rs_author)) { + extract($a); + $a_out[] = array('name'=>$name,'title'=>$RealName,'level'=>0); + } + } + + $lim_out = array(); + $lim_out[] = array('name'=>'0','title'=>'All','level'=>0); + $lim_out[] = array('name'=>'10','title'=>'10','level'=>0); + $lim_out[] = array('name'=>'20','title'=>'20','level'=>0); + $lim_out[] = array('name'=>'30','title'=>'30','level'=>0); + $lim_out[] = array('name'=>'50','title'=>'50','level'=>0); + + $t_ar = array("id"=>0,"name"=>'0',"title"=>'All',"level"=>0,"children"=>0,"parent"=>'root'); + array_unshift($rs, $t_ar); + if ($rs) { - echo tag(gTxt('category'),"legend"). - treeSelectInput("category",$rs,"","txpCategory"); + echo '

'. + treeSelectInput2("category",$rs,"0","txpCategory"). + '

'. + treeSelectInput2("author",$a_out,"0","txpAuthor").'
'. + '
'. + '
'. + treeSelectInput2("LimitImages",$lim_out,"10","txpLimitImages").'
'; } exit(0); } +function hak_txpcountselect() { + global $img_dir,$path_to_site,$txpcfg; + $num = 10; + $category = gps("c"); + $author = gps("a"); + $limit_image = gps("limimg"); + $limit_img_count = gps("limcount"); + + if(empty($author) || $author=='0') { $author = ""; } + else { $author = " and author='".doSlash($author)."' "; } + if(empty($category) || $category=='0') { $category = ""; } + else { $category = " and category='".doSlash($category)."' "; } + + if(empty($limit_img_count)) { $limit_img_count = 0; } + else { $limit_img_count = intval($limit_img_count); } + + if($limit_image=='0') { $limit_image = 1; } + elseif(empty($limit_image)) { $limit_image = 10; } + else { $limit_image = (intval($limit_image)==0)? 1 : intval($limit_image); } + + $rcount = safe_count("txp_image", "1=1 ".$category.$author); + $count = 0; $min_count = 0; $max_count = 0; $lim_count_out = array(); + $count = ceil($rcount/$limit_image); + if($count<=$num) { $min_count = 0; $max_count = $count; } + else { + if($limit_img_count-5>0) { $min_count = $limit_img_count-4; } + else { $min_count = 0; } + if($limit_img_count+5>$count) { $max_count = $count; } + else { $max_count = $limit_img_count+5; } + } + for($i=0; $i<$count; $i++) { + $lim_count_out[] = array('count_li'=>$i); + } + if ($rcount>$limit_image && $limit_image>1) { echo liLinks2($lim_count_out, $limit_img_count, $count, $min_count, $max_count, 10); } + else { echo ''; } + exit(0); +} +function treeSelectInput2($select_name = '', $array = '', $value = '', $select_id = '', $truncate = 0) { + $out = array(); + $selected = false; + foreach ($array as $a) + { + if ($a['name'] == 'root') + { + continue; + } + extract($a); + if ($name == $value) + { + $sel = ' selected="selected"'; + $selected = true; + } + else + { + $sel = ''; + } + $sp = str_repeat(sp.sp, $level); + + if (($truncate > 3) && (strlen(utf8_decode($title)) > $truncate)) { + $htmltitle = ' title="'.htmlspecialchars($title).'"'; + $title = preg_replace('/^(.{0,'.($truncate - 3).'}).*$/su','$1',$title); + $hellip = '…'; + } else { + $htmltitle = $hellip = ''; + } + $out[] = n.t.''; + } + return n.''. + ( $out ? join('', $out) : ''). + n.''; +} +function liLinks2($array = '', $value = '', $count = 0, $min_count = 0, $max_count = 0, $num = 10) { + $out = array(); + if($count>0) { + foreach ($array as $a) { + extract($a); + if($count_li == $value) { $class = ' class="li_links active"'; } + else { $class = ' class="li_links"'; } + if($count_li>=$min_count && $count_li<=$max_count) { + $out[$count_li] = n.t.'
  • '.htmlspecialchars($count_li + 1).'
  • '; + } + if($count_li==$max_count) { break; } + } + if($count>$num && $out) { + $out[-1] = n.t.'
  • «
  • '; + $tmin = ($min_count-1<0)? 0 : $min_count-1; + $out[$tmin] = n.t.'
  • <
  • '; + $tmax = ($max_count+1>$count)? $count : $max_count+1; + $out[$tmax] = n.t.'
  • »
  • '; + $out[$count+1] = n.t.'
  • »
  • '; + } + } + return n.'
      '. + ( $out ? join('', $out) : '' ). + n.'
    '; +} # --- END PLUGIN CODE --- if (0) { ?> From 3e27f9ab5751e6e9cd18af95b03bd8e4123ddc75 Mon Sep 17 00:00:00 2001 From: Redduck911 Date: Fri, 1 Mar 2013 16:26:36 +0600 Subject: [PATCH 09/14] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=BF=D0=B0=D0=B3=D0=B8=D0=BD=D0=B0=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hak_tinymce.php | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/hak_tinymce.php b/hak_tinymce.php index 5a2222b..a949817 100644 --- a/hak_tinymce.php +++ b/hak_tinymce.php @@ -867,26 +867,31 @@ function liLinks2($array = '', $value = '', $count = 0, $min_count = 0, $max_cou if($count>0) { foreach ($array as $a) { extract($a); - if($count_li == $value) { $class = ' class="li_links active"'; } + if($count_li == $value) { $class = ' class="li_links active" style="font-weight: bold;color:red;" '; } else { $class = ' class="li_links"'; } - if($count_li>=$min_count && $count_li<=$max_count) { - $out[$count_li] = n.t.'
  • '.htmlspecialchars($count_li + 1).'
  • '; + if($count_li>=($min_count-1) && $count_li<=$max_count) { + $out[] = n.t.'
  • '.htmlspecialchars($count_li + 1).'
  • '; } if($count_li==$max_count) { break; } } if($count>$num && $out) { - $out[-1] = n.t.'
  • «
  • '; + $out2x = n.t.'
  • «
  • '; $tmin = ($min_count-1<0)? 0 : $min_count-1; - $out[$tmin] = n.t.'
  • <
  • '; - $tmax = ($max_count+1>$count)? $count : $max_count+1; - $out[$tmax] = n.t.'
  • »
  • '; - $out[$count+1] = n.t.'
  • »
  • '; + $value_min = ($value-1<0)? 0 : $value-1; + $out1x = n.t.'
  • <
  • '; + array_unshift($out, $out1x, $out2x); + //$tmax = ($max_count+1>$count)? $count-1 : $max_count+1; + $value_max = ($value+1>=$count)? $count-1 : $value+1; + $out[$count] = n.t.'
  • >
  • '; + $count2 = $count-1; + $out[$count+1] = n.t.'
  • »
  • '; } } return n.'
      '. ( $out ? join('', $out) : '' ). - n.'
    '; + n.''; } + # --- END PLUGIN CODE --- if (0) { ?> From 8a844c21e15aeffc6f7d8992741cdf3095ee2ca9 Mon Sep 17 00:00:00 2001 From: Redduck911 Date: Sun, 3 Mar 2013 12:59:04 +0600 Subject: [PATCH 10/14] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hak_tinymce.php | 45 +++++++++++++++++++++++++++++------------ txpimage/js/txpimage.js | 2 +- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/hak_tinymce.php b/hak_tinymce.php index a949817..d0612f1 100644 --- a/hak_tinymce.php +++ b/hak_tinymce.php @@ -639,9 +639,21 @@ function map_attribs($arr) { $format .= (!empty($arr["height"])) ? ',height:'.$arr["height"] : ''; $format .= (!empty($arr["alt"])) ? ',alt:"'.$arr["alt"].'"' : ''; $format .= (!empty($arr["title"])) ? ',title:"'.$arr["title"].'"' : ''; + $format .= ',srcf:""'; $format .= '}'; return $format; } + + function map_attribsf($arr) { + $format = '{src:"'.$arr["path"].'"'; + $format .= (!empty($arr["width"])) ? ',width:'.$arr["width"] : ''; + $format .= (!empty($arr["height"])) ? ',height:'.$arr["height"] : ''; + $format .= (!empty($arr["alt"])) ? ',alt:"'.$arr["alt"].'"' : ''; + $format .= (!empty($arr["title"])) ? ',title:"'.$arr["title"].'"' : ''; + $format .= (!empty($arr["srcf"])) ? ',srcf:"'.$arr["srcf"].'"' : ''; + $format .= '}'; + return $format; + } } //--- End Class //---------------------------------------- @@ -661,9 +673,9 @@ function hak_txpimage() { $limit_image = gps("limimg"); $limit_img_count = gps("limcount"); - if(empty($author) || $author=='0') { $author = ""; } + if(empty($author)) { $author = ""; } else { $author = " and author='".doSlash($author)."' "; } - if(empty($category) || $category=='0') { $category = ""; } + if(empty($category)) { $category = ""; } else { $category = " and category='".doSlash($category)."' "; } if(empty($limit_img_count)) { $limit_img_count = 0; } @@ -677,7 +689,7 @@ function hak_txpimage() { $srcf2 = gps("srcf2"); $srcf2 = (!empty($srcf2))? true : false; - $rs = safe_rows_start("*", "txp_image","1=1 ".$category." order by category,name"); + $rs = safe_rows_start("*", "txp_image","1=1 ".$category.$author." order by id desc,category,name".$limit_image); $src = gps("src"); @@ -702,13 +714,19 @@ function hak_txpimage() { $thumb["height"] = $thumb_h; $thumb["alt"] = $image["alt"]; $thumb["caption"] = $image["caption"]; + $thumbf["path"] = hu.$img_dir.'/'.$id.'t'.$ext; + $thumbf["width"] = $thumb_w; + $thumbf["height"] = $thumb_h; + $thumbf["alt"] = $image["alt"]; + $thumbf["caption"] = $image["caption"]; + $thumbf["srcf"] = $image["path"]; $preview = $thumb; $thumbclick = 'onclick=\'TxpImageDialog.insertImage(this,'.hak_tinymce::map_attribs($thumb).');return'.n.'false;\''; $thumbclickf = 'onclick=\'TxpImageDialog.insertImage(this,'.hak_tinymce::map_attribsf($thumbf).');return'.n.'false;\''; $thumbclick = ''.hak_tinymce::mce_gTxt('insert_thumb').''; - if($srcf2) { + //if($srcf2) { $thumbclick .= ''.hak_tinymce::mce_gTxt('insert_fancy').''; - } + //} } //$desiredheight = $preview["height"]; @@ -768,7 +786,7 @@ function hak_txpcatselect() { } $lim_out = array(); - $lim_out[] = array('name'=>'0','title'=>'All','level'=>0); + $lim_out[] = array('name'=>'0','title'=>'All','level'=>0); $lim_out[] = array('name'=>'10','title'=>'10','level'=>0); $lim_out[] = array('name'=>'20','title'=>'20','level'=>0); $lim_out[] = array('name'=>'30','title'=>'30','level'=>0); @@ -812,16 +830,17 @@ function hak_txpcountselect() { $count = 0; $min_count = 0; $max_count = 0; $lim_count_out = array(); $count = ceil($rcount/$limit_image); if($count<=$num) { $min_count = 0; $max_count = $count; } - else { - if($limit_img_count-5>0) { $min_count = $limit_img_count-4; } - else { $min_count = 0; } - if($limit_img_count+5>$count) { $max_count = $count; } - else { $max_count = $limit_img_count+5; } + elseif($limit_img_count>$count) { $min_count=($count-$num>0)? $count-$num: 0; $max_count = $count; } + elseif($count<$num) { $min_count=0; $max_count=$count; } + else{ + $pol = ceil($num/2); + $max_count=($limit_img_count+$pol>=$count)? $count : (($limit_img_count+$pol<=$num)? $num : $limit_img_count+$pol); + $min_count=($limit_img_count-$pol<=0)? 0 : (($max_count-$num>0)? $max_count-$num : $limit_img_count-$pol); } for($i=0; $i<$count; $i++) { $lim_count_out[] = array('count_li'=>$i); } - if ($rcount>$limit_image && $limit_image>1) { echo liLinks2($lim_count_out, $limit_img_count, $count, $min_count, $max_count, 10); } + if ($rcount>$limit_image && $limit_image>1) { echo liLinks2($lim_count_out, $limit_img_count, $count, $min_count, $max_count, $num); } else { echo ''; } exit(0); } @@ -879,7 +898,7 @@ function liLinks2($array = '', $value = '', $count = 0, $min_count = 0, $max_cou $tmin = ($min_count-1<0)? 0 : $min_count-1; $value_min = ($value-1<0)? 0 : $value-1; $out1x = n.t.'
  • <
  • '; - array_unshift($out, $out1x, $out2x); + array_unshift($out, $out2x, $out1x); //$tmax = ($max_count+1>$count)? $count-1 : $max_count+1; $value_max = ($value+1>=$count)? $count-1 : $value+1; $out[$count] = n.t.'
  • >
  • '; diff --git a/txpimage/js/txpimage.js b/txpimage/js/txpimage.js index 733803e..c908b2c 100644 --- a/txpimage/js/txpimage.js +++ b/txpimage/js/txpimage.js @@ -495,7 +495,7 @@ var TxpImageDialog = { } }); }, - loadImageBrowser: function (category) { + loadImageBrowser: function (category, author, limit, limcount) { var selCat = category || ""; var selAuthor = author || ""; var selLimit = limit || 10; From fdfa03883b725dfe44a51adea5a418aae5c8a7e6 Mon Sep 17 00:00:00 2001 From: Redduck911 Date: Sun, 3 Mar 2013 13:16:05 +0600 Subject: [PATCH 11/14] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BE?= =?UTF-8?q?=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hak_tinymce.php | 4 ++-- txpimage/js/txpimage.js | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/hak_tinymce.php b/hak_tinymce.php index d0612f1..bb4cef6 100644 --- a/hak_tinymce.php +++ b/hak_tinymce.php @@ -724,9 +724,9 @@ function hak_txpimage() { $thumbclick = 'onclick=\'TxpImageDialog.insertImage(this,'.hak_tinymce::map_attribs($thumb).');return'.n.'false;\''; $thumbclickf = 'onclick=\'TxpImageDialog.insertImage(this,'.hak_tinymce::map_attribsf($thumbf).');return'.n.'false;\''; $thumbclick = ''.hak_tinymce::mce_gTxt('insert_thumb').''; - //if($srcf2) { + if($srcf2) { $thumbclick .= ''.hak_tinymce::mce_gTxt('insert_fancy').''; - //} + } } //$desiredheight = $preview["height"]; diff --git a/txpimage/js/txpimage.js b/txpimage/js/txpimage.js index c908b2c..e71f138 100644 --- a/txpimage/js/txpimage.js +++ b/txpimage/js/txpimage.js @@ -38,6 +38,7 @@ var TxpImageDialog = { nl.usemap.value = dom.getAttrib(n, 'usemap'); nl.longdesc.value = dom.getAttrib(n, 'longdesc'); nl.insert.value = ed.getLang('update'); + nl.srcf2.value = '0'; if (/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/.test(dom.getAttrib(n, 'onmouseover'))) { nl.onmouseoversrc.value = dom.getAttrib(n, 'onmouseover').replace(/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/, '$1'); @@ -166,6 +167,11 @@ var TxpImageDialog = { longdesc : nl.longdesc.value }); + tinymce.extend(argsf, { + href : nl.srcf.value, + 'class' : 'fancybox' + }); + args.onmouseover = args.onmouseout = ''; if (f.onmousemovecheck.checked) { @@ -501,9 +507,10 @@ var TxpImageDialog = { var selLimit = limit || 10; var selLimCount = limcount || 0; var src = tinyMCEPopup.dom.get('src').value || ''; + var srcf2 = tinyMCEPopup.dom.get('srcf2').value || ''; tinymce.util.XHR.send({ - url:this.txpEndPoint + '?event=hak_txpimage&src='+ src + '&c='+ selCat + '&a=' + selAuthor + '&limimg=' + selLimit + '&limcount=' + selLimCount + '&_rnd=' + new Date().getTime(), + url:this.txpEndPoint + '?event=hak_txpimage&src='+ src + '&c='+ selCat + '&a=' + selAuthor + '&limimg=' + selLimit + '&limcount=' + selLimCount + '&srcf2=' + srcf2 + '&_rnd=' + new Date().getTime(), type: 'GET', success: function (response) { tinyMCEPopup.dom.setHTML("image_browse", response); From 7dfc43f74e9c733888a1f2b5372fef0ca932d57c Mon Sep 17 00:00:00 2001 From: Redduck911 Date: Sun, 3 Mar 2013 13:32:14 +0600 Subject: [PATCH 12/14] =?UTF-8?q?=D0=BC=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- txpimage/image.htm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/txpimage/image.htm b/txpimage/image.htm index f89fb69..f0dacfc 100644 --- a/txpimage/image.htm +++ b/txpimage/image.htm @@ -33,7 +33,9 @@ - + + + From a2d89d1f58584146df21620fb9c89c33dfb2f1f7 Mon Sep 17 00:00:00 2001 From: Redduck911 Date: Sun, 3 Mar 2013 13:45:14 +0600 Subject: [PATCH 13/14] errors --- txpimage/js/txpimage.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/txpimage/js/txpimage.js b/txpimage/js/txpimage.js index e71f138..e1a87ea 100644 --- a/txpimage/js/txpimage.js +++ b/txpimage/js/txpimage.js @@ -127,7 +127,7 @@ var TxpImageDialog = { }, insertAndClose : function() { - var ed = tinyMCEPopup.editor, f = document.forms[0], nl = f.elements, v, args = {}, el; + var ed = tinyMCEPopup.editor, f = document.forms[0], nl = f.elements, v, args = {}, argsf = {}, el; tinyMCEPopup.restoreSelection(); @@ -188,11 +188,20 @@ var TxpImageDialog = { if (el && el.nodeName == 'IMG') { ed.dom.setAttribs(el, args); } else { - ed.execCommand('mceInsertContent', false, '', {skip_undo : 1}); - ed.dom.setAttribs('__mce_tmp', args); - ed.dom.setAttrib('__mce_tmp', 'id', ''); - ed.undoManager.add(); - } + if(argsf.href != "") { + ed.execCommand('mceInsertContent', false, '', {skip_undo : 1}); + ed.dom.setAttribs('__mce_tmp', args); + ed.dom.setAttrib('__mce_tmp', 'id', ''); + ed.dom.setAttribs('__mce_tmp_a', argsf); + ed.dom.setAttrib('__mce_tmp_a', 'id', ''); + ed.undoManager.add(); + } else { + ed.execCommand('mceInsertContent', false, '', {skip_undo : 1}); + ed.dom.setAttribs('__mce_tmp', args); + ed.dom.setAttrib('__mce_tmp', 'id', ''); + ed.undoManager.add(); + } + } tinyMCEPopup.close(); }, From b1ea7f01c7b61b30ce2a39ce3e353b75b426d563 Mon Sep 17 00:00:00 2001 From: Redduck911 Date: Sun, 3 Mar 2013 14:12:30 +0600 Subject: [PATCH 14/14] =?UTF-8?q?=D0=BC=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- txpimage/js/txpimage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/txpimage/js/txpimage.js b/txpimage/js/txpimage.js index e1a87ea..40605e9 100644 --- a/txpimage/js/txpimage.js +++ b/txpimage/js/txpimage.js @@ -516,7 +516,7 @@ var TxpImageDialog = { var selLimit = limit || 10; var selLimCount = limcount || 0; var src = tinyMCEPopup.dom.get('src').value || ''; - var srcf2 = tinyMCEPopup.dom.get('srcf2').value || ''; + var srcf2 = tinyMCEPopup.dom.get('srcf2').value || 1; tinymce.util.XHR.send({ url:this.txpEndPoint + '?event=hak_txpimage&src='+ src + '&c='+ selCat + '&a=' + selAuthor + '&limimg=' + selLimit + '&limcount=' + selLimCount + '&srcf2=' + srcf2 + '&_rnd=' + new Date().getTime(),