* [DEV] Closes #121. New password expiration time feature.

This commit is contained in:
nuxsmin
2016-11-07 02:37:22 +01:00
committed by Rubén Domínguez
parent 078283732c
commit 44fdb6b79e
22 changed files with 1693 additions and 167 deletions

View File

@@ -64,6 +64,7 @@ $accountLogin = Request::analyze('login');
$accountPassword = Request::analyzeEncrypted('pass');
$accountNotes = Request::analyze('notes');
$accountUrl = Request::analyze('url');
$accountPassDateChange = Request::analyze('passworddatechange_unix', 0);
// Checks
$accountGroupEditEnabled = Request::analyze('groupEditEnabled', 0, false, 1);
@@ -93,6 +94,7 @@ $AccountData->setAccountOtherUserEdit($accountUserEditEnabled);
$AccountData->setAccountOtherGroupEdit($accountGroupEditEnabled);
$AccountData->setAccountPass($accountPassword);
$AccountData->setAccountIsPrivate($accountPrivateEnabled);
$AccountData->setAccountPassDateChange($accountPassDateChange);
if (is_array($accountOtherUsers)) {
$AccountData->setUsersId($accountOtherUsers);

View File

@@ -253,6 +253,8 @@ class Account extends AccountBase implements AccountInterface
. 'dst.account_otherGroupEdit = src.acchistory_otherGroupEdit + 0,'
. 'dst.account_pass = src.acchistory_pass,'
. 'dst.account_IV = src.acchistory_IV '
. 'dst.account_passDate = src.acchistory_passDate,'
. 'dst.account_passDateChange = src.acchistory_passDateChange '
. 'WHERE dst.account_id = :accountId';
$Data = new QueryData();
@@ -335,7 +337,9 @@ class Account extends AccountBase implements AccountInterface
. 'account_userGroupId = :accountUserGroupId,'
. 'account_otherUserEdit = :accountOtherUserEdit,'
. 'account_otherGroupEdit = :accountOtherGroupEdit,'
. 'account_isPrivate = :accountIsPrivate';
. 'account_isPrivate = :accountIsPrivate,'
. 'account_passDate = UNIX_TIMESTAMP(),'
. 'account_passDateChange = :accountPassDateChange';
$Data = new QueryData();
$Data->setQuery($query);
@@ -352,6 +356,7 @@ class Account extends AccountBase implements AccountInterface
$Data->addParam($this->accountData->getAccountOtherUserEdit(), 'accountOtherUserEdit');
$Data->addParam($this->accountData->getAccountOtherGroupEdit(), 'accountOtherGroupEdit');
$Data->addParam($this->accountData->getAccountIsPrivate(), 'accountIsPrivate');
$Data->addParam($this->accountData->getAccountPassDateChange(), 'accountPassDateChange');
if (DB::getQuery($Data) === false) {
return false;
@@ -640,7 +645,9 @@ class Account extends AccountBase implements AccountInterface
. 'account_pass = :accountPass,'
. 'account_IV = :accountIV,'
. 'account_userEditId = :accountUserEditId,'
. 'account_dateEdit = NOW() '
. 'account_dateEdit = NOW(), '
. 'account_passDate = UNIX_TIMESTAMP(), '
. 'account_passDateChange = :accountPassDateChange '
. 'WHERE account_id = :accountId';
$Data = new QueryData();
@@ -649,6 +656,7 @@ class Account extends AccountBase implements AccountInterface
$Data->addParam($this->accountData->getAccountIV(), 'accountIV');
$Data->addParam($this->accountData->getAccountUserEditId(), 'accountUserEditId');
$Data->addParam($this->accountData->getAccountId(), 'accountId');
$Data->addParam($this->accountData->getAccountPassDateChange(), 'accountPassDateChange');
if (DB::getQuery($Data) === false) {

View File

@@ -484,7 +484,7 @@ class AccountSearch
*/
private function analyzeQueryString()
{
preg_match('/(user|group|file|tag):(.*)/i', $this->txtSearch, $filters);
preg_match('/(user|group|file|tag|expired):(.*)/i', $this->txtSearch, $filters);
if (!is_array($filters) || count($filters) === 0) {
return [];
@@ -497,7 +497,7 @@ class AccountSearch
$UserData = User::getItem()->getByLogin($filters[2])->getItemData();
$filtersData[] = [
'type' => 'user',
'query' => '(account_userId = ? OR accuser_userId ?)',
'query' => 'account_userId = ? OR accuser_userId ?',
'values' => [$UserData->getUserId(), $UserData->getUserId()]
];
break;
@@ -505,7 +505,7 @@ class AccountSearch
$GroupData = GroupUtil::getGroupIdByName($filters[2]);
$filtersData[] = [
'type' => 'group',
'query' => '(account_userGroupId = ? OR accgroup_groupId ?)',
'query' => 'account_userGroupId = ? OR accgroup_groupId ?',
'values' => [$GroupData->getUsergroupId(), $GroupData->getUsergroupId()]
];
break;
@@ -524,6 +524,14 @@ class AccountSearch
'values' => [$filters[2]]
];
break;
case 'expired':
$filtersData[] =
[
'type' => 'expired',
'query' => 'account_passDateChange > 0 AND UNIX_TIMESTAMP() > account_passDateChange',
'values' => []
];
break;
default:
return $filtersData;
}

View File

@@ -369,4 +369,14 @@ class AccountsSearchItem
return $accountNotes;
}
/**
* Develve si la clave ha caducado
*
* @return bool
*/
public function isPasswordExpired()
{
return $this->AccountSearchData->getAccountPassDateChange() > 0 && time() > $this->AccountSearchData->getAccountPassDateChange();
}
}

View File

@@ -133,7 +133,6 @@ class AccountController extends ControllerBase implements ActionsInterface
'icon' => $this->icons->getIconAdd()->getIcon()
]
);
$this->view->assign('nextaction', Acl::ACTION_ACC_NEW);
Session::setLastAcountId(0);
$this->setCommonData();
@@ -184,6 +183,9 @@ class AccountController extends ControllerBase implements ActionsInterface
$publicLinkUrl = (Checks::publicLinksIsEnabled() && $this->AccountData->getPublicLinkHash() ? Init::$WEBURI . '/?h=' . $this->AccountData->getPublicLinkHash() . '&a=link' : '');
$this->view->assign('publicLinkUrl', $publicLinkUrl);
$this->view->assign('accountPassDate', gmdate('Y-m-d H:i:s', $this->AccountData->getAccountPassDate()));
$this->view->assign('accountPassDateChange', gmdate('Y-m-d', $this->AccountData->getAccountPassDateChange()));
}
$this->view->assign('actionId', $this->getAction());
@@ -257,7 +259,6 @@ class AccountController extends ControllerBase implements ActionsInterface
'icon' => $this->icons->getIconCopy()->getIcon()
]
);
$this->view->assign('nextaction', self::ACTION_ACC_COPY);
$this->setCommonData();
}
@@ -313,7 +314,6 @@ class AccountController extends ControllerBase implements ActionsInterface
'icon' => $this->icons->getIconEdit()->getIcon()
]
);
$this->view->assign('nextaction', self::ACTION_ACC_VIEW);
$this->setCommonData();
}
@@ -448,7 +448,8 @@ class AccountController extends ControllerBase implements ActionsInterface
'icon' => $this->icons->getIconEditPass()->getIcon()
]
);
$this->view->assign('nextaction', self::ACTION_ACC_VIEW);
$this->view->assign('accountPassDateChange', gmdate('Y-m-d', $this->AccountData->getAccountPassDateChange()));
}
/**

View File

@@ -113,6 +113,15 @@ class AccountData extends DataModelBase implements JsonSerializable, DataModelIn
* @var int
*/
public $account_isPrivate = 0;
/**
* @var int
*/
public $account_passDate = 0;
/**
* @var int
*/
public $account_passDateChange = 0;
/**
* AccountData constructor.
@@ -460,4 +469,36 @@ class AccountData extends DataModelBase implements JsonSerializable, DataModelIn
{
$this->account_isPrivate = (int)$account_isPrivate;
}
/**
* @return int
*/
public function getAccountPassDate()
{
return (int)$this->account_passDate;
}
/**
* @param int $account_passDate
*/
public function setAccountPassDate($account_passDate)
{
$this->account_passDate = (int)$account_passDate;
}
/**
* @return int
*/
public function getAccountPassDateChange()
{
return (int)$this->account_passDateChange;
}
/**
* @param int $account_passDateChange
*/
public function setAccountPassDateChange($account_passDateChange)
{
$this->account_passDateChange = (int)$account_passDateChange;
}
}

View File

