diff --git a/3rdparty/Archive/Tar.php b/3rdparty/Archive/Tar.php index e9969501a0..fd2d5d7d9b 100644 --- a/3rdparty/Archive/Tar.php +++ b/3rdparty/Archive/Tar.php @@ -35,7 +35,7 @@ * @author Vincent Blavet * @copyright 1997-2010 The Authors * @license http://www.opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: Tar.php 323476 2012-02-24 15:27:26Z mrook $ + * @version CVS: $Id: Tar.php 324840 2012-04-05 08:44:41Z mrook $ * @link http://pear.php.net/package/Archive_Tar */ @@ -50,7 +50,7 @@ define('ARCHIVE_TAR_END_BLOCK', pack("a512", '')); * @package Archive_Tar * @author Vincent Blavet * @license http://www.opensource.org/licenses/bsd-license.php New BSD License -* @version $Revision: 323476 $ +* @version $Revision: 324840 $ */ class Archive_Tar extends PEAR { @@ -577,7 +577,7 @@ class Archive_Tar extends PEAR } // ----- Get the arguments - $v_att_list = func_get_args(); + $v_att_list = &func_get_args(); // ----- Read the attributes $i=0; @@ -649,14 +649,14 @@ class Archive_Tar extends PEAR // {{{ _error() function _error($p_message) { - $this->error_object = $this->raiseError($p_message); + $this->error_object = &$this->raiseError($p_message); } // }}} // {{{ _warning() function _warning($p_message) { - $this->error_object = $this->raiseError($p_message); + $this->error_object = &$this->raiseError($p_message); } // }}} @@ -981,7 +981,7 @@ class Archive_Tar extends PEAR // }}} // {{{ _addFile() - function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir,$v_stored_filename=null) + function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $v_stored_filename=null) { if (!$this->_file) { $this->_error('Invalid file descriptor'); @@ -992,31 +992,32 @@ class Archive_Tar extends PEAR $this->_error('Invalid file name'); return false; } - if(is_null($v_stored_filename)){ - // ----- Calculate the stored filename - $p_filename = $this->_translateWinPath($p_filename, false); - $v_stored_filename = $p_filename; - if (strcmp($p_filename, $p_remove_dir) == 0) { - return true; - } - if ($p_remove_dir != '') { - if (substr($p_remove_dir, -1) != '/') - $p_remove_dir .= '/'; + // ownCloud change to make it possible to specify the filename to use + if(is_null($v_stored_filename)) { + // ----- Calculate the stored filename + $p_filename = $this->_translateWinPath($p_filename, false); + $v_stored_filename = $p_filename; + if (strcmp($p_filename, $p_remove_dir) == 0) { + return true; + } + if ($p_remove_dir != '') { + if (substr($p_remove_dir, -1) != '/') + $p_remove_dir .= '/'; - if (substr($p_filename, 0, strlen($p_remove_dir)) == $p_remove_dir) - $v_stored_filename = substr($p_filename, strlen($p_remove_dir)); - } - $v_stored_filename = $this->_translateWinPath($v_stored_filename); - if ($p_add_dir != '') { - if (substr($p_add_dir, -1) == '/') - $v_stored_filename = $p_add_dir.$v_stored_filename; - else - $v_stored_filename = $p_add_dir.'/'.$v_stored_filename; - } + if (substr($p_filename, 0, strlen($p_remove_dir)) == $p_remove_dir) + $v_stored_filename = substr($p_filename, strlen($p_remove_dir)); + } + $v_stored_filename = $this->_translateWinPath($v_stored_filename); + if ($p_add_dir != '') { + if (substr($p_add_dir, -1) == '/') + $v_stored_filename = $p_add_dir.$v_stored_filename; + else + $v_stored_filename = $p_add_dir.'/'.$v_stored_filename; + } - $v_stored_filename = $this->_pathReduction($v_stored_filename); - } + $v_stored_filename = $this->_pathReduction($v_stored_filename); + } if ($this->_isArchive($p_filename)) { if (($v_file = @fopen($p_filename, "rb")) == 0) { @@ -1775,12 +1776,20 @@ class Archive_Tar extends PEAR } if ($this->_compress_type == 'gz') { + $end_blocks = 0; + while (!@gzeof($v_temp_tar)) { $v_buffer = @gzread($v_temp_tar, 512); if ($v_buffer == ARCHIVE_TAR_END_BLOCK || strlen($v_buffer) == 0) { + $end_blocks++; // do not copy end blocks, we will re-make them // after appending continue; + } elseif ($end_blocks > 0) { + for ($i = 0; $i < $end_blocks; $i++) { + $this->_writeBlock(ARCHIVE_TAR_END_BLOCK); + } + $end_blocks = 0; } $v_binary_data = pack("a512", $v_buffer); $this->_writeBlock($v_binary_data); @@ -1789,9 +1798,19 @@ class Archive_Tar extends PEAR @gzclose($v_temp_tar); } elseif ($this->_compress_type == 'bz2') { + $end_blocks = 0; + while (strlen($v_buffer = @bzread($v_temp_tar, 512)) > 0) { - if ($v_buffer == ARCHIVE_TAR_END_BLOCK) { + if ($v_buffer == ARCHIVE_TAR_END_BLOCK || strlen($v_buffer) == 0) { + $end_blocks++; + // do not copy end blocks, we will re-make them + // after appending continue; + } elseif ($end_blocks > 0) { + for ($i = 0; $i < $end_blocks; $i++) { + $this->_writeBlock(ARCHIVE_TAR_END_BLOCK); + } + $end_blocks = 0; } $v_binary_data = pack("a512", $v_buffer); $this->_writeBlock($v_binary_data); diff --git a/3rdparty/class.phpmailer.php b/3rdparty/class.phpmailer.php index 4589cd791e..af089d5978 100644 --- a/3rdparty/class.phpmailer.php +++ b/3rdparty/class.phpmailer.php @@ -2,7 +2,7 @@ /*~ class.phpmailer.php .---------------------------------------------------------------------------. | Software: PHPMailer - PHP email class | -| Version: 5.2 | +| Version: 5.2.1 | | Site: https://code.google.com/a/apache-extras.org/p/phpmailer/ | | ------------------------------------------------------------------------- | | Admin: Jim Jagielski (project admininistrator) | @@ -10,7 +10,7 @@ | : Marcus Bointon (coolbru) coolbru@users.sourceforge.net | | : Jim Jagielski (jimjag) jimjag@gmail.com | | Founder: Brent R. Matzelle (original founder) | -| Copyright (c) 2010-2011, Jim Jagielski. All Rights Reserved. | +| Copyright (c) 2010-2012, Jim Jagielski. All Rights Reserved. | | Copyright (c) 2004-2009, Andy Prevost. All Rights Reserved. | | Copyright (c) 2001-2003, Brent R. Matzelle | | ------------------------------------------------------------------------- | @@ -29,7 +29,7 @@ * @author Andy Prevost * @author Marcus Bointon * @author Jim Jagielski - * @copyright 2010 - 2011 Jim Jagielski + * @copyright 2010 - 2012 Jim Jagielski * @copyright 2004 - 2009 Andy Prevost * @version $Id: class.phpmailer.php 450 2010-06-23 16:46:33Z coolbru $ * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License @@ -129,6 +129,13 @@ class PHPMailer { */ protected $MIMEHeader = ''; + /** + * Stores the complete sent MIME message (Body and Headers) + * @var string + * @access protected + */ + protected $SentMIMEMessage = ''; + /** * Sets word wrapping on the body of the message to a given number of * characters. @@ -317,7 +324,7 @@ class PHPMailer { * Sets the PHPMailer Version number * @var string */ - public $Version = '5.2'; + public $Version = '5.2.1'; /** * What to use in the X-Mailer header @@ -460,7 +467,7 @@ class PHPMailer { * @return boolean */ public function AddReplyTo($address, $name = '') { - return $this->AddAnAddress('ReplyTo', $address, $name); + return $this->AddAnAddress('Reply-To', $address, $name); } /** @@ -473,12 +480,14 @@ class PHPMailer { * @access protected */ protected function AddAnAddress($kind, $address, $name = '') { - if (!preg_match('/^(to|cc|bcc|ReplyTo)$/', $kind)) { + if (!preg_match('/^(to|cc|bcc|Reply-To)$/', $kind)) { $this->SetError($this->Lang('Invalid recipient array').': '.$kind); if ($this->exceptions) { throw new phpmailerException('Invalid recipient array: ' . $kind); } - echo $this->Lang('Invalid recipient array').': '.$kind; + if ($this->SMTPDebug) { + echo $this->Lang('Invalid recipient array').': '.$kind; + } return false; } $address = trim($address); @@ -488,10 +497,12 @@ class PHPMailer { if ($this->exceptions) { throw new phpmailerException($this->Lang('invalid_address').': '.$address); } - echo $this->Lang('invalid_address').': '.$address; + if ($this->SMTPDebug) { + echo $this->Lang('invalid_address').': '.$address; + } return false; } - if ($kind != 'ReplyTo') { + if ($kind != 'Reply-To') { if (!isset($this->all_recipients[strtolower($address)])) { array_push($this->$kind, array($address, $name)); $this->all_recipients[strtolower($address)] = true; @@ -520,14 +531,16 @@ class PHPMailer { if ($this->exceptions) { throw new phpmailerException($this->Lang('invalid_address').': '.$address); } - echo $this->Lang('invalid_address').': '.$address; + if ($this->SMTPDebug) { + echo $this->Lang('invalid_address').': '.$address; + } return false; } $this->From = $address; $this->FromName = $name; if ($auto) { if (empty($this->ReplyTo)) { - $this->AddAnAddress('ReplyTo', $address, $name); + $this->AddAnAddress('Reply-To', $address, $name); } if (empty($this->Sender)) { $this->Sender = $address; @@ -574,6 +587,7 @@ class PHPMailer { if(!$this->PreSend()) return false; return $this->PostSend(); } catch (phpmailerException $e) { + $this->SentMIMEMessage = ''; $this->SetError($e->getMessage()); if ($this->exceptions) { throw $e; @@ -584,6 +598,7 @@ class PHPMailer { protected function PreSend() { try { + $mailHeader = ""; if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) { throw new phpmailerException($this->Lang('provide_address'), self::STOP_CRITICAL); } @@ -603,6 +618,19 @@ class PHPMailer { $this->MIMEHeader = $this->CreateHeader(); $this->MIMEBody = $this->CreateBody(); + // To capture the complete message when using mail(), create + // an extra header list which CreateHeader() doesn't fold in + if ($this->Mailer == 'mail') { + if (count($this->to) > 0) { + $mailHeader .= $this->AddrAppend("To", $this->to); + } else { + $mailHeader .= $this->HeaderLine("To", "undisclosed-recipients:;"); + } + $mailHeader .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader(trim($this->Subject)))); + // if(count($this->cc) > 0) { + // $mailHeader .= $this->AddrAppend("Cc", $this->cc); + // } + } // digitally sign with DKIM if enabled if ($this->DKIM_domain && $this->DKIM_private) { @@ -610,7 +638,9 @@ class PHPMailer { $this->MIMEHeader = str_replace("\r\n", "\n", $header_dkim) . $this->MIMEHeader; } + $this->SentMIMEMessage = sprintf("%s%s\r\n\r\n%s",$this->MIMEHeader,$mailHeader,$this->MIMEBody); return true; + } catch (phpmailerException $e) { $this->SetError($e->getMessage()); if ($this->exceptions) { @@ -628,6 +658,8 @@ class PHPMailer { return $this->SendmailSend($this->MIMEHeader, $this->MIMEBody); case 'smtp': return $this->SmtpSend($this->MIMEHeader, $this->MIMEBody); + case 'mail': + return $this->MailSend($this->MIMEHeader, $this->MIMEBody); default: return $this->MailSend($this->MIMEHeader, $this->MIMEBody); } @@ -637,7 +669,9 @@ class PHPMailer { if ($this->exceptions) { throw $e; } - echo $e->getMessage()."\n"; + if ($this->SMTPDebug) { + echo $e->getMessage()."\n"; + } return false; } } @@ -703,7 +737,7 @@ class PHPMailer { $to = implode(', ', $toArr); if (empty($this->Sender)) { - $params = "-oi -f %s"; + $params = "-oi "; } else { $params = sprintf("-oi -f %s", $this->Sender); } @@ -732,7 +766,7 @@ class PHPMailer { $this->doCallback($isSent, $val, $this->cc, $this->bcc, $this->Subject, $body); } } else { - $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header); + $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params); // implement call back function if it exists $isSent = ($rt == 1) ? 1 : 0; $this->doCallback($isSent, $to, $this->cc, $this->bcc, $this->Subject, $body); @@ -880,7 +914,9 @@ class PHPMailer { } } catch (phpmailerException $e) { $this->smtp->Reset(); - throw $e; + if ($this->exceptions) { + throw $e; + } } return true; } @@ -1159,7 +1195,7 @@ class PHPMailer { $result .= $this->HeaderLine('To', 'undisclosed-recipients:;'); } } - } + } $from = array(); $from[0][0] = trim($this->From); @@ -1177,7 +1213,7 @@ class PHPMailer { } if(count($this->ReplyTo) > 0) { - $result .= $this->AddrAppend('Reply-to', $this->ReplyTo); + $result .= $this->AddrAppend('Reply-To', $this->ReplyTo); } // mail() sets the subject itself @@ -1250,6 +1286,16 @@ class PHPMailer { return $result; } + /** + * Returns the MIME message (headers and body). Only really valid post PreSend(). + * @access public + * @return string + */ + public function GetSentMIMEMessage() { + return $this->SentMIMEMessage; + } + + /** * Assembles the message body. Returns an empty string on failure. * @access public @@ -1363,8 +1409,8 @@ class PHPMailer { $signed = tempnam("", "signed"); if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_cert_file, array("file://".$this->sign_key_file, $this->sign_key_pass), NULL)) { @unlink($file); - @unlink($signed); $body = file_get_contents($signed); + @unlink($signed); } else { @unlink($file); @unlink($signed); @@ -1487,7 +1533,9 @@ class PHPMailer { if ($this->exceptions) { throw $e; } - echo $e->getMessage()."\n"; + if ($this->SMTPDebug) { + echo $e->getMessage()."\n"; + } if ( $e->getCode() == self::STOP_CRITICAL ) { return false; } @@ -1590,15 +1638,23 @@ class PHPMailer { return false; } } - if (version_compare(PHP_VERSION, '5.3.0', '<')) { - $magic_quotes = get_magic_quotes_runtime(); - set_magic_quotes_runtime(0); - } + $magic_quotes = get_magic_quotes_runtime(); + if ($magic_quotes) { + if (version_compare(PHP_VERSION, '5.3.0', '<')) { + set_magic_quotes_runtime(0); + } else { + ini_set('magic_quotes_runtime', 0); + } + } $file_buffer = file_get_contents($path); $file_buffer = $this->EncodeString($file_buffer, $encoding); - if (version_compare(PHP_VERSION, '5.3.0', '<')) { - set_magic_quotes_runtime($magic_quotes); - } + if ($magic_quotes) { + if (version_compare(PHP_VERSION, '5.3.0', '<')) { + set_magic_quotes_runtime($magic_quotes); + } else { + ini_set('magic_quotes_runtime', $magic_quotes); + } + } return $file_buffer; } catch (Exception $e) { $this->SetError($e->getMessage()); @@ -2154,7 +2210,7 @@ class PHPMailer { * @return $message */ public function MsgHTML($message, $basedir = '') { - preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images); + preg_match_all("/(src|background)=[\"'](.*)[\"']/Ui", $message, $images); if(isset($images[2])) { foreach($images[2] as $i => $url) { // do not change urls for absolute images (thanks to corvuscorax) @@ -2168,20 +2224,23 @@ class PHPMailer { if ( strlen($basedir) > 1 && substr($basedir, -1) != '/') { $basedir .= '/'; } if ( strlen($directory) > 1 && substr($directory, -1) != '/') { $directory .= '/'; } if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64', $mimeType) ) { - $message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message); + $message = preg_replace("/".$images[1][$i]."=[\"']".preg_quote($url, '/')."[\"']/Ui", $images[1][$i]."=\"".$cid."\"", $message); } } } } $this->IsHTML(true); $this->Body = $message; - $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s', '', $message))); - if (!empty($textMsg) && empty($this->AltBody)) { - $this->AltBody = html_entity_decode($textMsg); - } + if (empty($this->AltBody)) { + $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s', '', $message))); + if (!empty($textMsg)) { + $this->AltBody = html_entity_decode($textMsg, ENT_QUOTES, $this->CharSet); + } + } if (empty($this->AltBody)) { $this->AltBody = 'To view this email message, open it in a program that understands HTML!' . "\n\n"; } + return $message; } /** diff --git a/3rdparty/class.smtp.php b/3rdparty/class.smtp.php index 07c275936c..6977bffad1 100644 --- a/3rdparty/class.smtp.php +++ b/3rdparty/class.smtp.php @@ -2,7 +2,7 @@ /*~ class.smtp.php .---------------------------------------------------------------------------. | Software: PHPMailer - PHP email class | -| Version: 5.2 | +| Version: 5.2.1 | | Site: https://code.google.com/a/apache-extras.org/p/phpmailer/ | | ------------------------------------------------------------------------- | | Admin: Jim Jagielski (project admininistrator) | @@ -10,7 +10,7 @@ | : Marcus Bointon (coolbru) coolbru@users.sourceforge.net | | : Jim Jagielski (jimjag) jimjag@gmail.com | | Founder: Brent R. Matzelle (original founder) | -| Copyright (c) 2010-2011, Jim Jagielski. All Rights Reserved. | +| Copyright (c) 2010-2012, Jim Jagielski. All Rights Reserved. | | Copyright (c) 2004-2009, Andy Prevost. All Rights Reserved. | | Copyright (c) 2001-2003, Brent R. Matzelle | | ------------------------------------------------------------------------- | @@ -30,7 +30,7 @@ * @author Marcus Bointon * @copyright 2004 - 2008 Andy Prevost * @author Jim Jagielski - * @copyright 2010 - 2011 Jim Jagielski + * @copyright 2010 - 2012 Jim Jagielski * @license http://www.gnu.org/copyleft/lesser.html Distributed under the Lesser General Public License (LGPL) * @version $Id: class.smtp.php 450 2010-06-23 16:46:33Z coolbru $ */ @@ -72,7 +72,7 @@ class SMTP { * Sets the SMTP PHPMailer Version number * @var string */ - public $Version = '5.2'; + public $Version = '5.2.1'; ///////////////////////////////////////////////// // PROPERTIES, PRIVATE AND PROTECTED @@ -797,7 +797,8 @@ class SMTP { */ private function get_lines() { $data = ""; - while($str = @fgets($this->smtp_conn,515)) { + while(!feof($this->smtp_conn)) { + $str = @fgets($this->smtp_conn,515); if($this->do_debug >= 4) { echo "SMTP -> get_lines(): \$data was \"$data\"" . $this->CRLF . '
'; echo "SMTP -> get_lines(): \$str is \"$str\"" . $this->CRLF . '
'; diff --git a/3rdparty/css/chosen-sprite.png b/3rdparty/css/chosen-sprite.png old mode 100644 new mode 100755 index f20db4439e..113dc9885a Binary files a/3rdparty/css/chosen-sprite.png and b/3rdparty/css/chosen-sprite.png differ diff --git a/3rdparty/css/chosen.css b/3rdparty/css/chosen.css old mode 100644 new mode 100755 index 96bae0fe95..89b5970e57 --- a/3rdparty/css/chosen.css +++ b/3rdparty/css/chosen.css @@ -1,16 +1,10 @@ /* @group Base */ -select.chzn-select { - visibility: hidden; - height: 28px !important; - min-height: 28px !important; -} .chzn-container { font-size: 13px; position: relative; display: inline-block; zoom: 1; *display: inline; - vertical-align: bottom; } .chzn-container .chzn-drop { background: #fff; @@ -29,31 +23,37 @@ select.chzn-select { /* @group Single Chosen */ .chzn-container-single .chzn-single { - background-color: #fff; - background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eeeeee), color-stop(0.5, white)); - background-image: -webkit-linear-gradient(center bottom, #eeeeee 0%, white 50%); - background-image: -moz-linear-gradient(center bottom, #eeeeee 0%, white 50%); - background-image: -o-linear-gradient(top, #eeeeee 0%,#ffffff 50%); - background-image: -ms-linear-gradient(top, #eeeeee 0%,#ffffff 50%); - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#ffffff',GradientType=0 ); - background-image: linear-gradient(top, #eeeeee 0%,#ffffff 50%); - -webkit-border-radius: 4px; - -moz-border-radius : 4px; - border-radius : 4px; + background-color: #ffffff; + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0 ); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4)); + background-image: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); + background-image: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); + background-image: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); + background-image: -ms-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); + background-image: linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); + -webkit-border-radius: 5px; + -moz-border-radius : 5px; + border-radius : 5px; -moz-background-clip : padding; -webkit-background-clip: padding-box; background-clip : padding-box; - border: 1px solid #aaa; + border: 1px solid #aaaaaa; + -webkit-box-shadow: 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1); + -moz-box-shadow : 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1); + box-shadow : 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1); display: block; overflow: hidden; white-space: nowrap; position: relative; - height: 26px; - line-height: 26px; + height: 23px; + line-height: 24px; padding: 0 0 0 8px; - color: #444; + color: #444444; text-decoration: none; } +.chzn-container-single .chzn-default { + color: #999; +} .chzn-container-single .chzn-single span { margin-right: 26px; display: block; @@ -61,25 +61,22 @@ select.chzn-select { white-space: nowrap; -o-text-overflow: ellipsis; -ms-text-overflow: ellipsis; - -moz-binding: url('/xml/ellipsis.xml#ellipsis'); text-overflow: ellipsis; } +.chzn-container-single .chzn-single abbr { + display: block; + position: absolute; + right: 26px; + top: 6px; + width: 12px; + height: 13px; + font-size: 1px; + background: url(chosen-sprite.png) right top no-repeat; +} +.chzn-container-single .chzn-single abbr:hover { + background-position: right -11px; +} .chzn-container-single .chzn-single div { - -webkit-border-radius: 0 4px 4px 0; - -moz-border-radius : 0 4px 4px 0; - border-radius : 0 4px 4px 0; - -moz-background-clip : padding; - -webkit-background-clip: padding-box; - background-clip : padding-box; - background: #ccc; - background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #ccc), color-stop(0.6, #eee)); - background-image: -webkit-linear-gradient(center bottom, #ccc 0%, #eee 60%); - background-image: -moz-linear-gradient(center bottom, #ccc 0%, #eee 60%); - background-image: -o-linear-gradient(bottom, #ccc 0%, #eee 60%); - background-image: -ms-linear-gradient(top, #cccccc 0%,#eeeeee 60%); - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cccccc', endColorstr='#eeeeee',GradientType=0 ); - background-image: linear-gradient(top, #cccccc 0%,#eeeeee 60%); - border-left: 1px solid #aaa; position: absolute; right: 0; top: 0; @@ -88,25 +85,26 @@ select.chzn-select { width: 18px; } .chzn-container-single .chzn-single div b { - background: url('chosen-sprite.png') no-repeat 0 1px; + background: url('chosen-sprite.png') no-repeat 0 0; display: block; width: 100%; height: 100%; } .chzn-container-single .chzn-search { padding: 3px 4px; + position: relative; margin: 0; white-space: nowrap; + z-index: 1010; } .chzn-container-single .chzn-search input { - background: #fff url('chosen-sprite.png') no-repeat 100% -20px; - background: url('chosen-sprite.png') no-repeat 100% -20px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee)); - background: url('chosen-sprite.png') no-repeat 100% -20px, -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%); - background: url('chosen-sprite.png') no-repeat 100% -20px, -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%); - background: url('chosen-sprite.png') no-repeat 100% -20px, -o-linear-gradient(bottom, white 85%, #eeeeee 99%); - background: url('chosen-sprite.png') no-repeat 100% -20px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%); - background: url('chosen-sprite.png') no-repeat 100% -20px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%); - background: url('chosen-sprite.png') no-repeat 100% -20px, linear-gradient(top, #ffffff 85%,#eeeeee 99%); + background: #fff url('chosen-sprite.png') no-repeat 100% -22px; + background: url('chosen-sprite.png') no-repeat 100% -22px, -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff)); + background: url('chosen-sprite.png') no-repeat 100% -22px, -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%); + background: url('chosen-sprite.png') no-repeat 100% -22px, -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%); + background: url('chosen-sprite.png') no-repeat 100% -22px, -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%); + background: url('chosen-sprite.png') no-repeat 100% -22px, -ms-linear-gradient(top, #eeeeee 1%, #ffffff 15%); + background: url('chosen-sprite.png') no-repeat 100% -22px, linear-gradient(top, #eeeeee 1%, #ffffff 15%); margin: 1px 0; padding: 4px 20px 4px 5px; outline: 0; @@ -124,16 +122,20 @@ select.chzn-select { } /* @end */ +.chzn-container-single-nosearch .chzn-search input { + position: absolute; + left: -9000px; +} + /* @group Multi Chosen */ .chzn-container-multi .chzn-choices { background-color: #fff; - background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee)); - background-image: -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%); - background-image: -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%); - background-image: -o-linear-gradient(bottom, white 85%, #eeeeee 99%); - background-image: -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%); - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee',GradientType=0 ); - background-image: linear-gradient(top, #ffffff 85%,#eeeeee 99%); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff)); + background-image: -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%); + background-image: -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%); + background-image: -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%); + background-image: -ms-linear-gradient(top, #eeeeee 1%, #ffffff 15%); + background-image: linear-gradient(top, #eeeeee 1%, #ffffff 15%); border: 1px solid #aaa; margin: 0; padding: 0; @@ -156,6 +158,9 @@ select.chzn-select { color: #666; background: transparent !important; border: 0 !important; + font-family: sans-serif; + font-size: 100%; + height: 15px; padding: 5px; margin: 1px 0; outline: 0; @@ -175,21 +180,22 @@ select.chzn-select { -webkit-background-clip: padding-box; background-clip : padding-box; background-color: #e4e4e4; - background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #e4e4e4), color-stop(0.7, #eeeeee)); - background-image: -webkit-linear-gradient(center bottom, #e4e4e4 0%, #eeeeee 70%); - background-image: -moz-linear-gradient(center bottom, #e4e4e4 0%, #eeeeee 70%); - background-image: -o-linear-gradient(bottom, #e4e4e4 0%, #eeeeee 70%); - background-image: -ms-linear-gradient(top, #e4e4e4 0%,#eeeeee 70%); - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e4e4e4', endColorstr='#eeeeee',GradientType=0 ); - background-image: linear-gradient(top, #e4e4e4 0%,#eeeeee 70%); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f4f4', endColorstr='#eeeeee', GradientType=0 ); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee)); + background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: -ms-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + -webkit-box-shadow: 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05); + -moz-box-shadow : 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05); + box-shadow : 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05); color: #333; - border: 1px solid #b4b4b4; + border: 1px solid #aaaaaa; line-height: 13px; - padding: 3px 19px 3px 6px; + padding: 3px 20px 3px 5px; margin: 3px 0 3px 5px; position: relative; -} -.chzn-container-multi .chzn-choices .search-choice span { cursor: default; } .chzn-container-multi .chzn-choices .search-choice-focus { @@ -198,25 +204,25 @@ select.chzn-select { .chzn-container-multi .chzn-choices .search-choice .search-choice-close { display: block; position: absolute; - right: 5px; - top: 6px; - width: 8px; - height: 9px; + right: 3px; + top: 4px; + width: 12px; + height: 13px; font-size: 1px; background: url(chosen-sprite.png) right top no-repeat; } .chzn-container-multi .chzn-choices .search-choice .search-choice-close:hover { - background-position: right -9px; + background-position: right -11px; } .chzn-container-multi .chzn-choices .search-choice-focus .search-choice-close { - background-position: right -9px; + background-position: right -11px; } /* @end */ /* @group Results */ .chzn-container .chzn-results { margin: 0 4px 4px 0; - max-height: 190px; + max-height: 240px; padding: 0 0 0 4px; position: relative; overflow-x: hidden; @@ -227,16 +233,25 @@ select.chzn-select { padding: 0; } .chzn-container .chzn-results li { - line-height: 80%; - padding: 7px 7px 8px; + display: none; + line-height: 15px; + padding: 5px 6px; margin: 0; list-style: none; } .chzn-container .chzn-results .active-result { cursor: pointer; + display: list-item; } .chzn-container .chzn-results .highlighted { - background: #3875d7; + background-color: #3875d7; + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3875d7', endColorstr='#2a62bc', GradientType=0 ); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc)); + background-image: -webkit-linear-gradient(top, #3875d7 20%, #2a62bc 90%); + background-image: -moz-linear-gradient(top, #3875d7 20%, #2a62bc 90%); + background-image: -o-linear-gradient(top, #3875d7 20%, #2a62bc 90%); + background-image: -ms-linear-gradient(top, #3875d7 20%, #2a62bc 90%); + background-image: linear-gradient(top, #3875d7 20%, #2a62bc 90%); color: #fff; } .chzn-container .chzn-results li em { @@ -248,6 +263,7 @@ select.chzn-select { } .chzn-container .chzn-results .no-results { background: #f4f4f4; + display: list-item; } .chzn-container .chzn-results .group-result { cursor: default; @@ -255,11 +271,34 @@ select.chzn-select { font-weight: bold; } .chzn-container .chzn-results .group-option { - padding-left: 20px; + padding-left: 15px; } .chzn-container-multi .chzn-drop .result-selected { display: none; } +.chzn-container .chzn-results-scroll { + background: white; + margin: 0 4px; + position: absolute; + text-align: center; + width: 321px; /* This should by dynamic with js */ + z-index: 1; +} +.chzn-container .chzn-results-scroll span { + display: inline-block; + height: 17px; + text-indent: -5000px; + width: 9px; +} +.chzn-container .chzn-results-scroll-down { + bottom: 0; +} +.chzn-container .chzn-results-scroll-down span { + background: url('chosen-sprite.png') no-repeat -4px -3px; +} +.chzn-container .chzn-results-scroll-up span { + background: url('chosen-sprite.png') no-repeat -22px -3px; +} /* @end */ /* @group Active */ @@ -277,13 +316,13 @@ select.chzn-select { -o-box-shadow : 0 1px 0 #fff inset; box-shadow : 0 1px 0 #fff inset; background-color: #eee; - background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, white), color-stop(0.5, #eeeeee)); - background-image: -webkit-linear-gradient(center bottom, white 0%, #eeeeee 50%); - background-image: -moz-linear-gradient(center bottom, white 0%, #eeeeee 50%); - background-image: -o-linear-gradient(bottom, white 0%, #eeeeee 50%); - background-image: -ms-linear-gradient(top, #ffffff 0%,#eeeeee 50%); - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee',GradientType=0 ); - background-image: linear-gradient(top, #ffffff 0%,#eeeeee 50%); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0 ); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #eeeeee), color-stop(80%, #ffffff)); + background-image: -webkit-linear-gradient(top, #eeeeee 20%, #ffffff 80%); + background-image: -moz-linear-gradient(top, #eeeeee 20%, #ffffff 80%); + background-image: -o-linear-gradient(top, #eeeeee 20%, #ffffff 80%); + background-image: -ms-linear-gradient(top, #eeeeee 20%, #ffffff 80%); + background-image: linear-gradient(top, #eeeeee 20%, #ffffff 80%); -webkit-border-bottom-left-radius : 0; -webkit-border-bottom-right-radius: 0; -moz-border-radius-bottomleft : 0; @@ -310,32 +349,44 @@ select.chzn-select { } /* @end */ -/* @group Right to Left */ -.chzn-rtl { direction:rtl;text-align: right; } -.chzn-rtl .chzn-single { padding-left: 0; padding-right: 8px; } -.chzn-rtl .chzn-single span { margin-left: 26px; margin-right: 0; } -.chzn-rtl .chzn-single div { - left: 0; right: auto; - border-left: none; border-right: 1px solid #aaaaaa; - -webkit-border-radius: 4px 0 0 4px; - -moz-border-radius : 4px 0 0 4px; - border-radius : 4px 0 0 4px; +/* @group Disabled Support */ +.chzn-disabled { + cursor: default; + opacity:0.5 !important; } +.chzn-disabled .chzn-single { + cursor: default; +} +.chzn-disabled .chzn-choices .search-choice .search-choice-close { + cursor: default; +} + +/* @group Right to Left */ +.chzn-rtl { text-align: right; } +.chzn-rtl .chzn-single { padding: 0 8px 0 0; overflow: visible; } +.chzn-rtl .chzn-single span { margin-left: 26px; margin-right: 0; direction: rtl; } + +.chzn-rtl .chzn-single div { left: 3px; right: auto; } +.chzn-rtl .chzn-single abbr { + left: 26px; + right: auto; +} +.chzn-rtl .chzn-choices .search-field input { direction: rtl; } .chzn-rtl .chzn-choices li { float: right; } -.chzn-rtl .chzn-choices .search-choice { padding: 3px 6px 3px 19px; margin: 3px 5px 3px 0; } -.chzn-rtl .chzn-choices .search-choice .search-choice-close { left: 5px; right: auto; background-position: right top;} -.chzn-rtl.chzn-container-single .chzn-results { margin-left: 4px; margin-right: 0; padding-left: 0; padding-right: 4px; } -.chzn-rtl .chzn-results .group-option { padding-left: 0; padding-right: 20px; } +.chzn-rtl .chzn-choices .search-choice { padding: 3px 5px 3px 19px; margin: 3px 5px 3px 0; } +.chzn-rtl .chzn-choices .search-choice .search-choice-close { left: 4px; right: auto; background-position: right top;} +.chzn-rtl.chzn-container-single .chzn-results { margin: 0 0 4px 4px; padding: 0 4px 0 0; } +.chzn-rtl .chzn-results .group-option { padding-left: 0; padding-right: 15px; } .chzn-rtl.chzn-container-active .chzn-single-with-drop div { border-right: none; } .chzn-rtl .chzn-search input { - background: url('chosen-sprite.png') no-repeat -38px -20px, #ffffff; - background: url('chosen-sprite.png') no-repeat -38px -20px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee)); - background: url('chosen-sprite.png') no-repeat -38px -20px, -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%); - background: url('chosen-sprite.png') no-repeat -38px -20px, -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%); - background: url('chosen-sprite.png') no-repeat -38px -20px, -o-linear-gradient(bottom, white 85%, #eeeeee 99%); - background: url('chosen-sprite.png') no-repeat -38px -20px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%); - background: url('chosen-sprite.png') no-repeat -38px -20px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%); - background: url('chosen-sprite.png') no-repeat -38px -20px, linear-gradient(top, #ffffff 85%,#eeeeee 99%); + background: #fff url('chosen-sprite.png') no-repeat -38px -22px; + background: url('chosen-sprite.png') no-repeat -38px -22px, -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff)); + background: url('chosen-sprite.png') no-repeat -38px -22px, -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%); + background: url('chosen-sprite.png') no-repeat -38px -22px, -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%); + background: url('chosen-sprite.png') no-repeat -38px -22px, -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%); + background: url('chosen-sprite.png') no-repeat -38px -22px, -ms-linear-gradient(top, #eeeeee 1%, #ffffff 15%); + background: url('chosen-sprite.png') no-repeat -38px -22px, linear-gradient(top, #eeeeee 1%, #ffffff 15%); padding: 4px 5px 4px 20px; + direction: rtl; } -/* @end */ \ No newline at end of file +/* @end */ diff --git a/3rdparty/css/chosen/chosen.css b/3rdparty/css/chosen/chosen.css old mode 100644 new mode 100755 index b9c6d88028..89b5970e57 --- a/3rdparty/css/chosen/chosen.css +++ b/3rdparty/css/chosen/chosen.css @@ -23,31 +23,37 @@ /* @group Single Chosen */ .chzn-container-single .chzn-single { - background-color: #fff; - background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eeeeee), color-stop(0.5, white)); - background-image: -webkit-linear-gradient(center bottom, #eeeeee 0%, white 50%); - background-image: -moz-linear-gradient(center bottom, #eeeeee 0%, white 50%); - background-image: -o-linear-gradient(top, #eeeeee 0%,#ffffff 50%); - background-image: -ms-linear-gradient(top, #eeeeee 0%,#ffffff 50%); - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#ffffff',GradientType=0 ); - background-image: linear-gradient(top, #eeeeee 0%,#ffffff 50%); - -webkit-border-radius: 4px; - -moz-border-radius : 4px; - border-radius : 4px; + background-color: #ffffff; + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0 ); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4)); + background-image: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); + background-image: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); + background-image: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); + background-image: -ms-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); + background-image: linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); + -webkit-border-radius: 5px; + -moz-border-radius : 5px; + border-radius : 5px; -moz-background-clip : padding; -webkit-background-clip: padding-box; background-clip : padding-box; - border: 1px solid #aaa; + border: 1px solid #aaaaaa; + -webkit-box-shadow: 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1); + -moz-box-shadow : 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1); + box-shadow : 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1); display: block; overflow: hidden; white-space: nowrap; position: relative; - height: 26px; - line-height: 26px; + height: 23px; + line-height: 24px; padding: 0 0 0 8px; - color: #444; + color: #444444; text-decoration: none; } +.chzn-container-single .chzn-default { + color: #999; +} .chzn-container-single .chzn-single span { margin-right: 26px; display: block; @@ -61,7 +67,7 @@ display: block; position: absolute; right: 26px; - top: 8px; + top: 6px; width: 12px; height: 13px; font-size: 1px; @@ -71,21 +77,6 @@ background-position: right -11px; } .chzn-container-single .chzn-single div { - -webkit-border-radius: 0 4px 4px 0; - -moz-border-radius : 0 4px 4px 0; - border-radius : 0 4px 4px 0; - -moz-background-clip : padding; - -webkit-background-clip: padding-box; - background-clip : padding-box; - background: #ccc; - background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #ccc), color-stop(0.6, #eee)); - background-image: -webkit-linear-gradient(center bottom, #ccc 0%, #eee 60%); - background-image: -moz-linear-gradient(center bottom, #ccc 0%, #eee 60%); - background-image: -o-linear-gradient(bottom, #ccc 0%, #eee 60%); - background-image: -ms-linear-gradient(top, #cccccc 0%,#eeeeee 60%); - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cccccc', endColorstr='#eeeeee',GradientType=0 ); - background-image: linear-gradient(top, #cccccc 0%,#eeeeee 60%); - border-left: 1px solid #aaa; position: absolute; right: 0; top: 0; @@ -94,7 +85,7 @@ width: 18px; } .chzn-container-single .chzn-single div b { - background: url('chosen-sprite.png') no-repeat 0 1px; + background: url('chosen-sprite.png') no-repeat 0 0; display: block; width: 100%; height: 100%; @@ -104,16 +95,16 @@ position: relative; margin: 0; white-space: nowrap; + z-index: 1010; } .chzn-container-single .chzn-search input { background: #fff url('chosen-sprite.png') no-repeat 100% -22px; - background: url('chosen-sprite.png') no-repeat 100% -22px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee)); - background: url('chosen-sprite.png') no-repeat 100% -22px, -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%); - background: url('chosen-sprite.png') no-repeat 100% -22px, -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%); - background: url('chosen-sprite.png') no-repeat 100% -22px, -o-linear-gradient(bottom, white 85%, #eeeeee 99%); - background: url('chosen-sprite.png') no-repeat 100% -22px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%); - background: url('chosen-sprite.png') no-repeat 100% -22px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%); - background: url('chosen-sprite.png') no-repeat 100% -22px, linear-gradient(top, #ffffff 85%,#eeeeee 99%); + background: url('chosen-sprite.png') no-repeat 100% -22px, -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff)); + background: url('chosen-sprite.png') no-repeat 100% -22px, -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%); + background: url('chosen-sprite.png') no-repeat 100% -22px, -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%); + background: url('chosen-sprite.png') no-repeat 100% -22px, -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%); + background: url('chosen-sprite.png') no-repeat 100% -22px, -ms-linear-gradient(top, #eeeeee 1%, #ffffff 15%); + background: url('chosen-sprite.png') no-repeat 100% -22px, linear-gradient(top, #eeeeee 1%, #ffffff 15%); margin: 1px 0; padding: 4px 20px 4px 5px; outline: 0; @@ -139,13 +130,12 @@ /* @group Multi Chosen */ .chzn-container-multi .chzn-choices { background-color: #fff; - background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee)); - background-image: -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%); - background-image: -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%); - background-image: -o-linear-gradient(bottom, white 85%, #eeeeee 99%); - background-image: -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%); - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee',GradientType=0 ); - background-image: linear-gradient(top, #ffffff 85%,#eeeeee 99%); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff)); + background-image: -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%); + background-image: -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%); + background-image: -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%); + background-image: -ms-linear-gradient(top, #eeeeee 1%, #ffffff 15%); + background-image: linear-gradient(top, #eeeeee 1%, #ffffff 15%); border: 1px solid #aaa; margin: 0; padding: 0; @@ -168,6 +158,9 @@ color: #666; background: transparent !important; border: 0 !important; + font-family: sans-serif; + font-size: 100%; + height: 15px; padding: 5px; margin: 1px 0; outline: 0; @@ -187,21 +180,22 @@ -webkit-background-clip: padding-box; background-clip : padding-box; background-color: #e4e4e4; - background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #e4e4e4), color-stop(0.7, #eeeeee)); - background-image: -webkit-linear-gradient(center bottom, #e4e4e4 0%, #eeeeee 70%); - background-image: -moz-linear-gradient(center bottom, #e4e4e4 0%, #eeeeee 70%); - background-image: -o-linear-gradient(bottom, #e4e4e4 0%, #eeeeee 70%); - background-image: -ms-linear-gradient(top, #e4e4e4 0%,#eeeeee 70%); - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e4e4e4', endColorstr='#eeeeee',GradientType=0 ); - background-image: linear-gradient(top, #e4e4e4 0%,#eeeeee 70%); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f4f4', endColorstr='#eeeeee', GradientType=0 ); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee)); + background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: -ms-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + -webkit-box-shadow: 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05); + -moz-box-shadow : 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05); + box-shadow : 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05); color: #333; - border: 1px solid #b4b4b4; + border: 1px solid #aaaaaa; line-height: 13px; - padding: 3px 19px 3px 6px; + padding: 3px 20px 3px 5px; margin: 3px 0 3px 5px; position: relative; -} -.chzn-container-multi .chzn-choices .search-choice span { cursor: default; } .chzn-container-multi .chzn-choices .search-choice-focus { @@ -228,7 +222,7 @@ /* @group Results */ .chzn-container .chzn-results { margin: 0 4px 4px 0; - max-height: 190px; + max-height: 240px; padding: 0 0 0 4px; position: relative; overflow-x: hidden; @@ -240,8 +234,8 @@ } .chzn-container .chzn-results li { display: none; - line-height: 80%; - padding: 7px 7px 8px; + line-height: 15px; + padding: 5px 6px; margin: 0; list-style: none; } @@ -250,7 +244,14 @@ display: list-item; } .chzn-container .chzn-results .highlighted { - background: #3875d7; + background-color: #3875d7; + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3875d7', endColorstr='#2a62bc', GradientType=0 ); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc)); + background-image: -webkit-linear-gradient(top, #3875d7 20%, #2a62bc 90%); + background-image: -moz-linear-gradient(top, #3875d7 20%, #2a62bc 90%); + background-image: -o-linear-gradient(top, #3875d7 20%, #2a62bc 90%); + background-image: -ms-linear-gradient(top, #3875d7 20%, #2a62bc 90%); + background-image: linear-gradient(top, #3875d7 20%, #2a62bc 90%); color: #fff; } .chzn-container .chzn-results li em { @@ -270,11 +271,34 @@ font-weight: bold; } .chzn-container .chzn-results .group-option { - padding-left: 20px; + padding-left: 15px; } .chzn-container-multi .chzn-drop .result-selected { display: none; } +.chzn-container .chzn-results-scroll { + background: white; + margin: 0 4px; + position: absolute; + text-align: center; + width: 321px; /* This should by dynamic with js */ + z-index: 1; +} +.chzn-container .chzn-results-scroll span { + display: inline-block; + height: 17px; + text-indent: -5000px; + width: 9px; +} +.chzn-container .chzn-results-scroll-down { + bottom: 0; +} +.chzn-container .chzn-results-scroll-down span { + background: url('chosen-sprite.png') no-repeat -4px -3px; +} +.chzn-container .chzn-results-scroll-up span { + background: url('chosen-sprite.png') no-repeat -22px -3px; +} /* @end */ /* @group Active */ @@ -292,13 +316,13 @@ -o-box-shadow : 0 1px 0 #fff inset; box-shadow : 0 1px 0 #fff inset; background-color: #eee; - background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, white), color-stop(0.5, #eeeeee)); - background-image: -webkit-linear-gradient(center bottom, white 0%, #eeeeee 50%); - background-image: -moz-linear-gradient(center bottom, white 0%, #eeeeee 50%); - background-image: -o-linear-gradient(bottom, white 0%, #eeeeee 50%); - background-image: -ms-linear-gradient(top, #ffffff 0%,#eeeeee 50%); - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee',GradientType=0 ); - background-image: linear-gradient(top, #ffffff 0%,#eeeeee 50%); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0 ); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #eeeeee), color-stop(80%, #ffffff)); + background-image: -webkit-linear-gradient(top, #eeeeee 20%, #ffffff 80%); + background-image: -moz-linear-gradient(top, #eeeeee 20%, #ffffff 80%); + background-image: -o-linear-gradient(top, #eeeeee 20%, #ffffff 80%); + background-image: -ms-linear-gradient(top, #eeeeee 20%, #ffffff 80%); + background-image: linear-gradient(top, #eeeeee 20%, #ffffff 80%); -webkit-border-bottom-left-radius : 0; -webkit-border-bottom-right-radius: 0; -moz-border-radius-bottomleft : 0; @@ -338,31 +362,31 @@ } /* @group Right to Left */ -.chzn-rtl { direction:rtl;text-align: right; } -.chzn-rtl .chzn-single { padding-left: 0; padding-right: 8px; } -.chzn-rtl .chzn-single span { margin-left: 26px; margin-right: 0; } -.chzn-rtl .chzn-single div { - left: 0; right: auto; - border-left: none; border-right: 1px solid #aaaaaa; - -webkit-border-radius: 4px 0 0 4px; - -moz-border-radius : 4px 0 0 4px; - border-radius : 4px 0 0 4px; +.chzn-rtl { text-align: right; } +.chzn-rtl .chzn-single { padding: 0 8px 0 0; overflow: visible; } +.chzn-rtl .chzn-single span { margin-left: 26px; margin-right: 0; direction: rtl; } + +.chzn-rtl .chzn-single div { left: 3px; right: auto; } +.chzn-rtl .chzn-single abbr { + left: 26px; + right: auto; } +.chzn-rtl .chzn-choices .search-field input { direction: rtl; } .chzn-rtl .chzn-choices li { float: right; } -.chzn-rtl .chzn-choices .search-choice { padding: 3px 6px 3px 19px; margin: 3px 5px 3px 0; } -.chzn-rtl .chzn-choices .search-choice .search-choice-close { left: 5px; right: auto; background-position: right top;} -.chzn-rtl.chzn-container-single .chzn-results { margin-left: 4px; margin-right: 0; padding-left: 0; padding-right: 4px; } -.chzn-rtl .chzn-results .group-option { padding-left: 0; padding-right: 20px; } +.chzn-rtl .chzn-choices .search-choice { padding: 3px 5px 3px 19px; margin: 3px 5px 3px 0; } +.chzn-rtl .chzn-choices .search-choice .search-choice-close { left: 4px; right: auto; background-position: right top;} +.chzn-rtl.chzn-container-single .chzn-results { margin: 0 0 4px 4px; padding: 0 4px 0 0; } +.chzn-rtl .chzn-results .group-option { padding-left: 0; padding-right: 15px; } .chzn-rtl.chzn-container-active .chzn-single-with-drop div { border-right: none; } .chzn-rtl .chzn-search input { - background: url('chosen-sprite.png') no-repeat -38px -22px, #ffffff; - background: url('chosen-sprite.png') no-repeat -38px -22px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee)); - background: url('chosen-sprite.png') no-repeat -38px -22px, -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%); - background: url('chosen-sprite.png') no-repeat -38px -22px, -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%); - background: url('chosen-sprite.png') no-repeat -38px -22px, -o-linear-gradient(bottom, white 85%, #eeeeee 99%); - background: url('chosen-sprite.png') no-repeat -38px -22px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%); - background: url('chosen-sprite.png') no-repeat -38px -22px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%); - background: url('chosen-sprite.png') no-repeat -38px -22px, linear-gradient(top, #ffffff 85%,#eeeeee 99%); + background: #fff url('chosen-sprite.png') no-repeat -38px -22px; + background: url('chosen-sprite.png') no-repeat -38px -22px, -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff)); + background: url('chosen-sprite.png') no-repeat -38px -22px, -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%); + background: url('chosen-sprite.png') no-repeat -38px -22px, -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%); + background: url('chosen-sprite.png') no-repeat -38px -22px, -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%); + background: url('chosen-sprite.png') no-repeat -38px -22px, -ms-linear-gradient(top, #eeeeee 1%, #ffffff 15%); + background: url('chosen-sprite.png') no-repeat -38px -22px, linear-gradient(top, #eeeeee 1%, #ffffff 15%); padding: 4px 5px 4px 20px; + direction: rtl; } -/* @end */ \ No newline at end of file +/* @end */ diff --git a/3rdparty/fullcalendar/css/fullcalendar.css b/3rdparty/fullcalendar/css/fullcalendar.css index 04f118493a..1f02ba428e 100644 --- a/3rdparty/fullcalendar/css/fullcalendar.css +++ b/3rdparty/fullcalendar/css/fullcalendar.css @@ -1,11 +1,11 @@ /* - * FullCalendar v1.5.3 Stylesheet + * FullCalendar v1.5.4 Stylesheet * * Copyright (c) 2011 Adam Shaw * Dual licensed under the MIT and GPL licenses, located in * MIT-LICENSE.txt and GPL-LICENSE.txt respectively. * - * Date: Mon Feb 6 22:40:40 2012 -0800 + * Date: Tue Sep 4 23:38:33 2012 -0700 * */ diff --git a/3rdparty/fullcalendar/css/fullcalendar.print.css b/3rdparty/fullcalendar/css/fullcalendar.print.css index e11c181637..227b80e0bc 100644 --- a/3rdparty/fullcalendar/css/fullcalendar.print.css +++ b/3rdparty/fullcalendar/css/fullcalendar.print.css @@ -1,5 +1,5 @@ /* - * FullCalendar v1.5.3 Print Stylesheet + * FullCalendar v1.5.4 Print Stylesheet * * Include this stylesheet on your page to get a more printer-friendly calendar. * When including this stylesheet, use the media='print' attribute of the tag. @@ -9,7 +9,7 @@ * Dual licensed under the MIT and GPL licenses, located in * MIT-LICENSE.txt and GPL-LICENSE.txt respectively. * - * Date: Mon Feb 6 22:40:40 2012 -0800 + * Date: Tue Sep 4 23:38:33 2012 -0700 * */ diff --git a/3rdparty/fullcalendar/js/fullcalendar.js b/3rdparty/fullcalendar/js/fullcalendar.js index 314f8c8a1a..d59de77c84 100644 --- a/3rdparty/fullcalendar/js/fullcalendar.js +++ b/3rdparty/fullcalendar/js/fullcalendar.js @@ -1,6 +1,6 @@ /** * @preserve - * FullCalendar v1.5.3 + * FullCalendar v1.5.4 * http://arshaw.com/fullcalendar/ * * Use fullcalendar.css for basic styling. @@ -11,7 +11,7 @@ * Dual licensed under the MIT and GPL licenses, located in * MIT-LICENSE.txt and GPL-LICENSE.txt respectively. * - * Date: Mon Feb 6 22:40:40 2012 -0800 + * Date: Tue Sep 4 23:38:33 2012 -0700 * */ @@ -111,7 +111,7 @@ var rtlDefaults = { -var fc = $.fullCalendar = { version: "1.5.3" }; +var fc = $.fullCalendar = { version: "1.5.4" }; var fcViews = fc.views = {}; @@ -1658,7 +1658,7 @@ function sliceSegs(events, visEventEnds, start, end) { msLength: segEnd - segStart }); } - } + } return segs.sort(segCmp); } @@ -1742,29 +1742,26 @@ function setOuterHeight(element, height, includeMargins) { } -// TODO: curCSS has been deprecated (jQuery 1.4.3 - 10/16/2010) - - function hsides(element, includeMargins) { return hpadding(element) + hborders(element) + (includeMargins ? hmargins(element) : 0); } function hpadding(element) { - return (parseFloat($.curCSS(element[0], 'paddingLeft', true)) || 0) + - (parseFloat($.curCSS(element[0], 'paddingRight', true)) || 0); + return (parseFloat($.css(element[0], 'paddingLeft', true)) || 0) + + (parseFloat($.css(element[0], 'paddingRight', true)) || 0); } function hmargins(element) { - return (parseFloat($.curCSS(element[0], 'marginLeft', true)) || 0) + - (parseFloat($.curCSS(element[0], 'marginRight', true)) || 0); + return (parseFloat($.css(element[0], 'marginLeft', true)) || 0) + + (parseFloat($.css(element[0], 'marginRight', true)) || 0); } function hborders(element) { - return (parseFloat($.curCSS(element[0], 'borderLeftWidth', true)) || 0) + - (parseFloat($.curCSS(element[0], 'borderRightWidth', true)) || 0); + return (parseFloat($.css(element[0], 'borderLeftWidth', true)) || 0) + + (parseFloat($.css(element[0], 'borderRightWidth', true)) || 0); } @@ -1774,20 +1771,20 @@ function vsides(element, includeMargins) { function vpadding(element) { - return (parseFloat($.curCSS(element[0], 'paddingTop', true)) || 0) + - (parseFloat($.curCSS(element[0], 'paddingBottom', true)) || 0); + return (parseFloat($.css(element[0], 'paddingTop', true)) || 0) + + (parseFloat($.css(element[0], 'paddingBottom', true)) || 0); } function vmargins(element) { - return (parseFloat($.curCSS(element[0], 'marginTop', true)) || 0) + - (parseFloat($.curCSS(element[0], 'marginBottom', true)) || 0); + return (parseFloat($.css(element[0], 'marginTop', true)) || 0) + + (parseFloat($.css(element[0], 'marginBottom', true)) || 0); } function vborders(element) { - return (parseFloat($.curCSS(element[0], 'borderTopWidth', true)) || 0) + - (parseFloat($.curCSS(element[0], 'borderBottomWidth', true)) || 0); + return (parseFloat($.css(element[0], 'borderTopWidth', true)) || 0) + + (parseFloat($.css(element[0], 'borderBottomWidth', true)) || 0); } @@ -1956,7 +1953,6 @@ function firstDefined() { } - fcViews.month = MonthView; function MonthView(element, calendar) { @@ -4662,7 +4658,7 @@ function DayEventRenderer() { ""; } html += - "" + event.title + "" + + "" + htmlEscape(event.title) + "" + ""; if (seg.isEnd && isEventResizable(event)) { html += diff --git a/3rdparty/fullcalendar/js/fullcalendar.min.js b/3rdparty/fullcalendar/js/fullcalendar.min.js index df37bdfd80..da6c7c09fd 100644 --- a/3rdparty/fullcalendar/js/fullcalendar.min.js +++ b/3rdparty/fullcalendar/js/fullcalendar.min.js @@ -1,6 +1,6 @@ /* - FullCalendar v1.5.3 + FullCalendar v1.5.4 http://arshaw.com/fullcalendar/ Use fullcalendar.css for basic styling. @@ -11,7 +11,7 @@ Dual licensed under the MIT and GPL licenses, located in MIT-LICENSE.txt and GPL-LICENSE.txt respectively. - Date: Mon Feb 6 22:40:40 2012 -0800 + Date: Tue Sep 4 23:38:33 2012 -0700 */ (function(m,ma){function wb(a){m.extend(true,Ya,a)}function Yb(a,b,e){function d(k){if(E){u();q();na();S(k)}else f()}function f(){B=b.theme?"ui":"fc";a.addClass("fc");b.isRTL&&a.addClass("fc-rtl");b.theme&&a.addClass("ui-widget");E=m("
").prependTo(a);C=new Zb(X,b);(P=C.render())&&a.prepend(P);y(b.defaultView);m(window).resize(oa);t()||g()}function g(){setTimeout(function(){!n.start&&t()&&S()},0)}function l(){m(window).unbind("resize",oa);C.destroy(); @@ -39,10 +39,10 @@ a[12])*1E3);lb(e,b)}else{e.setUTCFullYear(a[1],a[3]?a[3]-1:0,a[5]||1);e.setUTCHo 10):0)}}function Oa(a,b,e){return ib(a,null,b,e)}function ib(a,b,e,d){d=d||Ya;var f=a,g=b,l,j=e.length,t,y,S,Q="";for(l=0;ll;y--)if(S=dc[e.substring(l,y)]){if(f)Q+=S(f,d);l=y-1;break}if(y==l)if(f)Q+=t}}return Q}function Ua(a){return a.end?ec(a.end,a.allDay):ba(N(a.start),1)}function ec(a,b){a=N(a);return b||a.getHours()||a.getMinutes()?ba(a,1):Ka(a)}function fc(a,b){return(b.msLength-a.msLength)*100+(a.event.start-b.event.start)}function Cb(a,b){return a.end>b.start&&a.starte&&td){y=N(d);Q=false}else{y=y;Q=true}f.push({event:j,start:t,end:y,isStart:S,isEnd:Q,msLength:y-t})}}return f.sort(fc)}function ob(a){var b=[],e,d=a.length,f,g,l,j;for(e=0;e=0;e--){d=a[b[e].toLowerCase()];if(d!== -ma)return d}return a[""]}function Qa(a){return a.replace(/&/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""").replace(/\n/g,"
")}function Ib(a){return a.id+"/"+a.className+"/"+a.style.cssText.replace(/(^|;)\s*(top|left|width|height)\s*:[^;]*/ig,"")}function qb(a){a.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})}function ab(a){a.children().removeClass("fc-first fc-last").filter(":first-child").addClass("fc-first").end().filter(":last-child").addClass("fc-last")} +g._fci)!==ma){g._fci=ma;g=b[f];e(g.event,g.element,g);m(d.target).trigger(d)}d.stopPropagation()})}function Va(a,b,e){for(var d=0,f;d=0;e--){d=a[b[e].toLowerCase()];if(d!==ma)return d}return a[""]}function Qa(a){return a.replace(/&/g, +"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""").replace(/\n/g,"
")}function Ib(a){return a.id+"/"+a.className+"/"+a.style.cssText.replace(/(^|;)\s*(top|left|width|height)\s*:[^;]*/ig,"")}function qb(a){a.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})}function ab(a){a.children().removeClass("fc-first fc-last").filter(":first-child").addClass("fc-first").end().filter(":last-child").addClass("fc-last")} function rb(a,b){a.each(function(e,d){d.className=d.className.replace(/^fc-\w*/,"fc-"+lc[b.getDay()])})}function Jb(a,b){var e=a.source||{},d=a.color,f=e.color,g=b("eventColor"),l=a.backgroundColor||d||e.backgroundColor||f||b("eventBackgroundColor")||g;d=a.borderColor||d||e.borderColor||f||b("eventBorderColor")||g;a=a.textColor||e.textColor||b("eventTextColor");b=[];l&&b.push("background-color:"+l);d&&b.push("border-color:"+d);a&&b.push("color:"+a);return b.join(";")}function $a(a,b,e){if(m.isFunction(a))a= [a];if(a){var d,f;for(d=0;d=e[t][0]&&g' + option.html + ''; + } else { + return ""; + } + }; + + AbstractChosen.prototype.results_update_field = function() { + this.result_clear_highlight(); + this.result_single_selected = null; + return this.results_build(); + }; + + AbstractChosen.prototype.results_toggle = function() { + if (this.results_showing) { + return this.results_hide(); + } else { + return this.results_show(); + } + }; + + AbstractChosen.prototype.results_search = function(evt) { + if (this.results_showing) { + return this.winnow_results(); + } else { + return this.results_show(); + } + }; + + AbstractChosen.prototype.keyup_checker = function(evt) { + var stroke, _ref; + stroke = (_ref = evt.which) != null ? _ref : evt.keyCode; + this.search_field_scale(); + switch (stroke) { + case 8: + if (this.is_multiple && this.backstroke_length < 1 && this.choices > 0) { + return this.keydown_backstroke(); + } else if (!this.pending_backstroke) { + this.result_clear_highlight(); + return this.results_search(); + } + break; + case 13: + evt.preventDefault(); + if (this.results_showing) return this.result_select(evt); + break; + case 27: + if (this.results_showing) this.results_hide(); + return true; + case 9: + case 38: + case 40: + case 16: + case 91: + case 17: + break; + default: + return this.results_search(); + } + }; + + AbstractChosen.prototype.generate_field_id = function() { + var new_id; + new_id = this.generate_random_id(); + this.form_field.id = new_id; + return new_id; + }; + + AbstractChosen.prototype.generate_random_char = function() { + var chars, newchar, rand; + chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ"; + rand = Math.floor(Math.random() * chars.length); + return newchar = chars.substring(rand, rand + 1); + }; + + return AbstractChosen; + + })(); + + root.AbstractChosen = AbstractChosen; + +}).call(this); + +/* +Chosen source: generate output using 'cake build' +Copyright (c) 2011 by Harvest +*/ + +(function() { + var $, Chosen, get_side_border_padding, root, + __hasProp = Object.prototype.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }; + + root = this; + + $ = jQuery; + + $.fn.extend({ + chosen: function(options) { + if ($.browser.msie && ($.browser.version === "6.0" || $.browser.version === "7.0")) { + return this; + } + return $(this).each(function(input_field) { + if (!($(this)).hasClass("chzn-done")) return new Chosen(this, options); + }); + } + }); + + Chosen = (function(_super) { + + __extends(Chosen, _super); + + function Chosen() { + Chosen.__super__.constructor.apply(this, arguments); + } + + Chosen.prototype.setup = function() { + this.form_field_jq = $(this.form_field); + return this.is_rtl = this.form_field_jq.hasClass("chzn-rtl"); + }; + + Chosen.prototype.finish_setup = function() { + return this.form_field_jq.addClass("chzn-done"); + }; + Chosen.prototype.set_up_html = function() { var container_div, dd_top, dd_width, sf_width; this.container_id = this.form_field.id.length ? this.form_field.id.replace(/(:|\.)/g, '_') : this.generate_field_id(); @@ -71,14 +308,11 @@ if (this.is_multiple) { container_div.html('
    '); } else { - container_div.html('' + this.default_text + '
      '); + container_div.html('' + this.default_text + '
        '); } this.form_field_jq.hide().after(container_div); this.container = $('#' + this.container_id); this.container.addClass("chzn-container-" + (this.is_multiple ? "multi" : "single")); - if (!this.is_multiple && this.form_field.options.length <= this.disable_search_threshold) { - this.container.addClass("chzn-container-single-nosearch"); - } this.dropdown = this.container.find('div.chzn-drop').first(); dd_top = this.container.height(); dd_width = this.f_width - get_side_border_padding(this.dropdown); @@ -102,83 +336,92 @@ }); } this.results_build(); - return this.set_tab_index(); + this.set_tab_index(); + return this.form_field_jq.trigger("liszt:ready", { + chosen: this + }); }; + Chosen.prototype.register_observers = function() { - this.container.mousedown(__bind(function(evt) { - return this.container_mousedown(evt); - }, this)); - this.container.mouseup(__bind(function(evt) { - return this.container_mouseup(evt); - }, this)); - this.container.mouseenter(__bind(function(evt) { - return this.mouse_enter(evt); - }, this)); - this.container.mouseleave(__bind(function(evt) { - return this.mouse_leave(evt); - }, this)); - this.search_results.mouseup(__bind(function(evt) { - return this.search_results_mouseup(evt); - }, this)); - this.search_results.mouseover(__bind(function(evt) { - return this.search_results_mouseover(evt); - }, this)); - this.search_results.mouseout(__bind(function(evt) { - return this.search_results_mouseout(evt); - }, this)); - this.form_field_jq.bind("liszt:updated", __bind(function(evt) { - return this.results_update_field(evt); - }, this)); - this.search_field.blur(__bind(function(evt) { - return this.input_blur(evt); - }, this)); - this.search_field.keyup(__bind(function(evt) { - return this.keyup_checker(evt); - }, this)); - this.search_field.keydown(__bind(function(evt) { - return this.keydown_checker(evt); - }, this)); + var _this = this; + this.container.mousedown(function(evt) { + return _this.container_mousedown(evt); + }); + this.container.mouseup(function(evt) { + return _this.container_mouseup(evt); + }); + this.container.mouseenter(function(evt) { + return _this.mouse_enter(evt); + }); + this.container.mouseleave(function(evt) { + return _this.mouse_leave(evt); + }); + this.search_results.mouseup(function(evt) { + return _this.search_results_mouseup(evt); + }); + this.search_results.mouseover(function(evt) { + return _this.search_results_mouseover(evt); + }); + this.search_results.mouseout(function(evt) { + return _this.search_results_mouseout(evt); + }); + this.form_field_jq.bind("liszt:updated", function(evt) { + return _this.results_update_field(evt); + }); + this.search_field.blur(function(evt) { + return _this.input_blur(evt); + }); + this.search_field.keyup(function(evt) { + return _this.keyup_checker(evt); + }); + this.search_field.keydown(function(evt) { + return _this.keydown_checker(evt); + }); if (this.is_multiple) { - this.search_choices.click(__bind(function(evt) { - return this.choices_click(evt); - }, this)); - return this.search_field.focus(__bind(function(evt) { - return this.input_focus(evt); - }, this)); + this.search_choices.click(function(evt) { + return _this.choices_click(evt); + }); + return this.search_field.focus(function(evt) { + return _this.input_focus(evt); + }); + } else { + return this.container.click(function(evt) { + return evt.preventDefault(); + }); } }; + Chosen.prototype.search_field_disabled = function() { - this.is_disabled = this.form_field_jq.attr('disabled'); + this.is_disabled = this.form_field_jq[0].disabled; if (this.is_disabled) { this.container.addClass('chzn-disabled'); - this.search_field.attr('disabled', true); + this.search_field[0].disabled = true; if (!this.is_multiple) { this.selected_item.unbind("focus", this.activate_action); } return this.close_field(); } else { this.container.removeClass('chzn-disabled'); - this.search_field.attr('disabled', false); + this.search_field[0].disabled = false; if (!this.is_multiple) { return this.selected_item.bind("focus", this.activate_action); } } }; + Chosen.prototype.container_mousedown = function(evt) { var target_closelink; if (!this.is_disabled) { target_closelink = evt != null ? ($(evt.target)).hasClass("search-choice-close") : false; - if (evt && evt.type === "mousedown") { + if (evt && evt.type === "mousedown" && !this.results_showing) { evt.stopPropagation(); } if (!this.pending_destroy_click && !target_closelink) { if (!this.active_field) { - if (this.is_multiple) { - this.search_field.val(""); - } + if (this.is_multiple) this.search_field.val(""); $(document).click(this.click_test_action); this.results_show(); - } else if (!this.is_multiple && evt && ($(evt.target) === this.selected_item || $(evt.target).parents("a.chzn-single").length)) { + } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chzn-single").length)) { evt.preventDefault(); this.results_toggle(); } @@ -188,37 +431,17 @@ } } }; + Chosen.prototype.container_mouseup = function(evt) { - if (evt.target.nodeName === "ABBR") { - return this.results_reset(evt); - } - }; - Chosen.prototype.mouse_enter = function() { - return this.mouse_on_container = true; - }; - Chosen.prototype.mouse_leave = function() { - return this.mouse_on_container = false; - }; - Chosen.prototype.input_focus = function(evt) { - if (!this.active_field) { - return setTimeout((__bind(function() { - return this.container_mousedown(); - }, this)), 50); - } - }; - Chosen.prototype.input_blur = function(evt) { - if (!this.mouse_on_container) { - this.active_field = false; - return setTimeout((__bind(function() { - return this.blur_test(); - }, this)), 100); - } + if (evt.target.nodeName === "ABBR") return this.results_reset(evt); }; + Chosen.prototype.blur_test = function(evt) { if (!this.active_field && this.container.hasClass("chzn-container-active")) { return this.close_field(); } }; + Chosen.prototype.close_field = function() { $(document).unbind("click", this.click_test_action); if (!this.is_multiple) { @@ -233,6 +456,7 @@ this.show_search_field_default(); return this.search_field_scale(); }; + Chosen.prototype.activate_field = function() { if (!this.is_multiple && !this.active_field) { this.search_field.attr("tabindex", this.selected_item.attr("tabindex")); @@ -243,6 +467,7 @@ this.search_field.val(this.search_field.val()); return this.search_field.focus(); }; + Chosen.prototype.test_active_click = function(evt) { if ($(evt.target).parents('#' + this.container_id).length) { return this.active_field = true; @@ -250,9 +475,9 @@ return this.close_field(); } }; + Chosen.prototype.results_build = function() { - var content, data, startTime, _i, _len, _ref; - startTime = new Date(); + var content, data, _i, _len, _ref; this.parsing = true; this.results_data = root.SelectParser.select_to_array(this.form_field); if (this.is_multiple && this.choices > 0) { @@ -260,6 +485,11 @@ this.choices = 0; } else if (!this.is_multiple) { this.selected_item.find("span").text(this.default_text); + if (this.form_field.options.length <= this.disable_search_threshold) { + this.container.addClass("chzn-container-single-nosearch"); + } else { + this.container.removeClass("chzn-container-single-nosearch"); + } } content = ''; _ref = this.results_data; @@ -272,10 +502,8 @@ if (data.selected && this.is_multiple) { this.choice_build(data); } else if (data.selected && !this.is_multiple) { - this.selected_item.find("span").text(data.text); - if (this.allow_single_deselect) { - this.selected_item.find("span").first().after(""); - } + this.selected_item.removeClass("chzn-default").find("span").text(data.text); + if (this.allow_single_deselect) this.single_deselect_control_build(); } } } @@ -285,6 +513,7 @@ this.search_results.html(content); return this.parsing = false; }; + Chosen.prototype.result_add_group = function(group) { if (!group.disabled) { group.dom_id = this.container_id + "_g_" + group.array_index; @@ -293,31 +522,7 @@ return ""; } }; - Chosen.prototype.result_add_option = function(option) { - var classes, style; - if (!option.disabled) { - option.dom_id = this.container_id + "_o_" + option.array_index; - classes = option.selected && this.is_multiple ? [] : ["active-result"]; - if (option.selected) { - classes.push("result-selected"); - } - if (option.group_array_index != null) { - classes.push("group-option"); - } - if (option.classes !== "") { - classes.push(option.classes); - } - style = option.style.cssText !== "" ? " style=\"" + option.style + "\"" : ""; - return '
      • ' + option.html + '
      • '; - } else { - return ""; - } - }; - Chosen.prototype.results_update_field = function() { - this.result_clear_highlight(); - this.result_single_selected = null; - return this.results_build(); - }; + Chosen.prototype.result_do_highlight = function(el) { var high_bottom, high_top, maxHeight, visible_bottom, visible_top; if (el.length) { @@ -336,19 +541,12 @@ } } }; + Chosen.prototype.result_clear_highlight = function() { - if (this.result_highlight) { - this.result_highlight.removeClass("highlighted"); - } + if (this.result_highlight) this.result_highlight.removeClass("highlighted"); return this.result_highlight = null; }; - Chosen.prototype.results_toggle = function() { - if (this.results_showing) { - return this.results_hide(); - } else { - return this.results_show(); - } - }; + Chosen.prototype.results_show = function() { var dd_top; if (!this.is_multiple) { @@ -367,6 +565,7 @@ this.search_field.val(this.search_field.val()); return this.winnow_results(); }; + Chosen.prototype.results_hide = function() { if (!this.is_multiple) { this.selected_item.removeClass("chzn-single-with-drop"); @@ -377,6 +576,7 @@ }); return this.results_showing = false; }; + Chosen.prototype.set_tab_index = function(el) { var ti; if (this.form_field_jq.attr("tabindex")) { @@ -390,6 +590,7 @@ } } }; + Chosen.prototype.show_search_field_default = function() { if (this.is_multiple && this.choices < 1 && !this.active_field) { this.search_field.val(this.default_text); @@ -399,6 +600,7 @@ return this.search_field.removeClass("default"); } }; + Chosen.prototype.search_results_mouseup = function(evt) { var target; target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first(); @@ -407,34 +609,38 @@ return this.result_select(evt); } }; + Chosen.prototype.search_results_mouseover = function(evt) { var target; target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first(); - if (target) { - return this.result_do_highlight(target); - } + if (target) return this.result_do_highlight(target); }; + Chosen.prototype.search_results_mouseout = function(evt) { if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) { return this.result_clear_highlight(); } }; + Chosen.prototype.choices_click = function(evt) { evt.preventDefault(); if (this.active_field && !($(evt.target).hasClass("search-choice" || $(evt.target).parents('.search-choice').first)) && !this.results_showing) { return this.results_show(); } }; + Chosen.prototype.choice_build = function(item) { - var choice_id, link; + var choice_id, link, + _this = this; choice_id = this.container_id + "_c_" + item.array_index; this.choices += 1; this.search_container.before('
      • ' + item.html + '
      • '); link = $('#' + choice_id).find("a").first(); - return link.click(__bind(function(evt) { - return this.choice_destroy_link_click(evt); - }, this)); + return link.click(function(evt) { + return _this.choice_destroy_link_click(evt); + }); }; + Chosen.prototype.choice_destroy_link_click = function(evt) { evt.preventDefault(); if (!this.is_disabled) { @@ -444,6 +650,7 @@ return evt.stopPropagation; } }; + Chosen.prototype.choice_destroy = function(link) { this.choices -= 1; this.show_search_field_default(); @@ -453,16 +660,17 @@ this.result_deselect(link.attr("rel")); return link.parents('li').first().remove(); }; + Chosen.prototype.results_reset = function(evt) { this.form_field.options[0].selected = true; this.selected_item.find("span").text(this.default_text); + if (!this.is_multiple) this.selected_item.addClass("chzn-default"); this.show_search_field_default(); $(evt.target).remove(); this.form_field_jq.trigger("change"); - if (this.active_field) { - return this.results_hide(); - } + if (this.active_field) return this.results_hide(); }; + Chosen.prototype.result_select = function(evt) { var high, high_id, item, position; if (this.result_highlight) { @@ -474,6 +682,7 @@ } else { this.search_results.find(".result-selected").removeClass("result-selected"); this.result_single_selected = high; + this.selected_item.removeClass("chzn-default"); } high.addClass("result-selected"); position = high_id.substr(high_id.lastIndexOf("_") + 1); @@ -484,24 +693,23 @@ this.choice_build(item); } else { this.selected_item.find("span").first().text(item.text); - if (this.allow_single_deselect) { - this.selected_item.find("span").first().after(""); - } - } - if (!(evt.metaKey && this.is_multiple)) { - this.results_hide(); + if (this.allow_single_deselect) this.single_deselect_control_build(); } + if (!(evt.metaKey && this.is_multiple)) this.results_hide(); this.search_field.val(""); this.form_field_jq.trigger("change"); return this.search_field_scale(); } }; + Chosen.prototype.result_activate = function(el) { return el.addClass("active-result"); }; + Chosen.prototype.result_deactivate = function(el) { return el.removeClass("active-result"); }; + Chosen.prototype.result_deselect = function(pos) { var result, result_data; result_data = this.results_data[pos]; @@ -514,30 +722,31 @@ this.form_field_jq.trigger("change"); return this.search_field_scale(); }; - Chosen.prototype.results_search = function(evt) { - if (this.results_showing) { - return this.winnow_results(); - } else { - return this.results_show(); + + Chosen.prototype.single_deselect_control_build = function() { + if (this.allow_single_deselect && this.selected_item.find("abbr").length < 1) { + return this.selected_item.find("span").first().after(""); } }; + Chosen.prototype.winnow_results = function() { - var found, option, part, parts, regex, result_id, results, searchText, startTime, startpos, text, zregex, _i, _j, _len, _len2, _ref; - startTime = new Date(); + var found, option, part, parts, regex, regexAnchor, result, result_id, results, searchText, startpos, text, zregex, _i, _j, _len, _len2, _ref; this.no_results_clear(); results = 0; searchText = this.search_field.val() === this.default_text ? "" : $('
        ').text($.trim(this.search_field.val())).html(); - regex = new RegExp('^' + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i'); + regexAnchor = this.search_contains ? "" : "^"; + regex = new RegExp(regexAnchor + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i'); zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i'); _ref = this.results_data; for (_i = 0, _len = _ref.length; _i < _len; _i++) { option = _ref[_i]; if (!option.disabled && !option.empty) { if (option.group) { - $('#' + option.dom_id).hide(); + $('#' + option.dom_id).css('display', 'none'); } else if (!(this.is_multiple && option.selected)) { found = false; result_id = option.dom_id; + result = $("#" + result_id); if (regex.test(option.html)) { found = true; results += 1; @@ -561,18 +770,16 @@ } else { text = option.html; } - if ($("#" + result_id).html !== text) { - $("#" + result_id).html(text); - } - this.result_activate($("#" + result_id)); + result.html(text); + this.result_activate(result); if (option.group_array_index != null) { - $("#" + this.results_data[option.group_array_index].dom_id).show(); + $("#" + this.results_data[option.group_array_index].dom_id).css('display', 'list-item'); } } else { if (this.result_highlight && result_id === this.result_highlight.attr('id')) { this.result_clear_highlight(); } - this.result_deactivate($("#" + result_id)); + this.result_deactivate(result); } } } @@ -583,6 +790,7 @@ return this.winnow_results_set_highlight(); } }; + Chosen.prototype.winnow_results_clear = function() { var li, lis, _i, _len, _results; this.search_field.val(""); @@ -591,46 +799,49 @@ for (_i = 0, _len = lis.length; _i < _len; _i++) { li = lis[_i]; li = $(li); - _results.push(li.hasClass("group-result") ? li.show() : !this.is_multiple || !li.hasClass("result-selected") ? this.result_activate(li) : void 0); + if (li.hasClass("group-result")) { + _results.push(li.css('display', 'auto')); + } else if (!this.is_multiple || !li.hasClass("result-selected")) { + _results.push(this.result_activate(li)); + } else { + _results.push(void 0); + } } return _results; }; + Chosen.prototype.winnow_results_set_highlight = function() { var do_high, selected_results; if (!this.result_highlight) { selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : []; do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first(); - if (do_high != null) { - return this.result_do_highlight(do_high); - } + if (do_high != null) return this.result_do_highlight(do_high); } }; + Chosen.prototype.no_results = function(terms) { var no_results_html; no_results_html = $('
      • ' + this.results_none_found + ' ""
      • '); no_results_html.find("span").first().html(terms); return this.search_results.append(no_results_html); }; + Chosen.prototype.no_results_clear = function() { return this.search_results.find(".no-results").remove(); }; + Chosen.prototype.keydown_arrow = function() { var first_active, next_sib; if (!this.result_highlight) { first_active = this.search_results.find("li.active-result").first(); - if (first_active) { - this.result_do_highlight($(first_active)); - } + if (first_active) this.result_do_highlight($(first_active)); } else if (this.results_showing) { next_sib = this.result_highlight.nextAll("li.active-result").first(); - if (next_sib) { - this.result_do_highlight(next_sib); - } - } - if (!this.results_showing) { - return this.results_show(); + if (next_sib) this.result_do_highlight(next_sib); } + if (!this.results_showing) return this.results_show(); }; + Chosen.prototype.keyup_arrow = function() { var prev_sibs; if (!this.results_showing && !this.is_multiple) { @@ -640,13 +851,12 @@ if (prev_sibs.length) { return this.result_do_highlight(prev_sibs.first()); } else { - if (this.choices > 0) { - this.results_hide(); - } + if (this.choices > 0) this.results_hide(); return this.result_clear_highlight(); } } }; + Chosen.prototype.keydown_backstroke = function() { if (this.pending_backstroke) { this.choice_destroy(this.pending_backstroke.find("a").first()); @@ -656,59 +866,25 @@ return this.pending_backstroke.addClass("search-choice-focus"); } }; + Chosen.prototype.clear_backstroke = function() { if (this.pending_backstroke) { this.pending_backstroke.removeClass("search-choice-focus"); } return this.pending_backstroke = null; }; - Chosen.prototype.keyup_checker = function(evt) { - var stroke, _ref; - stroke = (_ref = evt.which) != null ? _ref : evt.keyCode; - this.search_field_scale(); - switch (stroke) { - case 8: - if (this.is_multiple && this.backstroke_length < 1 && this.choices > 0) { - return this.keydown_backstroke(); - } else if (!this.pending_backstroke) { - this.result_clear_highlight(); - return this.results_search(); - } - break; - case 13: - evt.preventDefault(); - if (this.results_showing) { - return this.result_select(evt); - } - break; - case 27: - if (this.results_showing) { - return this.results_hide(); - } - break; - case 9: - case 38: - case 40: - case 16: - case 91: - case 17: - break; - default: - return this.results_search(); - } - }; + Chosen.prototype.keydown_checker = function(evt) { var stroke, _ref; stroke = (_ref = evt.which) != null ? _ref : evt.keyCode; this.search_field_scale(); - if (stroke !== 8 && this.pending_backstroke) { - this.clear_backstroke(); - } + if (stroke !== 8 && this.pending_backstroke) this.clear_backstroke(); switch (stroke) { case 8: this.backstroke_length = this.search_field.val().length; break; case 9: + if (this.results_showing && !this.is_multiple) this.result_select(evt); this.mouse_on_container = false; break; case 13: @@ -723,6 +899,7 @@ break; } }; + Chosen.prototype.search_field_scale = function() { var dd_top, div, h, style, style_block, styles, w, _i, _len; if (this.is_multiple) { @@ -741,9 +918,7 @@ $('body').append(div); w = div.width() + 25; div.remove(); - if (w > this.f_width - 10) { - w = this.f_width - 10; - } + if (w > this.f_width - 10) w = this.f_width - 10; this.search_field.css({ 'width': w + 'px' }); @@ -753,12 +928,7 @@ }); } }; - Chosen.prototype.generate_field_id = function() { - var new_id; - new_id = this.generate_random_id(); - this.form_field.id = new_id; - return new_id; - }; + Chosen.prototype.generate_random_id = function() { var string; string = "sel" + this.generate_random_char() + this.generate_random_char() + this.generate_random_char(); @@ -767,91 +937,16 @@ } return string; }; - Chosen.prototype.generate_random_char = function() { - var chars, newchar, rand; - chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ"; - rand = Math.floor(Math.random() * chars.length); - return newchar = chars.substring(rand, rand + 1); - }; + return Chosen; - })(); + + })(AbstractChosen); + get_side_border_padding = function(elmt) { var side_border_padding; return side_border_padding = elmt.outerWidth() - elmt.width(); }; + root.get_side_border_padding = get_side_border_padding; -}).call(this); -(function() { - var SelectParser; - SelectParser = (function() { - function SelectParser() { - this.options_index = 0; - this.parsed = []; - } - SelectParser.prototype.add_node = function(child) { - if (child.nodeName === "OPTGROUP") { - return this.add_group(child); - } else { - return this.add_option(child); - } - }; - SelectParser.prototype.add_group = function(group) { - var group_position, option, _i, _len, _ref, _results; - group_position = this.parsed.length; - this.parsed.push({ - array_index: group_position, - group: true, - label: group.label, - children: 0, - disabled: group.disabled - }); - _ref = group.childNodes; - _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - option = _ref[_i]; - _results.push(this.add_option(option, group_position, group.disabled)); - } - return _results; - }; - SelectParser.prototype.add_option = function(option, group_position, group_disabled) { - if (option.nodeName === "OPTION") { - if (option.text !== "") { - if (group_position != null) { - this.parsed[group_position].children += 1; - } - this.parsed.push({ - array_index: this.parsed.length, - options_index: this.options_index, - value: option.value, - text: option.text, - html: option.innerHTML, - selected: option.selected, - disabled: group_disabled === true ? group_disabled : option.disabled, - group_array_index: group_position, - classes: option.className, - style: option.style.cssText - }); - } else { - this.parsed.push({ - array_index: this.parsed.length, - options_index: this.options_index, - empty: true - }); - } - return this.options_index += 1; - } - }; - return SelectParser; - })(); - SelectParser.select_to_array = function(select) { - var child, parser, _i, _len, _ref; - parser = new SelectParser(); - _ref = select.childNodes; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - child = _ref[_i]; - parser.add_node(child); - } - return parser.parsed; - }; - this.SelectParser = SelectParser; + }).call(this); diff --git a/3rdparty/js/chosen/chosen.jquery.min.js b/3rdparty/js/chosen/chosen.jquery.min.js old mode 100644 new mode 100755 index 371ee53e7a..9ba164cc47 --- a/3rdparty/js/chosen/chosen.jquery.min.js +++ b/3rdparty/js/chosen/chosen.jquery.min.js @@ -1,10 +1,10 @@ // Chosen, a Select Box Enhancer for jQuery and Protoype // by Patrick Filler for Harvest, http://getharvest.com // -// Version 0.9.5 +// Version 0.9.8 // Full source at https://github.com/harvesthq/chosen // Copyright (c) 2011 Harvest http://getharvest.com // MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md // This file is generated by `cake build`, do not edit it by hand. -(function(){var a,b,c,d,e=function(a,b){return function(){return a.apply(b,arguments)}};d=this,a=jQuery,a.fn.extend({chosen:function(c){return a.browser!=="msie"||a.browser.version!=="6.0"&&a.browser.version!=="7.0"?a(this).each(function(d){if(!a(this).hasClass("chzn-done"))return new b(this,c)}):this}}),b=function(){function b(b,c){this.form_field=b,this.options=c!=null?c:{},this.set_default_values(),this.form_field_jq=a(this.form_field),this.is_multiple=this.form_field.multiple,this.is_rtl=this.form_field_jq.hasClass("chzn-rtl"),this.default_text_default=this.form_field.multiple?"Select Some Options":"Select an Option",this.set_up_html(),this.register_observers(),this.form_field_jq.addClass("chzn-done")}b.prototype.set_default_values=function(){this.click_test_action=e(function(a){return this.test_active_click(a)},this),this.activate_action=e(function(a){return this.activate_field(a)},this),this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.result_single_selected=null,this.allow_single_deselect=this.options.allow_single_deselect!=null&&this.form_field.options[0].text===""?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.choices=0;return this.results_none_found=this.options.no_results_text||"No results match"},b.prototype.set_up_html=function(){var b,d,e,f;this.container_id=this.form_field.id.length?this.form_field.id.replace(/(:|\.)/g,"_"):this.generate_field_id(),this.container_id+="_chzn",this.f_width=this.form_field_jq.outerWidth(),this.default_text=this.form_field_jq.data("placeholder")?this.form_field_jq.data("placeholder"):this.default_text_default,b=a("
        ",{id:this.container_id,"class":"chzn-container"+(this.is_rtl?" chzn-rtl":""),style:"width: "+this.f_width+"px;"}),this.is_multiple?b.html('
          '):b.html(''+this.default_text+'
            '),this.form_field_jq.hide().after(b),this.container=a("#"+this.container_id),this.container.addClass("chzn-container-"+(this.is_multiple?"multi":"single")),!this.is_multiple&&this.form_field.options.length<=this.disable_search_threshold&&this.container.addClass("chzn-container-single-nosearch"),this.dropdown=this.container.find("div.chzn-drop").first(),d=this.container.height(),e=this.f_width-c(this.dropdown),this.dropdown.css({width:e+"px",top:d+"px"}),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chzn-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chzn-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chzn-search").first(),this.selected_item=this.container.find(".chzn-single").first(),f=e-c(this.search_container)-c(this.search_field),this.search_field.css({width:f+"px"})),this.results_build();return this.set_tab_index()},b.prototype.register_observers=function(){this.container.mousedown(e(function(a){return this.container_mousedown(a)},this)),this.container.mouseup(e(function(a){return this.container_mouseup(a)},this)),this.container.mouseenter(e(function(a){return this.mouse_enter(a)},this)),this.container.mouseleave(e(function(a){return this.mouse_leave(a)},this)),this.search_results.mouseup(e(function(a){return this.search_results_mouseup(a)},this)),this.search_results.mouseover(e(function(a){return this.search_results_mouseover(a)},this)),this.search_results.mouseout(e(function(a){return this.search_results_mouseout(a)},this)),this.form_field_jq.bind("liszt:updated",e(function(a){return this.results_update_field(a)},this)),this.search_field.blur(e(function(a){return this.input_blur(a)},this)),this.search_field.keyup(e(function(a){return this.keyup_checker(a)},this)),this.search_field.keydown(e(function(a){return this.keydown_checker(a)},this));if(this.is_multiple){this.search_choices.click(e(function(a){return this.choices_click(a)},this));return this.search_field.focus(e(function(a){return this.input_focus(a)},this))}},b.prototype.search_field_disabled=function(){this.is_disabled=this.form_field_jq.attr("disabled");if(this.is_disabled){this.container.addClass("chzn-disabled"),this.search_field.attr("disabled",!0),this.is_multiple||this.selected_item.unbind("focus",this.activate_action);return this.close_field()}this.container.removeClass("chzn-disabled"),this.search_field.attr("disabled",!1);if(!this.is_multiple)return this.selected_item.bind("focus",this.activate_action)},b.prototype.container_mousedown=function(b){var c;if(!this.is_disabled){c=b!=null?a(b.target).hasClass("search-choice-close"):!1,b&&b.type==="mousedown"&&b.stopPropagation();if(!this.pending_destroy_click&&!c){this.active_field?!this.is_multiple&&b&&(a(b.target)===this.selected_item||a(b.target).parents("a.chzn-single").length)&&(b.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),a(document).click(this.click_test_action),this.results_show());return this.activate_field()}return this.pending_destroy_click=!1}},b.prototype.container_mouseup=function(a){if(a.target.nodeName==="ABBR")return this.results_reset(a)},b.prototype.mouse_enter=function(){return this.mouse_on_container=!0},b.prototype.mouse_leave=function(){return this.mouse_on_container=!1},b.prototype.input_focus=function(a){if(!this.active_field)return setTimeout(e(function(){return this.container_mousedown()},this),50)},b.prototype.input_blur=function(a){if(!this.mouse_on_container){this.active_field=!1;return setTimeout(e(function(){return this.blur_test()},this),100)}},b.prototype.blur_test=function(a){if(!this.active_field&&this.container.hasClass("chzn-container-active"))return this.close_field()},b.prototype.close_field=function(){a(document).unbind("click",this.click_test_action),this.is_multiple||(this.selected_item.attr("tabindex",this.search_field.attr("tabindex")),this.search_field.attr("tabindex",-1)),this.active_field=!1,this.results_hide(),this.container.removeClass("chzn-container-active"),this.winnow_results_clear(),this.clear_backstroke(),this.show_search_field_default();return this.search_field_scale()},b.prototype.activate_field=function(){!this.is_multiple&&!this.active_field&&(this.search_field.attr("tabindex",this.selected_item.attr("tabindex")),this.selected_item.attr("tabindex",-1)),this.container.addClass("chzn-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val());return this.search_field.focus()},b.prototype.test_active_click=function(b){return a(b.target).parents("#"+this.container_id).length?this.active_field=!0:this.close_field()},b.prototype.results_build=function(){var a,b,c,e,f,g;c=new Date,this.parsing=!0,this.results_data=d.SelectParser.select_to_array(this.form_field),this.is_multiple&&this.choices>0?(this.search_choices.find("li.search-choice").remove(),this.choices=0):this.is_multiple||this.selected_item.find("span").text(this.default_text),a="",g=this.results_data;for(e=0,f=g.length;e')));this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.search_results.html(a);return this.parsing=!1},b.prototype.result_add_group=function(b){if(!b.disabled){b.dom_id=this.container_id+"_g_"+b.array_index;return'
          • '+a("
            ").text(b.label).html()+"
          • "}return""},b.prototype.result_add_option=function(a){var b,c;if(!a.disabled){a.dom_id=this.container_id+"_o_"+a.array_index,b=a.selected&&this.is_multiple?[]:["active-result"],a.selected&&b.push("result-selected"),a.group_array_index!=null&&b.push("group-option"),a.classes!==""&&b.push(a.classes),c=a.style.cssText!==""?' style="'+a.style+'"':"";return'
          • "+a.html+"
          • "}return""},b.prototype.results_update_field=function(){this.result_clear_highlight(),this.result_single_selected=null;return this.results_build()},b.prototype.result_do_highlight=function(a){var b,c,d,e,f;if(a.length){this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClass("highlighted"),d=parseInt(this.search_results.css("maxHeight"),10),f=this.search_results.scrollTop(),e=d+f,c=this.result_highlight.position().top+this.search_results.scrollTop(),b=c+this.result_highlight.outerHeight();if(b>=e)return this.search_results.scrollTop(b-d>0?b-d:0);if(c'+b.html+''),d=a("#"+c).find("a").first();return d.click(e(function(a){return this.choice_destroy_link_click(a)},this))},b.prototype.choice_destroy_link_click=function(b){b.preventDefault();if(!this.is_disabled){this.pending_destroy_click=!0;return this.choice_destroy(a(b.target))}return b.stopPropagation},b.prototype.choice_destroy=function(a){this.choices-=1,this.show_search_field_default(),this.is_multiple&&this.choices>0&&this.search_field.val().length<1&&this.results_hide(),this.result_deselect(a.attr("rel"));return a.parents("li").first().remove()},b.prototype.results_reset=function(b){this.form_field.options[0].selected=!0,this.selected_item.find("span").text(this.default_text),this.show_search_field_default(),a(b.target).remove(),this.form_field_jq.trigger("change");if(this.active_field)return this.results_hide()},b.prototype.result_select=function(a){var b,c,d,e;if(this.result_highlight){b=this.result_highlight,c=b.attr("id"),this.result_clear_highlight(),this.is_multiple?this.result_deactivate(b):(this.search_results.find(".result-selected").removeClass("result-selected"),this.result_single_selected=b),b.addClass("result-selected"),e=c.substr(c.lastIndexOf("_")+1),d=this.results_data[e],d.selected=!0,this.form_field.options[d.options_index].selected=!0,this.is_multiple?this.choice_build(d):(this.selected_item.find("span").first().text(d.text),this.allow_single_deselect&&this.selected_item.find("span").first().after('')),(!a.metaKey||!this.is_multiple)&&this.results_hide(),this.search_field.val(""),this.form_field_jq.trigger("change");return this.search_field_scale()}},b.prototype.result_activate=function(a){return a.addClass("active-result")},b.prototype.result_deactivate=function(a){return a.removeClass("active-result")},b.prototype.result_deselect=function(b){var c,d;d=this.results_data[b],d.selected=!1,this.form_field.options[d.options_index].selected=!1,c=a("#"+this.container_id+"_o_"+b),c.removeClass("result-selected").addClass("active-result").show(),this.result_clear_highlight(),this.winnow_results(),this.form_field_jq.trigger("change");return this.search_field_scale()},b.prototype.results_search=function(a){return this.results_showing?this.winnow_results():this.results_show()},b.prototype.winnow_results=function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;j=new Date,this.no_results_clear(),h=0,i=this.search_field.val()===this.default_text?"":a("
            ").text(a.trim(this.search_field.val())).html(),f=new RegExp("^"+i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),m=new RegExp(i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),r=this.results_data;for(n=0,p=r.length;n=0||c.html.indexOf("[")===0){e=c.html.replace(/\[|\]/g,"").split(" ");if(e.length)for(o=0,q=e.length;o"+c.html.substr(k+i.length),l=l.substr(0,k)+""+l.substr(k)):l=c.html,a("#"+g).html!==l&&a("#"+g).html(l),this.result_activate(a("#"+g)),c.group_array_index!=null&&a("#"+this.results_data[c.group_array_index].dom_id).show()):(this.result_highlight&&g===this.result_highlight.attr("id")&&this.result_clear_highlight(),this.result_deactivate(a("#"+g)))}}return h<1&&i.length?this.no_results(i):this.winnow_results_set_highlight()},b.prototype.winnow_results_clear=function(){var b,c,d,e,f;this.search_field.val(""),c=this.search_results.find("li"),f=[];for(d=0,e=c.length;d'+this.results_none_found+' ""'),c.find("span").first().html(b);return this.search_results.append(c)},b.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},b.prototype.keydown_arrow=function(){var b,c;this.result_highlight?this.results_showing&&(c=this.result_highlight.nextAll("li.active-result").first(),c&&this.result_do_highlight(c)):(b=this.search_results.find("li.active-result").first(),b&&this.result_do_highlight(a(b)));if(!this.results_showing)return this.results_show()},b.prototype.keyup_arrow=function(){var a;if(!this.results_showing&&!this.is_multiple)return this.results_show();if(this.result_highlight){a=this.result_highlight.prevAll("li.active-result");if(a.length)return this.result_do_highlight(a.first());this.choices>0&&this.results_hide();return this.result_clear_highlight()}},b.prototype.keydown_backstroke=function(){if(this.pending_backstroke){this.choice_destroy(this.pending_backstroke.find("a").first());return this.clear_backstroke()}this.pending_backstroke=this.search_container.siblings("li.search-choice").last();return this.pending_backstroke.addClass("search-choice-focus")},b.prototype.clear_backstroke=function(){this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus");return this.pending_backstroke=null},b.prototype.keyup_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale();switch(b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0)return this.keydown_backstroke();if(!this.pending_backstroke){this.result_clear_highlight();return this.results_search()}break;case 13:a.preventDefault();if(this.results_showing)return this.result_select(a);break;case 27:if(this.results_showing)return this.results_hide();break;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},b.prototype.keydown_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale(),b!==8&&this.pending_backstroke&&this.clear_backstroke();switch(b){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.mouse_on_container=!1;break;case 13:a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:this.keydown_arrow()}},b.prototype.search_field_scale=function(){var b,c,d,e,f,g,h,i,j;if(this.is_multiple){d=0,h=0,f="position:absolute; left: -1000px; top: -1000px; display:none;",g=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(i=0,j=g.length;i",{style:f}),c.text(this.search_field.val()),a("body").append(c),h=c.width()+25,c.remove(),h>this.f_width-10&&(h=this.f_width-10),this.search_field.css({width:h+"px"}),b=this.container.height();return this.dropdown.css({top:b+"px"})}},b.prototype.generate_field_id=function(){var a;a=this.generate_random_id(),this.form_field.id=a;return a},b.prototype.generate_random_id=function(){var b;b="sel"+this.generate_random_char()+this.generate_random_char()+this.generate_random_char();while(a("#"+b).length>0)b+=this.generate_random_char();return b},b.prototype.generate_random_char=function(){var a,b,c;a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ",c=Math.floor(Math.random()*a.length);return b=a.substring(c,c+1)};return b}(),c=function(a){var b;return b=a.outerWidth()-a.width()},d.get_side_border_padding=c}).call(this),function(){var a;a=function(){function a(){this.options_index=0,this.parsed=[]}a.prototype.add_node=function(a){return a.nodeName==="OPTGROUP"?this.add_group(a):this.add_option(a)},a.prototype.add_group=function(a){var b,c,d,e,f,g;b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:a.label,children:0,disabled:a.disabled}),f=a.childNodes,g=[];for(d=0,e=f.length;d"+a.html+"")},a.prototype.results_update_field=function(){return this.result_clear_highlight(),this.result_single_selected=null,this.results_build()},a.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},a.prototype.results_search=function(a){return this.results_showing?this.winnow_results():this.results_show()},a.prototype.keyup_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale();switch(b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:a.preventDefault();if(this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},a.prototype.generate_field_id=function(){var a;return a=this.generate_random_id(),this.form_field.id=a,a},a.prototype.generate_random_char=function(){var a,b,c;return a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ",c=Math.floor(Math.random()*a.length),b=a.substring(c,c+1)},a}(),b.AbstractChosen=a}.call(this),function(){var a,b,c,d,e=Object.prototype.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};d=this,a=jQuery,a.fn.extend({chosen:function(c){return!a.browser.msie||a.browser.version!=="6.0"&&a.browser.version!=="7.0"?a(this).each(function(d){if(!a(this).hasClass("chzn-done"))return new b(this,c)}):this}}),b=function(b){function e(){e.__super__.constructor.apply(this,arguments)}return f(e,b),e.prototype.setup=function(){return this.form_field_jq=a(this.form_field),this.is_rtl=this.form_field_jq.hasClass("chzn-rtl")},e.prototype.finish_setup=function(){return this.form_field_jq.addClass("chzn-done")},e.prototype.set_up_html=function(){var b,d,e,f;return this.container_id=this.form_field.id.length?this.form_field.id.replace(/(:|\.)/g,"_"):this.generate_field_id(),this.container_id+="_chzn",this.f_width=this.form_field_jq.outerWidth(),this.default_text=this.form_field_jq.data("placeholder")?this.form_field_jq.data("placeholder"):this.default_text_default,b=a("
            ",{id:this.container_id,"class":"chzn-container"+(this.is_rtl?" chzn-rtl":""),style:"width: "+this.f_width+"px;"}),this.is_multiple?b.html('
              '):b.html(''+this.default_text+'
                '),this.form_field_jq.hide().after(b),this.container=a("#"+this.container_id),this.container.addClass("chzn-container-"+(this.is_multiple?"multi":"single")),this.dropdown=this.container.find("div.chzn-drop").first(),d=this.container.height(),e=this.f_width-c(this.dropdown),this.dropdown.css({width:e+"px",top:d+"px"}),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chzn-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chzn-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chzn-search").first(),this.selected_item=this.container.find(".chzn-single").first(),f=e-c(this.search_container)-c(this.search_field),this.search_field.css({width:f+"px"})),this.results_build(),this.set_tab_index(),this.form_field_jq.trigger("liszt:ready",{chosen:this})},e.prototype.register_observers=function(){var a=this;return this.container.mousedown(function(b){return a.container_mousedown(b)}),this.container.mouseup(function(b){return a.container_mouseup(b)}),this.container.mouseenter(function(b){return a.mouse_enter(b)}),this.container.mouseleave(function(b){return a.mouse_leave(b)}),this.search_results.mouseup(function(b){return a.search_results_mouseup(b)}),this.search_results.mouseover(function(b){return a.search_results_mouseover(b)}),this.search_results.mouseout(function(b){return a.search_results_mouseout(b)}),this.form_field_jq.bind("liszt:updated",function(b){return a.results_update_field(b)}),this.search_field.blur(function(b){return a.input_blur(b)}),this.search_field.keyup(function(b){return a.keyup_checker(b)}),this.search_field.keydown(function(b){return a.keydown_checker(b)}),this.is_multiple?(this.search_choices.click(function(b){return a.choices_click(b)}),this.search_field.focus(function(b){return a.input_focus(b)})):this.container.click(function(a){return a.preventDefault()})},e.prototype.search_field_disabled=function(){this.is_disabled=this.form_field_jq[0].disabled;if(this.is_disabled)return this.container.addClass("chzn-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus",this.activate_action),this.close_field();this.container.removeClass("chzn-disabled"),this.search_field[0].disabled=!1;if(!this.is_multiple)return this.selected_item.bind("focus",this.activate_action)},e.prototype.container_mousedown=function(b){var c;if(!this.is_disabled)return c=b!=null?a(b.target).hasClass("search-choice-close"):!1,b&&b.type==="mousedown"&&!this.results_showing&&b.stopPropagation(),!this.pending_destroy_click&&!c?(this.active_field?!this.is_multiple&&b&&(a(b.target)[0]===this.selected_item[0]||a(b.target).parents("a.chzn-single").length)&&(b.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),a(document).click(this.click_test_action),this.results_show()),this.activate_field()):this.pending_destroy_click=!1},e.prototype.container_mouseup=function(a){if(a.target.nodeName==="ABBR")return this.results_reset(a)},e.prototype.blur_test=function(a){if(!this.active_field&&this.container.hasClass("chzn-container-active"))return this.close_field()},e.prototype.close_field=function(){return a(document).unbind("click",this.click_test_action),this.is_multiple||(this.selected_item.attr("tabindex",this.search_field.attr("tabindex")),this.search_field.attr("tabindex",-1)),this.active_field=!1,this.results_hide(),this.container.removeClass("chzn-container-active"),this.winnow_results_clear(),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},e.prototype.activate_field=function(){return!this.is_multiple&&!this.active_field&&(this.search_field.attr("tabindex",this.selected_item.attr("tabindex")),this.selected_item.attr("tabindex",-1)),this.container.addClass("chzn-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},e.prototype.test_active_click=function(b){return a(b.target).parents("#"+this.container_id).length?this.active_field=!0:this.close_field()},e.prototype.results_build=function(){var a,b,c,e,f;this.parsing=!0,this.results_data=d.SelectParser.select_to_array(this.form_field),this.is_multiple&&this.choices>0?(this.search_choices.find("li.search-choice").remove(),this.choices=0):this.is_multiple||(this.selected_item.find("span").text(this.default_text),this.form_field.options.length<=this.disable_search_threshold?this.container.addClass("chzn-container-single-nosearch"):this.container.removeClass("chzn-container-single-nosearch")),a="",f=this.results_data;for(c=0,e=f.length;c'+a("
                ").text(b.label).html()+"")},e.prototype.result_do_highlight=function(a){var b,c,d,e,f;if(a.length){this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClass("highlighted"),d=parseInt(this.search_results.css("maxHeight"),10),f=this.search_results.scrollTop(),e=d+f,c=this.result_highlight.position().top+this.search_results.scrollTop(),b=c+this.result_highlight.outerHeight();if(b>=e)return this.search_results.scrollTop(b-d>0?b-d:0);if(c'+b.html+''),d=a("#"+c).find("a").first(),d.click(function(a){return e.choice_destroy_link_click(a)})},e.prototype.choice_destroy_link_click=function(b){return b.preventDefault(),this.is_disabled?b.stopPropagation:(this.pending_destroy_click=!0,this.choice_destroy(a(b.target)))},e.prototype.choice_destroy=function(a){return this.choices-=1,this.show_search_field_default(),this.is_multiple&&this.choices>0&&this.search_field.val().length<1&&this.results_hide(),this.result_deselect(a.attr("rel")),a.parents("li").first().remove()},e.prototype.results_reset=function(b){this.form_field.options[0].selected=!0,this.selected_item.find("span").text(this.default_text),this.is_multiple||this.selected_item.addClass("chzn-default"),this.show_search_field_default(),a(b.target).remove(),this.form_field_jq.trigger("change");if(this.active_field)return this.results_hide()},e.prototype.result_select=function(a){var b,c,d,e;if(this.result_highlight)return b=this.result_highlight,c=b.attr("id"),this.result_clear_highlight(),this.is_multiple?this.result_deactivate(b):(this.search_results.find(".result-selected").removeClass("result-selected"),this.result_single_selected=b,this.selected_item.removeClass("chzn-default")),b.addClass("result-selected"),e=c.substr(c.lastIndexOf("_")+1),d=this.results_data[e],d.selected=!0,this.form_field.options[d.options_index].selected=!0,this.is_multiple?this.choice_build(d):(this.selected_item.find("span").first().text(d.text),this.allow_single_deselect&&this.single_deselect_control_build()),(!a.metaKey||!this.is_multiple)&&this.results_hide(),this.search_field.val(""),this.form_field_jq.trigger("change"),this.search_field_scale()},e.prototype.result_activate=function(a){return a.addClass("active-result")},e.prototype.result_deactivate=function(a){return a.removeClass("active-result")},e.prototype.result_deselect=function(b){var c,d;return d=this.results_data[b],d.selected=!1,this.form_field.options[d.options_index].selected=!1,c=a("#"+this.container_id+"_o_"+b),c.removeClass("result-selected").addClass("active-result").show(),this.result_clear_highlight(),this.winnow_results(),this.form_field_jq.trigger("change"),this.search_field_scale()},e.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect&&this.selected_item.find("abbr").length<1)return this.selected_item.find("span").first().after('')},e.prototype.winnow_results=function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;this.no_results_clear(),j=0,k=this.search_field.val()===this.default_text?"":a("
                ").text(a.trim(this.search_field.val())).html(),g=this.search_contains?"":"^",f=new RegExp(g+k.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),n=new RegExp(k.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),s=this.results_data;for(o=0,q=s.length;o=0||c.html.indexOf("[")===0){e=c.html.replace(/\[|\]/g,"").split(" ");if(e.length)for(p=0,r=e.length;p"+c.html.substr(l+k.length),m=m.substr(0,l)+""+m.substr(l)):m=c.html,h.html(m),this.result_activate(h),c.group_array_index!=null&&a("#"+this.results_data[c.group_array_index].dom_id).css("display","list-item")):(this.result_highlight&&i===this.result_highlight.attr("id")&&this.result_clear_highlight(),this.result_deactivate(h))}}return j<1&&k.length?this.no_results(k):this.winnow_results_set_highlight()},e.prototype.winnow_results_clear=function(){var b,c,d,e,f;this.search_field.val(""),c=this.search_results.find("li"),f=[];for(d=0,e=c.length;d'+this.results_none_found+' ""'),c.find("span").first().html(b),this.search_results.append(c)},e.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},e.prototype.keydown_arrow=function(){var b,c;this.result_highlight?this.results_showing&&(c=this.result_highlight.nextAll("li.active-result").first(),c&&this.result_do_highlight(c)):(b=this.search_results.find("li.active-result").first(),b&&this.result_do_highlight(a(b)));if(!this.results_showing)return this.results_show()},e.prototype.keyup_arrow=function(){var a;if(!this.results_showing&&!this.is_multiple)return this.results_show();if(this.result_highlight)return a=this.result_highlight.prevAll("li.active-result"),a.length?this.result_do_highlight(a.first()):(this.choices>0&&this.results_hide(),this.result_clear_highlight())},e.prototype.keydown_backstroke=function(){return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(this.pending_backstroke=this.search_container.siblings("li.search-choice").last(),this.pending_backstroke.addClass("search-choice-focus"))},e.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},e.prototype.keydown_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale(),b!==8&&this.pending_backstroke&&this.clear_backstroke();switch(b){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:this.keydown_arrow()}},e.prototype.search_field_scale=function(){var b,c,d,e,f,g,h,i,j;if(this.is_multiple){d=0,h=0,f="position:absolute; left: -1000px; top: -1000px; display:none;",g=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(i=0,j=g.length;i",{style:f}),c.text(this.search_field.val()),a("body").append(c),h=c.width()+25,c.remove(),h>this.f_width-10&&(h=this.f_width-10),this.search_field.css({width:h+"px"}),b=this.container.height(),this.dropdown.css({top:b+"px"})}},e.prototype.generate_random_id=function(){var b;b="sel"+this.generate_random_char()+this.generate_random_char()+this.generate_random_char();while(a("#"+b).length>0)b+=this.generate_random_char();return b},e}(AbstractChosen),c=function(a){var b;return b=a.outerWidth()-a.width()},d.get_side_border_padding=c}.call(this) \ No newline at end of file diff --git a/3rdparty/miniColors/css/images/colors.png b/3rdparty/miniColors/css/images/colors.png index 1b4f819d8d..deb50a9ae1 100755 Binary files a/3rdparty/miniColors/css/images/colors.png and b/3rdparty/miniColors/css/images/colors.png differ diff --git a/3rdparty/miniColors/css/images/trigger.png b/3rdparty/miniColors/css/images/trigger.png index 8c169fd605..96c91294f3 100755 Binary files a/3rdparty/miniColors/css/images/trigger.png and b/3rdparty/miniColors/css/images/trigger.png differ diff --git a/3rdparty/miniColors/css/jquery.miniColors.css b/3rdparty/miniColors/css/jquery.miniColors.css index 381bc1dc06..592f44894d 100755 --- a/3rdparty/miniColors/css/jquery.miniColors.css +++ b/3rdparty/miniColors/css/jquery.miniColors.css @@ -1,19 +1,13 @@ -.miniColors-trigger { - height: 22px; - width: 22px; - background: url(images/trigger.png) center no-repeat; - vertical-align: middle; - margin: 0 .25em; - display: inline-block; - outline: none; +INPUT.miniColors { + margin-right: 4px; } .miniColors-selector { position: absolute; width: 175px; height: 150px; - background: #FFF; - border: solid 1px #BBB; + background: white; + border: solid 1px #bababa; -moz-box-shadow: 0 0 6px rgba(0, 0, 0, .25); -webkit-box-shadow: 0 0 6px rgba(0, 0, 0, .25); box-shadow: 0 0 6px rgba(0, 0, 0, .25); @@ -24,9 +18,13 @@ z-index: 999999; } +.miniColors.opacity.miniColors-selector { + width: 200px; +} + .miniColors-selector.black { - background: #000; - border-color: #000; + background: black; + border-color: black; } .miniColors-colors { @@ -35,25 +33,43 @@ left: 5px; width: 150px; height: 150px; - background: url(images/colors.png) right no-repeat; + background: url(images/colors.png) -40px 0 no-repeat; cursor: crosshair; } +.miniColors.opacity .miniColors-colors { + left: 30px; +} + .miniColors-hues { position: absolute; top: 5px; left: 160px; width: 20px; height: 150px; - background: url(images/colors.png) left no-repeat; + background: url(images/colors.png) 0 0 no-repeat; + cursor: crosshair; +} + +.miniColors.opacity .miniColors-hues { + left: 185px; +} + +.miniColors-opacity { + position: absolute; + top: 5px; + left: 5px; + width: 20px; + height: 150px; + background: url(images/colors.png) -20px 0 no-repeat; cursor: crosshair; } .miniColors-colorPicker { position: absolute; - width: 9px; - height: 9px; - border: 1px solid #fff; + width: 11px; + height: 11px; + border: 1px solid black; -moz-border-radius: 11px; -webkit-border-radius: 11px; border-radius: 11px; @@ -64,18 +80,46 @@ left: 0; width: 7px; height: 7px; - border: 1px solid #000; + border: 2px solid white; -moz-border-radius: 9px; -webkit-border-radius: 9px; border-radius: 9px; } -.miniColors-huePicker { +.miniColors-huePicker, +.miniColors-opacityPicker { position: absolute; - left: -3px; - width: 24px; - height: 1px; - border: 1px solid #fff; + left: -2px; + width: 22px; + height: 2px; + border: 1px solid black; + background: white; + margin-top: -1px; border-radius: 2px; - background: #000; +} + +.miniColors-trigger, +.miniColors-triggerWrap { + width: 22px; + height: 22px; + display: inline-block; +} + +.miniColors-triggerWrap { + background: url(images/trigger.png) -22px 0 no-repeat; +} + +.miniColors-triggerWrap.disabled { + filter: alpha(opacity=50); + opacity: .5; +} + +.miniColors-trigger { + vertical-align: middle; + outline: none; + background: url(images/trigger.png) 0 0 no-repeat; +} + +.miniColors-triggerWrap.disabled .miniColors-trigger { + cursor: default; } \ No newline at end of file diff --git a/3rdparty/miniColors/js/jquery.miniColors.js b/3rdparty/miniColors/js/jquery.miniColors.js index 187db3fa84..a0f439c2c4 100755 --- a/3rdparty/miniColors/js/jquery.miniColors.js +++ b/3rdparty/miniColors/js/jquery.miniColors.js @@ -1,7 +1,7 @@ /* * jQuery miniColors: A small color selector * - * Copyright 2011 Cory LaViska for A Beautiful Site, LLC. (http://abeautifulsite.net/) + * Copyright 2012 Cory LaViska for A Beautiful Site, LLC. (http://www.abeautifulsite.net/) * * Dual licensed under the MIT or GPL Version 2 licenses * @@ -18,20 +18,30 @@ if(jQuery) (function($) { // // Determine initial color (defaults to white) - var color = expandHex(input.val()); - if( !color ) color = 'ffffff'; - var hsb = hex2hsb(color); + var color = expandHex(input.val()) || 'ffffff', + hsb = hex2hsb(color), + rgb = hsb2rgb(hsb), + alpha = parseFloat(input.attr('data-opacity')).toFixed(2); + + if( alpha > 1 ) alpha = 1; + if( alpha < 0 ) alpha = 0; // Create trigger var trigger = $(''); trigger.insertAfter(input); + trigger.wrap(''); + if( o.opacity ) { + trigger.css('backgroundColor', 'rgba(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ', ' + alpha + ')'); + } // Set input data and update attributes input .addClass('miniColors') .data('original-maxlength', input.attr('maxlength') || null) .data('original-autocomplete', input.attr('autocomplete') || null) - .data('letterCase', 'uppercase') + .data('letterCase', o.letterCase === 'uppercase' ? 'uppercase' : 'lowercase') + .data('opacity', o.opacity ? true : false) + .data('alpha', alpha) .data('trigger', trigger) .data('hsb', hsb) .data('change', o.change ? o.change : null) @@ -42,11 +52,11 @@ if(jQuery) (function($) { .val('#' + convertCase(color, o.letterCase)); // Handle options - if( o.readonly ) input.prop('readonly', true); - if( o.disabled ) disable(input); + if( o.readonly || input.prop('readonly') ) input.prop('readonly', true); + if( o.disabled || input.prop('disabled') ) disable(input); // Show selector when trigger is clicked - trigger.bind('click.miniColors', function(event) { + trigger.on('click.miniColors', function(event) { event.preventDefault(); if( input.val() === '' ) input.val('#'); show(input); @@ -54,29 +64,29 @@ if(jQuery) (function($) { }); // Show selector when input receives focus - input.bind('focus.miniColors', function(event) { + input.on('focus.miniColors', function(event) { if( input.val() === '' ) input.val('#'); show(input); }); // Hide on blur - input.bind('blur.miniColors', function(event) { + input.on('blur.miniColors', function(event) { var hex = expandHex( hsb2hex(input.data('hsb')) ); input.val( hex ? '#' + convertCase(hex, input.data('letterCase')) : '' ); }); // Hide when tabbing out of the input - input.bind('keydown.miniColors', function(event) { + input.on('keydown.miniColors', function(event) { if( event.keyCode === 9 ) hide(input); }); // Update when color is typed in - input.bind('keyup.miniColors', function(event) { + input.on('keyup.miniColors', function(event) { setColorFromInput(input); }); // Handle pasting - input.bind('paste.miniColors', function(event) { + input.on('paste.miniColors', function(event) { // Short pause to wait for paste to complete setTimeout( function() { setColorFromInput(input); @@ -89,19 +99,18 @@ if(jQuery) (function($) { // // Destroys an active instance of the miniColors selector // - hide(); input = $(input); // Restore to original state - input.data('trigger').remove(); + input.data('trigger').parent().remove(); input .attr('autocomplete', input.data('original-autocomplete')) .attr('maxlength', input.data('original-maxlength')) .removeData() .removeClass('miniColors') - .unbind('.miniColors'); - $(document).unbind('.miniColors'); + .off('.miniColors'); + $(document).off('.miniColors'); }; var enable = function(input) { @@ -110,8 +119,7 @@ if(jQuery) (function($) { // input .prop('disabled', false) - .data('trigger') - .css('opacity', 1); + .data('trigger').parent().removeClass('disabled'); }; var disable = function(input) { @@ -121,8 +129,7 @@ if(jQuery) (function($) { hide(input); input .prop('disabled', true) - .data('trigger') - .css('opacity', 0.5); + .data('trigger').parent().addClass('disabled'); }; var show = function(input) { @@ -133,24 +140,27 @@ if(jQuery) (function($) { // Hide all other instances hide(); - + // Generate the selector var selector = $('
                '); selector - .append('
                ') .append('
                ') - .css({ - top: input.is(':visible') ? input.offset().top + input.outerHeight() : input.data('trigger').offset().top + input.data('trigger').outerHeight(), - left: input.is(':visible') ? input.offset().left : input.data('trigger').offset().left, - display: 'none' - }) + .append('
                ') + .css('display', 'none') .addClass( input.attr('class') ); + // Opacity + if( input.data('opacity') ) { + selector + .addClass('opacity') + .prepend('
                '); + } + // Set background for colors var hsb = input.data('hsb'); selector - .find('.miniColors-colors') - .css('backgroundColor', '#' + hsb2hex({ h: hsb.h, s: 100, b: 100 })); + .find('.miniColors-colors').css('backgroundColor', '#' + hsb2hex({ h: hsb.h, s: 100, b: 100 })).end() + .find('.miniColors-opacity').css('backgroundColor', '#' + hsb2hex({ h: hsb.h, s: hsb.s, b: hsb.b })).end(); // Set colorPicker position var colorPosition = input.data('colorPosition'); @@ -162,64 +172,106 @@ if(jQuery) (function($) { // Set huePicker position var huePosition = input.data('huePosition'); if( !huePosition ) huePosition = getHuePositionFromHSB(hsb); - selector.find('.miniColors-huePicker').css('top', huePosition.y + 'px'); + selector.find('.miniColors-huePicker').css('top', huePosition + 'px'); + + // Set opacity position + var opacityPosition = input.data('opacityPosition'); + if( !opacityPosition ) opacityPosition = getOpacityPositionFromAlpha(input.attr('data-opacity')); + selector.find('.miniColors-opacityPicker').css('top', opacityPosition + 'px'); // Set input data input .data('selector', selector) .data('huePicker', selector.find('.miniColors-huePicker')) + .data('opacityPicker', selector.find('.miniColors-opacityPicker')) .data('colorPicker', selector.find('.miniColors-colorPicker')) .data('mousebutton', 0); - + $('BODY').append(selector); - selector.fadeIn(100); + + // Position the selector + var trigger = input.data('trigger'), + hidden = !input.is(':visible'), + top = hidden ? trigger.offset().top + trigger.outerHeight() : input.offset().top + input.outerHeight(), + left = hidden ? trigger.offset().left : input.offset().left, + selectorWidth = selector.outerWidth(), + selectorHeight = selector.outerHeight(), + triggerWidth = trigger.outerWidth(), + triggerHeight = trigger.outerHeight(), + windowHeight = $(window).height(), + windowWidth = $(window).width(), + scrollTop = $(window).scrollTop(), + scrollLeft = $(window).scrollLeft(); + + // Adjust based on viewport + if( (top + selectorHeight) > windowHeight + scrollTop ) top = top - selectorHeight - triggerHeight; + if( (left + selectorWidth) > windowWidth + scrollLeft ) left = left - selectorWidth + triggerWidth; + + // Set position and show + selector.css({ + top: top, + left: left + }).fadeIn(100); // Prevent text selection in IE - selector.bind('selectstart', function() { return false; }); + selector.on('selectstart', function() { return false; }); - $(document).bind('mousedown.miniColors touchstart.miniColors', function(event) { - - input.data('mousebutton', 1); - var testSubject = $(event.target).parents().andSelf(); - - if( testSubject.hasClass('miniColors-colors') ) { - event.preventDefault(); - input.data('moving', 'colors'); - moveColor(input, event); - } - - if( testSubject.hasClass('miniColors-hues') ) { - event.preventDefault(); - input.data('moving', 'hues'); - moveHue(input, event); - } - - if( testSubject.hasClass('miniColors-selector') ) { - event.preventDefault(); - return; - } - - if( testSubject.hasClass('miniColors') ) return; - - hide(input); - }); + // Hide on resize (IE7/8 trigger this when any element is resized...) + if( !$.browser.msie || ($.browser.msie && $.browser.version >= 9) ) { + $(window).on('resize.miniColors', function(event) { + hide(input); + }); + } $(document) - .bind('mouseup.miniColors touchend.miniColors', function(event) { + .on('mousedown.miniColors touchstart.miniColors', function(event) { + + input.data('mousebutton', 1); + var testSubject = $(event.target).parents().andSelf(); + + if( testSubject.hasClass('miniColors-colors') ) { + event.preventDefault(); + input.data('moving', 'colors'); + moveColor(input, event); + } + + if( testSubject.hasClass('miniColors-hues') ) { + event.preventDefault(); + input.data('moving', 'hues'); + moveHue(input, event); + } + + if( testSubject.hasClass('miniColors-opacity') ) { + event.preventDefault(); + input.data('moving', 'opacity'); + moveOpacity(input, event); + } + + if( testSubject.hasClass('miniColors-selector') ) { + event.preventDefault(); + return; + } + + if( testSubject.hasClass('miniColors') ) return; + + hide(input); + }) + .on('mouseup.miniColors touchend.miniColors', function(event) { event.preventDefault(); input.data('mousebutton', 0).removeData('moving'); }) - .bind('mousemove.miniColors touchmove.miniColors', function(event) { + .on('mousemove.miniColors touchmove.miniColors', function(event) { event.preventDefault(); if( input.data('mousebutton') === 1 ) { if( input.data('moving') === 'colors' ) moveColor(input, event); if( input.data('moving') === 'hues' ) moveHue(input, event); + if( input.data('moving') === 'opacity' ) moveOpacity(input, event); } }); // Fire open callback if( input.data('open') ) { - input.data('open').call(input.get(0), '#' + hsb2hex(hsb), hsb2rgb(hsb)); + input.data('open').call(input.get(0), '#' + hsb2hex(hsb), $.extend(hsb2rgb(hsb), { a: parseFloat(input.attr('data-opacity')) })); } }; @@ -231,22 +283,22 @@ if(jQuery) (function($) { // // Hide all other instances if input isn't specified - if( !input ) input = '.miniColors'; + if( !input ) input = $('.miniColors'); - $(input).each( function() { + input.each( function() { var selector = $(this).data('selector'); $(this).removeData('selector'); $(selector).fadeOut(100, function() { // Fire close callback if( input.data('close') ) { var hsb = input.data('hsb'), hex = hsb2hex(hsb); - input.data('close').call(input.get(0), '#' + hex, hsb2rgb(hsb)); + input.data('close').call(input.get(0), '#' + hex, $.extend(hsb2rgb(hsb), { a: parseFloat(input.attr('data-opacity')) })); } $(this).remove(); }); }); - $(document).unbind('.miniColors'); + $(document).off('.miniColors'); }; @@ -266,8 +318,8 @@ if(jQuery) (function($) { position.x = event.originalEvent.changedTouches[0].pageX; position.y = event.originalEvent.changedTouches[0].pageY; } - position.x = position.x - input.data('selector').find('.miniColors-colors').offset().left - 5; - position.y = position.y - input.data('selector').find('.miniColors-colors').offset().top - 5; + position.x = position.x - input.data('selector').find('.miniColors-colors').offset().left - 6; + position.y = position.y - input.data('selector').find('.miniColors-colors').offset().top - 6; if( position.x <= -5 ) position.x = -5; if( position.x >= 144 ) position.x = 144; if( position.y <= -5 ) position.y = -5; @@ -301,23 +353,21 @@ if(jQuery) (function($) { huePicker.hide(); - var position = { - y: event.pageY - }; + var position = event.pageY; // Touch support if( event.originalEvent.changedTouches ) { - position.y = event.originalEvent.changedTouches[0].pageY; + position = event.originalEvent.changedTouches[0].pageY; } - position.y = position.y - input.data('selector').find('.miniColors-colors').offset().top - 1; - if( position.y <= -1 ) position.y = -1; - if( position.y >= 149 ) position.y = 149; + position = position - input.data('selector').find('.miniColors-colors').offset().top - 1; + if( position <= -1 ) position = -1; + if( position >= 149 ) position = 149; input.data('huePosition', position); - huePicker.css('top', position.y).show(); + huePicker.css('top', position).show(); // Calculate hue - var h = Math.round((150 - position.y - 1) * 2.4); + var h = Math.round((150 - position - 1) * 2.4); if( h < 0 ) h = 0; if( h > 360 ) h = 360; @@ -330,18 +380,65 @@ if(jQuery) (function($) { }; + var moveOpacity = function(input, event) { + + var opacityPicker = input.data('opacityPicker'); + + opacityPicker.hide(); + + var position = event.pageY; + + // Touch support + if( event.originalEvent.changedTouches ) { + position = event.originalEvent.changedTouches[0].pageY; + } + + position = position - input.data('selector').find('.miniColors-colors').offset().top - 1; + if( position <= -1 ) position = -1; + if( position >= 149 ) position = 149; + input.data('opacityPosition', position); + opacityPicker.css('top', position).show(); + + // Calculate opacity + var alpha = parseFloat((150 - position - 1) / 150).toFixed(2); + if( alpha < 0 ) alpha = 0; + if( alpha > 1 ) alpha = 1; + + // Update opacity + input + .data('alpha', alpha) + .attr('data-opacity', alpha); + + // Set color + setColor(input, input.data('hsb'), true); + + }; + var setColor = function(input, hsb, updateInput) { input.data('hsb', hsb); - var hex = hsb2hex(hsb); + var hex = hsb2hex(hsb), + selector = $(input.data('selector')); if( updateInput ) input.val( '#' + convertCase(hex, input.data('letterCase')) ); + + selector + .find('.miniColors-colors').css('backgroundColor', '#' + hsb2hex({ h: hsb.h, s: 100, b: 100 })).end() + .find('.miniColors-opacity').css('backgroundColor', '#' + hex).end(); + + var rgb = hsb2rgb(hsb); + + // Set background color (also fallback for non RGBA browsers) input.data('trigger').css('backgroundColor', '#' + hex); - if( input.data('selector') ) input.data('selector').find('.miniColors-colors').css('backgroundColor', '#' + hsb2hex({ h: hsb.h, s: 100, b: 100 })); + + // Set background color + opacity + if( input.data('opacity') ) { + input.data('trigger').css('backgroundColor', 'rgba(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ', ' + input.attr('data-opacity') + ')'); + } // Fire change callback if( input.data('change') ) { - if( hex === input.data('lastChange') ) return; - input.data('change').call(input.get(0), '#' + hex, hsb2rgb(hsb)); - input.data('lastChange', hex); + if( (hex + ',' + input.attr('data-opacity')) === input.data('lastChange') ) return; + input.data('change').call(input.get(0), '#' + hex, $.extend(hsb2rgb(hsb), { a: parseFloat(input.attr('data-opacity')) })); + input.data('lastChange', hex + ',' + input.attr('data-opacity')); } }; @@ -355,10 +452,6 @@ if(jQuery) (function($) { // Get HSB equivalent var hsb = hex2hsb(hex); - // If color is the same, no change required - var currentHSB = input.data('hsb'); - if( hsb.h === currentHSB.h && hsb.s === currentHSB.s && hsb.b === currentHSB.b ) return true; - // Set colorPicker position var colorPosition = getColorPositionFromHSB(hsb); var colorPicker = $(input.data('colorPicker')); @@ -368,9 +461,14 @@ if(jQuery) (function($) { // Set huePosition position var huePosition = getHuePositionFromHSB(hsb); var huePicker = $(input.data('huePicker')); - huePicker.css('top', huePosition.y + 'px'); + huePicker.css('top', huePosition + 'px'); input.data('huePosition', huePosition); + // Set opacity position + var opacityPosition = getOpacityPositionFromAlpha(input.attr('data-opacity')); + var opacityPicker = $(input.data('opacityPicker')); + opacityPicker.css('top', opacityPosition + 'px'); + input.data('opacityPosition', opacityPosition); setColor(input, hsb); return true; @@ -378,9 +476,11 @@ if(jQuery) (function($) { }; var convertCase = function(string, letterCase) { - if( letterCase === 'lowercase' ) return string.toLowerCase(); - if( letterCase === 'uppercase' ) return string.toUpperCase(); - return string; + if( letterCase === 'uppercase' ) { + return string.toUpperCase(); + } else { + return string.toLowerCase(); + } }; var getColorPositionFromHSB = function(hsb) { @@ -397,7 +497,14 @@ if(jQuery) (function($) { var y = 150 - (hsb.h / 2.4); if( y < 0 ) h = 0; if( y > 150 ) h = 150; - return { y: y - 1 }; + return y; + }; + + var getOpacityPositionFromAlpha = function(alpha) { + var y = 150 * alpha; + if( y < 0 ) y = 0; + if( y > 150 ) y = 150; + return 150 - y; }; var cleanHex = function(hex) { @@ -542,6 +649,29 @@ if(jQuery) (function($) { }); return $(this); + + case 'opacity': + + // Getter + if( data === undefined ) { + if( !$(this).hasClass('miniColors') ) return; + if( $(this).data('opacity') ) { + return parseFloat($(this).attr('data-opacity')); + } else { + return null; + } + } + + // Setter + $(this).each( function() { + if( !$(this).hasClass('miniColors') ) return; + if( data < 0 ) data = 0; + if( data > 1 ) data = 1; + $(this).attr('data-opacity', data).data('alpha', data); + setColorFromInput($(this)); + }); + + return $(this); case 'destroy': diff --git a/3rdparty/miniColors/js/jquery.miniColors.min.js b/3rdparty/miniColors/js/jquery.miniColors.min.js index c00e0ace6b..1d3346455b 100755 --- a/3rdparty/miniColors/js/jquery.miniColors.min.js +++ b/3rdparty/miniColors/js/jquery.miniColors.min.js @@ -1,9 +1,9 @@ /* * jQuery miniColors: A small color selector * - * Copyright 2011 Cory LaViska for A Beautiful Site, LLC. (http://abeautifulsite.net/) + * Copyright 2012 Cory LaViska for A Beautiful Site, LLC. (http://www.abeautifulsite.net/) * * Dual licensed under the MIT or GPL Version 2 licenses * */ -if(jQuery)(function($){$.extend($.fn,{miniColors:function(o,data){var create=function(input,o,data){var color=expandHex(input.val());if(!color)color='ffffff';var hsb=hex2hsb(color);var trigger=$('');trigger.insertAfter(input);input.addClass('miniColors').data('original-maxlength',input.attr('maxlength')||null).data('original-autocomplete',input.attr('autocomplete')||null).data('letterCase','uppercase').data('trigger',trigger).data('hsb',hsb).data('change',o.change?o.change:null).data('close',o.close?o.close:null).data('open',o.open?o.open:null).attr('maxlength',7).attr('autocomplete','off').val('#'+convertCase(color,o.letterCase));if(o.readonly)input.prop('readonly',true);if(o.disabled)disable(input);trigger.bind('click.miniColors',function(event){event.preventDefault();if(input.val()==='')input.val('#');show(input)});input.bind('focus.miniColors',function(event){if(input.val()==='')input.val('#');show(input)});input.bind('blur.miniColors',function(event){var hex=expandHex(hsb2hex(input.data('hsb')));input.val(hex?'#'+convertCase(hex,input.data('letterCase')):'')});input.bind('keydown.miniColors',function(event){if(event.keyCode===9)hide(input)});input.bind('keyup.miniColors',function(event){setColorFromInput(input)});input.bind('paste.miniColors',function(event){setTimeout(function(){setColorFromInput(input)},5)})};var destroy=function(input){hide();input=$(input);input.data('trigger').remove();input.attr('autocomplete',input.data('original-autocomplete')).attr('maxlength',input.data('original-maxlength')).removeData().removeClass('miniColors').unbind('.miniColors');$(document).unbind('.miniColors')};var enable=function(input){input.prop('disabled',false).data('trigger').css('opacity',1)};var disable=function(input){hide(input);input.prop('disabled',true).data('trigger').css('opacity',0.5)};var show=function(input){if(input.prop('disabled'))return false;hide();var selector=$('
                ');selector.append('
                ').append('
                ').css({top:input.is(':visible')?input.offset().top+input.outerHeight():input.data('trigger').offset().top+input.data('trigger').outerHeight(),left:input.is(':visible')?input.offset().left:input.data('trigger').offset().left,display:'none'}).addClass(input.attr('class'));var hsb=input.data('hsb');selector.find('.miniColors-colors').css('backgroundColor','#'+hsb2hex({h:hsb.h,s:100,b:100}));var colorPosition=input.data('colorPosition');if(!colorPosition)colorPosition=getColorPositionFromHSB(hsb);selector.find('.miniColors-colorPicker').css('top',colorPosition.y+'px').css('left',colorPosition.x+'px');var huePosition=input.data('huePosition');if(!huePosition)huePosition=getHuePositionFromHSB(hsb);selector.find('.miniColors-huePicker').css('top',huePosition.y+'px');input.data('selector',selector).data('huePicker',selector.find('.miniColors-huePicker')).data('colorPicker',selector.find('.miniColors-colorPicker')).data('mousebutton',0);$('BODY').append(selector);selector.fadeIn(100);selector.bind('selectstart',function(){return false});$(document).bind('mousedown.miniColors touchstart.miniColors',function(event){input.data('mousebutton',1);var testSubject=$(event.target).parents().andSelf();if(testSubject.hasClass('miniColors-colors')){event.preventDefault();input.data('moving','colors');moveColor(input,event)}if(testSubject.hasClass('miniColors-hues')){event.preventDefault();input.data('moving','hues');moveHue(input,event)}if(testSubject.hasClass('miniColors-selector')){event.preventDefault();return}if(testSubject.hasClass('miniColors'))return;hide(input)});$(document).bind('mouseup.miniColors touchend.miniColors',function(event){event.preventDefault();input.data('mousebutton',0).removeData('moving')}).bind('mousemove.miniColors touchmove.miniColors',function(event){event.preventDefault();if(input.data('mousebutton')===1){if(input.data('moving')==='colors')moveColor(input,event);if(input.data('moving')==='hues')moveHue(input,event)}});if(input.data('open')){input.data('open').call(input.get(0),'#'+hsb2hex(hsb),hsb2rgb(hsb))}};var hide=function(input){if(!input)input='.miniColors';$(input).each(function(){var selector=$(this).data('selector');$(this).removeData('selector');$(selector).fadeOut(100,function(){if(input.data('close')){var hsb=input.data('hsb'),hex=hsb2hex(hsb);input.data('close').call(input.get(0),'#'+hex,hsb2rgb(hsb))}$(this).remove()})});$(document).unbind('.miniColors')};var moveColor=function(input,event){var colorPicker=input.data('colorPicker');colorPicker.hide();var position={x:event.pageX,y:event.pageY};if(event.originalEvent.changedTouches){position.x=event.originalEvent.changedTouches[0].pageX;position.y=event.originalEvent.changedTouches[0].pageY}position.x=position.x-input.data('selector').find('.miniColors-colors').offset().left-5;position.y=position.y-input.data('selector').find('.miniColors-colors').offset().top-5;if(position.x<=-5)position.x=-5;if(position.x>=144)position.x=144;if(position.y<=-5)position.y=-5;if(position.y>=144)position.y=144;input.data('colorPosition',position);colorPicker.css('left',position.x).css('top',position.y).show();var s=Math.round((position.x+5)*0.67);if(s<0)s=0;if(s>100)s=100;var b=100-Math.round((position.y+5)*0.67);if(b<0)b=0;if(b>100)b=100;var hsb=input.data('hsb');hsb.s=s;hsb.b=b;setColor(input,hsb,true)};var moveHue=function(input,event){var huePicker=input.data('huePicker');huePicker.hide();var position={y:event.pageY};if(event.originalEvent.changedTouches){position.y=event.originalEvent.changedTouches[0].pageY}position.y=position.y-input.data('selector').find('.miniColors-colors').offset().top-1;if(position.y<=-1)position.y=-1;if(position.y>=149)position.y=149;input.data('huePosition',position);huePicker.css('top',position.y).show();var h=Math.round((150-position.y-1)*2.4);if(h<0)h=0;if(h>360)h=360;var hsb=input.data('hsb');hsb.h=h;setColor(input,hsb,true)};var setColor=function(input,hsb,updateInput){input.data('hsb',hsb);var hex=hsb2hex(hsb);if(updateInput)input.val('#'+convertCase(hex,input.data('letterCase')));input.data('trigger').css('backgroundColor','#'+hex);if(input.data('selector'))input.data('selector').find('.miniColors-colors').css('backgroundColor','#'+hsb2hex({h:hsb.h,s:100,b:100}));if(input.data('change')){if(hex===input.data('lastChange'))return;input.data('change').call(input.get(0),'#'+hex,hsb2rgb(hsb));input.data('lastChange',hex)}};var setColorFromInput=function(input){input.val('#'+cleanHex(input.val()));var hex=expandHex(input.val());if(!hex)return false;var hsb=hex2hsb(hex);var currentHSB=input.data('hsb');if(hsb.h===currentHSB.h&&hsb.s===currentHSB.s&&hsb.b===currentHSB.b)return true;var colorPosition=getColorPositionFromHSB(hsb);var colorPicker=$(input.data('colorPicker'));colorPicker.css('top',colorPosition.y+'px').css('left',colorPosition.x+'px');input.data('colorPosition',colorPosition);var huePosition=getHuePositionFromHSB(hsb);var huePicker=$(input.data('huePicker'));huePicker.css('top',huePosition.y+'px');input.data('huePosition',huePosition);setColor(input,hsb);return true};var convertCase=function(string,letterCase){if(letterCase==='lowercase')return string.toLowerCase();if(letterCase==='uppercase')return string.toUpperCase();return string};var getColorPositionFromHSB=function(hsb){var x=Math.ceil(hsb.s/0.67);if(x<0)x=0;if(x>150)x=150;var y=150-Math.ceil(hsb.b/0.67);if(y<0)y=0;if(y>150)y=150;return{x:x-5,y:y-5}};var getHuePositionFromHSB=function(hsb){var y=150-(hsb.h/2.4);if(y<0)h=0;if(y>150)h=150;return{y:y-1}};var cleanHex=function(hex){return hex.replace(/[^A-F0-9]/ig,'')};var expandHex=function(hex){hex=cleanHex(hex);if(!hex)return null;if(hex.length===3)hex=hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2];return hex.length===6?hex:null};var hsb2rgb=function(hsb){var rgb={};var h=Math.round(hsb.h);var s=Math.round(hsb.s*255/100);var v=Math.round(hsb.b*255/100);if(s===0){rgb.r=rgb.g=rgb.b=v}else{var t1=v;var t2=(255-s)*v/255;var t3=(t1-t2)*(h%60)/60;if(h===360)h=0;if(h<60){rgb.r=t1;rgb.b=t2;rgb.g=t2+t3}else if(h<120){rgb.g=t1;rgb.b=t2;rgb.r=t1-t3}else if(h<180){rgb.g=t1;rgb.r=t2;rgb.b=t2+t3}else if(h<240){rgb.b=t1;rgb.r=t2;rgb.g=t1-t3}else if(h<300){rgb.b=t1;rgb.g=t2;rgb.r=t2+t3}else if(h<360){rgb.r=t1;rgb.g=t2;rgb.b=t1-t3}else{rgb.r=0;rgb.g=0;rgb.b=0}}return{r:Math.round(rgb.r),g:Math.round(rgb.g),b:Math.round(rgb.b)}};var rgb2hex=function(rgb){var hex=[rgb.r.toString(16),rgb.g.toString(16),rgb.b.toString(16)];$.each(hex,function(nr,val){if(val.length===1)hex[nr]='0'+val});return hex.join('')};var hex2rgb=function(hex){hex=parseInt(((hex.indexOf('#')>-1)?hex.substring(1):hex),16);return{r:hex>>16,g:(hex&0x00FF00)>>8,b:(hex&0x0000FF)}};var rgb2hsb=function(rgb){var hsb={h:0,s:0,b:0};var min=Math.min(rgb.r,rgb.g,rgb.b);var max=Math.max(rgb.r,rgb.g,rgb.b);var delta=max-min;hsb.b=max;hsb.s=max!==0?255*delta/max:0;if(hsb.s!==0){if(rgb.r===max){hsb.h=(rgb.g-rgb.b)/delta}else if(rgb.g===max){hsb.h=2+(rgb.b-rgb.r)/delta}else{hsb.h=4+(rgb.r-rgb.g)/delta}}else{hsb.h=-1}hsb.h*=60;if(hsb.h<0){hsb.h+=360}hsb.s*=100/255;hsb.b*=100/255;return hsb};var hex2hsb=function(hex){var hsb=rgb2hsb(hex2rgb(hex));if(hsb.s===0)hsb.h=360;return hsb};var hsb2hex=function(hsb){return rgb2hex(hsb2rgb(hsb))};switch(o){case'readonly':$(this).each(function(){if(!$(this).hasClass('miniColors'))return;$(this).prop('readonly',data)});return $(this);case'disabled':$(this).each(function(){if(!$(this).hasClass('miniColors'))return;if(data){disable($(this))}else{enable($(this))}});return $(this);case'value':if(data===undefined){if(!$(this).hasClass('miniColors'))return;var input=$(this),hex=expandHex(input.val());return hex?'#'+convertCase(hex,input.data('letterCase')):null}$(this).each(function(){if(!$(this).hasClass('miniColors'))return;$(this).val(data);setColorFromInput($(this))});return $(this);case'destroy':$(this).each(function(){if(!$(this).hasClass('miniColors'))return;destroy($(this))});return $(this);default:if(!o)o={};$(this).each(function(){if($(this)[0].tagName.toLowerCase()!=='input')return;if($(this).data('trigger'))return;create($(this),o,data)});return $(this)}}})})(jQuery); \ No newline at end of file +if(jQuery)(function($){$.extend($.fn,{miniColors:function(o,data){var create=function(input,o,data){var color=expandHex(input.val())||'ffffff',hsb=hex2hsb(color),rgb=hsb2rgb(hsb),alpha=parseFloat(input.attr('data-opacity')).toFixed(2);if(alpha>1)alpha=1;if(alpha<0)alpha=0;var trigger=$('');trigger.insertAfter(input);trigger.wrap('');if(o.opacity){trigger.css('backgroundColor','rgba('+rgb.r+', '+rgb.g+', '+rgb.b+', '+alpha+')')}input.addClass('miniColors').data('original-maxlength',input.attr('maxlength')||null).data('original-autocomplete',input.attr('autocomplete')||null).data('letterCase',o.letterCase==='uppercase'?'uppercase':'lowercase').data('opacity',o.opacity?true:false).data('alpha',alpha).data('trigger',trigger).data('hsb',hsb).data('change',o.change?o.change:null).data('close',o.close?o.close:null).data('open',o.open?o.open:null).attr('maxlength',7).attr('autocomplete','off').val('#'+convertCase(color,o.letterCase));if(o.readonly||input.prop('readonly'))input.prop('readonly',true);if(o.disabled||input.prop('disabled'))disable(input);trigger.on('click.miniColors',function(event){event.preventDefault();if(input.val()==='')input.val('#');show(input)});input.on('focus.miniColors',function(event){if(input.val()==='')input.val('#');show(input)});input.on('blur.miniColors',function(event){var hex=expandHex(hsb2hex(input.data('hsb')));input.val(hex?'#'+convertCase(hex,input.data('letterCase')):'')});input.on('keydown.miniColors',function(event){if(event.keyCode===9)hide(input)});input.on('keyup.miniColors',function(event){setColorFromInput(input)});input.on('paste.miniColors',function(event){setTimeout(function(){setColorFromInput(input)},5)})};var destroy=function(input){hide();input=$(input);input.data('trigger').parent().remove();input.attr('autocomplete',input.data('original-autocomplete')).attr('maxlength',input.data('original-maxlength')).removeData().removeClass('miniColors').off('.miniColors');$(document).off('.miniColors')};var enable=function(input){input.prop('disabled',false).data('trigger').parent().removeClass('disabled')};var disable=function(input){hide(input);input.prop('disabled',true).data('trigger').parent().addClass('disabled')};var show=function(input){if(input.prop('disabled'))return false;hide();var selector=$('
                ');selector.append('
                ').append('
                ').css('display','none').addClass(input.attr('class'));if(input.data('opacity')){selector.addClass('opacity').prepend('
                ')}var hsb=input.data('hsb');selector.find('.miniColors-colors').css('backgroundColor','#'+hsb2hex({h:hsb.h,s:100,b:100})).end().find('.miniColors-opacity').css('backgroundColor','#'+hsb2hex({h:hsb.h,s:hsb.s,b:hsb.b})).end();var colorPosition=input.data('colorPosition');if(!colorPosition)colorPosition=getColorPositionFromHSB(hsb);selector.find('.miniColors-colorPicker').css('top',colorPosition.y+'px').css('left',colorPosition.x+'px');var huePosition=input.data('huePosition');if(!huePosition)huePosition=getHuePositionFromHSB(hsb);selector.find('.miniColors-huePicker').css('top',huePosition+'px');var opacityPosition=input.data('opacityPosition');if(!opacityPosition)opacityPosition=getOpacityPositionFromAlpha(input.attr('data-opacity'));selector.find('.miniColors-opacityPicker').css('top',opacityPosition+'px');input.data('selector',selector).data('huePicker',selector.find('.miniColors-huePicker')).data('opacityPicker',selector.find('.miniColors-opacityPicker')).data('colorPicker',selector.find('.miniColors-colorPicker')).data('mousebutton',0);$('BODY').append(selector);var trigger=input.data('trigger'),hidden=!input.is(':visible'),top=hidden?trigger.offset().top+trigger.outerHeight():input.offset().top+input.outerHeight(),left=hidden?trigger.offset().left:input.offset().left,selectorWidth=selector.outerWidth(),selectorHeight=selector.outerHeight(),triggerWidth=trigger.outerWidth(),triggerHeight=trigger.outerHeight(),windowHeight=$(window).height(),windowWidth=$(window).width(),scrollTop=$(window).scrollTop(),scrollLeft=$(window).scrollLeft();if((top+selectorHeight)>windowHeight+scrollTop)top=top-selectorHeight-triggerHeight;if((left+selectorWidth)>windowWidth+scrollLeft)left=left-selectorWidth+triggerWidth;selector.css({top:top,left:left}).fadeIn(100);selector.on('selectstart',function(){return false});if(!$.browser.msie||($.browser.msie&&$.browser.version>=9)){$(window).on('resize.miniColors',function(event){hide(input)})}$(document).on('mousedown.miniColors touchstart.miniColors',function(event){input.data('mousebutton',1);var testSubject=$(event.target).parents().andSelf();if(testSubject.hasClass('miniColors-colors')){event.preventDefault();input.data('moving','colors');moveColor(input,event)}if(testSubject.hasClass('miniColors-hues')){event.preventDefault();input.data('moving','hues');moveHue(input,event)}if(testSubject.hasClass('miniColors-opacity')){event.preventDefault();input.data('moving','opacity');moveOpacity(input,event)}if(testSubject.hasClass('miniColors-selector')){event.preventDefault();return}if(testSubject.hasClass('miniColors'))return;hide(input)}).on('mouseup.miniColors touchend.miniColors',function(event){event.preventDefault();input.data('mousebutton',0).removeData('moving')}).on('mousemove.miniColors touchmove.miniColors',function(event){event.preventDefault();if(input.data('mousebutton')===1){if(input.data('moving')==='colors')moveColor(input,event);if(input.data('moving')==='hues')moveHue(input,event);if(input.data('moving')==='opacity')moveOpacity(input,event)}});if(input.data('open')){input.data('open').call(input.get(0),'#'+hsb2hex(hsb),$.extend(hsb2rgb(hsb),{a:parseFloat(input.attr('data-opacity'))}))}};var hide=function(input){if(!input)input=$('.miniColors');input.each(function(){var selector=$(this).data('selector');$(this).removeData('selector');$(selector).fadeOut(100,function(){if(input.data('close')){var hsb=input.data('hsb'),hex=hsb2hex(hsb);input.data('close').call(input.get(0),'#'+hex,$.extend(hsb2rgb(hsb),{a:parseFloat(input.attr('data-opacity'))}))}$(this).remove()})});$(document).off('.miniColors')};var moveColor=function(input,event){var colorPicker=input.data('colorPicker');colorPicker.hide();var position={x:event.pageX,y:event.pageY};if(event.originalEvent.changedTouches){position.x=event.originalEvent.changedTouches[0].pageX;position.y=event.originalEvent.changedTouches[0].pageY}position.x=position.x-input.data('selector').find('.miniColors-colors').offset().left-6;position.y=position.y-input.data('selector').find('.miniColors-colors').offset().top-6;if(position.x<=-5)position.x=-5;if(position.x>=144)position.x=144;if(position.y<=-5)position.y=-5;if(position.y>=144)position.y=144;input.data('colorPosition',position);colorPicker.css('left',position.x).css('top',position.y).show();var s=Math.round((position.x+5)*0.67);if(s<0)s=0;if(s>100)s=100;var b=100-Math.round((position.y+5)*0.67);if(b<0)b=0;if(b>100)b=100;var hsb=input.data('hsb');hsb.s=s;hsb.b=b;setColor(input,hsb,true)};var moveHue=function(input,event){var huePicker=input.data('huePicker');huePicker.hide();var position=event.pageY;if(event.originalEvent.changedTouches){position=event.originalEvent.changedTouches[0].pageY}position=position-input.data('selector').find('.miniColors-colors').offset().top-1;if(position<=-1)position=-1;if(position>=149)position=149;input.data('huePosition',position);huePicker.css('top',position).show();var h=Math.round((150-position-1)*2.4);if(h<0)h=0;if(h>360)h=360;var hsb=input.data('hsb');hsb.h=h;setColor(input,hsb,true)};var moveOpacity=function(input,event){var opacityPicker=input.data('opacityPicker');opacityPicker.hide();var position=event.pageY;if(event.originalEvent.changedTouches){position=event.originalEvent.changedTouches[0].pageY}position=position-input.data('selector').find('.miniColors-colors').offset().top-1;if(position<=-1)position=-1;if(position>=149)position=149;input.data('opacityPosition',position);opacityPicker.css('top',position).show();var alpha=parseFloat((150-position-1)/150).toFixed(2);if(alpha<0)alpha=0;if(alpha>1)alpha=1;input.data('alpha',alpha).attr('data-opacity',alpha);setColor(input,input.data('hsb'),true)};var setColor=function(input,hsb,updateInput){input.data('hsb',hsb);var hex=hsb2hex(hsb),selector=$(input.data('selector'));if(updateInput)input.val('#'+convertCase(hex,input.data('letterCase')));selector.find('.miniColors-colors').css('backgroundColor','#'+hsb2hex({h:hsb.h,s:100,b:100})).end().find('.miniColors-opacity').css('backgroundColor','#'+hex).end();var rgb=hsb2rgb(hsb);input.data('trigger').css('backgroundColor','#'+hex);if(input.data('opacity')){input.data('trigger').css('backgroundColor','rgba('+rgb.r+', '+rgb.g+', '+rgb.b+', '+input.attr('data-opacity')+')')}if(input.data('change')){if((hex+','+input.attr('data-opacity'))===input.data('lastChange'))return;input.data('change').call(input.get(0),'#'+hex,$.extend(hsb2rgb(hsb),{a:parseFloat(input.attr('data-opacity'))}));input.data('lastChange',hex+','+input.attr('data-opacity'))}};var setColorFromInput=function(input){input.val('#'+cleanHex(input.val()));var hex=expandHex(input.val());if(!hex)return false;var hsb=hex2hsb(hex);var colorPosition=getColorPositionFromHSB(hsb);var colorPicker=$(input.data('colorPicker'));colorPicker.css('top',colorPosition.y+'px').css('left',colorPosition.x+'px');input.data('colorPosition',colorPosition);var huePosition=getHuePositionFromHSB(hsb);var huePicker=$(input.data('huePicker'));huePicker.css('top',huePosition+'px');input.data('huePosition',huePosition);var opacityPosition=getOpacityPositionFromAlpha(input.attr('data-opacity'));var opacityPicker=$(input.data('opacityPicker'));opacityPicker.css('top',opacityPosition+'px');input.data('opacityPosition',opacityPosition);setColor(input,hsb);return true};var convertCase=function(string,letterCase){if(letterCase==='uppercase'){return string.toUpperCase()}else{return string.toLowerCase()}};var getColorPositionFromHSB=function(hsb){var x=Math.ceil(hsb.s/0.67);if(x<0)x=0;if(x>150)x=150;var y=150-Math.ceil(hsb.b/0.67);if(y<0)y=0;if(y>150)y=150;return{x:x-5,y:y-5}};var getHuePositionFromHSB=function(hsb){var y=150-(hsb.h/2.4);if(y<0)h=0;if(y>150)h=150;return y};var getOpacityPositionFromAlpha=function(alpha){var y=150*alpha;if(y<0)y=0;if(y>150)y=150;return 150-y};var cleanHex=function(hex){return hex.replace(/[^A-F0-9]/ig,'')};var expandHex=function(hex){hex=cleanHex(hex);if(!hex)return null;if(hex.length===3)hex=hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2];return hex.length===6?hex:null};var hsb2rgb=function(hsb){var rgb={};var h=Math.round(hsb.h);var s=Math.round(hsb.s*255/100);var v=Math.round(hsb.b*255/100);if(s===0){rgb.r=rgb.g=rgb.b=v}else{var t1=v;var t2=(255-s)*v/255;var t3=(t1-t2)*(h%60)/60;if(h===360)h=0;if(h<60){rgb.r=t1;rgb.b=t2;rgb.g=t2+t3}else if(h<120){rgb.g=t1;rgb.b=t2;rgb.r=t1-t3}else if(h<180){rgb.g=t1;rgb.r=t2;rgb.b=t2+t3}else if(h<240){rgb.b=t1;rgb.r=t2;rgb.g=t1-t3}else if(h<300){rgb.b=t1;rgb.g=t2;rgb.r=t2+t3}else if(h<360){rgb.r=t1;rgb.g=t2;rgb.b=t1-t3}else{rgb.r=0;rgb.g=0;rgb.b=0}}return{r:Math.round(rgb.r),g:Math.round(rgb.g),b:Math.round(rgb.b)}};var rgb2hex=function(rgb){var hex=[rgb.r.toString(16),rgb.g.toString(16),rgb.b.toString(16)];$.each(hex,function(nr,val){if(val.length===1)hex[nr]='0'+val});return hex.join('')};var hex2rgb=function(hex){hex=parseInt(((hex.indexOf('#')>-1)?hex.substring(1):hex),16);return{r:hex>>16,g:(hex&0x00FF00)>>8,b:(hex&0x0000FF)}};var rgb2hsb=function(rgb){var hsb={h:0,s:0,b:0};var min=Math.min(rgb.r,rgb.g,rgb.b);var max=Math.max(rgb.r,rgb.g,rgb.b);var delta=max-min;hsb.b=max;hsb.s=max!==0?255*delta/max:0;if(hsb.s!==0){if(rgb.r===max){hsb.h=(rgb.g-rgb.b)/delta}else if(rgb.g===max){hsb.h=2+(rgb.b-rgb.r)/delta}else{hsb.h=4+(rgb.r-rgb.g)/delta}}else{hsb.h=-1}hsb.h*=60;if(hsb.h<0){hsb.h+=360}hsb.s*=100/255;hsb.b*=100/255;return hsb};var hex2hsb=function(hex){var hsb=rgb2hsb(hex2rgb(hex));if(hsb.s===0)hsb.h=360;return hsb};var hsb2hex=function(hsb){return rgb2hex(hsb2rgb(hsb))};switch(o){case'readonly':$(this).each(function(){if(!$(this).hasClass('miniColors'))return;$(this).prop('readonly',data)});return $(this);case'disabled':$(this).each(function(){if(!$(this).hasClass('miniColors'))return;if(data){disable($(this))}else{enable($(this))}});return $(this);case'value':if(data===undefined){if(!$(this).hasClass('miniColors'))return;var input=$(this),hex=expandHex(input.val());return hex?'#'+convertCase(hex,input.data('letterCase')):null}$(this).each(function(){if(!$(this).hasClass('miniColors'))return;$(this).val(data);setColorFromInput($(this))});return $(this);case'opacity':if(data===undefined){if(!$(this).hasClass('miniColors'))return;if($(this).data('opacity')){return parseFloat($(this).attr('data-opacity'))}else{return null}}$(this).each(function(){if(!$(this).hasClass('miniColors'))return;if(data<0)data=0;if(data>1)data=1;$(this).attr('data-opacity',data).data('alpha',data);setColorFromInput($(this))});return $(this);case'destroy':$(this).each(function(){if(!$(this).hasClass('miniColors'))return;destroy($(this))});return $(this);default:if(!o)o={};$(this).each(function(){if($(this)[0].tagName.toLowerCase()!=='input')return;if($(this).data('trigger'))return;create($(this),o,data)});return $(this)}}})})(jQuery); \ No newline at end of file diff --git a/3rdparty/php-cloudfiles/cloudfiles.php b/3rdparty/php-cloudfiles/cloudfiles.php index 5f7e2100a9..7b1014265e 100644 --- a/3rdparty/php-cloudfiles/cloudfiles.php +++ b/3rdparty/php-cloudfiles/cloudfiles.php @@ -2000,7 +2000,7 @@ class CF_Object // } //use OC's mimetype detection for files - if(is_file($handle)){ + if(@is_file($handle)){ $this->content_type=OC_Helper::getMimeType($handle); }else{ $this->content_type=OC_Helper::getStringMimeType($handle); @@ -2537,7 +2537,7 @@ class CF_Object } $md5 = hash_final($ctx, false); rewind($data); - } elseif ((string)is_file($data)) { + } elseif ((string)@is_file($data)) { $md5 = md5_file($data); } else { $md5 = md5($data); diff --git a/3rdparty/simpletest/HELP_MY_TESTS_DONT_WORK_ANYMORE b/3rdparty/simpletest/HELP_MY_TESTS_DONT_WORK_ANYMORE deleted file mode 100644 index a65e83e876..0000000000 --- a/3rdparty/simpletest/HELP_MY_TESTS_DONT_WORK_ANYMORE +++ /dev/null @@ -1,399 +0,0 @@ -Simple Test interface changes -============================= -Because the SimpleTest tool set is still evolving it is likely that tests -written with earlier versions will fail with the newest ones. The most -dramatic changes are in the alpha releases. Here is a list of possible -problems and their fixes... - -assertText() no longer finds a string inside a ', 'js'); - $this->mapHandler('comment', 'ignore'); - $this->addEntryPattern('', 'comment'); - } - - /** - * Pattern matches to start and end a tag. - * @param string $tag Name of tag to scan for. - * @access private - */ - protected function addTag($tag) { - $this->addSpecialPattern("", 'text', 'acceptEndToken'); - $this->addEntryPattern("<$tag", 'text', 'tag'); - } - - /** - * Pattern matches to parse the inside of a tag - * including the attributes and their quoting. - * @access private - */ - protected function addInTagTokens() { - $this->mapHandler('tag', 'acceptStartToken'); - $this->addSpecialPattern('\s+', 'tag', 'ignore'); - $this->addAttributeTokens(); - $this->addExitPattern('/>', 'tag'); - $this->addExitPattern('>', 'tag'); - } - - /** - * Matches attributes that are either single quoted, - * double quoted or unquoted. - * @access private - */ - protected function addAttributeTokens() { - $this->mapHandler('dq_attribute', 'acceptAttributeToken'); - $this->addEntryPattern('=\s*"', 'tag', 'dq_attribute'); - $this->addPattern("\\\\\"", 'dq_attribute'); - $this->addExitPattern('"', 'dq_attribute'); - $this->mapHandler('sq_attribute', 'acceptAttributeToken'); - $this->addEntryPattern("=\s*'", 'tag', 'sq_attribute'); - $this->addPattern("\\\\'", 'sq_attribute'); - $this->addExitPattern("'", 'sq_attribute'); - $this->mapHandler('uq_attribute', 'acceptAttributeToken'); - $this->addSpecialPattern('=\s*[^>\s]*', 'tag', 'uq_attribute'); - } -} - -/** - * Converts HTML tokens into selected SAX events. - * @package SimpleTest - * @subpackage WebTester - */ -class SimpleHtmlSaxParser { - private $lexer; - private $listener; - private $tag; - private $attributes; - private $current_attribute; - - /** - * Sets the listener. - * @param SimplePhpPageBuilder $listener SAX event handler. - * @access public - */ - function __construct($listener) { - $this->listener = $listener; - $this->lexer = $this->createLexer($this); - $this->tag = ''; - $this->attributes = array(); - $this->current_attribute = ''; - } - - /** - * Runs the content through the lexer which - * should call back to the acceptors. - * @param string $raw Page text to parse. - * @return boolean False if parse error. - * @access public - */ - function parse($raw) { - return $this->lexer->parse($raw); - } - - /** - * Sets up the matching lexer. Starts in 'text' mode. - * @param SimpleSaxParser $parser Event generator, usually $self. - * @return SimpleLexer Lexer suitable for this parser. - * @access public - */ - static function createLexer(&$parser) { - return new SimpleHtmlLexer($parser); - } - - /** - * Accepts a token from the tag mode. If the - * starting element completes then the element - * is dispatched and the current attributes - * set back to empty. The element or attribute - * name is converted to lower case. - * @param string $token Incoming characters. - * @param integer $event Lexer event type. - * @return boolean False if parse error. - * @access public - */ - function acceptStartToken($token, $event) { - if ($event == LEXER_ENTER) { - $this->tag = strtolower(substr($token, 1)); - return true; - } - if ($event == LEXER_EXIT) { - $success = $this->listener->startElement( - $this->tag, - $this->attributes); - $this->tag = ''; - $this->attributes = array(); - return $success; - } - if ($token != '=') { - $this->current_attribute = strtolower(html_entity_decode($token, ENT_QUOTES)); - $this->attributes[$this->current_attribute] = ''; - } - return true; - } - - /** - * Accepts a token from the end tag mode. - * The element name is converted to lower case. - * @param string $token Incoming characters. - * @param integer $event Lexer event type. - * @return boolean False if parse error. - * @access public - */ - function acceptEndToken($token, $event) { - if (! preg_match('/<\/(.*)>/', $token, $matches)) { - return false; - } - return $this->listener->endElement(strtolower($matches[1])); - } - - /** - * Part of the tag data. - * @param string $token Incoming characters. - * @param integer $event Lexer event type. - * @return boolean False if parse error. - * @access public - */ - function acceptAttributeToken($token, $event) { - if ($this->current_attribute) { - if ($event == LEXER_UNMATCHED) { - $this->attributes[$this->current_attribute] .= - html_entity_decode($token, ENT_QUOTES); - } - if ($event == LEXER_SPECIAL) { - $this->attributes[$this->current_attribute] .= - preg_replace('/^=\s*/' , '', html_entity_decode($token, ENT_QUOTES)); - } - } - return true; - } - - /** - * A character entity. - * @param string $token Incoming characters. - * @param integer $event Lexer event type. - * @return boolean False if parse error. - * @access public - */ - function acceptEntityToken($token, $event) { - } - - /** - * Character data between tags regarded as - * important. - * @param string $token Incoming characters. - * @param integer $event Lexer event type. - * @return boolean False if parse error. - * @access public - */ - function acceptTextToken($token, $event) { - return $this->listener->addContent($token); - } - - /** - * Incoming data to be ignored. - * @param string $token Incoming characters. - * @param integer $event Lexer event type. - * @return boolean False if parse error. - * @access public - */ - function ignore($token, $event) { - return true; - } -} - -/** - * SAX event handler. Maintains a list of - * open tags and dispatches them as they close. - * @package SimpleTest - * @subpackage WebTester - */ -class SimplePhpPageBuilder { - private $tags; - private $page; - private $private_content_tag; - private $open_forms = array(); - private $complete_forms = array(); - private $frameset = false; - private $loading_frames = array(); - private $frameset_nesting_level = 0; - private $left_over_labels = array(); - - /** - * Frees up any references so as to allow the PHP garbage - * collection from unset() to work. - * @access public - */ - function free() { - unset($this->tags); - unset($this->page); - unset($this->private_content_tags); - $this->open_forms = array(); - $this->complete_forms = array(); - $this->frameset = false; - $this->loading_frames = array(); - $this->frameset_nesting_level = 0; - $this->left_over_labels = array(); - } - - /** - * This builder is always available. - * @return boolean Always true. - */ - function can() { - return true; - } - - /** - * Reads the raw content and send events - * into the page to be built. - * @param $response SimpleHttpResponse Fetched response. - * @return SimplePage Newly parsed page. - * @access public - */ - function parse($response) { - $this->tags = array(); - $this->page = $this->createPage($response); - $parser = $this->createParser($this); - $parser->parse($response->getContent()); - $this->acceptPageEnd(); - $page = $this->page; - $this->free(); - return $page; - } - - /** - * Creates an empty page. - * @return SimplePage New unparsed page. - * @access protected - */ - protected function createPage($response) { - return new SimplePage($response); - } - - /** - * Creates the parser used with the builder. - * @param SimplePhpPageBuilder $listener Target of parser. - * @return SimpleSaxParser Parser to generate - * events for the builder. - * @access protected - */ - protected function createParser(&$listener) { - return new SimpleHtmlSaxParser($listener); - } - - /** - * Start of element event. Opens a new tag. - * @param string $name Element name. - * @param hash $attributes Attributes without content - * are marked as true. - * @return boolean False on parse error. - * @access public - */ - function startElement($name, $attributes) { - $factory = new SimpleTagBuilder(); - $tag = $factory->createTag($name, $attributes); - if (! $tag) { - return true; - } - if ($tag->getTagName() == 'label') { - $this->acceptLabelStart($tag); - $this->openTag($tag); - return true; - } - if ($tag->getTagName() == 'form') { - $this->acceptFormStart($tag); - return true; - } - if ($tag->getTagName() == 'frameset') { - $this->acceptFramesetStart($tag); - return true; - } - if ($tag->getTagName() == 'frame') { - $this->acceptFrame($tag); - return true; - } - if ($tag->isPrivateContent() && ! isset($this->private_content_tag)) { - $this->private_content_tag = &$tag; - } - if ($tag->expectEndTag()) { - $this->openTag($tag); - return true; - } - $this->acceptTag($tag); - return true; - } - - /** - * End of element event. - * @param string $name Element name. - * @return boolean False on parse error. - * @access public - */ - function endElement($name) { - if ($name == 'label') { - $this->acceptLabelEnd(); - return true; - } - if ($name == 'form') { - $this->acceptFormEnd(); - return true; - } - if ($name == 'frameset') { - $this->acceptFramesetEnd(); - return true; - } - if ($this->hasNamedTagOnOpenTagStack($name)) { - $tag = array_pop($this->tags[$name]); - if ($tag->isPrivateContent() && $this->private_content_tag->getTagName() == $name) { - unset($this->private_content_tag); - } - $this->addContentTagToOpenTags($tag); - $this->acceptTag($tag); - return true; - } - return true; - } - - /** - * Test to see if there are any open tags awaiting - * closure that match the tag name. - * @param string $name Element name. - * @return boolean True if any are still open. - * @access private - */ - protected function hasNamedTagOnOpenTagStack($name) { - return isset($this->tags[$name]) && (count($this->tags[$name]) > 0); - } - - /** - * Unparsed, but relevant data. The data is added - * to every open tag. - * @param string $text May include unparsed tags. - * @return boolean False on parse error. - * @access public - */ - function addContent($text) { - if (isset($this->private_content_tag)) { - $this->private_content_tag->addContent($text); - } else { - $this->addContentToAllOpenTags($text); - } - return true; - } - - /** - * Any content fills all currently open tags unless it - * is part of an option tag. - * @param string $text May include unparsed tags. - * @access private - */ - protected function addContentToAllOpenTags($text) { - foreach (array_keys($this->tags) as $name) { - for ($i = 0, $count = count($this->tags[$name]); $i < $count; $i++) { - $this->tags[$name][$i]->addContent($text); - } - } - } - - /** - * Parsed data in tag form. The parsed tag is added - * to every open tag. Used for adding options to select - * fields only. - * @param SimpleTag $tag Option tags only. - * @access private - */ - protected function addContentTagToOpenTags(&$tag) { - if ($tag->getTagName() != 'option') { - return; - } - foreach (array_keys($this->tags) as $name) { - for ($i = 0, $count = count($this->tags[$name]); $i < $count; $i++) { - $this->tags[$name][$i]->addTag($tag); - } - } - } - - /** - * Opens a tag for receiving content. Multiple tags - * will be receiving input at the same time. - * @param SimpleTag $tag New content tag. - * @access private - */ - protected function openTag($tag) { - $name = $tag->getTagName(); - if (! in_array($name, array_keys($this->tags))) { - $this->tags[$name] = array(); - } - $this->tags[$name][] = $tag; - } - - /** - * Adds a tag to the page. - * @param SimpleTag $tag Tag to accept. - * @access public - */ - protected function acceptTag($tag) { - if ($tag->getTagName() == "a") { - $this->page->addLink($tag); - } elseif ($tag->getTagName() == "base") { - $this->page->setBase($tag->getAttribute('href')); - } elseif ($tag->getTagName() == "title") { - $this->page->setTitle($tag); - } elseif ($this->isFormElement($tag->getTagName())) { - for ($i = 0; $i < count($this->open_forms); $i++) { - $this->open_forms[$i]->addWidget($tag); - } - $this->last_widget = $tag; - } - } - - /** - * Opens a label for a described widget. - * @param SimpleFormTag $tag Tag to accept. - * @access public - */ - protected function acceptLabelStart($tag) { - $this->label = $tag; - unset($this->last_widget); - } - - /** - * Closes the most recently opened label. - * @access public - */ - protected function acceptLabelEnd() { - if (isset($this->label)) { - if (isset($this->last_widget)) { - $this->last_widget->setLabel($this->label->getText()); - unset($this->last_widget); - } else { - $this->left_over_labels[] = SimpleTestCompatibility::copy($this->label); - } - unset($this->label); - } - } - - /** - * Tests to see if a tag is a possible form - * element. - * @param string $name HTML element name. - * @return boolean True if form element. - * @access private - */ - protected function isFormElement($name) { - return in_array($name, array('input', 'button', 'textarea', 'select')); - } - - /** - * Opens a form. New widgets go here. - * @param SimpleFormTag $tag Tag to accept. - * @access public - */ - protected function acceptFormStart($tag) { - $this->open_forms[] = new SimpleForm($tag, $this->page); - } - - /** - * Closes the most recently opened form. - * @access public - */ - protected function acceptFormEnd() { - if (count($this->open_forms)) { - $this->complete_forms[] = array_pop($this->open_forms); - } - } - - /** - * Opens a frameset. A frameset may contain nested - * frameset tags. - * @param SimpleFramesetTag $tag Tag to accept. - * @access public - */ - protected function acceptFramesetStart($tag) { - if (! $this->isLoadingFrames()) { - $this->frameset = $tag; - } - $this->frameset_nesting_level++; - } - - /** - * Closes the most recently opened frameset. - * @access public - */ - protected function acceptFramesetEnd() { - if ($this->isLoadingFrames()) { - $this->frameset_nesting_level--; - } - } - - /** - * Takes a single frame tag and stashes it in - * the current frame set. - * @param SimpleFrameTag $tag Tag to accept. - * @access public - */ - protected function acceptFrame($tag) { - if ($this->isLoadingFrames()) { - if ($tag->getAttribute('src')) { - $this->loading_frames[] = $tag; - } - } - } - - /** - * Test to see if in the middle of reading - * a frameset. - * @return boolean True if inframeset. - * @access private - */ - protected function isLoadingFrames() { - return $this->frameset and $this->frameset_nesting_level > 0; - } - - /** - * Marker for end of complete page. Any work in - * progress can now be closed. - * @access public - */ - protected function acceptPageEnd() { - while (count($this->open_forms)) { - $this->complete_forms[] = array_pop($this->open_forms); - } - foreach ($this->left_over_labels as $label) { - for ($i = 0, $count = count($this->complete_forms); $i < $count; $i++) { - $this->complete_forms[$i]->attachLabelBySelector( - new SimpleById($label->getFor()), - $label->getText()); - } - } - $this->page->setForms($this->complete_forms); - $this->page->setFrames($this->loading_frames); - } -} -?> \ No newline at end of file diff --git a/3rdparty/simpletest/recorder.php b/3rdparty/simpletest/recorder.php deleted file mode 100644 index b3d0d01c62..0000000000 --- a/3rdparty/simpletest/recorder.php +++ /dev/null @@ -1,101 +0,0 @@ -time, $this->breadcrumb, $this->message) = - array(time(), $breadcrumb, $message); - } -} - -/** - * A single pass captured for later. - * @package SimpleTest - * @subpackage Extensions - */ -class SimpleResultOfPass extends SimpleResult { } - -/** - * A single failure captured for later. - * @package SimpleTest - * @subpackage Extensions - */ -class SimpleResultOfFail extends SimpleResult { } - -/** - * A single exception captured for later. - * @package SimpleTest - * @subpackage Extensions - */ -class SimpleResultOfException extends SimpleResult { } - -/** - * Array-based test recorder. Returns an array - * with timestamp, status, test name and message for each pass and failure. - * @package SimpleTest - * @subpackage Extensions - */ -class Recorder extends SimpleReporterDecorator { - public $results = array(); - - /** - * Stashes the pass as a SimpleResultOfPass - * for later retrieval. - * @param string $message Pass message to be displayed - * eventually. - */ - function paintPass($message) { - parent::paintPass($message); - $this->results[] = new SimpleResultOfPass(parent::getTestList(), $message); - } - - /** - * Stashes the fail as a SimpleResultOfFail - * for later retrieval. - * @param string $message Failure message to be displayed - * eventually. - */ - function paintFail($message) { - parent::paintFail($message); - $this->results[] = new SimpleResultOfFail(parent::getTestList(), $message); - } - - /** - * Stashes the exception as a SimpleResultOfException - * for later retrieval. - * @param string $message Exception message to be displayed - * eventually. - */ - function paintException($message) { - parent::paintException($message); - $this->results[] = new SimpleResultOfException(parent::getTestList(), $message); - } -} -?> \ No newline at end of file diff --git a/3rdparty/simpletest/reflection_php4.php b/3rdparty/simpletest/reflection_php4.php deleted file mode 100644 index 39801ea1bd..0000000000 --- a/3rdparty/simpletest/reflection_php4.php +++ /dev/null @@ -1,136 +0,0 @@ -_interface = $interface; - } - - /** - * Checks that a class has been declared. - * @return boolean True if defined. - * @access public - */ - function classExists() { - return class_exists($this->_interface); - } - - /** - * Needed to kill the autoload feature in PHP5 - * for classes created dynamically. - * @return boolean True if defined. - * @access public - */ - function classExistsSansAutoload() { - return class_exists($this->_interface); - } - - /** - * Checks that a class or interface has been - * declared. - * @return boolean True if defined. - * @access public - */ - function classOrInterfaceExists() { - return class_exists($this->_interface); - } - - /** - * Needed to kill the autoload feature in PHP5 - * for classes created dynamically. - * @return boolean True if defined. - * @access public - */ - function classOrInterfaceExistsSansAutoload() { - return class_exists($this->_interface); - } - - /** - * Gets the list of methods on a class or - * interface. - * @returns array List of method names. - * @access public - */ - function getMethods() { - return get_class_methods($this->_interface); - } - - /** - * Gets the list of interfaces from a class. If the - * class name is actually an interface then just that - * interface is returned. - * @returns array List of interfaces. - * @access public - */ - function getInterfaces() { - return array(); - } - - /** - * Finds the parent class name. - * @returns string Parent class name. - * @access public - */ - function getParent() { - return strtolower(get_parent_class($this->_interface)); - } - - /** - * Determines if the class is abstract, which for PHP 4 - * will never be the case. - * @returns boolean True if abstract. - * @access public - */ - function isAbstract() { - return false; - } - - /** - * Determines if the the entity is an interface, which for PHP 4 - * will never be the case. - * @returns boolean True if interface. - * @access public - */ - function isInterface() { - return false; - } - - /** - * Scans for final methods, but as it's PHP 4 there - * aren't any. - * @returns boolean True if the class has a final method. - * @access public - */ - function hasFinal() { - return false; - } - - /** - * Gets the source code matching the declaration - * of a method. - * @param string $method Method name. - * @access public - */ - function getSignature($method) { - return "function &$method()"; - } -} -?> \ No newline at end of file diff --git a/3rdparty/simpletest/reflection_php5.php b/3rdparty/simpletest/reflection_php5.php deleted file mode 100644 index 43d8a7b287..0000000000 --- a/3rdparty/simpletest/reflection_php5.php +++ /dev/null @@ -1,386 +0,0 @@ -interface = $interface; - } - - /** - * Checks that a class has been declared. Versions - * before PHP5.0.2 need a check that it's not really - * an interface. - * @return boolean True if defined. - * @access public - */ - function classExists() { - if (! class_exists($this->interface)) { - return false; - } - $reflection = new ReflectionClass($this->interface); - return ! $reflection->isInterface(); - } - - /** - * Needed to kill the autoload feature in PHP5 - * for classes created dynamically. - * @return boolean True if defined. - * @access public - */ - function classExistsSansAutoload() { - return class_exists($this->interface, false); - } - - /** - * Checks that a class or interface has been - * declared. - * @return boolean True if defined. - * @access public - */ - function classOrInterfaceExists() { - return $this->classOrInterfaceExistsWithAutoload($this->interface, true); - } - - /** - * Needed to kill the autoload feature in PHP5 - * for classes created dynamically. - * @return boolean True if defined. - * @access public - */ - function classOrInterfaceExistsSansAutoload() { - return $this->classOrInterfaceExistsWithAutoload($this->interface, false); - } - - /** - * Needed to select the autoload feature in PHP5 - * for classes created dynamically. - * @param string $interface Class or interface name. - * @param boolean $autoload True totriggerautoload. - * @return boolean True if interface defined. - * @access private - */ - protected function classOrInterfaceExistsWithAutoload($interface, $autoload) { - if (function_exists('interface_exists')) { - if (interface_exists($this->interface, $autoload)) { - return true; - } - } - return class_exists($this->interface, $autoload); - } - - /** - * Gets the list of methods on a class or - * interface. - * @returns array List of method names. - * @access public - */ - function getMethods() { - return array_unique(get_class_methods($this->interface)); - } - - /** - * Gets the list of interfaces from a class. If the - * class name is actually an interface then just that - * interface is returned. - * @returns array List of interfaces. - * @access public - */ - function getInterfaces() { - $reflection = new ReflectionClass($this->interface); - if ($reflection->isInterface()) { - return array($this->interface); - } - return $this->onlyParents($reflection->getInterfaces()); - } - - /** - * Gets the list of methods for the implemented - * interfaces only. - * @returns array List of enforced method signatures. - * @access public - */ - function getInterfaceMethods() { - $methods = array(); - foreach ($this->getInterfaces() as $interface) { - $methods = array_merge($methods, get_class_methods($interface)); - } - return array_unique($methods); - } - - /** - * Checks to see if the method signature has to be tightly - * specified. - * @param string $method Method name. - * @returns boolean True if enforced. - * @access private - */ - protected function isInterfaceMethod($method) { - return in_array($method, $this->getInterfaceMethods()); - } - - /** - * Finds the parent class name. - * @returns string Parent class name. - * @access public - */ - function getParent() { - $reflection = new ReflectionClass($this->interface); - $parent = $reflection->getParentClass(); - if ($parent) { - return $parent->getName(); - } - return false; - } - - /** - * Trivially determines if the class is abstract. - * @returns boolean True if abstract. - * @access public - */ - function isAbstract() { - $reflection = new ReflectionClass($this->interface); - return $reflection->isAbstract(); - } - - /** - * Trivially determines if the class is an interface. - * @returns boolean True if interface. - * @access public - */ - function isInterface() { - $reflection = new ReflectionClass($this->interface); - return $reflection->isInterface(); - } - - /** - * Scans for final methods, as they screw up inherited - * mocks by not allowing you to override them. - * @returns boolean True if the class has a final method. - * @access public - */ - function hasFinal() { - $reflection = new ReflectionClass($this->interface); - foreach ($reflection->getMethods() as $method) { - if ($method->isFinal()) { - return true; - } - } - return false; - } - - /** - * Whittles a list of interfaces down to only the - * necessary top level parents. - * @param array $interfaces Reflection API interfaces - * to reduce. - * @returns array List of parent interface names. - * @access private - */ - protected function onlyParents($interfaces) { - $parents = array(); - $blacklist = array(); - foreach ($interfaces as $interface) { - foreach($interfaces as $possible_parent) { - if ($interface->getName() == $possible_parent->getName()) { - continue; - } - if ($interface->isSubClassOf($possible_parent)) { - $blacklist[$possible_parent->getName()] = true; - } - } - if (!isset($blacklist[$interface->getName()])) { - $parents[] = $interface->getName(); - } - } - return $parents; - } - - /** - * Checks whether a method is abstract or not. - * @param string $name Method name. - * @return bool true if method is abstract, else false - * @access private - */ - protected function isAbstractMethod($name) { - $interface = new ReflectionClass($this->interface); - if (! $interface->hasMethod($name)) { - return false; - } - return $interface->getMethod($name)->isAbstract(); - } - - /** - * Checks whether a method is the constructor. - * @param string $name Method name. - * @return bool true if method is the constructor - * @access private - */ - protected function isConstructor($name) { - return ($name == '__construct') || ($name == $this->interface); - } - - /** - * Checks whether a method is abstract in all parents or not. - * @param string $name Method name. - * @return bool true if method is abstract in parent, else false - * @access private - */ - protected function isAbstractMethodInParents($name) { - $interface = new ReflectionClass($this->interface); - $parent = $interface->getParentClass(); - while($parent) { - if (! $parent->hasMethod($name)) { - return false; - } - if ($parent->getMethod($name)->isAbstract()) { - return true; - } - $parent = $parent->getParentClass(); - } - return false; - } - - /** - * Checks whether a method is static or not. - * @param string $name Method name - * @return bool true if method is static, else false - * @access private - */ - protected function isStaticMethod($name) { - $interface = new ReflectionClass($this->interface); - if (! $interface->hasMethod($name)) { - return false; - } - return $interface->getMethod($name)->isStatic(); - } - - /** - * Writes the source code matching the declaration - * of a method. - * @param string $name Method name. - * @return string Method signature up to last - * bracket. - * @access public - */ - function getSignature($name) { - if ($name == '__set') { - return 'function __set($key, $value)'; - } - if ($name == '__call') { - return 'function __call($method, $arguments)'; - } - if (version_compare(phpversion(), '5.1.0', '>=')) { - if (in_array($name, array('__get', '__isset', $name == '__unset'))) { - return "function {$name}(\$key)"; - } - } - if ($name == '__toString') { - return "function $name()"; - } - - // This wonky try-catch is a work around for a faulty method_exists() - // in early versions of PHP 5 which would return false for static - // methods. The Reflection classes work fine, but hasMethod() - // doesn't exist prior to PHP 5.1.0, so we need to use a more crude - // detection method. - try { - $interface = new ReflectionClass($this->interface); - $interface->getMethod($name); - } catch (ReflectionException $e) { - return "function $name()"; - } - return $this->getFullSignature($name); - } - - /** - * For a signature specified in an interface, full - * details must be replicated to be a valid implementation. - * @param string $name Method name. - * @return string Method signature up to last - * bracket. - * @access private - */ - protected function getFullSignature($name) { - $interface = new ReflectionClass($this->interface); - $method = $interface->getMethod($name); - $reference = $method->returnsReference() ? '&' : ''; - $static = $method->isStatic() ? 'static ' : ''; - return "{$static}function $reference$name(" . - implode(', ', $this->getParameterSignatures($method)) . - ")"; - } - - /** - * Gets the source code for each parameter. - * @param ReflectionMethod $method Method object from - * reflection API - * @return array List of strings, each - * a snippet of code. - * @access private - */ - protected function getParameterSignatures($method) { - $signatures = array(); - foreach ($method->getParameters() as $parameter) { - $signature = ''; - $type = $parameter->getClass(); - if (is_null($type) && version_compare(phpversion(), '5.1.0', '>=') && $parameter->isArray()) { - $signature .= 'array '; - } elseif (!is_null($type)) { - $signature .= $type->getName() . ' '; - } - if ($parameter->isPassedByReference()) { - $signature .= '&'; - } - $signature .= '$' . $this->suppressSpurious($parameter->getName()); - if ($this->isOptional($parameter)) { - $signature .= ' = null'; - } - $signatures[] = $signature; - } - return $signatures; - } - - /** - * The SPL library has problems with the - * Reflection library. In particular, you can - * get extra characters in parameter names :(. - * @param string $name Parameter name. - * @return string Cleaner name. - * @access private - */ - protected function suppressSpurious($name) { - return str_replace(array('[', ']', ' '), '', $name); - } - - /** - * Test of a reflection parameter being optional - * that works with early versions of PHP5. - * @param reflectionParameter $parameter Is this optional. - * @return boolean True if optional. - * @access private - */ - protected function isOptional($parameter) { - if (method_exists($parameter, 'isOptional')) { - return $parameter->isOptional(); - } - return false; - } -} -?> \ No newline at end of file diff --git a/3rdparty/simpletest/remote.php b/3rdparty/simpletest/remote.php deleted file mode 100644 index 4bb37b7c51..0000000000 --- a/3rdparty/simpletest/remote.php +++ /dev/null @@ -1,115 +0,0 @@ -url = $url; - $this->dry_url = $dry_url ? $dry_url : $url; - $this->size = false; - } - - /** - * Accessor for the test name for subclasses. - * @return string Name of the test. - * @access public - */ - function getLabel() { - return $this->url; - } - - /** - * Runs the top level test for this class. Currently - * reads the data as a single chunk. I'll fix this - * once I have added iteration to the browser. - * @param SimpleReporter $reporter Target of test results. - * @returns boolean True if no failures. - * @access public - */ - function run($reporter) { - $browser = $this->createBrowser(); - $xml = $browser->get($this->url); - if (! $xml) { - trigger_error('Cannot read remote test URL [' . $this->url . ']'); - return false; - } - $parser = $this->createParser($reporter); - if (! $parser->parse($xml)) { - trigger_error('Cannot parse incoming XML from [' . $this->url . ']'); - return false; - } - return true; - } - - /** - * Creates a new web browser object for fetching - * the XML report. - * @return SimpleBrowser New browser. - * @access protected - */ - protected function createBrowser() { - return new SimpleBrowser(); - } - - /** - * Creates the XML parser. - * @param SimpleReporter $reporter Target of test results. - * @return SimpleTestXmlListener XML reader. - * @access protected - */ - protected function createParser($reporter) { - return new SimpleTestXmlParser($reporter); - } - - /** - * Accessor for the number of subtests. - * @return integer Number of test cases. - * @access public - */ - function getSize() { - if ($this->size === false) { - $browser = $this->createBrowser(); - $xml = $browser->get($this->dry_url); - if (! $xml) { - trigger_error('Cannot read remote test URL [' . $this->dry_url . ']'); - return false; - } - $reporter = new SimpleReporter(); - $parser = $this->createParser($reporter); - if (! $parser->parse($xml)) { - trigger_error('Cannot parse incoming XML from [' . $this->dry_url . ']'); - return false; - } - $this->size = $reporter->getTestCaseCount(); - } - return $this->size; - } -} -?> \ No newline at end of file diff --git a/3rdparty/simpletest/reporter.php b/3rdparty/simpletest/reporter.php deleted file mode 100644 index bd4f3fa41d..0000000000 --- a/3rdparty/simpletest/reporter.php +++ /dev/null @@ -1,445 +0,0 @@ -character_set = $character_set; - } - - /** - * Paints the top of the web page setting the - * title to the name of the starting test. - * @param string $test_name Name class of test. - * @access public - */ - function paintHeader($test_name) { - $this->sendNoCacheHeaders(); - print ""; - print "\n\n$test_name\n"; - print "\n"; - print "\n"; - print "\n\n"; - print "

                $test_name

                \n"; - flush(); - } - - /** - * Send the headers necessary to ensure the page is - * reloaded on every request. Otherwise you could be - * scratching your head over out of date test data. - * @access public - */ - static function sendNoCacheHeaders() { - if (! headers_sent()) { - header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); - header("Cache-Control: no-store, no-cache, must-revalidate"); - header("Cache-Control: post-check=0, pre-check=0", false); - header("Pragma: no-cache"); - } - } - - /** - * Paints the CSS. Add additional styles here. - * @return string CSS code as text. - * @access protected - */ - protected function getCss() { - return ".fail { background-color: inherit; color: red; }" . - ".pass { background-color: inherit; color: green; }" . - " pre { background-color: lightgray; color: inherit; }"; - } - - /** - * Paints the end of the test with a summary of - * the passes and failures. - * @param string $test_name Name class of test. - * @access public - */ - function paintFooter($test_name) { - $colour = ($this->getFailCount() + $this->getExceptionCount() > 0 ? "red" : "green"); - print "
                "; - print $this->getTestCaseProgress() . "/" . $this->getTestCaseCount(); - print " test cases complete:\n"; - print "" . $this->getPassCount() . " passes, "; - print "" . $this->getFailCount() . " fails and "; - print "" . $this->getExceptionCount() . " exceptions."; - print "
                \n"; - print "\n\n"; - } - - /** - * Paints the test failure with a breadcrumbs - * trail of the nesting test suites below the - * top level test. - * @param string $message Failure message displayed in - * the context of the other tests. - */ - function paintFail($message) { - parent::paintFail($message); - print "Fail: "; - $breadcrumb = $this->getTestList(); - array_shift($breadcrumb); - print implode(" -> ", $breadcrumb); - print " -> " . $this->htmlEntities($message) . "
                \n"; - } - - /** - * Paints a PHP error. - * @param string $message Message is ignored. - * @access public - */ - function paintError($message) { - parent::paintError($message); - print "Exception: "; - $breadcrumb = $this->getTestList(); - array_shift($breadcrumb); - print implode(" -> ", $breadcrumb); - print " -> " . $this->htmlEntities($message) . "
                \n"; - } - - /** - * Paints a PHP exception. - * @param Exception $exception Exception to display. - * @access public - */ - function paintException($exception) { - parent::paintException($exception); - print "Exception: "; - $breadcrumb = $this->getTestList(); - array_shift($breadcrumb); - print implode(" -> ", $breadcrumb); - $message = 'Unexpected exception of type [' . get_class($exception) . - '] with message ['. $exception->getMessage() . - '] in ['. $exception->getFile() . - ' line ' . $exception->getLine() . ']'; - print " -> " . $this->htmlEntities($message) . "
                \n"; - } - - /** - * Prints the message for skipping tests. - * @param string $message Text of skip condition. - * @access public - */ - function paintSkip($message) { - parent::paintSkip($message); - print "Skipped: "; - $breadcrumb = $this->getTestList(); - array_shift($breadcrumb); - print implode(" -> ", $breadcrumb); - print " -> " . $this->htmlEntities($message) . "
                \n"; - } - - /** - * Paints formatted text such as dumped privateiables. - * @param string $message Text to show. - * @access public - */ - function paintFormattedMessage($message) { - print '
                ' . $this->htmlEntities($message) . '
                '; - } - - /** - * Character set adjusted entity conversion. - * @param string $message Plain text or Unicode message. - * @return string Browser readable message. - * @access protected - */ - protected function htmlEntities($message) { - return htmlentities($message, ENT_COMPAT, $this->character_set); - } -} - -/** - * Sample minimal test displayer. Generates only - * failure messages and a pass count. For command - * line use. I've tried to make it look like JUnit, - * but I wanted to output the errors as they arrived - * which meant dropping the dots. - * @package SimpleTest - * @subpackage UnitTester - */ -class TextReporter extends SimpleReporter { - - /** - * Does nothing yet. The first output will - * be sent on the first test start. - */ - function __construct() { - parent::__construct(); - } - - /** - * Paints the title only. - * @param string $test_name Name class of test. - * @access public - */ - function paintHeader($test_name) { - if (! SimpleReporter::inCli()) { - header('Content-type: text/plain'); - } - print "$test_name\n"; - flush(); - } - - /** - * Paints the end of the test with a summary of - * the passes and failures. - * @param string $test_name Name class of test. - * @access public - */ - function paintFooter($test_name) { - if ($this->getFailCount() + $this->getExceptionCount() == 0) { - print "OK\n"; - } else { - print "FAILURES!!!\n"; - } - print "Test cases run: " . $this->getTestCaseProgress() . - "/" . $this->getTestCaseCount() . - ", Passes: " . $this->getPassCount() . - ", Failures: " . $this->getFailCount() . - ", Exceptions: " . $this->getExceptionCount() . "\n"; - } - - /** - * Paints the test failure as a stack trace. - * @param string $message Failure message displayed in - * the context of the other tests. - * @access public - */ - function paintFail($message) { - parent::paintFail($message); - print $this->getFailCount() . ") $message\n"; - $breadcrumb = $this->getTestList(); - array_shift($breadcrumb); - print "\tin " . implode("\n\tin ", array_reverse($breadcrumb)); - print "\n"; - } - - /** - * Paints a PHP error or exception. - * @param string $message Message to be shown. - * @access public - * @abstract - */ - function paintError($message) { - parent::paintError($message); - print "Exception " . $this->getExceptionCount() . "!\n$message\n"; - $breadcrumb = $this->getTestList(); - array_shift($breadcrumb); - print "\tin " . implode("\n\tin ", array_reverse($breadcrumb)); - print "\n"; - } - - /** - * Paints a PHP error or exception. - * @param Exception $exception Exception to describe. - * @access public - * @abstract - */ - function paintException($exception) { - parent::paintException($exception); - $message = 'Unexpected exception of type [' . get_class($exception) . - '] with message ['. $exception->getMessage() . - '] in ['. $exception->getFile() . - ' line ' . $exception->getLine() . ']'; - print "Exception " . $this->getExceptionCount() . "!\n$message\n"; - $breadcrumb = $this->getTestList(); - array_shift($breadcrumb); - print "\tin " . implode("\n\tin ", array_reverse($breadcrumb)); - print "\n"; - } - - /** - * Prints the message for skipping tests. - * @param string $message Text of skip condition. - * @access public - */ - function paintSkip($message) { - parent::paintSkip($message); - print "Skip: $message\n"; - } - - /** - * Paints formatted text such as dumped privateiables. - * @param string $message Text to show. - * @access public - */ - function paintFormattedMessage($message) { - print "$message\n"; - flush(); - } -} - -/** - * Runs just a single test group, a single case or - * even a single test within that case. - * @package SimpleTest - * @subpackage UnitTester - */ -class SelectiveReporter extends SimpleReporterDecorator { - private $just_this_case = false; - private $just_this_test = false; - private $on; - - /** - * Selects the test case or group to be run, - * and optionally a specific test. - * @param SimpleScorer $reporter Reporter to receive events. - * @param string $just_this_case Only this case or group will run. - * @param string $just_this_test Only this test method will run. - */ - function __construct($reporter, $just_this_case = false, $just_this_test = false) { - if (isset($just_this_case) && $just_this_case) { - $this->just_this_case = strtolower($just_this_case); - $this->off(); - } else { - $this->on(); - } - if (isset($just_this_test) && $just_this_test) { - $this->just_this_test = strtolower($just_this_test); - } - parent::__construct($reporter); - } - - /** - * Compares criteria to actual the case/group name. - * @param string $test_case The incoming test. - * @return boolean True if matched. - * @access protected - */ - protected function matchesTestCase($test_case) { - return $this->just_this_case == strtolower($test_case); - } - - /** - * Compares criteria to actual the test name. If no - * name was specified at the beginning, then all tests - * can run. - * @param string $method The incoming test method. - * @return boolean True if matched. - * @access protected - */ - protected function shouldRunTest($test_case, $method) { - if ($this->isOn() || $this->matchesTestCase($test_case)) { - if ($this->just_this_test) { - return $this->just_this_test == strtolower($method); - } else { - return true; - } - } - return false; - } - - /** - * Switch on testing for the group or subgroup. - * @access private - */ - protected function on() { - $this->on = true; - } - - /** - * Switch off testing for the group or subgroup. - * @access private - */ - protected function off() { - $this->on = false; - } - - /** - * Is this group actually being tested? - * @return boolean True if the current test group is active. - * @access private - */ - protected function isOn() { - return $this->on; - } - - /** - * Veto everything that doesn't match the method wanted. - * @param string $test_case Name of test case. - * @param string $method Name of test method. - * @return boolean True if test should be run. - * @access public - */ - function shouldInvoke($test_case, $method) { - if ($this->shouldRunTest($test_case, $method)) { - return $this->reporter->shouldInvoke($test_case, $method); - } - return false; - } - - /** - * Paints the start of a group test. - * @param string $test_case Name of test or other label. - * @param integer $size Number of test cases starting. - * @access public - */ - function paintGroupStart($test_case, $size) { - if ($this->just_this_case && $this->matchesTestCase($test_case)) { - $this->on(); - } - $this->reporter->paintGroupStart($test_case, $size); - } - - /** - * Paints the end of a group test. - * @param string $test_case Name of test or other label. - * @access public - */ - function paintGroupEnd($test_case) { - $this->reporter->paintGroupEnd($test_case); - if ($this->just_this_case && $this->matchesTestCase($test_case)) { - $this->off(); - } - } -} - -/** - * Suppresses skip messages. - * @package SimpleTest - * @subpackage UnitTester - */ -class NoSkipsReporter extends SimpleReporterDecorator { - - /** - * Does nothing. - * @param string $message Text of skip condition. - * @access public - */ - function paintSkip($message) { } -} -?> \ No newline at end of file diff --git a/3rdparty/simpletest/scorer.php b/3rdparty/simpletest/scorer.php deleted file mode 100644 index 27776f4b63..0000000000 --- a/3rdparty/simpletest/scorer.php +++ /dev/null @@ -1,875 +0,0 @@ -passes = 0; - $this->fails = 0; - $this->exceptions = 0; - $this->is_dry_run = false; - } - - /** - * Signals that the next evaluation will be a dry - * run. That is, the structure events will be - * recorded, but no tests will be run. - * @param boolean $is_dry Dry run if true. - * @access public - */ - function makeDry($is_dry = true) { - $this->is_dry_run = $is_dry; - } - - /** - * The reporter has a veto on what should be run. - * @param string $test_case_name name of test case. - * @param string $method Name of test method. - * @access public - */ - function shouldInvoke($test_case_name, $method) { - return ! $this->is_dry_run; - } - - /** - * Can wrap the invoker in preperation for running - * a test. - * @param SimpleInvoker $invoker Individual test runner. - * @return SimpleInvoker Wrapped test runner. - * @access public - */ - function createInvoker($invoker) { - return $invoker; - } - - /** - * Accessor for current status. Will be false - * if there have been any failures or exceptions. - * Used for command line tools. - * @return boolean True if no failures. - * @access public - */ - function getStatus() { - if ($this->exceptions + $this->fails > 0) { - return false; - } - return true; - } - - /** - * Paints the start of a group test. - * @param string $test_name Name of test or other label. - * @param integer $size Number of test cases starting. - * @access public - */ - function paintGroupStart($test_name, $size) { - } - - /** - * Paints the end of a group test. - * @param string $test_name Name of test or other label. - * @access public - */ - function paintGroupEnd($test_name) { - } - - /** - * Paints the start of a test case. - * @param string $test_name Name of test or other label. - * @access public - */ - function paintCaseStart($test_name) { - } - - /** - * Paints the end of a test case. - * @param string $test_name Name of test or other label. - * @access public - */ - function paintCaseEnd($test_name) { - } - - /** - * Paints the start of a test method. - * @param string $test_name Name of test or other label. - * @access public - */ - function paintMethodStart($test_name) { - } - - /** - * Paints the end of a test method. - * @param string $test_name Name of test or other label. - * @access public - */ - function paintMethodEnd($test_name) { - } - - /** - * Increments the pass count. - * @param string $message Message is ignored. - * @access public - */ - function paintPass($message) { - $this->passes++; - } - - /** - * Increments the fail count. - * @param string $message Message is ignored. - * @access public - */ - function paintFail($message) { - $this->fails++; - } - - /** - * Deals with PHP 4 throwing an error. - * @param string $message Text of error formatted by - * the test case. - * @access public - */ - function paintError($message) { - $this->exceptions++; - } - - /** - * Deals with PHP 5 throwing an exception. - * @param Exception $exception The actual exception thrown. - * @access public - */ - function paintException($exception) { - $this->exceptions++; - } - - /** - * Prints the message for skipping tests. - * @param string $message Text of skip condition. - * @access public - */ - function paintSkip($message) { - } - - /** - * Accessor for the number of passes so far. - * @return integer Number of passes. - * @access public - */ - function getPassCount() { - return $this->passes; - } - - /** - * Accessor for the number of fails so far. - * @return integer Number of fails. - * @access public - */ - function getFailCount() { - return $this->fails; - } - - /** - * Accessor for the number of untrapped errors - * so far. - * @return integer Number of exceptions. - * @access public - */ - function getExceptionCount() { - return $this->exceptions; - } - - /** - * Paints a simple supplementary message. - * @param string $message Text to display. - * @access public - */ - function paintMessage($message) { - } - - /** - * Paints a formatted ASCII message such as a - * privateiable dump. - * @param string $message Text to display. - * @access public - */ - function paintFormattedMessage($message) { - } - - /** - * By default just ignores user generated events. - * @param string $type Event type as text. - * @param mixed $payload Message or object. - * @access public - */ - function paintSignal($type, $payload) { - } -} - -/** - * Recipient of generated test messages that can display - * page footers and headers. Also keeps track of the - * test nesting. This is the main base class on which - * to build the finished test (page based) displays. - * @package SimpleTest - * @subpackage UnitTester - */ -class SimpleReporter extends SimpleScorer { - private $test_stack; - private $size; - private $progress; - - /** - * Starts the display with no results in. - * @access public - */ - function __construct() { - parent::__construct(); - $this->test_stack = array(); - $this->size = null; - $this->progress = 0; - } - - /** - * Gets the formatter for small generic data items. - * @return SimpleDumper Formatter. - * @access public - */ - function getDumper() { - return new SimpleDumper(); - } - - /** - * Paints the start of a group test. Will also paint - * the page header and footer if this is the - * first test. Will stash the size if the first - * start. - * @param string $test_name Name of test that is starting. - * @param integer $size Number of test cases starting. - * @access public - */ - function paintGroupStart($test_name, $size) { - if (! isset($this->size)) { - $this->size = $size; - } - if (count($this->test_stack) == 0) { - $this->paintHeader($test_name); - } - $this->test_stack[] = $test_name; - } - - /** - * Paints the end of a group test. Will paint the page - * footer if the stack of tests has unwound. - * @param string $test_name Name of test that is ending. - * @param integer $progress Number of test cases ending. - * @access public - */ - function paintGroupEnd($test_name) { - array_pop($this->test_stack); - if (count($this->test_stack) == 0) { - $this->paintFooter($test_name); - } - } - - /** - * Paints the start of a test case. Will also paint - * the page header and footer if this is the - * first test. Will stash the size if the first - * start. - * @param string $test_name Name of test that is starting. - * @access public - */ - function paintCaseStart($test_name) { - if (! isset($this->size)) { - $this->size = 1; - } - if (count($this->test_stack) == 0) { - $this->paintHeader($test_name); - } - $this->test_stack[] = $test_name; - } - - /** - * Paints the end of a test case. Will paint the page - * footer if the stack of tests has unwound. - * @param string $test_name Name of test that is ending. - * @access public - */ - function paintCaseEnd($test_name) { - $this->progress++; - array_pop($this->test_stack); - if (count($this->test_stack) == 0) { - $this->paintFooter($test_name); - } - } - - /** - * Paints the start of a test method. - * @param string $test_name Name of test that is starting. - * @access public - */ - function paintMethodStart($test_name) { - $this->test_stack[] = $test_name; - } - - /** - * Paints the end of a test method. Will paint the page - * footer if the stack of tests has unwound. - * @param string $test_name Name of test that is ending. - * @access public - */ - function paintMethodEnd($test_name) { - array_pop($this->test_stack); - } - - /** - * Paints the test document header. - * @param string $test_name First test top level - * to start. - * @access public - * @abstract - */ - function paintHeader($test_name) { - } - - /** - * Paints the test document footer. - * @param string $test_name The top level test. - * @access public - * @abstract - */ - function paintFooter($test_name) { - } - - /** - * Accessor for internal test stack. For - * subclasses that need to see the whole test - * history for display purposes. - * @return array List of methods in nesting order. - * @access public - */ - function getTestList() { - return $this->test_stack; - } - - /** - * Accessor for total test size in number - * of test cases. Null until the first - * test is started. - * @return integer Total number of cases at start. - * @access public - */ - function getTestCaseCount() { - return $this->size; - } - - /** - * Accessor for the number of test cases - * completed so far. - * @return integer Number of ended cases. - * @access public - */ - function getTestCaseProgress() { - return $this->progress; - } - - /** - * Static check for running in the comand line. - * @return boolean True if CLI. - * @access public - */ - static function inCli() { - return php_sapi_name() == 'cli'; - } -} - -/** - * For modifying the behaviour of the visual reporters. - * @package SimpleTest - * @subpackage UnitTester - */ -class SimpleReporterDecorator { - protected $reporter; - - /** - * Mediates between the reporter and the test case. - * @param SimpleScorer $reporter Reporter to receive events. - */ - function __construct($reporter) { - $this->reporter = $reporter; - } - - /** - * Signals that the next evaluation will be a dry - * run. That is, the structure events will be - * recorded, but no tests will be run. - * @param boolean $is_dry Dry run if true. - * @access public - */ - function makeDry($is_dry = true) { - $this->reporter->makeDry($is_dry); - } - - /** - * Accessor for current status. Will be false - * if there have been any failures or exceptions. - * Used for command line tools. - * @return boolean True if no failures. - * @access public - */ - function getStatus() { - return $this->reporter->getStatus(); - } - - /** - * The nesting of the test cases so far. Not - * all reporters have this facility. - * @return array Test list if accessible. - * @access public - */ - function getTestList() { - if (method_exists($this->reporter, 'getTestList')) { - return $this->reporter->getTestList(); - } else { - return array(); - } - } - - /** - * The reporter has a veto on what should be run. - * @param string $test_case_name Name of test case. - * @param string $method Name of test method. - * @return boolean True if test should be run. - * @access public - */ - function shouldInvoke($test_case_name, $method) { - return $this->reporter->shouldInvoke($test_case_name, $method); - } - - /** - * Can wrap the invoker in preparation for running - * a test. - * @param SimpleInvoker $invoker Individual test runner. - * @return SimpleInvoker Wrapped test runner. - * @access public - */ - function createInvoker($invoker) { - return $this->reporter->createInvoker($invoker); - } - - /** - * Gets the formatter for privateiables and other small - * generic data items. - * @return SimpleDumper Formatter. - * @access public - */ - function getDumper() { - return $this->reporter->getDumper(); - } - - /** - * Paints the start of a group test. - * @param string $test_name Name of test or other label. - * @param integer $size Number of test cases starting. - * @access public - */ - function paintGroupStart($test_name, $size) { - $this->reporter->paintGroupStart($test_name, $size); - } - - /** - * Paints the end of a group test. - * @param string $test_name Name of test or other label. - * @access public - */ - function paintGroupEnd($test_name) { - $this->reporter->paintGroupEnd($test_name); - } - - /** - * Paints the start of a test case. - * @param string $test_name Name of test or other label. - * @access public - */ - function paintCaseStart($test_name) { - $this->reporter->paintCaseStart($test_name); - } - - /** - * Paints the end of a test case. - * @param string $test_name Name of test or other label. - * @access public - */ - function paintCaseEnd($test_name) { - $this->reporter->paintCaseEnd($test_name); - } - - /** - * Paints the start of a test method. - * @param string $test_name Name of test or other label. - * @access public - */ - function paintMethodStart($test_name) { - $this->reporter->paintMethodStart($test_name); - } - - /** - * Paints the end of a test method. - * @param string $test_name Name of test or other label. - * @access public - */ - function paintMethodEnd($test_name) { - $this->reporter->paintMethodEnd($test_name); - } - - /** - * Chains to the wrapped reporter. - * @param string $message Message is ignored. - * @access public - */ - function paintPass($message) { - $this->reporter->paintPass($message); - } - - /** - * Chains to the wrapped reporter. - * @param string $message Message is ignored. - * @access public - */ - function paintFail($message) { - $this->reporter->paintFail($message); - } - - /** - * Chains to the wrapped reporter. - * @param string $message Text of error formatted by - * the test case. - * @access public - */ - function paintError($message) { - $this->reporter->paintError($message); - } - - /** - * Chains to the wrapped reporter. - * @param Exception $exception Exception to show. - * @access public - */ - function paintException($exception) { - $this->reporter->paintException($exception); - } - - /** - * Prints the message for skipping tests. - * @param string $message Text of skip condition. - * @access public - */ - function paintSkip($message) { - $this->reporter->paintSkip($message); - } - - /** - * Chains to the wrapped reporter. - * @param string $message Text to display. - * @access public - */ - function paintMessage($message) { - $this->reporter->paintMessage($message); - } - - /** - * Chains to the wrapped reporter. - * @param string $message Text to display. - * @access public - */ - function paintFormattedMessage($message) { - $this->reporter->paintFormattedMessage($message); - } - - /** - * Chains to the wrapped reporter. - * @param string $type Event type as text. - * @param mixed $payload Message or object. - * @return boolean Should return false if this - * type of signal should fail the - * test suite. - * @access public - */ - function paintSignal($type, $payload) { - $this->reporter->paintSignal($type, $payload); - } -} - -/** - * For sending messages to multiple reporters at - * the same time. - * @package SimpleTest - * @subpackage UnitTester - */ -class MultipleReporter { - private $reporters = array(); - - /** - * Adds a reporter to the subscriber list. - * @param SimpleScorer $reporter Reporter to receive events. - * @access public - */ - function attachReporter($reporter) { - $this->reporters[] = $reporter; - } - - /** - * Signals that the next evaluation will be a dry - * run. That is, the structure events will be - * recorded, but no tests will be run. - * @param boolean $is_dry Dry run if true. - * @access public - */ - function makeDry($is_dry = true) { - for ($i = 0; $i < count($this->reporters); $i++) { - $this->reporters[$i]->makeDry($is_dry); - } - } - - /** - * Accessor for current status. Will be false - * if there have been any failures or exceptions. - * If any reporter reports a failure, the whole - * suite fails. - * @return boolean True if no failures. - * @access public - */ - function getStatus() { - for ($i = 0; $i < count($this->reporters); $i++) { - if (! $this->reporters[$i]->getStatus()) { - return false; - } - } - return true; - } - - /** - * The reporter has a veto on what should be run. - * It requires all reporters to want to run the method. - * @param string $test_case_name name of test case. - * @param string $method Name of test method. - * @access public - */ - function shouldInvoke($test_case_name, $method) { - for ($i = 0; $i < count($this->reporters); $i++) { - if (! $this->reporters[$i]->shouldInvoke($test_case_name, $method)) { - return false; - } - } - return true; - } - - /** - * Every reporter gets a chance to wrap the invoker. - * @param SimpleInvoker $invoker Individual test runner. - * @return SimpleInvoker Wrapped test runner. - * @access public - */ - function createInvoker($invoker) { - for ($i = 0; $i < count($this->reporters); $i++) { - $invoker = $this->reporters[$i]->createInvoker($invoker); - } - return $invoker; - } - - /** - * Gets the formatter for privateiables and other small - * generic data items. - * @return SimpleDumper Formatter. - * @access public - */ - function getDumper() { - return new SimpleDumper(); - } - - /** - * Paints the start of a group test. - * @param string $test_name Name of test or other label. - * @param integer $size Number of test cases starting. - * @access public - */ - function paintGroupStart($test_name, $size) { - for ($i = 0; $i < count($this->reporters); $i++) { - $this->reporters[$i]->paintGroupStart($test_name, $size); - } - } - - /** - * Paints the end of a group test. - * @param string $test_name Name of test or other label. - * @access public - */ - function paintGroupEnd($test_name) { - for ($i = 0; $i < count($this->reporters); $i++) { - $this->reporters[$i]->paintGroupEnd($test_name); - } - } - - /** - * Paints the start of a test case. - * @param string $test_name Name of test or other label. - * @access public - */ - function paintCaseStart($test_name) { - for ($i = 0; $i < count($this->reporters); $i++) { - $this->reporters[$i]->paintCaseStart($test_name); - } - } - - /** - * Paints the end of a test case. - * @param string $test_name Name of test or other label. - * @access public - */ - function paintCaseEnd($test_name) { - for ($i = 0; $i < count($this->reporters); $i++) { - $this->reporters[$i]->paintCaseEnd($test_name); - } - } - - /** - * Paints the start of a test method. - * @param string $test_name Name of test or other label. - * @access public - */ - function paintMethodStart($test_name) { - for ($i = 0; $i < count($this->reporters); $i++) { - $this->reporters[$i]->paintMethodStart($test_name); - } - } - - /** - * Paints the end of a test method. - * @param string $test_name Name of test or other label. - * @access public - */ - function paintMethodEnd($test_name) { - for ($i = 0; $i < count($this->reporters); $i++) { - $this->reporters[$i]->paintMethodEnd($test_name); - } - } - - /** - * Chains to the wrapped reporter. - * @param string $message Message is ignored. - * @access public - */ - function paintPass($message) { - for ($i = 0; $i < count($this->reporters); $i++) { - $this->reporters[$i]->paintPass($message); - } - } - - /** - * Chains to the wrapped reporter. - * @param string $message Message is ignored. - * @access public - */ - function paintFail($message) { - for ($i = 0; $i < count($this->reporters); $i++) { - $this->reporters[$i]->paintFail($message); - } - } - - /** - * Chains to the wrapped reporter. - * @param string $message Text of error formatted by - * the test case. - * @access public - */ - function paintError($message) { - for ($i = 0; $i < count($this->reporters); $i++) { - $this->reporters[$i]->paintError($message); - } - } - - /** - * Chains to the wrapped reporter. - * @param Exception $exception Exception to display. - * @access public - */ - function paintException($exception) { - for ($i = 0; $i < count($this->reporters); $i++) { - $this->reporters[$i]->paintException($exception); - } - } - - /** - * Prints the message for skipping tests. - * @param string $message Text of skip condition. - * @access public - */ - function paintSkip($message) { - for ($i = 0; $i < count($this->reporters); $i++) { - $this->reporters[$i]->paintSkip($message); - } - } - - /** - * Chains to the wrapped reporter. - * @param string $message Text to display. - * @access public - */ - function paintMessage($message) { - for ($i = 0; $i < count($this->reporters); $i++) { - $this->reporters[$i]->paintMessage($message); - } - } - - /** - * Chains to the wrapped reporter. - * @param string $message Text to display. - * @access public - */ - function paintFormattedMessage($message) { - for ($i = 0; $i < count($this->reporters); $i++) { - $this->reporters[$i]->paintFormattedMessage($message); - } - } - - /** - * Chains to the wrapped reporter. - * @param string $type Event type as text. - * @param mixed $payload Message or object. - * @return boolean Should return false if this - * type of signal should fail the - * test suite. - * @access public - */ - function paintSignal($type, $payload) { - for ($i = 0; $i < count($this->reporters); $i++) { - $this->reporters[$i]->paintSignal($type, $payload); - } - } -} -?> \ No newline at end of file diff --git a/3rdparty/simpletest/selector.php b/3rdparty/simpletest/selector.php deleted file mode 100644 index ba2fed312a..0000000000 --- a/3rdparty/simpletest/selector.php +++ /dev/null @@ -1,141 +0,0 @@ -name = $name; - } - - /** - * Accessor for name. - * @returns string $name Name to match. - */ - function getName() { - return $this->name; - } - - /** - * Compares with name attribute of widget. - * @param SimpleWidget $widget Control to compare. - * @access public - */ - function isMatch($widget) { - return ($widget->getName() == $this->name); - } -} - -/** - * Used to extract form elements for testing against. - * Searches by visible label or alt text. - * @package SimpleTest - * @subpackage WebTester - */ -class SimpleByLabel { - private $label; - - /** - * Stashes the name for later comparison. - * @param string $label Visible text to match. - */ - function __construct($label) { - $this->label = $label; - } - - /** - * Comparison. Compares visible text of widget or - * related label. - * @param SimpleWidget $widget Control to compare. - * @access public - */ - function isMatch($widget) { - if (! method_exists($widget, 'isLabel')) { - return false; - } - return $widget->isLabel($this->label); - } -} - -/** - * Used to extract form elements for testing against. - * Searches dy id attribute. - * @package SimpleTest - * @subpackage WebTester - */ -class SimpleById { - private $id; - - /** - * Stashes the name for later comparison. - * @param string $id ID atribute to match. - */ - function __construct($id) { - $this->id = $id; - } - - /** - * Comparison. Compares id attribute of widget. - * @param SimpleWidget $widget Control to compare. - * @access public - */ - function isMatch($widget) { - return $widget->isId($this->id); - } -} - -/** - * Used to extract form elements for testing against. - * Searches by visible label, name or alt text. - * @package SimpleTest - * @subpackage WebTester - */ -class SimpleByLabelOrName { - private $label; - - /** - * Stashes the name/label for later comparison. - * @param string $label Visible text to match. - */ - function __construct($label) { - $this->label = $label; - } - - /** - * Comparison. Compares visible text of widget or - * related label or name. - * @param SimpleWidget $widget Control to compare. - * @access public - */ - function isMatch($widget) { - if (method_exists($widget, 'isLabel')) { - if ($widget->isLabel($this->label)) { - return true; - } - } - return ($widget->getName() == $this->label); - } -} -?> \ No newline at end of file diff --git a/3rdparty/simpletest/shell_tester.php b/3rdparty/simpletest/shell_tester.php deleted file mode 100644 index 9a3bd389ee..0000000000 --- a/3rdparty/simpletest/shell_tester.php +++ /dev/null @@ -1,330 +0,0 @@ -output = false; - } - - /** - * Actually runs the command. Does not trap the - * error stream output as this need PHP 4.3+. - * @param string $command The actual command line - * to run. - * @return integer Exit code. - * @access public - */ - function execute($command) { - $this->output = false; - exec($command, $this->output, $ret); - return $ret; - } - - /** - * Accessor for the last output. - * @return string Output as text. - * @access public - */ - function getOutput() { - return implode("\n", $this->output); - } - - /** - * Accessor for the last output. - * @return array Output as array of lines. - * @access public - */ - function getOutputAsList() { - return $this->output; - } -} - -/** - * Test case for testing of command line scripts and - * utilities. Usually scripts that are external to the - * PHP code, but support it in some way. - * @package SimpleTest - * @subpackage UnitTester - */ -class ShellTestCase extends SimpleTestCase { - private $current_shell; - private $last_status; - private $last_command; - - /** - * Creates an empty test case. Should be subclassed - * with test methods for a functional test case. - * @param string $label Name of test case. Will use - * the class name if none specified. - * @access public - */ - function __construct($label = false) { - parent::__construct($label); - $this->current_shell = $this->createShell(); - $this->last_status = false; - $this->last_command = ''; - } - - /** - * Executes a command and buffers the results. - * @param string $command Command to run. - * @return boolean True if zero exit code. - * @access public - */ - function execute($command) { - $shell = $this->getShell(); - $this->last_status = $shell->execute($command); - $this->last_command = $command; - return ($this->last_status === 0); - } - - /** - * Dumps the output of the last command. - * @access public - */ - function dumpOutput() { - $this->dump($this->getOutput()); - } - - /** - * Accessor for the last output. - * @return string Output as text. - * @access public - */ - function getOutput() { - $shell = $this->getShell(); - return $shell->getOutput(); - } - - /** - * Accessor for the last output. - * @return array Output as array of lines. - * @access public - */ - function getOutputAsList() { - $shell = $this->getShell(); - return $shell->getOutputAsList(); - } - - /** - * Called from within the test methods to register - * passes and failures. - * @param boolean $result Pass on true. - * @param string $message Message to display describing - * the test state. - * @return boolean True on pass - * @access public - */ - function assertTrue($result, $message = false) { - return $this->assert(new TrueExpectation(), $result, $message); - } - - /** - * Will be true on false and vice versa. False - * is the PHP definition of false, so that null, - * empty strings, zero and an empty array all count - * as false. - * @param boolean $result Pass on false. - * @param string $message Message to display. - * @return boolean True on pass - * @access public - */ - function assertFalse($result, $message = '%s') { - return $this->assert(new FalseExpectation(), $result, $message); - } - - /** - * Will trigger a pass if the two parameters have - * the same value only. Otherwise a fail. This - * is for testing hand extracted text, etc. - * @param mixed $first Value to compare. - * @param mixed $second Value to compare. - * @param string $message Message to display. - * @return boolean True on pass - * @access public - */ - function assertEqual($first, $second, $message = "%s") { - return $this->assert( - new EqualExpectation($first), - $second, - $message); - } - - /** - * Will trigger a pass if the two parameters have - * a different value. Otherwise a fail. This - * is for testing hand extracted text, etc. - * @param mixed $first Value to compare. - * @param mixed $second Value to compare. - * @param string $message Message to display. - * @return boolean True on pass - * @access public - */ - function assertNotEqual($first, $second, $message = "%s") { - return $this->assert( - new NotEqualExpectation($first), - $second, - $message); - } - - /** - * Tests the last status code from the shell. - * @param integer $status Expected status of last - * command. - * @param string $message Message to display. - * @return boolean True if pass. - * @access public - */ - function assertExitCode($status, $message = "%s") { - $message = sprintf($message, "Expected status code of [$status] from [" . - $this->last_command . "], but got [" . - $this->last_status . "]"); - return $this->assertTrue($status === $this->last_status, $message); - } - - /** - * Attempt to exactly match the combined STDERR and - * STDOUT output. - * @param string $expected Expected output. - * @param string $message Message to display. - * @return boolean True if pass. - * @access public - */ - function assertOutput($expected, $message = "%s") { - $shell = $this->getShell(); - return $this->assert( - new EqualExpectation($expected), - $shell->getOutput(), - $message); - } - - /** - * Scans the output for a Perl regex. If found - * anywhere it passes, else it fails. - * @param string $pattern Regex to search for. - * @param string $message Message to display. - * @return boolean True if pass. - * @access public - */ - function assertOutputPattern($pattern, $message = "%s") { - $shell = $this->getShell(); - return $this->assert( - new PatternExpectation($pattern), - $shell->getOutput(), - $message); - } - - /** - * If a Perl regex is found anywhere in the current - * output then a failure is generated, else a pass. - * @param string $pattern Regex to search for. - * @param $message Message to display. - * @return boolean True if pass. - * @access public - */ - function assertNoOutputPattern($pattern, $message = "%s") { - $shell = $this->getShell(); - return $this->assert( - new NoPatternExpectation($pattern), - $shell->getOutput(), - $message); - } - - /** - * File existence check. - * @param string $path Full filename and path. - * @param string $message Message to display. - * @return boolean True if pass. - * @access public - */ - function assertFileExists($path, $message = "%s") { - $message = sprintf($message, "File [$path] should exist"); - return $this->assertTrue(file_exists($path), $message); - } - - /** - * File non-existence check. - * @param string $path Full filename and path. - * @param string $message Message to display. - * @return boolean True if pass. - * @access public - */ - function assertFileNotExists($path, $message = "%s") { - $message = sprintf($message, "File [$path] should not exist"); - return $this->assertFalse(file_exists($path), $message); - } - - /** - * Scans a file for a Perl regex. If found - * anywhere it passes, else it fails. - * @param string $pattern Regex to search for. - * @param string $path Full filename and path. - * @param string $message Message to display. - * @return boolean True if pass. - * @access public - */ - function assertFilePattern($pattern, $path, $message = "%s") { - return $this->assert( - new PatternExpectation($pattern), - implode('', file($path)), - $message); - } - - /** - * If a Perl regex is found anywhere in the named - * file then a failure is generated, else a pass. - * @param string $pattern Regex to search for. - * @param string $path Full filename and path. - * @param string $message Message to display. - * @return boolean True if pass. - * @access public - */ - function assertNoFilePattern($pattern, $path, $message = "%s") { - return $this->assert( - new NoPatternExpectation($pattern), - implode('', file($path)), - $message); - } - - /** - * Accessor for current shell. Used for testing the - * the tester itself. - * @return Shell Current shell. - * @access protected - */ - protected function getShell() { - return $this->current_shell; - } - - /** - * Factory for the shell to run the command on. - * @return Shell New shell object. - * @access protected - */ - protected function createShell() { - return new SimpleShell(); - } -} -?> \ No newline at end of file diff --git a/3rdparty/simpletest/simpletest.php b/3rdparty/simpletest/simpletest.php deleted file mode 100644 index 425c869a82..0000000000 --- a/3rdparty/simpletest/simpletest.php +++ /dev/null @@ -1,391 +0,0 @@ -getParent()) { - SimpleTest::ignore($parent); - } - } - } - } - - /** - * Puts the object to the global pool of 'preferred' objects - * which can be retrieved with SimpleTest :: preferred() method. - * Instances of the same class are overwritten. - * @param object $object Preferred object - * @see preferred() - */ - static function prefer($object) { - $registry = &SimpleTest::getRegistry(); - $registry['Preferred'][] = $object; - } - - /** - * Retrieves 'preferred' objects from global pool. Class filter - * can be applied in order to retrieve the object of the specific - * class - * @param array|string $classes Allowed classes or interfaces. - * @return array|object|null - * @see prefer() - */ - static function preferred($classes) { - if (! is_array($classes)) { - $classes = array($classes); - } - $registry = &SimpleTest::getRegistry(); - for ($i = count($registry['Preferred']) - 1; $i >= 0; $i--) { - foreach ($classes as $class) { - if (SimpleTestCompatibility::isA($registry['Preferred'][$i], $class)) { - return $registry['Preferred'][$i]; - } - } - } - return null; - } - - /** - * Test to see if a test case is in the ignore - * list. Quite obviously the ignore list should - * be a separate object and will be one day. - * This method is internal to SimpleTest. Don't - * use it. - * @param string $class Class name to test. - * @return boolean True if should not be run. - */ - static function isIgnored($class) { - $registry = &SimpleTest::getRegistry(); - return isset($registry['IgnoreList'][strtolower($class)]); - } - - /** - * Sets proxy to use on all requests for when - * testing from behind a firewall. Set host - * to false to disable. This will take effect - * if there are no other proxy settings. - * @param string $proxy Proxy host as URL. - * @param string $username Proxy username for authentication. - * @param string $password Proxy password for authentication. - */ - static function useProxy($proxy, $username = false, $password = false) { - $registry = &SimpleTest::getRegistry(); - $registry['DefaultProxy'] = $proxy; - $registry['DefaultProxyUsername'] = $username; - $registry['DefaultProxyPassword'] = $password; - } - - /** - * Accessor for default proxy host. - * @return string Proxy URL. - */ - static function getDefaultProxy() { - $registry = &SimpleTest::getRegistry(); - return $registry['DefaultProxy']; - } - - /** - * Accessor for default proxy username. - * @return string Proxy username for authentication. - */ - static function getDefaultProxyUsername() { - $registry = &SimpleTest::getRegistry(); - return $registry['DefaultProxyUsername']; - } - - /** - * Accessor for default proxy password. - * @return string Proxy password for authentication. - */ - static function getDefaultProxyPassword() { - $registry = &SimpleTest::getRegistry(); - return $registry['DefaultProxyPassword']; - } - - /** - * Accessor for default HTML parsers. - * @return array List of parsers to try in - * order until one responds true - * to can(). - */ - static function getParsers() { - $registry = &SimpleTest::getRegistry(); - return $registry['Parsers']; - } - - /** - * Set the list of HTML parsers to attempt to use by default. - * @param array $parsers List of parsers to try in - * order until one responds true - * to can(). - */ - static function setParsers($parsers) { - $registry = &SimpleTest::getRegistry(); - $registry['Parsers'] = $parsers; - } - - /** - * Accessor for global registry of options. - * @return hash All stored values. - */ - protected static function &getRegistry() { - static $registry = false; - if (! $registry) { - $registry = SimpleTest::getDefaults(); - } - return $registry; - } - - /** - * Accessor for the context of the current - * test run. - * @return SimpleTestContext Current test run. - */ - static function getContext() { - static $context = false; - if (! $context) { - $context = new SimpleTestContext(); - } - return $context; - } - - /** - * Constant default values. - * @return hash All registry defaults. - */ - protected static function getDefaults() { - return array( - 'Parsers' => false, - 'MockBaseClass' => 'SimpleMock', - 'IgnoreList' => array(), - 'DefaultProxy' => false, - 'DefaultProxyUsername' => false, - 'DefaultProxyPassword' => false, - 'Preferred' => array(new HtmlReporter(), new TextReporter(), new XmlReporter())); - } - - /** - * @deprecated - */ - static function setMockBaseClass($mock_base) { - $registry = &SimpleTest::getRegistry(); - $registry['MockBaseClass'] = $mock_base; - } - - /** - * @deprecated - */ - static function getMockBaseClass() { - $registry = &SimpleTest::getRegistry(); - return $registry['MockBaseClass']; - } -} - -/** - * Container for all components for a specific - * test run. Makes things like error queues - * available to PHP event handlers, and also - * gets around some nasty reference issues in - * the mocks. - * @package SimpleTest - */ -class SimpleTestContext { - private $test; - private $reporter; - private $resources; - - /** - * Clears down the current context. - * @access public - */ - function clear() { - $this->resources = array(); - } - - /** - * Sets the current test case instance. This - * global instance can be used by the mock objects - * to send message to the test cases. - * @param SimpleTestCase $test Test case to register. - */ - function setTest($test) { - $this->clear(); - $this->test = $test; - } - - /** - * Accessor for currently running test case. - * @return SimpleTestCase Current test. - */ - function getTest() { - return $this->test; - } - - /** - * Sets the current reporter. This - * global instance can be used by the mock objects - * to send messages. - * @param SimpleReporter $reporter Reporter to register. - */ - function setReporter($reporter) { - $this->clear(); - $this->reporter = $reporter; - } - - /** - * Accessor for current reporter. - * @return SimpleReporter Current reporter. - */ - function getReporter() { - return $this->reporter; - } - - /** - * Accessor for the Singleton resource. - * @return object Global resource. - */ - function get($resource) { - if (! isset($this->resources[$resource])) { - $this->resources[$resource] = new $resource(); - } - return $this->resources[$resource]; - } -} - -/** - * Interrogates the stack trace to recover the - * failure point. - * @package SimpleTest - * @subpackage UnitTester - */ -class SimpleStackTrace { - private $prefixes; - - /** - * Stashes the list of target prefixes. - * @param array $prefixes List of method prefixes - * to search for. - */ - function __construct($prefixes) { - $this->prefixes = $prefixes; - } - - /** - * Extracts the last method name that was not within - * Simpletest itself. Captures a stack trace if none given. - * @param array $stack List of stack frames. - * @return string Snippet of test report with line - * number and file. - */ - function traceMethod($stack = false) { - $stack = $stack ? $stack : $this->captureTrace(); - foreach ($stack as $frame) { - if ($this->frameLiesWithinSimpleTestFolder($frame)) { - continue; - } - if ($this->frameMatchesPrefix($frame)) { - return ' at [' . $frame['file'] . ' line ' . $frame['line'] . ']'; - } - } - return ''; - } - - /** - * Test to see if error is generated by SimpleTest itself. - * @param array $frame PHP stack frame. - * @return boolean True if a SimpleTest file. - */ - protected function frameLiesWithinSimpleTestFolder($frame) { - if (isset($frame['file'])) { - $path = substr(SIMPLE_TEST, 0, -1); - if (strpos($frame['file'], $path) === 0) { - if (dirname($frame['file']) == $path) { - return true; - } - } - } - return false; - } - - /** - * Tries to determine if the method call is an assert, etc. - * @param array $frame PHP stack frame. - * @return boolean True if matches a target. - */ - protected function frameMatchesPrefix($frame) { - foreach ($this->prefixes as $prefix) { - if (strncmp($frame['function'], $prefix, strlen($prefix)) == 0) { - return true; - } - } - return false; - } - - /** - * Grabs a current stack trace. - * @return array Fulle trace. - */ - protected function captureTrace() { - if (function_exists('debug_backtrace')) { - return array_reverse(debug_backtrace()); - } - return array(); - } -} -?> \ No newline at end of file diff --git a/3rdparty/simpletest/socket.php b/3rdparty/simpletest/socket.php deleted file mode 100644 index 06e8ca62d0..0000000000 --- a/3rdparty/simpletest/socket.php +++ /dev/null @@ -1,312 +0,0 @@ -clearError(); - } - - /** - * Test for an outstanding error. - * @return boolean True if there is an error. - * @access public - */ - function isError() { - return ($this->error != ''); - } - - /** - * Accessor for an outstanding error. - * @return string Empty string if no error otherwise - * the error message. - * @access public - */ - function getError() { - return $this->error; - } - - /** - * Sets the internal error. - * @param string Error message to stash. - * @access protected - */ - function setError($error) { - $this->error = $error; - } - - /** - * Resets the error state to no error. - * @access protected - */ - function clearError() { - $this->setError(''); - } -} - -/** - * @package SimpleTest - * @subpackage WebTester - */ -class SimpleFileSocket extends SimpleStickyError { - private $handle; - private $is_open = false; - private $sent = ''; - private $block_size; - - /** - * Opens a socket for reading and writing. - * @param SimpleUrl $file Target URI to fetch. - * @param integer $block_size Size of chunk to read. - * @access public - */ - function __construct($file, $block_size = 1024) { - parent::__construct(); - if (! ($this->handle = $this->openFile($file, $error))) { - $file_string = $file->asString(); - $this->setError("Cannot open [$file_string] with [$error]"); - return; - } - $this->is_open = true; - $this->block_size = $block_size; - } - - /** - * Writes some data to the socket and saves alocal copy. - * @param string $message String to send to socket. - * @return boolean True if successful. - * @access public - */ - function write($message) { - return true; - } - - /** - * Reads data from the socket. The error suppresion - * is a workaround for PHP4 always throwing a warning - * with a secure socket. - * @return integer/boolean Incoming bytes. False - * on error. - * @access public - */ - function read() { - $raw = @fread($this->handle, $this->block_size); - if ($raw === false) { - $this->setError('Cannot read from socket'); - $this->close(); - } - return $raw; - } - - /** - * Accessor for socket open state. - * @return boolean True if open. - * @access public - */ - function isOpen() { - return $this->is_open; - } - - /** - * Closes the socket preventing further reads. - * Cannot be reopened once closed. - * @return boolean True if successful. - * @access public - */ - function close() { - if (!$this->is_open) return false; - $this->is_open = false; - return fclose($this->handle); - } - - /** - * Accessor for content so far. - * @return string Bytes sent only. - * @access public - */ - function getSent() { - return $this->sent; - } - - /** - * Actually opens the low level socket. - * @param SimpleUrl $file SimpleUrl file target. - * @param string $error Recipient of error message. - * @param integer $timeout Maximum time to wait for connection. - * @access protected - */ - protected function openFile($file, &$error) { - return @fopen($file->asString(), 'r'); - } -} - -/** - * Wrapper for TCP/IP socket. - * @package SimpleTest - * @subpackage WebTester - */ -class SimpleSocket extends SimpleStickyError { - private $handle; - private $is_open = false; - private $sent = ''; - private $lock_size; - - /** - * Opens a socket for reading and writing. - * @param string $host Hostname to send request to. - * @param integer $port Port on remote machine to open. - * @param integer $timeout Connection timeout in seconds. - * @param integer $block_size Size of chunk to read. - * @access public - */ - function __construct($host, $port, $timeout, $block_size = 255) { - parent::__construct(); - if (! ($this->handle = $this->openSocket($host, $port, $error_number, $error, $timeout))) { - $this->setError("Cannot open [$host:$port] with [$error] within [$timeout] seconds"); - return; - } - $this->is_open = true; - $this->block_size = $block_size; - SimpleTestCompatibility::setTimeout($this->handle, $timeout); - } - - /** - * Writes some data to the socket and saves alocal copy. - * @param string $message String to send to socket. - * @return boolean True if successful. - * @access public - */ - function write($message) { - if ($this->isError() || ! $this->isOpen()) { - return false; - } - $count = fwrite($this->handle, $message); - if (! $count) { - if ($count === false) { - $this->setError('Cannot write to socket'); - $this->close(); - } - return false; - } - fflush($this->handle); - $this->sent .= $message; - return true; - } - - /** - * Reads data from the socket. The error suppresion - * is a workaround for PHP4 always throwing a warning - * with a secure socket. - * @return integer/boolean Incoming bytes. False - * on error. - * @access public - */ - function read() { - if ($this->isError() || ! $this->isOpen()) { - return false; - } - $raw = @fread($this->handle, $this->block_size); - if ($raw === false) { - $this->setError('Cannot read from socket'); - $this->close(); - } - return $raw; - } - - /** - * Accessor for socket open state. - * @return boolean True if open. - * @access public - */ - function isOpen() { - return $this->is_open; - } - - /** - * Closes the socket preventing further reads. - * Cannot be reopened once closed. - * @return boolean True if successful. - * @access public - */ - function close() { - $this->is_open = false; - return fclose($this->handle); - } - - /** - * Accessor for content so far. - * @return string Bytes sent only. - * @access public - */ - function getSent() { - return $this->sent; - } - - /** - * Actually opens the low level socket. - * @param string $host Host to connect to. - * @param integer $port Port on host. - * @param integer $error_number Recipient of error code. - * @param string $error Recipoent of error message. - * @param integer $timeout Maximum time to wait for connection. - * @access protected - */ - protected function openSocket($host, $port, &$error_number, &$error, $timeout) { - return @fsockopen($host, $port, $error_number, $error, $timeout); - } -} - -/** - * Wrapper for TCP/IP socket over TLS. - * @package SimpleTest - * @subpackage WebTester - */ -class SimpleSecureSocket extends SimpleSocket { - - /** - * Opens a secure socket for reading and writing. - * @param string $host Hostname to send request to. - * @param integer $port Port on remote machine to open. - * @param integer $timeout Connection timeout in seconds. - * @access public - */ - function __construct($host, $port, $timeout) { - parent::__construct($host, $port, $timeout); - } - - /** - * Actually opens the low level socket. - * @param string $host Host to connect to. - * @param integer $port Port on host. - * @param integer $error_number Recipient of error code. - * @param string $error Recipient of error message. - * @param integer $timeout Maximum time to wait for connection. - * @access protected - */ - function openSocket($host, $port, &$error_number, &$error, $timeout) { - return parent::openSocket("tls://$host", $port, $error_number, $error, $timeout); - } -} -?> \ No newline at end of file diff --git a/3rdparty/simpletest/tag.php b/3rdparty/simpletest/tag.php deleted file mode 100644 index afe649ec5d..0000000000 --- a/3rdparty/simpletest/tag.php +++ /dev/null @@ -1,1527 +0,0 @@ - 'SimpleAnchorTag', - 'title' => 'SimpleTitleTag', - 'base' => 'SimpleBaseTag', - 'button' => 'SimpleButtonTag', - 'textarea' => 'SimpleTextAreaTag', - 'option' => 'SimpleOptionTag', - 'label' => 'SimpleLabelTag', - 'form' => 'SimpleFormTag', - 'frame' => 'SimpleFrameTag'); - $attributes = $this->keysToLowerCase($attributes); - if (array_key_exists($name, $map)) { - $tag_class = $map[$name]; - return new $tag_class($attributes); - } elseif ($name == 'select') { - return $this->createSelectionTag($attributes); - } elseif ($name == 'input') { - return $this->createInputTag($attributes); - } - return new SimpleTag($name, $attributes); - } - - /** - * Factory for selection fields. - * @param hash $attributes Element attributes. - * @return SimpleTag Tag object. - * @access protected - */ - protected function createSelectionTag($attributes) { - if (isset($attributes['multiple'])) { - return new MultipleSelectionTag($attributes); - } - return new SimpleSelectionTag($attributes); - } - - /** - * Factory for input tags. - * @param hash $attributes Element attributes. - * @return SimpleTag Tag object. - * @access protected - */ - protected function createInputTag($attributes) { - if (! isset($attributes['type'])) { - return new SimpleTextTag($attributes); - } - $type = strtolower(trim($attributes['type'])); - $map = array( - 'submit' => 'SimpleSubmitTag', - 'image' => 'SimpleImageSubmitTag', - 'checkbox' => 'SimpleCheckboxTag', - 'radio' => 'SimpleRadioButtonTag', - 'text' => 'SimpleTextTag', - 'hidden' => 'SimpleTextTag', - 'password' => 'SimpleTextTag', - 'file' => 'SimpleUploadTag'); - if (array_key_exists($type, $map)) { - $tag_class = $map[$type]; - return new $tag_class($attributes); - } - return false; - } - - /** - * Make the keys lower case for case insensitive look-ups. - * @param hash $map Hash to convert. - * @return hash Unchanged values, but keys lower case. - * @access private - */ - protected function keysToLowerCase($map) { - $lower = array(); - foreach ($map as $key => $value) { - $lower[strtolower($key)] = $value; - } - return $lower; - } -} - -/** - * HTML or XML tag. - * @package SimpleTest - * @subpackage WebTester - */ -class SimpleTag { - private $name; - private $attributes; - private $content; - - /** - * Starts with a named tag with attributes only. - * @param string $name Tag name. - * @param hash $attributes Attribute names and - * string values. Note that - * the keys must have been - * converted to lower case. - */ - function __construct($name, $attributes) { - $this->name = strtolower(trim($name)); - $this->attributes = $attributes; - $this->content = ''; - } - - /** - * Check to see if the tag can have both start and - * end tags with content in between. - * @return boolean True if content allowed. - * @access public - */ - function expectEndTag() { - return true; - } - - /** - * The current tag should not swallow all content for - * itself as it's searchable page content. Private - * content tags are usually widgets that contain default - * values. - * @return boolean False as content is available - * to other tags by default. - * @access public - */ - function isPrivateContent() { - return false; - } - - /** - * Appends string content to the current content. - * @param string $content Additional text. - * @access public - */ - function addContent($content) { - $this->content .= (string)$content; - return $this; - } - - /** - * Adds an enclosed tag to the content. - * @param SimpleTag $tag New tag. - * @access public - */ - function addTag($tag) { - } - - /** - * Adds multiple enclosed tags to the content. - * @param array List of SimpleTag objects to be added. - */ - function addTags($tags) { - foreach ($tags as $tag) { - $this->addTag($tag); - } - } - - /** - * Accessor for tag name. - * @return string Name of tag. - * @access public - */ - function getTagName() { - return $this->name; - } - - /** - * List of legal child elements. - * @return array List of element names. - * @access public - */ - function getChildElements() { - return array(); - } - - /** - * Accessor for an attribute. - * @param string $label Attribute name. - * @return string Attribute value. - * @access public - */ - function getAttribute($label) { - $label = strtolower($label); - if (! isset($this->attributes[$label])) { - return false; - } - return (string)$this->attributes[$label]; - } - - /** - * Sets an attribute. - * @param string $label Attribute name. - * @return string $value New attribute value. - * @access protected - */ - protected function setAttribute($label, $value) { - $this->attributes[strtolower($label)] = $value; - } - - /** - * Accessor for the whole content so far. - * @return string Content as big raw string. - * @access public - */ - function getContent() { - return $this->content; - } - - /** - * Accessor for content reduced to visible text. Acts - * like a text mode browser, normalising space and - * reducing images to their alt text. - * @return string Content as plain text. - * @access public - */ - function getText() { - return SimplePage::normalise($this->content); - } - - /** - * Test to see if id attribute matches. - * @param string $id ID to test against. - * @return boolean True on match. - * @access public - */ - function isId($id) { - return ($this->getAttribute('id') == $id); - } -} - -/** - * Base url. - * @package SimpleTest - * @subpackage WebTester - */ -class SimpleBaseTag extends SimpleTag { - - /** - * Starts with a named tag with attributes only. - * @param hash $attributes Attribute names and - * string values. - */ - function __construct($attributes) { - parent::__construct('base', $attributes); - } - - /** - * Base tag is not a block tag. - * @return boolean false - * @access public - */ - function expectEndTag() { - return false; - } -} - -/** - * Page title. - * @package SimpleTest - * @subpackage WebTester - */ -class SimpleTitleTag extends SimpleTag { - - /** - * Starts with a named tag with attributes only. - * @param hash $attributes Attribute names and - * string values. - */ - function __construct($attributes) { - parent::__construct('title', $attributes); - } -} - -/** - * Link. - * @package SimpleTest - * @subpackage WebTester - */ -class SimpleAnchorTag extends SimpleTag { - - /** - * Starts with a named tag with attributes only. - * @param hash $attributes Attribute names and - * string values. - */ - function __construct($attributes) { - parent::__construct('a', $attributes); - } - - /** - * Accessor for URL as string. - * @return string Coerced as string. - * @access public - */ - function getHref() { - $url = $this->getAttribute('href'); - if (is_bool($url)) { - $url = ''; - } - return $url; - } -} - -/** - * Form element. - * @package SimpleTest - * @subpackage WebTester - */ -class SimpleWidget extends SimpleTag { - private $value; - private $label; - private $is_set; - - /** - * Starts with a named tag with attributes only. - * @param string $name Tag name. - * @param hash $attributes Attribute names and - * string values. - */ - function __construct($name, $attributes) { - parent::__construct($name, $attributes); - $this->value = false; - $this->label = false; - $this->is_set = false; - } - - /** - * Accessor for name submitted as the key in - * GET/POST privateiables hash. - * @return string Parsed value. - * @access public - */ - function getName() { - return $this->getAttribute('name'); - } - - /** - * Accessor for default value parsed with the tag. - * @return string Parsed value. - * @access public - */ - function getDefault() { - return $this->getAttribute('value'); - } - - /** - * Accessor for currently set value or default if - * none. - * @return string Value set by form or default - * if none. - * @access public - */ - function getValue() { - if (! $this->is_set) { - return $this->getDefault(); - } - return $this->value; - } - - /** - * Sets the current form element value. - * @param string $value New value. - * @return boolean True if allowed. - * @access public - */ - function setValue($value) { - $this->value = $value; - $this->is_set = true; - return true; - } - - /** - * Resets the form element value back to the - * default. - * @access public - */ - function resetValue() { - $this->is_set = false; - } - - /** - * Allows setting of a label externally, say by a - * label tag. - * @param string $label Label to attach. - * @access public - */ - function setLabel($label) { - $this->label = trim($label); - return $this; - } - - /** - * Reads external or internal label. - * @param string $label Label to test. - * @return boolean True is match. - * @access public - */ - function isLabel($label) { - return $this->label == trim($label); - } - - /** - * Dispatches the value into the form encoded packet. - * @param SimpleEncoding $encoding Form packet. - * @access public - */ - function write($encoding) { - if ($this->getName()) { - $encoding->add($this->getName(), $this->getValue()); - } - } -} - -/** - * Text, password and hidden field. - * @package SimpleTest - * @subpackage WebTester - */ -class SimpleTextTag extends SimpleWidget { - - /** - * Starts with a named tag with attributes only. - * @param hash $attributes Attribute names and - * string values. - */ - function __construct($attributes) { - parent::__construct('input', $attributes); - if ($this->getAttribute('value') === false) { - $this->setAttribute('value', ''); - } - } - - /** - * Tag contains no content. - * @return boolean False. - * @access public - */ - function expectEndTag() { - return false; - } - - /** - * Sets the current form element value. Cannot - * change the value of a hidden field. - * @param string $value New value. - * @return boolean True if allowed. - * @access public - */ - function setValue($value) { - if ($this->getAttribute('type') == 'hidden') { - return false; - } - return parent::setValue($value); - } -} - -/** - * Submit button as input tag. - * @package SimpleTest - * @subpackage WebTester - */ -class SimpleSubmitTag extends SimpleWidget { - - /** - * Starts with a named tag with attributes only. - * @param hash $attributes Attribute names and - * string values. - */ - function __construct($attributes) { - parent::__construct('input', $attributes); - if ($this->getAttribute('value') === false) { - $this->setAttribute('value', 'Submit'); - } - } - - /** - * Tag contains no end element. - * @return boolean False. - * @access public - */ - function expectEndTag() { - return false; - } - - /** - * Disables the setting of the button value. - * @param string $value Ignored. - * @return boolean True if allowed. - * @access public - */ - function setValue($value) { - return false; - } - - /** - * Value of browser visible text. - * @return string Visible label. - * @access public - */ - function getLabel() { - return $this->getValue(); - } - - /** - * Test for a label match when searching. - * @param string $label Label to test. - * @return boolean True on match. - * @access public - */ - function isLabel($label) { - return trim($label) == trim($this->getLabel()); - } -} - -/** - * Image button as input tag. - * @package SimpleTest - * @subpackage WebTester - */ -class SimpleImageSubmitTag extends SimpleWidget { - - /** - * Starts with a named tag with attributes only. - * @param hash $attributes Attribute names and - * string values. - */ - function __construct($attributes) { - parent::__construct('input', $attributes); - } - - /** - * Tag contains no end element. - * @return boolean False. - * @access public - */ - function expectEndTag() { - return false; - } - - /** - * Disables the setting of the button value. - * @param string $value Ignored. - * @return boolean True if allowed. - * @access public - */ - function setValue($value) { - return false; - } - - /** - * Value of browser visible text. - * @return string Visible label. - * @access public - */ - function getLabel() { - if ($this->getAttribute('title')) { - return $this->getAttribute('title'); - } - return $this->getAttribute('alt'); - } - - /** - * Test for a label match when searching. - * @param string $label Label to test. - * @return boolean True on match. - * @access public - */ - function isLabel($label) { - return trim($label) == trim($this->getLabel()); - } - - /** - * Dispatches the value into the form encoded packet. - * @param SimpleEncoding $encoding Form packet. - * @param integer $x X coordinate of click. - * @param integer $y Y coordinate of click. - * @access public - */ - function write($encoding, $x = 1, $y = 1) { - if ($this->getName()) { - $encoding->add($this->getName() . '.x', $x); - $encoding->add($this->getName() . '.y', $y); - } else { - $encoding->add('x', $x); - $encoding->add('y', $y); - } - } -} - -/** - * Submit button as button tag. - * @package SimpleTest - * @subpackage WebTester - */ -class SimpleButtonTag extends SimpleWidget { - - /** - * Starts with a named tag with attributes only. - * Defaults are very browser dependent. - * @param hash $attributes Attribute names and - * string values. - */ - function __construct($attributes) { - parent::__construct('button', $attributes); - } - - /** - * Check to see if the tag can have both start and - * end tags with content in between. - * @return boolean True if content allowed. - * @access public - */ - function expectEndTag() { - return true; - } - - /** - * Disables the setting of the button value. - * @param string $value Ignored. - * @return boolean True if allowed. - * @access public - */ - function setValue($value) { - return false; - } - - /** - * Value of browser visible text. - * @return string Visible label. - * @access public - */ - function getLabel() { - return $this->getContent(); - } - - /** - * Test for a label match when searching. - * @param string $label Label to test. - * @return boolean True on match. - * @access public - */ - function isLabel($label) { - return trim($label) == trim($this->getLabel()); - } -} - -/** - * Content tag for text area. - * @package SimpleTest - * @subpackage WebTester - */ -class SimpleTextAreaTag extends SimpleWidget { - - /** - * Starts with a named tag with attributes only. - * @param hash $attributes Attribute names and - * string values. - */ - function __construct($attributes) { - parent::__construct('textarea', $attributes); - } - - /** - * Accessor for starting value. - * @return string Parsed value. - * @access public - */ - function getDefault() { - return $this->wrap(html_entity_decode($this->getContent(), ENT_QUOTES)); - } - - /** - * Applies word wrapping if needed. - * @param string $value New value. - * @return boolean True if allowed. - * @access public - */ - function setValue($value) { - return parent::setValue($this->wrap($value)); - } - - /** - * Test to see if text should be wrapped. - * @return boolean True if wrapping on. - * @access private - */ - function wrapIsEnabled() { - if ($this->getAttribute('cols')) { - $wrap = $this->getAttribute('wrap'); - if (($wrap == 'physical') || ($wrap == 'hard')) { - return true; - } - } - return false; - } - - /** - * Performs the formatting that is peculiar to - * this tag. There is strange behaviour in this - * one, including stripping a leading new line. - * Go figure. I am using Firefox as a guide. - * @param string $text Text to wrap. - * @return string Text wrapped with carriage - * returns and line feeds - * @access private - */ - protected function wrap($text) { - $text = str_replace("\r\r\n", "\r\n", str_replace("\n", "\r\n", $text)); - $text = str_replace("\r\n\n", "\r\n", str_replace("\r", "\r\n", $text)); - if (strncmp($text, "\r\n", strlen("\r\n")) == 0) { - $text = substr($text, strlen("\r\n")); - } - if ($this->wrapIsEnabled()) { - return wordwrap( - $text, - (integer)$this->getAttribute('cols'), - "\r\n"); - } - return $text; - } - - /** - * The content of textarea is not part of the page. - * @return boolean True. - * @access public - */ - function isPrivateContent() { - return true; - } -} - -/** - * File upload widget. - * @package SimpleTest - * @subpackage WebTester - */ -class SimpleUploadTag extends SimpleWidget { - - /** - * Starts with attributes only. - * @param hash $attributes Attribute names and - * string values. - */ - function __construct($attributes) { - parent::__construct('input', $attributes); - } - - /** - * Tag contains no content. - * @return boolean False. - * @access public - */ - function expectEndTag() { - return false; - } - - /** - * Dispatches the value into the form encoded packet. - * @param SimpleEncoding $encoding Form packet. - * @access public - */ - function write($encoding) { - if (! file_exists($this->getValue())) { - return; - } - $encoding->attach( - $this->getName(), - implode('', file($this->getValue())), - basename($this->getValue())); - } -} - -/** - * Drop down widget. - * @package SimpleTest - * @subpackage WebTester - */ -class SimpleSelectionTag extends SimpleWidget { - private $options; - private $choice; - - /** - * Starts with attributes only. - * @param hash $attributes Attribute names and - * string values. - */ - function __construct($attributes) { - parent::__construct('select', $attributes); - $this->options = array(); - $this->choice = false; - } - - /** - * Adds an option tag to a selection field. - * @param SimpleOptionTag $tag New option. - * @access public - */ - function addTag($tag) { - if ($tag->getTagName() == 'option') { - $this->options[] = $tag; - } - } - - /** - * Text within the selection element is ignored. - * @param string $content Ignored. - * @access public - */ - function addContent($content) { - return $this; - } - - /** - * Scans options for defaults. If none, then - * the first option is selected. - * @return string Selected field. - * @access public - */ - function getDefault() { - for ($i = 0, $count = count($this->options); $i < $count; $i++) { - if ($this->options[$i]->getAttribute('selected') !== false) { - return $this->options[$i]->getDefault(); - } - } - if ($count > 0) { - return $this->options[0]->getDefault(); - } - return ''; - } - - /** - * Can only set allowed values. - * @param string $value New choice. - * @return boolean True if allowed. - * @access public - */ - function setValue($value) { - for ($i = 0, $count = count($this->options); $i < $count; $i++) { - if ($this->options[$i]->isValue($value)) { - $this->choice = $i; - return true; - } - } - return false; - } - - /** - * Accessor for current selection value. - * @return string Value attribute or - * content of opton. - * @access public - */ - function getValue() { - if ($this->choice === false) { - return $this->getDefault(); - } - return $this->options[$this->choice]->getValue(); - } -} - -/** - * Drop down widget. - * @package SimpleTest - * @subpackage WebTester - */ -class MultipleSelectionTag extends SimpleWidget { - private $options; - private $values; - - /** - * Starts with attributes only. - * @param hash $attributes Attribute names and - * string values. - */ - function __construct($attributes) { - parent::__construct('select', $attributes); - $this->options = array(); - $this->values = false; - } - - /** - * Adds an option tag to a selection field. - * @param SimpleOptionTag $tag New option. - * @access public - */ - function addTag($tag) { - if ($tag->getTagName() == 'option') { - $this->options[] = &$tag; - } - } - - /** - * Text within the selection element is ignored. - * @param string $content Ignored. - * @access public - */ - function addContent($content) { - return $this; - } - - /** - * Scans options for defaults to populate the - * value array(). - * @return array Selected fields. - * @access public - */ - function getDefault() { - $default = array(); - for ($i = 0, $count = count($this->options); $i < $count; $i++) { - if ($this->options[$i]->getAttribute('selected') !== false) { - $default[] = $this->options[$i]->getDefault(); - } - } - return $default; - } - - /** - * Can only set allowed values. Any illegal value - * will result in a failure, but all correct values - * will be set. - * @param array $desired New choices. - * @return boolean True if all allowed. - * @access public - */ - function setValue($desired) { - $achieved = array(); - foreach ($desired as $value) { - $success = false; - for ($i = 0, $count = count($this->options); $i < $count; $i++) { - if ($this->options[$i]->isValue($value)) { - $achieved[] = $this->options[$i]->getValue(); - $success = true; - break; - } - } - if (! $success) { - return false; - } - } - $this->values = $achieved; - return true; - } - - /** - * Accessor for current selection value. - * @return array List of currently set options. - * @access public - */ - function getValue() { - if ($this->values === false) { - return $this->getDefault(); - } - return $this->values; - } -} - -/** - * Option for selection field. - * @package SimpleTest - * @subpackage WebTester - */ -class SimpleOptionTag extends SimpleWidget { - - /** - * Stashes the attributes. - */ - function __construct($attributes) { - parent::__construct('option', $attributes); - } - - /** - * Does nothing. - * @param string $value Ignored. - * @return boolean Not allowed. - * @access public - */ - function setValue($value) { - return false; - } - - /** - * Test to see if a value matches the option. - * @param string $compare Value to compare with. - * @return boolean True if possible match. - * @access public - */ - function isValue($compare) { - $compare = trim($compare); - if (trim($this->getValue()) == $compare) { - return true; - } - return trim(strip_tags($this->getContent())) == $compare; - } - - /** - * Accessor for starting value. Will be set to - * the option label if no value exists. - * @return string Parsed value. - * @access public - */ - function getDefault() { - if ($this->getAttribute('value') === false) { - return strip_tags($this->getContent()); - } - return $this->getAttribute('value'); - } - - /** - * The content of options is not part of the page. - * @return boolean True. - * @access public - */ - function isPrivateContent() { - return true; - } -} - -/** - * Radio button. - * @package SimpleTest - * @subpackage WebTester - */ -class SimpleRadioButtonTag extends SimpleWidget { - - /** - * Stashes the attributes. - * @param array $attributes Hash of attributes. - */ - function __construct($attributes) { - parent::__construct('input', $attributes); - if ($this->getAttribute('value') === false) { - $this->setAttribute('value', 'on'); - } - } - - /** - * Tag contains no content. - * @return boolean False. - * @access public - */ - function expectEndTag() { - return false; - } - - /** - * The only allowed value sn the one in the - * "value" attribute. - * @param string $value New value. - * @return boolean True if allowed. - * @access public - */ - function setValue($value) { - if ($value === false) { - return parent::setValue($value); - } - if ($value != $this->getAttribute('value')) { - return false; - } - return parent::setValue($value); - } - - /** - * Accessor for starting value. - * @return string Parsed value. - * @access public - */ - function getDefault() { - if ($this->getAttribute('checked') !== false) { - return $this->getAttribute('value'); - } - return false; - } -} - -/** - * Checkbox widget. - * @package SimpleTest - * @subpackage WebTester - */ -class SimpleCheckboxTag extends SimpleWidget { - - /** - * Starts with attributes only. - * @param hash $attributes Attribute names and - * string values. - */ - function __construct($attributes) { - parent::__construct('input', $attributes); - if ($this->getAttribute('value') === false) { - $this->setAttribute('value', 'on'); - } - } - - /** - * Tag contains no content. - * @return boolean False. - * @access public - */ - function expectEndTag() { - return false; - } - - /** - * The only allowed value in the one in the - * "value" attribute. The default for this - * attribute is "on". If this widget is set to - * true, then the usual value will be taken. - * @param string $value New value. - * @return boolean True if allowed. - * @access public - */ - function setValue($value) { - if ($value === false) { - return parent::setValue($value); - } - if ($value === true) { - return parent::setValue($this->getAttribute('value')); - } - if ($value != $this->getAttribute('value')) { - return false; - } - return parent::setValue($value); - } - - /** - * Accessor for starting value. The default - * value is "on". - * @return string Parsed value. - * @access public - */ - function getDefault() { - if ($this->getAttribute('checked') !== false) { - return $this->getAttribute('value'); - } - return false; - } -} - -/** - * A group of multiple widgets with some shared behaviour. - * @package SimpleTest - * @subpackage WebTester - */ -class SimpleTagGroup { - private $widgets = array(); - - /** - * Adds a tag to the group. - * @param SimpleWidget $widget - * @access public - */ - function addWidget($widget) { - $this->widgets[] = $widget; - } - - /** - * Accessor to widget set. - * @return array All widgets. - * @access protected - */ - protected function &getWidgets() { - return $this->widgets; - } - - /** - * Accessor for an attribute. - * @param string $label Attribute name. - * @return boolean Always false. - * @access public - */ - function getAttribute($label) { - return false; - } - - /** - * Fetches the name for the widget from the first - * member. - * @return string Name of widget. - * @access public - */ - function getName() { - if (count($this->widgets) > 0) { - return $this->widgets[0]->getName(); - } - } - - /** - * Scans the widgets for one with the appropriate - * ID field. - * @param string $id ID value to try. - * @return boolean True if matched. - * @access public - */ - function isId($id) { - for ($i = 0, $count = count($this->widgets); $i < $count; $i++) { - if ($this->widgets[$i]->isId($id)) { - return true; - } - } - return false; - } - - /** - * Scans the widgets for one with the appropriate - * attached label. - * @param string $label Attached label to try. - * @return boolean True if matched. - * @access public - */ - function isLabel($label) { - for ($i = 0, $count = count($this->widgets); $i < $count; $i++) { - if ($this->widgets[$i]->isLabel($label)) { - return true; - } - } - return false; - } - - /** - * Dispatches the value into the form encoded packet. - * @param SimpleEncoding $encoding Form packet. - * @access public - */ - function write($encoding) { - $encoding->add($this->getName(), $this->getValue()); - } -} - -/** - * A group of tags with the same name within a form. - * @package SimpleTest - * @subpackage WebTester - */ -class SimpleCheckboxGroup extends SimpleTagGroup { - - /** - * Accessor for current selected widget or false - * if none. - * @return string/array Widget values or false if none. - * @access public - */ - function getValue() { - $values = array(); - $widgets = $this->getWidgets(); - for ($i = 0, $count = count($widgets); $i < $count; $i++) { - if ($widgets[$i]->getValue() !== false) { - $values[] = $widgets[$i]->getValue(); - } - } - return $this->coerceValues($values); - } - - /** - * Accessor for starting value that is active. - * @return string/array Widget values or false if none. - * @access public - */ - function getDefault() { - $values = array(); - $widgets = $this->getWidgets(); - for ($i = 0, $count = count($widgets); $i < $count; $i++) { - if ($widgets[$i]->getDefault() !== false) { - $values[] = $widgets[$i]->getDefault(); - } - } - return $this->coerceValues($values); - } - - /** - * Accessor for current set values. - * @param string/array/boolean $values Either a single string, a - * hash or false for nothing set. - * @return boolean True if all values can be set. - * @access public - */ - function setValue($values) { - $values = $this->makeArray($values); - if (! $this->valuesArePossible($values)) { - return false; - } - $widgets = $this->getWidgets(); - for ($i = 0, $count = count($widgets); $i < $count; $i++) { - $possible = $widgets[$i]->getAttribute('value'); - if (in_array($widgets[$i]->getAttribute('value'), $values)) { - $widgets[$i]->setValue($possible); - } else { - $widgets[$i]->setValue(false); - } - } - return true; - } - - /** - * Tests to see if a possible value set is legal. - * @param string/array/boolean $values Either a single string, a - * hash or false for nothing set. - * @return boolean False if trying to set a - * missing value. - * @access private - */ - protected function valuesArePossible($values) { - $matches = array(); - $widgets = &$this->getWidgets(); - for ($i = 0, $count = count($widgets); $i < $count; $i++) { - $possible = $widgets[$i]->getAttribute('value'); - if (in_array($possible, $values)) { - $matches[] = $possible; - } - } - return ($values == $matches); - } - - /** - * Converts the output to an appropriate format. This means - * that no values is false, a single value is just that - * value and only two or more are contained in an array. - * @param array $values List of values of widgets. - * @return string/array/boolean Expected format for a tag. - * @access private - */ - protected function coerceValues($values) { - if (count($values) == 0) { - return false; - } elseif (count($values) == 1) { - return $values[0]; - } else { - return $values; - } - } - - /** - * Converts false or string into array. The opposite of - * the coercian method. - * @param string/array/boolean $value A single item is converted - * to a one item list. False - * gives an empty list. - * @return array List of values, possibly empty. - * @access private - */ - protected function makeArray($value) { - if ($value === false) { - return array(); - } - if (is_string($value)) { - return array($value); - } - return $value; - } -} - -/** - * A group of tags with the same name within a form. - * Used for radio buttons. - * @package SimpleTest - * @subpackage WebTester - */ -class SimpleRadioGroup extends SimpleTagGroup { - - /** - * Each tag is tried in turn until one is - * successfully set. The others will be - * unchecked if successful. - * @param string $value New value. - * @return boolean True if any allowed. - * @access public - */ - function setValue($value) { - if (! $this->valueIsPossible($value)) { - return false; - } - $index = false; - $widgets = $this->getWidgets(); - for ($i = 0, $count = count($widgets); $i < $count; $i++) { - if (! $widgets[$i]->setValue($value)) { - $widgets[$i]->setValue(false); - } - } - return true; - } - - /** - * Tests to see if a value is allowed. - * @param string Attempted value. - * @return boolean True if a valid value. - * @access private - */ - protected function valueIsPossible($value) { - $widgets = $this->getWidgets(); - for ($i = 0, $count = count($widgets); $i < $count; $i++) { - if ($widgets[$i]->getAttribute('value') == $value) { - return true; - } - } - return false; - } - - /** - * Accessor for current selected widget or false - * if none. - * @return string/boolean Value attribute or - * content of opton. - * @access public - */ - function getValue() { - $widgets = $this->getWidgets(); - for ($i = 0, $count = count($widgets); $i < $count; $i++) { - if ($widgets[$i]->getValue() !== false) { - return $widgets[$i]->getValue(); - } - } - return false; - } - - /** - * Accessor for starting value that is active. - * @return string/boolean Value of first checked - * widget or false if none. - * @access public - */ - function getDefault() { - $widgets = $this->getWidgets(); - for ($i = 0, $count = count($widgets); $i < $count; $i++) { - if ($widgets[$i]->getDefault() !== false) { - return $widgets[$i]->getDefault(); - } - } - return false; - } -} - -/** - * Tag to keep track of labels. - * @package SimpleTest - * @subpackage WebTester - */ -class SimpleLabelTag extends SimpleTag { - - /** - * Starts with a named tag with attributes only. - * @param hash $attributes Attribute names and - * string values. - */ - function __construct($attributes) { - parent::__construct('label', $attributes); - } - - /** - * Access for the ID to attach the label to. - * @return string For attribute. - * @access public - */ - function getFor() { - return $this->getAttribute('for'); - } -} - -/** - * Tag to aid parsing the form. - * @package SimpleTest - * @subpackage WebTester - */ -class SimpleFormTag extends SimpleTag { - - /** - * Starts with a named tag with attributes only. - * @param hash $attributes Attribute names and - * string values. - */ - function __construct($attributes) { - parent::__construct('form', $attributes); - } -} - -/** - * Tag to aid parsing the frames in a page. - * @package SimpleTest - * @subpackage WebTester - */ -class SimpleFrameTag extends SimpleTag { - - /** - * Starts with a named tag with attributes only. - * @param hash $attributes Attribute names and - * string values. - */ - function __construct($attributes) { - parent::__construct('frame', $attributes); - } - - /** - * Tag contains no content. - * @return boolean False. - * @access public - */ - function expectEndTag() { - return false; - } -} -?> \ No newline at end of file diff --git a/3rdparty/simpletest/test_case.php b/3rdparty/simpletest/test_case.php deleted file mode 100644 index ba023c3b2e..0000000000 --- a/3rdparty/simpletest/test_case.php +++ /dev/null @@ -1,658 +0,0 @@ -label = $label; - } - } - - /** - * Accessor for the test name for subclasses. - * @return string Name of the test. - * @access public - */ - function getLabel() { - return $this->label ? $this->label : get_class($this); - } - - /** - * This is a placeholder for skipping tests. In this - * method you place skipIf() and skipUnless() calls to - * set the skipping state. - * @access public - */ - function skip() { - } - - /** - * Will issue a message to the reporter and tell the test - * case to skip if the incoming flag is true. - * @param string $should_skip Condition causing the tests to be skipped. - * @param string $message Text of skip condition. - * @access public - */ - function skipIf($should_skip, $message = '%s') { - if ($should_skip && ! $this->should_skip) { - $this->should_skip = true; - $message = sprintf($message, 'Skipping [' . get_class($this) . ']'); - $this->reporter->paintSkip($message . $this->getAssertionLine()); - } - } - - /** - * Accessor for the private variable $_shoud_skip - * @access public - */ - function shouldSkip() { - return $this->should_skip; - } - - /** - * Will issue a message to the reporter and tell the test - * case to skip if the incoming flag is false. - * @param string $shouldnt_skip Condition causing the tests to be run. - * @param string $message Text of skip condition. - * @access public - */ - function skipUnless($shouldnt_skip, $message = false) { - $this->skipIf(! $shouldnt_skip, $message); - } - - /** - * Used to invoke the single tests. - * @return SimpleInvoker Individual test runner. - * @access public - */ - function createInvoker() { - return new SimpleErrorTrappingInvoker( - new SimpleExceptionTrappingInvoker(new SimpleInvoker($this))); - } - - /** - * Uses reflection to run every method within itself - * starting with the string "test" unless a method - * is specified. - * @param SimpleReporter $reporter Current test reporter. - * @return boolean True if all tests passed. - * @access public - */ - function run($reporter) { - $context = SimpleTest::getContext(); - $context->setTest($this); - $context->setReporter($reporter); - $this->reporter = $reporter; - $started = false; - foreach ($this->getTests() as $method) { - if ($reporter->shouldInvoke($this->getLabel(), $method)) { - $this->skip(); - if ($this->should_skip) { - break; - } - if (! $started) { - $reporter->paintCaseStart($this->getLabel()); - $started = true; - } - $invoker = $this->reporter->createInvoker($this->createInvoker()); - $invoker->before($method); - $invoker->invoke($method); - $invoker->after($method); - } - } - if ($started) { - $reporter->paintCaseEnd($this->getLabel()); - } - unset($this->reporter); - $context->setTest(null); - return $reporter->getStatus(); - } - - /** - * Gets a list of test names. Normally that will - * be all internal methods that start with the - * name "test". This method should be overridden - * if you want a different rule. - * @return array List of test names. - * @access public - */ - function getTests() { - $methods = array(); - foreach (get_class_methods(get_class($this)) as $method) { - if ($this->isTest($method)) { - $methods[] = $method; - } - } - return $methods; - } - - /** - * Tests to see if the method is a test that should - * be run. Currently any method that starts with 'test' - * is a candidate unless it is the constructor. - * @param string $method Method name to try. - * @return boolean True if test method. - * @access protected - */ - protected function isTest($method) { - if (strtolower(substr($method, 0, 4)) == 'test') { - return ! SimpleTestCompatibility::isA($this, strtolower($method)); - } - return false; - } - - /** - * Announces the start of the test. - * @param string $method Test method just started. - * @access public - */ - function before($method) { - $this->reporter->paintMethodStart($method); - $this->observers = array(); - } - - /** - * Sets up unit test wide variables at the start - * of each test method. To be overridden in - * actual user test cases. - * @access public - */ - function setUp() { - } - - /** - * Clears the data set in the setUp() method call. - * To be overridden by the user in actual user test cases. - * @access public - */ - function tearDown() { - } - - /** - * Announces the end of the test. Includes private clean up. - * @param string $method Test method just finished. - * @access public - */ - function after($method) { - for ($i = 0; $i < count($this->observers); $i++) { - $this->observers[$i]->atTestEnd($method, $this); - } - $this->reporter->paintMethodEnd($method); - } - - /** - * Sets up an observer for the test end. - * @param object $observer Must have atTestEnd() - * method. - * @access public - */ - function tell($observer) { - $this->observers[] = &$observer; - } - - /** - * @deprecated - */ - function pass($message = "Pass") { - if (! isset($this->reporter)) { - trigger_error('Can only make assertions within test methods'); - } - $this->reporter->paintPass( - $message . $this->getAssertionLine()); - return true; - } - - /** - * Sends a fail event with a message. - * @param string $message Message to send. - * @access public - */ - function fail($message = "Fail") { - if (! isset($this->reporter)) { - trigger_error('Can only make assertions within test methods'); - } - $this->reporter->paintFail( - $message . $this->getAssertionLine()); - return false; - } - - /** - * Formats a PHP error and dispatches it to the - * reporter. - * @param integer $severity PHP error code. - * @param string $message Text of error. - * @param string $file File error occoured in. - * @param integer $line Line number of error. - * @access public - */ - function error($severity, $message, $file, $line) { - if (! isset($this->reporter)) { - trigger_error('Can only make assertions within test methods'); - } - $this->reporter->paintError( - "Unexpected PHP error [$message] severity [$severity] in [$file line $line]"); - } - - /** - * Formats an exception and dispatches it to the - * reporter. - * @param Exception $exception Object thrown. - * @access public - */ - function exception($exception) { - $this->reporter->paintException($exception); - } - - /** - * For user defined expansion of the available messages. - * @param string $type Tag for sorting the signals. - * @param mixed $payload Extra user specific information. - */ - function signal($type, $payload) { - if (! isset($this->reporter)) { - trigger_error('Can only make assertions within test methods'); - } - $this->reporter->paintSignal($type, $payload); - } - - /** - * Runs an expectation directly, for extending the - * tests with new expectation classes. - * @param SimpleExpectation $expectation Expectation subclass. - * @param mixed $compare Value to compare. - * @param string $message Message to display. - * @return boolean True on pass - * @access public - */ - function assert($expectation, $compare, $message = '%s') { - if ($expectation->test($compare)) { - return $this->pass(sprintf( - $message, - $expectation->overlayMessage($compare, $this->reporter->getDumper()))); - } else { - return $this->fail(sprintf( - $message, - $expectation->overlayMessage($compare, $this->reporter->getDumper()))); - } - } - - /** - * Uses a stack trace to find the line of an assertion. - * @return string Line number of first assert* - * method embedded in format string. - * @access public - */ - function getAssertionLine() { - $trace = new SimpleStackTrace(array('assert', 'expect', 'pass', 'fail', 'skip')); - return $trace->traceMethod(); - } - - /** - * Sends a formatted dump of a variable to the - * test suite for those emergency debugging - * situations. - * @param mixed $variable Variable to display. - * @param string $message Message to display. - * @return mixed The original variable. - * @access public - */ - function dump($variable, $message = false) { - $dumper = $this->reporter->getDumper(); - $formatted = $dumper->dump($variable); - if ($message) { - $formatted = $message . "\n" . $formatted; - } - $this->reporter->paintFormattedMessage($formatted); - return $variable; - } - - /** - * Accessor for the number of subtests including myelf. - * @return integer Number of test cases. - * @access public - */ - function getSize() { - return 1; - } -} - -/** - * Helps to extract test cases automatically from a file. - * @package SimpleTest - * @subpackage UnitTester - */ -class SimpleFileLoader { - - /** - * Builds a test suite from a library of test cases. - * The new suite is composed into this one. - * @param string $test_file File name of library with - * test case classes. - * @return TestSuite The new test suite. - * @access public - */ - function load($test_file) { - $existing_classes = get_declared_classes(); - $existing_globals = get_defined_vars(); - include_once($test_file); - $new_globals = get_defined_vars(); - $this->makeFileVariablesGlobal($existing_globals, $new_globals); - $new_classes = array_diff(get_declared_classes(), $existing_classes); - if (empty($new_classes)) { - $new_classes = $this->scrapeClassesFromFile($test_file); - } - $classes = $this->selectRunnableTests($new_classes); - return $this->createSuiteFromClasses($test_file, $classes); - } - - /** - * Imports new variables into the global namespace. - * @param hash $existing Variables before the file was loaded. - * @param hash $new Variables after the file was loaded. - * @access private - */ - protected function makeFileVariablesGlobal($existing, $new) { - $globals = array_diff(array_keys($new), array_keys($existing)); - foreach ($globals as $global) { - $GLOBALS[$global] = $new[$global]; - } - } - - /** - * Lookup classnames from file contents, in case the - * file may have been included before. - * Note: This is probably too clever by half. Figuring this - * out after a failed test case is going to be tricky for us, - * never mind the user. A test case should not be included - * twice anyway. - * @param string $test_file File name with classes. - * @access private - */ - protected function scrapeClassesFromFile($test_file) { - preg_match_all('~^\s*class\s+(\w+)(\s+(extends|implements)\s+\w+)*\s*\{~mi', - file_get_contents($test_file), - $matches ); - return $matches[1]; - } - - /** - * Calculates the incoming test cases. Skips abstract - * and ignored classes. - * @param array $candidates Candidate classes. - * @return array New classes which are test - * cases that shouldn't be ignored. - * @access public - */ - function selectRunnableTests($candidates) { - $classes = array(); - foreach ($candidates as $class) { - if (TestSuite::getBaseTestCase($class)) { - $reflection = new SimpleReflection($class); - if ($reflection->isAbstract()) { - SimpleTest::ignore($class); - } else { - $classes[] = $class; - } - } - } - return $classes; - } - - /** - * Builds a test suite from a class list. - * @param string $title Title of new group. - * @param array $classes Test classes. - * @return TestSuite Group loaded with the new - * test cases. - * @access public - */ - function createSuiteFromClasses($title, $classes) { - if (count($classes) == 0) { - $suite = new BadTestSuite($title, "No runnable test cases in [$title]"); - return $suite; - } - SimpleTest::ignoreParentsIfIgnored($classes); - $suite = new TestSuite($title); - foreach ($classes as $class) { - if (! SimpleTest::isIgnored($class)) { - $suite->add($class); - } - } - return $suite; - } -} - -/** - * This is a composite test class for combining - * test cases and other RunnableTest classes into - * a group test. - * @package SimpleTest - * @subpackage UnitTester - */ -class TestSuite { - private $label; - private $test_cases; - - /** - * Sets the name of the test suite. - * @param string $label Name sent at the start and end - * of the test. - * @access public - */ - function TestSuite($label = false) { - $this->label = $label; - $this->test_cases = array(); - } - - /** - * Accessor for the test name for subclasses. If the suite - * wraps a single test case the label defaults to the name of that test. - * @return string Name of the test. - * @access public - */ - function getLabel() { - if (! $this->label) { - return ($this->getSize() == 1) ? - get_class($this->test_cases[0]) : get_class($this); - } else { - return $this->label; - } - } - - /** - * Adds a test into the suite by instance or class. The class will - * be instantiated if it's a test suite. - * @param SimpleTestCase $test_case Suite or individual test - * case implementing the - * runnable test interface. - * @access public - */ - function add($test_case) { - if (! is_string($test_case)) { - $this->test_cases[] = $test_case; - } elseif (TestSuite::getBaseTestCase($test_case) == 'testsuite') { - $this->test_cases[] = new $test_case(); - } else { - $this->test_cases[] = $test_case; - } - } - - /** - * Builds a test suite from a library of test cases. - * The new suite is composed into this one. - * @param string $test_file File name of library with - * test case classes. - * @access public - */ - function addFile($test_file) { - $extractor = new SimpleFileLoader(); - $this->add($extractor->load($test_file)); - } - - /** - * Delegates to a visiting collector to add test - * files. - * @param string $path Path to scan from. - * @param SimpleCollector $collector Directory scanner. - * @access public - */ - function collect($path, $collector) { - $collector->collect($this, $path); - } - - /** - * Invokes run() on all of the held test cases, instantiating - * them if necessary. - * @param SimpleReporter $reporter Current test reporter. - * @access public - */ - function run($reporter) { - $reporter->paintGroupStart($this->getLabel(), $this->getSize()); - for ($i = 0, $count = count($this->test_cases); $i < $count; $i++) { - if (is_string($this->test_cases[$i])) { - $class = $this->test_cases[$i]; - $test = new $class(); - $test->run($reporter); - unset($test); - } else { - $this->test_cases[$i]->run($reporter); - } - } - $reporter->paintGroupEnd($this->getLabel()); - return $reporter->getStatus(); - } - - /** - * Number of contained test cases. - * @return integer Total count of cases in the group. - * @access public - */ - function getSize() { - $count = 0; - foreach ($this->test_cases as $case) { - if (is_string($case)) { - if (! SimpleTest::isIgnored($case)) { - $count++; - } - } else { - $count += $case->getSize(); - } - } - return $count; - } - - /** - * Test to see if a class is derived from the - * SimpleTestCase class. - * @param string $class Class name. - * @access public - */ - static function getBaseTestCase($class) { - while ($class = get_parent_class($class)) { - $class = strtolower($class); - if ($class == 'simpletestcase' || $class == 'testsuite') { - return $class; - } - } - return false; - } -} - -/** - * This is a failing group test for when a test suite hasn't - * loaded properly. - * @package SimpleTest - * @subpackage UnitTester - */ -class BadTestSuite { - private $label; - private $error; - - /** - * Sets the name of the test suite and error message. - * @param string $label Name sent at the start and end - * of the test. - * @access public - */ - function BadTestSuite($label, $error) { - $this->label = $label; - $this->error = $error; - } - - /** - * Accessor for the test name for subclasses. - * @return string Name of the test. - * @access public - */ - function getLabel() { - return $this->label; - } - - /** - * Sends a single error to the reporter. - * @param SimpleReporter $reporter Current test reporter. - * @access public - */ - function run($reporter) { - $reporter->paintGroupStart($this->getLabel(), $this->getSize()); - $reporter->paintFail('Bad TestSuite [' . $this->getLabel() . - '] with error [' . $this->error . ']'); - $reporter->paintGroupEnd($this->getLabel()); - return $reporter->getStatus(); - } - - /** - * Number of contained test cases. Always zero. - * @return integer Total count of cases in the group. - * @access public - */ - function getSize() { - return 0; - } -} -?> diff --git a/3rdparty/simpletest/tidy_parser.php b/3rdparty/simpletest/tidy_parser.php deleted file mode 100644 index 3d8b4b2ac7..0000000000 --- a/3rdparty/simpletest/tidy_parser.php +++ /dev/null @@ -1,382 +0,0 @@ -free(); - } - - /** - * Frees up any references so as to allow the PHP garbage - * collection from unset() to work. - */ - private function free() { - unset($this->page); - $this->forms = array(); - $this->labels = array(); - } - - /** - * This builder is only available if the 'tidy' extension is loaded. - * @return boolean True if available. - */ - function can() { - return extension_loaded('tidy'); - } - - /** - * Reads the raw content the page using HTML Tidy. - * @param $response SimpleHttpResponse Fetched response. - * @return SimplePage Newly parsed page. - */ - function parse($response) { - $this->page = new SimplePage($response); - $tidied = tidy_parse_string($input = $this->insertGuards($response->getContent()), - array('output-xml' => false, 'wrap' => '0', 'indent' => 'no'), - 'latin1'); - $this->walkTree($tidied->html()); - $this->attachLabels($this->widgets_by_id, $this->labels); - $this->page->setForms($this->forms); - $page = $this->page; - $this->free(); - return $page; - } - - /** - * Stops HTMLTidy stripping content that we wish to preserve. - * @param string The raw html. - * @return string The html with guard tags inserted. - */ - private function insertGuards($html) { - return $this->insertEmptyTagGuards($this->insertTextareaSimpleWhitespaceGuards($html)); - } - - /** - * Removes the extra content added during the parse stage - * in order to preserve content we don't want stripped - * out by HTMLTidy. - * @param string The raw html. - * @return string The html with guard tags removed. - */ - private function stripGuards($html) { - return $this->stripTextareaWhitespaceGuards($this->stripEmptyTagGuards($html)); - } - - /** - * HTML tidy strips out empty tags such as
                -
                + diff --git a/apps/files/templates/part.breadcrumb.php b/apps/files/templates/part.breadcrumb.php index 875fc747bb..71b695f65f 100644 --- a/apps/files/templates/part.breadcrumb.php +++ b/apps/files/templates/part.breadcrumb.php @@ -1,6 +1,6 @@ -
                svg" data-dir='' style='background-image:url("")'> - "> +
                svg" data-dir='' style='background-image:url("")'> + ">
                diff --git a/apps/files/templates/part.list.php b/apps/files/templates/part.list.php index 8faeae3939..0f5b839b18 100644 --- a/apps/files/templates/part.list.php +++ b/apps/files/templates/part.list.php @@ -1,3 +1,12 @@ + + Server side encryption of files. DEPRECATED. This app is no longer supported and will be replaced with an improved version in ownCloud 5. Only enable this features if you want to read old encrypted data. Warning: You will lose your data if you enable this App and forget your password. Encryption is not yet compatible with LDAP. AGPL Robin Appelman - 4 + 4.9 true diff --git a/apps/files_encryption/l10n/de_DE.php b/apps/files_encryption/l10n/de_DE.php new file mode 100644 index 0000000000..d486a82322 --- /dev/null +++ b/apps/files_encryption/l10n/de_DE.php @@ -0,0 +1,6 @@ + "Verschlüsselung", +"Exclude the following file types from encryption" => "Die folgenden Dateitypen von der Verschlüsselung ausnehmen", +"None" => "Keine", +"Enable Encryption" => "Verschlüsselung aktivieren" +); diff --git a/apps/files_encryption/l10n/ku_IQ.php b/apps/files_encryption/l10n/ku_IQ.php new file mode 100644 index 0000000000..bd8977ac51 --- /dev/null +++ b/apps/files_encryption/l10n/ku_IQ.php @@ -0,0 +1,6 @@ + "نهێنیکردن", +"Exclude the following file types from encryption" => "به‌ربه‌ست کردنی ئه‌م جۆره‌ په‌ڕگانه له‌ نهێنیکردن", +"None" => "هیچ", +"Enable Encryption" => "چالاکردنی نهێنیکردن" +); diff --git a/apps/files_external/ajax/addRootCertificate.php b/apps/files_external/ajax/addRootCertificate.php index e0a0239c95..72eb30009d 100644 --- a/apps/files_external/ajax/addRootCertificate.php +++ b/apps/files_external/ajax/addRootCertificate.php @@ -3,23 +3,23 @@ OCP\JSON::checkAppEnabled('files_external'); if ( !($filename = $_FILES['rootcert_import']['name']) ) { - header("Location: settings/personal.php"); + header("Location: settings/personal.php"); exit; } -$fh = fopen($_FILES['rootcert_import']['tmp_name'], 'r'); -$data = fread($fh, filesize($_FILES['rootcert_import']['tmp_name'])); +$fh = fopen($_FILES['rootcert_import']['tmp_name'], 'r'); +$data = fread($fh, filesize($_FILES['rootcert_import']['tmp_name'])); fclose($fh); $filename = $_FILES['rootcert_import']['name']; - -$view = new \OC_FilesystemView('/'.\OCP\User::getUser().'/files_external/uploads'); + +$view = new \OC_FilesystemView('/'.\OCP\User::getUser().'/files_external/uploads'); if (!$view->file_exists('')) $view->mkdir(''); $isValid = openssl_pkey_get_public($data); //maybe it was just the wrong file format, try to convert it... if ($isValid == false) { - $data = chunk_split(base64_encode($data), 64, "\n"); + $data = chunk_split(base64_encode($data), 64, "\n"); $data = "-----BEGIN CERTIFICATE-----\n".$data."-----END CERTIFICATE-----\n"; $isValid = openssl_pkey_get_public($data); } diff --git a/apps/files_external/ajax/removeRootCertificate.php b/apps/files_external/ajax/removeRootCertificate.php index 6871b0fd1d..664b3937e9 100644 --- a/apps/files_external/ajax/removeRootCertificate.php +++ b/apps/files_external/ajax/removeRootCertificate.php @@ -11,4 +11,3 @@ if ( $view->file_exists($file) ) { $view->unlink($file); OC_Mount_Config::createCertificateBundle(); } - diff --git a/apps/files_external/appinfo/info.xml b/apps/files_external/appinfo/info.xml index e0301365d1..3da1913c5f 100644 --- a/apps/files_external/appinfo/info.xml +++ b/apps/files_external/appinfo/info.xml @@ -5,7 +5,7 @@ Mount external storage sources AGPL Robin Appelman, Michael Gapczynski - 4 + 4.9 true diff --git a/apps/files_external/js/dropbox.js b/apps/files_external/js/dropbox.js index 6082fdd2cb..c1e3864070 100644 --- a/apps/files_external/js/dropbox.js +++ b/apps/files_external/js/dropbox.js @@ -4,7 +4,7 @@ $(document).ready(function() { var configured = $(this).find('[data-parameter="configured"]'); if ($(configured).val() == 'true') { $(this).find('.configuration input').attr('disabled', 'disabled'); - $(this).find('.configuration').append('Access granted'); + $(this).find('.configuration').append(''+t('files_external', 'Access granted')+''); } else { var app_key = $(this).find('.configuration [data-parameter="app_key"]').val(); var app_secret = $(this).find('.configuration [data-parameter="app_secret"]').val(); @@ -22,14 +22,16 @@ $(document).ready(function() { $(configured).val('true'); OC.MountConfig.saveStorage(tr); $(tr).find('.configuration input').attr('disabled', 'disabled'); - $(tr).find('.configuration').append('Access granted'); + $(tr).find('.configuration').append(''+t('files_external', 'Access granted')+''); } else { - OC.dialogs.alert(result.data.message, 'Error configuring Dropbox storage'); + OC.dialogs.alert(result.data.message, + t('files_external', 'Error configuring Dropbox storage') + ); } }); } } else if ($(this).find('.mountPoint input').val() != '' && $(config).find('[data-parameter="app_key"]').val() != '' && $(config).find('[data-parameter="app_secret"]').val() != '' && $(this).find('.dropbox').length == 0) { - $(this).find('.configuration').append('Grant access'); + $(this).find('.configuration').append(''+t('files_external', 'Grant access')+''); } } }); @@ -40,7 +42,7 @@ $(document).ready(function() { var config = $(tr).find('.configuration'); if ($(tr).find('.mountPoint input').val() != '' && $(config).find('[data-parameter="app_key"]').val() != '' && $(config).find('[data-parameter="app_secret"]').val() != '') { if ($(tr).find('.dropbox').length == 0) { - $(config).append('Grant access'); + $(config).append(''+t('files_external', 'Grant access')+''); } else { $(tr).find('.dropbox').show(); } @@ -67,14 +69,22 @@ $(document).ready(function() { if (OC.MountConfig.saveStorage(tr)) { window.location = result.data.url; } else { - OC.dialogs.alert('Fill out all required fields', 'Error configuring Dropbox storage'); + OC.dialogs.alert( + t('files_external', 'Fill out all required fields'), + t('files_external', 'Error configuring Dropbox storage') + ); } } else { - OC.dialogs.alert(result.data.message, 'Error configuring Dropbox storage'); + OC.dialogs.alert(result.data.message, + t('files_external', 'Error configuring Dropbox storage') + ); } }); } else { - OC.dialogs.alert('Please provide a valid Dropbox app key and secret.', 'Error configuring Dropbox storage'); + OC.dialogs.alert( + t('files_external', 'Please provide a valid Dropbox app key and secret.'), + t('files_external', 'Error configuring Dropbox storage') + ); } }); diff --git a/apps/files_external/js/google.js b/apps/files_external/js/google.js index 7c62297df4..0b3c314eb5 100644 --- a/apps/files_external/js/google.js +++ b/apps/files_external/js/google.js @@ -3,7 +3,8 @@ $(document).ready(function() { $('#externalStorage tbody tr.OC_Filestorage_Google').each(function() { var configured = $(this).find('[data-parameter="configured"]'); if ($(configured).val() == 'true') { - $(this).find('.configuration').append('Access granted'); + $(this).find('.configuration') + .append(''+t('files_external', 'Access granted')+''); } else { var token = $(this).find('[data-parameter="token"]'); var token_secret = $(this).find('[data-parameter="token_secret"]'); @@ -19,13 +20,15 @@ $(document).ready(function() { $(token_secret).val(result.access_token_secret); $(configured).val('true'); OC.MountConfig.saveStorage(tr); - $(tr).find('.configuration').append('Access granted'); + $(tr).find('.configuration').append(''+t('files_external', 'Access granted')+''); } else { - OC.dialogs.alert(result.data.message, 'Error configuring Google Drive storage'); + OC.dialogs.alert(result.data.message, + t('files_external', 'Error configuring Google Drive storage') + ); } }); } else if ($(this).find('.google').length == 0) { - $(this).find('.configuration').append('Grant access'); + $(this).find('.configuration').append(''+t('files_external', 'Grant access')+''); } } }); @@ -34,7 +37,7 @@ $(document).ready(function() { if ($(this).hasClass('OC_Filestorage_Google') && $(this).find('[data-parameter="configured"]').val() != 'true') { if ($(this).find('.mountPoint input').val() != '') { if ($(this).find('.google').length == 0) { - $(this).find('.configuration').append('Grant access'); + $(this).find('.configuration').append(''+t('files_external', 'Grant access')+''); } } } @@ -65,10 +68,15 @@ $(document).ready(function() { if (OC.MountConfig.saveStorage(tr)) { window.location = result.data.url; } else { - OC.dialogs.alert('Fill out all required fields', 'Error configuring Google Drive storage'); + OC.dialogs.alert( + t('files_external', 'Fill out all required fields'), + t('files_external', 'Error configuring Google Drive storage') + ); } } else { - OC.dialogs.alert(result.data.message, 'Error configuring Google Drive storage'); + OC.dialogs.alert(result.data.message, + t('files_external', 'Error configuring Google Drive storage') + ); } }); }); diff --git a/apps/files_external/l10n/ca.php b/apps/files_external/l10n/ca.php index aa93379c35..fc6706381b 100644 --- a/apps/files_external/l10n/ca.php +++ b/apps/files_external/l10n/ca.php @@ -1,4 +1,10 @@ "S'ha concedit l'accés", +"Error configuring Dropbox storage" => "Error en configurar l'emmagatzemament Dropbox", +"Grant access" => "Concedeix accés", +"Fill out all required fields" => "Ompliu els camps requerits", +"Please provide a valid Dropbox app key and secret." => "Proporcioneu una clau d'aplicació i secret vàlids per a Dropbox", +"Error configuring Google Drive storage" => "Error en configurar l'emmagatzemament Google Drive", "External Storage" => "Emmagatzemament extern", "Mount point" => "Punt de muntatge", "Backend" => "Dorsal", @@ -11,8 +17,8 @@ "Groups" => "Grups", "Users" => "Usuaris", "Delete" => "Elimina", -"SSL root certificates" => "Certificats SSL root", -"Import Root Certificate" => "Importa certificat root", "Enable User External Storage" => "Habilita l'emmagatzemament extern d'usuari", -"Allow users to mount their own external storage" => "Permet als usuaris muntar el seu emmagatzemament extern propi" +"Allow users to mount their own external storage" => "Permet als usuaris muntar el seu emmagatzemament extern propi", +"SSL root certificates" => "Certificats SSL root", +"Import Root Certificate" => "Importa certificat root" ); diff --git a/apps/files_external/l10n/cs_CZ.php b/apps/files_external/l10n/cs_CZ.php index 7589960334..51951c19bf 100644 --- a/apps/files_external/l10n/cs_CZ.php +++ b/apps/files_external/l10n/cs_CZ.php @@ -1,4 +1,10 @@ "Přístup povolen", +"Error configuring Dropbox storage" => "Chyba při nastavení úložiště Dropbox", +"Grant access" => "Povolit přístup", +"Fill out all required fields" => "Vyplňte všechna povinná pole", +"Please provide a valid Dropbox app key and secret." => "Zadejte, prosím, platný klíč a bezpečnostní frázi aplikace Dropbox.", +"Error configuring Google Drive storage" => "Chyba při nastavení úložiště Google Drive", "External Storage" => "Externí úložiště", "Mount point" => "Přípojný bod", "Backend" => "Podpůrná vrstva", @@ -11,8 +17,8 @@ "Groups" => "Skupiny", "Users" => "Uživatelé", "Delete" => "Smazat", -"SSL root certificates" => "Kořenové certifikáty SSL", -"Import Root Certificate" => "Importovat kořenového certifikátu", "Enable User External Storage" => "Zapnout externí uživatelské úložiště", -"Allow users to mount their own external storage" => "Povolit uživatelům připojení jejich vlastních externích úložišť" +"Allow users to mount their own external storage" => "Povolit uživatelům připojení jejich vlastních externích úložišť", +"SSL root certificates" => "Kořenové certifikáty SSL", +"Import Root Certificate" => "Importovat kořenového certifikátu" ); diff --git a/apps/files_external/l10n/da.php b/apps/files_external/l10n/da.php index e4f1b9bb5e..00a81f3da1 100644 --- a/apps/files_external/l10n/da.php +++ b/apps/files_external/l10n/da.php @@ -1,4 +1,10 @@ "Adgang godkendt", +"Error configuring Dropbox storage" => "Fejl ved konfiguration af Dropbox plads", +"Grant access" => "Godkend adgang", +"Fill out all required fields" => "Udfyld alle nødvendige felter", +"Please provide a valid Dropbox app key and secret." => "Angiv venligst en valid Dropbox app nøgle og hemmelighed", +"Error configuring Google Drive storage" => "Fejl ved konfiguration af Google Drive plads", "External Storage" => "Ekstern opbevaring", "Mount point" => "Monteringspunkt", "Backend" => "Backend", diff --git a/apps/files_external/l10n/de.php b/apps/files_external/l10n/de.php index 4306ad33dc..5d57e5e459 100644 --- a/apps/files_external/l10n/de.php +++ b/apps/files_external/l10n/de.php @@ -1,4 +1,10 @@ "Zugriff gestattet", +"Error configuring Dropbox storage" => "Fehler beim Einrichten von Dropbox", +"Grant access" => "Zugriff gestatten", +"Fill out all required fields" => "Bitte alle notwendigen Felder füllen", +"Please provide a valid Dropbox app key and secret." => "Bitte trage einen gültigen Dropbox-App-Key mit Secret ein.", +"Error configuring Google Drive storage" => "Fehler beim Einrichten von Google Drive", "External Storage" => "Externer Speicher", "Mount point" => "Mount-Point", "Backend" => "Backend", @@ -11,8 +17,8 @@ "Groups" => "Gruppen", "Users" => "Benutzer", "Delete" => "Löschen", -"SSL root certificates" => "SSL-Root-Zertifikate", -"Import Root Certificate" => "Root-Zertifikate importieren", "Enable User External Storage" => "Externen Speicher für Benutzer aktivieren", -"Allow users to mount their own external storage" => "Erlaubt Benutzern ihre eigenen externen Speicher einzubinden" +"Allow users to mount their own external storage" => "Erlaubt Benutzern ihre eigenen externen Speicher einzubinden", +"SSL root certificates" => "SSL-Root-Zertifikate", +"Import Root Certificate" => "Root-Zertifikate importieren" ); diff --git a/apps/files_external/l10n/de_DE.php b/apps/files_external/l10n/de_DE.php new file mode 100644 index 0000000000..5d57e5e459 --- /dev/null +++ b/apps/files_external/l10n/de_DE.php @@ -0,0 +1,24 @@ + "Zugriff gestattet", +"Error configuring Dropbox storage" => "Fehler beim Einrichten von Dropbox", +"Grant access" => "Zugriff gestatten", +"Fill out all required fields" => "Bitte alle notwendigen Felder füllen", +"Please provide a valid Dropbox app key and secret." => "Bitte trage einen gültigen Dropbox-App-Key mit Secret ein.", +"Error configuring Google Drive storage" => "Fehler beim Einrichten von Google Drive", +"External Storage" => "Externer Speicher", +"Mount point" => "Mount-Point", +"Backend" => "Backend", +"Configuration" => "Konfiguration", +"Options" => "Optionen", +"Applicable" => "Zutreffend", +"Add mount point" => "Mount-Point hinzufügen", +"None set" => "Nicht definiert", +"All Users" => "Alle Benutzer", +"Groups" => "Gruppen", +"Users" => "Benutzer", +"Delete" => "Löschen", +"Enable User External Storage" => "Externen Speicher für Benutzer aktivieren", +"Allow users to mount their own external storage" => "Erlaubt Benutzern ihre eigenen externen Speicher einzubinden", +"SSL root certificates" => "SSL-Root-Zertifikate", +"Import Root Certificate" => "Root-Zertifikate importieren" +); diff --git a/apps/files_external/l10n/el.php b/apps/files_external/l10n/el.php index 3de151eb75..a1dae9d488 100644 --- a/apps/files_external/l10n/el.php +++ b/apps/files_external/l10n/el.php @@ -1,4 +1,10 @@ "Προσβαση παρασχέθηκε", +"Error configuring Dropbox storage" => "Σφάλμα ρυθμίζωντας αποθήκευση Dropbox ", +"Grant access" => "Παροχή πρόσβασης", +"Fill out all required fields" => "Συμπληρώστε όλα τα απαιτούμενα πεδία", +"Please provide a valid Dropbox app key and secret." => "Παρακαλούμε δώστε έγκυρο κλειδί Dropbox και μυστικό.", +"Error configuring Google Drive storage" => "Σφάλμα ρυθμίζωντας αποθήκευση Google Drive ", "External Storage" => "Εξωτερικό Αποθηκευτικό Μέσο", "Mount point" => "Σημείο προσάρτησης", "Backend" => "Σύστημα υποστήριξης", @@ -7,12 +13,12 @@ "Applicable" => "Εφαρμόσιμο", "Add mount point" => "Προσθήκη σημείου προσάρτησης", "None set" => "Κανένα επιλεγμένο", -"All Users" => "Όλοι οι χρήστες", +"All Users" => "Όλοι οι Χρήστες", "Groups" => "Ομάδες", "Users" => "Χρήστες", "Delete" => "Διαγραφή", -"SSL root certificates" => "Πιστοποιητικά SSL root", -"Import Root Certificate" => "Εισαγωγή Πιστοποιητικού Root", "Enable User External Storage" => "Ενεργοποίηση Εξωτερικού Αποθηκευτικού Χώρου Χρήστη", -"Allow users to mount their own external storage" => "Να επιτρέπεται στους χρήστες να προσαρτούν δικό τους εξωτερικό αποθηκευτικό χώρο" +"Allow users to mount their own external storage" => "Να επιτρέπεται στους χρήστες να προσαρτούν δικό τους εξωτερικό αποθηκευτικό χώρο", +"SSL root certificates" => "Πιστοποιητικά SSL root", +"Import Root Certificate" => "Εισαγωγή Πιστοποιητικού Root" ); diff --git a/apps/files_external/l10n/eo.php b/apps/files_external/l10n/eo.php index 3cb8255c52..97453aafed 100644 --- a/apps/files_external/l10n/eo.php +++ b/apps/files_external/l10n/eo.php @@ -1,4 +1,10 @@ "Alirpermeso donita", +"Error configuring Dropbox storage" => "Eraro dum agordado de la memorservo Dropbox", +"Grant access" => "Doni alirpermeson", +"Fill out all required fields" => "Plenigu ĉiujn neprajn kampojn", +"Please provide a valid Dropbox app key and secret." => "Bonvolu provizi ŝlosilon de la aplikaĵo Dropbox validan kaj sekretan.", +"Error configuring Google Drive storage" => "Eraro dum agordado de la memorservo Google Drive", "External Storage" => "Malena memorilo", "Mount point" => "Surmetingo", "Backend" => "Motoro", @@ -11,8 +17,8 @@ "Groups" => "Grupoj", "Users" => "Uzantoj", "Delete" => "Forigi", -"SSL root certificates" => "Radikaj SSL-atestoj", -"Import Root Certificate" => "Enporti radikan ateston", "Enable User External Storage" => "Kapabligi malenan memorilon de uzanto", -"Allow users to mount their own external storage" => "Permesi al uzantoj surmeti siajn proprajn malenajn memorilojn" +"Allow users to mount their own external storage" => "Permesi al uzantoj surmeti siajn proprajn malenajn memorilojn", +"SSL root certificates" => "Radikaj SSL-atestoj", +"Import Root Certificate" => "Enporti radikan ateston" ); diff --git a/apps/files_external/l10n/es.php b/apps/files_external/l10n/es.php index 004c352c19..32a0d89687 100644 --- a/apps/files_external/l10n/es.php +++ b/apps/files_external/l10n/es.php @@ -1,4 +1,10 @@ "Acceso garantizado", +"Error configuring Dropbox storage" => "Error configurando el almacenamiento de Dropbox", +"Grant access" => "Garantizar acceso", +"Fill out all required fields" => "Rellenar todos los campos requeridos", +"Please provide a valid Dropbox app key and secret." => "Por favor , proporcione un secreto y una contraseña válida de la app Dropbox.", +"Error configuring Google Drive storage" => "Error configurando el almacenamiento de Google Drive", "External Storage" => "Almacenamiento externo", "Mount point" => "Punto de montaje", "Backend" => "Motor", @@ -11,8 +17,8 @@ "Groups" => "Grupos", "Users" => "Usuarios", "Delete" => "Eliiminar", -"SSL root certificates" => "Raíz de certificados SSL ", -"Import Root Certificate" => "Importar certificado raíz", "Enable User External Storage" => "Habilitar almacenamiento de usuario externo", -"Allow users to mount their own external storage" => "Permitir a los usuarios montar su propio almacenamiento externo" +"Allow users to mount their own external storage" => "Permitir a los usuarios montar su propio almacenamiento externo", +"SSL root certificates" => "Raíz de certificados SSL ", +"Import Root Certificate" => "Importar certificado raíz" ); diff --git a/apps/files_external/l10n/es_AR.php b/apps/files_external/l10n/es_AR.php index 52ed44556a..055fbe782e 100644 --- a/apps/files_external/l10n/es_AR.php +++ b/apps/files_external/l10n/es_AR.php @@ -1,4 +1,10 @@ "Acceso permitido", +"Error configuring Dropbox storage" => "Error al configurar el almacenamiento de Dropbox", +"Grant access" => "Permitir acceso", +"Fill out all required fields" => "Rellenar todos los campos requeridos", +"Please provide a valid Dropbox app key and secret." => "Por favor, proporcioná un secreto y una contraseña válida para la aplicación Dropbox.", +"Error configuring Google Drive storage" => "Error al configurar el almacenamiento de Google Drive", "External Storage" => "Almacenamiento externo", "Mount point" => "Punto de montaje", "Backend" => "Motor", @@ -11,8 +17,8 @@ "Groups" => "Grupos", "Users" => "Usuarios", "Delete" => "Borrar", -"SSL root certificates" => "certificados SSL raíz", -"Import Root Certificate" => "Importar certificado raíz", "Enable User External Storage" => "Habilitar almacenamiento de usuario externo", -"Allow users to mount their own external storage" => "Permitir a los usuarios montar su propio almacenamiento externo" +"Allow users to mount their own external storage" => "Permitir a los usuarios montar su propio almacenamiento externo", +"SSL root certificates" => "certificados SSL raíz", +"Import Root Certificate" => "Importar certificado raíz" ); diff --git a/apps/files_external/l10n/et_EE.php b/apps/files_external/l10n/et_EE.php index f47ebc936b..280e266433 100644 --- a/apps/files_external/l10n/et_EE.php +++ b/apps/files_external/l10n/et_EE.php @@ -11,8 +11,8 @@ "Groups" => "Grupid", "Users" => "Kasutajad", "Delete" => "Kustuta", -"SSL root certificates" => "SSL root sertifikaadid", -"Import Root Certificate" => "Impordi root sertifikaadid", "Enable User External Storage" => "Luba kasutajatele väline salvestamine", -"Allow users to mount their own external storage" => "Luba kasutajatel ühendada külge nende enda välised salvestusseadmed" +"Allow users to mount their own external storage" => "Luba kasutajatel ühendada külge nende enda välised salvestusseadmed", +"SSL root certificates" => "SSL root sertifikaadid", +"Import Root Certificate" => "Impordi root sertifikaadid" ); diff --git a/apps/files_external/l10n/eu.php b/apps/files_external/l10n/eu.php index 6299390c26..dccd377b11 100644 --- a/apps/files_external/l10n/eu.php +++ b/apps/files_external/l10n/eu.php @@ -1,4 +1,10 @@ "Sarrera baimendua", +"Error configuring Dropbox storage" => "Errore bat egon da Dropbox biltegiratzea konfiguratzean", +"Grant access" => "Baimendu sarrera", +"Fill out all required fields" => "Bete eskatutako eremu guztiak", +"Please provide a valid Dropbox app key and secret." => "Mesedez eman baliozkoa den Dropbox app giltza eta sekretua", +"Error configuring Google Drive storage" => "Errore bat egon da Google Drive biltegiratzea konfiguratzean", "External Storage" => "Kanpoko Biltegiratzea", "Mount point" => "Montatze puntua", "Backend" => "Motorra", @@ -11,8 +17,8 @@ "Groups" => "Taldeak", "Users" => "Erabiltzaileak", "Delete" => "Ezabatu", -"SSL root certificates" => "SSL erro ziurtagiriak", -"Import Root Certificate" => "Inportatu Erro Ziurtagiria", "Enable User External Storage" => "Gaitu erabiltzaileentzako Kanpo Biltegiratzea", -"Allow users to mount their own external storage" => "Baimendu erabiltzaileak bere kanpo biltegiratzeak muntatzen" +"Allow users to mount their own external storage" => "Baimendu erabiltzaileak bere kanpo biltegiratzeak muntatzen", +"SSL root certificates" => "SSL erro ziurtagiriak", +"Import Root Certificate" => "Inportatu Erro Ziurtagiria" ); diff --git a/apps/files_external/l10n/fi_FI.php b/apps/files_external/l10n/fi_FI.php index cea671368e..d7b16e0d3e 100644 --- a/apps/files_external/l10n/fi_FI.php +++ b/apps/files_external/l10n/fi_FI.php @@ -1,4 +1,9 @@ "Pääsy sallittu", +"Error configuring Dropbox storage" => "Virhe Dropbox levyn asetuksia tehtäessä", +"Grant access" => "Salli pääsy", +"Fill out all required fields" => "Täytä kaikki vaaditut kentät", +"Error configuring Google Drive storage" => "Virhe Google Drive levyn asetuksia tehtäessä", "External Storage" => "Erillinen tallennusväline", "Mount point" => "Liitospiste", "Backend" => "Taustaosa", @@ -11,8 +16,8 @@ "Groups" => "Ryhmät", "Users" => "Käyttäjät", "Delete" => "Poista", -"SSL root certificates" => "SSL-juurivarmenteet", -"Import Root Certificate" => "Tuo juurivarmenne", "Enable User External Storage" => "Ota käyttöön ulkopuoliset tallennuspaikat", -"Allow users to mount their own external storage" => "Salli käyttäjien liittää omia erillisiä tallennusvälineitä" +"Allow users to mount their own external storage" => "Salli käyttäjien liittää omia erillisiä tallennusvälineitä", +"SSL root certificates" => "SSL-juurivarmenteet", +"Import Root Certificate" => "Tuo juurivarmenne" ); diff --git a/apps/files_external/l10n/fr.php b/apps/files_external/l10n/fr.php index b3e76c6350..90007aafaa 100644 --- a/apps/files_external/l10n/fr.php +++ b/apps/files_external/l10n/fr.php @@ -1,4 +1,10 @@ "Accès autorisé", +"Error configuring Dropbox storage" => "Erreur lors de la configuration du support de stockage Dropbox", +"Grant access" => "Autoriser l'accès", +"Fill out all required fields" => "Veuillez remplir tous les champs requis", +"Please provide a valid Dropbox app key and secret." => "Veuillez fournir une clé d'application (app key) ainsi qu'un mot de passe valides.", +"Error configuring Google Drive storage" => "Erreur lors de la configuration du support de stockage Google Drive", "External Storage" => "Stockage externe", "Mount point" => "Point de montage", "Backend" => "Infrastructure", @@ -11,8 +17,8 @@ "Groups" => "Groupes", "Users" => "Utilisateurs", "Delete" => "Supprimer", -"SSL root certificates" => "Certificats racine SSL", -"Import Root Certificate" => "Importer un certificat racine", "Enable User External Storage" => "Activer le stockage externe pour les utilisateurs", -"Allow users to mount their own external storage" => "Autoriser les utilisateurs à monter leur propre stockage externe" +"Allow users to mount their own external storage" => "Autoriser les utilisateurs à monter leur propre stockage externe", +"SSL root certificates" => "Certificats racine SSL", +"Import Root Certificate" => "Importer un certificat racine" ); diff --git a/apps/files_external/l10n/gl.php b/apps/files_external/l10n/gl.php index c6de7b837a..3830efb70b 100644 --- a/apps/files_external/l10n/gl.php +++ b/apps/files_external/l10n/gl.php @@ -11,8 +11,8 @@ "Groups" => "Grupos", "Users" => "Usuarios", "Delete" => "Eliminar", -"SSL root certificates" => "Certificados raíz SSL", -"Import Root Certificate" => "Importar Certificado Raíz", "Enable User External Storage" => "Habilitar almacenamento externo do usuario", -"Allow users to mount their own external storage" => "Permitir aos usuarios montar os seus propios almacenamentos externos" +"Allow users to mount their own external storage" => "Permitir aos usuarios montar os seus propios almacenamentos externos", +"SSL root certificates" => "Certificados raíz SSL", +"Import Root Certificate" => "Importar Certificado Raíz" ); diff --git a/apps/files_external/l10n/he.php b/apps/files_external/l10n/he.php index edfa9aa85f..12dfa62e7c 100644 --- a/apps/files_external/l10n/he.php +++ b/apps/files_external/l10n/he.php @@ -6,8 +6,8 @@ "Groups" => "קבוצות", "Users" => "משתמשים", "Delete" => "מחיקה", -"SSL root certificates" => "שורש אישורי אבטחת SSL ", -"Import Root Certificate" => "ייבוא אישור אבטחת שורש", "Enable User External Storage" => "הפעלת אחסון חיצוני למשתמשים", -"Allow users to mount their own external storage" => "יאפשר למשתמשים לעגן את האחסון החיצוני שלהם" +"Allow users to mount their own external storage" => "יאפשר למשתמשים לעגן את האחסון החיצוני שלהם", +"SSL root certificates" => "שורש אישורי אבטחת SSL ", +"Import Root Certificate" => "ייבוא אישור אבטחת שורש" ); diff --git a/apps/files_external/l10n/it.php b/apps/files_external/l10n/it.php index 5c5d32b214..49effebdfc 100644 --- a/apps/files_external/l10n/it.php +++ b/apps/files_external/l10n/it.php @@ -1,4 +1,10 @@ "Accesso consentito", +"Error configuring Dropbox storage" => "Errore durante la configurazione dell'archivio Dropbox", +"Grant access" => "Concedi l'accesso", +"Fill out all required fields" => "Compila tutti i campi richiesti", +"Please provide a valid Dropbox app key and secret." => "Fornisci chiave di applicazione e segreto di Dropbox validi.", +"Error configuring Google Drive storage" => "Errore durante la configurazione dell'archivio Google Drive", "External Storage" => "Archiviazione esterna", "Mount point" => "Punto di mount", "Backend" => "Motore", @@ -11,8 +17,8 @@ "Groups" => "Gruppi", "Users" => "Utenti", "Delete" => "Elimina", -"SSL root certificates" => "Certificati SSL radice", -"Import Root Certificate" => "Importa certificato radice", "Enable User External Storage" => "Abilita la memoria esterna dell'utente", -"Allow users to mount their own external storage" => "Consenti agli utenti di montare la propria memoria esterna" +"Allow users to mount their own external storage" => "Consenti agli utenti di montare la propria memoria esterna", +"SSL root certificates" => "Certificati SSL radice", +"Import Root Certificate" => "Importa certificato radice" ); diff --git a/apps/files_external/l10n/ja_JP.php b/apps/files_external/l10n/ja_JP.php index c7d38d8832..92f74ce9f7 100644 --- a/apps/files_external/l10n/ja_JP.php +++ b/apps/files_external/l10n/ja_JP.php @@ -1,4 +1,10 @@ "アクセスは許可されました", +"Error configuring Dropbox storage" => "Dropboxストレージの設定エラー", +"Grant access" => "アクセスを許可", +"Fill out all required fields" => "すべての必須フィールドを埋めて下さい", +"Please provide a valid Dropbox app key and secret." => "有効なDropboxアプリのキーとパスワードを入力して下さい。", +"Error configuring Google Drive storage" => "Googleドライブストレージの設定エラー", "External Storage" => "外部ストレージ", "Mount point" => "マウントポイント", "Backend" => "バックエンド", @@ -11,8 +17,8 @@ "Groups" => "グループ", "Users" => "ユーザ", "Delete" => "削除", -"SSL root certificates" => "SSLルート証明書", -"Import Root Certificate" => "ルート証明書をインポート", "Enable User External Storage" => "ユーザの外部ストレージを有効にする", -"Allow users to mount their own external storage" => "ユーザに外部ストレージのマウントを許可する" +"Allow users to mount their own external storage" => "ユーザに外部ストレージのマウントを許可する", +"SSL root certificates" => "SSLルート証明書", +"Import Root Certificate" => "ルート証明書をインポート" ); diff --git a/apps/files_external/l10n/nl.php b/apps/files_external/l10n/nl.php index f3f38260a8..87ab87cfc9 100644 --- a/apps/files_external/l10n/nl.php +++ b/apps/files_external/l10n/nl.php @@ -1,4 +1,10 @@ "Toegang toegestaan", +"Error configuring Dropbox storage" => "Fout tijdens het configureren van Dropbox opslag", +"Grant access" => "Sta toegang toe", +"Fill out all required fields" => "Vul alle verplichte in", +"Please provide a valid Dropbox app key and secret." => "Geef een geldige Dropbox key en secret.", +"Error configuring Google Drive storage" => "Fout tijdens het configureren van Google Drive opslag", "External Storage" => "Externe opslag", "Mount point" => "Aankoppelpunt", "Backend" => "Backend", @@ -11,8 +17,8 @@ "Groups" => "Groepen", "Users" => "Gebruikers", "Delete" => "Verwijder", -"SSL root certificates" => "SSL root certificaten", -"Import Root Certificate" => "Importeer root certificaat", "Enable User External Storage" => "Zet gebruiker's externe opslag aan", -"Allow users to mount their own external storage" => "Sta gebruikers toe om hun eigen externe opslag aan te koppelen" +"Allow users to mount their own external storage" => "Sta gebruikers toe om hun eigen externe opslag aan te koppelen", +"SSL root certificates" => "SSL root certificaten", +"Import Root Certificate" => "Importeer root certificaat" ); diff --git a/apps/files_external/l10n/pl.php b/apps/files_external/l10n/pl.php index df0ed54e80..00514e59a5 100644 --- a/apps/files_external/l10n/pl.php +++ b/apps/files_external/l10n/pl.php @@ -1,4 +1,10 @@ "Dostęp do", +"Error configuring Dropbox storage" => "Wystąpił błąd podczas konfigurowania zasobu Dropbox", +"Grant access" => "Udziel dostępu", +"Fill out all required fields" => "Wypełnij wszystkie wymagane pola", +"Please provide a valid Dropbox app key and secret." => "Proszę podać prawidłowy klucz aplikacji Dropbox i klucz sekretny.", +"Error configuring Google Drive storage" => "Wystąpił błąd podczas konfigurowania zasobu Google Drive", "External Storage" => "Zewnętrzna zasoby dyskowe", "Mount point" => "Punkt montowania", "Backend" => "Zaplecze", @@ -11,8 +17,8 @@ "Groups" => "Grupy", "Users" => "Użytkownicy", "Delete" => "Usuń", -"SSL root certificates" => "Główny certyfikat SSL", -"Import Root Certificate" => "Importuj główny certyfikat", "Enable User External Storage" => "Włącz zewnętrzne zasoby dyskowe użytkownika", -"Allow users to mount their own external storage" => "Zezwalaj użytkownikom na montowanie ich własnych zewnętrznych zasobów dyskowych" +"Allow users to mount their own external storage" => "Zezwalaj użytkownikom na montowanie ich własnych zewnętrznych zasobów dyskowych", +"SSL root certificates" => "Główny certyfikat SSL", +"Import Root Certificate" => "Importuj główny certyfikat" ); diff --git a/apps/files_external/l10n/pt_BR.php b/apps/files_external/l10n/pt_BR.php index 3251e4561a..26e927a423 100644 --- a/apps/files_external/l10n/pt_BR.php +++ b/apps/files_external/l10n/pt_BR.php @@ -1,4 +1,10 @@ "Acesso concedido", +"Error configuring Dropbox storage" => "Erro ao configurar armazenamento do Dropbox", +"Grant access" => "Permitir acesso", +"Fill out all required fields" => "Preencha todos os campos obrigatórios", +"Please provide a valid Dropbox app key and secret." => "Por favor forneça um app key e secret válido do Dropbox", +"Error configuring Google Drive storage" => "Erro ao configurar armazenamento do Google Drive", "External Storage" => "Armazenamento Externo", "Mount point" => "Ponto de montagem", "Backend" => "Backend", @@ -11,8 +17,8 @@ "Groups" => "Grupos", "Users" => "Usuários", "Delete" => "Remover", -"SSL root certificates" => "Certificados SSL raíz", -"Import Root Certificate" => "Importar Certificado Raíz", "Enable User External Storage" => "Habilitar Armazenamento Externo do Usuário", -"Allow users to mount their own external storage" => "Permitir usuários a montar seus próprios armazenamentos externos" +"Allow users to mount their own external storage" => "Permitir usuários a montar seus próprios armazenamentos externos", +"SSL root certificates" => "Certificados SSL raíz", +"Import Root Certificate" => "Importar Certificado Raíz" ); diff --git a/apps/files_external/l10n/pt_PT.php b/apps/files_external/l10n/pt_PT.php index 8b4680b371..4795a51a6b 100644 --- a/apps/files_external/l10n/pt_PT.php +++ b/apps/files_external/l10n/pt_PT.php @@ -1,10 +1,24 @@ "Acesso autorizado", +"Error configuring Dropbox storage" => "Erro ao configurar o armazenamento do Dropbox", +"Grant access" => "Conceder acesso", +"Fill out all required fields" => "Preencha todos os campos obrigatórios", +"Please provide a valid Dropbox app key and secret." => "Por favor forneça uma \"app key\" e \"secret\" do Dropbox válidas.", +"Error configuring Google Drive storage" => "Erro ao configurar o armazenamento do Google Drive", +"External Storage" => "Armazenamento Externo", +"Mount point" => "Ponto de montagem", +"Backend" => "Backend", "Configuration" => "Configuração", "Options" => "Opções", "Applicable" => "Aplicável", +"Add mount point" => "Adicionar ponto de montagem", +"None set" => "Nenhum configurado", "All Users" => "Todos os utilizadores", "Groups" => "Grupos", "Users" => "Utilizadores", "Delete" => "Apagar", +"Enable User External Storage" => "Activar Armazenamento Externo para o Utilizador", +"Allow users to mount their own external storage" => "Permitir que os utilizadores montem o seu próprio armazenamento externo", +"SSL root certificates" => "Certificados SSL de raiz", "Import Root Certificate" => "Importar Certificado Root" ); diff --git a/apps/files_external/l10n/ro.php b/apps/files_external/l10n/ro.php index f5114f6179..6a15278680 100644 --- a/apps/files_external/l10n/ro.php +++ b/apps/files_external/l10n/ro.php @@ -11,8 +11,8 @@ "Groups" => "Grupuri", "Users" => "Utilizatori", "Delete" => "Șterge", -"SSL root certificates" => "Certificate SSL root", -"Import Root Certificate" => "Importă certificat root", "Enable User External Storage" => "Permite stocare externă pentru utilizatori", -"Allow users to mount their own external storage" => "Permite utilizatorilor să monteze stocare externă proprie" +"Allow users to mount their own external storage" => "Permite utilizatorilor să monteze stocare externă proprie", +"SSL root certificates" => "Certificate SSL root", +"Import Root Certificate" => "Importă certificat root" ); diff --git a/apps/files_external/l10n/ru.php b/apps/files_external/l10n/ru.php index 7ee4378662..eeef416a84 100644 --- a/apps/files_external/l10n/ru.php +++ b/apps/files_external/l10n/ru.php @@ -11,8 +11,8 @@ "Groups" => "Группы", "Users" => "Пользователи", "Delete" => "Удалить", -"SSL root certificates" => "Корневые сертификаты SSL", -"Import Root Certificate" => "Импортировать корневые сертификаты", "Enable User External Storage" => "Включить пользовательские внешние носители", -"Allow users to mount their own external storage" => "Разрешить пользователям монтировать их собственные внешние носители" +"Allow users to mount their own external storage" => "Разрешить пользователям монтировать их собственные внешние носители", +"SSL root certificates" => "Корневые сертификаты SSL", +"Import Root Certificate" => "Импортировать корневые сертификаты" ); diff --git a/apps/files_external/l10n/ru_RU.php b/apps/files_external/l10n/ru_RU.php index 5b0cf1b6aa..493e3f5bee 100644 --- a/apps/files_external/l10n/ru_RU.php +++ b/apps/files_external/l10n/ru_RU.php @@ -1,4 +1,10 @@ "Доступ разрешен", +"Error configuring Dropbox storage" => "Ошибка при конфигурировании хранилища Dropbox", +"Grant access" => "Предоставить доступ", +"Fill out all required fields" => "Заполните все требуемые поля", +"Please provide a valid Dropbox app key and secret." => "Пожалуйста представьте допустимый ключ приложения Dropbox и пароль.", +"Error configuring Google Drive storage" => "Ошибка настройки хранилища Google Drive", "External Storage" => "Внешние системы хранения данных", "Mount point" => "Точка монтирования", "Backend" => "Бэкэнд", @@ -11,8 +17,8 @@ "Groups" => "Группы", "Users" => "Пользователи", "Delete" => "Удалить", -"SSL root certificates" => "Корневые сертификаты SSL", -"Import Root Certificate" => "Импортировать корневые сертификаты", "Enable User External Storage" => "Включить пользовательскую внешнюю систему хранения данных", -"Allow users to mount their own external storage" => "Разрешить пользователям монтировать их собственную внешнюю систему хранения данных" +"Allow users to mount their own external storage" => "Разрешить пользователям монтировать их собственную внешнюю систему хранения данных", +"SSL root certificates" => "Корневые сертификаты SSL", +"Import Root Certificate" => "Импортировать корневые сертификаты" ); diff --git a/apps/files_external/l10n/sk_SK.php b/apps/files_external/l10n/sk_SK.php index 24087ea7fe..04d5e3c7ee 100644 --- a/apps/files_external/l10n/sk_SK.php +++ b/apps/files_external/l10n/sk_SK.php @@ -1,4 +1,10 @@ "Prístup povolený", +"Error configuring Dropbox storage" => "Chyba pri konfigurácii úložiska Dropbox", +"Grant access" => "Povoliť prístup", +"Fill out all required fields" => "Vyplňte všetky vyžadované kolónky", +"Please provide a valid Dropbox app key and secret." => "Zadajte platný kľúč aplikácie a heslo Dropbox", +"Error configuring Google Drive storage" => "Chyba pri konfigurácii úložiska Google drive", "External Storage" => "Externé úložisko", "Mount point" => "Prípojný bod", "Backend" => "Backend", @@ -11,8 +17,8 @@ "Groups" => "Skupiny", "Users" => "Užívatelia", "Delete" => "Odstrániť", -"SSL root certificates" => "Koreňové SSL certifikáty", -"Import Root Certificate" => "Importovať koreňový certifikát", "Enable User External Storage" => "Povoliť externé úložisko", -"Allow users to mount their own external storage" => "Povoliť užívateľom pripojiť ich vlastné externé úložisko" +"Allow users to mount their own external storage" => "Povoliť užívateľom pripojiť ich vlastné externé úložisko", +"SSL root certificates" => "Koreňové SSL certifikáty", +"Import Root Certificate" => "Importovať koreňový certifikát" ); diff --git a/apps/files_external/l10n/sl.php b/apps/files_external/l10n/sl.php index d588844467..f455f8c56f 100644 --- a/apps/files_external/l10n/sl.php +++ b/apps/files_external/l10n/sl.php @@ -11,8 +11,8 @@ "Groups" => "Skupine", "Users" => "Uporabniki", "Delete" => "Izbriši", -"SSL root certificates" => "SSL korenski certifikati", -"Import Root Certificate" => "Uvozi korenski certifikat", "Enable User External Storage" => "Omogoči uporabo zunanje podatkovne shrambe za uporabnike", -"Allow users to mount their own external storage" => "Dovoli uporabnikom priklop lastne zunanje podatkovne shrambe" +"Allow users to mount their own external storage" => "Dovoli uporabnikom priklop lastne zunanje podatkovne shrambe", +"SSL root certificates" => "SSL korenski certifikati", +"Import Root Certificate" => "Uvozi korenski certifikat" ); diff --git a/apps/files_external/l10n/sv.php b/apps/files_external/l10n/sv.php index 0838df6a32..0a5e1c66d9 100644 --- a/apps/files_external/l10n/sv.php +++ b/apps/files_external/l10n/sv.php @@ -1,4 +1,10 @@ "Åtkomst beviljad", +"Error configuring Dropbox storage" => "Fel vid konfigurering av Dropbox", +"Grant access" => "Bevilja åtkomst", +"Fill out all required fields" => "Fyll i alla obligatoriska fält", +"Please provide a valid Dropbox app key and secret." => "Ange en giltig Dropbox nyckel och hemlighet.", +"Error configuring Google Drive storage" => "Fel vid konfigurering av Google Drive", "External Storage" => "Extern lagring", "Mount point" => "Monteringspunkt", "Backend" => "Källa", @@ -11,8 +17,8 @@ "Groups" => "Grupper", "Users" => "Användare", "Delete" => "Radera", -"SSL root certificates" => "SSL rotcertifikat", -"Import Root Certificate" => "Importera rotcertifikat", "Enable User External Storage" => "Aktivera extern lagring för användare", -"Allow users to mount their own external storage" => "Tillåt användare att montera egen extern lagring" +"Allow users to mount their own external storage" => "Tillåt användare att montera egen extern lagring", +"SSL root certificates" => "SSL rotcertifikat", +"Import Root Certificate" => "Importera rotcertifikat" ); diff --git a/apps/files_external/l10n/th_TH.php b/apps/files_external/l10n/th_TH.php index 84a233046e..70ab8d3348 100644 --- a/apps/files_external/l10n/th_TH.php +++ b/apps/files_external/l10n/th_TH.php @@ -1,4 +1,10 @@ "การเข้าถึงได้รับอนุญาตแล้ว", +"Error configuring Dropbox storage" => "เกิดข้อผิดพลาดในการกำหนดค่าพื้นที่จัดเก็บข้อมูล Dropbox", +"Grant access" => "อนุญาตให้เข้าถึงได้", +"Fill out all required fields" => "กรอกข้อมูลในช่องข้อมูลที่จำเป็นต้องกรอกทั้งหมด", +"Please provide a valid Dropbox app key and secret." => "กรุณากรอกรหัส app key ของ Dropbox และรหัสลับ", +"Error configuring Google Drive storage" => "เกิดข้อผิดพลาดในการกำหนดค่าการจัดเก็บข้อมูลในพื้นที่ของ Google Drive", "External Storage" => "พื้นทีจัดเก็บข้อมูลจากภายนอก", "Mount point" => "จุดชี้ตำแหน่ง", "Backend" => "ด้านหลังระบบ", @@ -11,8 +17,8 @@ "Groups" => "กลุ่ม", "Users" => "ผู้ใช้งาน", "Delete" => "ลบ", -"SSL root certificates" => "ใบรับรองความปลอดภัยด้วยระบบ SSL จาก Root", -"Import Root Certificate" => "นำเข้าข้อมูลใบรับรองความปลอดภัยจาก Root", "Enable User External Storage" => "เปิดให้มีการใช้พื้นที่จัดเก็บข้อมูลของผู้ใช้งานจากภายนอกได้", -"Allow users to mount their own external storage" => "อนุญาตให้ผู้ใช้งานสามารถชี้ตำแหน่งไปที่พื้นที่จัดเก็บข้อมูลภายนอกของตนเองได้" +"Allow users to mount their own external storage" => "อนุญาตให้ผู้ใช้งานสามารถชี้ตำแหน่งไปที่พื้นที่จัดเก็บข้อมูลภายนอกของตนเองได้", +"SSL root certificates" => "ใบรับรองความปลอดภัยด้วยระบบ SSL จาก Root", +"Import Root Certificate" => "นำเข้าข้อมูลใบรับรองความปลอดภัยจาก Root" ); diff --git a/apps/files_external/l10n/vi.php b/apps/files_external/l10n/vi.php index 35312329da..dd616e9115 100644 --- a/apps/files_external/l10n/vi.php +++ b/apps/files_external/l10n/vi.php @@ -11,8 +11,8 @@ "Groups" => "Nhóm", "Users" => "Người dùng", "Delete" => "Xóa", -"SSL root certificates" => "Chứng chỉ SSL root", -"Import Root Certificate" => "Nhập Root Certificate", "Enable User External Storage" => "Kích hoạt tính năng lưu trữ ngoài", -"Allow users to mount their own external storage" => "Cho phép người dùng kết nối với lưu trữ riêng bên ngoài của họ" +"Allow users to mount their own external storage" => "Cho phép người dùng kết nối với lưu trữ riêng bên ngoài của họ", +"SSL root certificates" => "Chứng chỉ SSL root", +"Import Root Certificate" => "Nhập Root Certificate" ); diff --git a/apps/files_external/l10n/zh_CN.GB2312.php b/apps/files_external/l10n/zh_CN.GB2312.php index 6a6d1c6d12..47983d3d7d 100644 --- a/apps/files_external/l10n/zh_CN.GB2312.php +++ b/apps/files_external/l10n/zh_CN.GB2312.php @@ -1,4 +1,10 @@ "已授予权限", +"Error configuring Dropbox storage" => "配置 Dropbox 存储出错", +"Grant access" => "授予权限", +"Fill out all required fields" => "填充全部必填字段", +"Please provide a valid Dropbox app key and secret." => "请提供一个有效的 Dropbox app key 和 secret。", +"Error configuring Google Drive storage" => "配置 Google Drive 存储失败", "External Storage" => "外部存储", "Mount point" => "挂载点", "Backend" => "后端", @@ -11,8 +17,8 @@ "Groups" => "群组", "Users" => "用户", "Delete" => "删除", -"SSL root certificates" => "SSL 根证书", -"Import Root Certificate" => "导入根证书", "Enable User External Storage" => "启用用户外部存储", -"Allow users to mount their own external storage" => "允许用户挂载他们的外部存储" +"Allow users to mount their own external storage" => "允许用户挂载他们的外部存储", +"SSL root certificates" => "SSL 根证书", +"Import Root Certificate" => "导入根证书" ); diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php index f87a042b38..068475783c 100755 --- a/apps/files_external/lib/config.php +++ b/apps/files_external/lib/config.php @@ -109,6 +109,21 @@ class OC_Mount_Config { return $personal; } + /** + * Add directory for mount point to the filesystem + * @param OC_Fileview instance $view + * @param string path to mount point + */ + private static function addMountPointDirectory($view, $path) { + $dir = ''; + foreach ( explode('/', $path) as $pathPart) { + $dir = $dir.'/'.$pathPart; + if ( !$view->file_exists($dir)) { + $view->mkdir($dir); + } + } + } + /** * Add a mount point to the filesystem @@ -127,8 +142,33 @@ class OC_Mount_Config { if ($applicable != OCP\User::getUser() || $class == 'OC_Filestorage_Local') { return false; } + $view = new OC_FilesystemView('/'.OCP\User::getUser().'/files'); + self::addMountPointDirectory($view, ltrim($mountPoint, '/')); $mountPoint = '/'.$applicable.'/files/'.ltrim($mountPoint, '/'); } else { + $view = new OC_FilesystemView('/'); + switch ($mountType) { + case 'user': + if ($applicable == "all") { + $users = OCP\User::getUsers(); + foreach ( $users as $user ) { + $path = $user.'/files/'.ltrim($mountPoint, '/'); + self::addMountPointDirectory($view, $path); + } + } else { + $path = $applicable.'/files/'.ltrim($mountPoint, '/'); + self::addMountPointDirectory($view, $path); + } + break; + case 'group' : + $groupMembers = OC_Group::usersInGroups(array($applicable)); + foreach ( $groupMembers as $user ) { + $path = $user.'/files/'.ltrim($mountPoint, '/'); + self::addMountPointDirectory($view, $path); + } + break; + } + $mountPoint = '/$user/files/'.ltrim($mountPoint, '/'); } $mount = array($applicable => array($mountPoint => array('class' => $class, 'options' => $classOptions))); @@ -248,6 +288,9 @@ class OC_Mount_Config { if (!is_dir($path)) mkdir($path); $result = array(); $handle = opendir($path); + if (!$handle) { + return array(); + } while (false !== ($file = readdir($handle))) { if($file != '.' && $file != '..') $result[] = $file; } diff --git a/apps/files_external/lib/dropbox.php b/apps/files_external/lib/dropbox.php index bb86894e55..c822083270 100755 --- a/apps/files_external/lib/dropbox.php +++ b/apps/files_external/lib/dropbox.php @@ -25,21 +25,25 @@ require_once 'Dropbox/autoload.php'; class OC_Filestorage_Dropbox extends OC_Filestorage_Common { private $dropbox; + private $root; private $metaData = array(); private static $tempFiles = array(); public function __construct($params) { if (isset($params['configured']) && $params['configured'] == 'true' && isset($params['app_key']) && isset($params['app_secret']) && isset($params['token']) && isset($params['token_secret'])) { + $this->root=isset($params['root'])?$params['root']:''; $oauth = new Dropbox_OAuth_Curl($params['app_key'], $params['app_secret']); $oauth->setToken($params['token'], $params['token_secret']); $this->dropbox = new Dropbox_API($oauth, 'dropbox'); + $this->mkdir(''); } else { throw new Exception('Creating OC_Filestorage_Dropbox storage failed'); } } private function getMetaData($path, $list = false) { + $path = $this->root.$path; if (!$list && isset($this->metaData[$path])) { return $this->metaData[$path]; } else { @@ -76,6 +80,7 @@ class OC_Filestorage_Dropbox extends OC_Filestorage_Common { } public function mkdir($path) { + $path = $this->root.$path; try { $this->dropbox->createFolder($path); return true; @@ -144,6 +149,7 @@ class OC_Filestorage_Dropbox extends OC_Filestorage_Common { } public function unlink($path) { + $path = $this->root.$path; try { $this->dropbox->delete($path); return true; @@ -154,6 +160,8 @@ class OC_Filestorage_Dropbox extends OC_Filestorage_Common { } public function rename($path1, $path2) { + $path1 = $this->root.$path1; + $path2 = $this->root.$path2; try { $this->dropbox->move($path1, $path2); return true; @@ -164,6 +172,8 @@ class OC_Filestorage_Dropbox extends OC_Filestorage_Common { } public function copy($path1, $path2) { + $path1 = $this->root.$path1; + $path2 = $this->root.$path2; try { $this->dropbox->copy($path1, $path2); return true; @@ -174,6 +184,7 @@ class OC_Filestorage_Dropbox extends OC_Filestorage_Common { } public function fopen($path, $mode) { + $path = $this->root.$path; switch ($mode) { case 'r': case 'rb': diff --git a/apps/files_external/lib/smb.php b/apps/files_external/lib/smb.php index e5ba7a1774..eed2582dc9 100644 --- a/apps/files_external/lib/smb.php +++ b/apps/files_external/lib/smb.php @@ -59,7 +59,7 @@ class OC_FileStorage_SMB extends OC_FileStorage_StreamWrapper{ } public function filetype($path) { - return (bool)@$this->opendir($path);//using opendir causes the same amount of requests and caches the content of the folder in one go + return (bool)@$this->opendir($path) ? 'dir' : 'file';//using opendir causes the same amount of requests and caches the content of the folder in one go } /** diff --git a/apps/files_external/lib/swift.php b/apps/files_external/lib/swift.php index c29d28b44c..4b0b8c25fd 100644 --- a/apps/files_external/lib/swift.php +++ b/apps/files_external/lib/swift.php @@ -39,7 +39,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ * @return string */ private function getContainerName($path) { - $path=trim($this->root.$path,'/'); + $path=trim(trim($this->root,'/')."/".$path,'/.'); return str_replace('/','\\',$path); } @@ -70,11 +70,11 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ * @return CF_Container */ private function createContainer($path) { - if($path=='' or $path=='/') { + if($path=='' or $path=='/' or $path=='.') { return $this->conn->create_container($this->getContainerName($path)); } $parent=dirname($path); - if($parent=='' or $parent=='/') { + if($parent=='' or $parent=='/' or $parent=='.') { $parentContainer=$this->rootContainer; }else{ if(!$this->containerExists($parent)) { @@ -100,6 +100,9 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ if(is_null($container)) { return null; }else{ + if ($path=="/" or $path=='') { + return null; + } try{ $obj=$container->get_object(basename($path)); $this->objects[$path]=$obj; @@ -135,7 +138,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ private function createObject($path) { $container=$this->getContainer(dirname($path)); if(!is_null($container)) { - $container=$this->createContainer($path); + $container=$this->createContainer(dirname($path)); } return $container->create_object(basename($path)); } @@ -277,7 +280,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ $this->conn = new CF_Connection($this->auth); - if(!$this->containerExists($this->root)) { + if(!$this->containerExists('/')) { $this->rootContainer=$this->createContainer('/'); }else{ $this->rootContainer=$this->getContainer('/'); @@ -391,6 +394,9 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ } public function unlink($path) { + if($this->containerExists($path)) { + return $this->rmdir($path); + } if($this->objectExists($path)) { $container=$this->getContainer(dirname($path)); $container->delete_object(basename($path)); @@ -401,13 +407,13 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ } public function fopen($path,$mode) { - $obj=$this->getObject($path); - if(is_null($obj)) { - return false; - } switch($mode) { case 'r': case 'rb': + $obj=$this->getObject($path); + if (is_null($obj)) { + return false; + } $fp = fopen('php://temp', 'r+'); $obj->stream($fp); @@ -440,7 +446,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ } public function free_space($path) { - return 0; + return 1024*1024*1024*8; } public function touch($path,$mtime=null) { @@ -481,7 +487,17 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ } public function stat($path) { + $container=$this->getContainer($path); + if (!is_null($container)) { + return array( + 'mtime'=>-1, + 'size'=>$container->bytes_used, + 'ctime'=>-1 + ); + } + $obj=$this->getObject($path); + if(is_null($obj)) { return false; } @@ -505,7 +521,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{ $obj->save_to_filename($tmpFile); return $tmpFile; }else{ - return false; + return OCP\Files::tmpFile(); } } diff --git a/apps/files_external/lib/webdav.php b/apps/files_external/lib/webdav.php index 3c18b227fa..5e18583915 100644 --- a/apps/files_external/lib/webdav.php +++ b/apps/files_external/lib/webdav.php @@ -131,6 +131,9 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{ switch($mode) { case 'r': case 'rb': + if(!$this->file_exists($path)) { + return false; + } //straight up curl instead of sabredav here, sabredav put's the entire get result in memory $curl = curl_init(); $fp = fopen('php://temp', 'r+'); diff --git a/apps/files_external/tests/amazons3.php b/apps/files_external/tests/amazons3.php index b9b4cf65bd..725f4ba05d 100644 --- a/apps/files_external/tests/amazons3.php +++ b/apps/files_external/tests/amazons3.php @@ -1,43 +1,42 @@ . -*/ + * ownCloud + * + * @author Michael Gapczynski + * @copyright 2012 Michael Gapczynski mtgap@owncloud.com + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see . + */ -$config = include('apps/files_external/tests/config.php'); -if (!is_array($config) or !isset($config['amazons3']) or !$config['amazons3']['run']) { - abstract class Test_Filestorage_AmazonS3 extends Test_FileStorage{} - return; -} else { - class Test_Filestorage_AmazonS3 extends Test_FileStorage { +class Test_Filestorage_AmazonS3 extends Test_FileStorage { - private $config; - private $id; + private $config; + private $id; - public function setUp() { - $id = uniqid(); - $this->config = include('apps/files_external/tests/config.php'); - $this->config['amazons3']['bucket'] = $id; // Make sure we have a new empty bucket to work in - $this->instance = new OC_Filestorage_AmazonS3($this->config['amazons3']); + public function setUp() { + $id = uniqid(); + $this->config = include('files_external/tests/config.php'); + if (!is_array($this->config) or !isset($this->config['amazons3']) or !$this->config['amazons3']['run']) { + $this->markTestSkipped('AmazonS3 backend not configured'); } + $this->config['amazons3']['bucket'] = $id; // Make sure we have a new empty bucket to work in + $this->instance = new OC_Filestorage_AmazonS3($this->config['amazons3']); + } - public function tearDown() { + public function tearDown() { + if ($this->instance) { $s3 = new AmazonS3(array('key' => $this->config['amazons3']['key'], 'secret' => $this->config['amazons3']['secret'])); if ($s3->delete_all_objects($this->id)) { $s3->delete_bucket($this->id); diff --git a/apps/files_external/tests/config.php b/apps/files_external/tests/config.php index e58a87fabd..ff16b1c1d8 100644 --- a/apps/files_external/tests/config.php +++ b/apps/files_external/tests/config.php @@ -26,7 +26,7 @@ return array( 'run'=>false, 'user'=>'test:tester', 'token'=>'testing', - 'host'=>'localhost:8080/auth', + 'host'=>'localhost.local:8080/auth', 'root'=>'/', ), 'smb'=>array( @@ -43,4 +43,13 @@ return array( 'secret'=>'test', 'bucket'=>'bucket', ), + 'dropbox' => array ( + 'run'=>false, + 'root'=>'owncloud', + 'configured' => 'true', + 'app_key' => '', + 'app_secret' => '', + 'token' => '', + 'token_secret' => '' + ) ); diff --git a/apps/files_external/tests/dropbox.php b/apps/files_external/tests/dropbox.php new file mode 100644 index 0000000000..56319b9f5d --- /dev/null +++ b/apps/files_external/tests/dropbox.php @@ -0,0 +1,27 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +class Test_Filestorage_Dropbox extends Test_FileStorage { + private $config; + + public function setUp() { + $id = uniqid(); + $this->config = include('files_external/tests/config.php'); + if (!is_array($this->config) or !isset($this->config['dropbox']) or !$this->config['dropbox']['run']) { + $this->markTestSkipped('Dropbox backend not configured'); + } + $this->config['dropbox']['root'] .= '/' . $id; //make sure we have an new empty folder to work in + $this->instance = new OC_Filestorage_Dropbox($this->config['dropbox']); + } + + public function tearDown() { + if ($this->instance) { + $this->instance->unlink('/'); + } + } +} diff --git a/apps/files_external/tests/ftp.php b/apps/files_external/tests/ftp.php index 12f3ec3908..4549c42041 100644 --- a/apps/files_external/tests/ftp.php +++ b/apps/files_external/tests/ftp.php @@ -6,22 +6,21 @@ * See the COPYING-README file. */ -$config=include('apps/files_external/tests/config.php'); -if(!is_array($config) or !isset($config['ftp']) or !$config['ftp']['run']) { - abstract class Test_Filestorage_FTP extends Test_FileStorage{} - return; -}else{ - class Test_Filestorage_FTP extends Test_FileStorage { - private $config; +class Test_Filestorage_FTP extends Test_FileStorage { + private $config; - public function setUp() { - $id=uniqid(); - $this->config=include('apps/files_external/tests/config.php'); - $this->config['ftp']['root'].='/'.$id;//make sure we have an new empty folder to work in - $this->instance=new OC_Filestorage_FTP($this->config['ftp']); + public function setUp() { + $id = uniqid(); + $this->config = include('files_external/tests/config.php'); + if (!is_array($this->config) or !isset($this->config['ftp']) or !$this->config['ftp']['run']) { + $this->markTestSkipped('FTP backend not configured'); } + $this->config['ftp']['root'] .= '/' . $id; //make sure we have an new empty folder to work in + $this->instance = new OC_Filestorage_FTP($this->config['ftp']); + } - public function tearDown() { + public function tearDown() { + if ($this->instance) { OCP\Files::rmdirr($this->instance->constructUrl('')); } } diff --git a/apps/files_external/tests/google.php b/apps/files_external/tests/google.php index d2a6358ade..46e622cc18 100644 --- a/apps/files_external/tests/google.php +++ b/apps/files_external/tests/google.php @@ -1,42 +1,41 @@ . -*/ + * ownCloud + * + * @author Michael Gapczynski + * @copyright 2012 Michael Gapczynski mtgap@owncloud.com + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see . + */ -$config=include('apps/files_external/tests/config.php'); -if(!is_array($config) or !isset($config['google']) or !$config['google']['run']) { - abstract class Test_Filestorage_Google extends Test_FileStorage{} - return; -}else{ - class Test_Filestorage_Google extends Test_FileStorage { +class Test_Filestorage_Google extends Test_FileStorage { - private $config; + private $config; - public function setUp() { - $id=uniqid(); - $this->config=include('apps/files_external/tests/config.php'); - $this->config['google']['root'].='/'.$id;//make sure we have an new empty folder to work in - $this->instance=new OC_Filestorage_Google($this->config['google']); + public function setUp() { + $id = uniqid(); + $this->config = include('files_external/tests/config.php'); + if (!is_array($this->config) or !isset($this->config['google']) or !$this->config['google']['run']) { + $this->markTestSkipped('Google backend not configured'); } + $this->config['google']['root'] .= '/' . $id; //make sure we have an new empty folder to work in + $this->instance = new OC_Filestorage_Google($this->config['google']); + } - public function tearDown() { + public function tearDown() { + if ($this->instance) { $this->instance->rmdir('/'); } } diff --git a/apps/files_external/tests/smb.php b/apps/files_external/tests/smb.php index 7de4fddbb3..2c03ef5dbd 100644 --- a/apps/files_external/tests/smb.php +++ b/apps/files_external/tests/smb.php @@ -6,23 +6,21 @@ * See the COPYING-README file. */ -$config=include('apps/files_external/tests/config.php'); +class Test_Filestorage_SMB extends Test_FileStorage { + private $config; -if(!is_array($config) or !isset($config['smb']) or !$config['smb']['run']) { - abstract class Test_Filestorage_SMB extends Test_FileStorage{} - return; -}else{ - class Test_Filestorage_SMB extends Test_FileStorage { - private $config; - - public function setUp() { - $id=uniqid(); - $this->config=include('apps/files_external/tests/config.php'); - $this->config['smb']['root'].=$id;//make sure we have an new empty folder to work in - $this->instance=new OC_Filestorage_SMB($this->config['smb']); + public function setUp() { + $id = uniqid(); + $this->config = include('files_external/tests/config.php'); + if (!is_array($this->config) or !isset($this->config['smb']) or !$this->config['smb']['run']) { + $this->markTestSkipped('Samba backend not configured'); } + $this->config['smb']['root'] .= $id; //make sure we have an new empty folder to work in + $this->instance = new OC_Filestorage_SMB($this->config['smb']); + } - public function tearDown() { + public function tearDown() { + if ($this->instance) { OCP\Files::rmdirr($this->instance->constructUrl('')); } } diff --git a/apps/files_external/tests/swift.php b/apps/files_external/tests/swift.php index a6f5eace1c..8cf2a3abc7 100644 --- a/apps/files_external/tests/swift.php +++ b/apps/files_external/tests/swift.php @@ -6,25 +6,23 @@ * See the COPYING-README file. */ -$config=include('apps/files_external/tests/config.php'); -if(!is_array($config) or !isset($config['swift']) or !$config['swift']['run']) { - abstract class Test_Filestorage_SWIFT extends Test_FileStorage{} - return; -}else{ - class Test_Filestorage_SWIFT extends Test_FileStorage { - private $config; +class Test_Filestorage_SWIFT extends Test_FileStorage { + private $config; - public function setUp() { - $id=uniqid(); - $this->config=include('apps/files_external/tests/config.php'); - $this->config['swift']['root'].='/'.$id;//make sure we have an new empty folder to work in - $this->instance=new OC_Filestorage_SWIFT($this->config['swift']); + public function setUp() { + $id = uniqid(); + $this->config = include('files_external/tests/config.php'); + if (!is_array($this->config) or !isset($this->config['swift']) or !$this->config['swift']['run']) { + $this->markTestSkipped('OpenStack SWIFT backend not configured'); } + $this->config['swift']['root'] .= '/' . $id; //make sure we have an new empty folder to work in + $this->instance = new OC_Filestorage_SWIFT($this->config['swift']); + } - public function tearDown() { - $this->instance->rmdir(''); + public function tearDown() { + if ($this->instance) { + $this->instance->rmdir(''); } - } } diff --git a/apps/files_external/tests/webdav.php b/apps/files_external/tests/webdav.php index 74d980aa3f..2da88f63ed 100644 --- a/apps/files_external/tests/webdav.php +++ b/apps/files_external/tests/webdav.php @@ -6,22 +6,21 @@ * See the COPYING-README file. */ -$config=include('apps/files_external/tests/config.php'); -if(!is_array($config) or !isset($config['webdav']) or !$config['webdav']['run']) { - abstract class Test_Filestorage_DAV extends Test_FileStorage{} - return; -}else{ - class Test_Filestorage_DAV extends Test_FileStorage { - private $config; +class Test_Filestorage_DAV extends Test_FileStorage { + private $config; - public function setUp() { - $id=uniqid(); - $this->config=include('apps/files_external/tests/config.php'); - $this->config['webdav']['root'].='/'.$id;//make sure we have an new empty folder to work in - $this->instance=new OC_Filestorage_DAV($this->config['webdav']); + public function setUp() { + $id = uniqid(); + $this->config = include('files_external/tests/config.php'); + if (!is_array($this->config) or !isset($this->config['webdav']) or !$this->config['webdav']['run']) { + $this->markTestSkipped('WebDAV backend not configured'); } + $this->config['webdav']['root'] .= '/' . $id; //make sure we have an new empty folder to work in + $this->instance = new OC_Filestorage_DAV($this->config['webdav']); + } - public function tearDown() { + public function tearDown() { + if ($this->instance) { $this->instance->rmdir('/'); } } diff --git a/apps/files_sharing/appinfo/info.xml b/apps/files_sharing/appinfo/info.xml index 6a8fc89ada..a44d0338bb 100644 --- a/apps/files_sharing/appinfo/info.xml +++ b/apps/files_sharing/appinfo/info.xml @@ -5,7 +5,7 @@ File sharing between users AGPL Michael Gapczynski - 4 + 4.9 true diff --git a/apps/files_sharing/appinfo/update.php b/apps/files_sharing/appinfo/update.php index 2beeb6316b..23f2afea7e 100644 --- a/apps/files_sharing/appinfo/update.php +++ b/apps/files_sharing/appinfo/update.php @@ -62,3 +62,11 @@ if (version_compare($installedVersion, '0.3', '<')) { // $query = OCP\DB::prepare('DROP TABLE `*PREFIX*sharing`'); // $query->execute(); } +if (version_compare($installedVersion, '0.3.3', '<')) { + OC_User::useBackend(new OC_User_Database()); + OC_App::loadApps(array('authentication')); + $users = OC_User::getUsers(); + foreach ($users as $user) { + OC_FileCache::delete('Shared', '/'.$user.'/files/'); + } +} \ No newline at end of file diff --git a/apps/files_sharing/appinfo/version b/apps/files_sharing/appinfo/version index 9fc80f937f..87a0871112 100644 --- a/apps/files_sharing/appinfo/version +++ b/apps/files_sharing/appinfo/version @@ -1 +1 @@ -0.3.2 \ No newline at end of file +0.3.3 \ No newline at end of file diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index def0237480..916e35419c 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -32,6 +32,18 @@ $(document).ready(function() { window.location = $(tr).find('a.name').attr('href'); } }); + FileActions.register('file', 'Download', OC.PERMISSION_READ, '', function(filename) { + var tr = $('tr').filterAttr('data-file', filename) + if (tr.length > 0) { + window.location = $(tr).find('a.name').attr('href'); + } + }); + FileActions.register('dir', 'Download', OC.PERMISSION_READ, '', function(filename) { + var tr = $('tr').filterAttr('data-file', filename) + if (tr.length > 0) { + window.location = $(tr).find('a.name').attr('href')+'&download'; + } + }); } }); \ No newline at end of file diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js index a171751589..72663c068c 100644 --- a/apps/files_sharing/js/share.js +++ b/apps/files_sharing/js/share.js @@ -1,6 +1,6 @@ $(document).ready(function() { - if (typeof OC.Share !== 'undefined' && typeof FileActions !== 'undefined') { + if (typeof OC.Share !== 'undefined' && typeof FileActions !== 'undefined' && !publicListView) { OC.Share.loadIcons('file'); FileActions.register('all', 'Share', OC.PERMISSION_READ, function(filename) { // Return the correct sharing icon @@ -46,7 +46,7 @@ $(document).ready(function() { var appendTo = $(tr).find('td.filename'); // Check if drop down is already visible for a different file if (OC.Share.droppedDown) { - if (item != $('#dropdown').data('item')) { + if ($(tr).data('id') != $('#dropdown').attr('data-item-source')) { OC.Share.hideDropDown(function () { $(tr).addClass('mouseOver'); OC.Share.showDropDown(itemType, $(tr).data('id'), appendTo, true, possiblePermissions); diff --git a/apps/files_sharing/l10n/ca.php b/apps/files_sharing/l10n/ca.php index f00d0d7263..223495455f 100644 --- a/apps/files_sharing/l10n/ca.php +++ b/apps/files_sharing/l10n/ca.php @@ -1,6 +1,8 @@ "Contrasenya", "Submit" => "Envia", +"%s shared the folder %s with you" => "%s ha compartit la carpeta %s amb vós", +"%s shared the file %s with you" => "%s ha compartit el fitxer %s amb vós", "Download" => "Baixa", "No preview available for" => "No hi ha vista prèvia disponible per a", "web services under your control" => "controleu els vostres serveis web" diff --git a/apps/files_sharing/l10n/de.php b/apps/files_sharing/l10n/de.php index b9a50387aa..c2fec21545 100644 --- a/apps/files_sharing/l10n/de.php +++ b/apps/files_sharing/l10n/de.php @@ -1,9 +1,9 @@ "Passwort", "Submit" => "Absenden", -"%s shared the folder %s with you" => "%s hat mit Ihnen den Ordner %s geteilt", -"%s shared the file %s with you" => "%s hat mit Ihnen die Datei %s geteilt", +"%s shared the folder %s with you" => "%s hat den Ordner %s für dich freigegeben", +"%s shared the file %s with you" => "%s hat die Datei %s für dich freigegeben", "Download" => "Download", "No preview available for" => "Es ist keine Vorschau verfügbar für", -"web services under your control" => "Web-Services unter Ihrer Kontrolle" +"web services under your control" => "Web-Services unter Deiner Kontrolle" ); diff --git a/apps/files_sharing/l10n/de_DE.php b/apps/files_sharing/l10n/de_DE.php new file mode 100644 index 0000000000..c2fec21545 --- /dev/null +++ b/apps/files_sharing/l10n/de_DE.php @@ -0,0 +1,9 @@ + "Passwort", +"Submit" => "Absenden", +"%s shared the folder %s with you" => "%s hat den Ordner %s für dich freigegeben", +"%s shared the file %s with you" => "%s hat die Datei %s für dich freigegeben", +"Download" => "Download", +"No preview available for" => "Es ist keine Vorschau verfügbar für", +"web services under your control" => "Web-Services unter Deiner Kontrolle" +); diff --git a/apps/files_sharing/l10n/el.php b/apps/files_sharing/l10n/el.php index 3406c508e6..5305eedd48 100644 --- a/apps/files_sharing/l10n/el.php +++ b/apps/files_sharing/l10n/el.php @@ -1,6 +1,8 @@ "Συνθηματικό", "Submit" => "Καταχώρηση", +"%s shared the folder %s with you" => "%s μοιράστηκε τον φάκελο %s μαζί σας", +"%s shared the file %s with you" => "%s μοιράστηκε το αρχείο %s μαζί σας", "Download" => "Λήψη", "No preview available for" => "Δεν υπάρχει διαθέσιμη προεπισκόπηση για", "web services under your control" => "υπηρεσίες δικτύου υπό τον έλεγχό σας" diff --git a/apps/files_sharing/l10n/eo.php b/apps/files_sharing/l10n/eo.php index e71715f0f1..c598d3aa2c 100644 --- a/apps/files_sharing/l10n/eo.php +++ b/apps/files_sharing/l10n/eo.php @@ -1,6 +1,8 @@ "Pasvorto", "Submit" => "Sendi", +"%s shared the folder %s with you" => "%s kunhavigis la dosierujon %s kun vi", +"%s shared the file %s with you" => "%s kunhavigis la dosieron %s kun vi", "Download" => "Elŝuti", "No preview available for" => "Ne haveblas antaŭvido por", "web services under your control" => "TTT-servoj regataj de vi" diff --git a/apps/files_sharing/l10n/he.php b/apps/files_sharing/l10n/he.php index 68a337241d..ff7be88af8 100644 --- a/apps/files_sharing/l10n/he.php +++ b/apps/files_sharing/l10n/he.php @@ -1,6 +1,8 @@ "ססמה", "Submit" => "שליחה", +"%s shared the folder %s with you" => "%s שיתף עמך את התיקייה %s", +"%s shared the file %s with you" => "%s שיתף עמך את הקובץ %s", "Download" => "הורדה", "No preview available for" => "אין תצוגה מקדימה זמינה עבור", "web services under your control" => "שירותי רשת תחת השליטה שלך" diff --git a/apps/files_sharing/l10n/ku_IQ.php b/apps/files_sharing/l10n/ku_IQ.php new file mode 100644 index 0000000000..f139b0a064 --- /dev/null +++ b/apps/files_sharing/l10n/ku_IQ.php @@ -0,0 +1,9 @@ + "تێپه‌ڕه‌وشه", +"Submit" => "ناردن", +"%s shared the folder %s with you" => "%s دابه‌شی کردووه‌ بوخچه‌ی %s له‌گه‌ڵ تۆ", +"%s shared the file %s with you" => "%s دابه‌شی کردووه‌ په‌ڕگه‌یی %s له‌گه‌ڵ تۆ", +"Download" => "داگرتن", +"No preview available for" => "هیچ پێشبینیه‌ك ئاماده‌ نیه بۆ", +"web services under your control" => "ڕاژه‌ی وێب له‌ژێر چاودێریت دایه" +); diff --git a/apps/files_sharing/l10n/pt_PT.php b/apps/files_sharing/l10n/pt_PT.php new file mode 100644 index 0000000000..b8e700e380 --- /dev/null +++ b/apps/files_sharing/l10n/pt_PT.php @@ -0,0 +1,9 @@ + "Palavra-Passe", +"Submit" => "Submeter", +"%s shared the folder %s with you" => "%s partilhou a pasta %s consigo", +"%s shared the file %s with you" => "%s partilhou o ficheiro %s consigo", +"Download" => "Descarregar", +"No preview available for" => "Não há pré-visualização para", +"web services under your control" => "serviços web sob o seu controlo" +); diff --git a/apps/files_sharing/l10n/ru_RU.php b/apps/files_sharing/l10n/ru_RU.php index a1579efc8f..36e4b2fd0e 100644 --- a/apps/files_sharing/l10n/ru_RU.php +++ b/apps/files_sharing/l10n/ru_RU.php @@ -1,6 +1,8 @@ "Пароль", "Submit" => "Передать", +"%s shared the folder %s with you" => "%s имеет общий с Вами доступ к папке %s ", +"%s shared the file %s with you" => "%s имеет общий с Вами доступ к файлу %s ", "Download" => "Загрузка", "No preview available for" => "Предварительный просмотр недоступен", "web services under your control" => "веб-сервисы под Вашим контролем" diff --git a/apps/files_sharing/l10n/sk_SK.php b/apps/files_sharing/l10n/sk_SK.php index ec9fc31c87..2e781f76f3 100644 --- a/apps/files_sharing/l10n/sk_SK.php +++ b/apps/files_sharing/l10n/sk_SK.php @@ -1,6 +1,8 @@ "Heslo", "Submit" => "Odoslať", +"%s shared the folder %s with you" => "%s zdieľa s vami priečinok %s", +"%s shared the file %s with you" => "%s zdieľa s vami súbor %s", "Download" => "Stiahnuť", "No preview available for" => "Žiaden náhľad k dispozícii pre", "web services under your control" => "webové služby pod Vašou kontrolou" diff --git a/apps/files_sharing/l10n/zh_CN.GB2312.php b/apps/files_sharing/l10n/zh_CN.GB2312.php index fdde2c641f..117ec8f406 100644 --- a/apps/files_sharing/l10n/zh_CN.GB2312.php +++ b/apps/files_sharing/l10n/zh_CN.GB2312.php @@ -1,6 +1,8 @@ "密码", "Submit" => "提交", +"%s shared the folder %s with you" => "%s 与您分享了文件夹 %s", +"%s shared the file %s with you" => "%s 与您分享了文件 %s", "Download" => "下载", "No preview available for" => "没有预览可用于", "web services under your control" => "您控制的网络服务" diff --git a/apps/files_sharing/lib/share/file.php b/apps/files_sharing/lib/share/file.php index 074ca9928d..9a88050592 100644 --- a/apps/files_sharing/lib/share/file.php +++ b/apps/files_sharing/lib/share/file.php @@ -53,7 +53,7 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent { $name = substr($target, 0, $pos); $ext = substr($target, $pos); } else { - $name = $filePath; + $name = $target; $ext = ''; } $i = 2; diff --git a/apps/files_sharing/lib/share/folder.php b/apps/files_sharing/lib/share/folder.php index e29e9b7e00..bddda99f8b 100644 --- a/apps/files_sharing/lib/share/folder.php +++ b/apps/files_sharing/lib/share/folder.php @@ -59,7 +59,7 @@ class OC_Share_Backend_Folder extends OC_Share_Backend_File implements OCP\Share $parents = array(); while ($file = $result->fetchRow()) { $children[] = array('source' => $file['id'], 'file_path' => $file['name']); - // If a child folder is found look inside it + // If a child folder is found look inside it if ($file['mimetype'] == 'httpd/unix-directory') { $parents[] = $file['id']; } diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php index 525ffa8357..59385dd686 100644 --- a/apps/files_sharing/public.php +++ b/apps/files_sharing/public.php @@ -1,23 +1,55 @@ execute(array($_GET['token']))->fetchOne(); + if(isset($filepath)) { + $info = OC_FileCache_Cached::get($filepath, ''); + if(strtolower($info['mimetype']) == 'httpd/unix-directory') { + $_GET['dir'] = $filepath; + } else { + $_GET['file'] = $filepath; + } + \OCP\Util::writeLog('files_sharing', 'You have files that are shared by link originating from ownCloud 4.0. Redistribute the new links, because backwards compatibility will be removed in ownCloud 5.', \OCP\Util::WARN); + } +} +// Enf of backward compatibility + if (isset($_GET['file']) || isset($_GET['dir'])) { if (isset($_GET['dir'])) { $type = 'folder'; - $path = $_GET['dir']; - $baseDir = basename($path); + $path = OC_Filesystem::normalizePath($_GET['dir']); + $baseDir = $path; $dir = $baseDir; } else { $type = 'file'; - $path = $_GET['file']; + $path = OC_Filesystem::normalizePath($_GET['file']); } $uidOwner = substr($path, 1, strpos($path, '/', 1) - 1); if (OCP\User::userExists($uidOwner)) { OC_Util::setupFS($uidOwner); $fileSource = OC_Filecache::getId($path, ''); if ($fileSource != -1 && ($linkItem = OCP\Share::getItemSharedWithByLink($type, $fileSource, $uidOwner))) { + // TODO Fix in the getItems + if (!isset($linkItem['item_type']) || $linkItem['item_type'] != $type) { + header('HTTP/1.0 404 Not Found'); + $tmpl = new OCP\Template('', '404', 'guest'); + $tmpl->printPage(); + exit(); + } if (isset($linkItem['share_with'])) { // Check password + if (isset($_GET['file'])) { + $url = OCP\Util::linkToPublic('files').'&file='.$_GET['file']; + } else { + $url = OCP\Util::linkToPublic('files').'&dir='.$_GET['dir']; + } if (isset($_POST['password'])) { $password = $_POST['password']; $storedHash = $linkItem['share_with']; @@ -25,7 +57,7 @@ if (isset($_GET['file']) || isset($_GET['dir'])) { $hasher = new PasswordHash(8, $forcePortable); if (!($hasher->CheckPassword($password.OC_Config::getValue('passwordsalt', ''), $storedHash))) { $tmpl = new OCP\Template('files_sharing', 'authenticate', 'guest'); - $tmpl->assign('URL', OCP\Util::linkToPublic('files').'&file='.$_GET['file']); + $tmpl->assign('URL', $url); $tmpl->assign('error', true); $tmpl->printPage(); exit(); @@ -37,7 +69,7 @@ if (isset($_GET['file']) || isset($_GET['dir'])) { } else if (!isset($_SESSION['public_link_authenticated']) || $_SESSION['public_link_authenticated'] !== $linkItem['id']) { // Prompt for password $tmpl = new OCP\Template('files_sharing', 'authenticate', 'guest'); - $tmpl->assign('URL', OCP\Util::linkToPublic('files').'&file='.$_GET['file']); + $tmpl->assign('URL', $url); $tmpl->printPage(); exit(); } @@ -55,14 +87,18 @@ if (isset($_GET['file']) || isset($_GET['dir'])) { } // Download the file if (isset($_GET['download'])) { - $mimetype = OC_Filesystem::getMimeType($path); - header('Content-Transfer-Encoding: binary'); - header('Content-Disposition: attachment; filename="'.basename($path).'"'); - header('Content-Type: '.$mimetype); - header('Content-Length: '.OC_Filesystem::filesize($path)); - OCP\Response::disableCaching(); - @ob_clean(); - OC_Filesystem::readfile($path); + if (isset($_GET['dir'])) { + if ( isset($_GET['files']) ) { // download selected files + OC_Files::get($path, $_GET['files'], $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false); + } else if (isset($_GET['path']) && $_GET['path'] != '' ) { // download a file from a shared directory + OC_Files::get('', $path, $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false); + } else { // download the whole shared directory + OC_Files::get($path, '', $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false); + } + } else { // download a single shared file + OC_Files::get("", $path, $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false); + } + } else { OCP\Util::addStyle('files_sharing', 'public'); OCP\Util::addScript('files_sharing', 'public'); @@ -83,7 +119,7 @@ if (isset($_GET['file']) || isset($_GET['dir'])) { $i['basename'] = $fileinfo['filename']; $i['extension'] = isset($fileinfo['extension']) ? ('.'.$fileinfo['extension']) : ''; } - $i['directory'] = substr($i['directory'], $rootLength); + $i['directory'] = '/'.substr('/'.$uidOwner.'/files'.$i['directory'], $rootLength); if ($i['directory'] == '/') { $i['directory'] = ''; } @@ -93,16 +129,21 @@ if (isset($_GET['file']) || isset($_GET['dir'])) { // Make breadcrumb $breadcrumb = array(); $pathtohere = ''; + $count = 1; foreach (explode('/', $dir) as $i) { if ($i != '') { if ($i != $baseDir) { $pathtohere .= '/'.$i; } - $breadcrumb[] = array('dir' => $pathtohere, 'name' => $i); + if ( strlen($pathtohere) < strlen($_GET['dir'])) { + continue; + } + $breadcrumb[] = array('dir' => str_replace($_GET['dir'], "", $pathtohere, $count), 'name' => $i); } } $list = new OCP\Template('files', 'part.list', ''); $list->assign('files', $files, false); + $list->assign('publicListView', true); $list->assign('baseURL', OCP\Util::linkToPublic('files').'&dir='.$_GET['dir'].'&path=', false); $list->assign('downloadURL', OCP\Util::linkToPublic('files').'&download&dir='.$_GET['dir'].'&path=', false); $breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', '' ); diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php index fd9b79e6f1..ef81e296d8 100644 --- a/apps/files_sharing/templates/public.php +++ b/apps/files_sharing/templates/public.php @@ -31,7 +31,5 @@ -
                -

                ownCloudt('web services under your control'); ?>

                diff --git a/apps/files_versions/appinfo/info.xml b/apps/files_versions/appinfo/info.xml index d806291ed1..e4e5a365d5 100644 --- a/apps/files_versions/appinfo/info.xml +++ b/apps/files_versions/appinfo/info.xml @@ -4,7 +4,7 @@ Versions AGPL Frank Karlitschek - 4 + 4.9 true Versioning of files diff --git a/apps/files_versions/js/versions.js b/apps/files_versions/js/versions.js index 9075095d28..426d521df8 100644 --- a/apps/files_versions/js/versions.js +++ b/apps/files_versions/js/versions.js @@ -25,7 +25,7 @@ $(document).ready(function(){ var file = $('#dir').val()+'/'+filename; // Check if drop down is already visible for a different file - if (($('#dropdown').length > 0)) { + if (($('#dropdown').length > 0) && $('#dropdown').hasClass('drop-versions') ) { if (file != $('#dropdown').data('file')) { $('#dropdown').hide('blind', function() { $('#dropdown').remove(); @@ -45,7 +45,7 @@ function createVersionsDropdown(filename, files) { var historyUrl = OC.linkTo('files_versions', 'history.php') + '?path='+encodeURIComponent( $( '#dir' ).val() ).replace( /%2F/g, '/' )+'/'+encodeURIComponent( filename ); - var html = '