Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 07CF9200CD7 for ; Tue, 18 Jul 2017 01:05:29 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 06552165F75; Mon, 17 Jul 2017 23:05:29 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 68EB0165F40 for ; Tue, 18 Jul 2017 01:05:21 +0200 (CEST) Received: (qmail 51323 invoked by uid 500); 17 Jul 2017 23:05:20 -0000 Mailing-List: contact commits-help@oodt.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@oodt.apache.org Delivered-To: mailing list commits@oodt.apache.org Received: (qmail 50342 invoked by uid 99); 17 Jul 2017 23:05:19 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Jul 2017 23:05:19 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 0D6DCF5571; Mon, 17 Jul 2017 23:05:17 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: mattmann@apache.org To: commits@oodt.apache.org Date: Mon, 17 Jul 2017 23:05:55 -0000 Message-Id: <750fedb633004cc988e4880326133b11@git.apache.org> In-Reply-To: <95eff81647544b1996db031f8290e90b@git.apache.org> References: <95eff81647544b1996db031f8290e90b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [40/88] [abbrv] [partial] oodt git commit: Record change for OODT-836, OODT-837. archived-at: Mon, 17 Jul 2017 23:05:29 -0000 http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/classes/LDAPAuthenticationProvider.class.php ---------------------------------------------------------------------- diff --git a/balance/modules/profile/classes/LDAPAuthenticationProvider.class.php b/balance/modules/profile/classes/LDAPAuthenticationProvider.class.php deleted file mode 100644 index ca69159..0000000 --- a/balance/modules/profile/classes/LDAPAuthenticationProvider.class.php +++ /dev/null @@ -1,263 +0,0 @@ -settings['ldap_host']); - define("SSO_LDAP_PORT", App::Get()->settings['ldap_port']); - define("SSO_BASE_DN", App::Get()->settings['ldap_base_dn']); - define("SSO_GROUPS_DN", App::Get()->settings['ldap_group_dn']); - define("SSO_COOKIE_KEY", App::Get()->settings['cookie_key']); - - $this->ldapHost = SSO_LDAP_HOST; - $this->ldapPort = SSO_LDAP_PORT; - } - - /** - * Connect to the LDAP server - */ - public function connect() { - return parent::connect($this->ldapHost,$this->ldapPort); - } - - /** - * Disconnect from the LDAP server - */ - public function disconnect() { - ldap_close($this->conn); - } - - /** - * Determine whether or not a user has authenticated - * - * @return boolean Whether or not the current user has authenticated - */ - public function isLoggedIn() { - return parent::isLoggedIn(); - } - - /** - * Process a user login - * - * @param string $username The provided username - * @param string $password The provided password - */ - public function login( $username, $password ) { - return parent::login( $username, $password ); - } - - /** - * End an authenticated user's session - */ - public function logout() { - parent::logout(); - } - - /** - * Return the unique username of the currently authenticated user - */ - public function getCurrentUsername() { - return parent::getCurrentUsername(); - } - - /** - * Process a password change request for the currently authenticated - * user - * - * @param string $newPassword The new password to associate with the user - */ - public function changePassword( $newPassword ) { - if ( App::Get()->settings['auth_encryption_method'] ) { - return parent::changePassword( $newPassword, App::Get()->settings['auth_encryption_method'] ); - } - return parent::changePassword( $newPassword ); - } - - /** - * Attempt to validate a candidate value for new user password - * - * @param string $newPass The candidate password value - * @param string $encryptionMethod The encryption method to use - */ - public function validateChangePassword( $newPass, $encryptionMethod = "SHA" ) { - $isValid = true; - $messages = array(); - // validate rules from config file - $rules = App::Get()->settings['security_password_rules']; - - if ( isset($rules) ) { - foreach( $rules as $rule ){ - - // Separate the rule from the error message - list($regularExpression,$errorMessage) = explode('|',$rule,2); - - // Test the rule - $rulePassed = preg_match($regularExpression, $newPass); - - // If the rule failed, append the error message - if (!$rulePassed) { - $messages[] = $errorMessage; - $isValid = false; - } - } - } - - if ($isValid && $this->connect(SSO_LDAP_HOST,SSO_LDAP_PORT)) { - $result = $this->changePassword($newPass,$encryptionMethod); - return true; - } else - return $messages; - } - - /** - * Obtain detailed information about the specified user. - * - * This function accepts both a username and an array of attributes - * corresponding to the variables in the LDAP user record for which - * values should be returned. - * - * @param string $username The username to obtain information for - * @param array $attributes The set of variables to return values for - */ - public function retrieveUserAttributes( $username, $attributes ) { - $rawArray = parent::retrieveUserAttributes( $username, $attributes ); - $userAttributes = array(); - - if ( count($rawArray) > 1 ) { - $rawArray = $rawArray[0]; - // Get only necessary attributes to return - foreach ( $rawArray as $key=>$keyValue ) { - foreach ( $attributes as $value ) { - if ( $key === $value ) { - $userAttributes[$key] = $keyValue[0]; - } - } - } - } - return $userAttributes; - } - - /** - * Add a user record to the LDAP directory - * - * This function accepts an associative array of information about - * a user. The keys in this array correspond to the named variables - * in the user object in the LDAP directory. At a minimum, this - * array must contain a key 'uid' which must be unique across users - * so that a proper dn can be generated for the new user. - * - * @param array $userInfo The information to include in the record - */ - public function addUser($userInfo) { - $ldapconn = $this->connect(SSO_LDAP_HOST,SSO_LDAP_PORT); - if ($ldapconn) { - $user = "uid={$userInfo[ "uid" ]}," . SSO_BASE_DN; - return ldap_add($ldapconn,$user,$userInfo); - } - // connection failed - return false; - } - - /** - * Determine if the specified username is available - * - * This function uses the value of the config setting 'username_attr' when - * determining which key in the LDAP user record to use as the username - * attribute. - * - * @param string $username The username to test for availability - */ - public function usernameAvailability( $username ) { - $justthese = array( App::Get()->settings['username_attr'] ); - $profile = $this->retrieveUserAttributes($username, $justthese); - if (count($profile) > 0) { - return false; - } else { - // available - return true; - } - } - - /** - * Update an existing user profile with new information - * - * This function accepts an associative array containing named key/value - * pairs. The keys in this array correspond to the named variables - * in the user object in the LDAP directory. The function can only update - * the record for the currently authenticated user. - * - * @param array $newInfo The updated information for the user's profile - */ - public function updateProfile($newInfo) { - - if ($this->isLoggedIn()) { - $user = "uid={$this->getCurrentUsername()}," . SSO_BASE_DN ; - $ldapconn = $this->connect(SSO_LDAP_HOST,SSO_LDAP_PORT); - - if (ldap_mod_replace($ldapconn,$user,$newInfo)) { - return true; - } else { - return false; - } - } else { - return false; - } - } -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/classes/LDAPAuthorizationProvider.class.php ---------------------------------------------------------------------- diff --git a/balance/modules/profile/classes/LDAPAuthorizationProvider.class.php b/balance/modules/profile/classes/LDAPAuthorizationProvider.class.php deleted file mode 100644 index 1ac95fb..0000000 --- a/balance/modules/profile/classes/LDAPAuthorizationProvider.class.php +++ /dev/null @@ -1,113 +0,0 @@ -settings['authorization_ldap_base_dn']); - define("AUTH_GROUPS_DN", App::Get()->settings['authorization_ldap_group_dn']); - define("AUTH_LDAP_HOST", App::Get()->settings['authorization_ldap_host']); - define("AUTH_LDAP_PORT", App::Get()->settings['authorization_ldap_port']); - - $this->ldapHost = AUTH_LDAP_HOST; - $this->ldapPort = AUTH_LDAP_PORT; - } - - /** - * Obtain the groups/roles for the current username - * - * This function searches {$searchDirectory} for groupOfUniqueName objects whose - * uniqueMember attribute contains {$username}. The cn attribute of all matching - * groups is returned as a numeric array. - * - * @param string $username The username to test for. Note that just the username - * portion should be specified, as both 'uid=' and AUTH_BASE_DN - * are added to the value before searching. - * @param string $searchDirectory The fully qualified DN (e.g.: ou=system,ou=groups) - * of the LDAP directory in which to search for groups - */ - public function retrieveGroupsForUser($username,$searchDirectory = AUTH_GROUPS_DN) { - - // attempt to connect to ldap server - $ldapconn = $this->connect(AUTH_LDAP_HOST,AUTH_LDAP_PORT); - $groups = array(); - if ($ldapconn) { - $filter = "(&(objectClass=groupOfUniqueNames)" - ."(uniqueMember=uid={$username}," . AUTH_BASE_DN . "))"; - $result = ldap_search($ldapconn,$searchDirectory,$filter,array('cn')); - - if ($result) { - $entries = ldap_get_entries($ldapconn,$result); - foreach ($entries as $rawGroup) { - if (isset($rawGroup['cn'][0]) - && $rawGroup['cn'][0] != '') { - $groups[] = $rawGroup['cn'][0]; - } - } - } - } - return $groups; - } - - /** - * Connect to the LDAP server - */ - public function connect() { - if ($conn = ldap_connect($this->ldapHost,$this->ldapPort)) { - - // Connection established - $this->connectionStatus = 1; - ldap_set_option($conn, LDAP_OPT_PROTOCOL_VERSION, 3); - ldap_set_option($conn, LDAP_OPT_DEBUG_LEVEL, 7); - ldap_set_option($conn, LDAP_OPT_REFERRALS, 0); - $this->conn = $conn; - return $conn; - } else { - // Connection failed - return false; - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/classes/NullAuthenticationProvider.class.php ---------------------------------------------------------------------- diff --git a/balance/modules/profile/classes/NullAuthenticationProvider.class.php b/balance/modules/profile/classes/NullAuthenticationProvider.class.php deleted file mode 100644 index 6449d10..0000000 --- a/balance/modules/profile/classes/NullAuthenticationProvider.class.php +++ /dev/null @@ -1,96 +0,0 @@ - $username - ); - } - - public function logout() { - unset($_SESSION['_auth']); - } - - public function getCurrentUsername() { - return ($this->isLoggedIn()) - ? $_SESSION['_auth']['username'] - : false; - } - - public function changePassword( $newPassword ) { - return true; - } - - public function validateChangePassword( $newPass, $encryptionMethod = "SHA" ) { - return true; - } - - public function retrieveUserAttributes( $username, $attributes ) { - return ($this->isLoggedIn()) - ? array( - "cn" => $this->getCurrentUsername(), - "givenname" => $this->getCurrentUsername(), - "sn" => '', - "uid" => $this->getCurrentUsername(), - "mail" => 'guest@example.org' - ) - : false; - } - - public function addUser($userInfo) { - return false; - } - - public function usernameAvailability( $username ) { - return false; - } - - public function updateProfile($newInfo) { - return false; - - } -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/classes/NullAuthorizationProvider.class.php ---------------------------------------------------------------------- diff --git a/balance/modules/profile/classes/NullAuthorizationProvider.class.php b/balance/modules/profile/classes/NullAuthorizationProvider.class.php deleted file mode 100644 index 3f4a220..0000000 --- a/balance/modules/profile/classes/NullAuthorizationProvider.class.php +++ /dev/null @@ -1,45 +0,0 @@ -"; - * } - * - * - * Take a look at the docblock descriptions of each hook to get a sense of where - * in the view rendering process the hook is invoked. - * - */ - -/** - * hook_before_header - * - * This hook is executed before the contents of the header file are processed. - */ -function hook_before_header() {} - -/** - * hook_before_view - * - * This hook is executed before the contents of the main view are processed. - */ -function hook_before_view() { - $module = App::Get()->loadModule(); - App::Get()->response->addStylesheet($module->moduleStatic.'/css/profile.css'); -} - -/** - * hook_before_footer - * - * This hook is executed before the contents of the footer are processed - */ -function hook_before_footer() {} - -/** - * hook_before_send - * - * This hook is after all of the view components (header, view, footer) have been - * processed but before the processed results are sent out across the wire to the - * browser. HTTP headers have not yet been sent to the browser. - */ -function hook_before_send() {} - -/** - * hook_after_send - * - * This hook is after all of the view components (header, view, footer) have been - * processed and sent out across the wire to the browser. It can be used for logging - * or analytics purposes, or to append a common trailer to all content. - */ -function hook_after_send() { - $timeStart = $GLOBALS['balance_request_start']; - $timeEnd = microtime(true); - $elapsed = $timeEnd - $timeStart; - - echo "\r\n"; -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/scripts/access.php ---------------------------------------------------------------------- diff --git a/balance/modules/profile/scripts/access.php b/balance/modules/profile/scripts/access.php deleted file mode 100644 index 3167409..0000000 --- a/balance/modules/profile/scripts/access.php +++ /dev/null @@ -1,107 +0,0 @@ -loadModule(); -$allSet = true; - - -if ( isset($_POST["firstname"]) && $_POST["firstname"] != "" ) { - $info[ App::Get()->settings['firstname_attr'] ] = $_POST["firstname"]; -} else { - // first name is required - App::Get()->SetMessage("First name cannot be blank",CAS_MSG_ERROR); - $allSet = FALSE; -} - -if ( isset($_POST["lastname"]) && $_POST["lastname"] != "" ) { - $info[ App::Get()->settings['lastname_attr'] ] = $_POST["lastname"]; -} else { - // last name is required - App::Get()->SetMessage("Last name cannot be blank",CAS_MSG_ERROR); - $allSet = FALSE; -} - -if ( isset($_POST["username"]) && $_POST["username"] != "" ) { - - // check username availability - $isAvailable = App::Get()->getAuthenticationProvider()->usernameAvailability($_POST["username"]); - if ( $isAvailable ) { - $info[ App::Get()->settings['username_attr'] ] = $_POST["username"]; - } else{ - App::Get()->SetMessage("Username has been taken",CAS_MSG_ERROR); - $allSet = FALSE; - } -} else { - // username is required - App::Get()->SetMessage("Username cannot be blank",CAS_MSG_ERROR); - $allSet = FALSE; -} - -if ( isset($_POST["email"]) && $_POST["email"] != "") { - $info[ App::Get()->settings['email_attr'] ] = $_POST["email"]; -} else { - // email is required - App::Get()->SetMessage("Email cannot be blank",CAS_MSG_ERROR); - $allSet = FALSE; -} - -if ( !isset($_POST["password_confirm"]) || $_POST["password_confirm"] == "" ) { - - // password confirm is required - App::Get()->SetMessage("Password cannot be blank and must match",CAS_MSG_ERROR); - $allSet = FALSE; -} elseif ( (isset($_POST["password"]) || $_POST["password"] != "") && - ( $_POST["password"] == $_POST["password_confirm"] ) ) { - - $info['userPassword'] = $_POST["password"]; -} else { - - // password is required and must match - App::Get()->SetMessage("Password cannot be blank and must match",CAS_MSG_ERROR); - $allSet = FALSE; -} - -if ($allSet) { - - $info[ App::Get()->settings['commonname_attr'] ] = $_POST["firstname"] . " " . $_POST["lastname"]; - $info[ "objectClass" ] = "inetOrgPerson"; - if ( App::Get()->getAuthenticationProvider()->addUser($info) ) { - - App::Get()->Redirect($module->moduleRoot . "/login" ); // add account successful - } else { - App::Get()->setMessage("Could not add user.",CAS_MSG_ERROR); - } -} else { - - App::Get()->Redirect($module->moduleRoot . "/createUser" ); -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/scripts/changePwd.php ---------------------------------------------------------------------- diff --git a/balance/modules/profile/scripts/changePwd.php b/balance/modules/profile/scripts/changePwd.php deleted file mode 100644 index 140c189..0000000 --- a/balance/modules/profile/scripts/changePwd.php +++ /dev/null @@ -1,69 +0,0 @@ -loadModule(); - -// Get instance of authentication class -$authentication = App::Get()->getAuthenticationProvider(); - - -if ( !isset($_POST["password_confirm"]) || $_POST["password_confirm"] == "" ) { - - // password confirm is required - App::Get()->SetMessage("Please confirm password.",CAS_MSG_ERROR); - App::Get()->Redirect($module->moduleRoot . "/changePwd" ); - -} elseif ( (isset($_POST["password"]) || $_POST["password"] != "") && - ( $_POST["password"] == $_POST["password_confirm"] ) ) { - - $message = $authentication->validateChangePassword( $_POST["password"] ); - - if( is_array($message) ) { - - foreach ($message as $value) { - App::Get()->setMessage($value,CAS_MSG_ERROR); - } - - App::Get()->Redirect($module->moduleRoot . "/changePwd" ); - } else{ - - // Log the user out - $authentication->logout(); - - // End user session - App::Get()->EndUserSession(); - - // Redirect to confirmation page - App::Get()->Redirect($module->moduleRoot . "/passwordChangeConfirmed" ); // password change successful - - } - } else { - - // password is required and must match - App::Get()->SetMessage("Password cannot be blank and must match",CAS_MSG_ERROR); - App::Get()->Redirect($module->moduleRoot . "/changePwd" ); - } - \ No newline at end of file http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/scripts/login.php ---------------------------------------------------------------------- diff --git a/balance/modules/profile/scripts/login.php b/balance/modules/profile/scripts/login.php deleted file mode 100644 index fc6fd43..0000000 --- a/balance/modules/profile/scripts/login.php +++ /dev/null @@ -1,46 +0,0 @@ -loadModule(); - -// Get instance of authentication class -$authentication = App::Get()->getAuthenticationProvider(); - -$message = ''; - -// If a user is already logged in, redirect to home page -if( $authentication->isLoggedIn() ) App::Get()->Redirect(SITE_ROOT . "/"); - -// Otherwise, if a user is attempting to log in, process: -else if(isset($_POST["username"]) && isset($_POST["password"])) { - - // Check the provided login credentials: - if($authentication->login($_POST["username"], $_POST["password"])){ - App::Get()->Redirect(SITE_ROOT . "/" ); // login successful - } else { - App::Get()->SetMessage("Invalid Credentials Provided",CAS_MSG_ERROR); - App::Get()->Redirect($module->moduleRoot . "/login"); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/scripts/logout.php ---------------------------------------------------------------------- diff --git a/balance/modules/profile/scripts/logout.php b/balance/modules/profile/scripts/logout.php deleted file mode 100644 index 59ccce3..0000000 --- a/balance/modules/profile/scripts/logout.php +++ /dev/null @@ -1,36 +0,0 @@ -getAuthenticationProvider()->logout(); - -// End user session -App::Get()->EndUserSession(); - -// Redirect to the home page -App::Get()->Redirect(SITE_ROOT . "/"); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/scripts/manage.php ---------------------------------------------------------------------- diff --git a/balance/modules/profile/scripts/manage.php b/balance/modules/profile/scripts/manage.php deleted file mode 100644 index 0615ec6..0000000 --- a/balance/modules/profile/scripts/manage.php +++ /dev/null @@ -1,59 +0,0 @@ -loadModule(); -$allSet = true; - -foreach ($_POST as $key=>$value) { - - if ( $key != submit_button) { - if ( isset($value) && $value != "" ) { - $info[$key] = $value; - } else { - // set error message - App::Get()->SetMessage( - array_search( $key, App::Get()->settings['attr_titles'] ) - . " cannot be left blank.", CAS_MSG_ERROR ); - $allSet = false; - } - } -} - -if ($allSet) { - // method to edit user - if( App::Get()->getAuthenticationProvider()->updateProfile($info) ){ - - // user info change successful - App::Get()->Redirect($module->moduleRoot . "/" ); - } else{ - - // if not logged in - cannot change pwd - App::Get()->SetMessage("Invalid entry",CAS_MSG_ERROR); - App::Get()->Redirect($module->moduleRoot . "/manage" ); - } -} else { - - App::Get()->Redirect($module->moduleRoot . "/manage" ); -} http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/scripts/widgets/UserStatusWidget.php ---------------------------------------------------------------------- diff --git a/balance/modules/profile/scripts/widgets/UserStatusWidget.php b/balance/modules/profile/scripts/widgets/UserStatusWidget.php deleted file mode 100644 index 8c9dd27..0000000 --- a/balance/modules/profile/scripts/widgets/UserStatusWidget.php +++ /dev/null @@ -1,91 +0,0 @@ -isLoggedIn = ( isset($options[0]) && $options[0] === true ); - $this->username = ( isset($options[1]) ) ? $options[1] : false; - $this->profileLink = ( isset($options[2]) ) ? $options[2] : true; - $this->moduleName = ( isset($options[3]) ) ? $options[3] : 'profile'; - } - - public function render($bEcho = true) { - - $str = ''; - $module = App::Get()->loadModule($this->moduleName); - - // Display the appropriate information about the user - if($this->isLoggedIn) { - $str .= "Logged in as "; - if ($this->profileLink) { - $str .= '' . $this->username . ' | ' - .'Log Out'; - } else { - $str .= $this->username . ' | ' - .'Log Out'; - } - } else { - $str .= 'Log In'; - } - - if($bEcho) { - echo $str; - } else { - return $str; - } - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/static/css/profile.css ---------------------------------------------------------------------- diff --git a/balance/modules/profile/static/css/profile.css b/balance/modules/profile/static/css/profile.css deleted file mode 100644 index 5ee73df..0000000 --- a/balance/modules/profile/static/css/profile.css +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * PROFILE MANAGER STYLESHEET - * - * PAGE ELEMENTS - * - */ -fieldset { -} - -label.invalid { - color:#BF1B02; - font:1em georgia; - margin:0 0 2px; -} - -.profile_input { - height:23px; - width:200px; -} - -/** - * DIV.USERDETAILS - * This provides information about the login-status of the user. - * - * top and color can be changed depending on portal - */ -#userdetails { - position:absolute; - top:105px; - right:15px; - z-index:10; -} -#userdetails a { - font-size:13px; -} - -/* Unsupported browsers */ - -.orange_rbcontent { padding: 0.4em; } -.orange_rbroundbox { width: 100%; } - -#unsupported { - font-weight: bold; - text-align: left; -} - -/* Signup form */ - -#signupform table { - border-spacing: 0; - border-collapse: collapse; - empty-cells: show; -} - -#signupform .label { - padding-top: 2px; - padding-right: 8px; - vertical-align: top; - text-align: right; - width: 125px; - white-space: nowrap; -} - -#signupform .field { - padding-bottom: 10px; - white-space: nowrap; -} - -#signupform .status { - padding-top: 2px; - padding-left: 8px; - vertical-align: top; - width: 246px; - white-space: nowrap; -} - -#signupform .textfield { - width: 150px; -} - -#signupform .error, .notice, .success { - padding:0.25em; - margin-bottom:0.5em 0; - background-color:#FFFFFF; - border:1px solid #BBBBBB; -} - -#signupform label.error { - background:none; - padding-left: 16px; - padding-bottom: 2px; - font-weight: bold; - color: #EA5200; - border:none; -} - -#signupform label.checked /*{ - background:none; -} - -#signupform .success_msg { - font-weight: bold; - color: #0060BF; - margin-left: 19px; -} - -#signupform #dateformatStatus, #signupform #termsStatus { - margin-left: 6px; -} - -#signupform #termswrap { - float: left; -} - -#signupform #terms { - vertical-align: middle; - float: left; - display: block; - margin-right: 5px; -} - -#signupform #lterms { - font-weight: normal; - vertical-align: middle; - float: left; - display: block; - width: 350px; - white-space: normal; -} - -#signupform #lsignupsubmit { - visibility: hidden; -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/static/js/additional-methods.js ---------------------------------------------------------------------- diff --git a/balance/modules/profile/static/js/additional-methods.js b/balance/modules/profile/static/js/additional-methods.js deleted file mode 100644 index db3ad14..0000000 --- a/balance/modules/profile/static/js/additional-methods.js +++ /dev/null @@ -1,259 +0,0 @@ -(function() { - - function stripHtml(value) { - // remove html tags and space chars - return value.replace(/<.[^<>]*?>/g, ' ').replace(/ | /gi, ' ') - // remove numbers and punctuation - .replace(/[0-9.(),;:!?%#$'"_+=\/-]*/g,''); - } - jQuery.validator.addMethod("maxWords", function(value, element, params) { - return this.optional(element) || stripHtml(value).match(/\b\w+\b/g).length < params; - }, jQuery.validator.format("Please enter {0} words or less.")); - - jQuery.validator.addMethod("minWords", function(value, element, params) { - return this.optional(element) || stripHtml(value).match(/\b\w+\b/g).length >= params; - }, jQuery.validator.format("Please enter at least {0} words.")); - - jQuery.validator.addMethod("rangeWords", function(value, element, params) { - return this.optional(element) || stripHtml(value).match(/\b\w+\b/g).length >= params[0] && value.match(/bw+b/g).length < params[1]; - }, jQuery.validator.format("Please enter between {0} and {1} words.")); - -})(); - -jQuery.validator.addMethod("letterswithbasicpunc", function(value, element) { - return this.optional(element) || /^[a-z-.,()'\"\s]+$/i.test(value); -}, "Letters or punctuation only please"); - -jQuery.validator.addMethod("alphanumeric", function(value, element) { - return this.optional(element) || /^\w+$/i.test(value); -}, "Letters, numbers, spaces or underscores only please"); - -jQuery.validator.addMethod("lettersonly", function(value, element) { - return this.optional(element) || /^[a-z]+$/i.test(value); -}, "Letters only please"); - -jQuery.validator.addMethod("nowhitespace", function(value, element) { - return this.optional(element) || /^\S+$/i.test(value); -}, "No white space please"); - -jQuery.validator.addMethod("ziprange", function(value, element) { - return this.optional(element) || /^90[2-5]\d\{2}-\d{4}$/.test(value); -}, "Your ZIP-code must be in the range 902xx-xxxx to 905-xx-xxxx"); - -jQuery.validator.addMethod("integer", function(value, element) { - return this.optional(element) || /^-?\d+$/.test(value); -}, "A positive or negative non-decimal number please"); - -/** -* Return true, if the value is a valid vehicle identification number (VIN). -* -* Works with all kind of text inputs. -* -* @example -* @desc Declares a required input element whose value must be a valid vehicle identification number. -* -* @name jQuery.validator.methods.vinUS -* @type Boolean -* @cat Plugins/Validate/Methods -*/ -jQuery.validator.addMethod( - "vinUS", - function(v){ - if (v.length != 17) - return false; - var i, n, d, f, cd, cdv; - var LL = ["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"]; - var VL = [1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9]; - var FL = [8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2]; - var rs = 0; - for(i = 0; i < 17; i++){ - f = FL[i]; - d = v.slice(i,i+1); - if(i == 8){ - cdv = d; - } - if(!isNaN(d)){ - d *= f; - } - else{ - for(n = 0; n < LL.length; n++){ - if(d.toUpperCase() === LL[n]){ - d = VL[n]; - d *= f; - if(isNaN(cdv) && n == 8){ - cdv = LL[n]; - } - break; - } - } - } - rs += d; - } - cd = rs % 11; - if(cd == 10){cd = "X";} - if(cd == cdv){return true;} - return false; - }, - "The specified vehicle identification number (VIN) is invalid." -); - -/** - * Return true, if the value is a valid date, also making this formal check dd/mm/yyyy. - * - * @example jQuery.validator.methods.date("01/01/1900") - * @result true - * - * @example jQuery.validator.methods.date("01/13/1990") - * @result false - * - * @example jQuery.validator.methods.date("01.01.1900") - * @result false - * - * @example - * @desc Declares an optional input element whose value must be a valid date. - * - * @name jQuery.validator.methods.dateITA - * @type Boolean - * @cat Plugins/Validate/Methods - */ -jQuery.validator.addMethod( - "dateITA", - function(value, element) { - var check = false; - var re = /^\d{1,2}\/\d{1,2}\/\d{4}$/; - if( re.test(value)){ - var adata = value.split('/'); - var gg = parseInt(adata[0],10); - var mm = parseInt(adata[1],10); - var aaaa = parseInt(adata[2],10); - var xdata = new Date(aaaa,mm-1,gg); - if ( ( xdata.getFullYear() == aaaa ) && ( xdata.getMonth () == mm - 1 ) && ( xdata.getDate() == gg ) ) - check = true; - else - check = false; - } else - check = false; - return this.optional(element) || check; - }, - "Please enter a correct date" -); - -jQuery.validator.addMethod("dateNL", function(value, element) { - return this.optional(element) || /^\d\d?[\.\/-]\d\d?[\.\/-]\d\d\d?\d?$/.test(value); - }, "Vul hier een geldige datum in." -); - -jQuery.validator.addMethod("time", function(value, element) { - return this.optional(element) || /^([01][0-9])|(2[0123]):([0-5])([0-9])$/.test(value); - }, "Please enter a valid time, between 00:00 and 23:59" -); - -/** - * matches US phone number format - * - * where the area code may not start with 1 and the prefix may not start with 1 - * allows '-' or ' ' as a separator and allows parens around area code - * some people may want to put a '1' in front of their number - * - * 1(212)-999-2345 - * or - * 212 999 2344 - * or - * 212-999-0983 - * - * but not - * 111-123-5434 - * and not - * 212 123 4567 - */ -jQuery.validator.addMethod("phoneUS", function(phone_number, element) { - phone_number = phone_number.replace(/\s+/g, ""); - return this.optional(element) || phone_number.length > 9 && - phone_number.match(/^(1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/); -}, "Please specify a valid phone number"); - -jQuery.validator.addMethod('phoneUK', function(phone_number, element) { -return this.optional(element) || phone_number.length > 9 && -phone_number.match(/^(\(?(0|\+44)[1-9]{1}\d{1,4}?\)?\s?\d{3,4}\s?\d{3,4})$/); -}, 'Please specify a valid phone number'); - -jQuery.validator.addMethod('mobileUK', function(phone_number, element) { -return this.optional(element) || phone_number.length > 9 && -phone_number.match(/^((0|\+44)7(5|6|7|8|9){1}\d{2}\s?\d{6})$/); -}, 'Please specify a valid mobile number'); - -// TODO check if value starts with <, otherwise don't try stripping anything -jQuery.validator.addMethod("strippedminlength", function(value, element, param) { - return jQuery(value).text().length >= param; -}, jQuery.validator.format("Please enter at least {0} characters")); - -// same as email, but TLD is optional -jQuery.validator.addMethod("email2", function(value, element, param) { - return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value); -}, jQuery.validator.messages.email); - -// same as url, but TLD is optional -jQuery.validator.addMethod("url2", function(value, element, param) { - return this.optional(element) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_ |~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value); -}, jQuery.validator.messages.url); - -// NOTICE: Modified version of Castle.Components.Validator.CreditCardValidator -// Redistributed under the the Apache License 2.0 at http://www.apache.org/licenses/LICENSE-2.0 -// Valid Types: mastercard, visa, amex, dinersclub, enroute, discover, jcb, unknown, all (overrides all other settings) -jQuery.validator.addMethod("creditcardtypes", function(value, element, param) { - - if (/[^0-9-]+/.test(value)) - return false; - - value = value.replace(/\D/g, ""); - - var validTypes = 0x0000; - - if (param.mastercard) - validTypes |= 0x0001; - if (param.visa) - validTypes |= 0x0002; - if (param.amex) - validTypes |= 0x0004; - if (param.dinersclub) - validTypes |= 0x0008; - if (param.enroute) - validTypes |= 0x0010; - if (param.discover) - validTypes |= 0x0020; - if (param.jcb) - validTypes |= 0x0040; - if (param.unknown) - validTypes |= 0x0080; - if (param.all) - validTypes = 0x0001 | 0x0002 | 0x0004 | 0x0008 | 0x0010 | 0x0020 | 0x0040 | 0x0080; - - if (validTypes & 0x0001 && /^(51|52|53|54|55)/.test(value)) { //mastercard - return value.length == 16; - } - if (validTypes & 0x0002 && /^(4)/.test(value)) { //visa - return value.length == 16; - } - if (validTypes & 0x0004 && /^(34|37)/.test(value)) { //amex - return value.length == 15; - } - if (validTypes & 0x0008 && /^(300|301|302|303|304|305|36|38)/.test(value)) { //dinersclub - return value.length == 14; - } - if (validTypes & 0x0010 && /^(2014|2149)/.test(value)) { //enroute - return value.length == 15; - } - if (validTypes & 0x0020 && /^(6011)/.test(value)) { //discover - return value.length == 16; - } - if (validTypes & 0x0040 && /^(3)/.test(value)) { //jcb - return value.length == 16; - } - if (validTypes & 0x0040 && /^(2131|1800)/.test(value)) { //jcb - return value.length == 15; - } - if (validTypes & 0x0080) { //unknown - return true; - } - return false; -}, "Please enter a valid credit card number."); http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/static/js/jquery.validate.min.js ---------------------------------------------------------------------- diff --git a/balance/modules/profile/static/js/jquery.validate.min.js b/balance/modules/profile/static/js/jquery.validate.min.js deleted file mode 100644 index 6264866..0000000 --- a/balance/modules/profile/static/js/jquery.validate.min.js +++ /dev/null @@ -1,16 +0,0 @@ -/* - * jQuery validation plug-in 1.7 - * - * http://bassistance.de/jquery-plugins/jquery-plugin-validation/ - * http://docs.jquery.com/Plugins/Validation - * - * Copyright (c) 2006 - 2008 Jörn Zaefferer - * - * $Id: jquery.validate.js 6403 2009-06-17 14:27:16Z joern.zaefferer $ - * - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - */ -(function($){$.extend($.fn,{validate:function(options){if(!this.length){options&&options.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing");return;}var validator=$.data(this[0],'validator');if(validator){return validator;}validator=new $.validator(options,this[0]);$.data(this[0],'validator',validator);if(validator.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){validator.cancelSubmit=true;});if(validator.settings.submitHandler){this.find("input, button").filter(":submit").click(function(){validator.submitButton=this;});}this.submit(function(event){if(validator.settings.debug)event.preventDefault();function handle(){if(validator.settings.submitHandler){if(validator.submitButton){var hidden=$("").attr("name",validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);}validator.settings.submitHandler.call(validator,validator.currentForm);if(validator.submit Button){hidden.remove();}return false;}return true;}if(validator.cancelSubmit){validator.cancelSubmit=false;return handle();}if(validator.form()){if(validator.pendingRequest){validator.formSubmitted=true;return false;}return handle();}else{validator.focusInvalid();return false;}});}return validator;},valid:function(){if($(this[0]).is('form')){return this.validate().form();}else{var valid=true;var validator=$(this[0].form).validate();this.each(function(){valid&=validator.element(this);});return valid;}},removeAttrs:function(attributes){var result={},$element=this;$.each(attributes.split(/\s/),function(index,value){result[value]=$element.attr(value);$element.removeAttr(value);});return result;},rules:function(command,argument){var element=this[0];if(command){var settings=$.data(element.form,'validator').settings;var staticRules=settings.rules;var existingRules=$.validator.staticRules(element);switch(command){case"add":$.extend(existingRules,$.validator.normalizeRule(argument));staticR ules[element.name]=existingRules;if(argument.messages)settings.messages[element.name]=$.extend(settings.messages[element.name],argument.messages);break;case"remove":if(!argument){delete staticRules[element.name];return existingRules;}var filtered={};$.each(argument.split(/\s/),function(index,method){filtered[method]=existingRules[method];delete existingRules[method];});return filtered;}}var data=$.validator.normalizeRules($.extend({},$.validator.metadataRules(element),$.validator.classRules(element),$.validator.attributeRules(element),$.validator.staticRules(element)),element);if(data.required){var param=data.required;delete data.required;data=$.extend({required:param},data);}return data;}});$.extend($.expr[":"],{blank:function(a){return!$.trim(""+a.value);},filled:function(a){return!!$.trim(""+a.value);},unchecked:function(a){return!a.checked;}});$.validator=function(options,form){this.settings=$.extend(true,{},$.validator.defaults,options);this.currentForm=form;this.init();};$.val idator.format=function(source,params){if(arguments.length==1)return function(){var args=$.makeArray(arguments);args.unshift(source);return $.validator.format.apply(this,args);};if(arguments.length>2&¶ms.constructor!=Array){params=$.makeArray(arguments).slice(1);}if(params.constructor!=Array){params=[params];}$.each(params,function(i,n){source=source.replace(new RegExp("\\{"+i+"\\}","g"),n);});return source;};$.extend($.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:$([]),errorLabelContainer:$([]),onsubmit:true,ignore:[],ignoreTitle:false,onfocusin:function(element){this.lastActive=element;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,element,this.settings.errorClass,this.settings.validClass);this.errorsFor(element).hide();}},onfocusout:function(element){if(!this.checkable(element)&&(element.name in this.submitte d||!this.optional(element))){this.element(element);}},onkeyup:function(element){if(element.name in this.submitted||element==this.lastElement){this.element(element);}},onclick:function(element){if(element.name in this.submitted)this.element(element);else if(element.parentNode.name in this.submitted)this.element(element.parentNode);},highlight:function(element,errorClass,validClass){$(element).addClass(errorClass).removeClass(validClass);},unhighlight:function(element,errorClass,validClass){$(element).removeClass(errorClass).addClass(validClass);}},setDefaults:function(settings){$.extend($.validator.defaults,settings);},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Pleas e enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:$.validator.format("Please enter no more than {0} characters."),minlength:$.validator.format("Please enter at least {0} characters."),rangelength:$.validator.format("Please enter a value between {0} and {1} characters long."),range:$.validator.format("Please enter a value between {0} and {1}."),max:$.validator.format("Please enter a value less than or equal to {0}."),min:$.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){this.labelContainer=$(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||$(this.currentForm);this.containers=$(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var groups=(this.groups={});$.each(this.settings.groups,function(key, value){$.each(value.split(/\s/),function(index,name){groups[name]=key;});});var rules=this.settings.rules;$.each(rules,function(key,value){rules[key]=$.validator.normalizeRule(value);});function delegate(event){var validator=$.data(this[0].form,"validator"),eventType="on"+event.type.replace(/^validate/,"");validator.settings[eventType]&&validator.settings[eventType].call(validator,this[0]);}$(this.currentForm).validateDelegate(":text, :password, :file, select, textarea","focusin focusout keyup",delegate).validateDelegate(":radio, :checkbox, select, option","click",delegate);if(this.settings.invalidHandler)$(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler);},form:function(){this.checkForm();$.extend(this.submitted,this.errorMap);this.invalid=$.extend({},this.errorMap);if(!this.valid())$(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid();},checkForm:function(){this.prepareForm();for(var i=0,elements=(this.currentEl ements=this.elements());elements[i];i++){this.check(elements[i]);}return this.valid();},element:function(element){element=this.clean(element);this.lastElement=element;this.prepareElement(element);this.currentElements=$(element);var result=this.check(element);if(result){delete this.invalid[element.name];}else{this.invalid[element.name]=true;}if(!this.numberOfInvalids()){this.toHide=this.toHide.add(this.containers);}this.showErrors();return result;},showErrors:function(errors){if(errors){$.extend(this.errorMap,errors);this.errorList=[];for(var name in errors){this.errorList.push({message:errors[name],element:this.findByName(name)[0]});}this.successList=$.grep(this.successList,function(element){return!(element.name in errors);});}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors();},resetForm:function(){if($.fn.resetForm)$(this.currentForm).resetForm();this.submitted={};this.prepareForm();this.hideErrors();this.elements().r emoveClass(this.settings.errorClass);},numberOfInvalids:function(){return this.objectLength(this.invalid);},objectLength:function(obj){var count=0;for(var i in obj)count++;return count;},hideErrors:function(){this.addWrapper(this.toHide).hide();},valid:function(){return this.size()==0;},size:function(){return this.errorList.length;},focusInvalid:function(){if(this.settings.focusInvalid){try{$(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin");}catch(e){}}},findLastActive:function(){var lastActive=this.lastActive;return lastActive&&$.grep(this.errorList,function(n){return n.element.name==lastActive.name;}).length==1&&lastActive;},elements:function(){var validator=this,rulesCache={};return $([]).add(this.currentForm.elements).filter(":input").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&validator.settings.debug&&window.console&&console.error("%o has no name ass igned",this);if(this.name in rulesCache||!validator.objectLength($(this).rules()))return false;rulesCache[this.name]=true;return true;});},clean:function(selector){return $(selector)[0];},errors:function(){return $(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext);},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=$([]);this.toHide=$([]);this.currentElements=$([]);},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers);},prepareElement:function(element){this.reset();this.toHide=this.errorsFor(element);},check:function(element){element=this.clean(element);if(this.checkable(element)){element=this.findByName(element.name)[0];}var rules=$(element).rules();var dependencyMismatch=false;for(method in rules){var rule={method:method,parameters:rules[method]};try{var result=$.validator.methods[method].call(this,element.value.replace(/\r/g,""),element,rule.parameters);if(result=="dependency-mismatch"){depe ndencyMismatch=true;continue;}dependencyMismatch=false;if(result=="pending"){this.toHide=this.toHide.not(this.errorsFor(element));return;}if(!result){this.formatAndAdd(element,rule);return false;}}catch(e){this.settings.debug&&window.console&&console.log("exception occured when checking element "+element.id -+", check the '"+rule.method+"' method",e);throw e;}}if(dependencyMismatch)return;if(this.objectLength(rules))this.successList.push(element);return true;},customMetaMessage:function(element,method){if(!$.metadata)return;var meta=this.settings.meta?$(element).metadata()[this.settings.meta]:$(element).metadata();return meta&&meta.messages&&meta.messages[method];},customMessage:function(name,method){var m=this.settings.messages[name];return m&&(m.constructor==String?m:m[method]);},findDefined:function(){for(var i=0;iWarning: No message defined for "+element.name+"");},formatAndAdd:function(element,rule){var message=this.defaultMessage(element,rule.method),th eregex=/\$?\{(\d+)\}/g;if(typeof message=="function"){message=message.call(this,rule.parameters,element);}else if(theregex.test(message)){message=jQuery.format(message.replace(theregex,'{$1}'),rule.parameters);}this.errorList.push({message:message,element:element});this.errorMap[element.name]=message;this.submitted[element.name]=message;},addWrapper:function(toToggle){if(this.settings.wrapper)toToggle=toToggle.add(toToggle.parent(this.settings.wrapper));return toToggle;},defaultShowErrors:function(){for(var i=0;this.errorList[i];i++){var error=this.errorList[i];this.settings.highlight&&this.settings.highlight.call(this,error.element,this.settings.errorClass,this.settings.validClass);this.showLabel(error.element,error.message);}if(this.errorList.length){this.toShow=this.toShow.add(this.containers);}if(this.settings.success){for(var i=0;this.successList[i];i++){this.showLabel(this.successList[i]);}}if(this.settings.unhighlight){for(var i=0,elements=this.validElements();elements[i];i++ ){this.settings.unhighlight.call(this,elements[i],this.settings.errorClass,this.settings.validClass);}}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show();},validElements:function(){return this.currentElements.not(this.invalidElements());},invalidElements:function(){return $(this.errorList).map(function(){return this.element;});},showLabel:function(element,message){var label=this.errorsFor(element);if(label.length){label.removeClass().addClass(this.settings.errorClass);label.attr("generated")&&label.html(message);}else{label=$("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(element),generated:true}).addClass(this.settings.errorClass).html(message||"");if(this.settings.wrapper){label=label.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();}if(!this.labelContainer.append(label).length)this.settings.errorPlacement?this.settings.errorPlacement(label,$(element)):label.insertAfter(element);}if(!message&&this.settings.succ ess){label.text("");typeof this.settings.success=="string"?label.addClass(this.settings.success):this.settings.success(label);}this.toShow=this.toShow.add(label);},errorsFor:function(element){var name=this.idOrName(element);return this.errors().filter(function(){return $(this).attr('for')==name;});},idOrName:function(element){return this.groups[element.name]||(this.checkable(element)?element.name:element.id||element.name);},checkable:function(element){return/radio|checkbox/i.test(element.type);},findByName:function(name){var form=this.currentForm;return $(document.getElementsByName(name)).map(function(index,element){return element.form==form&&element.name==name&&element||null;});},getLength:function(value,element){switch(element.nodeName.toLowerCase()){case'select':return $("option:selected",element).length;case'input':if(this.checkable(element))return this.findByName(element.name).filter(':checked').length;}return value.length;},depend:function(param,element){return this.dependType s[typeof param]?this.dependTypes[typeof param](param,element):true;},dependTypes:{"boolean":function(param,element){return param;},"string":function(param,element){return!!$(param,element.form).length;},"function":function(param,element){return param(element);}},optional:function(element){return!$.validator.methods.required.call(this,$.trim(element.value),element)&&"dependency-mismatch";},startRequest:function(element){if(!this.pending[element.name]){this.pendingRequest++;this.pending[element.name]=true;}},stopRequest:function(element,valid){this.pendingRequest--;if(this.pendingRequest<0)this.pendingRequest=0;delete this.pending[element.name];if(valid&&this.pendingRequest==0&&this.formSubmitted&&this.form()){$(this.currentForm).submit();this.formSubmitted=false;}else if(!valid&&this.pendingRequest==0&&this.formSubmitted){$(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=false;}},previousValue:function(element){return $.data(element,"previousValue")||$.data (element,"previousValue",{old:null,valid:true,message:this.defaultMessage(element,"remote")});}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(className,rules){className.constructor==String?this.classRuleSettings[className]=rules:$.extend(this.classRuleSettings,className);},classRules:function(element){var rules={};var classes=$(element).attr('class');classes&&$.each(classes.split(' '),function(){if(this in $.validator.classRuleSettings){$.extend(rules,$.validator.classRuleSettings[this]);}});return rules;},attributeRules:function(element){var rules={};var $element=$(element);for(method in $.validator.methods){var value=$element.attr(method);if(value){rules[method]=value;}}if(rules.maxlength&&/-1|2147483647|524288/.test(rules.maxlength)){delete rules.maxlength;}return rules ;},metadataRules:function(element){if(!$.metadata)return{};var meta=$.data(element.form,'validator').settings.meta;return meta?$(element).metadata()[meta]:$(element).metadata();},staticRules:function(element){var rules={};var validator=$.data(element.form,'validator');if(validator.settings.rules){rules=$.validator.normalizeRule(validator.settings.rules[element.name])||{};}return rules;},normalizeRules:function(rules,element){$.each(rules,function(prop,val){if(val===false){delete rules[prop];return;}if(val.param||val.depends){var keepRule=true;switch(typeof val.depends){case"string":keepRule=!!$(val.depends,element.form).length;break;case"function":keepRule=val.depends.call(element,element);break;}if(keepRule){rules[prop]=val.param!==undefined?val.param:true;}else{delete rules[prop];}}});$.each(rules,function(rule,parameter){rules[rule]=$.isFunction(parameter)?parameter(element):parameter;});$.each(['minlength','maxlength','min','max'],function(){if(rules[this]){rules[this]=Number(ru les[this]);}});$.each(['rangelength','range'],function(){if(rules[this]){rules[this]=[Number(rules[this][0]),Number(rules[this][1])];}});if($.validator.autoCreateRanges){if(rules.min&&rules.max){rules.range=[rules.min,rules.max];delete rules.min;delete rules.max;}if(rules.minlength&&rules.maxlength){rules.rangelength=[rules.minlength,rules.maxlength];delete rules.minlength;delete rules.maxlength;}}if(rules.messages){delete rules.messages;}return rules;},normalizeRule:function(data){if(typeof data=="string"){var transformed={};$.each(data.split(/\s/),function(){transformed[this]=true;});data=transformed;}return data;},addMethod:function(name,method,message){$.validator.methods[name]=method;$.validator.messages[name]=message!=undefined?message:$.validator.messages[name];if(method.length<3){$.validator.addClassRules(name,$.validator.normalizeRule(name));}},methods:{required:function(value,element,param){if(!this.depend(param,element))return"dependency-mismatch";switch(element.nodeName. toLowerCase()){case'select':var val=$(element).val();return val&&val.length>0;case'input':if(this.checkable(element))return this.getLength(value,element)>0;default:return $.trim(value).length>0;}},remote:function(value,element,param){if(this.optional(element))return"dependency-mismatch";var previous=this.previousValue(element);if(!this.settings.messages[element.name])this.settings.messages[element.name]={};previous.originalMessage=this.settings.messages[element.name].remote;this.settings.messages[element.name].remote=previous.message;param=typeof param=="string"&&{url:param}||param;if(previous.old!==value){previous.old=value;var validator=this;this.startRequest(element);var data={};data[element.name]=value;$.ajax($.extend(true,{url:param,mode:"abort",port:"validate"+element.name,dataType:"json",data:data,success:function(response){validator.settings.messages[element.name].remote=previous.originalMessage;var valid=response===true;if(valid){var submitted=validator.formSubmitted;valida tor.prepareElement(element);validator.formSubmitted=submitted;validator.successList.push(element);validator.showErrors();}else{var errors={};var message=(previous.message=response||validator.defaultMessage(element,"remote"));errors[element.name]=$.isFunction(message)?message(value):message;validator.showErrors(errors);}previous.valid=valid;validator.stopRequest(element,valid);}},param));return"pending";}else if(this.pending[element.name]){return"pending";}return previous.valid;},minlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)>=param;},maxlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)<=param;},rangelength:function(value,element,param){var length=this.getLength($.trim(value),element);return this.optional(element)||(length>=param[0]&&length<=param[1]);},min:function(value,element,param){return this.optional(element)||value>=param;},max:function(value,element,param){re turn this.optional(element)||value<=param;},range:function(value,element,param){return this.optional(element)||(value>=param[0]&&value<=param[1]);},email:function(value,element){return this.optional(element)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF] )([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);},url:function(value,element){return this.optional(element)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f] {2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);},date:function(value,element){return this.optional(element)||!/Invalid|NaN/.test(new Date(value));},dateISO:function(value,element){return this.optional(element)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);},number:function(value,element){return this.optional(element)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);},digits:function(value,element){return this.optional(element)||/^\d+$/.test(value);},creditcard:function(value,element){if(this.optional(element))return"dependency-mismatch";if(/[^0-9-]+/.test(value))return false;var nCheck=0,nDigit=0,bEven=false;value=value.replace(/ \D/g,"");for(var n=value.length-1;n>=0;n--){var cDigit=value.charAt(n);var nDigit=parseInt(cDigit,10);if(bEven){if((nDigit*=2)>9)nDigit-=9;}nCheck+=nDigit;bEven=!bEven;}return(nCheck%10)==0;},accept:function(value,element,param){param=typeof param=="string"?param.replace(/,/g,'|'):"png|jpe?g|gif";return this.optional(element)||value.match(new RegExp(".("+param+")$","i"));},equalTo:function(value,element,param){var target=$(param).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){$(element).valid();});return value==target.val();}}});$.format=$.validator.format;})(jQuery);;(function($){var ajax=$.ajax;var pendingRequests={};$.ajax=function(settings){settings=$.extend(settings,$.extend({},$.ajaxSettings,settings));var port=settings.port;if(settings.mode=="abort"){if(pendingRequests[port]){pendingRequests[port].abort();}return(pendingRequests[port]=ajax.apply(this,arguments));}return ajax.apply(this,arguments);};})(jQuery);;(function($){if(!jQuery.event.special.focusin &&!jQuery.event.special.focusout&&document.addEventListener){$.each({focus:'focusin',blur:'focusout'},function(original,fix){$.event.special[fix]={setup:function(){this.addEventListener(original,handler,true);},teardown:function(){this.removeEventListener(original,handler,true);},handler:function(e){arguments[0]=$.event.fix(e);arguments[0].type=fix;return $.event.handle.apply(this,arguments);}};function handler(e){e=$.event.fix(e);e.type=fix;return $.event.handle.call(this,e);}});};$.extend($.fn,{validateDelegate:function(delegate,type,handler){return this.bind(type,function(event){var target=$(event.target);if(target.is(delegate)){return handler.apply(target,arguments);}});}});})(jQuery); \ No newline at end of file