@@ -231,74 +231,18 @@ REFERENCES `usrGroups` (`usergroup_id`)
ON DELETE CASCADE
ON UPDATE CASCADE;
CREATE ALGORITHM = UNDEFINED
DEFINER = CURRENT_USER
SQL SECURITY DEFINER VIEW `account_search_v` AS
SELECT DISTINCT
`accounts`.`account_id` AS `account_id`,
`accounts`.`account_customerId` AS `account_customerId`,
`accounts`.`account_categoryId` AS `account_categoryId`,
`accounts`.`account_name` AS `account_name`,
`accounts`.`account_login` AS `account_login`,
`accounts`.`account_url` AS `account_url`,
`accounts`.`account_notes` AS `account_notes`,
`accounts`.`account_userId` AS `account_userId`,
`accounts`.`account_userGroupId` AS `account_userGroupId`,
`accounts`.`account_otherUserEdit` AS `account_otherUserEdit`,
`accounts`.`account_otherGroupEdit` AS `account_otherGroupEdit`,
`accounts`.`account_isPrivate` AS `account_isPrivate`,
`ug`.`usergroup_name` AS `usergroup_name`,
`categories`.`category_name` AS `category_name`,
`customers`.`customer_name` AS `customer_name`,
(SELECT count(0)
FROM `accFiles`
WHERE (`accFiles`.`accfile_accountId` = `accounts`.`account_id`)) AS `num_files`
FROM (((`accounts`
LEFT JOIN `categories` ON ((`accounts`.`account_categoryId` = `categories`.`category_id`))) LEFT JOIN
`usrGroups` `ug` ON ((`accounts`.`account_userGroupId` = `ug`.`usergroup_id`))) LEFT JOIN `customers`
ON ((`customers`.`customer_id` = `accounts`.`account_customerId`)));
CREATE ALGORITHM=UNDEFINED DEFINER = CURRENT_USER SQL SECURITY DEFINER VIEW `account_search_v` AS select distinct `accounts`.`account_id` AS `account_id`,`accounts`.`account_customerId` AS `account_customerId`,`accounts`.`account_categoryId` AS `account_categoryId`,`accounts`.`account_name` AS `account_name`,`accounts`.`account_login` AS `account_login`,`accounts`.`account_url` AS `account_url`,`accounts`.`account_notes` AS `account_notes`,`accounts`.`account_userId` AS `account_userId`,`accounts`.`account_userGroupId` AS `account_userGroupId`,`accounts`.`account_otherUserEdit` AS `account_otherUserEdit`,`accounts`.`account_otherGroupEdit` AS `account_otherGroupEdit`,`accounts`.`account_isPrivate` AS `account_isPrivate`,`accounts`.`account_passDate` AS `account_passDate`,`accounts`.`account_passDateChange` AS `account_passDateChange`,`ug`.`usergroup_name` AS `usergroup_name`,`categories`.`category_name` AS `category_name`,`customers`.`customer_name` AS `customer_name`,(select count(0) from `accFiles` where (`accFiles`.`accfile_accountId` = `accounts`.`account_id`)) AS `num_files` from (((`accounts` left join `categories` on((`accounts`.`account_categoryId` = `categories`.`category_id`))) left join `usrGroups` `ug` on((`accounts`.`account_userGroupId` = `ug`.`usergroup_id`))) left join `customers` on((`customers`.`customer_id` = `accounts`.`account_customerId`)));
ALTER TABLE `accounts`
ADD COLUMN `account_isPrivate` BIT(1) NULL DEFAULT b'0'
AFTER `account_otherUserEdit`;
CREATE
ALGORITHM = UNDEFINED
DEFINER = CURRENT_USER
SQL SECURITY DEFINER
VIEW `account_data_v` AS
SELECT
`accounts`.`account_id` AS `account_id`,
`accounts`.`account_name` AS `account_name`,
`accounts`.`account_categoryId` AS `account_categoryId`,
`accounts`.`account_userId` AS `account_userId`,
`accounts`.`account_customerId` AS `account_customerId`,
`accounts`.`account_userGroupId` AS `account_userGroupId`,
`accounts`.`account_userEditId` AS `account_userEditId`,
`accounts`.`account_login` AS `account_login`,
`accounts`.`account_url` AS `account_url`,
`accounts`.`account_notes` AS `account_notes`,
`accounts`.`account_countView` AS `account_countView`,
`accounts`.`account_countDecrypt` AS `account_countDecrypt`,
`accounts`.`account_dateAdd` AS `account_dateAdd`,
`accounts`.`account_dateEdit` AS `account_dateEdit`,
`accounts`.`account_otherUserEdit` AS `account_otherUserEdit`,
`accounts`.`account_otherGroupEdit` AS `account_otherGroupEdit`,
`accounts`.`account_isPrivate` AS `account_isPrivate`,
`categories`.`category_name` AS `category_name`,
`customers`.`customer_name` AS `customer_name`,
`ug`.`usergroup_name` AS `usergroup_name`,
`u1`.`user_name` AS `user_name`,
`u1`.`user_login` AS `user_login`,
`u2`.`user_name` AS `user_editName`,
`u2`.`user_login` AS `user_editLogin`,
`publicLinks`.`publicLink_hash` AS `publicLink_hash`
FROM
((((((`accounts`
LEFT JOIN `categories` ON ((`accounts`.`account_categoryId` = `categories`.`category_id`)))
LEFT JOIN `usrGroups` `ug` ON ((`accounts`.`account_userGroupId` = `ug`.`usergroup_id`)))
LEFT JOIN `usrData` `u1` ON ((`accounts`.`account_userId` = `u1`.`user_id`)))
LEFT JOIN `usrData` `u2` ON ((`accounts`.`account_userEditId` = `u2`.`user_id`)))
LEFT JOIN `customers` ON ((`accounts`.`account_customerId` = `customers`.`customer_id`)))
LEFT JOIN `publicLinks` ON ((`accounts`.`account_id` = `publicLinks`.`publicLink_itemId`)))
CREATE ALGORITHM=UNDEFINED DEFINER = CURRENT_USER SQL SECURITY DEFINER VIEW `account_data_v` AS select `accounts`.`account_id` AS `account_id`,`accounts`.`account_name` AS `account_name`,`accounts`.`account_categoryId` AS `account_categoryId`,`accounts`.`account_userId` AS `account_userId`,`accounts`.`account_customerId` AS `account_customerId`,`accounts`.`account_userGroupId` AS `account_userGroupId`,`accounts`.`account_userEditId` AS `account_userEditId`,`accounts`.`account_login` AS `account_login`,`accounts`.`account_url` AS `account_url`,`accounts`.`account_notes` AS `account_notes`,`accounts`.`account_countView` AS `account_countView`,`accounts`.`account_countDecrypt` AS `account_countDecrypt`,`accounts`.`account_dateAdd` AS `account_dateAdd`,`accounts`.`account_dateEdit` AS `account_dateEdit`,`accounts`.`account_otherUserEdit` AS `account_otherUserEdit`,`accounts`.`account_otherGroupEdit` AS `account_otherGroupEdit`,`accounts`.`account_isPrivate` AS `account_isPrivate`,`accounts`.`account_passDate` AS `account_passDate`,`accounts`.`account_passDateChange` AS `account_passDateChange`,`categories`.`category_name` AS `category_name`,`customers`.`customer_name` AS `customer_name`,`ug`.`usergroup_name` AS `usergroup_name`,`u1`.`user_name` AS `user_name`,`u1`.`user_login` AS `user_login`,`u2`.`user_name` AS `user_editName`,`u2`.`user_login` AS `user_editLogin`,`publicLinks`.`publicLink_hash` AS `publicLink_hash` from ((((((`accounts` left join `categories` on((`accounts`.`account_categoryId` = `categories`.`category_id`))) left join `usrGroups` `ug` on((`accounts`.`account_userGroupId` = `ug`.`usergroup_id`))) left join `usrData` `u1` on((`accounts`.`account_userId` = `u1`.`user_id`))) left join `usrData` `u2` on((`accounts`.`account_userEditId` = `u2`.`user_id`))) left join `customers` on((`accounts`.`account_customerId` = `customers`.`customer_id`))) left join `publicLinks` on((`accounts`.`account_id` = `publicLinks`.`publicLink_itemId`)));
ALTER TABLE `accounts`
ADD COLUMN `account_passDate` INT UNSIGNED NULL AFTER `account_isPrivate`,
ADD COLUMN `account_passDateChange` INT UNSIGNED NULL AFTER `account_passDate`;
ALTER TABLE `accHistory`
ADD COLUMN `accHistory_passDate` INT UNSIGNED NULL AFTER `accHistory_otherGroupEdit`,
ADD COLUMN `accHistory_passDateChange` INT UNSIGNED NULL AFTER `accHistory_passDate`;

View File

