From 9e38d4e0302574b2f886c676e99e32eb39031003 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20St=C3=B6ckel?= Date: Sat, 26 Feb 2011 19:21:55 +0000 Subject: [PATCH] Added some forgotten files --- phpgwapi/js/egw_action/egw_action_popup.js | 194 ++++++++++++++++++ phpgwapi/js/egw_action/test/imgs/compress.png | Bin 0 -> 766 bytes phpgwapi/js/egw_action/test/imgs/delete.png | Bin 0 -> 715 bytes phpgwapi/js/egw_action/test/imgs/edit.png | Bin 0 -> 450 bytes phpgwapi/js/egw_action/test/imgs/email.png | Bin 0 -> 641 bytes phpgwapi/js/egw_action/test/imgs/preview.png | Bin 0 -> 589 bytes phpgwapi/js/egw_action/test/imgs/view.png | Bin 0 -> 615 bytes phpgwapi/js/egw_action/test/test_action.html | 2 +- 8 files changed, 195 insertions(+), 1 deletion(-) create mode 100644 phpgwapi/js/egw_action/egw_action_popup.js create mode 100755 phpgwapi/js/egw_action/test/imgs/compress.png create mode 100755 phpgwapi/js/egw_action/test/imgs/delete.png create mode 100755 phpgwapi/js/egw_action/test/imgs/edit.png create mode 100755 phpgwapi/js/egw_action/test/imgs/email.png create mode 100755 phpgwapi/js/egw_action/test/imgs/preview.png create mode 100755 phpgwapi/js/egw_action/test/imgs/view.png diff --git a/phpgwapi/js/egw_action/egw_action_popup.js b/phpgwapi/js/egw_action/egw_action_popup.js new file mode 100644 index 0000000000..d7cbaaffe2 --- /dev/null +++ b/phpgwapi/js/egw_action/egw_action_popup.js @@ -0,0 +1,194 @@ +/** + * eGroupWare egw_action framework - egw action framework + * + * @link http://www.egroupware.org + * @author Andreas Stöckel + * @copyright 2011 by Andreas Stöckel + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @package egw_action + * @version $Id$ + */ + +if (typeof window._egwActionClasses == "undefined") + window._egwActionClasses = {} +_egwActionClasses["popup"] = { + "actionConstructor": egwPopupAction, + "implementation": getPopupImplementation +} + +function egwPopupAction(_id, _handler, _caption, _icon, _onExecute, _allowOnMultiple) +{ + var action = new egwAction(_id, _handler, _caption, _icon, _onExecute, _allowOnMultiple); + + action.type = "popup"; + action["default"] = false; + action.order = 0; + action.group = 0; + + action.set_default = function(_value) { + action["default"] = _value; + } + + action.set_order = function(_value) { + action.order = _value; + } + + action.set_group = function(_value) { + action.group = _value; + } + + return action; +} + +var + _popupActionImpl = null; + +function getPopupImplementation() +{ + if (!_popupActionImpl) + { + _popupActionImpl = new egwPopupActionImplementation(); + } + return _popupActionImpl +} + +function egwPopupActionImplementation() +{ + var ai = new egwActionImplementation(); + + ai.type = "popup"; + + ai.getPageXY = function getPageXY(event) + { + // document.body.scrollTop does not work in IE + var scrollTop = document.body.scrollTop ? document.body.scrollTop : + document.documentElement.scrollTop; + var scrollLeft = document.body.scrollLeft ? document.body.scrollLeft : + document.documentElement.scrollLeft; + + return {'x': (event.clientX + scrollLeft), 'y': (event.clientY + scrollTop)}; + } + + ai.doRegisterAction = function(_aoi, _callback, _context) + { + var node = _aoi.getDOMNode(); + + if (node) + { + node.oncontextmenu = function(e) { + //Obtain the event object + if (!e) + e = window.event; + + if (_egw_active_menu) + { + _egw_active_menu.hide() + } + else + { + _xy = ai.getPageXY(e); + _callback.call(_context, _xy, ai); + } + + e.cancelBubble = true; + if (e.stopPropagation) + e.stopPropagation(); + return false; + } + } + } + + ai.doUnregisterAction = function(_aoi) + { + // + } + + ai.doExecuteImplementation = function(_context, _selected, _links) + { + var menu = ai._buildMenu(_links, _selected); + menu.showAt(_context.x, _context.y); + } + + ai._buildMenu = function(_links, _selected) + { + var menu = new egwMenu(); + + //Sort the links in ordered groups + var link_groups = {}; + for (k in _links) + { + // Check whether the link group of the current element already exists, + // if not, create the group + var grp = _links[k].actionObj.group; + if (typeof link_groups[grp] == "undefined") + { + link_groups[grp] = []; + } + + // Insert the element in order + var inserted = false; + for (var i = 0; i < link_groups[grp].length; i++) + { + var elem = link_groups[grp][i]; + if (elem.actionObj.order > _links[k].actionObj.order) + { + inserted = true; + link_groups[grp].splice(i, 0, _links[k]); + break; + } + } + + // If the object hasn't been inserted, add it to the end of the list + if (!inserted) + { + link_groups[grp].push(_links[k]); + } + } + + // Insert the link groups sorted into an array + var groups = []; + for (k in link_groups) + groups.push({"grp": k, "links": link_groups[k]}); + groups.sort(function(a, b) { + return (a.grp > b.grp) ? 1 : ((a.grp < b.grp) ? -1 : 0); + }); + + for (var i = 0; i < groups.length; i++) + { + // Add an seperator after each group + if (i != 0) + { + menu.addItem("", "-"); + } + + // Go through the elements of each group + for (var j = 0; j < groups[i].links.length; j++) + { + var link = groups[i].links[j]; + if (link.visible) + { + var item = menu.addItem(link.actionObj.id, link.actionObj.caption, + link.actionObj.iconUrl); + item.data = link.actionObj; + if (link.enabled) + { + item.set_onClick(function(elem) { + elem.data.execute(_selected); + }); + } + else + { + item.set_enabled(false); + } + } + } + } + + return menu; + } + + return ai; +} + + + diff --git a/phpgwapi/js/egw_action/test/imgs/compress.png b/phpgwapi/js/egw_action/test/imgs/compress.png new file mode 100755 index 0000000000000000000000000000000000000000..8606ff0fd23c97d71d43afa0bd587e47c1e90441 GIT binary patch literal 766 zcmVZcJ%1+b$|lEg|m$p?$2s-?aFIU^lhS4 zt=5>B*onJiX5((A#g&zdZ;7N+zyNUJY~v8{(NtqH{`+@8xk&m zG`u_jq?FJb9n=hw%`FbbD_m;*4&fCDuR=V`pUsP7fU1Tp7Q?_nK-IQ85K85YX7gRJ zgwtoomKC%RWTO%Skh+*{%b>T>VfXA~9;mZE6vn=~?YHE7)8Zq;mfF}l;^WAReVKbv2dyl8I zZdsNM9oTISwn$ahzw_tMS*<#q^{;+1adq)i5#6)A{L5!4^#~!-uOE5i^$%Jv0}EmF z8*kM!$D7UP9;w~?<@c-q)vuj615`xxpt}~#kmfz_<C4}Mrzlg<+1Y8PEBfUp0jJpx4B>@E+cy3`^(Gw`Mf+2&yxZm<$to~Vpgvg&QKNR z_f#1(r6svZt%iF?s+n<8X?B&!h3g9Dbb8_=MX}!;HiQSAh`bp^WMl~Z-44teO7W_Y zV4thSL{h;rJY7!l3%5J4H1!tIzB`Dv+YxO(haWeausGZYkI8^hWj6mzo=L0{%;yxzh{5!Htr?51 zvG|W62MzC8BZ76hRpCyO2zOn<%e)K>NHge!-~)Ap33OdWw6hsLYbCxGNt0%wk_2z7 zfyYvXheSG)5HRK1VB~%mq7Dmurw#bi@hEcOr3&G1ZiF*$M=&9nB#VNf&Q^r$4G5kp zTURh&s)E0%5&hyVD}sp<72~zmAY`Y(9aqO6CXF%=zFHGzO-A&I(pE}v70YQxCPJ{Y z4L+?5-crdLn3ZRPEs!A4ehEY3ZRpL~w9>@aMN+{F4dI@v&>(QDHQum!mG~E^$OS8l z!7?%Uwib*ROP67Hw`ika)gX-(8Ia`-u_IEhxG7U<13kSsMW+$lbb2dUMm5p6pa}cjgA+U$^mJ^AjD?&bdi)8~y+Q002ovPDHLkV1g8IMc@Dc literal 0 HcmV?d00001 diff --git a/phpgwapi/js/egw_action/test/imgs/edit.png b/phpgwapi/js/egw_action/test/imgs/edit.png new file mode 100755 index 0000000000000000000000000000000000000000..0bfecd50ee9f5bc5828f0c0745aa3e0effcbe250 GIT binary patch literal 450 zcmV;z0X_bSP)Rq1}l<=psl5*5Xz9i;M}s*NP=ugs7Q#8Z;Dyx|}!`#}xw_C3!B-yaPC&0j)XcpuX@rNfq|q}N(wJOjA& z>u+z?dfJEuLePrqzy!)73pvLjxk4d6XNZt?hm_iYES{i}J5y3l?}PPNYDBR7oPc~6 zL^d)Bi4Q2L3pnp!nFxN9c2E+=@XAl&+;2m6a~kZj1r3Mz3C=hmUG<{+vWR@t4q?fJ zhFc(ozZD#Mx`^Q~g1v=K6!QnfuqyD4>U4EjF0eamL}Jx| z%&`kR-H+3GBYr*Qx}frLU4`%n9(`uSomzw)t%%NagXkA*R5Mbv9VLDp1wMo$cOMa~ s3Wm%r7^bwK$2$}-<~D8p`#1iScU4^XCLAA~0ssI207*qoM6N<$g3sK(Qvd(} literal 0 HcmV?d00001 diff --git a/phpgwapi/js/egw_action/test/imgs/email.png b/phpgwapi/js/egw_action/test/imgs/email.png new file mode 100755 index 0000000000000000000000000000000000000000..7348aed77fe6a64c2210a202f12c6eccae7fcf24 GIT binary patch literal 641 zcmV-{0)G98P)Az`{eoOom?Tf*9)f$7n8&|1&5M4#i^32;+&E? zC3Q;bRFQN#y*%%=_V)Mfa<$xe^kB0TO;vJPkN*k(2v-CI7)OaWj?&eKPos(H4wGh_ zIC;6#q1B5SMap5{(Hc0~XO7OfqZ=x{kupu8-H&9azl`L1pTuu^Znm3EA)kCoG=JuwsyNLEtY83i->Z~j3y~F)`RA1k>zTES07po!kBVS2y#L{jCt|CMY&v{ zxmqM|`OA#P2{R&)OcQd}v0kt6_Dh#`Z$i5_;q|93je3Q^PcfR{TmBHRmr;rWahz~G z2x-&;d_O~HkmKXt5Cd#Bs?-+qj3zOiUdU24KowBIUPg(gPNmxqX)Fiia~V*$y;5L( zrGNmU;81MA$F2k%oeUXQ@}N%bXz=qOij$4IYk4W=jfhDxfCz{PGXe-#ge#VfYTyoj zh4JvDePrW{lf(Oux2xG;VZmlSvDU+Qf@i=O!B`MLglhttCUHDIKkc729`oe)=`;M0Ve`z_rRHM)ytw;{NqJ92_6VOk@C*y0Ex)o5ihL^ph1#5YinO zyxORvZUfgg!GxzCWTNIM`)KJS{p1Ntor?_ABp3_=gaD2H85Y)0(rUlQOh{nzR6z<5 zEO0De$IN)yJIjF82x73(uJW{bfy*E6{#GD4S;+brQ?z@ND2z~($5eI$1QYf0H)an^QOO;qRuu9YpYp4SM;xg>M8uf2gNuvOO$0ks zMIj=HnnBRUR?tKXG11rxCU4&7dG4NbuvR2_mEvc)n?Cow;~Wve|KR^>9@p5l)|QB+ z$jmun3q#x>;ss-PW_mnr2MHVzLAl1RW&0?VkixF*4t!St0YVb2wnKdU(kmOHiL;aW zK8Xte%(k>MVGG$E4no6dcNnb>BhVHHGD&1pv4YZ68kE2V03t5#PCEFm7=ad$6)+3B zTCmn*?A?=u(o~ET7~-7g0)ZB=6|lumi4}B}MLgy~Ysy6)Q5%Al7|05&1z3Jpu>cF8 z3?VXs*3<}%h3`5Wld)N2zJnk%Agw<~3k)sPTLFd=F5;d8-bj-09SkQuynfflNcZLN z!^_37fdZvzrq=9~mp*($%mcDRKC&qvaaZuX+C=AT6O*~tHl>0mcP<_q>-z%$xO(@! zYluq5a8VQI$S@4?r*v;gPo!QQ%pX3A#>xx4t=w-L6COWx?aj&`f+!YePsFtj=hOQR zP3=E2j@9L7s8;T^&s?u(Hdpu?CubjMrGn{t_37>9$|AD)QE08weJlKn8|OyjL~7oP zC8mPT`jzuH*Dh^I0048RGafUIT)4H~*m8m>egI0iH=(LB%b@@O002ovPDHLkV1lw0 B3