Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d65ad79709 | ||
|
|
43a9ed178e | ||
|
|
cc68ab1521 | ||
|
|
ea21509f2a |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
*.swp
|
*.swp
|
||||||
|
.idea
|
||||||
38
SQL/sqlite.initial.sql
Normal file
38
SQL/sqlite.initial.sql
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
CREATE TABLE ident_switch
|
||||||
|
(
|
||||||
|
id
|
||||||
|
serial
|
||||||
|
PRIMARY KEY,
|
||||||
|
user_id
|
||||||
|
integer
|
||||||
|
NOT NULL
|
||||||
|
REFERENCES users(user_id) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||||
|
iid
|
||||||
|
integer
|
||||||
|
NOT NULL
|
||||||
|
REFERENCES identities(identity_id) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
|
UNIQUE,
|
||||||
|
username
|
||||||
|
varchar(64),
|
||||||
|
password
|
||||||
|
varchar(64),
|
||||||
|
host
|
||||||
|
varchar(64),
|
||||||
|
port
|
||||||
|
integer
|
||||||
|
CHECK(port > 0 AND port <= 65535),
|
||||||
|
delimiter
|
||||||
|
char(1),
|
||||||
|
label
|
||||||
|
varchar(32),
|
||||||
|
flags
|
||||||
|
integer
|
||||||
|
NOT NULL
|
||||||
|
DEFAULT(0),
|
||||||
|
UNIQUE (user_id, label)
|
||||||
|
);
|
||||||
|
CREATE INDEX IX_ident_switch_user_id
|
||||||
|
ON
|
||||||
|
ident_switch(user_id);
|
||||||
|
CREATE INDEX IX_ident_switch_iid on ident_switch(iid);
|
||||||
|
|
||||||
@@ -8,3 +8,34 @@ $(function() {
|
|||||||
plugin_switchIdent_processPreconfig();
|
plugin_switchIdent_processPreconfig();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function plugin_switchIdent_processPreconfig() {
|
||||||
|
var disFld = $("INPUT[name='_ident_switch.form.readonly']");
|
||||||
|
disFld.parentsUntil("TABLE", "TR").hide();
|
||||||
|
|
||||||
|
var disVal = disFld.val();
|
||||||
|
if (disVal > 0) {
|
||||||
|
$("INPUT[name='_ident_switch.form.host']").prop("disabled", true);
|
||||||
|
$("SELECT[name='_ident_switch.form.secure']").prop("disabled", true);
|
||||||
|
$("INPUT[name='_ident_switch.form.port']").prop("disabled", true);
|
||||||
|
}
|
||||||
|
if (2 == disVal) {
|
||||||
|
$("INPUT[name='_ident_switch.form.username']").prop("disabled", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function plugin_switchIdent_enabled_onChange(e) {
|
||||||
|
var $enFld = $("INPUT[name='_ident_switch.form.enabled']");
|
||||||
|
$("INPUT[name!='_ident_switch.form.enabled'], SELECT", $enFld.parents("FIELDSET")).prop("disabled", !$enFld.is(":checked"));
|
||||||
|
plugin_switchIdent_processPreconfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
function plugin_switchIdent_secure_onChange(e) {
|
||||||
|
var $secSel = $("SELECT[name='_ident_switch.form.secure']");
|
||||||
|
var $portFld = $("INPUT[name='_ident_switch.form.port']");
|
||||||
|
|
||||||
|
if ('SSL' === $secSel.val().toUpperCase())
|
||||||
|
$portFld.attr("placeholder", 993);
|
||||||
|
else
|
||||||
|
$portFld.attr("placeholder", 143);
|
||||||
|
}
|
||||||
2
ident_switch-form.min.js
vendored
2
ident_switch-form.min.js
vendored
@@ -1 +1 @@
|
|||||||
$(function(){$("INPUT[name='_ident_switch.form.enabled']").change();$("SELECT[name='_ident_switch.form.secure']").change();plugin_switchIdent_processPreconfig();});
|
$(function(){$("INPUT[name='_ident_switch.form.enabled']").change();$("SELECT[name='_ident_switch.form.secure']").change();plugin_switchIdent_processPreconfig()});function plugin_switchIdent_processPreconfig(){var a=$("INPUT[name='_ident_switch.form.readonly']");a.parentsUntil("TABLE","TR").hide();var b=a.val();if(b>0){$("INPUT[name='_ident_switch.form.host']").prop("disabled",true);$("SELECT[name='_ident_switch.form.secure']").prop("disabled",true);$("INPUT[name='_ident_switch.form.port']").prop("disabled",true)}if(2==b){$("INPUT[name='_ident_switch.form.username']").prop("disabled",true)}}function plugin_switchIdent_enabled_onChange(a){var b=$("INPUT[name='_ident_switch.form.enabled']");$("INPUT[name!='_ident_switch.form.enabled'], SELECT",b.parents("FIELDSET")).prop("disabled",!b.is(":checked"));plugin_switchIdent_processPreconfig()}function plugin_switchIdent_secure_onChange(c){var b=$("SELECT[name='_ident_switch.form.secure']");var a=$("INPUT[name='_ident_switch.form.port']");if("SSL"===b.val().toUpperCase()){a.attr("placeholder",993)}else{a.attr("placeholder",143)}};
|
||||||
@@ -13,14 +13,13 @@ $(function() {
|
|||||||
case 'classic':
|
case 'classic':
|
||||||
isOk = plugin_switchIdent_addCbClassic($sw);
|
isOk = plugin_switchIdent_addCbClassic($sw);
|
||||||
break;
|
break;
|
||||||
|
case 'elastic':
|
||||||
|
isOk = plugin_switchIdent_addCbElastic($sw);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isOk)
|
if (isOk)
|
||||||
$sw.show();
|
$sw.show();
|
||||||
|
|
||||||
$("INPUT[name='_ident_switch.form.enabled']").change();
|
|
||||||
$("SELECT[name='_ident_switch.form.secure']").change();
|
|
||||||
plugin_switchIdent_processPreconfig();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function plugin_switchIdent_addCbLarry($sw) {
|
function plugin_switchIdent_addCbLarry($sw) {
|
||||||
@@ -47,39 +46,22 @@ function plugin_switchIdent_addCbClassic($sw) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function plugin_switchIdent_processPreconfig() {
|
function plugin_switchIdent_addCbElastic($sw) {
|
||||||
var disFld = $("INPUT[name='_ident_switch.form.readonly']");
|
var $taskBar = $('.header-title.username');
|
||||||
disFld.parentsUntil("TABLE", "TR").hide();
|
$sw.css("background-color", "transparent").css("border","none");
|
||||||
|
$sw.css("background-position-x","left 0.75rem").css("padding","0 0 0 2rem");
|
||||||
|
$sw.css("font-weight","bold").css("box-shadow","none");
|
||||||
|
if ($taskBar.length > 0) {
|
||||||
|
$taskBar.prepend($sw);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
var disVal = disFld.val();
|
return false;
|
||||||
if (disVal > 0) {
|
|
||||||
$("INPUT[name='_ident_switch.form.host']").prop("disabled", true);
|
|
||||||
$("SELECT[name='_ident_switch.form.secure']").prop("disabled", true);
|
|
||||||
$("INPUT[name='_ident_switch.form.port']").prop("disabled", true);
|
|
||||||
}
|
|
||||||
if (2 == disVal) {
|
|
||||||
$("INPUT[name='_ident_switch.form.username']").prop("disabled", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function plugin_switchIdent_enabled_onChange(e) {
|
|
||||||
var $enFld = $("INPUT[name='_ident_switch.form.enabled']");
|
|
||||||
$("INPUT[name!='_ident_switch.form.enabled'], SELECT", $enFld.parents("FIELDSET")).prop("disabled", !$enFld.is(":checked"));
|
|
||||||
plugin_switchIdent_processPreconfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
function plugin_switchIdent_secure_onChange(e) {
|
|
||||||
var $secSel = $("SELECT[name='_ident_switch.form.secure']");
|
|
||||||
var $portFld = $("INPUT[name='_ident_switch.form.port']");
|
|
||||||
|
|
||||||
if ('SSL' === $secSel.val().toUpperCase())
|
|
||||||
$portFld.attr("placeholder", 993);
|
|
||||||
else
|
|
||||||
$portFld.attr("placeholder", 143);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function plugin_switchIdent_switch(val) {
|
function plugin_switchIdent_switch(val) {
|
||||||
|
rcmail.env.unread_counts = {};
|
||||||
|
console.log(rcmail.env.unread_counts);
|
||||||
rcmail.http_post('plugin.ident_switch.switch', { '_ident-id': val, '_mbox': rcmail.env.mailbox });
|
rcmail.http_post('plugin.ident_switch.switch', { '_ident-id': val, '_mbox': rcmail.env.mailbox });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
16
ident_switch-switch.min.js
vendored
16
ident_switch-switch.min.js
vendored
@@ -1,15 +1 @@
|
|||||||
$(function(){$sw=$('#plugin-ident_switch-account');isOk=false;switch(rcmail.env['skin']){case'larry':isOk=plugin_switchIdent_addCbLarry($sw);break;case'classic':isOk=plugin_switchIdent_addCbClassic($sw);break;}
|
$(function(){$sw=$("#plugin-ident_switch-account");isOk=false;switch(rcmail.env.skin){case"larry":isOk=plugin_switchIdent_addCbLarry($sw);break;case"classic":isOk=plugin_switchIdent_addCbClassic($sw);break;case"elastic":isOk=plugin_switchIdent_addCbElastic($sw);break}if(isOk){$sw.show()}});function plugin_switchIdent_addCbLarry(b){var a=$(".topright .username");if(a.length>0){if(b.length>0){b.prependTo(".topright");a.hide();return true}}return false}function plugin_switchIdent_addCbClassic(b){var a=$("#taskbar");if(a.length>0){a.prepend(b);return true}return false}function plugin_switchIdent_addCbElastic(b){var a=$(".header-title.username");b.css("background-color","transparent").css("border","none");b.css("background-position-x","left 0.75rem").css("padding","0 0 0 2rem");b.css("font-weight","bold").css("box-shadow","none");if(a.length>0){a.prepend(b);return true}return false}function plugin_switchIdent_switch(a){rcmail.env.unread_counts={};console.log(rcmail.env.unread_counts);rcmail.http_post("plugin.ident_switch.switch",{"_ident-id":a,_mbox:rcmail.env.mailbox})}function plugin_switchIdent_fixIdent(a){if(parseInt(a)>0){$("#_from").val(a)}};
|
||||||
if(isOk)
|
|
||||||
$sw.show();$("INPUT[name='_ident_switch.form.enabled']").change();$("SELECT[name='_ident_switch.form.secure']").change();plugin_switchIdent_processPreconfig();});function plugin_switchIdent_addCbLarry($sw){var $truName=$('.topright .username');if($truName.length>0){if($sw.length>0){$sw.prependTo('.topright');$truName.hide();return true;}}
|
|
||||||
return false;}
|
|
||||||
function plugin_switchIdent_addCbClassic($sw){var $taskBar=$('#taskbar');if($taskBar.length>0){$taskBar.prepend($sw);return true;}
|
|
||||||
return false;}
|
|
||||||
function plugin_switchIdent_processPreconfig(){var disFld=$("INPUT[name='_ident_switch.form.readonly']");disFld.parentsUntil("TABLE","TR").hide();var disVal=disFld.val();if(disVal>0){$("INPUT[name='_ident_switch.form.host']").prop("disabled",true);$("SELECT[name='_ident_switch.form.secure']").prop("disabled",true);$("INPUT[name='_ident_switch.form.port']").prop("disabled",true);}
|
|
||||||
if(2==disVal){$("INPUT[name='_ident_switch.form.username']").prop("disabled",true);}}
|
|
||||||
function plugin_switchIdent_enabled_onChange(e){var $enFld=$("INPUT[name='_ident_switch.form.enabled']");$("INPUT[name!='_ident_switch.form.enabled'], SELECT",$enFld.parents("FIELDSET")).prop("disabled",!$enFld.is(":checked"));plugin_switchIdent_processPreconfig();}
|
|
||||||
function plugin_switchIdent_secure_onChange(e){var $secSel=$("SELECT[name='_ident_switch.form.secure']");var $portFld=$("INPUT[name='_ident_switch.form.port']");if('SSL'===$secSel.val().toUpperCase())
|
|
||||||
$portFld.attr("placeholder",993);else
|
|
||||||
$portFld.attr("placeholder",143);}
|
|
||||||
function plugin_switchIdent_switch(val){rcmail.http_post('plugin.ident_switch.switch',{'_ident-id':val,'_mbox':rcmail.env.mailbox});}
|
|
||||||
function plugin_switchIdent_fixIdent(iid){if(parseInt(iid)>0)
|
|
||||||
$("#_from").val(iid);}
|
|
||||||
Reference in New Issue
Block a user