@@ -112,6 +112,9 @@ CREATE TABLE `accounts` (
`account_dateEdit` datetime DEFAULT NULL,
`account_otherGroupEdit` bit(1) DEFAULT b'0',
`account_otherUserEdit` bit(1) DEFAULT b'0',
`account_isPrivate` bit(1) DEFAULT b'0',
`account_passDate` int(11) unsigned DEFAULT NULL,
`account_passDateChange` int(11) unsigned DEFAULT NULL,
PRIMARY KEY (`account_id`),
KEY `IDX_categoryId` (`account_categoryId`),
KEY `IDX_userId` (`account_userGroupId`,`account_userId`),
@@ -119,7 +122,7 @@ CREATE TABLE `accounts` (
KEY `fk_accounts_user_id` (`account_userId`),
KEY `fk_accounts_user_edit_id` (`account_userEditId`),
CONSTRAINT `fk_accounts_user_id` FOREIGN KEY (`account_userId`) REFERENCES `usrData` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `accFavorites`;
@@ -191,6 +194,8 @@ CREATE TABLE `accHistory` (
`acchistory_mPassHash` varbinary(255) NOT NULL,
`accHistory_otherUserEdit` bit(1) DEFAULT b'0',
`accHistory_otherGroupEdit` bit(1) DEFAULT b'0',
`accHistory_passDate` int(10) unsigned DEFAULT NULL,
`accHistory_passDateChange` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`acchistory_id`),
KEY `IDX_accountId` (`acchistory_accountId`),
KEY `fk_accHistory_users_edit_id_idx` (`acchistory_userEditId`),
@@ -198,7 +203,7 @@ CREATE TABLE `accHistory` (
KEY `fk_accHistory_categories_id` (`acchistory_categoryId`),
KEY `fk_accHistory_customers_id` (`acchistory_customerId`),
CONSTRAINT `fk_accHistory_users_id` FOREIGN KEY (`acchistory_userId`) REFERENCES `usrData` (`user_id`) ON DELETE NO ACTION ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `accTags`;

View File

@@ -0,0 +1,215 @@
.dtp {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.2);
z-index: 2000;
font-size: 15px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.dtp > .dtp-content {
background: #fff;
max-width: 300px;
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
max-height: 520px;
position: relative;
left: 50%;
}
.dtp > .dtp-content > .dtp-date-view > header.dtp-header {
background: #607D8B;
color: #fff;
text-align: center;
padding: 0.3em;
}
.dtp div.dtp-date, .dtp div.dtp-time {
background: #607D8B;
text-align: center;
color: #fff;
padding: 10px;
}
.dtp div.dtp-date > div {
padding: 0;
margin: 0;
}
.dtp div.dtp-actual-month {
font-size: 1.5em;
}
.dtp div.dtp-actual-num {
font-size: 3em;
line-height: 0.9;
}
.dtp div.dtp-actual-maxtime {
font-size: 3em;
line-height: 0.9;
}
.dtp div.dtp-actual-year {
font-size: 1.5em;
color: #fff;
}
.dtp div.dtp-picker {
padding: 1em;
text-align: center;
}
.dtp div.dtp-picker-month, .dtp div.dtp-actual-time {
font-weight: 500;
text-align: center;
}
.dtp div.dtp-picker-month {
padding-bottom: 20px !important;
text-transform: uppercase !important;
}
.dtp .dtp-close {
position: absolute;
top: 0.5em;
right: 1em;
}
.dtp .dtp-close > a {
color: #fff;
}
.dtp .dtp-close > a > i {
font-size: 1em;
}
.dtp table.dtp-picker-days {
margin: 0;
min-height: 251px;
}
.dtp table.dtp-picker-days, .dtp table.dtp-picker-days tr, .dtp table.dtp-picker-days tr > td {
border: none;
}
.dtp table.dtp-picker-days tr > td {
font-weight: 700;
text-align: center;
padding: 0.5em;
}
.dtp table.dtp-picker-days tr > td > span.dtp-select-day {
color: #BDBDBD !important;
padding: 0.4em 0.5em 0.5em 0.6em;
}
.dtp table.dtp-picker-days tr > td > a, .dtp .dtp-picker-time > a {
color: #212121;
text-decoration: none;
padding: 0.4em;
border-radius: 5px !important;
}
.dtp table.dtp-picker-days tr > td > a.selected {
background: #607D8B;
color: #fff;
}
.dtp table.dtp-picker-days tr > th {
color: #757575;
text-align: center;
font-weight: 700;
padding: 0.4em 0.3em;
}
.dtp .p10 > a {
color: #fff;
text-decoration: none;
}
.dtp .p10 {
width: 10%;
display: inline-block;
}
.dtp .p20 {
width: 20%;
display: inline-block;
}
.dtp .p60 {
width: 60%;
display: inline-block;
}
.dtp .p80 {
width: 80%;
display: inline-block;
}
.dtp a.dtp-meridien-am, .dtp a.dtp-meridien-pm {
position: relative;
top: 10px;
color: #212121;
font-weight: 500;
padding: 0.7em 0.5em;
border-radius: 50% !important;
text-decoration: none;
background: #eee;
font-size: 1em;
}
.dtp .dtp-actual-meridien a.selected {
background: #607D8B;
color: #fff;
}
.dtp .dtp-picker-time > .dtp-select-hour {
cursor: pointer;
}
.dtp .dtp-picker-time > .dtp-select-minute {
cursor: pointer;
}
.dtp .dtp-buttons {
padding: 0 1em 1em 1em;
text-align: right;
}
/*.dtp .dtp-buttons .btn-flat {*/
/*border: none;*/
/*padding: .5em;*/
/*color: #fff;*/
/*background-color: #607D8B;*/
/*}*/
.dtp.hidden, .dtp .hidden {
display: none;
}
.dtp .invisible {
visibility: hidden;
}
.dtp .left {
float: left;
}
.dtp .right {
float: right;
}
.dtp .clearfix {
clear: both;
}
.dtp .center {
text-align: center;
}

View File

@@ -0,0 +1 @@
.dtp{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.2);z-index:2000;font-size:15px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.dtp>.dtp-content{background:#fff;max-width:300px;box-shadow:0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12);max-height:520px;position:relative;left:50%}.dtp>.dtp-content>.dtp-date-view>header.dtp-header{background:#607d8b;color:#fff;text-align:center;padding:.3em}.dtp div.dtp-date,.dtp div.dtp-time{background:#607d8b;text-align:center;color:#fff;padding:10px}.dtp div.dtp-date>div{padding:0;margin:0}.dtp div.dtp-actual-month{font-size:1.5em}.dtp div.dtp-actual-num{font-size:3em;line-height:.9}.dtp div.dtp-actual-maxtime{font-size:3em;line-height:.9}.dtp div.dtp-actual-year{font-size:1.5em;color:#fff}.dtp div.dtp-picker{padding:1em;text-align:center}.dtp div.dtp-picker-month,.dtp div.dtp-actual-time{font-weight:500;text-align:center}.dtp div.dtp-picker-month{padding-bottom:20px !important;text-transform:uppercase !important}.dtp .dtp-close{position:absolute;top:.5em;right:1em}.dtp .dtp-close>a{color:#fff}.dtp .dtp-close>a>i{font-size:1em}.dtp table.dtp-picker-days{margin:0;min-height:251px}.dtp table.dtp-picker-days,.dtp table.dtp-picker-days tr,.dtp table.dtp-picker-days tr>td{border:0}.dtp table.dtp-picker-days tr>td{font-weight:700;text-align:center;padding:.5em}.dtp table.dtp-picker-days tr>td>span.dtp-select-day{color:#bdbdbd !important;padding:.4em .5em .5em .6em}.dtp table.dtp-picker-days tr>td>a,.dtp .dtp-picker-time>a{color:#212121;text-decoration:none;padding:.4em;border-radius:5px !important}.dtp table.dtp-picker-days tr>td>a.selected{background:#607d8b;color:#fff}.dtp table.dtp-picker-days tr>th{color:#757575;text-align:center;font-weight:700;padding:.4em .3em}.dtp .p10>a{color:#fff;text-decoration:none}.dtp .p10{width:10%;display:inline-block}.dtp .p20{width:20%;display:inline-block}.dtp .p60{width:60%;display:inline-block}.dtp .p80{width:80%;display:inline-block}.dtp a.dtp-meridien-am,.dtp a.dtp-meridien-pm{position:relative;top:10px;color:#212121;font-weight:500;padding:.7em .5em;border-radius:50% !important;text-decoration:none;background:#eee;font-size:1em}.dtp .dtp-actual-meridien a.selected{background:#607d8b;color:#fff}.dtp .dtp-picker-time>.dtp-select-hour{cursor:pointer}.dtp .dtp-picker-time>.dtp-select-minute{cursor:pointer}.dtp .dtp-buttons{padding:0 1em 1em 1em;text-align:right}.dtp.hidden,.dtp .hidden{display:none}.dtp .invisible{visibility:hidden}.dtp .left{float:left}.dtp .right{float:right}.dtp .clearfix{clear:both}.dtp .center{text-align:center}

View File

@@ -23,20 +23,23 @@
*
*/
$themeInfo = array(
$themeInfo = [
'name' => 'Material Blue',
'creator' => 'nuxsmin',
'version' => '1.0',
'targetversion' => '1.2.0',
'js' => array(
'js' => [
'moment.min.js',
'bootstrap-material-datetimepicker.min.js',
'material.min.js',
'app-theme.min.js'),
'css' => array(
'app-theme.min.js'],
'css' => [
'fonts.min.css',
'material.min.css',
'material-custom.min.css',
'bootstrap-material-datetimepicker.min.css',
'jquery-ui.theme.min.css',
'styles.min.css',
'alertify-custom.min.css',
'selectize.bootstrap3.min.css')
);
'selectize.bootstrap3.min.css']
];

View File

@@ -275,6 +275,58 @@ sysPass.Theme = function (Common) {
});
};
/**
* Inicializar el selector de fecha
* @param $container
*/
var setupDatePicker = function ($container) {
log.info("setupDatePicker");
var datePickerOpts = {
format: "YYYY-MM-DD",
lang: "en",
weekStart: 0,
time: false,
cancelText: Common.config().LANG[44],
okText: Common.config().LANG[43],
clearText: Common.config().LANG[30],
nowText: Common.config().LANG[56],
minDate: new Date(),
triggerEvent: "dateIconClick"
};
// Actualizar el input oculto con la fecha en formato UNIX
var updateUnixInput = function ($obj, date) {
var unixtime;
if (typeof date !== "undefined") {
unixtime = date;
} else {
unixtime = moment($obj.val()).format("X");
}
$obj.parent().find("input[name='passworddatechange_unix']").val(unixtime);
};
$container.find(".password-datefield__input").each(function () {
var $this = $(this);
$this.bootstrapMaterialDatePicker(datePickerOpts);
$this.parent().append("<input type='hidden' name='passworddatechange_unix' value='" + moment($this.val()).format("X") + "' />");
// Evento de click para el icono de calendario
$this.parent().next("i").on("click", function () {
$this.trigger("dateIconClick");
});
// Actualizar el campo oculto cuando cambie la fecha
$this.on("change", function () {
updateUnixInput($this);
});
});
};
/**
* Triggers que se ejecutan en determinadas vistas
*/
@@ -337,6 +389,7 @@ sysPass.Theme = function (Common) {
common: function ($container) {
passwordDetect($container);
activeTooltip($container);
setupDatePicker($container);
$container.find(".download").button({
icons: {primary: "ui-icon-arrowthickstop-1-s"}

View File

@@ -1,16 +1,18 @@
var $jscomp={scope:{},findInternal:function(a,g,e){a instanceof String&&(a=String(a));for(var h=a.length,f=0;f<h;f++){var l=a[f];if(g.call(e,l,f,a))return{i:f,v:l}}return{i:-1,v:void 0}}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(a,g,e){if(e.get||e.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[g]=e.value)};
$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,g,e,h){if(g){e=$jscomp.global;a=a.split(".");for(h=0;h<a.length-1;h++){var f=a[h];f in e||(e[f]={});e=e[f]}a=a[a.length-1];h=e[a];g=g(h);g!=h&&null!=g&&$jscomp.defineProperty(e,a,{configurable:!0,writable:!0,value:g})}};
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,e){return $jscomp.findInternal(this,a,e).v}},"es6-impl","es3");
sysPass.Theme=function(a){var g=function(a){"undefined"===typeof a&&(a=$("body"));a.find(".active-tooltip").tooltip({content:function(){return $(this).attr("title")},tooltipClass:"tooltip"})},e=function(b){for(var k=0,d="",c;k<a.passwordData.complexity.numlength;){c=Math.floor(100*Math.random())%94+33;if(!a.passwordData.complexity.symbols){if(33<=c&&47>=c)continue;if(58<=c&&64>=c)continue;if(91<=c&&96>=c)continue;if(123<=c&&126>=c)continue}!a.passwordData.complexity.numbers&&48<=c&&57>=c||!a.passwordData.complexity.uppercase&&
65<=c&&90>=c||(k++,d+=String.fromCharCode(c))}$("#viewPass").attr("title",d);var e=zxcvbn(d);a.passwordData.passLength=d.length;b?(k=b.parent(),c=$("#"+b.attr("id")+"R"),a.outputResult(e,b),b=new MaterialTextfield,k.find("input:password").val(d),k.addClass(b.CssClasses_.IS_DIRTY).removeClass(b.CssClasses_.IS_INVALID),c.val(d).parent().addClass(b.CssClasses_.IS_DIRTY).removeClass(b.CssClasses_.IS_INVALID),a.encryptFormValue(c),k.find("#passLevel").show(500)):(a.outputResult(e),$("input:password, input.password").val(d),
$("#passLevel").show(500))},h=function(){$("<div></div>").dialog({modal:!0,title:a.config().LANG[29],width:"400px",open:function(){var b=$(this),k='<label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" for="checkbox-numbers"><input type="checkbox" id="checkbox-numbers" class="mdl-checkbox__input" name="checkbox-numbers"/><span class="mdl-checkbox__label">'+a.config().LANG[35]+'</span></label><label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" for="checkbox-uppercase"><input type="checkbox" id="checkbox-uppercase" class="mdl-checkbox__input" name="checkbox-uppercase"/><span class="mdl-checkbox__label">'+
var $jscomp={scope:{},findInternal:function(a,f,c){a instanceof String&&(a=String(a));for(var g=a.length,h=0;h<g;h++){var l=a[h];if(f.call(c,l,h,a))return{i:h,v:l}}return{i:-1,v:void 0}}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(a,f,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[f]=c.value)};
$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,f,c,g){if(f){c=$jscomp.global;a=a.split(".");for(g=0;g<a.length-1;g++){var h=a[g];h in c||(c[h]={});c=c[h]}a=a[a.length-1];g=c[a];f=f(g);f!=g&&null!=f&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:f})}};
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,c){return $jscomp.findInternal(this,a,c).v}},"es6-impl","es3");
sysPass.Theme=function(a){var f=a.log,c=function(a){"undefined"===typeof a&&(a=$("body"));a.find(".active-tooltip").tooltip({content:function(){return $(this).attr("title")},tooltipClass:"tooltip"})},g=function(b){for(var k=0,d="",e;k<a.passwordData.complexity.numlength;){e=Math.floor(100*Math.random())%94+33;if(!a.passwordData.complexity.symbols){if(33<=e&&47>=e)continue;if(58<=e&&64>=e)continue;if(91<=e&&96>=e)continue;if(123<=e&&126>=e)continue}!a.passwordData.complexity.numbers&&48<=e&&57>=e||
!a.passwordData.complexity.uppercase&&65<=e&&90>=e||(k++,d+=String.fromCharCode(e))}$("#viewPass").attr("title",d);var c=zxcvbn(d);a.passwordData.passLength=d.length;b?(k=b.parent(),e=$("#"+b.attr("id")+"R"),a.outputResult(c,b),b=new MaterialTextfield,k.find("input:password").val(d),k.addClass(b.CssClasses_.IS_DIRTY).removeClass(b.CssClasses_.IS_INVALID),e.val(d).parent().addClass(b.CssClasses_.IS_DIRTY).removeClass(b.CssClasses_.IS_INVALID),a.encryptFormValue(e),k.find("#passLevel").show(500)):(a.outputResult(c),
$("input:password, input.password").val(d),$("#passLevel").show(500))},h=function(){$("<div></div>").dialog({modal:!0,title:a.config().LANG[29],width:"400px",open:function(){var b=$(this),k='<label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" for="checkbox-numbers"><input type="checkbox" id="checkbox-numbers" class="mdl-checkbox__input" name="checkbox-numbers"/><span class="mdl-checkbox__label">'+a.config().LANG[35]+'</span></label><label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" for="checkbox-uppercase"><input type="checkbox" id="checkbox-uppercase" class="mdl-checkbox__input" name="checkbox-uppercase"/><span class="mdl-checkbox__label">'+
a.config().LANG[36]+'</span></label><label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" for="checkbox-symbols"><input type="checkbox" id="checkbox-symbols" class="mdl-checkbox__input" name="checkbox-symbols"/><span class="mdl-checkbox__label">'+a.config().LANG[37]+'</span></label><div class="mdl-textfield mdl-js-textfield textfield-passlength"><input class="mdl-textfield__input" type="number" pattern="[0-9]*" id="passlength" /><label class="mdl-textfield__label" for="passlength">'+a.config().LANG[38]+
'</label></div><button id="btn-complexity" class="mdl-button mdl-js-button mdl-button--raised">Ok</button>';b.html(k);b.dialog("option","position","center");b.ready(function(){$("#checkbox-numbers").prop("checked",a.passwordData.complexity.numbers);$("#checkbox-uppercase").prop("checked",a.passwordData.complexity.uppercase);$("#checkbox-symbols").prop("checked",a.passwordData.complexity.symbols);$("#passlength").val(a.passwordData.complexity.numlength);$("#btn-complexity").click(function(){a.passwordData.complexity.numbers=
$(" #checkbox-numbers").is(":checked");a.passwordData.complexity.uppercase=$("#checkbox-uppercase").is(":checked");a.passwordData.complexity.symbols=$("#checkbox-symbols").is(":checked");a.passwordData.complexity.numlength=parseInt($("#passlength").val());b.dialog("close")});componentHandler.upgradeDom()})},close:function(){$(this).dialog("destroy")}})},f=function(b){b.find(".passwordfield__input").each(function(){var b=$(this);if("true"!==b.attr("data-pass-upgraded")){var d=b.parent(),c=b.attr("id"),
g=$("#"+c+"R"),f='<button id="menu-speed-'+c+'" class="mdl-button mdl-js-button mdl-button--icon" type="button" title="'+a.config().LANG[27]+'"><i class="material-icons">more_vert</i></button>',f=f+('<ul class="mdl-menu mdl-js-menu" for="menu-speed-'+c+'">')+('<li class="mdl-menu__item passGen"><i class="material-icons">settings</i>'+a.config().LANG[28]+"</li>"),f=f+('<li class="mdl-menu__item passComplexity"><i class="material-icons">vpn_key</i>'+a.config().LANG[29]+"</li>"),f=f+('<li class="mdl-menu__item reset"><i class="material-icons">refresh</i>'+
a.config().LANG[30]+"</li>");d.after('<div class="password-actions" />');d.next(".password-actions").prepend('<span class="passLevel passLevel-'+c+' fullround" title="'+a.config().LANG[31]+'"></span>').prepend('<i class="showpass material-icons" title="'+a.config().LANG[32]+'">remove_red_eye</i>').prepend(f);b.on("keyup",function(){a.checkPassLevel(b)});d=b.parent().next();d.find(".passGen").on("click",function(){e(b);b.focus()});d.find(".passComplexity").on("click",function(){h()});d.find(".showpass").on("mouseover",
function(){$(this).attr("title",b.val())});d.find(".reset").on("click",function(){b.val("");g.val("");componentHandler.upgradeDom()});b.attr("data-pass-upgraded","true")}});b.find(".passwordfield__input-show").each(function(){var b=$(this),d=b.parent(),b=b.attr("id");d.after('<i class="showpass material-icons" title="'+a.config().LANG[32]+'" data-targetid="'+b+'">remove_red_eye</i>')})},l=function(){var a=$("#actions-bar");if(0<a.length){var e=a.find("#actions-bar-logo"),d=!1,c={on:function(){a.css({backgroundColor:"rgba(255, 255, 255, .75)",
borderBottom:"1px solid #ccc"});e.show();d=!0},off:function(){a.css({backgroundColor:"transparent",borderBottom:"none"});e.hide();d=!1}};$(window).on("scroll",function(){var b=$(this).scrollTop()>a.height();if(b&&!d)c.on();else!b&&d&&c.off()}).on("resize",function(){if(0<a.offset().top)c.on()});if(0<a.offset().top)c.on()}};(function(){jQuery.extend(jQuery.fancybox.defaults,{type:"ajax",autoWidth:!0,autoHeight:!0,autoResize:!0,autoCenter:!0,fitToView:!1,minHeight:50,padding:0,helpers:{overlay:{css:{background:"rgba(0, 0, 0, 0.3)"}}},
keys:{close:[27]},afterShow:function(){$("#fancyContainer").find("input[type='text']:visible:first").focus()}});g();l()})();return{activeTooltip:g,passwordDetect:f,password:e,viewsTriggers:{search:function(){var b=$("#frmSearch"),e=$("#res-content");b.find(".icon-searchfav").on("click",function(){var d=$(this).find("i"),c=b.find("input[name='searchfav']");0==c.val()?(d.addClass("mdl-color-text--amber-A200"),d.attr("title",a.config().LANG[53]),c.val(1)):(d.removeClass("mdl-color-text--amber-A200"),
d.attr("title",a.config().LANG[52]),c.val(0));b.submit()});e.on("click","#data-search-header .sort-down,#data-search-header .sort-up",function(){var b=$(this);b.parent().find("a").addClass("filterOn");a.appActions().account.sort(b)}).on("click","#search-rows i.icon-favorite",function(){var b=$(this);a.appActions().account.savefavorite(b,function(){"on"===b.data("status")?(b.addClass("mdl-color-text--amber-A100"),b.attr("title",a.config().LANG[50]),b.html("star")):(b.removeClass("mdl-color-text--amber-A100"),
b.attr("title",a.config().LANG[49]),b.html("star_border"))})}).on("click","#search-rows span.tag",function(){var b="tag:"+this.innerHTML;$("#search").val(b).parent().addClass("is-dirty");a.appActions().account.search()})},common:function(a){f(a);g(a);a.find(".download").button({icons:{primary:"ui-icon-arrowthickstop-1-s"}})}},loading:{show:function(){$("#wrap-loading").show();$("#loading").addClass("is-active")},hide:function(){$("#wrap-loading").hide();$("#loading").removeClass("is-active")}},ajax:{complete:function(){componentHandler.upgradeDom()}}}};
$(" #checkbox-numbers").is(":checked");a.passwordData.complexity.uppercase=$("#checkbox-uppercase").is(":checked");a.passwordData.complexity.symbols=$("#checkbox-symbols").is(":checked");a.passwordData.complexity.numlength=parseInt($("#passlength").val());b.dialog("close")});componentHandler.upgradeDom()})},close:function(){$(this).dialog("destroy")}})},l=function(b){b.find(".passwordfield__input").each(function(){var b=$(this);if("true"!==b.attr("data-pass-upgraded")){var d=b.parent(),e=b.attr("id"),
c=$("#"+e+"R"),f='<button id="menu-speed-'+e+'" class="mdl-button mdl-js-button mdl-button--icon" type="button" title="'+a.config().LANG[27]+'"><i class="material-icons">more_vert</i></button>',f=f+('<ul class="mdl-menu mdl-js-menu" for="menu-speed-'+e+'">')+('<li class="mdl-menu__item passGen"><i class="material-icons">settings</i>'+a.config().LANG[28]+"</li>"),f=f+('<li class="mdl-menu__item passComplexity"><i class="material-icons">vpn_key</i>'+a.config().LANG[29]+"</li>"),f=f+('<li class="mdl-menu__item reset"><i class="material-icons">refresh</i>'+
a.config().LANG[30]+"</li>");d.after('<div class="password-actions" />');d.next(".password-actions").prepend('<span class="passLevel passLevel-'+e+' fullround" title="'+a.config().LANG[31]+'"></span>').prepend('<i class="showpass material-icons" title="'+a.config().LANG[32]+'">remove_red_eye</i>').prepend(f);b.on("keyup",function(){a.checkPassLevel(b)});d=b.parent().next();d.find(".passGen").on("click",function(){g(b);b.focus()});d.find(".passComplexity").on("click",function(){h()});d.find(".showpass").on("mouseover",
function(){$(this).attr("title",b.val())});d.find(".reset").on("click",function(){b.val("");c.val("");componentHandler.upgradeDom()});b.attr("data-pass-upgraded","true")}});b.find(".passwordfield__input-show").each(function(){var b=$(this),d=b.parent(),b=b.attr("id");d.after('<i class="showpass material-icons" title="'+a.config().LANG[32]+'" data-targetid="'+b+'">remove_red_eye</i>')})},m=function(b){f.info("setupDatePicker");var c={format:"YYYY-MM-DD",lang:"en",weekStart:0,time:!1,cancelText:a.config().LANG[44],
okText:a.config().LANG[43],clearText:a.config().LANG[30],nowText:a.config().LANG[56],minDate:new Date,triggerEvent:"dateIconClick"};b.find(".password-datefield__input").each(function(){var a=$(this);a.bootstrapMaterialDatePicker(c);a.parent().append("<input type='hidden' name='passworddatechange_unix' value='"+moment(a.val()).format("X")+"' />");a.parent().next("i").on("click",function(){a.trigger("dateIconClick")});a.on("change",function(){var b;b=moment(a.val()).format("X");a.parent().find("input[name='passworddatechange_unix']").val(b)})})},
n=function(){var a=$("#actions-bar");if(0<a.length){var c=a.find("#actions-bar-logo"),d=!1,e={on:function(){a.css({backgroundColor:"rgba(255, 255, 255, .75)",borderBottom:"1px solid #ccc"});c.show();d=!0},off:function(){a.css({backgroundColor:"transparent",borderBottom:"none"});c.hide();d=!1}};$(window).on("scroll",function(){var b=$(this).scrollTop()>a.height();if(b&&!d)e.on();else!b&&d&&e.off()}).on("resize",function(){if(0<a.offset().top)e.on()});if(0<a.offset().top)e.on()}};(function(){jQuery.extend(jQuery.fancybox.defaults,
{type:"ajax",autoWidth:!0,autoHeight:!0,autoResize:!0,autoCenter:!0,fitToView:!1,minHeight:50,padding:0,helpers:{overlay:{css:{background:"rgba(0, 0, 0, 0.3)"}}},keys:{close:[27]},afterShow:function(){$("#fancyContainer").find("input[type='text']:visible:first").focus()}});c();n()})();return{activeTooltip:c,passwordDetect:l,password:g,viewsTriggers:{search:function(){var b=$("#frmSearch"),c=$("#res-content");b.find(".icon-searchfav").on("click",function(){var d=$(this).find("i"),c=b.find("input[name='searchfav']");
0==c.val()?(d.addClass("mdl-color-text--amber-A200"),d.attr("title",a.config().LANG[53]),c.val(1)):(d.removeClass("mdl-color-text--amber-A200"),d.attr("title",a.config().LANG[52]),c.val(0));b.submit()});c.on("click","#data-search-header .sort-down,#data-search-header .sort-up",function(){var b=$(this);b.parent().find("a").addClass("filterOn");a.appActions().account.sort(b)}).on("click","#search-rows i.icon-favorite",function(){var b=$(this);a.appActions().account.savefavorite(b,function(){"on"===
b.data("status")?(b.addClass("mdl-color-text--amber-A100"),b.attr("title",a.config().LANG[50]),b.html("star")):(b.removeClass("mdl-color-text--amber-A100"),b.attr("title",a.config().LANG[49]),b.html("star_border"))})}).on("click","#search-rows span.tag",function(){var b="tag:"+this.innerHTML;$("#search").val(b).parent().addClass("is-dirty");a.appActions().account.search()})},common:function(a){l(a);c(a);m(a);a.find(".download").button({icons:{primary:"ui-icon-arrowthickstop-1-s"}})}},loading:{show:function(){$("#wrap-loading").show();
$("#loading").addClass("is-active")},hide:function(){$("#wrap-loading").hide();$("#loading").removeClass("is-active")}},ajax:{complete:function(){componentHandler.upgradeDom()}}}};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,48 @@
var $jscomp={scope:{},findInternal:function(e,f,g){e instanceof String&&(e=String(e));for(var a=e.length,b=0;b<a;b++){var d=e[b];if(f.call(g,d,b,e))return{i:b,v:d}}return{i:-1,v:void 0}}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(e,f,g){if(g.get||g.set)throw new TypeError("ES3 does not support getters and setters.");e!=Array.prototype&&e!=Object.prototype&&(e[f]=g.value)};
$jscomp.getGlobal=function(e){return"undefined"!=typeof window&&window===e?e:"undefined"!=typeof global?global:e};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(e,f,g,a){if(f){g=$jscomp.global;e=e.split(".");for(a=0;a<e.length-1;a++){var b=e[a];b in g||(g[b]={});g=g[b]}e=e[e.length-1];a=g[e];f=f(a);f!=a&&null!=f&&$jscomp.defineProperty(g,e,{configurable:!0,writable:!0,value:f})}};
$jscomp.polyfill("Array.prototype.find",function(e){return e?e:function(e,g){return $jscomp.findInternal(this,e,g).v}},"es6-impl","es3");
(function(e,f){function g(a,b){this.currentView=0;this.minDate;this.maxDate;this._attachedEvents=[];this.element=a;this.$element=e(a);this.params={date:!0,time:!0,format:"YYYY-MM-DD",minDate:null,maxDate:null,currentDate:null,lang:"en",weekStart:0,shortTime:!1,clearButton:!1,nowButton:!1,cancelText:"Cancel",okText:"OK",clearText:"Clear",nowText:"Now",switchOnClick:!1,triggerEvent:"focus"};this.params=e.fn.extend(this.params,b);this.name="dtp_"+this.setName();this.$element.attr("data-dtp",this.name);
f.locale(this.params.lang);this.init()}f.locale("en");e.fn.bootstrapMaterialDatePicker=function(a,b){this.each(function(){if(e.data(this,"plugin_bootstrapMaterialDatePicker")){if("function"===typeof e.data(this,"plugin_bootstrapMaterialDatePicker")[a])e.data(this,"plugin_bootstrapMaterialDatePicker")[a](b);"destroy"===a&&e.removeData(this)}else e.data(this,"plugin_bootstrapMaterialDatePicker",new g(this,a))});return this};g.prototype={init:function(){this.initDays();this.initDates();this.initTemplate();
this.initButtons();this._attachEvent(e(window),"resize",this._centerBox.bind(this));this._attachEvent(this.$dtpElement.find(".dtp-content"),"click",this._onElementClick.bind(this));this._attachEvent(this.$dtpElement,"click",this._onBackgroundClick.bind(this));this._attachEvent(this.$dtpElement.find(".dtp-close > a"),"click",this._onCloseClick.bind(this));this._attachEvent(this.$element,this.params.triggerEvent,this._fireCalendar.bind(this))},initDays:function(){this.days=[];for(var a=this.params.weekStart;7>
this.days.length;a++)6<a&&(a=0),this.days.push(a.toString())},initDates:function(){if(0<this.$element.val().length)this.currentDate="undefined"!==typeof this.params.format&&null!==this.params.format?f(this.$element.val(),this.params.format).locale(this.params.lang):f(this.$element.val()).locale(this.params.lang);else if("undefined"!==typeof this.$element.attr("value")&&null!==this.$element.attr("value")&&""!==this.$element.attr("value"))"string"===typeof this.$element.attr("value")&&(this.currentDate=
"undefined"!==typeof this.params.format&&null!==this.params.format?f(this.$element.attr("value"),this.params.format).locale(this.params.lang):f(this.$element.attr("value")).locale(this.params.lang));else if("undefined"!==typeof this.params.currentDate&&null!==this.params.currentDate){if("string"===typeof this.params.currentDate)this.currentDate="undefined"!==typeof this.params.format&&null!==this.params.format?f(this.params.currentDate,this.params.format).locale(this.params.lang):f(this.params.currentDate).locale(this.params.lang);
else if("undefined"===typeof this.params.currentDate.isValid||"function"!==typeof this.params.currentDate.isValid){var a=this.params.currentDate.getTime();this.currentDate=f(a,"x").locale(this.params.lang)}else this.currentDate=this.params.currentDate;this.$element.val(this.currentDate.format(this.params.format))}else this.currentDate=f();"undefined"!==typeof this.params.minDate&&null!==this.params.minDate?"string"===typeof this.params.minDate?this.minDate="undefined"!==typeof this.params.format&&
null!==this.params.format?f(this.params.minDate,this.params.format).locale(this.params.lang):f(this.params.minDate).locale(this.params.lang):"undefined"===typeof this.params.minDate.isValid||"function"!==typeof this.params.minDate.isValid?(a=this.params.minDate.getTime(),this.minDate=f(a,"x").locale(this.params.lang)):this.minDate=this.params.minDate:null===this.params.minDate&&(this.minDate=null);"undefined"!==typeof this.params.maxDate&&null!==this.params.maxDate?"string"===typeof this.params.maxDate?
this.maxDate="undefined"!==typeof this.params.format&&null!==this.params.format?f(this.params.maxDate,this.params.format).locale(this.params.lang):f(this.params.maxDate).locale(this.params.lang):"undefined"===typeof this.params.maxDate.isValid||"function"!==typeof this.params.maxDate.isValid?(a=this.params.maxDate.getTime(),this.maxDate=f(a,"x").locale(this.params.lang)):this.maxDate=this.params.maxDate:null===this.params.maxDate&&(this.maxDate=null);this.isAfterMinDate(this.currentDate)||(this.currentDate=
f(this.minDate));this.isBeforeMaxDate(this.currentDate)||(this.currentDate=f(this.maxDate))},initTemplate:function(){this.template='<div class="dtp hidden" id="'+this.name+'"><div class="dtp-content"><div class="dtp-date-view"><header class="dtp-header"><div class="dtp-actual-day">Lundi</div><div class="dtp-close"><a href="javascript:void(0);"><i class="material-icons">clear</i></a></div></header><div class="dtp-date hidden"><div><div class="left center p10"><a href="javascript:void(0);" class="dtp-select-month-before"><i class="material-icons">chevron_left</i></a></div><div class="dtp-actual-month p80">MAR</div><div class="right center p10"><a href="javascript:void(0);" class="dtp-select-month-after"><i class="material-icons">chevron_right</i></a></div><div class="clearfix"></div></div><div class="dtp-actual-num">13</div><div><div class="left center p10"><a href="javascript:void(0);" class="dtp-select-year-before"><i class="material-icons">chevron_left</i></a></div><div class="dtp-actual-year p80">2014</div><div class="right center p10"><a href="javascript:void(0);" class="dtp-select-year-after"><i class="material-icons">chevron_right</i></a></div><div class="clearfix"></div></div></div><div class="dtp-time hidden"><div class="dtp-actual-maxtime">23:55</div></div><div class="dtp-picker"><div class="dtp-picker-calendar"></div><div class="dtp-picker-datetime hidden"><div class="dtp-actual-meridien"><div class="left p20"><a class="dtp-meridien-am" href="javascript:void(0);">AM</a></div><div class="dtp-actual-time p60"></div><div class="right p20"><a class="dtp-meridien-pm" href="javascript:void(0);">PM</a></div><div class="clearfix"></div></div><div id="dtp-svg-clock"></div></div></div></div><div class="dtp-buttons"><button class="dtp-btn-now btn btn-flat hidden mdl-button mdl-js-button">'+
this.params.nowText+'</button><button class="dtp-btn-clear btn btn-flat hidden mdl-button mdl-js-button">'+this.params.clearText+'</button><button class="dtp-btn-cancel btn btn-flat mdl-button mdl-js-button mdl-button--primary">'+this.params.cancelText+'</button><button class="dtp-btn-ok btn btn-flat mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--primary">'+this.params.okText+'</button><div class="clearfix"></div></div></div></div>';var a=e("body");0>=a.find("#"+this.name).length&&(a.append(this.template),
this&&(this.dtpElement=a.find("#"+this.name)),this.$dtpElement=e(this.dtpElement))},initButtons:function(){this._attachEvent(this.$dtpElement.find(".dtp-btn-cancel"),"click",this._onCancelClick.bind(this));this._attachEvent(this.$dtpElement.find(".dtp-btn-ok"),"click",this._onOKClick.bind(this));this._attachEvent(this.$dtpElement.find("a.dtp-select-month-before"),"click",this._onMonthBeforeClick.bind(this));this._attachEvent(this.$dtpElement.find("a.dtp-select-month-after"),"click",this._onMonthAfterClick.bind(this));
this._attachEvent(this.$dtpElement.find("a.dtp-select-year-before"),"click",this._onYearBeforeClick.bind(this));this._attachEvent(this.$dtpElement.find("a.dtp-select-year-after"),"click",this._onYearAfterClick.bind(this));!0===this.params.clearButton&&(this._attachEvent(this.$dtpElement.find(".dtp-btn-clear"),"click",this._onClearClick.bind(this)),this.$dtpElement.find(".dtp-btn-clear").removeClass("hidden"));!0===this.params.nowButton&&(this._attachEvent(this.$dtpElement.find(".dtp-btn-now"),"click",
this._onNowClick.bind(this)),this.$dtpElement.find(".dtp-btn-now").removeClass("hidden"));!0===this.params.nowButton&&!0===this.params.clearButton?this.$dtpElement.find(".dtp-btn-clear, .dtp-btn-now, .dtp-btn-cancel, .dtp-btn-ok").addClass("btn-xs"):!0!==this.params.nowButton&&!0!==this.params.clearButton||this.$dtpElement.find(".dtp-btn-clear, .dtp-btn-now, .dtp-btn-cancel, .dtp-btn-ok").addClass("btn-sm")},initMeridienButtons:function(){this.$dtpElement.find("a.dtp-meridien-am").off("click").on("click",
this._onSelectAM.bind(this));this.$dtpElement.find("a.dtp-meridien-pm").off("click").on("click",this._onSelectPM.bind(this))},initDate:function(a){this.currentView=0;this.$dtpElement.find(".dtp-picker-calendar").removeClass("hidden");this.$dtpElement.find(".dtp-picker-datetime").addClass("hidden");a="undefined"!==typeof this.currentDate&&null!==this.currentDate?this.currentDate:null;var b=this.generateCalendar(this.currentDate);"undefined"!==typeof b.week&&"undefined"!==typeof b.days&&(b=this.constructHTMLCalendar(a,
b),this.$dtpElement.find("a.dtp-select-day").off("click"),this.$dtpElement.find(".dtp-picker-calendar").html(b),this.$dtpElement.find("a.dtp-select-day").on("click",this._onSelectDate.bind(this)),this.toggleButtons(a));this._centerBox();this.showDate(a)},initHours:function(){this.currentView=1;this.showTime(this.currentDate);this.initMeridienButtons();12>this.currentDate.hour()?this.$dtpElement.find("a.dtp-meridien-am").click():this.$dtpElement.find("a.dtp-meridien-pm").click();var a=this.params.shortTime?
"h":"H";this.$dtpElement.find(".dtp-picker-datetime").removeClass("hidden");this.$dtpElement.find(".dtp-picker-calendar").addClass("hidden");for(var b=this.createSVGClock(!0),d=0;12>d;d++){var c=-(162*Math.sin(d/12*-Math.PI*2)),e=-(162*Math.cos(d/12*-Math.PI*2)),f=this.currentDate.format(a)==d?"#8BC34A":"transparent",g=this.currentDate.format(a)==d?"#fff":"#000",f=this.createSVGElement("circle",{id:"h-"+d,"class":"dtp-select-hour",style:"cursor:pointer",r:"30",cx:c,cy:e,fill:f,"data-hour":d}),c=this.createSVGElement("text",
{id:"th-"+d,"class":"dtp-select-hour-text","text-anchor":"middle",style:"cursor:pointer","font-weight":"bold","font-size":"20",x:c,y:e+7,fill:g,"data-hour":d});c.textContent=0===d?this.params.shortTime?12:d:d;this.toggleTime(d,!0)?(f.addEventListener("click",this._onSelectHour.bind(this)),c.addEventListener("click",this._onSelectHour.bind(this))):(f.className+=" disabled",c.className+=" disabled",c.setAttribute("fill","#bdbdbd"));b.appendChild(f);b.appendChild(c)}if(!this.params.shortTime){for(d=
0;12>d;d++)c=-(110*Math.sin(d/12*-Math.PI*2)),e=-(110*Math.cos(d/12*-Math.PI*2)),f=this.currentDate.format(a)==d+12?"#8BC34A":"transparent",g=this.currentDate.format(a)==d+12?"#fff":"#000",f=this.createSVGElement("circle",{id:"h-"+(d+12),"class":"dtp-select-hour",style:"cursor:pointer",r:"30",cx:c,cy:e,fill:f,"data-hour":d+12}),c=this.createSVGElement("text",{id:"th-"+(d+12),"class":"dtp-select-hour-text","text-anchor":"middle",style:"cursor:pointer","font-weight":"bold","font-size":"22",x:c,y:e+
7,fill:g,"data-hour":d+12}),c.textContent=d+12,this.toggleTime(d+12,!0)?(f.addEventListener("click",this._onSelectHour.bind(this)),c.addEventListener("click",this._onSelectHour.bind(this))):(f.className+=" disabled",c.className+=" disabled",c.setAttribute("fill","#bdbdbd")),b.appendChild(f),b.appendChild(c);this.$dtpElement.find("a.dtp-meridien-am").addClass("hidden");this.$dtpElement.find("a.dtp-meridien-pm").addClass("hidden")}this._centerBox()},initMinutes:function(){this.currentView=2;this.showTime(this.currentDate);
this.initMeridienButtons();12>this.currentDate.hour()?this.$dtpElement.find("a.dtp-meridien-am").click():this.$dtpElement.find("a.dtp-meridien-pm").click();this.$dtpElement.find(".dtp-picker-calendar").addClass("hidden");this.$dtpElement.find(".dtp-picker-datetime").removeClass("hidden");for(var a=this.createSVGClock(!1),b=0;60>b;b++){var d=0===b%5?162:158,c=0===b%5?30:20,e=-(d*Math.sin(b/60*-Math.PI*2)),d=-(d*Math.cos(b/60*-Math.PI*2)),f=this.currentDate.format("m")==b?"#8BC34A":"transparent",c=
this.createSVGElement("circle",{id:"m-"+b,"class":"dtp-select-minute",style:"cursor:pointer",r:c,cx:e,cy:d,fill:f,"data-minute":b});this.toggleTime(b,!1)?c.addEventListener("click",this._onSelectMinute.bind(this)):c.className+=" disabled";a.appendChild(c)}for(b=0;60>b;b++)0===b%5&&(e=-(162*Math.sin(b/60*-Math.PI*2)),d=-(162*Math.cos(b/60*-Math.PI*2)),f=this.currentDate.format("m")==b?"#fff":"#000",c=this.createSVGElement("text",{id:"tm-"+b,"class":"dtp-select-minute-text","text-anchor":"middle",style:"cursor:pointer",
"font-weight":"bold","font-size":"20",x:e,y:d+7,fill:f,"data-minute":b}),c.textContent=b,this.toggleTime(b,!1)?c.addEventListener("click",this._onSelectMinute.bind(this)):(c.className+=" disabled",c.setAttribute("fill","#bdbdbd")),a.appendChild(c));this._centerBox()},animateHands:function(){var a=this.currentDate.hour(),b=this.currentDate.minute();this.$dtpElement.find(".hour-hand")[0].setAttribute("transform","rotate("+360*a/12+")");this.$dtpElement.find(".minute-hand")[0].setAttribute("transform",
"rotate("+360*b/60+")")},createSVGClock:function(a){var b=this.params.shortTime?-120:-90,d=this.createSVGElement("svg",{"class":"svg-clock",viewBox:"0,0,400,400"}),c=this.createSVGElement("g",{transform:"translate(200,200) "}),e=this.createSVGElement("circle",{r:"192",fill:"#eee",stroke:"#bdbdbd","stroke-width":2}),f=this.createSVGElement("circle",{r:"15",fill:"#757575"});c.appendChild(e);a?(a=this.createSVGElement("line",{"class":"minute-hand",x1:0,y1:0,x2:0,y2:-150,stroke:"#bdbdbd","stroke-width":2}),
b=this.createSVGElement("line",{"class":"hour-hand",x1:0,y1:0,x2:0,y2:b,stroke:"#8BC34A","stroke-width":8}),c.appendChild(a),c.appendChild(b)):(a=this.createSVGElement("line",{"class":"minute-hand",x1:0,y1:0,x2:0,y2:-150,stroke:"#8BC34A","stroke-width":2}),b=this.createSVGElement("line",{"class":"hour-hand",x1:0,y1:0,x2:0,y2:b,stroke:"#bdbdbd","stroke-width":8}),c.appendChild(b),c.appendChild(a));c.appendChild(f);d.appendChild(c);this.$dtpElement.find("#dtp-svg-clock").empty();this.$dtpElement.find("#dtp-svg-clock")[0].appendChild(d);
this.animateHands();return c},createSVGElement:function(a,b){var d=document.createElementNS("http://www.w3.org/2000/svg",a),c;for(c in b)d.setAttribute(c,b[c]);return d},isAfterMinDate:function(a,b,d){var c=!0;"undefined"!==typeof this.minDate&&null!==this.minDate&&(c=f(this.minDate),a=f(a),b||d||(c.hour(0),c.minute(0),a.hour(0),a.minute(0)),c.second(0),a.second(0),c.millisecond(0),a.millisecond(0),d||(a.minute(0),c.minute(0)),c=parseInt(a.format("X"))>=parseInt(c.format("X")));return c},isBeforeMaxDate:function(a,
b,d){var c=!0;"undefined"!==typeof this.maxDate&&null!==this.maxDate&&(c=f(this.maxDate),a=f(a),b||d||(c.hour(0),c.minute(0),a.hour(0),a.minute(0)),c.second(0),a.second(0),c.millisecond(0),a.millisecond(0),d||(a.minute(0),c.minute(0)),c=parseInt(a.format("X"))<=parseInt(c.format("X")));return c},rotateElement:function(a,b){e(a).css({WebkitTransform:"rotate("+b+"deg)","-moz-transform":"rotate("+b+"deg)"})},showDate:function(a){a&&(this.$dtpElement.find(".dtp-actual-day").html(a.locale(this.params.lang).format("dddd")),
this.$dtpElement.find(".dtp-actual-month").html(a.locale(this.params.lang).format("MMM").toUpperCase()),this.$dtpElement.find(".dtp-actual-num").html(a.locale(this.params.lang).format("DD")),this.$dtpElement.find(".dtp-actual-year").html(a.locale(this.params.lang).format("YYYY")))},showTime:function(a){if(a){var b=a.minute(),b=(this.params.shortTime?a.format("hh"):a.format("HH"))+":"+(2==b.toString().length?b:"0"+b)+(this.params.shortTime?" "+a.format("A"):"");this.params.date?this.$dtpElement.find(".dtp-actual-time").html(b):
(this.params.shortTime?this.$dtpElement.find(".dtp-actual-day").html(a.format("A")):this.$dtpElement.find(".dtp-actual-day").html("&nbsp;"),this.$dtpElement.find(".dtp-actual-maxtime").html(b))}},selectDate:function(a){a&&(this.currentDate.date(a),this.showDate(this.currentDate),this.$element.trigger("dateSelected",this.currentDate))},generateCalendar:function(a){var b={};if(null!==a){var d=f(a).locale(this.params.lang).startOf("month");a=f(a).locale(this.params.lang).endOf("month");var c=d.format("d");
b.week=this.days;b.days=[];for(var e=d.date();e<=a.date();e++){if(e===d.date()){var g=b.week.indexOf(c.toString());if(0<g)for(var h=0;h<g;h++)b.days.push(0)}b.days.push(f(d).locale(this.params.lang).date(e))}}return b},constructHTMLCalendar:function(a,b){var d;d=""+('<div class="dtp-picker-month">'+a.locale(this.params.lang).format("MMMM YYYY")+"</div>");d+='<table class="table dtp-picker-days"><thead>';for(var c=0;c<b.week.length;c++)d+="<th>"+f(parseInt(b.week[c]),"d").locale(this.params.lang).format("dd").substring(0,
1)+"</th>";d+="</thead><tbody><tr>";for(c=0;c<b.days.length;c++)0==c%7&&(d+="</tr><tr>"),d+='<td data-date="'+f(b.days[c]).locale(this.params.lang).format("D")+'">',0!=b.days[c]&&(d=!1===this.isBeforeMaxDate(f(b.days[c]),!1,!1)||!1===this.isAfterMinDate(f(b.days[c]),!1,!1)?d+('<span class="dtp-select-day">'+f(b.days[c]).locale(this.params.lang).format("DD")+"</span>"):f(b.days[c]).locale(this.params.lang).format("DD")===f(this.currentDate).locale(this.params.lang).format("DD")?d+('<a href="javascript:void(0);" class="dtp-select-day selected">'+
f(b.days[c]).locale(this.params.lang).format("DD")+"</a>"):d+('<a href="javascript:void(0);" class="dtp-select-day">'+f(b.days[c]).locale(this.params.lang).format("DD")+"</a>"),d+="</td>");return d+"</tr></tbody></table>"},setName:function(){for(var a="",b=0;5>b;b++)a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(62*Math.random()));return a},isPM:function(){return this.$dtpElement.find("a.dtp-meridien-pm").hasClass("selected")},setElementValue:function(){this.$element.trigger("beforeChange",
this.currentDate);this.$element.hasClass("mdl-textfield__input")&&(this.$element.removeClass("empty"),this.$element.parent().addClass("is-dirty"));this.$element.val(f(this.currentDate).locale(this.params.lang).format(this.params.format));this.$element.trigger("change",this.currentDate)},toggleButtons:function(a){if(a&&a.isValid()){var b=f(a).locale(this.params.lang).startOf("month"),d=f(a).locale(this.params.lang).endOf("month");this.isAfterMinDate(b,!1,!1)?this.$dtpElement.find("a.dtp-select-month-before").removeClass("invisible"):
this.$dtpElement.find("a.dtp-select-month-before").addClass("invisible");this.isBeforeMaxDate(d,!1,!1)?this.$dtpElement.find("a.dtp-select-month-after").removeClass("invisible"):this.$dtpElement.find("a.dtp-select-month-after").addClass("invisible");b=f(a).locale(this.params.lang).startOf("year");a=f(a).locale(this.params.lang).endOf("year");this.isAfterMinDate(b,!1,!1)?this.$dtpElement.find("a.dtp-select-year-before").removeClass("invisible"):this.$dtpElement.find("a.dtp-select-year-before").addClass("invisible");
this.isBeforeMaxDate(a,!1,!1)?this.$dtpElement.find("a.dtp-select-year-after").removeClass("invisible"):this.$dtpElement.find("a.dtp-select-year-after").addClass("invisible")}},toggleTime:function(a,b){var d;b?(d=f(this.currentDate),d.hour(this.convertHours(a)).minute(0).second(0),d=!(!1===this.isAfterMinDate(d,!0,!1)||!1===this.isBeforeMaxDate(d,!0,!1))):(d=f(this.currentDate),d.minute(a).second(0),d=!(!1===this.isAfterMinDate(d,!0,!0)||!1===this.isBeforeMaxDate(d,!0,!0)));return d},_attachEvent:function(a,
b,d){a.on(b,null,null,d);this._attachedEvents.push([a,b,d])},_detachEvents:function(){for(var a=this._attachedEvents.length-1;0<=a;a--)this._attachedEvents[a][0].off(this._attachedEvents[a][1],this._attachedEvents[a][2]),this._attachedEvents.splice(a,1)},_fireCalendar:function(){this.currentView=0;this.$element.blur();this.initDates();this.show();this.params.date?(this.$dtpElement.find(".dtp-date").removeClass("hidden"),this.initDate()):this.params.time&&(this.$dtpElement.find(".dtp-time").removeClass("hidden"),
this.initHours())},_onBackgroundClick:function(a){a.stopPropagation();this.hide()},_onElementClick:function(a){a.stopPropagation()},_onKeydown:function(a){27===a.which&&this.hide()},_onCloseClick:function(){this.hide()},_onClearClick:function(){this.currentDate=null;this.$element.trigger("beforeChange",this.currentDate);this.hide();"undefined"!==typeof e.material&&this.$element.addClass("empty");this.$element.val("");this.$element.trigger("change",this.currentDate)},_onNowClick:function(){this.currentDate=
f();!0===this.params.date&&(this.showDate(this.currentDate),0===this.currentView&&this.initDate());if(!0===this.params.time){this.showTime(this.currentDate);switch(this.currentView){case 1:this.initHours();break;case 2:this.initMinutes()}this.animateHands()}},_onOKClick:function(){switch(this.currentView){case 0:!0===this.params.time?this.initHours():(this.setElementValue(),this.hide());break;case 1:this.initMinutes();break;case 2:this.setElementValue(),this.hide()}},_onCancelClick:function(){if(this.params.time)switch(this.currentView){case 0:this.hide();
break;case 1:this.params.date?this.initDate():this.hide();break;case 2:this.initHours()}else this.hide()},_onMonthBeforeClick:function(){this.currentDate.subtract(1,"months");this.initDate(this.currentDate)},_onMonthAfterClick:function(){this.currentDate.add(1,"months");this.initDate(this.currentDate)},_onYearBeforeClick:function(){this.currentDate.subtract(1,"years");this.initDate(this.currentDate)},_onYearAfterClick:function(){this.currentDate.add(1,"years");this.initDate(this.currentDate)},_onSelectDate:function(a){this.$dtpElement.find("a.dtp-select-day").removeClass("selected");
e(a.currentTarget).addClass("selected");this.selectDate(e(a.currentTarget).parent().data("date"));!0===this.params.switchOnClick&&!0===this.params.time&&setTimeout(this.initHours.bind(this),200);!0===this.params.switchOnClick&&!1===this.params.time&&setTimeout(this._onOKClick.bind(this),200)},_onSelectHour:function(a){if(!e(a.target).hasClass("disabled")){var b=e(a.target).data("hour");a=e(a.target).parent();for(var d=a.find(".dtp-select-hour"),c=0;c<d.length;c++)e(d[c]).attr("fill","transparent");
d=a.find(".dtp-select-hour-text");for(c=0;c<d.length;c++)e(d[c]).attr("fill","#000");e(a.find("#h-"+b)).attr("fill","#8BC34A");e(a.find("#th-"+b)).attr("fill","#fff");this.currentDate.hour(parseInt(b));!0===this.params.shortTime&&this.isPM()&&this.currentDate.add(12,"hours");this.showTime(this.currentDate);this.animateHands();!0===this.params.switchOnClick&&setTimeout(this.initMinutes.bind(this),200)}},_onSelectMinute:function(a){if(!e(a.target).hasClass("disabled")){var b=e(a.target).data("minute");
a=e(a.target).parent();for(var d=a.find(".dtp-select-minute"),c=0;c<d.length;c++)e(d[c]).attr("fill","transparent");d=a.find(".dtp-select-minute-text");for(c=0;c<d.length;c++)e(d[c]).attr("fill","#000");e(a.find("#m-"+b)).attr("fill","#8BC34A");e(a.find("#tm-"+b)).attr("fill","#fff");this.currentDate.minute(parseInt(b));this.showTime(this.currentDate);this.animateHands();!0===this.params.switchOnClick&&setTimeout(function(){this.setElementValue();this.hide()}.bind(this),200)}},_onSelectAM:function(a){e(".dtp-actual-meridien").find("a").removeClass("selected");
e(a.currentTarget).addClass("selected");12<=this.currentDate.hour()&&this.currentDate.subtract(12,"hours")&&this.showTime(this.currentDate);this.toggleTime(1===this.currentView)},_onSelectPM:function(a){e(".dtp-actual-meridien").find("a").removeClass("selected");e(a.currentTarget).addClass("selected");12>this.currentDate.hour()&&this.currentDate.add(12,"hours")&&this.showTime(this.currentDate);this.toggleTime(1===this.currentView)},convertHours:function(a){var b=a;!0===this.params.shortTime&&12>a&&
this.isPM()&&(b+=12);return b},setDate:function(a){this.params.currentDate=a;this.initDates()},setMinDate:function(a){this.params.minDate=a;this.initDates()},setMaxDate:function(a){this.params.maxDate=a;this.initDates()},destroy:function(){this._detachEvents();this.$dtpElement.remove()},show:function(){this.$dtpElement.removeClass("hidden");this._attachEvent(e(window),"keydown",this._onKeydown.bind(this));this._centerBox()},hide:function(){e(window).off("keydown",null,null,this._onKeydown.bind(this));
this.$dtpElement.addClass("hidden")},_centerBox:function(){var a=(this.$dtpElement.height()-this.$dtpElement.find(".dtp-content").height())/2;this.$dtpElement.find(".dtp-content").css("marginLeft",-(this.$dtpElement.find(".dtp-content").width()/2)+"px");this.$dtpElement.find(".dtp-content").css("top",a+"px")},enableDays:function(){var a=this.params.enableDays;a&&e(".dtp-picker-days tbody tr td").each(function(){0<=e.inArray(e(this).index(),a)||e(this).find("a").css({background:"#e3e3e3",cursor:"no-drop",
opacity:"0.5"}).off("click")})}}})(jQuery,moment);

