From 85c812acec58c46d97442c736d62ea16633a96d9 Mon Sep 17 00:00:00 2001 From: thomascube Date: Thu, 27 Aug 2009 07:07:10 +0000 Subject: [PATCH] Added archive plugin --- plugins/archive/archive.js | 36 ++++++++ plugins/archive/archive.php | 114 +++++++++++++++++++++++++ plugins/archive/archive_act.png | Bin 0 -> 3663 bytes plugins/archive/archive_pas.png | Bin 0 -> 977 bytes plugins/archive/foldericon.png | Bin 0 -> 3312 bytes plugins/archive/localization/de_CH.inc | 8 ++ plugins/archive/localization/de_DE.inc | 8 ++ plugins/archive/localization/en_US.inc | 8 ++ plugins/archive/localization/fr_FR.inc | 9 ++ 9 files changed, 183 insertions(+) create mode 100644 plugins/archive/archive.js create mode 100644 plugins/archive/archive.php create mode 100644 plugins/archive/archive_act.png create mode 100644 plugins/archive/archive_pas.png create mode 100644 plugins/archive/foldericon.png create mode 100644 plugins/archive/localization/de_CH.inc create mode 100644 plugins/archive/localization/de_DE.inc create mode 100644 plugins/archive/localization/en_US.inc create mode 100644 plugins/archive/localization/fr_FR.inc diff --git a/plugins/archive/archive.js b/plugins/archive/archive.js new file mode 100644 index 000000000..d771fb66b --- /dev/null +++ b/plugins/archive/archive.js @@ -0,0 +1,36 @@ +/* + * Archive plugin script + * @version 1.2 + */ + +function rcmail_archive(prop) +{ + if (!rcmail.env.uid && (!rcmail.message_list || !rcmail.message_list.get_selection().length)) + return; + + var uids = rcmail.env.uid ? rcmail.env.uid : rcmail.message_list.get_selection().join(','); + + rcmail.set_busy(true, 'loading'); + rcmail.http_post('plugin.archive', '_uid='+uids+'&_mbox='+urlencode(rcmail.env.mailbox), true); +} + +// callback for app-onload event +if (window.rcmail) { + rcmail.addEventListener('init', function(evt) { + + // register command (directly enable in message view mode) + rcmail.register_command('plugin.archive', rcmail_archive, (rcmail.env.uid && rcmail.env.mailbox != rcmail.env.archive_folder)); + + // add event-listener to message list + if (rcmail.message_list) + rcmail.message_list.addEventListener('select', function(list){ + rcmail.enable_command('plugin.archive', (list.get_selection().length > 0 && rcmail.env.mailbox != rcmail.env.archive_folder)); + }); + + // set css style for archive folder + var li; + if (rcmail.env.archive_folder && (li = rcmail.get_folder_li(rcmail.env.archive_folder))) + $(li).css('background-image', 'url(plugins/archive/foldericon.png)'); + }) +} + diff --git a/plugins/archive/archive.php b/plugins/archive/archive.php new file mode 100644 index 000000000..2bd1adc7a --- /dev/null +++ b/plugins/archive/archive.php @@ -0,0 +1,114 @@ +register_action('plugin.archive', array($this, 'request_action')); + + # There is no "Archived flags" + # $GLOBALS['IMAP_FLAGS']['ARCHIVED'] = 'Archive'; + + $rcmail = rcmail::get_instance(); + if ($rcmail->task == 'mail' && ($rcmail->action == '' || $rcmail->action == 'show') && ($archive_folder = $rcmail->config->get('archive_mbox'))) { + $this->include_script('archive.js'); + $this->add_texts('localization', true); + $this->add_button( + array( + 'command' => 'plugin.archive', + 'imagepas' => 'archive_pas.png', + 'imageact' => 'archive_act.png', + 'title' => 'buttontitle', + 'domain' => $this->ID, + ), + 'toolbar'); + + // register hook to localize the archive folder + $this->add_hook('render_mailboxlist', array($this, 'render_mailboxlist')); + + // set env variable for client + $rcmail->output->set_env('archive_folder', $archive_folder); + + // add archive folder to the list of defailt mailboxes + if (($default_folders = $rcmail->config->get('default_imap_folders')) && !in_array($archive_folder, $default_folders)) { + $default_folders[] = $archive_folder; + $rcmail->config->set('default_imap_folders', $default_folders); + } + + } + else if ($rcmail->task == 'settings') { + $dont_override = $rcmail->config->get('dont_override', array()); + if (!in_array('archive_mbox', $dont_override)) { + $this->add_hook('user_preferences', array($this, 'prefs_table')); + $this->add_hook('save_preferences', array($this, 'save_prefs')); + } + } + } + + function render_mailboxlist($p) + { + $rcmail = rcmail::get_instance(); + $archive_folder = $rcmail->config->get('archive_mbox'); + + // set localized name for the configured arcive folder + if ($archive_folder && $p['list'][$archive_folder]) + $p['list'][$archive_folder]['name'] = $this->gettext('archivefolder'); + + return $p; + } + + function request_action() + { + $this->add_texts('localization'); + + $uids = get_input_value('_uid', RCUBE_INPUT_POST); + $mbox = get_input_value('_mbox', RCUBE_INPUT_POST); + + $rcmail = rcmail::get_instance(); + + # There is no "Archive flags", but I left this line in case it may be useful + # $rcmail->imap->set_flag($uids, 'ARCHIVE'); + + if (($archive_mbox = $rcmail->config->get('archive_mbox')) && $mbox != $archive_mbox) { + $rcmail->output->command('move_messages', $archive_mbox); + $rcmail->output->command('display_message', $this->gettext('archived'), 'confirmation'); + } + + $rcmail->output->send(); + } + + function prefs_table($args) + { + if ($args['section'] == 'folders') { + $this->add_texts('localization'); + + $rcmail = rcmail::get_instance(); + $select = rcmail_mailbox_select(array('noselection' => '---', 'realnames' => true, 'maxlength' => 30)); + + $args['blocks']['main']['options']['archive_mbox'] = array( + 'title' => $this->gettext('archivefolder'), + 'content' => $select->show($rcmail->config->get('archive_mbox'), array('name' => "_archive_mbox")) + ); + } + + return $args; + } + + function save_prefs($args) + { + $args['prefs']['archive_mbox'] = get_input_value('_archive_mbox', RCUBE_INPUT_POST); + return $args; + } + +} diff --git a/plugins/archive/archive_act.png b/plugins/archive/archive_act.png new file mode 100644 index 0000000000000000000000000000000000000000..2a173586832e8f8c6dedafd79a93611dec8b5a61 GIT binary patch literal 3663 zcmV-V4zTfwP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqI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VAvf{t@e-k$$+E>%Xd=mvmgMJKn(f3nOcaNkpVx4+7KC`ClAqq0F@&sTK|nSv=M}X_9q}botsVwc)fJ=`r za`%rmz2#ynwA{L#>FFEhvq@^9*WEmo0^0x$5K#{}29%&%nhgWs1Iy)d<1w*q2Ow?k zaQf^j#_^`&o^2Mf%{quBjKl+0;(zY!#da8gIUo}RcEL@g@Q=TW1|>i`*Rx98qHb-c z0>n3`3W|VOoJ0<1UU5<@h~9O9MW6wsfaWLw76_}=`k$YD@qO{we4;8~Bqn1YCE||u z5KNrTU~l>w{aFg-*8RAwj^Z}9D$WB-u{Yc!ctJ(+!D>JOs7>-NNW`x4;=1NACh_T8 hdnMLL0ROf9GXRHc*=Y)9d%pkx002ovPDHLkV1gJG-{t@S literal 0 HcmV?d00001 diff --git a/plugins/archive/archive_pas.png b/plugins/archive/archive_pas.png new file mode 100644 index 0000000000000000000000000000000000000000..8de2085836b64805f5088a30526af04630d966aa GIT binary patch literal 977 zcmV;?11|iDP)$NJ8^Kp->#%7j>qAeAv8z2g9q}bKY&1$RFoCzl4(Gcryt=30}z4lo+&AD zItu|6A!rTY%c>1d8CT~vmf_?H6$}&khO&bsbOT~XVRX1yooBNul#5DB0GvaRk0;xB zphCGlrVh!Z460Pi2irxE&1=s2Cp>^%k--F)ps>Ee{I2=G%e|1>yQXV4Xexi$sRu|U z$##Cmz_rq#$l=a|&4LMIV@P35VNPY=hYdl=8?K>?oZ001HWMD+QS&C0T-xNOTXIHE%|*21Y=5ALW69A7HdH3}nx zH2|rU!g5VNFe;X|wzAr84|wQEA8dRrLw&nwIT%*gB6V{Fy)g~)j#^W07|imbAS2e` zaM$QwUq^!g@E46trl=EK7F(KV9ZpRSG9pq#oUCa(Fy{<*A&~v zimVu*4_{^mq{Xo;j%Pv7q?*~{m=!GNot*4HxwmR$eznk zw@ly-$IAhCKi>t&10cb{T)5tPUjTpl`X#^sjQ-yh3OoIh00000NkvXXu0mjfuQbF0 literal 0 HcmV?d00001 diff --git a/plugins/archive/foldericon.png b/plugins/archive/foldericon.png new file mode 100644 index 0000000000000000000000000000000000000000..ec0853c4420efb6317e4fc9c34ca17e9e451ac32 GIT binary patch literal 3312 zcmVKLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl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y zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0006TNkl%&i;y9N7FM)T+=%@Ffq#Mp z?IH;xXjdQwl6@?S7PV;=HsU66Q7x=&W{j9--g}-F_jTrN*|WNE&v~BbJm+4M#M7Gx zkWn;a+@1XZmVg}000YDxwt-hT^$XWOQvh%%;+!8DyEZp)@={4s?3Tb3yA?oU>*Mlj z`OUoo#!H}H06>hN7@MCP7@aEZ6-LPrR*}TYV*iZ(6Dv3R zXC%cDB=E{|rW8OaCdbu83YY@&6iAT=jDS1_k`V}bgHM}ZK`G!IJ-a|c8yoKyKq*pS z@K8@H)B=FX61+~WR^`-4KPYhb*3}rV9Cv5-%4wXyhqW(A-4G)G-UuD?CObc>NPVD` z>C0y@n&1K9NDWY6r?Ly)i=d-LfGB#XQ?1o_yz;)a0l6|4A+8l6IZ_HzvF#wJh&Py= zIEJ+f0#b@exTlz@waR!$n*gH=HQ3zR#&Gb!@pHGyqx^a{x-nz$U=Ki7KE!VMA8OU# zj1KL?5KD^_Q4s^2nW`k4R$KKnDv5->8T+MN6H>%hM%>1jLmZ+ z7<8dPrTU8}&o{swNhC>vvTjLO_Oqm{C%48 diff --git a/plugins/archive/localization/de_DE.inc b/plugins/archive/localization/de_DE.inc new file mode 100644 index 000000000..2ed0f5ac8 --- /dev/null +++ b/plugins/archive/localization/de_DE.inc @@ -0,0 +1,8 @@ + diff --git a/plugins/archive/localization/en_US.inc b/plugins/archive/localization/en_US.inc new file mode 100644 index 000000000..fce31a0b5 --- /dev/null +++ b/plugins/archive/localization/en_US.inc @@ -0,0 +1,8 @@ + diff --git a/plugins/archive/localization/fr_FR.inc b/plugins/archive/localization/fr_FR.inc new file mode 100644 index 000000000..422d45d87 --- /dev/null +++ b/plugins/archive/localization/fr_FR.inc @@ -0,0 +1,9 @@ + +