File diff suppressed because one or more lines are too long

View File

@@ -9,26 +9,54 @@
<table class="data round">
<tr>
<td class="descField"><?php echo _('Nombre'); ?></td>
<td class="valField"><?php echo $accountData->getAccountName(); ?></td>
<td class="valField">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input id="name" name="name" type="text"
class="mdl-textfield__input mdl-color-text--indigo-400"
value="<?php echo $accountData->getAccountName(); ?>" readonly>
<label class="mdl-textfield__label" for="name"><?php echo _('Nombre de cuenta'); ?></label>
</div>
</td>
</tr>
<tr>
<td class="descField"><?php echo _('Cliente'); ?></td>
<td class="valField"><?php echo $accountData->customer_name; ?></td>
<td class="valField">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input id="customer" name="customer" type="text"
class="mdl-textfield__input mdl-color-text--indigo-400"
value="<?php echo $accountData->getCustomerName(); ?>" readonly>
<label class="mdl-textfield__label" for="customer"><?php echo _('Cliente'); ?></label>
</div>
</td>
</tr>
<tr>
<td class="descField"><?php echo _('URL / IP'); ?></td>
<td class="valField"><A href="<?php echo $accountData->getAccountUrl(); ?>"
target="_blank"><?php echo $accountData->getAccountUrl(); ?></td>
<td class="valField">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input id="url" name="url" type="text"
class="mdl-textfield__input mdl-color-text--indigo-400"
value="<?php echo $accountData->getAccountUrl(); ?>" readonly>
<label class="mdl-textfield__label" for="url"><?php echo _('URL / IP'); ?></label>
</div>
</td>
</tr>
<tr>
<td class="descField"><?php echo _('Usuario'); ?></td>
<td class="valField"><?php echo $accountData->getAccountLogin(); ?></td>
<td class="valField">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input id="user" name="user" type="text"
class="mdl-textfield__input mdl-color-text--indigo-400"
value="<?php echo $accountData->getAccountLogin(); ?>" readonly>
<label class="mdl-textfield__label" for="user"><?php echo _('Usuario'); ?></label>
</div>
</td>
</tr>
<tr>
<td class="descField"><?php echo _('Clave'); ?></td>
<td class="valField">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input id="accountpass" name="pass" type="password" required class="mdl-textfield__input mdl-color-text--indigo-400 passwordfield__input"
<input id="accountpass" name="pass" type="password" required
class="mdl-textfield__input mdl-color-text--indigo-400 passwordfield__input"
maxlength="255" autocomplete="off">
<label class="mdl-textfield__label" for="accountpass"><?php echo _('Clave'); ?></label>
</div>
@@ -38,12 +66,27 @@
<td class="descField"><?php echo _('Clave (repetir)'); ?></td>
<td class="valField">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input id="accountpassR" name="passR" type="password" required class="mdl-textfield__input mdl-color-text--indigo-400"
<input id="accountpassR" name="passR" type="password" required
class="mdl-textfield__input mdl-color-text--indigo-400"
maxlength="255" autocomplete="off">
<label class="mdl-textfield__label" for="accountpassR"><?php echo _('Clave'); ?></label>
</div>
</td>
</tr>
<tr>
<td class="descField"><?php echo _('Fecha Caducidad Clave'); ?></td>
<td class="valField">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input id="accountpassdatechange" name="accountpassdatechange" type="date"
class="mdl-textfield__input mdl-color-text--indigo-400 password-datefield__input"
value="<?php echo $accountPassDateChange; ?>">
<label class="mdl-textfield__label"
for="accountpassdatechange"><?php echo _('Fecha'); ?></label>
</div>
<i class="material-icons btn-action"
title="<?php echo _('Seleccionar Fecha'); ?>">date_range</i>
</td>
</tr>
</table>
<input type="hidden" name="actionId" value="<?php echo $actionId; ?>"/>
<input type="hidden" name="accountId" value="<?php echo $accountId; ?>"/>

View File

@@ -124,13 +124,28 @@
</div>
</td>
</tr>
<tr>
<td class="descField"><?php echo _('Fecha Caducidad Clave'); ?></td>
<td class="valField">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input id="accountpassdatechange" name="accountpassdatechange" type="date"
class="mdl-textfield__input mdl-color-text--indigo-400 password-datefield__input"
value="<?php echo $gotData ? $accountData->getAccountPassDateChange() : ''; ?>">
<label class="mdl-textfield__label"
for="accountpassdatechange"><?php echo _('Fecha'); ?></label>
</div>
<i class="material-icons btn-action"
title="<?php echo _('Seleccionar Fecha'); ?>">date_range</i>
</td>
</tr>
<?php endif; ?>
<tr>
<td class="descField"><?php echo _('Notas'); ?></td>
<td class="valField">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<textarea class="mdl-textfield__input mdl-color-text--indigo-400" rows="3" id="notes"
name="notes" maxlength="1000" <?php echo $readonly; ?>><?php echo $gotData ? $accountData->getAccountNotes() : ''; ?></textarea>
name="notes"
maxlength="1000" <?php echo $readonly; ?>><?php echo $gotData ? $accountData->getAccountNotes() : ''; ?></textarea>
<label class="mdl-textfield__label"
for="notes"><?php echo _('Notas sobre la cuenta'); ?></label>
</div>
@@ -267,7 +282,6 @@
});
<?php endif; ?>
sysPassApp.sk.set("<?php echo $sk; ?>");
sysPassApp.triggers().views.account();
});

View File

@@ -78,4 +78,12 @@
</td>
</tr>
<?php endif; ?>
<tr>
<td class="descField"><?php echo _('Fecha de Clave'); ?></td>
<td class="valField"><?php echo $accountPassDate; ?></td>
</tr>
<tr>
<td class="descField"><?php echo _('Fecha Caducidad Clave'); ?></td>
<td class="valField"><?php echo $accountPassDateChange; ?></td>
</tr>
</table>

View File

@@ -85,73 +85,79 @@
</div>
<div class="label-right">
<?php if ($AccountSearchItem->isShow()): ?>
<div class="account-info">
<?php if (!$AccountSearchData->getAccountIsPrivate()): ?>
<i id="accesses-<?php echo $AccountSearchData->getAccountId(); ?>"
class="material-icons">face</i>
<div class="account-info">
<div class="mdl-tooltip" for="accesses-<?php echo $AccountSearchData->getAccountId(); ?>">
<?php echo _('Permisos'), '<br>', $AccountSearchItem->getAccesses(); ?>
</div>
<?php else: ?>
<i class="material-icons" title="<?php echo _('Privada'); ?>">lock</i>
<?php endif; ?>
<?php if ($AccountSearchItem->isPasswordExpired()): ?>
<i class="material-icons <?php echo $icons->getIconWarning()->getClass(); ?>"
title="<?php echo _('Clave Caducada'); ?>"><?php echo $icons->getIconWarning()->getIcon(); ?></i>
<?php endif; ?>
<?php if ($AccountSearchItem->isFavorite()): ?>
<i class="material-icons icon-favorite mdl-color-text--amber-A100"
title="<?php echo _('Eliminar Favorito'); ?>"
data-action-id-on="<?php echo \SP\Core\ActionsInterface::ACTION_ACC_FAVORITES_ADD; ?>"
data-action-id-off="<?php echo \SP\Core\ActionsInterface::ACTION_ACC_FAVORITES_DELETE; ?>"
data-item-id="<?php echo $AccountSearchData->getAccountId(); ?>"
data-status="<?php echo 'on'; ?>">star</i>
<?php else: ?>
<i class="material-icons icon-favorite"
title="<?php echo _('Marcar Favorito'); ?>"
data-action-id-on="<?php echo \SP\Core\ActionsInterface::ACTION_ACC_FAVORITES_ADD; ?>"
data-action-id-off="<?php echo \SP\Core\ActionsInterface::ACTION_ACC_FAVORITES_DELETE; ?>"
data-item-id="<?php echo $AccountSearchData->getAccountId(); ?>"
data-status="<?php echo 'off'; ?>">star_border</i>
<?php endif; ?>
<?php if (!$AccountSearchData->getAccountIsPrivate()): ?>
<i id="accesses-<?php echo $AccountSearchData->getAccountId(); ?>"
class="material-icons">face</i>
<?php if ($AccountSearchData->getAccountNotes() !== ''): ?>
<i id="notes-<?php echo $AccountSearchData->getAccountId(); ?>" class="material-icons">speaker_notes</i>
<div class="mdl-tooltip" for="notes-<?php echo $AccountSearchData->getAccountId(); ?>">
<?php echo _('Notas'), '<br>', $AccountSearchItem->getShortNotes(); ?>
</div>
<?php endif; ?>
<div class="mdl-tooltip" for="accesses-<?php echo $AccountSearchData->getAccountId(); ?>">
<?php echo _('Permisos'), '<br>', $AccountSearchItem->getAccesses(); ?>
</div>
<?php else: ?>
<i class="material-icons" title="<?php echo _('Cuenta Privada'); ?>">lock</i>
<?php endif; ?>
<?php if ($AccountSearchItem->getNumFiles() > 0): ?>
<i id="attachments-<?php echo $AccountSearchData->getAccountId(); ?>"
class="material-icons">attach_file</i>
<div class="mdl-tooltip"
for="attachments-<?php echo $AccountSearchData->getAccountId(); ?>">
<?php echo _('Archivos adjuntos'), ': ', $AccountSearchItem->getNumFiles(); ?>
</div>
<?php endif; ?>
<?php if ($AccountSearchItem->isFavorite()): ?>
<i class="material-icons icon-favorite mdl-color-text--amber-A100"
title="<?php echo _('Eliminar Favorito'); ?>"
data-action-id-on="<?php echo \SP\Core\ActionsInterface::ACTION_ACC_FAVORITES_ADD; ?>"
data-action-id-off="<?php echo \SP\Core\ActionsInterface::ACTION_ACC_FAVORITES_DELETE; ?>"
data-item-id="<?php echo $AccountSearchData->getAccountId(); ?>"
data-status="<?php echo 'on'; ?>">star</i>
<?php else: ?>
<i class="material-icons icon-favorite"
title="<?php echo _('Marcar Favorito'); ?>"
data-action-id-on="<?php echo \SP\Core\ActionsInterface::ACTION_ACC_FAVORITES_ADD; ?>"
data-action-id-off="<?php echo \SP\Core\ActionsInterface::ACTION_ACC_FAVORITES_DELETE; ?>"
data-item-id="<?php echo $AccountSearchData->getAccountId(); ?>"
data-status="<?php echo 'off'; ?>">star_border</i>
<?php endif; ?>
<?php if (isset($wikiFilter)): ?>
<?php if (preg_match('/^(' . $wikiFilter . ').*/i', $AccountSearchData->getAccountName())): ?>
<?php if (\SP\Account\AccountsSearchItem::$dokuWikiEnabled): ?>
<a href="<?php echo $wikiPageUrl, $AccountSearchData->getAccountName(); ?>"
target="_blank">
<i class="material-icons"
title="<?php echo _('Enlace a Wiki'); ?>">library_books</i>
</a>
<i class="btn-action material-icons fg-green100"
title="<?php echo _('Ver en Wiki'); ?>"
data-action-id="<?php echo \SP\Core\ActionsInterface::ACTION_WIKI_VIEW; ?>"
data-item-id="<?php echo $AccountSearchData->getAccountName(); ?>"
data-onclick="wiki/show">library_books</i>
<?php else: ?>
<a href="<?php echo $wikiPageUrl, $AccountSearchData->getAccountName(); ?>"
target="_blank">
<i class="material-icons"
title="<?php echo _('Enlace a Wiki'); ?>">library_books</i>
</a>
<?php endif; ?>
<?php if ($AccountSearchData->getAccountNotes() !== ''): ?>
<i id="notes-<?php echo $AccountSearchData->getAccountId(); ?>" class="material-icons">speaker_notes</i>
<div class="mdl-tooltip" for="notes-<?php echo $AccountSearchData->getAccountId(); ?>">
<?php echo _('Notas'), '<br>', $AccountSearchItem->getShortNotes(); ?>
</div>
<?php endif; ?>
<?php if ($AccountSearchItem->getNumFiles() > 0): ?>
<i id="attachments-<?php echo $AccountSearchData->getAccountId(); ?>"
class="material-icons">attach_file</i>
<div class="mdl-tooltip"
for="attachments-<?php echo $AccountSearchData->getAccountId(); ?>">
<?php echo _('Archivos adjuntos'), ': ', $AccountSearchItem->getNumFiles(); ?>
</div>
<?php endif; ?>
<?php if (isset($wikiFilter)): ?>
<?php if (preg_match('/^(' . $wikiFilter . ').*/i', $AccountSearchData->getAccountName())): ?>
<?php if (\SP\Account\AccountsSearchItem::$dokuWikiEnabled): ?>
<a href="<?php echo $wikiPageUrl, $AccountSearchData->getAccountName(); ?>"
target="_blank">
<i class="material-icons"
title="<?php echo _('Enlace a Wiki'); ?>">library_books</i>
</a>
<i class="btn-action material-icons fg-green100"
title="<?php echo _('Ver en Wiki'); ?>"
data-action-id="<?php echo \SP\Core\ActionsInterface::ACTION_WIKI_VIEW; ?>"
data-item-id="<?php echo $AccountSearchData->getAccountName(); ?>"
data-onclick="wiki/show">library_books</i>
<?php else: ?>
<a href="<?php echo $wikiPageUrl, $AccountSearchData->getAccountName(); ?>"
target="_blank">
<i class="material-icons"
title="<?php echo _('Enlace a Wiki'); ?>">library_books</i>
</a>
<?php endif; ?>
<?php endif; ?>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ($AccountSearchItem->isShow() || $AccountSearchItem->isShowRequest()): ?>

View File

@@ -28,6 +28,7 @@
<li>file:file_name
&gt; <?php echo _('Buscar cuentas con archivos con el nombre \'file_name\''); ?></li>
<li>tag:tag_name &gt; <?php echo _('Buscar cuentas con la etiqueta \'tag_name\''); ?></li>
<li>expired: &gt; <?php echo _('Buscar cuentas con la clave caducada'); ?></li>
</ul>
</div>
</div>

View File

@@ -78,5 +78,6 @@ $stringsJsLang = array(
52 => _('Mostrar Favoritos'),
53 => _('Mostrar Todos'),
54 => _('Ayuda'),
55 => _('Sin cambios')
55 => _('Sin cambios'),
56 => _('Ahora')
);