git-svn-id: https://192.168.0.254/svn/Proyectos.AdemasProyectosSolidarios_Web/trunk@5 dac18aa3-6f68-5b46-b19f-13bb96c8fe2c
@ -1,23 +0,0 @@
|
|||||||
|
|
||||||
The MIT License
|
|
||||||
|
|
||||||
Copyright (c) <2008> <Kazuyoshi Tlacaelel>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
EXAMPLES
|
|
||||||
located in the file "docs/examples/EXAMPLES"
|
|
||||||
|
|
||||||
LICENSE
|
|
||||||
located in the file "LICENSE"
|
|
||||||
|
|
||||||
PROJECT
|
|
||||||
http://code.google.com/p/php-csv-parser/
|
|
||||||
|
|
||||||
TESTS
|
|
||||||
located in the folder "tests"
|
|
||||||
|
|
||||||
AUTHOR
|
|
||||||
Kazuyoshi Tlacaelel
|
|
||||||
|
|
||||||
DOCUMENTATION
|
|
||||||
http://code.google.com/p/php-csv-parser/
|
|
||||||
@ -1,72 +0,0 @@
|
|||||||
#summary Quick sample!
|
|
||||||
#labels Featured
|
|
||||||
|
|
||||||
Lets get started with quick samples
|
|
||||||
|
|
||||||
= Quick Samples =
|
|
||||||
*my_file.csv*
|
|
||||||
{{{
|
|
||||||
name, age
|
|
||||||
john, 13
|
|
||||||
takaka, 8
|
|
||||||
}}}
|
|
||||||
|
|
||||||
*php script*
|
|
||||||
{{{
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$csv = new File_CSV_DataSource;
|
|
||||||
|
|
||||||
$csv->load('my_file.csv'); // boolean
|
|
||||||
|
|
||||||
$csv->getHeaders(); // array('name', 'age');
|
|
||||||
|
|
||||||
$csv->getColumn('name'); // array('john', 'tanaka');
|
|
||||||
|
|
||||||
$csv->row(1); // array('john', '13');
|
|
||||||
|
|
||||||
$csv->connect(); // array(
|
|
||||||
// array('name' => 'john', 'age' => 13),
|
|
||||||
// array('name' => 'tanaka', 'age' => 8)
|
|
||||||
// );
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
}}}
|
|
||||||
|
|
||||||
|
|
||||||
= Detailed Usage =
|
|
||||||
|
|
||||||
{{{
|
|
||||||
<?php
|
|
||||||
|
|
||||||
// usage sample
|
|
||||||
$csv = new File_CSV_DataSource;
|
|
||||||
|
|
||||||
// tell the object to parse a specific file
|
|
||||||
if ($csv->load('my_file.csv')) {
|
|
||||||
|
|
||||||
// execute the following if given file is usable
|
|
||||||
|
|
||||||
// get the headers found in file
|
|
||||||
$array = $csv->getHeaders();
|
|
||||||
|
|
||||||
// get a specific column from csv file
|
|
||||||
$csv->getColumn($array[2]);
|
|
||||||
|
|
||||||
// get each record with its related header
|
|
||||||
// ONLY if all records length match the number
|
|
||||||
// of headers
|
|
||||||
if ($csv->isSymmetric()) {
|
|
||||||
$array = $csv->connect();
|
|
||||||
} else {
|
|
||||||
// fetch records that dont match headers length
|
|
||||||
$array = $csv->getAsymmetricRows();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore everything and simply get the data as an array
|
|
||||||
$array = $csv->getrawArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
}}}
|
|
||||||
@ -1,508 +0,0 @@
|
|||||||
<?php
|
|
||||||
require_once 'PHPUnit/Framework.php';
|
|
||||||
|
|
||||||
require_once "File/CSV/DataSource.php";
|
|
||||||
require_once "File/CSV/tests/fixtures/csv.php";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test class for File_CSV_DataSource.
|
|
||||||
* Generated by PHPUnit on 2008-10-08 at 20:47:55.
|
|
||||||
*/
|
|
||||||
class File_CSV_DataSourceTest extends PHPUnit_Framework_TestCase
|
|
||||||
{
|
|
||||||
protected $csv;
|
|
||||||
|
|
||||||
protected function setUp()
|
|
||||||
{
|
|
||||||
$this->csv = new File_CSV_DataSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown()
|
|
||||||
{
|
|
||||||
$this->csv = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_uses_must_load_valid_files()
|
|
||||||
{
|
|
||||||
// must return true when a file is valid
|
|
||||||
foreach (fix('valid_files') as $file => $msg) {
|
|
||||||
$this->assertTrue($this->csv->load(path($file)), $msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testSettings()
|
|
||||||
{
|
|
||||||
$new_delim = '>>>>';
|
|
||||||
$this->csv->settings(array('delimiter' => $new_delim));
|
|
||||||
|
|
||||||
$expected = array(
|
|
||||||
'delimiter' => $new_delim,
|
|
||||||
'eol' => ";",
|
|
||||||
'length' => 999999,
|
|
||||||
'escape' => '"'
|
|
||||||
);
|
|
||||||
|
|
||||||
$msg = 'settings where not parsed correctly!';
|
|
||||||
$this->assertEquals($expected, $this->csv->settings, $msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testHeaders()
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->csv->load(path('symmetric.csv'));
|
|
||||||
$result = $this->csv->getHeaders();
|
|
||||||
$this->assertEquals(fix('symmetric_headers'), $result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testConnect()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$this->assertEquals(fix('symmetric_connection'), $this->csv->connect());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_connect_must_return_emtpy_arr_when_not_aisSymmetric()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('escape_ng.csv')));
|
|
||||||
$this->assertEquals(array(), $this->csv->connect());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testSymmetric_OK()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$this->assertTrue($this->csv->isSymmetric());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testSymmetric_NG()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('asymmetric.csv')));
|
|
||||||
$this->assertFalse($this->csv->isSymmetric());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testAsymmetry()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('asymmetric.csv')));
|
|
||||||
$result = $this->csv->getAsymmetricRows();
|
|
||||||
$this->assertEquals(fix('asymmetric_rows'), $result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testColumn()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('asymmetric.csv')));
|
|
||||||
$result = $this->csv->getColumn('header_c');
|
|
||||||
|
|
||||||
$this->assertEquals(fix('expected_column'), $result);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testRaw_array()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('raw.csv')));
|
|
||||||
$this->assertEquals(fix('expected_raw'), $this->csv->getRawArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_if_connect_ignores_valid_escaped_delims()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('escape_ok.csv')));
|
|
||||||
$this->assertEquals(fix('expected_escaped'), $this->csv->connect());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_create_headers_must_generate_headers_for_symmetric_data()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$this->assertTrue($this->csv->createHeaders('COL'));
|
|
||||||
$this->assertEquals(fix('expected_headers'), $this->csv->getHeaders());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function tets_create_headers_must_not_create_when_data_is_aisSymmetric()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('asymmetric.csv')));
|
|
||||||
$this->assertFalse($this->csv->createHeaders('COL'));
|
|
||||||
$this->assertEquals(fix('original_headers'), $this->csv->getHeaders());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_inject_headers_must_inject_headers_for_symmetric_data()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$this->assertEquals(fix('original_headers'), $this->csv->getHeaders());
|
|
||||||
$this->assertTrue($this->csv->setHeaders(fix('expected_headers')));
|
|
||||||
$this->assertEquals(fix('expected_headers'), $this->csv->getHeaders());
|
|
||||||
$this->assertEquals(fix('symmetric_raw_data'), $this->csv->getRows());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_inject_headers_must_not_inject_when_data_is_aisSymmetric()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('asymmetric.csv')));
|
|
||||||
$this->assertEquals(fix('original_headers'), $this->csv->getHeaders());
|
|
||||||
$this->assertFalse($this->csv->setHeaders(fix('expected_headers')));
|
|
||||||
$this->assertEquals(fix('original_headers'), $this->csv->getHeaders());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_row_count_is_correct()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$expected_count = count(fix('symmetric_connection'));
|
|
||||||
$this->assertEquals($expected_count, $this->csv->countRows());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_row_fetching_returns_correct_result()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$expected = fix('eighth_row_from_symmetric');
|
|
||||||
$this->assertEquals($expected, $this->csv->getRow(8));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_row_must_be_empty_array_when_row_does_not_exist()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$this->assertEquals(array(), $this->csv->getRow(-1));
|
|
||||||
$this->assertEquals(array(), $this->csv->getRow(10));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_connect_must_build_relationship_for_needed_headers_only()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$result = $this->csv->connect(array('header_a'));
|
|
||||||
$this->assertEquals(fix('header_a_connection'), $result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_connect_must_return_empty_array_if_given_params_are_of_invalid_datatype()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$this->assertEquals(array(), $this->csv->connect('header_a'));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_connect_should_ignore_non_existant_headers_AND_return_empty_array()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$this->assertEquals(array(), $this->csv->connect(array('non_existent_header')));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_connect_should_ignore_non_existant_headers_BUT_get_existent_ones()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$result = $this->csv->connect(array('non_existent_header', 'header_a'));
|
|
||||||
$this->assertEquals(fix('header_a_connection'), $result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_count_getHeaders()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$this->assertEquals(5, $this->csv->countHeaders());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_raw_array_must_remove_empty_lines()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric_with_empty_lines.csv')));
|
|
||||||
$this->assertEquals(fix('symmetric_connection'), $this->csv->connect());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_raw_array_must_remove_empty_records()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric_with_empty_records.csv')));
|
|
||||||
$this->assertEquals(fix('symmetric_connection'), $this->csv->connect());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_range_of_rows_should_retrive_specific_rows_only()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$expected = fix('symmetric_range_of_rows');
|
|
||||||
$this->assertEquals($expected, $this->csv->getRows(range(1, 2)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_non_existent_rows_in_range_should_be_ignored()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$expected = fix('symmetric_range_of_rows');
|
|
||||||
$this->assertEquals($expected, $this->csv->getRows(array(22, 19, 1, 2)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_fist_row_must_be_zero()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$this->assertEquals(fix('first_row_from_symmetric'), $this->csv->getRow(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_uses_must_flush_internal_data_when_new_file_is_given()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('another_symmetric.csv')));
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$this->assertEquals(fix('symmetric_headers'), $this->csv->getHeaders());
|
|
||||||
$this->assertEquals(fix('symmetric_rows'), $this->csv->getRows());
|
|
||||||
$this->assertEquals(fix('symmetric_raw_data'), $this->csv->getRawArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_getCell()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$this->assertEquals(fix('first_symmetric_cell'), $this->csv->getCell(0, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_header_exists()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
foreach (fix('symmetric_headers') as $h) {
|
|
||||||
$this->assertTrue($this->csv->hasColumn($h));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_header_exists_must_return_false_when_header_does_not_exist()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$this->assertFalse($this->csv->hasColumn(md5('x')));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_fill_getCell()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$this->assertTrue($this->csv->fillCell(0, 0, 'hoge hoge'));
|
|
||||||
$this->assertEquals('hoge hoge', $this->csv->getCell(0, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_coordinatable_must_return_true_when_coordinates_exist()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$this->assertTrue($this->csv->hasCell(0, 0));
|
|
||||||
$this->assertFalse($this->csv->hasCell(-1, 0));
|
|
||||||
$this->assertFalse($this->csv->hasCell(0, -1));
|
|
||||||
$this->assertFalse($this->csv->hasCell(-1, -1));
|
|
||||||
$this->assertFalse($this->csv->hasCell(1, 11));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_fill_column_must_fill_all_values_of_a_getColumn()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$fh = fix('first_symmetric_header');
|
|
||||||
$this->assertTrue($this->csv->fillColumn($fh, ''));
|
|
||||||
$this->assertEquals(fix('empty_column'), $this->csv->getColumn($fh));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_append_column_must_create_new_header_and_blank_values()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$this->assertTrue($this->csv->appendColumn('extra'));
|
|
||||||
$se = fix('symmetric_extra_header');
|
|
||||||
$this->assertEquals($se, $this->csv->getHeaders());
|
|
||||||
$this->assertEquals(fix('empty_column'), $this->csv->getColumn('extra'));
|
|
||||||
$this->assertEquals(count($se), $this->csv->countHeaders());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_symmetrize_must_convert_asymmetric_file()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('asymmetric.csv')));
|
|
||||||
$this->csv->symmetrize();
|
|
||||||
$this->assertTrue($this->csv->isSymmetric());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_symetrize_must_not_alter_symmetric_data()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$this->csv->symmetrize();
|
|
||||||
$this->assertEquals(fix('symmetric_headers'), $this->csv->getHeaders());
|
|
||||||
$this->assertEquals(fix('symmetric_rows'), $this->csv->getRows());
|
|
||||||
$this->assertEquals(fix('symmetric_raw_data'), $this->csv->getRawArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_remove_column_must_remove_last_column_and_return_true()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$this->assertTrue($this->csv->removeColumn('header_e'));
|
|
||||||
$this->assertEquals(fix('symmetric_raw_data_with_last_colum_removed'), $this->csv->getRawArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_remove_column_must_remove_second_column_and_return_true()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$this->assertTrue($this->csv->removeColumn('header_b'));
|
|
||||||
$this->assertEquals(fix('symmetric_raw_data_with_second_column_removed'), $this->csv->getRawArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_remove_column_must_return_false_when_column_does_not_exist()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$this->assertFalse($this->csv->removeColumn(md5('header_b')));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_remove_row_must_remove_first_row_successfully_and_return_true()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$this->assertTrue($this->csv->removeRow(0));
|
|
||||||
$this->assertEquals(fix('symmetric_rows_without_first_row'), $this->csv->getRows());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_remove_row_must_remove_only_third_row_and_return_true()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$this->assertTrue($this->csv->removeRow(2));
|
|
||||||
$this->assertEquals(fix('symmetric_rows_without_third_row'), $this->csv->getRows());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_remove_row_must_return_false_and_leave_rows_intact_when_row_does_not_exist()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$this->assertFalse($this->csv->removeRow(999999));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_rows_must_return_all_rows_when_argument_is_not_an_array()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$this->assertEquals(fix('symmetric_rows'), $this->csv->getRows('lasdjfklsajdf'));
|
|
||||||
$this->assertEquals(fix('symmetric_rows'), $this->csv->getRows(true));
|
|
||||||
$this->assertEquals(fix('symmetric_rows'), $this->csv->getRows(false));
|
|
||||||
$this->assertEquals(fix('symmetric_rows'), $this->csv->getRows(1));
|
|
||||||
$this->assertEquals(fix('symmetric_rows'), $this->csv->getRows(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_has_row_must_return_true_when_a_row_exists()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$this->assertTrue($this->csv->hasRow(1));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_row_must_return_false_when_a_row_does_not_exist()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$this->assertFalse($this->csv->hasRow(999999));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_fill_row_must_fill_a_row_with_a_string_and_return_true()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('one_row_only.csv')));
|
|
||||||
$this->assertTrue($this->csv->fillRow(0, 'hello'));
|
|
||||||
$this->assertEquals(fix('rows_from_one_row_only_plus_one_filled_with_str_hello'), $this->csv->getRows());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_fill_row_mus_fill_a_row_with_an_array_and_return_true()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('one_row_only.csv')));
|
|
||||||
$this->assertTrue($this->csv->fillRow(0, $this->csv->getHeaders()));
|
|
||||||
$this->assertEquals(fix('rows_from_one_row_only_plus_one_filled_with_arr_abc'), $this->csv->getRows());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_fill_row_must_fill_a_row_with_a_number_and_return_true()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('one_row_only.csv')));
|
|
||||||
$this->assertTrue($this->csv->fillRow(0, 1));
|
|
||||||
$this->assertEquals(fix('rows_from_one_row_only_plus_one_filled_with_num_1'), $this->csv->getRows());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_fill_row_must_not_change_anything_when_given_row_does_not_exist_and_return_false()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('one_row_only.csv')));
|
|
||||||
$this->assertFalse($this->csv->fillRow(999, 1));
|
|
||||||
$this->assertEquals(fix('rows_from_one_row_only'), $this->csv->getRows());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_fill_row_must_not_change_anything_when_given_value_is_other_than_string_int_or_array_and_return_false()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('one_row_only.csv')));
|
|
||||||
$this->assertFalse($this->csv->fillRow(0, new stdClass));
|
|
||||||
$this->assertEquals(fix('rows_from_one_row_only'), $this->csv->getRows());
|
|
||||||
}
|
|
||||||
|
|
||||||
// be strict, no looking back from the end of array
|
|
||||||
public function test_fill_row_must_return_false_when_negative_numbers_are_given()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$this->assertFalse($this->csv->fillRow(-1, 'xxx'));
|
|
||||||
$this->assertEquals(fix('symmetric_rows'), $this->csv->getRows());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_append_row_must_aggregate_a_row_fill_it_with_values_and_return_true()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$this->assertTrue($this->csv->appendRow(fix('one_row_for_symmetric')));
|
|
||||||
$this->assertEquals(fix('symmetric_rows_plus_one'), $this->csv->getRows());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_walk_row_must_replace_values_in_a_row_by_using_a_callback_and_be_true()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('one_row_only.csv')));
|
|
||||||
$this->assertTrue($this->csv->walkRow(0, 'callback'));
|
|
||||||
$this->assertEquals(fix('rows_from_one_row_only_plus_one_filled_with_num_1'), $this->csv->getRows());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_walk_row_must_return_false_when_callback_does_not_exist()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$non_existent_callback = md5('');
|
|
||||||
$this->assertFalse($this->csv->walkRow(1, $non_existent_callback));
|
|
||||||
$this->assertEquals(fix('symmetric_rows'), $this->csv->getRows());
|
|
||||||
$this->assertEquals(fix('symmetric_headers'), $this->csv->getHeaders());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_walk_column_must_replace_values_in_a_column_and_be_true()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$fh = fix('first_symmetric_header');
|
|
||||||
$this->assertTrue($this->csv->walkColumn($fh, 'callback2'));
|
|
||||||
$this->assertEquals(fix('empty_column'), $this->csv->getColumn($fh));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_walk_column_must_return_false_when_callback_does_not_exist()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$fh = fix('first_symmetric_header');
|
|
||||||
$non_existent_callback = md5('');
|
|
||||||
$this->assertFalse($this->csv->walkColumn($fh, $non_existent_callback));
|
|
||||||
$this->assertEquals(fix('symmetric_rows'), $this->csv->getRows());
|
|
||||||
$this->assertEquals(fix('symmetric_headers'), $this->csv->getHeaders());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_walk_grid_must_replace_the_whole_data_set_and_be_true()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$this->assertTrue($this->csv->walkGrid('callback2'));
|
|
||||||
$this->assertEquals(fix('symmetric_rows_empty'), $this->csv->getRows());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_walk_grid_must_return_false_when_callback_does_not_exist()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->csv->load(path('symmetric.csv')));
|
|
||||||
$non_existent_callback = md5('');
|
|
||||||
$this->assertFalse($this->csv->walkGrid($non_existent_callback));
|
|
||||||
$this->assertEquals(fix('symmetric_rows'), $this->csv->getRows());
|
|
||||||
$this->assertEquals(fix('symmetric_headers'), $this->csv->getHeaders());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_constructor_must_be_equivalent_to_load()
|
|
||||||
{
|
|
||||||
$this->csv = new File_CSV_DataSource(path('symmetric.csv'));
|
|
||||||
$result = $this->csv->getHeaders();
|
|
||||||
$this->assertEquals(fix('symmetric_headers'), $result);
|
|
||||||
$this->assertEquals(fix('symmetric_rows'), $this->csv->getRows());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_must_append_row_when_csv_file_only_has_headers_and_array_is_passed_returning_true()
|
|
||||||
{
|
|
||||||
$this->csv = new File_CSV_DataSource(path('only_headers.csv'));
|
|
||||||
$this->assertTrue($this->csv->appendRow(array(1, 2, 3)));
|
|
||||||
$result = array(array('a' => 1, 'b' => 2, 'c' => 3));
|
|
||||||
$this->assertEquals($result, $this->csv->connect());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_must_append_row_when_csv_file_only_has_headers_and_string_is_passed_returning_true()
|
|
||||||
{
|
|
||||||
$this->csv = new File_CSV_DataSource(path('only_headers.csv'));
|
|
||||||
$this->assertTrue($this->csv->appendRow('1'));
|
|
||||||
$result = array(array('a' => '1', 'b' => '1', 'c' => '1'));
|
|
||||||
$this->assertEquals($result, $this->csv->connect());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_must_append_row_when_csv_file_only_has_headers_and_numeric_value_is_passed_returning_true()
|
|
||||||
{
|
|
||||||
$this->csv = new File_CSV_DataSource(path('only_headers.csv'));
|
|
||||||
$this->assertTrue($this->csv->appendRow(1));
|
|
||||||
$result = array(array('a' => 1, 'b' => 1, 'c' => 1));
|
|
||||||
$this->assertEquals($result, $this->csv->connect());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_must_use_headers_as_max_row_padding_when_headers_length_is_longer_than_all_rows_length()
|
|
||||||
{
|
|
||||||
$this->csv = new File_CSV_DataSource(path('longer_headers.csv'));
|
|
||||||
$this->csv->symmetrize();
|
|
||||||
$this->assertEquals(fix('longer_headers'), $this->csv->connect());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
name,age,skill
|
|
||||||
john,13,knows magic
|
|
||||||
tanaka,8,makes sushi
|
|
||||||
jose,5,dances salsa
|
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
header_a, header_b, header_c, header_d, header_e
|
|
||||||
1aa, 1bb, 1cc, 1dd, 1ee
|
|
||||||
2aa, 2bb, 2cc, 2dd, 2ee
|
|
||||||
3aa, 3bb, 3cc, 3dd, 3ee
|
|
||||||
4aa, 4bb, 4cc, 4dd, 4ee
|
|
||||||
5aa, 5bb, 5cc, 5dd, 5ee, extra1
|
|
||||||
6aa, 6bb, 6cc, 6dd, 6ee
|
|
||||||
7aa, 7bb, 7cc, 7dd, 7ee
|
|
||||||
8aa, 8bb, 8cc, 8dd, 8ee, extra2
|
|
||||||
9aa, 9bb, 9cc, 9dd, 9ee
|
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
one, two, three
|
|
||||||
th,ie, adn, thei
|
|
||||||
thie, adn, thei
|
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
one, two, three
|
|
||||||
"thie,", adn, thei
|
|
||||||
thie, adn, thei
|
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
one, two, three, four, five, six
|
|
||||||
1, 2, 3
|
|
||||||
1, 2, 3, 4
|
|
||||||
, 2, 3, 4
|
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
a,b,c
|
|
||||||
1,2,3
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
a,b,c
|
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
h_one, h_two, h_three
|
|
||||||
v_1one, v_1two, v_1three
|
|
||||||
v_2one, v_2two, v_2three
|
|
||||||
v_3one, v_3two, v_3three
|
|
||||||
|
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
header_a, header_b, header_c, header_d, header_e
|
|
||||||
1aa, 1bb, 1cc, 1dd, 1ee
|
|
||||||
2aa, 2bb, 2cc, 2dd, 2ee
|
|
||||||
3aa, 3bb, 3cc, 3dd, 3ee
|
|
||||||
4aa, 4bb, 4cc, 4dd, 4ee
|
|
||||||
5aa, 5bb, 5cc, 5dd, 5ee
|
|
||||||
6aa, 6bb, 6cc, 6dd, 6ee
|
|
||||||
7aa, 7bb, 7cc, 7dd, 7ee
|
|
||||||
8aa, 8bb, 8cc, 8dd, 8ee
|
|
||||||
9aa, 9bb, 9cc, 9dd, 9ee
|
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
header_a, header_b, header_c, header_d, header_e
|
|
||||||
1aa, 1bb, 1cc, 1dd, 1ee
|
|
||||||
2aa, 2bb, 2cc, 2dd, 2ee
|
|
||||||
3aa, 3bb, 3cc, 3dd, 3ee
|
|
||||||
4aa, 4bb, 4cc, 4dd, 4ee
|
|
||||||
|
|
||||||
5aa, 5bb, 5cc, 5dd, 5ee
|
|
||||||
6aa, 6bb, 6cc, 6dd, 6ee
|
|
||||||
|
|
||||||
7aa, 7bb, 7cc, 7dd, 7ee
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
8aa, 8bb, 8cc, 8dd, 8ee
|
|
||||||
9aa, 9bb, 9cc, 9dd, 9ee
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
header_a, header_b, header_c, header_d, header_e
|
|
||||||
, , , ,
|
|
||||||
, , , ,
|
|
||||||
, , , ,
|
|
||||||
, , , ,
|
|
||||||
1aa, 1bb, 1cc, 1dd, 1ee
|
|
||||||
2aa, 2bb, 2cc, 2dd, 2ee
|
|
||||||
3aa, 3bb, 3cc, 3dd, 3ee
|
|
||||||
, , , ,
|
|
||||||
4aa, 4bb, 4cc, 4dd, 4ee
|
|
||||||
, , , ,
|
|
||||||
5aa, 5bb, 5cc, 5dd, 5ee
|
|
||||||
, , , ,
|
|
||||||
6aa, 6bb, 6cc, 6dd, 6ee
|
|
||||||
, , , ,
|
|
||||||
, , , ,
|
|
||||||
, , , ,
|
|
||||||
, , , ,
|
|
||||||
7aa, 7bb, 7cc, 7dd, 7ee
|
|
||||||
8aa, 8bb, 8cc, 8dd, 8ee
|
|
||||||
9aa, 9bb, 9cc, 9dd, 9ee
|
|
||||||
, , , ,
|
|
||||||
, , , ,
|
|
||||||
, , , ,
|
|
||||||
, , , ,
|
|
||||||
, , , ,
|
|
||||||
, , , ,
|
|
||||||
, , , ,
|
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
header_a, header_b, header_c, header_d, header_e
|
|
||||||
1aa, 1bb, 1cc, 1dd, 1ee
|
|
||||||
2aa, 2bb, 2cc, 2dd, 2ee
|
|
||||||
3aa , 3bb , 3cc, 3dd, 3ee
|
|
||||||
4aa, 4bb, 4cc, 4dd, 4ee
|
|
||||||
5aa, 5bb, 5cc, 5dd, 5ee
|
|
||||||
6aa, 6bb, 6cc, 6dd, 6ee
|
|
||||||
7aa, 7bb, 7cc, 7dd, 7ee
|
|
||||||
8aa, 8bb, 8cc, 8dd, 8ee
|
|
||||||
9aa, 9bb, 9cc, 9dd, 9ee
|
|
||||||
|
@ -1,999 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
$fixtures = array (
|
|
||||||
'symmetric_headers' =>
|
|
||||||
array (
|
|
||||||
0 => 'header_a',
|
|
||||||
1 => 'header_b',
|
|
||||||
2 => 'header_c',
|
|
||||||
3 => 'header_d',
|
|
||||||
4 => 'header_e',
|
|
||||||
),
|
|
||||||
'rows_from_one_row_only' => array (
|
|
||||||
array (
|
|
||||||
0 => '1',
|
|
||||||
1 => '2',
|
|
||||||
2 => '3',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'rows_from_one_row_only_plus_one_filled_with_num_1' => array (
|
|
||||||
array (
|
|
||||||
0 => '1',
|
|
||||||
1 => '1',
|
|
||||||
2 => '1',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'rows_from_one_row_only_plus_one_filled_with_str_hello' => array (
|
|
||||||
array (
|
|
||||||
0 => 'hello',
|
|
||||||
1 => 'hello',
|
|
||||||
2 => 'hello',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'rows_from_one_row_only_plus_one_filled_with_arr_abc' => array (
|
|
||||||
array (
|
|
||||||
0 => 'a',
|
|
||||||
1 => 'b',
|
|
||||||
2 => 'c',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'symmetric_raw_data_with_second_column_removed' =>
|
|
||||||
array (
|
|
||||||
0 =>
|
|
||||||
array (
|
|
||||||
0 => 'header_a',
|
|
||||||
1 => 'header_c',
|
|
||||||
2 => 'header_d',
|
|
||||||
3 => 'header_e',
|
|
||||||
),
|
|
||||||
1 =>
|
|
||||||
array (
|
|
||||||
0 => '1aa',
|
|
||||||
1 => '1cc',
|
|
||||||
2 => '1dd',
|
|
||||||
3 => '1ee',
|
|
||||||
),
|
|
||||||
2 =>
|
|
||||||
array (
|
|
||||||
0 => '2aa',
|
|
||||||
1 => '2cc',
|
|
||||||
2 => '2dd',
|
|
||||||
3 => '2ee',
|
|
||||||
),
|
|
||||||
3 =>
|
|
||||||
array (
|
|
||||||
0 => '3aa',
|
|
||||||
1 => '3cc',
|
|
||||||
2 => '3dd',
|
|
||||||
3 => '3ee',
|
|
||||||
),
|
|
||||||
4 =>
|
|
||||||
array (
|
|
||||||
0 => '4aa',
|
|
||||||
1 => '4cc',
|
|
||||||
2 => '4dd',
|
|
||||||
3 => '4ee',
|
|
||||||
),
|
|
||||||
5 =>
|
|
||||||
array (
|
|
||||||
0 => '5aa',
|
|
||||||
1 => '5cc',
|
|
||||||
2 => '5dd',
|
|
||||||
3 => '5ee',
|
|
||||||
),
|
|
||||||
6 =>
|
|
||||||
array (
|
|
||||||
0 => '6aa',
|
|
||||||
1 => '6cc',
|
|
||||||
2 => '6dd',
|
|
||||||
3 => '6ee',
|
|
||||||
),
|
|
||||||
7 =>
|
|
||||||
array (
|
|
||||||
0 => '7aa',
|
|
||||||
1 => '7cc',
|
|
||||||
2 => '7dd',
|
|
||||||
3 => '7ee',
|
|
||||||
),
|
|
||||||
8 =>
|
|
||||||
array (
|
|
||||||
0 => '8aa',
|
|
||||||
1 => '8cc',
|
|
||||||
2 => '8dd',
|
|
||||||
3 => '8ee',
|
|
||||||
),
|
|
||||||
9 =>
|
|
||||||
array (
|
|
||||||
0 => '9aa',
|
|
||||||
1 => '9cc',
|
|
||||||
2 => '9dd',
|
|
||||||
3 => '9ee',
|
|
||||||
)
|
|
||||||
),
|
|
||||||
'symmetric_raw_data_with_last_colum_removed' =>
|
|
||||||
array (
|
|
||||||
0 =>
|
|
||||||
array (
|
|
||||||
0 => 'header_a',
|
|
||||||
1 => 'header_b',
|
|
||||||
2 => 'header_c',
|
|
||||||
3 => 'header_d',
|
|
||||||
),
|
|
||||||
1 =>
|
|
||||||
array (
|
|
||||||
0 => '1aa',
|
|
||||||
1 => '1bb',
|
|
||||||
2 => '1cc',
|
|
||||||
3 => '1dd',
|
|
||||||
),
|
|
||||||
2 =>
|
|
||||||
array (
|
|
||||||
0 => '2aa',
|
|
||||||
1 => '2bb',
|
|
||||||
2 => '2cc',
|
|
||||||
3 => '2dd',
|
|
||||||
),
|
|
||||||
3 =>
|
|
||||||
array (
|
|
||||||
0 => '3aa',
|
|
||||||
1 => '3bb',
|
|
||||||
2 => '3cc',
|
|
||||||
3 => '3dd',
|
|
||||||
),
|
|
||||||
4 =>
|
|
||||||
array (
|
|
||||||
0 => '4aa',
|
|
||||||
1 => '4bb',
|
|
||||||
2 => '4cc',
|
|
||||||
3 => '4dd',
|
|
||||||
),
|
|
||||||
5 =>
|
|
||||||
array (
|
|
||||||
0 => '5aa',
|
|
||||||
1 => '5bb',
|
|
||||||
2 => '5cc',
|
|
||||||
3 => '5dd',
|
|
||||||
),
|
|
||||||
6 =>
|
|
||||||
array (
|
|
||||||
0 => '6aa',
|
|
||||||
1 => '6bb',
|
|
||||||
2 => '6cc',
|
|
||||||
3 => '6dd',
|
|
||||||
),
|
|
||||||
7 =>
|
|
||||||
array (
|
|
||||||
0 => '7aa',
|
|
||||||
1 => '7bb',
|
|
||||||
2 => '7cc',
|
|
||||||
3 => '7dd',
|
|
||||||
),
|
|
||||||
8 =>
|
|
||||||
array (
|
|
||||||
0 => '8aa',
|
|
||||||
1 => '8bb',
|
|
||||||
2 => '8cc',
|
|
||||||
3 => '8dd',
|
|
||||||
),
|
|
||||||
9 =>
|
|
||||||
array (
|
|
||||||
0 => '9aa',
|
|
||||||
1 => '9bb',
|
|
||||||
2 => '9cc',
|
|
||||||
3 => '9dd',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
'first_symmetric_header' => 'header_a',
|
|
||||||
'first_symmetric_cell' => '1aa',
|
|
||||||
|
|
||||||
'symmetric_extra_header' =>
|
|
||||||
array (
|
|
||||||
0 => 'header_a',
|
|
||||||
1 => 'header_b',
|
|
||||||
2 => 'header_c',
|
|
||||||
3 => 'header_d',
|
|
||||||
4 => 'header_e',
|
|
||||||
5 => 'extra',
|
|
||||||
),
|
|
||||||
'first_row_from_symmetric' =>
|
|
||||||
array (
|
|
||||||
0 => '1aa',
|
|
||||||
1 => '1bb',
|
|
||||||
2 => '1cc',
|
|
||||||
3 => '1dd',
|
|
||||||
4 => '1ee',
|
|
||||||
),
|
|
||||||
'eighth_row_from_symmetric' =>
|
|
||||||
array (
|
|
||||||
0 => '9aa',
|
|
||||||
1 => '9bb',
|
|
||||||
2 => '9cc',
|
|
||||||
3 => '9dd',
|
|
||||||
4 => '9ee',
|
|
||||||
),
|
|
||||||
'valid_files' =>
|
|
||||||
array (
|
|
||||||
'empty.csv' => 'emtpy csv file',
|
|
||||||
'uppercased.CSV' => 'upper cased extension',
|
|
||||||
'multcased.CsV' => 'multiple cased extension',
|
|
||||||
'symmetric.csv' => 'symmetric data',
|
|
||||||
'asymmetric.csv' => 'asymmetric data',
|
|
||||||
'escape_ok.csv' => 'valid escape syntax file',
|
|
||||||
'escape_ok.csv' => 'valid escape syntax file',
|
|
||||||
'non_csv_extension.txt' => 'non csv-extension file',
|
|
||||||
),
|
|
||||||
'expected_headers' =>
|
|
||||||
array (
|
|
||||||
0 => 'COL_1',
|
|
||||||
1 => 'COL_2',
|
|
||||||
2 => 'COL_3',
|
|
||||||
3 => 'COL_4',
|
|
||||||
4 => 'COL_5',
|
|
||||||
),
|
|
||||||
'original_headers' =>
|
|
||||||
array (
|
|
||||||
0 => 'header_a',
|
|
||||||
1 => 'header_b',
|
|
||||||
2 => 'header_c',
|
|
||||||
3 => 'header_d',
|
|
||||||
4 => 'header_e',
|
|
||||||
),
|
|
||||||
'symmetric_connection' =>
|
|
||||||
array (
|
|
||||||
0 =>
|
|
||||||
array (
|
|
||||||
'header_a' => '1aa',
|
|
||||||
'header_b' => '1bb',
|
|
||||||
'header_c' => '1cc',
|
|
||||||
'header_d' => '1dd',
|
|
||||||
'header_e' => '1ee',
|
|
||||||
),
|
|
||||||
1 =>
|
|
||||||
array (
|
|
||||||
'header_a' => '2aa',
|
|
||||||
'header_b' => '2bb',
|
|
||||||
'header_c' => '2cc',
|
|
||||||
'header_d' => '2dd',
|
|
||||||
'header_e' => '2ee',
|
|
||||||
),
|
|
||||||
2 =>
|
|
||||||
array (
|
|
||||||
'header_a' => '3aa',
|
|
||||||
'header_b' => '3bb',
|
|
||||||
'header_c' => '3cc',
|
|
||||||
'header_d' => '3dd',
|
|
||||||
'header_e' => '3ee',
|
|
||||||
),
|
|
||||||
3 =>
|
|
||||||
array (
|
|
||||||
'header_a' => '4aa',
|
|
||||||
'header_b' => '4bb',
|
|
||||||
'header_c' => '4cc',
|
|
||||||
'header_d' => '4dd',
|
|
||||||
'header_e' => '4ee',
|
|
||||||
),
|
|
||||||
4 =>
|
|
||||||
array (
|
|
||||||
'header_a' => '5aa',
|
|
||||||
'header_b' => '5bb',
|
|
||||||
'header_c' => '5cc',
|
|
||||||
'header_d' => '5dd',
|
|
||||||
'header_e' => '5ee',
|
|
||||||
),
|
|
||||||
5 =>
|
|
||||||
array (
|
|
||||||
'header_a' => '6aa',
|
|
||||||
'header_b' => '6bb',
|
|
||||||
'header_c' => '6cc',
|
|
||||||
'header_d' => '6dd',
|
|
||||||
'header_e' => '6ee',
|
|
||||||
),
|
|
||||||
6 =>
|
|
||||||
array (
|
|
||||||
'header_a' => '7aa',
|
|
||||||
'header_b' => '7bb',
|
|
||||||
'header_c' => '7cc',
|
|
||||||
'header_d' => '7dd',
|
|
||||||
'header_e' => '7ee',
|
|
||||||
),
|
|
||||||
7 =>
|
|
||||||
array (
|
|
||||||
'header_a' => '8aa',
|
|
||||||
'header_b' => '8bb',
|
|
||||||
'header_c' => '8cc',
|
|
||||||
'header_d' => '8dd',
|
|
||||||
'header_e' => '8ee',
|
|
||||||
),
|
|
||||||
8 =>
|
|
||||||
array (
|
|
||||||
'header_a' => '9aa',
|
|
||||||
'header_b' => '9bb',
|
|
||||||
'header_c' => '9cc',
|
|
||||||
'header_d' => '9dd',
|
|
||||||
'header_e' => '9ee',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'asymmetric_rows' =>
|
|
||||||
array (
|
|
||||||
0 =>
|
|
||||||
array (
|
|
||||||
0 => '5aa',
|
|
||||||
1 => '5bb',
|
|
||||||
2 => '5cc',
|
|
||||||
3 => '5dd',
|
|
||||||
4 => '5ee',
|
|
||||||
5 => 'extra1',
|
|
||||||
),
|
|
||||||
1 =>
|
|
||||||
array (
|
|
||||||
0 => '8aa',
|
|
||||||
1 => '8bb',
|
|
||||||
2 => '8cc',
|
|
||||||
3 => '8dd',
|
|
||||||
4 => '8ee',
|
|
||||||
5 => 'extra2',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'empty_column' =>
|
|
||||||
array (
|
|
||||||
0 => '',
|
|
||||||
1 => '',
|
|
||||||
2 => '',
|
|
||||||
3 => '',
|
|
||||||
4 => '',
|
|
||||||
5 => '',
|
|
||||||
6 => '',
|
|
||||||
7 => '',
|
|
||||||
8 => '',
|
|
||||||
),
|
|
||||||
'expected_column' =>
|
|
||||||
array (
|
|
||||||
0 => '1cc',
|
|
||||||
1 => '2cc',
|
|
||||||
2 => '3cc',
|
|
||||||
3 => '4cc',
|
|
||||||
4 => '5cc',
|
|
||||||
5 => '6cc',
|
|
||||||
6 => '7cc',
|
|
||||||
7 => '8cc',
|
|
||||||
8 => '9cc',
|
|
||||||
),
|
|
||||||
'symmetric_rows_without_first_row' =>
|
|
||||||
array (
|
|
||||||
0 =>
|
|
||||||
array (
|
|
||||||
0 => '2aa',
|
|
||||||
1 => '2bb',
|
|
||||||
2 => '2cc',
|
|
||||||
3 => '2dd',
|
|
||||||
4 => '2ee',
|
|
||||||
),
|
|
||||||
1 =>
|
|
||||||
array (
|
|
||||||
0 => '3aa',
|
|
||||||
1 => '3bb',
|
|
||||||
2 => '3cc',
|
|
||||||
3 => '3dd',
|
|
||||||
4 => '3ee',
|
|
||||||
),
|
|
||||||
2 =>
|
|
||||||
array (
|
|
||||||
0 => '4aa',
|
|
||||||
1 => '4bb',
|
|
||||||
2 => '4cc',
|
|
||||||
3 => '4dd',
|
|
||||||
4 => '4ee',
|
|
||||||
),
|
|
||||||
3 =>
|
|
||||||
array (
|
|
||||||
0 => '5aa',
|
|
||||||
1 => '5bb',
|
|
||||||
2 => '5cc',
|
|
||||||
3 => '5dd',
|
|
||||||
4 => '5ee',
|
|
||||||
),
|
|
||||||
4 =>
|
|
||||||
array (
|
|
||||||
0 => '6aa',
|
|
||||||
1 => '6bb',
|
|
||||||
2 => '6cc',
|
|
||||||
3 => '6dd',
|
|
||||||
4 => '6ee',
|
|
||||||
),
|
|
||||||
5 =>
|
|
||||||
array (
|
|
||||||
0 => '7aa',
|
|
||||||
1 => '7bb',
|
|
||||||
2 => '7cc',
|
|
||||||
3 => '7dd',
|
|
||||||
4 => '7ee',
|
|
||||||
),
|
|
||||||
6 =>
|
|
||||||
array (
|
|
||||||
0 => '8aa',
|
|
||||||
1 => '8bb',
|
|
||||||
2 => '8cc',
|
|
||||||
3 => '8dd',
|
|
||||||
4 => '8ee',
|
|
||||||
),
|
|
||||||
7 =>
|
|
||||||
array (
|
|
||||||
0 => '9aa',
|
|
||||||
1 => '9bb',
|
|
||||||
2 => '9cc',
|
|
||||||
3 => '9dd',
|
|
||||||
4 => '9ee',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'symmetric_rows_without_third_row' =>
|
|
||||||
array (
|
|
||||||
0 =>
|
|
||||||
array (
|
|
||||||
0 => '1aa',
|
|
||||||
1 => '1bb',
|
|
||||||
2 => '1cc',
|
|
||||||
3 => '1dd',
|
|
||||||
4 => '1ee',
|
|
||||||
),
|
|
||||||
1 =>
|
|
||||||
array (
|
|
||||||
0 => '2aa',
|
|
||||||
1 => '2bb',
|
|
||||||
2 => '2cc',
|
|
||||||
3 => '2dd',
|
|
||||||
4 => '2ee',
|
|
||||||
),
|
|
||||||
2 =>
|
|
||||||
array (
|
|
||||||
0 => '4aa',
|
|
||||||
1 => '4bb',
|
|
||||||
2 => '4cc',
|
|
||||||
3 => '4dd',
|
|
||||||
4 => '4ee',
|
|
||||||
),
|
|
||||||
3 =>
|
|
||||||
array (
|
|
||||||
0 => '5aa',
|
|
||||||
1 => '5bb',
|
|
||||||
2 => '5cc',
|
|
||||||
3 => '5dd',
|
|
||||||
4 => '5ee',
|
|
||||||
),
|
|
||||||
4 =>
|
|
||||||
array (
|
|
||||||
0 => '6aa',
|
|
||||||
1 => '6bb',
|
|
||||||
2 => '6cc',
|
|
||||||
3 => '6dd',
|
|
||||||
4 => '6ee',
|
|
||||||
),
|
|
||||||
5 =>
|
|
||||||
array (
|
|
||||||
0 => '7aa',
|
|
||||||
1 => '7bb',
|
|
||||||
2 => '7cc',
|
|
||||||
3 => '7dd',
|
|
||||||
4 => '7ee',
|
|
||||||
),
|
|
||||||
6 =>
|
|
||||||
array (
|
|
||||||
0 => '8aa',
|
|
||||||
1 => '8bb',
|
|
||||||
2 => '8cc',
|
|
||||||
3 => '8dd',
|
|
||||||
4 => '8ee',
|
|
||||||
),
|
|
||||||
7 =>
|
|
||||||
array (
|
|
||||||
0 => '9aa',
|
|
||||||
1 => '9bb',
|
|
||||||
2 => '9cc',
|
|
||||||
3 => '9dd',
|
|
||||||
4 => '9ee',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'one_row_for_symmetric' => array (
|
|
||||||
0 => '10aa',
|
|
||||||
1 => '10bb',
|
|
||||||
2 => '10cc',
|
|
||||||
3 => '10dd',
|
|
||||||
4 => '10ee',
|
|
||||||
),
|
|
||||||
'symmetric_rows_plus_one' => // contains 'one_row_for_symmetric'
|
|
||||||
array (
|
|
||||||
0 =>
|
|
||||||
array (
|
|
||||||
0 => '1aa',
|
|
||||||
1 => '1bb',
|
|
||||||
2 => '1cc',
|
|
||||||
3 => '1dd',
|
|
||||||
4 => '1ee',
|
|
||||||
),
|
|
||||||
1 =>
|
|
||||||
array (
|
|
||||||
0 => '2aa',
|
|
||||||
1 => '2bb',
|
|
||||||
2 => '2cc',
|
|
||||||
3 => '2dd',
|
|
||||||
4 => '2ee',
|
|
||||||
),
|
|
||||||
2 =>
|
|
||||||
array (
|
|
||||||
0 => '3aa',
|
|
||||||
1 => '3bb',
|
|
||||||
2 => '3cc',
|
|
||||||
3 => '3dd',
|
|
||||||
4 => '3ee',
|
|
||||||
),
|
|
||||||
3 =>
|
|
||||||
array (
|
|
||||||
0 => '4aa',
|
|
||||||
1 => '4bb',
|
|
||||||
2 => '4cc',
|
|
||||||
3 => '4dd',
|
|
||||||
4 => '4ee',
|
|
||||||
),
|
|
||||||
4 =>
|
|
||||||
array (
|
|
||||||
0 => '5aa',
|
|
||||||
1 => '5bb',
|
|
||||||
2 => '5cc',
|
|
||||||
3 => '5dd',
|
|
||||||
4 => '5ee',
|
|
||||||
),
|
|
||||||
5 =>
|
|
||||||
array (
|
|
||||||
0 => '6aa',
|
|
||||||
1 => '6bb',
|
|
||||||
2 => '6cc',
|
|
||||||
3 => '6dd',
|
|
||||||
4 => '6ee',
|
|
||||||
),
|
|
||||||
6 =>
|
|
||||||
array (
|
|
||||||
0 => '7aa',
|
|
||||||
1 => '7bb',
|
|
||||||
2 => '7cc',
|
|
||||||
3 => '7dd',
|
|
||||||
4 => '7ee',
|
|
||||||
),
|
|
||||||
7 =>
|
|
||||||
array (
|
|
||||||
0 => '8aa',
|
|
||||||
1 => '8bb',
|
|
||||||
2 => '8cc',
|
|
||||||
3 => '8dd',
|
|
||||||
4 => '8ee',
|
|
||||||
),
|
|
||||||
8 =>
|
|
||||||
array (
|
|
||||||
0 => '9aa',
|
|
||||||
1 => '9bb',
|
|
||||||
2 => '9cc',
|
|
||||||
3 => '9dd',
|
|
||||||
4 => '9ee',
|
|
||||||
),
|
|
||||||
9 =>
|
|
||||||
array (
|
|
||||||
0 => '10aa',
|
|
||||||
1 => '10bb',
|
|
||||||
2 => '10cc',
|
|
||||||
3 => '10dd',
|
|
||||||
4 => '10ee',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'symmetric_rows_empty' =>
|
|
||||||
array (
|
|
||||||
0 =>
|
|
||||||
array (
|
|
||||||
0 => '',
|
|
||||||
1 => '',
|
|
||||||
2 => '',
|
|
||||||
3 => '',
|
|
||||||
4 => '',
|
|
||||||
),
|
|
||||||
1 =>
|
|
||||||
array (
|
|
||||||
0 => '',
|
|
||||||
1 => '',
|
|
||||||
2 => '',
|
|
||||||
3 => '',
|
|
||||||
4 => '',
|
|
||||||
),
|
|
||||||
2 =>
|
|
||||||
array (
|
|
||||||
0 => '',
|
|
||||||
1 => '',
|
|
||||||
2 => '',
|
|
||||||
3 => '',
|
|
||||||
4 => '',
|
|
||||||
),
|
|
||||||
3 =>
|
|
||||||
array (
|
|
||||||
0 => '',
|
|
||||||
1 => '',
|
|
||||||
2 => '',
|
|
||||||
3 => '',
|
|
||||||
4 => '',
|
|
||||||
),
|
|
||||||
4 =>
|
|
||||||
array (
|
|
||||||
0 => '',
|
|
||||||
1 => '',
|
|
||||||
2 => '',
|
|
||||||
3 => '',
|
|
||||||
4 => '',
|
|
||||||
),
|
|
||||||
5 =>
|
|
||||||
array (
|
|
||||||
0 => '',
|
|
||||||
1 => '',
|
|
||||||
2 => '',
|
|
||||||
3 => '',
|
|
||||||
4 => '',
|
|
||||||
),
|
|
||||||
6 =>
|
|
||||||
array (
|
|
||||||
0 => '',
|
|
||||||
1 => '',
|
|
||||||
2 => '',
|
|
||||||
3 => '',
|
|
||||||
4 => '',
|
|
||||||
),
|
|
||||||
7 =>
|
|
||||||
array (
|
|
||||||
0 => '',
|
|
||||||
1 => '',
|
|
||||||
2 => '',
|
|
||||||
3 => '',
|
|
||||||
4 => '',
|
|
||||||
),
|
|
||||||
8 =>
|
|
||||||
array (
|
|
||||||
0 => '',
|
|
||||||
1 => '',
|
|
||||||
2 => '',
|
|
||||||
3 => '',
|
|
||||||
4 => '',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'symmetric_rows' =>
|
|
||||||
array (
|
|
||||||
0 =>
|
|
||||||
array (
|
|
||||||
0 => '1aa',
|
|
||||||
1 => '1bb',
|
|
||||||
2 => '1cc',
|
|
||||||
3 => '1dd',
|
|
||||||
4 => '1ee',
|
|
||||||
),
|
|
||||||
1 =>
|
|
||||||
array (
|
|
||||||
0 => '2aa',
|
|
||||||
1 => '2bb',
|
|
||||||
2 => '2cc',
|
|
||||||
3 => '2dd',
|
|
||||||
4 => '2ee',
|
|
||||||
),
|
|
||||||
2 =>
|
|
||||||
array (
|
|
||||||
0 => '3aa',
|
|
||||||
1 => '3bb',
|
|
||||||
2 => '3cc',
|
|
||||||
3 => '3dd',
|
|
||||||
4 => '3ee',
|
|
||||||
),
|
|
||||||
3 =>
|
|
||||||
array (
|
|
||||||
0 => '4aa',
|
|
||||||
1 => '4bb',
|
|
||||||
2 => '4cc',
|
|
||||||
3 => '4dd',
|
|
||||||
4 => '4ee',
|
|
||||||
),
|
|
||||||
4 =>
|
|
||||||
array (
|
|
||||||
0 => '5aa',
|
|
||||||
1 => '5bb',
|
|
||||||
2 => '5cc',
|
|
||||||
3 => '5dd',
|
|
||||||
4 => '5ee',
|
|
||||||
),
|
|
||||||
5 =>
|
|
||||||
array (
|
|
||||||
0 => '6aa',
|
|
||||||
1 => '6bb',
|
|
||||||
2 => '6cc',
|
|
||||||
3 => '6dd',
|
|
||||||
4 => '6ee',
|
|
||||||
),
|
|
||||||
6 =>
|
|
||||||
array (
|
|
||||||
0 => '7aa',
|
|
||||||
1 => '7bb',
|
|
||||||
2 => '7cc',
|
|
||||||
3 => '7dd',
|
|
||||||
4 => '7ee',
|
|
||||||
),
|
|
||||||
7 =>
|
|
||||||
array (
|
|
||||||
0 => '8aa',
|
|
||||||
1 => '8bb',
|
|
||||||
2 => '8cc',
|
|
||||||
3 => '8dd',
|
|
||||||
4 => '8ee',
|
|
||||||
),
|
|
||||||
8 =>
|
|
||||||
array (
|
|
||||||
0 => '9aa',
|
|
||||||
1 => '9bb',
|
|
||||||
2 => '9cc',
|
|
||||||
3 => '9dd',
|
|
||||||
4 => '9ee',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'symmetric_raw_data' =>
|
|
||||||
array (
|
|
||||||
0 =>
|
|
||||||
array (
|
|
||||||
0 => 'header_a',
|
|
||||||
1 => 'header_b',
|
|
||||||
2 => 'header_c',
|
|
||||||
3 => 'header_d',
|
|
||||||
4 => 'header_e',
|
|
||||||
),
|
|
||||||
1 =>
|
|
||||||
array (
|
|
||||||
0 => '1aa',
|
|
||||||
1 => '1bb',
|
|
||||||
2 => '1cc',
|
|
||||||
3 => '1dd',
|
|
||||||
4 => '1ee',
|
|
||||||
),
|
|
||||||
2 =>
|
|
||||||
array (
|
|
||||||
0 => '2aa',
|
|
||||||
1 => '2bb',
|
|
||||||
2 => '2cc',
|
|
||||||
3 => '2dd',
|
|
||||||
4 => '2ee',
|
|
||||||
),
|
|
||||||
3 =>
|
|
||||||
array (
|
|
||||||
0 => '3aa',
|
|
||||||
1 => '3bb',
|
|
||||||
2 => '3cc',
|
|
||||||
3 => '3dd',
|
|
||||||
4 => '3ee',
|
|
||||||
),
|
|
||||||
4 =>
|
|
||||||
array (
|
|
||||||
0 => '4aa',
|
|
||||||
1 => '4bb',
|
|
||||||
2 => '4cc',
|
|
||||||
3 => '4dd',
|
|
||||||
4 => '4ee',
|
|
||||||
),
|
|
||||||
5 =>
|
|
||||||
array (
|
|
||||||
0 => '5aa',
|
|
||||||
1 => '5bb',
|
|
||||||
2 => '5cc',
|
|
||||||
3 => '5dd',
|
|
||||||
4 => '5ee',
|
|
||||||
),
|
|
||||||
6 =>
|
|
||||||
array (
|
|
||||||
0 => '6aa',
|
|
||||||
1 => '6bb',
|
|
||||||
2 => '6cc',
|
|
||||||
3 => '6dd',
|
|
||||||
4 => '6ee',
|
|
||||||
),
|
|
||||||
7 =>
|
|
||||||
array (
|
|
||||||
0 => '7aa',
|
|
||||||
1 => '7bb',
|
|
||||||
2 => '7cc',
|
|
||||||
3 => '7dd',
|
|
||||||
4 => '7ee',
|
|
||||||
),
|
|
||||||
8 =>
|
|
||||||
array (
|
|
||||||
0 => '8aa',
|
|
||||||
1 => '8bb',
|
|
||||||
2 => '8cc',
|
|
||||||
3 => '8dd',
|
|
||||||
4 => '8ee',
|
|
||||||
),
|
|
||||||
9 =>
|
|
||||||
array (
|
|
||||||
0 => '9aa',
|
|
||||||
1 => '9bb',
|
|
||||||
2 => '9cc',
|
|
||||||
3 => '9dd',
|
|
||||||
4 => '9ee',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'expected_raw' =>
|
|
||||||
array (
|
|
||||||
0 =>
|
|
||||||
array (
|
|
||||||
0 => 'h_one',
|
|
||||||
1 => 'h_two',
|
|
||||||
2 => 'h_three',
|
|
||||||
),
|
|
||||||
1 =>
|
|
||||||
array (
|
|
||||||
0 => 'v_1one',
|
|
||||||
1 => 'v_1two',
|
|
||||||
2 => 'v_1three',
|
|
||||||
),
|
|
||||||
2 =>
|
|
||||||
array (
|
|
||||||
0 => 'v_2one',
|
|
||||||
1 => 'v_2two',
|
|
||||||
2 => 'v_2three',
|
|
||||||
),
|
|
||||||
3 =>
|
|
||||||
array (
|
|
||||||
0 => 'v_3one',
|
|
||||||
1 => 'v_3two',
|
|
||||||
2 => 'v_3three',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'expected_escaped' =>
|
|
||||||
array (
|
|
||||||
0 =>
|
|
||||||
array (
|
|
||||||
'one' => 'thie,',
|
|
||||||
'two' => 'adn',
|
|
||||||
'three' => 'thei',
|
|
||||||
),
|
|
||||||
1 =>
|
|
||||||
array (
|
|
||||||
'one' => 'thie',
|
|
||||||
'two' => 'adn',
|
|
||||||
'three' => 'thei',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'header_a_connection' =>
|
|
||||||
array (
|
|
||||||
0 =>
|
|
||||||
array (
|
|
||||||
'header_a' => '1aa',
|
|
||||||
),
|
|
||||||
1 =>
|
|
||||||
array (
|
|
||||||
'header_a' => '2aa',
|
|
||||||
),
|
|
||||||
2 =>
|
|
||||||
array (
|
|
||||||
'header_a' => '3aa',
|
|
||||||
),
|
|
||||||
3 =>
|
|
||||||
array (
|
|
||||||
'header_a' => '4aa',
|
|
||||||
),
|
|
||||||
4 =>
|
|
||||||
array (
|
|
||||||
'header_a' => '5aa',
|
|
||||||
),
|
|
||||||
5 =>
|
|
||||||
array (
|
|
||||||
'header_a' => '6aa',
|
|
||||||
),
|
|
||||||
6 =>
|
|
||||||
array (
|
|
||||||
'header_a' => '7aa',
|
|
||||||
),
|
|
||||||
7 =>
|
|
||||||
array (
|
|
||||||
'header_a' => '8aa',
|
|
||||||
),
|
|
||||||
8 =>
|
|
||||||
array (
|
|
||||||
'header_a' => '9aa',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'symmetric_queries' =>
|
|
||||||
array (
|
|
||||||
0 => 'INSERT INTO test_table (header_a, header_b, header_c, header_d, header_e) VALUES (\'1aa\', \'1bb\', \'1cc\', \'1dd\', \'1ee\')',
|
|
||||||
1 => 'INSERT INTO test_table (header_a, header_b, header_c, header_d, header_e) VALUES (\'2aa\', \'2bb\', \'2cc\', \'2dd\', \'2ee\')',
|
|
||||||
2 => 'INSERT INTO test_table (header_a, header_b, header_c, header_d, header_e) VALUES (\'3aa\', \'3bb\', \'3cc\', \'3dd\', \'3ee\')',
|
|
||||||
3 => 'INSERT INTO test_table (header_a, header_b, header_c, header_d, header_e) VALUES (\'4aa\', \'4bb\', \'4cc\', \'4dd\', \'4ee\')',
|
|
||||||
4 => 'INSERT INTO test_table (header_a, header_b, header_c, header_d, header_e) VALUES (\'5aa\', \'5bb\', \'5cc\', \'5dd\', \'5ee\')',
|
|
||||||
5 => 'INSERT INTO test_table (header_a, header_b, header_c, header_d, header_e) VALUES (\'6aa\', \'6bb\', \'6cc\', \'6dd\', \'6ee\')',
|
|
||||||
6 => 'INSERT INTO test_table (header_a, header_b, header_c, header_d, header_e) VALUES (\'7aa\', \'7bb\', \'7cc\', \'7dd\', \'7ee\')',
|
|
||||||
7 => 'INSERT INTO test_table (header_a, header_b, header_c, header_d, header_e) VALUES (\'8aa\', \'8bb\', \'8cc\', \'8dd\', \'8ee\')',
|
|
||||||
8 => 'INSERT INTO test_table (header_a, header_b, header_c, header_d, header_e) VALUES (\'9aa\', \'9bb\', \'9cc\', \'9dd\', \'9ee\')',
|
|
||||||
),
|
|
||||||
'alternated_header_queries' =>
|
|
||||||
array (
|
|
||||||
0 => 'INSERT INTO test_table (header_a, header_c) VALUES (\'1aa\', \'1cc\')',
|
|
||||||
1 => 'INSERT INTO test_table (header_a, header_c) VALUES (\'2aa\', \'2cc\')',
|
|
||||||
2 => 'INSERT INTO test_table (header_a, header_c) VALUES (\'3aa\', \'3cc\')',
|
|
||||||
3 => 'INSERT INTO test_table (header_a, header_c) VALUES (\'4aa\', \'4cc\')',
|
|
||||||
4 => 'INSERT INTO test_table (header_a, header_c) VALUES (\'5aa\', \'5cc\')',
|
|
||||||
5 => 'INSERT INTO test_table (header_a, header_c) VALUES (\'6aa\', \'6cc\')',
|
|
||||||
6 => 'INSERT INTO test_table (header_a, header_c) VALUES (\'7aa\', \'7cc\')',
|
|
||||||
7 => 'INSERT INTO test_table (header_a, header_c) VALUES (\'8aa\', \'8cc\')',
|
|
||||||
8 => 'INSERT INTO test_table (header_a, header_c) VALUES (\'9aa\', \'9cc\')',
|
|
||||||
),
|
|
||||||
'symmetric_range_of_rows' =>
|
|
||||||
array (
|
|
||||||
0 =>
|
|
||||||
array (
|
|
||||||
0 => '2aa',
|
|
||||||
1 => '2bb',
|
|
||||||
2 => '2cc',
|
|
||||||
3 => '2dd',
|
|
||||||
4 => '2ee',
|
|
||||||
),
|
|
||||||
1 =>
|
|
||||||
array (
|
|
||||||
0 => '3aa',
|
|
||||||
1 => '3bb',
|
|
||||||
2 => '3cc',
|
|
||||||
3 => '3dd',
|
|
||||||
4 => '3ee',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'longer_headers' =>
|
|
||||||
array (
|
|
||||||
0 =>
|
|
||||||
array (
|
|
||||||
'one' => '1',
|
|
||||||
'two' => '2',
|
|
||||||
'three' => '3',
|
|
||||||
'four' => '',
|
|
||||||
'five' => '',
|
|
||||||
'six' => '',
|
|
||||||
),
|
|
||||||
1 =>
|
|
||||||
array (
|
|
||||||
'one' => '1',
|
|
||||||
'two' => '2',
|
|
||||||
'three' => '3',
|
|
||||||
'four' => '4',
|
|
||||||
'five' => '',
|
|
||||||
'six' => '',
|
|
||||||
),
|
|
||||||
2 =>
|
|
||||||
array (
|
|
||||||
'one' => '',
|
|
||||||
'two' => '2',
|
|
||||||
'three' => '3',
|
|
||||||
'four' => '4',
|
|
||||||
'five' => '',
|
|
||||||
'six' => '',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
);
|
|
||||||
|
|
||||||
function fix($key) {
|
|
||||||
global $fixtures;
|
|
||||||
if (!array_key_exists($key, $fixtures)) {
|
|
||||||
throw new Exception("Fixture not found: '$key' ");
|
|
||||||
}
|
|
||||||
return $fixtures[$key];
|
|
||||||
}
|
|
||||||
|
|
||||||
function path($file)
|
|
||||||
{
|
|
||||||
return 'File/CSV/tests/data/' . $file;
|
|
||||||
}
|
|
||||||
|
|
||||||
function callback($value)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
function callback2($value)
|
|
||||||
{
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
@ -1,21 +0,0 @@
|
|||||||
The MIT License
|
|
||||||
|
|
||||||
Copyright (c) <2009> <Denis Kobozev>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
* Add an option to the GUI for specifying a delimiter other than a comma
|
|
||||||
* Add column for importing post thumbnails
|
|
||||||
* Add a column for page templates
|
|
||||||
* Create users if they don't exist (as an option)
|
|
||||||
* Add support for unix timestamp dates
|
|
||||||
* Add support for category descriptions
|
|
||||||
@ -1,542 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
Plugin Name: CSV Importer
|
|
||||||
Description: Import data as posts from a CSV file. <em>You can reach the author at <a href="mailto:d.v.kobozev@gmail.com">d.v.kobozev@gmail.com</a></em>.
|
|
||||||
Version: 0.3.6
|
|
||||||
Author: Denis Kobozev
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* LICENSE: The MIT License {{{
|
|
||||||
*
|
|
||||||
* Copyright (c) <2009> <Denis Kobozev>
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*
|
|
||||||
* @author Denis Kobozev <d.v.kobozev@gmail.com>
|
|
||||||
* @copyright 2009 Denis Kobozev
|
|
||||||
* @license The MIT License
|
|
||||||
* }}}
|
|
||||||
*/
|
|
||||||
|
|
||||||
class CSVImporterException extends Exception {}
|
|
||||||
|
|
||||||
class CSVImporterPlugin {
|
|
||||||
var $defaults = array(
|
|
||||||
'csv_post_title' => null,
|
|
||||||
'csv_post_post' => null,
|
|
||||||
'csv_post_type' => null,
|
|
||||||
'csv_post_excerpt' => null,
|
|
||||||
'csv_post_date' => null,
|
|
||||||
'csv_post_tags' => null,
|
|
||||||
'csv_post_categories' => null,
|
|
||||||
'csv_post_author' => null,
|
|
||||||
'csv_post_slug' => null,
|
|
||||||
'csv_post_parent' => 0,
|
|
||||||
);
|
|
||||||
|
|
||||||
var $log = array();
|
|
||||||
|
|
||||||
// determine value of option $name from database, $default value or $params,
|
|
||||||
// save it to the db if needed and return it
|
|
||||||
function process_option($name, $default, $params) {
|
|
||||||
if (array_key_exists($name, $params)) {
|
|
||||||
$value = stripslashes($params[$name]);
|
|
||||||
} elseif (array_key_exists('_'.$name, $params)) {
|
|
||||||
// unchecked checkbox value
|
|
||||||
$value = stripslashes($params['_'.$name]);
|
|
||||||
} else {
|
|
||||||
$value = null;
|
|
||||||
}
|
|
||||||
$stored_value = get_option($name);
|
|
||||||
if ($value == null) {
|
|
||||||
if ($stored_value === false) {
|
|
||||||
if (is_callable($default) &&
|
|
||||||
method_exists($default[0], $default[1])) {
|
|
||||||
$value = call_user_func($default);
|
|
||||||
} else {
|
|
||||||
$value = $default;
|
|
||||||
}
|
|
||||||
add_option($name, $value);
|
|
||||||
} else {
|
|
||||||
$value = $stored_value;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ($stored_value === false) {
|
|
||||||
add_option($name, $value);
|
|
||||||
} elseif ($stored_value != $value) {
|
|
||||||
update_option($name, $value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Plugin's interface
|
|
||||||
function form() {
|
|
||||||
$opt_draft = $this->process_option('csv_importer_import_as_draft',
|
|
||||||
'publish', $_POST);
|
|
||||||
$opt_cat = $this->process_option('csv_importer_cat', 0, $_POST);
|
|
||||||
|
|
||||||
if ('POST' == $_SERVER['REQUEST_METHOD']) {
|
|
||||||
$this->post(compact('opt_draft', 'opt_cat'));
|
|
||||||
}
|
|
||||||
|
|
||||||
// form HTML {{{
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class="wrap">
|
|
||||||
<h2>Import CSV</h2>
|
|
||||||
<form class="add:the-list: validate" method="post" enctype="multipart/form-data">
|
|
||||||
<!-- Import as draft -->
|
|
||||||
<p>
|
|
||||||
<input name="_csv_importer_import_as_draft" type="hidden" value="publish" />
|
|
||||||
<label><input name="csv_importer_import_as_draft" type="checkbox" <?php if ('draft' == $opt_draft) { echo 'checked="checked"'; } ?> value="draft" /> Import posts as drafts</label>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<!-- Parent category -->
|
|
||||||
<p>Organize into category <?php wp_dropdown_categories(array('show_option_all' => 'Select one ...', 'hide_empty' => 0, 'hierarchical' => 1, 'show_count' => 0, 'name' => 'csv_importer_cat', 'orderby' => 'name', 'selected' => $opt_cat));?><br/>
|
|
||||||
<small>This will create new categories inside the category parent you choose.</small></p>
|
|
||||||
|
|
||||||
<!-- File input -->
|
|
||||||
<p><label for="csv_import">Upload file:</label><br/>
|
|
||||||
<input name="csv_import" id="csv_import" type="file" value="" aria-required="true" /></p>
|
|
||||||
<p class="submit"><input type="submit" class="button" name="submit" value="Import" /></p>
|
|
||||||
</form>
|
|
||||||
</div><!-- end wrap -->
|
|
||||||
|
|
||||||
<?php
|
|
||||||
// end form HTML }}}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function print_messages() {
|
|
||||||
if (!empty($this->log)) {
|
|
||||||
|
|
||||||
// messages HTML {{{
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class="wrap">
|
|
||||||
<?php if (!empty($this->log['error'])): ?>
|
|
||||||
|
|
||||||
<div class="error">
|
|
||||||
|
|
||||||
<?php foreach ($this->log['error'] as $error): ?>
|
|
||||||
<p><?php echo $error; ?></p>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php if (!empty($this->log['notice'])): ?>
|
|
||||||
|
|
||||||
<div class="updated fade">
|
|
||||||
|
|
||||||
<?php foreach ($this->log['notice'] as $notice): ?>
|
|
||||||
<p><?php echo $notice; ?></p>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php endif; ?>
|
|
||||||
</div><!-- end wrap -->
|
|
||||||
|
|
||||||
<?php
|
|
||||||
// end messages HTML }}}
|
|
||||||
|
|
||||||
$this->log = array();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle POST submission
|
|
||||||
function post($options) {
|
|
||||||
if (empty($_FILES['csv_import']['tmp_name'])) {
|
|
||||||
$this->log['error'][] = 'No file uploaded, aborting.';
|
|
||||||
$this->print_messages();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once 'File_CSV_DataSource/DataSource.php';
|
|
||||||
|
|
||||||
$time_start = microtime(true);
|
|
||||||
$csv = new File_CSV_DataSource;
|
|
||||||
$file = $_FILES['csv_import']['tmp_name'];
|
|
||||||
$this->stripBOM($file);
|
|
||||||
|
|
||||||
if (!$csv->load($file)) {
|
|
||||||
$this->log['error'][] = 'Failed to load file, aborting.';
|
|
||||||
$this->print_messages();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// pad shorter rows with empty values
|
|
||||||
$csv->symmetrize();
|
|
||||||
|
|
||||||
// WordPress sets the correct timezone for date functions somewhere
|
|
||||||
// in the bowels of wp_insert_post(). We need strtotime() to return
|
|
||||||
// correct time before the call to wp_insert_post().
|
|
||||||
$tz = get_option('timezone_string');
|
|
||||||
if ($tz && function_exists('date_default_timezone_set')) {
|
|
||||||
date_default_timezone_set($tz);
|
|
||||||
}
|
|
||||||
|
|
||||||
$skipped = 0;
|
|
||||||
$imported = 0;
|
|
||||||
$comments = 0;
|
|
||||||
foreach ($csv->connect() as $csv_data) {
|
|
||||||
if ($post_id = $this->create_post($csv_data, $options)) {
|
|
||||||
$imported++;
|
|
||||||
$comments += $this->add_comments($post_id, $csv_data);
|
|
||||||
$this->create_custom_fields($post_id, $csv_data);
|
|
||||||
} else {
|
|
||||||
$skipped++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file_exists($file)) {
|
|
||||||
@unlink($file);
|
|
||||||
}
|
|
||||||
|
|
||||||
$exec_time = microtime(true) - $time_start;
|
|
||||||
|
|
||||||
if ($skipped) {
|
|
||||||
$this->log['notice'][] = "<b>Skipped {$skipped} posts (most likely due to empty title, body and excerpt).</b>";
|
|
||||||
}
|
|
||||||
$this->log['notice'][] = sprintf("<b>Imported {$imported} posts and {$comments} comments in %.2f seconds.</b>", $exec_time);
|
|
||||||
$this->print_messages();
|
|
||||||
}
|
|
||||||
|
|
||||||
function create_post($data, $options) {
|
|
||||||
extract($options);
|
|
||||||
|
|
||||||
$data = array_merge($this->defaults, $data);
|
|
||||||
$type = $data['csv_post_type'] ? $data['csv_post_type'] : 'post';
|
|
||||||
$valid_type = (function_exists('post_type_exists') &&
|
|
||||||
post_type_exists($type)) || in_array($type, array('post', 'page'));
|
|
||||||
|
|
||||||
if (!$valid_type) {
|
|
||||||
$this->log['error']["type-{$type}"] = sprintf(
|
|
||||||
'Unknown post type "%s".', $type);
|
|
||||||
}
|
|
||||||
|
|
||||||
$new_post = array(
|
|
||||||
'post_title' => convert_chars($data['csv_post_title']),
|
|
||||||
'post_content' => wpautop(convert_chars($data['csv_post_post'])),
|
|
||||||
'post_status' => $opt_draft,
|
|
||||||
'post_type' => $type,
|
|
||||||
'post_date' => $this->parse_date($data['csv_post_date']),
|
|
||||||
'post_excerpt' => convert_chars($data['csv_post_excerpt']),
|
|
||||||
'post_name' => $data['csv_post_slug'],
|
|
||||||
'post_author' => $this->get_auth_id($data['csv_post_author']),
|
|
||||||
'tax_input' => $this->get_taxonomies($data),
|
|
||||||
'post_parent' => $data['csv_post_parent'],
|
|
||||||
);
|
|
||||||
|
|
||||||
// pages don't have tags or categories
|
|
||||||
if ('page' !== $type) {
|
|
||||||
$new_post['tags_input'] = $data['csv_post_tags'];
|
|
||||||
|
|
||||||
// Setup categories before inserting - this should make insertion
|
|
||||||
// faster, but I don't exactly remember why :) Most likely because
|
|
||||||
// we don't assign default cat to post when csv_post_categories
|
|
||||||
// is not empty.
|
|
||||||
$cats = $this->create_or_get_categories($data, $opt_cat);
|
|
||||||
$new_post['post_category'] = $cats['post'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// create!
|
|
||||||
$id = wp_insert_post($new_post);
|
|
||||||
|
|
||||||
if ('page' !== $type && !$id) {
|
|
||||||
// cleanup new categories on failure
|
|
||||||
foreach ($cats['cleanup'] as $c) {
|
|
||||||
wp_delete_term($c, 'category');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return an array of category ids for a post.
|
|
||||||
*
|
|
||||||
* @param string $data csv_post_categories cell contents
|
|
||||||
* @param integer $common_parent_id common parent id for all categories
|
|
||||||
*
|
|
||||||
* @return array() category ids
|
|
||||||
*/
|
|
||||||
function create_or_get_categories($data, $common_parent_id) {
|
|
||||||
$ids = array(
|
|
||||||
'post' => array(),
|
|
||||||
'cleanup' => array(),
|
|
||||||
);
|
|
||||||
$items = array_map('trim', explode(',', $data['csv_post_categories']));
|
|
||||||
foreach ($items as $item) {
|
|
||||||
if (is_numeric($item)) {
|
|
||||||
if (get_category($item) !== null) {
|
|
||||||
$ids['post'][] = $item;
|
|
||||||
} else {
|
|
||||||
$this->log['error'][] = "Category ID {$item} does not exist, skipping.";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$parent_id = $common_parent_id;
|
|
||||||
// item can be a single category name or a string such as
|
|
||||||
// Parent > Child > Grandchild
|
|
||||||
$categories = array_map('trim', explode('>', $item));
|
|
||||||
if (count($categories) > 1 && is_numeric($categories[0])) {
|
|
||||||
$parent_id = $categories[0];
|
|
||||||
if (get_category($parent_id) !== null) {
|
|
||||||
// valid id, everything's ok
|
|
||||||
$categories = array_slice($categories, 1);
|
|
||||||
} else {
|
|
||||||
$this->log['error'][] = "Category ID {$parent_id} does not exist, skipping.";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach ($categories as $category) {
|
|
||||||
if ($category) {
|
|
||||||
$term = is_term($category, 'category', $parent_id);
|
|
||||||
if ($term) {
|
|
||||||
$term_id = $term['term_id'];
|
|
||||||
} else {
|
|
||||||
$term_id = wp_insert_category(array(
|
|
||||||
'cat_name' => $category,
|
|
||||||
'category_parent' => $parent_id,
|
|
||||||
));
|
|
||||||
$ids['cleanup'][] = $term_id;
|
|
||||||
}
|
|
||||||
$parent_id = $term_id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$ids['post'][] = $term_id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse taxonomy data from the file
|
|
||||||
//
|
|
||||||
// array(
|
|
||||||
// // hierarchical taxonomy name => ID array
|
|
||||||
// 'my taxonomy 1' => array(1, 2, 3, ...),
|
|
||||||
// // non-hierarchical taxonomy name => term names string
|
|
||||||
// 'my taxonomy 2' => array('term1', 'term2', ...),
|
|
||||||
// )
|
|
||||||
function get_taxonomies($data) {
|
|
||||||
$taxonomies = array();
|
|
||||||
foreach ($data as $k => $v) {
|
|
||||||
if (preg_match('/^csv_ctax_(.*)$/', $k, $matches)) {
|
|
||||||
$t_name = $matches[1];
|
|
||||||
if (is_taxonomy($t_name)) {
|
|
||||||
$taxonomies[$t_name] = $this->create_terms($t_name,
|
|
||||||
$data[$k]);
|
|
||||||
} else {
|
|
||||||
$this->log['error'][] = "Unknown taxonomy $t_name";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $taxonomies;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return an array of term IDs for hierarchical taxonomies or the original
|
|
||||||
// string from CSV for non-hierarchical taxonomies. The original string
|
|
||||||
// should have the same format as csv_post_tags.
|
|
||||||
function create_terms($taxonomy, $field) {
|
|
||||||
if (is_taxonomy_hierarchical($taxonomy)) {
|
|
||||||
$term_ids = array();
|
|
||||||
foreach ($this->_parse_tax($field) as $row) {
|
|
||||||
list($parent, $child) = $row;
|
|
||||||
$parent_ok = true;
|
|
||||||
if ($parent) {
|
|
||||||
$parent_info = is_term($parent, $taxonomy);
|
|
||||||
if (!$parent_info) {
|
|
||||||
// create parent
|
|
||||||
$parent_info = wp_insert_term($parent, $taxonomy);
|
|
||||||
}
|
|
||||||
if (!is_wp_error($parent_info)) {
|
|
||||||
$parent_id = $parent_info['term_id'];
|
|
||||||
} else {
|
|
||||||
// could not find or create parent
|
|
||||||
$parent_ok = false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$parent_id = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($parent_ok) {
|
|
||||||
$child_info = is_term($child, $taxonomy, $parent_id);
|
|
||||||
if (!$child_info) {
|
|
||||||
// create child
|
|
||||||
$child_info = wp_insert_term($child, $taxonomy,
|
|
||||||
array('parent' => $parent_id));
|
|
||||||
}
|
|
||||||
if (!is_wp_error($child_info)) {
|
|
||||||
$term_ids[] = $child_info['term_id'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $term_ids;
|
|
||||||
} else {
|
|
||||||
return $field;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// hierarchical taxonomy fields are tiny CSV files in their own right
|
|
||||||
function _parse_tax($field) {
|
|
||||||
$data = array();
|
|
||||||
if (function_exists('str_getcsv')) { // PHP 5 >= 5.3.0
|
|
||||||
$lines = explode("\n", $field);
|
|
||||||
|
|
||||||
foreach ($lines as $line) {
|
|
||||||
$data[] = str_getcsv($line, ',', '"');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Use temp files for older PHP versions. Reusing the tmp file for
|
|
||||||
// the duration of the script might be faster, but not necessarily
|
|
||||||
// significant.
|
|
||||||
$handle = tmpfile();
|
|
||||||
fwrite($handle, $field);
|
|
||||||
fseek($handle, 0);
|
|
||||||
|
|
||||||
while (($r = fgetcsv($handle, 999999, ',', '"')) !== false) {
|
|
||||||
$data[] = $r;
|
|
||||||
}
|
|
||||||
fclose($handle);
|
|
||||||
}
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
function add_comments($post_id, $data) {
|
|
||||||
// First get a list of the comments for this post
|
|
||||||
$comments = array();
|
|
||||||
foreach ($data as $k => $v) {
|
|
||||||
// comments start with cvs_comment_
|
|
||||||
if ( preg_match('/^csv_comment_([^_]+)_(.*)/', $k, $matches) &&
|
|
||||||
$v != '') {
|
|
||||||
$comments[$matches[1]] = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Sort this list which specifies the order they are inserted, in case
|
|
||||||
// that matters somewhere
|
|
||||||
ksort($comments);
|
|
||||||
|
|
||||||
// Now go through each comment and insert it. More fields are possible
|
|
||||||
// in principle (see docu of wp_insert_comment), but I didn't have data
|
|
||||||
// for them so I didn't test them, so I didn't include them.
|
|
||||||
$count = 0;
|
|
||||||
foreach ($comments as $cid => $v) {
|
|
||||||
$new_comment = array(
|
|
||||||
'comment_post_ID' => $post_id,
|
|
||||||
'comment_approved' => 1,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (isset($data["csv_comment_{$cid}_author"])) {
|
|
||||||
$new_comment['comment_author'] = convert_chars(
|
|
||||||
$data["csv_comment_{$cid}_author"]);
|
|
||||||
}
|
|
||||||
if (isset($data["csv_comment_{$cid}_author_email"])) {
|
|
||||||
$new_comment['comment_author_email'] = convert_chars(
|
|
||||||
$data["csv_comment_{$cid}_author_email"]);
|
|
||||||
}
|
|
||||||
if (isset($data["csv_comment_{$cid}_url"])) {
|
|
||||||
$new_comment['comment_author_url'] = convert_chars(
|
|
||||||
$data["csv_comment_{$cid}_url"]);
|
|
||||||
}
|
|
||||||
if (isset($data["csv_comment_{$cid}_content"])) {
|
|
||||||
$new_comment['comment_content'] = convert_chars(
|
|
||||||
$data["csv_comment_{$cid}_content"]);
|
|
||||||
}
|
|
||||||
if (isset($data["csv_comment_{$cid}_date"])) {
|
|
||||||
$new_comment['comment_date'] = $this->parse_date(
|
|
||||||
$data["csv_comment_{$cid}_date"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$id = wp_insert_comment($new_comment);
|
|
||||||
if ($id) {
|
|
||||||
$count++;
|
|
||||||
} else {
|
|
||||||
$this->log['error'][] = "Could not add comment $cid";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $count;
|
|
||||||
}
|
|
||||||
|
|
||||||
function create_custom_fields($post_id, $data) {
|
|
||||||
foreach ($data as $k => $v) {
|
|
||||||
// anything that doesn't start with csv_ is a custom field
|
|
||||||
if (!preg_match('/^csv_/', $k) && $v != '') {
|
|
||||||
add_post_meta($post_id, $k, $v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_auth_id($author) {
|
|
||||||
if (is_numeric($author)) {
|
|
||||||
return $author;
|
|
||||||
}
|
|
||||||
$author_data = get_userdatabylogin($author);
|
|
||||||
return ($author_data) ? $author_data->ID : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert date in CSV file to 1999-12-31 23:52:00 format
|
|
||||||
function parse_date($data) {
|
|
||||||
$timestamp = strtotime($data);
|
|
||||||
if (false === $timestamp) {
|
|
||||||
return '';
|
|
||||||
} else {
|
|
||||||
return date('Y-m-d H:i:s', $timestamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// delete BOM from UTF-8 file
|
|
||||||
function stripBOM($fname) {
|
|
||||||
$res = fopen($fname, 'rb');
|
|
||||||
if (false !== $res) {
|
|
||||||
$bytes = fread($res, 3);
|
|
||||||
if ($bytes == pack('CCC', 0xef, 0xbb, 0xbf)) {
|
|
||||||
$this->log['notice'][] = 'Getting rid of byte order mark...';
|
|
||||||
fclose($res);
|
|
||||||
|
|
||||||
$contents = file_get_contents($fname);
|
|
||||||
if (false === $contents) {
|
|
||||||
trigger_error('Failed to get file contents.', E_USER_WARNING);
|
|
||||||
}
|
|
||||||
$contents = substr($contents, 3);
|
|
||||||
$success = file_put_contents($fname, $contents);
|
|
||||||
if (false === $success) {
|
|
||||||
trigger_error('Failed to put file contents.', E_USER_WARNING);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
fclose($res);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$this->log['error'][] = 'Failed to open file, aborting.';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function csv_admin_menu() {
|
|
||||||
require_once ABSPATH . '/wp-admin/admin.php';
|
|
||||||
$plugin = new CSVImporterPlugin;
|
|
||||||
add_management_page('edit.php', 'CSV Importer', 9, __FILE__, array($plugin, 'form'));
|
|
||||||
}
|
|
||||||
|
|
||||||
add_action('admin_menu', 'csv_admin_menu');
|
|
||||||
|
|
||||||
?>
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
"csv_post_title","csv_post_post","csv_post_categories","csv_post_tags","csv_comment_1_author","csv_comment_1_content","csv_comment_2_author","csv_comment_2_author_email","csv_comment_2_url","csv_comment_2_content","csv_comment_2_date"
|
|
||||||
"Minitel","The Minitel is a Videotex online service accessible through the telephone lines, and is considered one of the world's most successful pre-World Wide Web online services.","Testing CSV Importer","test,import,csv","gordon","Wow, I have never heard about such service.","eli","eli@example.com","http://example.com","From its early days, users could make online purchases, make train reservations, check stock prices, search the telephone directory, and chat in a similar way to that now made possible by the Internet.","yesterday"
|
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
"csv_post_title","csv_post_post","csv_post_excerpt","csv_post_categories","csv_post_tags","csv_post_date","csv_post_author","csv_post_slug","csv_ctax_art","csv_ctax_country","my_custom1"
|
|
||||||
"Vincent Van Gogh","Vincent Willem van Gogh[a 1] (30 March 1853 – 29 July 1890) was a Dutch post-Impressionist painter whose work had a far-reaching influence on 20th century art for its vivid colors and emotional impact. He suffered from anxiety and increasingly frequent bouts of mental illness throughout his life, and died largely unknown, at the age of 37, from a self-inflicted gunshot wound.","Vincent Willem van Gogh[a 1] (30 March 1853 – 29 July 1890) was a Dutch post-Impressionist painter","Art, CSV Importer","van gogh, dutch, painter","June 1, 2010","alice","Van-gogh-one","Painting, post-impressionism","Netherlands,France",53
|
|
||||||
"Claude Monet","Claude Monet (French pronunciation: [klod mɔnɛ]), born Oscar Claude Monet (14 November 1840 – 5 December 1926)[1] was a founder of French impressionist painting, and the most consistent and prolific practitioner of the movement's philosophy of expressing one's perceptions before nature, especially as applied to plein-air landscape painting. ","Claude Monet (French pronunciation: [klod mɔnɛ]), born Oscar Claude Monet (14 November 1840 – 5 December 1926)[1] was a founder of French impressionist painting","Art, CSV Importer","monet, french, painter","May 30, 2010","alice","Claude-monet-one","Painting, impressionism","France",40
|
|
||||||
"Pablo Picasso","Pablo Diego José Francisco de Paula Juan Nepomuceno María de los Remedios Cipriano de la Santísima Trinidad Clito Ruiz y Picasso Ruiz Picasso known as Pablo Ruiz Picasso (25 October 1881 – 8 April 1973) was a Spanish painter, draughtsman, and sculptor. He is best known for co-founding the Cubist movement and for the wide variety of styles embodied in his work.","Pablo Ruiz Picasso (25 October 1881 – 8 April 1973) was a Spanish painter, draughtsman, and sculptor.","Art, CSV Importer","picasso, spanish, painter, sculptor","August 25 2009","alice","Pablo-picasso-one","Painting, cubism
|
|
||||||
Sculpture, cubism","France, Spain",81
|
|
||||||
"Oscar Wilde","Oscar Fingal O'Flahertie Wills Wilde (16 October 1854 – 30 November 1900) was an Irish writer, poet, and prominent aesthete. His parents were successful Dublin intellectuals, and from an early age he was tutored at home, where he showed his intelligence, becoming fluent in French and German. ","Oscar Fingal O'Flahertie Wills Wilde (16 October 1854 – 30 November 1900) was an Irish writer, poet, and prominent aesthete.","Art, CSV Importer","wilde, irish, poet","August 25 2009","bob","Oscar-wilde-one","Poetry, aestheticism
|
|
||||||
Prose, ""fiction, gothic""","Ireland, UK, France",54
|
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
// Set up custom taxonomies for CSV Importer custom-taxonomies.csv example. You
|
|
||||||
// can copy-and-paste the code below to your theme's functions.php file.
|
|
||||||
|
|
||||||
add_action('init', 'csv_importer_taxonomies', 0);
|
|
||||||
|
|
||||||
function csv_importer_taxonomies() {
|
|
||||||
register_taxonomy('art', 'post', array(
|
|
||||||
'hierarchical' => true,
|
|
||||||
'label' => 'Art',
|
|
||||||
));
|
|
||||||
register_taxonomy('country', 'post', array(
|
|
||||||
'hierarchical' => false,
|
|
||||||
'label' => 'Country',
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
"csv_post_title","csv_post_post","csv_post_categories","csv_post_date","csv_post_author","csv_post_slug","csv_post_type","csv_post_parent"
|
|
||||||
"[CSV Importer] Assign an author","You can manually assign an author to a post, provided that user exists.","Testing CSV Importer",,"alice",,,
|
|
||||||
"[CSV Importer] Set a slug","Slugs are supported, too.","Testing CSV Importer",,,"slug-ability",,
|
|
||||||
"[CSV Importer] Yesterday's post","Dates can be specified in a variety of formats, including plain English (with limitations, of course).","Testing CSV Importer","yesterday",,,,
|
|
||||||
"[CSV Importer] A year ago","Set date to the same day, a year ago.","Testing CSV Importer","-1 year",,,,
|
|
||||||
"[CSV Importer] Exact date 1","More precise date formats are supported, too.","Testing CSV Importer","2011, feb 2",,,,
|
|
||||||
"[CSV Importer] Exact date 2","More precise date formats are supported, too.","Testing CSV Importer","01/01/11",,,,
|
|
||||||
"[CSV Importer] Parent","You can specify a parent page using its id. The page has to already exist for this to work.","Testing CSV Importer",,,,"page",83
|
|
||||||
"[CSV Importer] Subcategories","To specify a category structure, use the greater than sign > in the csv_post_categories column.","Testing CSV Importer > Guitars > Electric",,,,,
|
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
"csv_post_title","csv_post_post","csv_post_type","csv_post_excerpt","csv_post_categories","csv_post_tags","csv_post_date","custom_field_1","custom_field_2"
|
|
||||||
"[CSV Importer] Test","Don't panic, this is only a test.
|
|
||||||
|
|
||||||
The <a href=""http://wordpress.org/extend/plugins/csv-importer/other_notes/"">manual</a> has a lot of useful information.
|
|
||||||
|
|
||||||
Unsurprisingly, one of the most frequently asked questions is ""What should I do if my data has commas and double quotes?"".
|
|
||||||
|
|
||||||
<em>CSV Importer</em> can be used with any language (just make sure to save the file with UTF-8 encoding):
|
|
||||||
|
|
||||||
<blockquote>
|
|
||||||
A comma-separated values or character-separated values (CSV) file is a simple text format for a database table.
|
|
||||||
|
|
||||||
Comma-separated values (CSV) est un format informatique ouvert représentant des données tabulaires sous forme de « valeurs séparées par des virgules ».
|
|
||||||
|
|
||||||
CSV (от англ. Comma Separated Values — значения, разделённые запятыми) — текстовый формат, предназначенный для представления табличных данных.
|
|
||||||
|
|
||||||
Comma-Separated Values(略称:CSV)は、いくつかのフィールド(項目)をカンマ「,」で区切ったテキストデータおよびテキストファイル。
|
|
||||||
</blockquote>",,"This is an excerpt for a CSV Importer test post.","Testing CSV Importer, Testing CSV Importer 2","test,csv","2000-12-31 20:00:12","custom value","custom value 2"
|
|
||||||
"[CSV Importer] A future post","This is a post that's scheduled to be published in the future (provided that it's not imported as a draft).","post","An excerpt of a future post.","Testing CSV Importer","test,csv,future","2014-01-01 14:00:00",42,43
|
|
||||||
"[CSV Importer] How to import a page?","To import a page, set csv_post_type column value to ""page"".","page",,,,,,
|
|
||||||
|
@ -1,339 +0,0 @@
|
|||||||
=== CSV Importer ===
|
|
||||||
Contributors: dvkob
|
|
||||||
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=4YJEU5U2Y4LTS&lc=US&item_name=Support%20CSV%20Importer%20development¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
|
|
||||||
Tags: csv, import, batch, spreadsheet, excel
|
|
||||||
Requires at least: 2.0.2
|
|
||||||
Tested up to: 3.0.4
|
|
||||||
Stable tag: trunk
|
|
||||||
|
|
||||||
Import posts from CSV files into WordPress.
|
|
||||||
|
|
||||||
|
|
||||||
== Description ==
|
|
||||||
|
|
||||||
This plugin imports posts from CSV (Comma Separated Value) files into your
|
|
||||||
WordPress blog. It can prove extremely useful when you want to import a bunch
|
|
||||||
of posts from an Excel document or the like - simply export your document into
|
|
||||||
a CSV file and the plugin will take care of the rest.
|
|
||||||
|
|
||||||
= Features =
|
|
||||||
|
|
||||||
* Imports post title, body, excerpt, tags, date, categories etc.
|
|
||||||
* Supports custom fields, custom taxonomies and comments
|
|
||||||
* Deals with Word-style quotes and other non-standard characters using
|
|
||||||
WordPress' built-in mechanism (same one that normalizes your input when you
|
|
||||||
write your posts)
|
|
||||||
* Columns in the CSV file can be in any order, provided that they have correct
|
|
||||||
headings
|
|
||||||
* Multilanguage support
|
|
||||||
|
|
||||||
|
|
||||||
== Screenshots ==
|
|
||||||
|
|
||||||
1. Plugin's interface
|
|
||||||
|
|
||||||
|
|
||||||
== Installation ==
|
|
||||||
|
|
||||||
Installing the plugin:
|
|
||||||
|
|
||||||
1. Unzip the plugin's directory into `wp-content/plugins`.
|
|
||||||
1. Activate the plugin through the 'Plugins' menu in WordPress.
|
|
||||||
1. The plugin will be available under Tools -> CSV Importer on
|
|
||||||
WordPress administration page.
|
|
||||||
|
|
||||||
|
|
||||||
== Usage ==
|
|
||||||
|
|
||||||
Click on the CSV Importer link on your WordPress admin page, choose the
|
|
||||||
file you would like to import and click Import. The `examples` directory
|
|
||||||
inside the plugin's directory contains several files that demonstrate
|
|
||||||
how to use the plugin. The best way to get started is to import one of
|
|
||||||
these files and look at the results.
|
|
||||||
|
|
||||||
CSV is a tabular format that consists of rows and columns. Each row in
|
|
||||||
a CSV file represents a post; each column identifies a piece of information
|
|
||||||
that comprises a post.
|
|
||||||
|
|
||||||
= Basic post information =
|
|
||||||
|
|
||||||
* `csv_post_title` - title of the post
|
|
||||||
* `csv_post_post` - body of the post
|
|
||||||
* `csv_post_type` - `post`, `page` or a custom post type.
|
|
||||||
__New in version 0.3.2__
|
|
||||||
In prior versions, importing rows as pages could be specified on a
|
|
||||||
per-file basis using the plugins UI. In 0.3.2, `csv_post_type` column
|
|
||||||
was added to support custom post types as well.
|
|
||||||
Refer to the WordPress
|
|
||||||
[documentation on custom post types][custom_post_types] for more info
|
|
||||||
on how to set up custom post types.
|
|
||||||
* `csv_post_excerpt` - post excerpt
|
|
||||||
* `csv_post_categories` - a comma separated list of category names or ids.
|
|
||||||
__New in version 0.3.5__
|
|
||||||
It's also possible to assign posts to non-existing subcategories, using
|
|
||||||
> to denote category relationships, e.g. `Animalia > Chordata > Mammalia`.
|
|
||||||
If any of the categories in the chain does not exist, the plugin will
|
|
||||||
automatically create it. It's also possible to specify the parent category
|
|
||||||
using an id, as in `42 > Primates > Callitrichidae`, where `42` is an
|
|
||||||
existing category id.
|
|
||||||
* `csv_post_tags` - a comma separated list of tags.
|
|
||||||
* `csv_post_date` - about any English textual description of a date and time.
|
|
||||||
For example, `now`, `11/16/2009 0:00`, `1999-12-31 23:55:00`, `+1 week`,
|
|
||||||
`next Thursday`, `last year` are all valid descriptions. For technical
|
|
||||||
details, consult PHP's `strtotime()` function [documentation][strtotime].
|
|
||||||
|
|
||||||
[custom_post_types]: http://codex.wordpress.org/Custom_Post_Types
|
|
||||||
[strtotime]: http://php.net/manual/en/function.strtotime.php
|
|
||||||
|
|
||||||
= Custom fields =
|
|
||||||
|
|
||||||
Any column that doesn't start with `csv_` is considered to be a custom field
|
|
||||||
name. The data in that column will be imported as the custom fields value.
|
|
||||||
|
|
||||||
= General remarks =
|
|
||||||
|
|
||||||
* WordPress pages [don't have categories or tags][pages].
|
|
||||||
* Most columns are optional. Either `csv_post_title`, `csv_post_post` or
|
|
||||||
`csv_post_excerpt` are sufficient to create a post. If all of these
|
|
||||||
columns are empty in a row, the plugin will skip that row.
|
|
||||||
* The plugin will attempt to reuse existing categories or tags; if an
|
|
||||||
existing category or tag cannot be found, the plugin will create it.
|
|
||||||
* To specify a category that has a greater than sign (>) in the name, use
|
|
||||||
the HTML entity `>`
|
|
||||||
|
|
||||||
[pages]: http://codex.wordpress.org/Pages
|
|
||||||
|
|
||||||
= Advanced usage =
|
|
||||||
|
|
||||||
* `csv_post_author` - numeric user id or login name. If not specified or
|
|
||||||
user does not exist, the plugin will assign the posts to the user
|
|
||||||
performing the import.
|
|
||||||
* `csv_post_slug` - post slug used in permalinks.
|
|
||||||
* `csv_post_parent` - post parent id.
|
|
||||||
|
|
||||||
== Custom taxonomies ==
|
|
||||||
|
|
||||||
__New in version 0.3.0__
|
|
||||||
|
|
||||||
Once custom taxonomies are set up in your theme's functions.php file or
|
|
||||||
by using a 3rd party plugin, `csv_ctax_(taxonomy name)` columns can be
|
|
||||||
used to assign imported data to the taxonomies.
|
|
||||||
|
|
||||||
__Non-hierarchical taxonomies__
|
|
||||||
|
|
||||||
The syntax for non-hierarchical taxonomies is straightforward and is essentially
|
|
||||||
the same as the `csv_post_tags` syntax.
|
|
||||||
|
|
||||||
__Hierarchical taxonomies__
|
|
||||||
|
|
||||||
The syntax for hierarchical taxonomies is more complicated. Each hierarchical
|
|
||||||
taxonomy field is a tiny two-column CSV file, where _the order of columns
|
|
||||||
matters_. The first column contains the name of the parent term and the second
|
|
||||||
column contains the name of the child term. Top level terms have to be preceded
|
|
||||||
either by an empty string or a 0 (zero).
|
|
||||||
|
|
||||||
Sample `examples/custom-taxonomies.csv` file included with the plugin
|
|
||||||
illustrates custom taxonomy support. To see how it works, make sure to set up
|
|
||||||
custom taxonomies from `functions.inc.php`.
|
|
||||||
|
|
||||||
Make sure that the quotation marks used as text delimiters in `csv_ctax_`
|
|
||||||
columns are regular ASCII double quotes, not typographical quotes like “
|
|
||||||
(U+201C) and ” (U+201D).
|
|
||||||
|
|
||||||
== Comments ==
|
|
||||||
|
|
||||||
__New in version 0.3.1__
|
|
||||||
|
|
||||||
An example file with comments is included in the `examples` directory.
|
|
||||||
In short, comments can be imported along with posts by specifying columns
|
|
||||||
such as `csv_comment_*_author`, `csv_comment_*_content` etc, where * is
|
|
||||||
a comment ID number. This ID doesn't go into WordPress. It is only there
|
|
||||||
to have the connection information in the CSV file.
|
|
||||||
|
|
||||||
|
|
||||||
== Frequently Asked Questions ==
|
|
||||||
|
|
||||||
> I have quotation marks and commas as values in my CSV file. How do I tell CSV
|
|
||||||
Importer to use a different separator?
|
|
||||||
|
|
||||||
It doesn't really matter what kind of separator you use if your file is
|
|
||||||
properly escaped. To see what I mean by proper escaping, take a look at
|
|
||||||
`examples/sample.csv` file which has cells with quotation marks and commas.
|
|
||||||
|
|
||||||
If the software you use for exporting to CSV is unable to escape quotation
|
|
||||||
marks and commas, you might want to give [OpenOffice Calc][calc] a try.
|
|
||||||
|
|
||||||
[calc]: http://www.openoffice.org/
|
|
||||||
|
|
||||||
> How can I import characters with diacritics, Cyrillic or Han characters?
|
|
||||||
|
|
||||||
Make sure to save your CSV file with utf-8 encoding.
|
|
||||||
|
|
||||||
Prior to version 6.0.4, MySQL [did not support][5] some rare Han characters. As
|
|
||||||
a workaround, you can insert characters such as 𠊎 (U+2028E) by
|
|
||||||
converting them to HTML entities - &\#x2028e;
|
|
||||||
|
|
||||||
[5]: http://dev.mysql.com/doc/refman/5.1/en/faqs-cjk.html#qandaitem-24-11-1-13
|
|
||||||
|
|
||||||
> I cannot import anything - the plugin displays "Imported 0 posts in 0.01
|
|
||||||
seconds."
|
|
||||||
|
|
||||||
Update to version 0.3.1 or greater. Previous versions required write access to
|
|
||||||
the /tmp directory and the plugin failed if access was denied by PHP's safe
|
|
||||||
mode or other settings.
|
|
||||||
|
|
||||||
> I'm importing a file, but not all rows in it are imported and I don't see
|
|
||||||
a confirmation message. Why?
|
|
||||||
|
|
||||||
WordPress can be many things, but one thing it's not is blazing fast. The
|
|
||||||
reason why not all rows are imported and there's no confirmation message is
|
|
||||||
that the plugin times out during execution - PHP decides that it has been
|
|
||||||
running too long and terminates it.
|
|
||||||
|
|
||||||
There are a number of solutions you can try. First, make sure that you're not
|
|
||||||
using any plugins that may slow down post insertion. For example, a Twitter
|
|
||||||
plugin might attempt to tweet every post you import - not a very good idea
|
|
||||||
if you have 200 posts. Second, you can break up a file into smaller chunks that
|
|
||||||
take less time to import and therefore will not cause the plugin to time out.
|
|
||||||
Third, you can try adjusting PHP's `max_execution_time` option that sets how
|
|
||||||
long scripts are allowed to run. Description of how to do it is beyond the
|
|
||||||
scope of this FAQ - you should search the web and/or use your web host's help
|
|
||||||
to find out how. However, putting the following line in `.htaccess` file inside
|
|
||||||
public_html directory works for some people:
|
|
||||||
|
|
||||||
# Sets max execution time to 2 minutes. Adjust as necessary.
|
|
||||||
php_value max_execution_time 120
|
|
||||||
|
|
||||||
The problem can be approached from another angle, namely instead of giving
|
|
||||||
scripts more time to run making them run faster. There's not much I can do to
|
|
||||||
speed up the plugin (you can contact me at dvkobozev at gmail.com if you like
|
|
||||||
to prove me wrong), so you can try to speed up WordPress. It is a pretty broad
|
|
||||||
topic, ranging from database optimizations to PHP accelerators such as APC,
|
|
||||||
eAccelerator or XCache, so I'm afraid you're on your own here.
|
|
||||||
|
|
||||||
> I receive the following error when I try to import my CSV file: "Invalid CSV
|
|
||||||
file: header length and/or row lengths do not match". What's wrong with your
|
|
||||||
plugin/my file?
|
|
||||||
|
|
||||||
Short answer: update to version 0.2.0 or later. Longer answer: the number of
|
|
||||||
fields (values) in rows in your file does not match the number of columns.
|
|
||||||
Version 0.2.0 pads such rows with empty values (if there are more columns than
|
|
||||||
cells in a row) or discards extra fields (if there are less columns than cells
|
|
||||||
in a row).
|
|
||||||
|
|
||||||
> I'm getting the following error: `Parse error: syntax error, unexpected
|
|
||||||
T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in .../public_html/wp-content/plugins/csv-importer/File_CSV_DataSource/DataSource.php
|
|
||||||
on line 61`. What gives?
|
|
||||||
|
|
||||||
This plugin requires PHP5, while you probably have PHP4 or older. Update your
|
|
||||||
PHP installation or ask your hosting provider to do it for you.
|
|
||||||
|
|
||||||
|
|
||||||
== Credits ==
|
|
||||||
|
|
||||||
This plugin uses [php-csv-parser][3] by Kazuyoshi Tlacaelel.
|
|
||||||
It was inspired by JayBlogger's [CSV Import][4] plugin.
|
|
||||||
|
|
||||||
Contributors:
|
|
||||||
|
|
||||||
* Kevin Hagerty (post_author support)
|
|
||||||
* Edir Pedro (root category option and tableless HTML markup)
|
|
||||||
* Frank Loeffler (comments support)
|
|
||||||
* Micah Gates (subcategory syntax)
|
|
||||||
|
|
||||||
[3]: http://code.google.com/p/php-csv-parser/
|
|
||||||
[4]: http://www.jayblogger.com/the-birth-of-my-first-plugin-import-csv/
|
|
||||||
|
|
||||||
|
|
||||||
== Changelog ==
|
|
||||||
|
|
||||||
= 0.3.6 =
|
|
||||||
* Fix category cleanup bug
|
|
||||||
|
|
||||||
= 0.3.5 =
|
|
||||||
* Added 'greater-than' category syntax
|
|
||||||
* Updated the docs
|
|
||||||
|
|
||||||
= 0.3.4 =
|
|
||||||
* Added csv_post_parent column
|
|
||||||
* Updated the docs
|
|
||||||
* Got rid of a deprecation warning
|
|
||||||
|
|
||||||
= 0.3.3 =
|
|
||||||
* Fixes incompatibility with versions of WordPress prior to 3.0 introduced
|
|
||||||
in previous release.
|
|
||||||
|
|
||||||
= 0.3.2 =
|
|
||||||
* Added ability to specify custom post type.
|
|
||||||
|
|
||||||
= 0.3.1 =
|
|
||||||
* Import comments.
|
|
||||||
* Updated php-csv-parser - the plugin should no longer create files in /tmp.
|
|
||||||
|
|
||||||
= 0.3.0 =
|
|
||||||
* Custom taxonomies.
|
|
||||||
|
|
||||||
= 0.2.4 =
|
|
||||||
* Root category selection, cleaner HTML.
|
|
||||||
|
|
||||||
= 0.2.3 =
|
|
||||||
* Slight speed increase, support for post_author and post_name.
|
|
||||||
|
|
||||||
= 0.2.2 =
|
|
||||||
* Bugfix release to deal with BOM that may occur in UTF-8 encoded files.
|
|
||||||
|
|
||||||
= 0.2.1 =
|
|
||||||
* Ability to import rows as pages, not posts.
|
|
||||||
* Starting with this version, you can also specify category ids instead of
|
|
||||||
names.
|
|
||||||
|
|
||||||
= 0.2.0 =
|
|
||||||
* Ability to handle CSV files where the number of cells in rows does not
|
|
||||||
match the number of columns
|
|
||||||
* Smart date parsing
|
|
||||||
* Code cleanup.
|
|
||||||
|
|
||||||
= 0.1.3 =
|
|
||||||
* New option to import posts with published status.
|
|
||||||
|
|
||||||
= 0.1.2 =
|
|
||||||
* Added support for post excerpts.
|
|
||||||
|
|
||||||
= 0.1.1 =
|
|
||||||
* Code cleanup
|
|
||||||
* Changed column names for CSV input. Sorry if it breaks anything for you,
|
|
||||||
folks, but it had to be done in order to allow for custom fields such as
|
|
||||||
`title` ([All in One SEO Pack][1] uses those, for example).
|
|
||||||
|
|
||||||
= v0.1.0 =
|
|
||||||
* Initial version of the plugin
|
|
||||||
|
|
||||||
[1]: http://wordpress.org/extend/plugins/all-in-one-seo-pack/
|
|
||||||
|
|
||||||
|
|
||||||
== Upgrade Notice ==
|
|
||||||
|
|
||||||
= 0.3.6 =
|
|
||||||
Fix for 'Invalid argument supplied for foreach() on line 268' error message
|
|
||||||
|
|
||||||
= 0.3.5 =
|
|
||||||
Subcategory creation support. Documentation update.
|
|
||||||
|
|
||||||
= 0.3.4 =
|
|
||||||
Post parent support. Documentation update.
|
|
||||||
|
|
||||||
= 0.3.3 =
|
|
||||||
Fixes "Call to undefined function post_type_exists()" error for versions of
|
|
||||||
Wordpress prior to 3.0
|
|
||||||
|
|
||||||
= 0.3.2 =
|
|
||||||
Adds support for custom post types. Option to import pages has been removed from
|
|
||||||
the interface. To import a page, add csv_post_type column to your csv file and
|
|
||||||
set it to "page".
|
|
||||||
|
|
||||||
= 0.3.1 =
|
|
||||||
Adds support for comments
|
|
||||||
|
|
||||||
= 0.3.0 =
|
|
||||||
Adds support for custom taxonomies
|
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 23 KiB |
@ -1,183 +0,0 @@
|
|||||||
<?php
|
|
||||||
if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
|
|
||||||
|
|
||||||
function nggallery_admin_about() {
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class="wrap">
|
|
||||||
<?php screen_icon( 'nextgen-gallery' ); ?>
|
|
||||||
<h2><?php _e('Copyright notes / Credits', 'nggallery') ;?></h2>
|
|
||||||
<div id="poststuff">
|
|
||||||
<div class="postbox">
|
|
||||||
<h3 class="hndle"><span><?php _e('NextGEN DEV Team', 'nggallery'); ?></span></h3>
|
|
||||||
<div class="inside">
|
|
||||||
<p><?php _e('This plugin is primarily developed, maintained, supported, documented by', 'nggallery'); ?> <a href="http://alexrabe.de" target="_blank">Alex Rabe</a>. <?php _e('There are many other folks who have made contributions to this project :', 'nggallery') ;?></p>
|
|
||||||
<p><?php ngg_list_contributors(); ?></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="postbox">
|
|
||||||
<h3 class="hndle"><span><?php _e('Contributors / Tribute to', 'nggallery'); ?></span></h3>
|
|
||||||
<div class="inside">
|
|
||||||
<p><?php _e('If you study the code of this plugin, you will find out that we mixed a lot of good already existing code and ideas together.', 'nggallery') ;?>
|
|
||||||
<?php _e('So, we would like to thank the following people for their pioneer work (without this work it\'s impossible to create such a plugin so fast)', 'nggallery') ;?></p>
|
|
||||||
<ul class="ngg-list">
|
|
||||||
<li><a href="http://wordpress.org" target="_blank">The WordPress Team</a> <?php _e('for their great documented code', 'nggallery') ;?></li>
|
|
||||||
<li><a href="http://jquery.com" target="_blank">The jQuery Team</a> <?php _e('for jQuery, which is the best Web2.0 framework', 'nggallery') ;?></li>
|
|
||||||
<li><a href="http://www.gen-x-design.com" target="_blank">Ian Selby</a> <?php _e('for the fantastic PHP Thumbnail Class', 'nggallery') ;?></li>
|
|
||||||
<li><a href="http://www.lesterchan.net/" target="_blank">GaMerZ</a> <?php _e('for a lot of very useful plugins and ideas', 'nggallery') ;?></li>
|
|
||||||
<li><a href="http://www.laptoptips.ca/" target="_blank">Andrew Ozz</a> <?php _e('for Shutter Reloaded, a real lightweight image effect', 'nggallery') ;?></li>
|
|
||||||
<li><a href="http://www.jeroenwijering.com/" target="_blank">Jeroen Wijering</a> <?php _e('for the best Media Flash Scripts on earth', 'nggallery') ;?></li>
|
|
||||||
<li><a href="http://field2.com" target="_blank">Ben Dunkle</a> <?php _e('for the Gallery Icon', 'nggallery') ;?></li>
|
|
||||||
<li><a href="http://watermark.malcherek.com/" target="_blank">Marek Malcherek</a> <?php _e('for the Watermark plugin', 'nggallery') ;?></li>
|
|
||||||
</ul>
|
|
||||||
<p><?php _e('If you didn\'t find your name on this list and there is some code which I integrate in my plugin, don\'t hesitate to send me a mail.', 'nggallery') ;?></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="postbox">
|
|
||||||
<h3 class="hndle"><span><?php _e('How to support ?', 'nggallery'); ?></span></h3>
|
|
||||||
<div class="inside">
|
|
||||||
<p><?php _e('There exist several ways to contribute, help or support us in this work. Non of them are mandatory.', 'nggallery') ;?></p>
|
|
||||||
<ul class="ngg-list">
|
|
||||||
<li><strong><?php _e('Send us bugfixes / code changes', 'nggallery') ;?></strong><br /><?php _e('The most motivated support for this plugin are your ideas and brain work', 'nggallery') ;?></li>
|
|
||||||
<li><strong><?php _e('Translate the plugin', 'nggallery') ;?></strong><br /><?php _e('To help people to work with this plugin, I would like to have it in all available languages', 'nggallery') ;?></li>
|
|
||||||
<li><strong><?php _e('Donate the work via paypal', 'nggallery') ;?></strong><br />
|
|
||||||
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" >
|
|
||||||
<input type="hidden" name="cmd" value="_xclick"/>
|
|
||||||
<input type="hidden" name="business" value="alter.ego@boelinger.com"/>
|
|
||||||
<input type="hidden" name="item_name" value="NextGEN Gallery plugin"/>
|
|
||||||
<input type="hidden" name="no_shipping" value="1"/>
|
|
||||||
<input type="hidden" name="return" value="http://alexrabe.de/" />
|
|
||||||
<input type="hidden" name="cancel_return" value="http://alexrabe.de/"/>
|
|
||||||
<input type="hidden" name="lc" value="US" />
|
|
||||||
<input type="hidden" name="currency_code" value="EUR"/>
|
|
||||||
<input type="hidden" name="tax" value="0"/>
|
|
||||||
<input type="hidden" name="bn" value="PP-DonationsBF"/>
|
|
||||||
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but21.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!" style="border: none;"/>
|
|
||||||
</form><?php _e('No doubt a very useful and easy motivation :-)', 'nggallery') ;?>
|
|
||||||
</li>
|
|
||||||
<li><strong><?php _e('Place a link to the plugin in your blog/webpage', 'nggallery') ;?></strong><br /><?php _e('Yes, share and trackback is also a good support for this work ', 'nggallery') ;?></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="postbox" id="donators">
|
|
||||||
<h3 class="hndle"><span><?php _e('Thanks!', 'nggallery'); ?></span></h3>
|
|
||||||
<div class="inside">
|
|
||||||
<p><?php _e('We would like to thank this people which support us in the work :', 'nggallery'); ?></p>
|
|
||||||
<p><a href="http://www.boelinger.com/heike/" target="_blank">HEIKE</a>, <?php ngg_list_support(); ?></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
|
|
||||||
function ngg_list_contributors() {
|
|
||||||
/* The list of my contributors. Thanks to all of them !*/
|
|
||||||
|
|
||||||
$contributors = array(
|
|
||||||
'Anty (Code contributor)' => 'http://www.anty.at/',
|
|
||||||
'Bjoern von Prollius (Code contributor)' => 'http://www.prollius.de/',
|
|
||||||
'Simone Fumagalli (Code contributor)' => 'http://www.iliveinperego.com/',
|
|
||||||
'Vincent Prat (Code contributor)' => 'http://www.vincentprat.info',
|
|
||||||
'Frederic De Ranter (AJAX code contributor)' => 'http://li.deranter.com/',
|
|
||||||
'Christian Arnold (Code contributor)' => 'http://blog.arctic-media.de/',
|
|
||||||
'Thomas Matzke (Album code contributor)' => 'http://mufuschnu.mu.funpic.de/',
|
|
||||||
'KeViN (Sidebar Widget developer)' => 'http://www.kev.hu/',
|
|
||||||
'Lazy (German Translation)' => 'http://www.lazychris.de/',
|
|
||||||
'Lise (French Translation)' => 'http://liseweb.fr/',
|
|
||||||
'Anja (Dutch Translation)' => 'http://www.werkgroepen.net/wordpress',
|
|
||||||
'Adrian (Indonesian Translation)' => 'http://adrian.web.id/',
|
|
||||||
'Gaspard Tseng / SillyCCSmile (Chinese Translation)' => '',
|
|
||||||
'Mika Pennanen (Finnish Translation)' => 'http://kapsi.fi/~penni',
|
|
||||||
'Wojciech Owczarek (Polish Translation)' => 'http://www.owczi.net',
|
|
||||||
'Dilip Ramirez (Spanish Translation)' => 'http://jmtd.110mb.com/blog',
|
|
||||||
'Oleinikov Vedmak Evgeny (Russian Translation)' => 'http://ka-2-03.mirea.org/',
|
|
||||||
'Sebastien MALHERBE (Logo design)' => 'http://www.7vision.com/',
|
|
||||||
'Claudia (German documentation)' => 'http://www.blog-werkstatt.de/',
|
|
||||||
'Robert (German documentation)' => 'http://www.curlyrob.de/',
|
|
||||||
'Pierpaolo Mannone (Italian Translation)' => 'http://www.interscambiocasa.com/',
|
|
||||||
'Mattias Tengblad (Swedish Translation)' => 'http://wp-support.se/',
|
|
||||||
'Müfit Kiper (Swedish Translation)' => 'http://www.kiper.se/',
|
|
||||||
'Gil Yaker (Documentation)' => 'http://bamboosoup.com/',
|
|
||||||
'Morten Johansen (Danish Translation)' => 'http://www.fr3ak.dk/',
|
|
||||||
'Vidar Seland (Norwegian Translation)' => 'http://www.viidar.net/',
|
|
||||||
'Emre Güler (Turkish Translation)' => 'http://www.emreguler.com/',
|
|
||||||
'Emilio Lauretti (Italian Translation)' => '',
|
|
||||||
'Jan Angelovic (Czech Translation)' => 'http://www.angelovic.cz/',
|
|
||||||
'Laki (Slovak Translation)' => 'http://www.laki.sk/',
|
|
||||||
'Rowan Crane (WPMU support)' => 'http://blog.rowancrane.com/',
|
|
||||||
'Kuba Zwolinski (Polish Translation)' => 'http://kubazwolinski.com/',
|
|
||||||
'Rina Jiang (Chinese Translation)' => 'http://http://mysticecho.net/',
|
|
||||||
'Anthony (Chinese Translation)' => 'http://www.angryouth.com/',
|
|
||||||
'Milan Vasicek (Czech Translation)' => 'http://www.NoWorkTeam.cz/',
|
|
||||||
'Joo Gi-young (Korean Translation)' => 'http://lombric.linuxstudy.pe.kr/wp/',
|
|
||||||
'Oleg A. Safonov (Russian Translation)' => 'http://blog.olart.ru',
|
|
||||||
'AleXander Kirichev (Bulgarian Translation)' => 'http://xsakex.art-bg.org/',
|
|
||||||
'Richer Yang (Chinese Translation)' => 'http://fantasyworld.idv.tw/',
|
|
||||||
'Bill Jones (Forums contributor)' => 'http://jonesphoto.bluehorizoninternet.com/',
|
|
||||||
'TheDonSansone (Forums contributor)' => 'http://abseiling.200blogs.co.uk/',
|
|
||||||
'Komyshov (Russian Translation)' => 'http://kf-web.ru/',
|
|
||||||
'aleX Zhang (Chinese Translation)' => 'http://zhangfei.info/',
|
|
||||||
'TheSoloist (Chinese Translation)' => 'http://www.soloist-ic.cn/',
|
|
||||||
'Nica Luigi Cristian (Romanian Translation)' => 'http://www.cristiannica.com/',
|
|
||||||
'Zdenek Hatas (Czech Translation)' => '',
|
|
||||||
'David Potter (Documentation and Help)' => 'http://dpotter.net/',
|
|
||||||
'Carlale Chen (Chinese Translation)' => 'http://0-o-0.cc/',
|
|
||||||
'Nica Luigi Cristian (Romanian Translation)' => 'http://www.cristiannica.com/',
|
|
||||||
'Igor Shevkoplyas (Russian Translation)' => 'http://www.russian-translation-matters.com',
|
|
||||||
'Alexandr Kindras (Code contributor)' => 'http://www.fixdev.com',
|
|
||||||
'Manabu Togawa (Japanese Translation)' => 'http://www.churadesign.com/',
|
|
||||||
'Serhiy Tretyak (Ukrainian Translation)' => 'http://designpoint.com.ua/',
|
|
||||||
'Janis Grinvalds (Latvian Translation)' => 'http://riga.bmxrace.lv/',
|
|
||||||
'Kristoffer Thøring (Norwegian Translation)' => '',
|
|
||||||
'Flactarus (Italian Translation)' => 'http://www.giroevago.it',
|
|
||||||
'Felip Alfred Galitó i Trilla (Catalan Translation)' => 'http://www.bratac.cat',
|
|
||||||
'Luka Komac (Slovenian Translation)' => 'http://www.komac.biz',
|
|
||||||
'Dimitris Ikonomou / Nikos Mouratidis (Greek Translation)' => 'http://www.kepik.gr'
|
|
||||||
);
|
|
||||||
|
|
||||||
ksort($contributors);
|
|
||||||
$i = count($contributors);
|
|
||||||
foreach ($contributors as $name => $url)
|
|
||||||
{
|
|
||||||
if ($url)
|
|
||||||
echo "<a href=\"$url\">$name</a>";
|
|
||||||
else
|
|
||||||
echo $name;
|
|
||||||
$i--;
|
|
||||||
if ($i == 1)
|
|
||||||
echo " & ";
|
|
||||||
elseif ($i)
|
|
||||||
echo ", ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function ngg_list_support() {
|
|
||||||
/* The list of my supporters. Thanks to all of them !*/
|
|
||||||
|
|
||||||
global $ngg;
|
|
||||||
|
|
||||||
$supporter = nggAdminPanel::get_remote_array($ngg->donators);
|
|
||||||
|
|
||||||
// Ensure that this is a array
|
|
||||||
if ( !is_array($supporter) )
|
|
||||||
return _e('and all donators...', 'nggallery');
|
|
||||||
|
|
||||||
ksort($supporter);
|
|
||||||
$i = count($supporter);
|
|
||||||
foreach ($supporter as $name => $url)
|
|
||||||
{
|
|
||||||
if ($url)
|
|
||||||
echo "<a href=\"$url\">$name</a>";
|
|
||||||
else
|
|
||||||
echo $name;
|
|
||||||
$i--;
|
|
||||||
if ($i == 1)
|
|
||||||
echo " & ";
|
|
||||||
elseif ($i)
|
|
||||||
echo ", ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
@ -1,417 +0,0 @@
|
|||||||
<?php
|
|
||||||
if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
|
|
||||||
|
|
||||||
// sometimes a error feedback is better than a white screen
|
|
||||||
@ini_set('error_reporting', E_ALL ^ E_NOTICE);
|
|
||||||
|
|
||||||
class nggAddGallery {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PHP4 compatibility layer for calling the PHP5 constructor.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
function nggAddGallery() {
|
|
||||||
return $this->__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nggOptions::__construct()
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function __construct() {
|
|
||||||
|
|
||||||
// same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
|
|
||||||
$this->filepath = admin_url() . 'admin.php?page=' . $_GET['page'];
|
|
||||||
|
|
||||||
//Look for POST updates
|
|
||||||
if ( !empty($_POST) )
|
|
||||||
$this->processor();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Perform the upload and add a new hook for plugins
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function processor() {
|
|
||||||
global $wpdb, $ngg;
|
|
||||||
|
|
||||||
$defaultpath = $ngg->options['gallerypath'];
|
|
||||||
|
|
||||||
if ($_POST['addgallery']){
|
|
||||||
check_admin_referer('ngg_addgallery');
|
|
||||||
|
|
||||||
if ( !nggGallery::current_user_can( 'NextGEN Add new gallery' ))
|
|
||||||
wp_die(__('Cheatin’ uh?'));
|
|
||||||
|
|
||||||
$newgallery = esc_attr( $_POST['galleryname']);
|
|
||||||
if ( !empty($newgallery) )
|
|
||||||
nggAdmin::create_gallery($newgallery, $defaultpath);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_POST['zipupload']){
|
|
||||||
check_admin_referer('ngg_addgallery');
|
|
||||||
|
|
||||||
if ( !nggGallery::current_user_can( 'NextGEN Upload a zip' ))
|
|
||||||
wp_die(__('Cheatin’ uh?'));
|
|
||||||
|
|
||||||
if ($_FILES['zipfile']['error'] == 0 || (!empty($_POST['zipurl'])))
|
|
||||||
nggAdmin::import_zipfile( intval( $_POST['zipgalselect'] ) );
|
|
||||||
else
|
|
||||||
nggGallery::show_error( __('Upload failed!','nggallery') );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_POST['importfolder']){
|
|
||||||
check_admin_referer('ngg_addgallery');
|
|
||||||
|
|
||||||
if ( !nggGallery::current_user_can( 'NextGEN Import image folder' ))
|
|
||||||
wp_die(__('Cheatin’ uh?'));
|
|
||||||
|
|
||||||
$galleryfolder = $_POST['galleryfolder'];
|
|
||||||
if ( ( !empty($galleryfolder) ) AND ($defaultpath != $galleryfolder) )
|
|
||||||
nggAdmin::import_gallery($galleryfolder);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_POST['uploadimage']){
|
|
||||||
check_admin_referer('ngg_addgallery');
|
|
||||||
|
|
||||||
if ( !nggGallery::current_user_can( 'NextGEN Upload in all galleries' ))
|
|
||||||
wp_die(__('Cheatin’ uh?'));
|
|
||||||
|
|
||||||
if ( $_FILES['imagefiles']['error'][0] == 0 )
|
|
||||||
$messagetext = nggAdmin::upload_images();
|
|
||||||
else
|
|
||||||
nggGallery::show_error( __('Upload failed! ' . nggAdmin::decode_upload_error( $_FILES['imagefiles']['error'][0]),'nggallery') );
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_POST['swf_callback'])){
|
|
||||||
if ($_POST['galleryselect'] == '0' )
|
|
||||||
nggGallery::show_error(__('No gallery selected !','nggallery'));
|
|
||||||
else {
|
|
||||||
// get the path to the gallery
|
|
||||||
$galleryID = (int) $_POST['galleryselect'];
|
|
||||||
$gallerypath = $wpdb->get_var("SELECT path FROM $wpdb->nggallery WHERE gid = '$galleryID' ");
|
|
||||||
nggAdmin::import_gallery($gallerypath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( isset($_POST['disable_flash']) ){
|
|
||||||
check_admin_referer('ngg_addgallery');
|
|
||||||
$ngg->options['swfUpload'] = false;
|
|
||||||
update_option('ngg_options', $ngg->options);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( isset($_POST['enable_flash']) ){
|
|
||||||
check_admin_referer('ngg_addgallery');
|
|
||||||
$ngg->options['swfUpload'] = true;
|
|
||||||
update_option('ngg_options', $ngg->options);
|
|
||||||
}
|
|
||||||
|
|
||||||
do_action( 'ngg_update_addgallery_page' );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Render the page content
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function controller() {
|
|
||||||
global $ngg, $nggdb;
|
|
||||||
|
|
||||||
// check for the max image size
|
|
||||||
$this->maxsize = nggGallery::check_memory_limit();
|
|
||||||
|
|
||||||
//get all galleries (after we added new ones)
|
|
||||||
$this->gallerylist = $nggdb->find_all_galleries('gid', 'DESC');
|
|
||||||
|
|
||||||
$this->defaultpath = $ngg->options['gallerypath'];
|
|
||||||
|
|
||||||
// link for the flash file
|
|
||||||
$swf_upload_link = NGGALLERY_URLPATH . 'admin/upload.php';
|
|
||||||
|
|
||||||
// get list of tabs
|
|
||||||
$tabs = $this->tabs_order();
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?php if($ngg->options['swfUpload'] && !empty ($this->gallerylist) ) { ?>
|
|
||||||
<!-- SWFUpload script -->
|
|
||||||
<script type="text/javascript">
|
|
||||||
var ngg_swf_upload;
|
|
||||||
|
|
||||||
window.onload = function () {
|
|
||||||
ngg_swf_upload = new SWFUpload({
|
|
||||||
// Backend settings
|
|
||||||
upload_url : "<?php echo esc_attr( $swf_upload_link ); ?>",
|
|
||||||
flash_url : "<?php echo NGGALLERY_URLPATH; ?>admin/js/swfupload.swf",
|
|
||||||
|
|
||||||
// Button Settings
|
|
||||||
button_placeholder_id : "spanButtonPlaceholder",
|
|
||||||
button_width: 300,
|
|
||||||
button_height: 27,
|
|
||||||
button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
|
|
||||||
button_cursor: SWFUpload.CURSOR.HAND,
|
|
||||||
|
|
||||||
// File Upload Settings
|
|
||||||
file_size_limit : "<?php echo wp_max_upload_size(); ?>b",
|
|
||||||
file_types : "*.jpg;*.jpeg;*.gif;*.png;*.JPG;*.JPEG;*.GIF;*.PNG",
|
|
||||||
file_types_description : "<?php _e('Image Files', 'nggallery') ;?>",
|
|
||||||
|
|
||||||
// Queue handler
|
|
||||||
file_queued_handler : fileQueued,
|
|
||||||
|
|
||||||
// Upload handler
|
|
||||||
upload_start_handler : uploadStart,
|
|
||||||
upload_progress_handler : uploadProgress,
|
|
||||||
upload_error_handler : uploadError,
|
|
||||||
upload_success_handler : uploadSuccess,
|
|
||||||
upload_complete_handler : uploadComplete,
|
|
||||||
|
|
||||||
post_params : {
|
|
||||||
"auth_cookie" : "<?php echo (is_ssl() ? $_COOKIE[SECURE_AUTH_COOKIE] : $_COOKIE[AUTH_COOKIE]); ?>",
|
|
||||||
"logged_in_cookie": "<?php echo $_COOKIE[LOGGED_IN_COOKIE]; ?>",
|
|
||||||
"_wpnonce" : "<?php echo wp_create_nonce('ngg_swfupload'); ?>",
|
|
||||||
"galleryselect" : "0"
|
|
||||||
},
|
|
||||||
|
|
||||||
// i18names
|
|
||||||
custom_settings : {
|
|
||||||
"remove" : "<?php _e('remove', 'nggallery') ;?>",
|
|
||||||
"browse" : "<?php _e('Browse...', 'nggallery') ;?>",
|
|
||||||
"upload" : "<?php _e('Upload images', 'nggallery') ;?>"
|
|
||||||
},
|
|
||||||
|
|
||||||
// Debug settings
|
|
||||||
debug: false
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// on load change the upload to swfupload
|
|
||||||
initSWFUpload();
|
|
||||||
|
|
||||||
nggAjaxOptions = {
|
|
||||||
header: "<?php _e('Upload images', 'nggallery') ;?>",
|
|
||||||
maxStep: 100
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<?php } else { ?>
|
|
||||||
<!-- MultiFile script -->
|
|
||||||
<script type="text/javascript">
|
|
||||||
/* <![CDATA[ */
|
|
||||||
jQuery(document).ready(function(){
|
|
||||||
jQuery('#imagefiles').MultiFile({
|
|
||||||
STRING: {
|
|
||||||
remove:'[<?php _e('remove', 'nggallery') ;?>]'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
/* ]]> */
|
|
||||||
</script>
|
|
||||||
<?php } ?>
|
|
||||||
<!-- jQuery Tabs script -->
|
|
||||||
<script type="text/javascript">
|
|
||||||
/* <![CDATA[ */
|
|
||||||
jQuery(document).ready(function(){
|
|
||||||
jQuery('html,body').scrollTop(0);
|
|
||||||
jQuery('#slider').tabs({ fxFade: true, fxSpeed: 'fast' });
|
|
||||||
});
|
|
||||||
|
|
||||||
// File Tree implementation
|
|
||||||
jQuery(function() {
|
|
||||||
jQuery("span.browsefiles").show().click(function(){
|
|
||||||
jQuery("#file_browser").fileTree({
|
|
||||||
script: "admin-ajax.php?action=ngg_file_browser&nonce=<?php echo wp_create_nonce( 'ngg-ajax' ) ;?>",
|
|
||||||
root: jQuery("#galleryfolder").val(),
|
|
||||||
}, function(folder) {
|
|
||||||
jQuery("#galleryfolder").val( folder );
|
|
||||||
});
|
|
||||||
jQuery("#file_browser").show('slide');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
/* ]]> */
|
|
||||||
</script>
|
|
||||||
<div id="slider" class="wrap">
|
|
||||||
<ul id="tabs">
|
|
||||||
<?php
|
|
||||||
foreach($tabs as $tab_key => $tab_name) {
|
|
||||||
echo "\n\t\t<li><a href='#$tab_key'>$tab_name</a></li>";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</ul>
|
|
||||||
<?php
|
|
||||||
foreach($tabs as $tab_key => $tab_name) {
|
|
||||||
echo "\n\t<div id='$tab_key'>\n";
|
|
||||||
// Looks for the internal class function, otherwise enable a hook for plugins
|
|
||||||
if ( method_exists( $this, "tab_$tab_key" ))
|
|
||||||
call_user_func( array( &$this , "tab_$tab_key") );
|
|
||||||
else
|
|
||||||
do_action( 'ngg_tab_content_' . $tab_key );
|
|
||||||
echo "\n\t</div>";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create array for tabs and add a filter for other plugins to inject more tabs
|
|
||||||
*
|
|
||||||
* @return array $tabs
|
|
||||||
*/
|
|
||||||
function tabs_order() {
|
|
||||||
|
|
||||||
$tabs = array();
|
|
||||||
|
|
||||||
if ( !empty ($this->gallerylist) )
|
|
||||||
$tabs['uploadimage'] = __( 'Upload Images', 'nggallery' );
|
|
||||||
|
|
||||||
if ( nggGallery::current_user_can( 'NextGEN Add new gallery' ))
|
|
||||||
$tabs['addgallery'] = __('Add new gallery', 'nggallery');
|
|
||||||
|
|
||||||
if ( wpmu_enable_function('wpmuZipUpload') && nggGallery::current_user_can( 'NextGEN Upload a zip' ) )
|
|
||||||
$tabs['zipupload'] = __('Upload a Zip-File', 'nggallery');
|
|
||||||
|
|
||||||
if ( wpmu_enable_function('wpmuImportFolder') && nggGallery::current_user_can( 'NextGEN Import image folder' ) )
|
|
||||||
$tabs['importfolder'] = __('Import image folder', 'nggallery');
|
|
||||||
|
|
||||||
$tabs = apply_filters('ngg_addgallery_tabs', $tabs);
|
|
||||||
|
|
||||||
return $tabs;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function tab_addgallery() {
|
|
||||||
?>
|
|
||||||
<!-- create gallery -->
|
|
||||||
<h2><?php _e('Add new gallery', 'nggallery') ;?></h2>
|
|
||||||
<form name="addgallery" id="addgallery_form" method="POST" action="<?php echo $this->filepath; ?>" accept-charset="utf-8" >
|
|
||||||
<?php wp_nonce_field('ngg_addgallery') ?>
|
|
||||||
<table class="form-table">
|
|
||||||
<tr valign="top">
|
|
||||||
<th scope="row"><?php _e('New Gallery', 'nggallery') ;?>:</th>
|
|
||||||
<td><input type="text" size="35" name="galleryname" value="" /><br />
|
|
||||||
<?php if(!is_multisite()) { ?>
|
|
||||||
<?php _e('Create a new , empty gallery below the folder', 'nggallery') ;?> <strong><?php echo $this->defaultpath ?></strong><br />
|
|
||||||
<?php } ?>
|
|
||||||
<i>( <?php _e('Allowed characters for file and folder names are', 'nggallery') ;?>: a-z, A-Z, 0-9, -, _ )</i></td>
|
|
||||||
</tr>
|
|
||||||
<?php do_action('ngg_add_new_gallery_form'); ?>
|
|
||||||
</table>
|
|
||||||
<div class="submit"><input class="button-primary" type="submit" name= "addgallery" value="<?php _e('Add gallery', 'nggallery') ;?>"/></div>
|
|
||||||
</form>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
|
|
||||||
function tab_zipupload() {
|
|
||||||
?>
|
|
||||||
<!-- zip-file operation -->
|
|
||||||
<h2><?php _e('Upload a Zip-File', 'nggallery') ;?></h2>
|
|
||||||
<form name="zipupload" id="zipupload_form" method="POST" enctype="multipart/form-data" action="<?php echo $this->filepath.'#zipupload'; ?>" accept-charset="utf-8" >
|
|
||||||
<?php wp_nonce_field('ngg_addgallery') ?>
|
|
||||||
<table class="form-table">
|
|
||||||
<tr valign="top">
|
|
||||||
<th scope="row"><?php _e('Select Zip-File', 'nggallery') ;?>:</th>
|
|
||||||
<td><input type="file" name="zipfile" id="zipfile" size="35" class="uploadform"/><br />
|
|
||||||
<?php _e('Upload a zip file with images', 'nggallery') ;?></td>
|
|
||||||
</tr>
|
|
||||||
<?php if (function_exists('curl_init')) : ?>
|
|
||||||
<tr valign="top">
|
|
||||||
<th scope="row"><?php _e('or enter a Zip-File URL', 'nggallery') ;?>:</th>
|
|
||||||
<td><input type="text" name="zipurl" id="zipurl" size="35" class="uploadform"/><br />
|
|
||||||
<?php _e('Import a zip file with images from a url', 'nggallery') ;?></td>
|
|
||||||
</tr>
|
|
||||||
<?php endif; ?>
|
|
||||||
<tr valign="top">
|
|
||||||
<th scope="row"><?php _e('in to', 'nggallery') ;?></th>
|
|
||||||
<td><select name="zipgalselect">
|
|
||||||
<option value="0" ><?php _e('a new gallery', 'nggallery') ?></option>
|
|
||||||
<?php
|
|
||||||
foreach($this->gallerylist as $gallery) {
|
|
||||||
if ( !nggAdmin::can_manage_this_gallery($gallery->author) )
|
|
||||||
continue;
|
|
||||||
$name = ( empty($gallery->title) ) ? $gallery->name : $gallery->title;
|
|
||||||
echo '<option value="' . $gallery->gid . '" >' . $gallery->gid . ' - ' . $name . '</option>' . "\n";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
<br /><?php echo $this->maxsize; ?>
|
|
||||||
<br /><?php echo _e('Note : The upload limit on your server is ','nggallery') . "<strong>" . ini_get('upload_max_filesize') . "Byte</strong>\n"; ?>
|
|
||||||
<br /><?php if ( (is_multisite()) && wpmu_enable_function('wpmuQuotaCheck') ) display_space_usage(); ?></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<div class="submit"><input class="button-primary" type="submit" name= "zipupload" value="<?php _e('Start upload', 'nggallery') ;?>"/></div>
|
|
||||||
</form>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
|
|
||||||
function tab_importfolder() {
|
|
||||||
?>
|
|
||||||
<!-- import folder -->
|
|
||||||
<h2><?php _e('Import image folder', 'nggallery') ;?></h2>
|
|
||||||
<form name="importfolder" id="importfolder_form" method="POST" action="<?php echo $this->filepath.'#importfolder'; ?>" accept-charset="utf-8" >
|
|
||||||
<?php wp_nonce_field('ngg_addgallery') ?>
|
|
||||||
<table class="form-table">
|
|
||||||
<tr valign="top">
|
|
||||||
<th scope="row"><?php _e('Import from Server path:', 'nggallery') ;?></th>
|
|
||||||
<td><input type="text" size="35" id="galleryfolder" name="galleryfolder" value="<?php echo $this->defaultpath; ?>" /><span class="browsefiles button" style="display:none"><?php _e('Browse...', 'nggallery'); ?></span><br />
|
|
||||||
<div id="file_browser"></div>
|
|
||||||
<br /><i>( <?php _e('Note : Change the default path in the gallery settings', 'nggallery') ;?> )</i>
|
|
||||||
<br /><?php echo $this->maxsize; ?>
|
|
||||||
<?php if (SAFE_MODE) {?><br /><?php _e(' Please note : For safe-mode = ON you need to add the subfolder thumbs manually', 'nggallery') ;?><?php }; ?></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<div class="submit"><input class="button-primary" type="submit" name= "importfolder" value="<?php _e('Import folder', 'nggallery') ;?>"/></div>
|
|
||||||
</form>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
|
|
||||||
function tab_uploadimage() {
|
|
||||||
global $ngg;
|
|
||||||
?>
|
|
||||||
<!-- upload images -->
|
|
||||||
<h2><?php _e('Upload Images', 'nggallery') ;?></h2>
|
|
||||||
<form name="uploadimage" id="uploadimage_form" method="POST" enctype="multipart/form-data" action="<?php echo $this->filepath.'#uploadimage'; ?>" accept-charset="utf-8" >
|
|
||||||
<?php wp_nonce_field('ngg_addgallery') ?>
|
|
||||||
<table class="form-table">
|
|
||||||
<tr valign="top">
|
|
||||||
<th scope="row"><?php _e('Upload image', 'nggallery') ;?></th>
|
|
||||||
<td><span id='spanButtonPlaceholder'></span><input type="file" name="imagefiles[]" id="imagefiles" size="35" class="imagefiles"/></td>
|
|
||||||
</tr>
|
|
||||||
<tr valign="top">
|
|
||||||
<th scope="row"><?php _e('in to', 'nggallery') ;?></th>
|
|
||||||
<td><select name="galleryselect" id="galleryselect">
|
|
||||||
<option value="0" ><?php _e('Choose gallery', 'nggallery') ?></option>
|
|
||||||
<?php
|
|
||||||
foreach($this->gallerylist as $gallery) {
|
|
||||||
|
|
||||||
//special case : we check if a user has this cap, then we override the second cap check
|
|
||||||
if ( !current_user_can( 'NextGEN Upload in all galleries' ) )
|
|
||||||
if ( !nggAdmin::can_manage_this_gallery($gallery->author) )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
$name = ( empty($gallery->title) ) ? $gallery->name : $gallery->title;
|
|
||||||
echo '<option value="' . $gallery->gid . '" >' . $gallery->gid . ' - ' . $name . '</option>' . "\n";
|
|
||||||
} ?>
|
|
||||||
</select>
|
|
||||||
<br /><?php echo $this->maxsize; ?>
|
|
||||||
<br /><?php if ((is_multisite()) && wpmu_enable_function('wpmuQuotaCheck')) display_space_usage(); ?></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<div class="submit">
|
|
||||||
<?php if ($ngg->options['swfUpload']) { ?>
|
|
||||||
<input type="submit" name="disable_flash" id="disable_flash" title="<?php _e('The batch upload requires Adobe Flash 10, disable it if you have problems','nggallery') ?>" value="<?php _e('Disable flash upload', 'nggallery') ;?>" />
|
|
||||||
<?php } else { ?>
|
|
||||||
<input type="submit" name="enable_flash" id="enable_flash" title="<?php _e('Upload multiple files at once by ctrl/shift-selecting in dialog','nggallery') ?>" value="<?php _e('Enable flash based upload', 'nggallery') ;?>" />
|
|
||||||
<?php } ?>
|
|
||||||
<input class="button-primary" type="submit" name="uploadimage" id="uploadimage_btn" value="<?php _e('Upload images', 'nggallery') ;?>" />
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
@ -1,453 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* nggAdminPanel - Admin Section for NextGEN Gallery
|
|
||||||
*
|
|
||||||
* @package NextGEN Gallery
|
|
||||||
* @author Alex Rabe
|
|
||||||
* @copyright 2008-2010
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
class nggAdminPanel{
|
|
||||||
|
|
||||||
// constructor
|
|
||||||
function nggAdminPanel() {
|
|
||||||
|
|
||||||
// Add the admin menu
|
|
||||||
add_action( 'admin_menu', array (&$this, 'add_menu') );
|
|
||||||
add_action( 'network_admin_menu', array (&$this, 'add_network_admin_menu') );
|
|
||||||
|
|
||||||
// Add the script and style files
|
|
||||||
add_action('admin_print_scripts', array(&$this, 'load_scripts') );
|
|
||||||
add_action('admin_print_styles', array(&$this, 'load_styles') );
|
|
||||||
|
|
||||||
add_filter('contextual_help', array(&$this, 'show_help'), 10, 2);
|
|
||||||
add_filter('screen_meta_screen', array(&$this, 'edit_screen_meta'));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// integrate the menu
|
|
||||||
function add_menu() {
|
|
||||||
|
|
||||||
add_menu_page( _n( 'Gallery', 'Galleries', 1, 'nggallery' ), _n( 'Gallery', 'Galleries', 1, 'nggallery' ), 'NextGEN Gallery overview', NGGFOLDER, array (&$this, 'show_menu'), 'div' );
|
|
||||||
add_submenu_page( NGGFOLDER , __('Overview', 'nggallery'), __('Overview', 'nggallery'), 'NextGEN Gallery overview', NGGFOLDER, array (&$this, 'show_menu'));
|
|
||||||
add_submenu_page( NGGFOLDER , __('Add Gallery / Images', 'nggallery'), __('Add Gallery / Images', 'nggallery'), 'NextGEN Upload images', 'nggallery-add-gallery', array (&$this, 'show_menu'));
|
|
||||||
add_submenu_page( NGGFOLDER , __('Manage Gallery', 'nggallery'), __('Manage Gallery', 'nggallery'), 'NextGEN Manage gallery', 'nggallery-manage-gallery', array (&$this, 'show_menu'));
|
|
||||||
add_submenu_page( NGGFOLDER , _n( 'Album', 'Albums', 1, 'nggallery' ), _n( 'Album', 'Albums', 1, 'nggallery' ), 'NextGEN Edit album', 'nggallery-manage-album', array (&$this, 'show_menu'));
|
|
||||||
add_submenu_page( NGGFOLDER , __('Tags', 'nggallery'), __('Tags', 'nggallery'), 'NextGEN Manage tags', 'nggallery-tags', array (&$this, 'show_menu'));
|
|
||||||
add_submenu_page( NGGFOLDER , __('Options', 'nggallery'), __('Options', 'nggallery'), 'NextGEN Change options', 'nggallery-options', array (&$this, 'show_menu'));
|
|
||||||
if ( wpmu_enable_function('wpmuStyle') )
|
|
||||||
add_submenu_page( NGGFOLDER , __('Style', 'nggallery'), __('Style', 'nggallery'), 'NextGEN Change style', 'nggallery-style', array (&$this, 'show_menu'));
|
|
||||||
if ( wpmu_enable_function('wpmuRoles') || wpmu_site_admin() )
|
|
||||||
add_submenu_page( NGGFOLDER , __('Roles', 'nggallery'), __('Roles', 'nggallery'), 'activate_plugins', 'nggallery-roles', array (&$this, 'show_menu'));
|
|
||||||
add_submenu_page( NGGFOLDER , __('About this Gallery', 'nggallery'), __('About', 'nggallery'), 'NextGEN Gallery overview', 'nggallery-about', array (&$this, 'show_menu'));
|
|
||||||
//TODO: Remove after WP 3.1 release, not longer needed
|
|
||||||
if ( is_multisite() && wpmu_site_admin() )
|
|
||||||
add_submenu_page( 'ms-admin.php' , __('NextGEN Gallery', 'nggallery'), __('NextGEN Gallery', 'nggallery'), 'activate_plugins', 'nggallery-wpmu', array (&$this, 'show_menu'));
|
|
||||||
|
|
||||||
if ( !is_multisite() || wpmu_site_admin() )
|
|
||||||
add_submenu_page( NGGFOLDER , __('Reset / Uninstall', 'nggallery'), __('Reset / Uninstall', 'nggallery'), 'activate_plugins', 'nggallery-setup', array (&$this, 'show_menu'));
|
|
||||||
|
|
||||||
//register the column fields
|
|
||||||
$this->register_columns();
|
|
||||||
}
|
|
||||||
|
|
||||||
// integrate the network menu
|
|
||||||
function add_network_admin_menu() {
|
|
||||||
|
|
||||||
add_menu_page( _n( 'Gallery', 'Galleries', 1, 'nggallery' ), _n( 'Gallery', 'Galleries', 1, 'nggallery' ), 'nggallery-wpmu', NGGFOLDER, array (&$this, 'show_network_settings'), 'div' );
|
|
||||||
add_submenu_page( NGGFOLDER , __('Network settings', 'nggallery'), __('Network settings', 'nggallery'), 'nggallery-wpmu', NGGFOLDER, array (&$this, 'show_network_settings'));
|
|
||||||
add_submenu_page( NGGFOLDER , __('Reset / Uninstall', 'nggallery'), __('Reset / Uninstall', 'nggallery'), 'activate_plugins', 'nggallery-setup', array (&$this, 'show_menu'));
|
|
||||||
}
|
|
||||||
|
|
||||||
// show the network page
|
|
||||||
function show_network_settings() {
|
|
||||||
include_once ( dirname (__FILE__) . '/style.php' );
|
|
||||||
include_once ( dirname (__FILE__) . '/wpmu.php' );
|
|
||||||
nggallery_wpmu_setup();
|
|
||||||
}
|
|
||||||
|
|
||||||
// load the script for the defined page and load only this code
|
|
||||||
function show_menu() {
|
|
||||||
|
|
||||||
global $ngg;
|
|
||||||
|
|
||||||
// check for upgrade and show upgrade screen
|
|
||||||
if( get_option( 'ngg_db_version' ) != NGG_DBVERSION ) {
|
|
||||||
include_once ( dirname (__FILE__) . '/functions.php' );
|
|
||||||
include_once ( dirname (__FILE__) . '/upgrade.php' );
|
|
||||||
nggallery_upgrade_page();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set installation date
|
|
||||||
if( empty($ngg->options['installDate']) ) {
|
|
||||||
$ngg->options['installDate'] = time();
|
|
||||||
update_option('ngg_options', $ngg->options);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show donation message only one time.
|
|
||||||
if (isset ( $_GET['hide_donation']) ) {
|
|
||||||
$ngg->options['hideDonation'] = true;
|
|
||||||
update_option('ngg_options', $ngg->options);
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !isset ( $ngg->options['hideDonation']) || $ngg->options['hideDonation'] !== true ) {
|
|
||||||
if ( time() > ( $ngg->options['installDate'] + ( 60 * 60 * 24 * 30 ) ) ) {
|
|
||||||
?>
|
|
||||||
<div id="donator_message">
|
|
||||||
<p><?php echo str_replace('%s', 'http://alexrabe.de/donation', __('Thanks for using this plugin, I hope you are satisfied ! If you would like to support the further development, please consider a <strong><a href="%s">donation</a></strong>! If you still need some help, please post your questions <a href="http://wordpress.org/tags/nextgen-gallery?forum_id=10">here</a> .', 'nggallery')); ?>
|
|
||||||
<span>
|
|
||||||
<a href="<?php echo add_query_arg( array( 'hide_donation' => 'true') ); ?>" >
|
|
||||||
<small><?php _e('OK, hide this message now !', 'nggallery'); ?></small>
|
|
||||||
</a>
|
|
||||||
<span>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ($_GET['page']){
|
|
||||||
case "nggallery-add-gallery" :
|
|
||||||
include_once ( dirname (__FILE__) . '/functions.php' ); // admin functions
|
|
||||||
include_once ( dirname (__FILE__) . '/addgallery.php' ); // nggallery_admin_add_gallery
|
|
||||||
$ngg->addgallery_page = new nggAddGallery ();
|
|
||||||
$ngg->addgallery_page->controller();
|
|
||||||
break;
|
|
||||||
case "nggallery-manage-gallery" :
|
|
||||||
include_once ( dirname (__FILE__) . '/functions.php' ); // admin functions
|
|
||||||
include_once ( dirname (__FILE__) . '/manage.php' ); // nggallery_admin_manage_gallery
|
|
||||||
// Initate the Manage Gallery page
|
|
||||||
$ngg->manage_page = new nggManageGallery ();
|
|
||||||
// Render the output now, because you cannot access a object during the constructor is not finished
|
|
||||||
$ngg->manage_page->controller();
|
|
||||||
break;
|
|
||||||
case "nggallery-manage-album" :
|
|
||||||
include_once ( dirname (__FILE__) . '/album.php' ); // nggallery_admin_manage_album
|
|
||||||
$ngg->manage_album = new nggManageAlbum ();
|
|
||||||
$ngg->manage_album->controller();
|
|
||||||
break;
|
|
||||||
case "nggallery-options" :
|
|
||||||
include_once ( dirname (__FILE__) . '/settings.php' ); // nggallery_admin_options
|
|
||||||
$ngg->option_page = new nggOptions ();
|
|
||||||
$ngg->option_page->controller();
|
|
||||||
break;
|
|
||||||
case "nggallery-tags" :
|
|
||||||
include_once ( dirname (__FILE__) . '/tags.php' ); // nggallery_admin_tags
|
|
||||||
break;
|
|
||||||
case "nggallery-style" :
|
|
||||||
include_once ( dirname (__FILE__) . '/style.php' ); // nggallery_admin_style
|
|
||||||
nggallery_admin_style();
|
|
||||||
break;
|
|
||||||
case "nggallery-setup" :
|
|
||||||
include_once ( dirname (__FILE__) . '/setup.php' ); // nggallery_admin_setup
|
|
||||||
nggallery_admin_setup();
|
|
||||||
break;
|
|
||||||
case "nggallery-roles" :
|
|
||||||
include_once ( dirname (__FILE__) . '/roles.php' ); // nggallery_admin_roles
|
|
||||||
nggallery_admin_roles();
|
|
||||||
break;
|
|
||||||
case "nggallery-import" :
|
|
||||||
include_once ( dirname (__FILE__) . '/myimport.php' ); // nggallery_admin_import
|
|
||||||
nggallery_admin_import();
|
|
||||||
break;
|
|
||||||
case "nggallery-about" :
|
|
||||||
include_once ( dirname (__FILE__) . '/about.php' ); // nggallery_admin_about
|
|
||||||
nggallery_admin_about();
|
|
||||||
break;
|
|
||||||
//TODO: Remove after WP 3.1 release, not longer needed
|
|
||||||
case "nggallery-wpmu" :
|
|
||||||
include_once ( dirname (__FILE__) . '/style.php' );
|
|
||||||
include_once ( dirname (__FILE__) . '/wpmu.php' ); // nggallery_wpmu_admin
|
|
||||||
nggallery_wpmu_setup();
|
|
||||||
break;
|
|
||||||
case "nggallery" :
|
|
||||||
default :
|
|
||||||
include_once ( dirname (__FILE__) . '/overview.php' ); // nggallery_admin_overview
|
|
||||||
nggallery_admin_overview();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function load_scripts() {
|
|
||||||
global $wp_version;
|
|
||||||
|
|
||||||
// no need to go on if it's not a plugin page
|
|
||||||
if( !isset($_GET['page']) )
|
|
||||||
return;
|
|
||||||
|
|
||||||
wp_register_script('ngg-ajax', NGGALLERY_URLPATH . 'admin/js/ngg.ajax.js', array('jquery'), '1.4.1');
|
|
||||||
wp_localize_script('ngg-ajax', 'nggAjaxSetup', array(
|
|
||||||
'url' => admin_url('admin-ajax.php'),
|
|
||||||
'action' => 'ngg_ajax_operation',
|
|
||||||
'operation' => '',
|
|
||||||
'nonce' => wp_create_nonce( 'ngg-ajax' ),
|
|
||||||
'ids' => '',
|
|
||||||
'permission' => __('You do not have the correct permission', 'nggallery'),
|
|
||||||
'error' => __('Unexpected Error', 'nggallery'),
|
|
||||||
'failure' => __('A failure occurred', 'nggallery')
|
|
||||||
) );
|
|
||||||
wp_register_script('ngg-progressbar', NGGALLERY_URLPATH .'admin/js/ngg.progressbar.js', array('jquery'), '2.0.1');
|
|
||||||
wp_register_script('swfupload_f10', NGGALLERY_URLPATH .'admin/js/swfupload.js', array('jquery'), '2.2.0');
|
|
||||||
// Until release of 3.1 not used, due to script conflict
|
|
||||||
wp_register_script('jquery-ui-autocomplete', NGGALLERY_URLPATH .'admin/js/jquery.ui.autocomplete.min.js', array('jquery-ui-core', 'jquery-ui-widget'), '1.8.9');
|
|
||||||
|
|
||||||
switch ($_GET['page']) {
|
|
||||||
case NGGFOLDER :
|
|
||||||
wp_enqueue_script( 'postbox' );
|
|
||||||
add_thickbox();
|
|
||||||
break;
|
|
||||||
case "nggallery-manage-gallery" :
|
|
||||||
wp_enqueue_script( 'postbox' );
|
|
||||||
wp_enqueue_script( 'ngg-ajax' );
|
|
||||||
wp_enqueue_script( 'ngg-progressbar' );
|
|
||||||
wp_enqueue_script( 'jquery-ui-dialog' );
|
|
||||||
add_thickbox();
|
|
||||||
break;
|
|
||||||
case "nggallery-manage-album" :
|
|
||||||
if ( version_compare( $wp_version, '3.0.999', '>' ) ) {
|
|
||||||
wp_enqueue_script( 'jquery-ui-autocomplete' );
|
|
||||||
wp_enqueue_script( 'jquery-ui-dialog' );
|
|
||||||
wp_enqueue_script( 'jquery-ui-sortable' );
|
|
||||||
wp_enqueue_script( 'ngg-autocomplete', NGGALLERY_URLPATH .'admin/js/ngg.autocomplete.js', array('jquery-ui-autocomplete'), '1.0');
|
|
||||||
} else {
|
|
||||||
// Due to script conflict with jQuery UI 1.8.6
|
|
||||||
wp_deregister_script( 'jquery-ui-sortable' );
|
|
||||||
// Package included sortable, dialog, autocomplete, tabs
|
|
||||||
wp_enqueue_script('jquery-ui', NGGALLERY_URLPATH .'admin/js/jquery-ui-1.8.6.min.js', array('jquery'), '1.8.6');
|
|
||||||
wp_enqueue_script('ngg-autocomplete', NGGALLERY_URLPATH .'admin/js/ngg.autocomplete.js', array('jquery-ui'), '1.0');
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "nggallery-options" :
|
|
||||||
wp_enqueue_script( 'jquery-ui-tabs' );
|
|
||||||
//wp_enqueue_script( 'ngg-colorpicker', NGGALLERY_URLPATH .'admin/js/colorpicker/js/colorpicker.js', array('jquery'), '1.0');
|
|
||||||
break;
|
|
||||||
case "nggallery-add-gallery" :
|
|
||||||
wp_enqueue_script( 'jquery-ui-tabs' );
|
|
||||||
wp_enqueue_script( 'mutlifile', NGGALLERY_URLPATH .'admin/js/jquery.MultiFile.js', array('jquery'), '1.4.4' );
|
|
||||||
wp_enqueue_script( 'ngg-swfupload-handler', NGGALLERY_URLPATH .'admin/js/swfupload.handler.js', array('swfupload_f10'), '1.0.3' );
|
|
||||||
wp_enqueue_script( 'ngg-ajax' );
|
|
||||||
wp_enqueue_script( 'ngg-progressbar' );
|
|
||||||
wp_enqueue_script( 'jquery-ui-dialog' );
|
|
||||||
wp_enqueue_script( 'jqueryFileTree', NGGALLERY_URLPATH .'admin/js/jqueryFileTree/jqueryFileTree.js', array('jquery'), '1.0.1' );
|
|
||||||
break;
|
|
||||||
case "nggallery-style" :
|
|
||||||
wp_enqueue_script( 'codepress' );
|
|
||||||
wp_enqueue_script( 'ngg-colorpicker', NGGALLERY_URLPATH .'admin/js/colorpicker/js/colorpicker.js', array('jquery'), '1.0');
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function load_styles() {
|
|
||||||
// load the icon for the navigation menu
|
|
||||||
wp_enqueue_style( 'nggmenu', NGGALLERY_URLPATH .'admin/css/menu.css', array() );
|
|
||||||
wp_register_style( 'nggadmin', NGGALLERY_URLPATH .'admin/css/nggadmin.css', false, '2.8.1', 'screen' );
|
|
||||||
wp_register_style( 'ngg-jqueryui', NGGALLERY_URLPATH .'admin/css/jquery.ui.css', false, '1.8.5', 'screen' );
|
|
||||||
|
|
||||||
// no need to go on if it's not a plugin page
|
|
||||||
if( !isset($_GET['page']) )
|
|
||||||
return;
|
|
||||||
|
|
||||||
switch ($_GET['page']) {
|
|
||||||
case NGGFOLDER :
|
|
||||||
wp_enqueue_style( 'thickbox' );
|
|
||||||
case "nggallery-about" :
|
|
||||||
wp_enqueue_style( 'nggadmin' );
|
|
||||||
wp_admin_css( 'css/dashboard' );
|
|
||||||
break;
|
|
||||||
case "nggallery-add-gallery" :
|
|
||||||
wp_enqueue_style( 'ngg-jqueryui' );
|
|
||||||
wp_enqueue_style( 'jqueryFileTree', NGGALLERY_URLPATH .'admin/js/jqueryFileTree/jqueryFileTree.css', false, '1.0.1', 'screen' );
|
|
||||||
case "nggallery-options" :
|
|
||||||
wp_enqueue_style( 'nggtabs', NGGALLERY_URLPATH .'admin/css/jquery.ui.tabs.css', false, '2.5.0', 'screen' );
|
|
||||||
wp_enqueue_style( 'nggadmin' );
|
|
||||||
break;
|
|
||||||
case "nggallery-manage-gallery" :
|
|
||||||
case "nggallery-roles" :
|
|
||||||
case "nggallery-manage-album" :
|
|
||||||
wp_enqueue_style( 'ngg-jqueryui' );
|
|
||||||
wp_enqueue_style( 'nggadmin' );
|
|
||||||
wp_enqueue_style( 'thickbox' );
|
|
||||||
break;
|
|
||||||
case "nggallery-tags" :
|
|
||||||
wp_enqueue_style( 'nggtags', NGGALLERY_URLPATH .'admin/css/tags-admin.css', false, '2.6.1', 'screen' );
|
|
||||||
break;
|
|
||||||
case "nggallery-style" :
|
|
||||||
wp_admin_css( 'css/theme-editor' );
|
|
||||||
wp_enqueue_style('nggcolorpicker', NGGALLERY_URLPATH.'admin/js/colorpicker/css/colorpicker.css', false, '1.0', 'screen');
|
|
||||||
wp_enqueue_style('nggadmincp', NGGALLERY_URLPATH.'admin/css/nggColorPicker.css', false, '1.0', 'screen');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function show_help($help, $screen) {
|
|
||||||
|
|
||||||
// since WP3.0 it's an object
|
|
||||||
if ( is_object($screen) )
|
|
||||||
$screen = $screen->id;
|
|
||||||
|
|
||||||
$link = '';
|
|
||||||
// menu title is localized...
|
|
||||||
$i18n = strtolower ( _n( 'Gallery', 'Galleries', 1, 'nggallery' ) );
|
|
||||||
|
|
||||||
switch ($screen) {
|
|
||||||
case 'toplevel_page_' . NGGFOLDER :
|
|
||||||
$link = __('<a href="http://dpotter.net/Technical/2008/03/nextgen-gallery-review-introduction/" target="_blank">Introduction</a>', 'nggallery');
|
|
||||||
break;
|
|
||||||
case "{$i18n}_page_nggallery-setup" :
|
|
||||||
$link = __('<a href="http://dpotter.net/Technical/2008/03/nextgen-gallery-review-introduction/" target="_blank">Setup</a>', 'nggallery');
|
|
||||||
break;
|
|
||||||
case "{$i18n}_page_nggallery-about" :
|
|
||||||
$link = __('<a href="http://alexrabe.de/wordpress-plugins/nextgen-gallery/languages/" target="_blank">Translation by alex rabe</a>', 'nggallery');
|
|
||||||
break;
|
|
||||||
case "{$i18n}_page_nggallery-roles" :
|
|
||||||
$link = __('<a href="http://dpotter.net/Technical/2008/03/nextgen-gallery-review-introduction/" target="_blank">Roles / Capabilities</a>', 'nggallery');
|
|
||||||
break;
|
|
||||||
case "{$i18n}_page_nggallery-style" :
|
|
||||||
$link = __('<a href="http://dpotter.net/Technical/2008/03/nextgen-gallery-review-introduction/" target="_blank">Styles</a>', 'nggallery');
|
|
||||||
$link .= ' | <a href="http://nextgen-gallery.com/templates/" target="_blank">' . __('Templates', 'nggallery') . '</a>';
|
|
||||||
break;
|
|
||||||
case "{$i18n}_page_nggallery-gallery" :
|
|
||||||
$link = __('<a href="http://dpotter.net/Technical/2008/03/nextgen-gallery-review-introduction/" target="_blank">Gallery management</a>', 'nggallery');
|
|
||||||
$link .= ' | <a href="http://nextgen-gallery.com/gallery-page/" target="_blank">' . __('Gallery example', 'nggallery') . '</a>';
|
|
||||||
break;
|
|
||||||
case "{$i18n}_page_nggallery-manage-gallery" :
|
|
||||||
case "nggallery-manage-gallery":
|
|
||||||
case "nggallery-manage-images":
|
|
||||||
$link = __('<a href="http://dpotter.net/Technical/2008/03/nextgen-gallery-review-introduction/" target="_blank">Gallery management</a>', 'nggallery');
|
|
||||||
$link .= ' | <a href="http://nextgen-gallery.com/gallery-tags/" target="_blank">' . __('Gallery tags', 'nggallery') . '</a>';
|
|
||||||
break;
|
|
||||||
case "{$i18n}_page_nggallery-manage-album" :
|
|
||||||
$link = __('<a href="http://dpotter.net/Technical/2008/03/nextgen-gallery-review-introduction/" target="_blank">Album management</a>', 'nggallery');
|
|
||||||
$link .= ' | <a href="http://nextgen-gallery.com/album/" target="_blank">' . __('Album example', 'nggallery') . '</a>';
|
|
||||||
$link .= ' | <a href="http://nextgen-gallery.com/albumtags/" target="_blank">' . __('Album tags', 'nggallery') . '</a>';
|
|
||||||
break;
|
|
||||||
case "{$i18n}_page_nggallery-tags" :
|
|
||||||
$link = __('<a href="http://dpotter.net/Technical/2008/03/nextgen-gallery-review-introduction/" target="_blank">Gallery tags</a>', 'nggallery');
|
|
||||||
$link .= ' | <a href="http://nextgen-gallery.com/related-images/" target="_blank">' . __('Related images', 'nggallery') . '</a>';
|
|
||||||
$link .= ' | <a href="http://nextgen-gallery.com/gallery-tags/" target="_blank">' . __('Gallery tags', 'nggallery') . '</a>';
|
|
||||||
$link .= ' | <a href="http://nextgen-gallery.com/albumtags/" target="_blank">' . __('Album tags', 'nggallery') . '</a>';
|
|
||||||
break;
|
|
||||||
case "{$i18n}_page_nggallery-options" :
|
|
||||||
$link = __('<a href="http://dpotter.net/Technical/2008/03/nextgen-gallery-review-image-management/" target="_blank">Image management</a>', 'nggallery');
|
|
||||||
$link .= ' | <a href="http://nextgen-gallery.com/custom-fields/" target="_blank">' . __('Custom fields', 'nggallery') . '</a>';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !empty($link) ) {
|
|
||||||
$help = '<h5>' . __('Get help with NextGEN Gallery', 'nggallery') . '</h5>';
|
|
||||||
$help .= '<div class="metabox-prefs">';
|
|
||||||
$help .= $link;
|
|
||||||
$help .= "</div>\n";
|
|
||||||
$help .= '<h5>' . __('More Help & Info', 'nggallery') . '</h5>';
|
|
||||||
$help .= '<div class="metabox-prefs">';
|
|
||||||
$help .= __('<a href="http://wordpress.org/tags/nextgen-gallery?forum_id=10" target="_blank">Support Forums</a>', 'nggallery');
|
|
||||||
$help .= ' | <a href="http://alexrabe.de/wordpress-plugins/nextgen-gallery/faq/" target="_blank">' . __('FAQ', 'nggallery') . '</a>';
|
|
||||||
$help .= ' | <a href="http://code.google.com/p/nextgen-gallery/issues/list" target="_blank">' . __('Feature request', 'nggallery') . '</a>';
|
|
||||||
$help .= ' | <a href="http://alexrabe.de/wordpress-plugins/nextgen-gallery/languages/" target="_blank">' . __('Get your language pack', 'nggallery') . '</a>';
|
|
||||||
$help .= ' | <a href="http://code.google.com/p/nextgen-gallery/" target="_blank">' . __('Contribute development', 'nggallery') . '</a>';
|
|
||||||
$help .= ' | <a href="http://wordpress.org/extend/plugins/nextgen-gallery" target="_blank">' . __('Download latest version', 'nggallery') . '</a>';
|
|
||||||
$help .= "</div>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
return $help;
|
|
||||||
}
|
|
||||||
|
|
||||||
function edit_screen_meta($screen) {
|
|
||||||
|
|
||||||
// menu title is localized, so we need to change the toplevel name
|
|
||||||
$i18n = strtolower ( _n( 'Gallery', 'Galleries', 1, 'nggallery' ) );
|
|
||||||
|
|
||||||
switch ($screen) {
|
|
||||||
case "{$i18n}_page_nggallery-manage-gallery" :
|
|
||||||
// we would like to have screen option only at the manage images / gallery page
|
|
||||||
if ( isset ($_POST['sortGallery']) )
|
|
||||||
$screen = $screen;
|
|
||||||
else if ( ($_GET['mode'] == 'edit') || isset ($_POST['backToGallery']) )
|
|
||||||
$screen = 'nggallery-manage-images';
|
|
||||||
else if ( ($_GET['mode'] == 'sort') )
|
|
||||||
$screen = $screen;
|
|
||||||
else
|
|
||||||
$screen = 'nggallery-manage-gallery';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $screen;
|
|
||||||
}
|
|
||||||
|
|
||||||
function register_column_headers($screen, $columns) {
|
|
||||||
global $_wp_column_headers, $wp_list_table;
|
|
||||||
|
|
||||||
if ( !isset($_wp_column_headers) )
|
|
||||||
$_wp_column_headers = array();
|
|
||||||
|
|
||||||
$_wp_column_headers[$screen] = $columns;
|
|
||||||
|
|
||||||
//TODO: Deprecated in 3.1, see http://core.trac.wordpress.org/ticket/14579
|
|
||||||
//$wp_list_table = new _WP_List_Table_Compat($screen);
|
|
||||||
//$wp_list_table->_columns = $columns;
|
|
||||||
}
|
|
||||||
|
|
||||||
function register_columns() {
|
|
||||||
include_once ( dirname (__FILE__) . '/manage-images.php' );
|
|
||||||
|
|
||||||
$this->register_column_headers('nggallery-manage-images', ngg_manage_image_columns() );
|
|
||||||
|
|
||||||
include_once ( dirname (__FILE__) . '/manage-galleries.php' );
|
|
||||||
|
|
||||||
$this->register_column_headers('nggallery-manage-galleries', ngg_manage_gallery_columns() );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Read an array from a remote url
|
|
||||||
*
|
|
||||||
* @param string $url
|
|
||||||
* @return array of the content
|
|
||||||
*/
|
|
||||||
function get_remote_array($url) {
|
|
||||||
if ( function_exists('wp_remote_request') ) {
|
|
||||||
|
|
||||||
$options = array();
|
|
||||||
$options['headers'] = array(
|
|
||||||
'User-Agent' => 'NextGEN Gallery Information Reader V' . NGGVERSION . '; (' . get_bloginfo('url') .')'
|
|
||||||
);
|
|
||||||
|
|
||||||
$response = wp_remote_request($url, $options);
|
|
||||||
|
|
||||||
if ( is_wp_error( $response ) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if ( 200 != $response['response']['code'] )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
$content = unserialize($response['body']);
|
|
||||||
|
|
||||||
if (is_array($content))
|
|
||||||
return $content;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function wpmu_site_admin() {
|
|
||||||
// Check for site admin
|
|
||||||
if ( function_exists('is_super_admin') )
|
|
||||||
if ( is_super_admin() )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function wpmu_enable_function($value) {
|
|
||||||
if (is_multisite()) {
|
|
||||||
$ngg_options = get_site_option('ngg_options');
|
|
||||||
return $ngg_options[$value];
|
|
||||||
}
|
|
||||||
// if this is not WPMU, enable it !
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
@ -1,446 +0,0 @@
|
|||||||
<?php
|
|
||||||
add_action('wp_ajax_ngg_ajax_operation', 'ngg_ajax_operation' );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Image edit functions via AJAX
|
|
||||||
*
|
|
||||||
* @author Alex Rabe
|
|
||||||
* @copyright 2008 - 2010
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function ngg_ajax_operation() {
|
|
||||||
|
|
||||||
global $wpdb;
|
|
||||||
|
|
||||||
// if nonce is not correct it returns -1
|
|
||||||
check_ajax_referer( "ngg-ajax" );
|
|
||||||
|
|
||||||
// check for correct capability
|
|
||||||
if ( !is_user_logged_in() )
|
|
||||||
die('-1');
|
|
||||||
|
|
||||||
// check for correct NextGEN capability
|
|
||||||
if ( !current_user_can('NextGEN Upload images') && !current_user_can('NextGEN Manage gallery') )
|
|
||||||
die('-1');
|
|
||||||
|
|
||||||
// include the ngg function
|
|
||||||
include_once (dirname (__FILE__) . '/functions.php');
|
|
||||||
|
|
||||||
// Get the image id
|
|
||||||
if ( isset($_POST['image'])) {
|
|
||||||
$id = (int) $_POST['image'];
|
|
||||||
// let's get the image data
|
|
||||||
$picture = nggdb::find_image( $id );
|
|
||||||
// what do you want to do ?
|
|
||||||
switch ( $_POST['operation'] ) {
|
|
||||||
case 'create_thumbnail' :
|
|
||||||
$result = nggAdmin::create_thumbnail($picture);
|
|
||||||
break;
|
|
||||||
case 'resize_image' :
|
|
||||||
$result = nggAdmin::resize_image($picture);
|
|
||||||
break;
|
|
||||||
case 'rotate_cw' :
|
|
||||||
$result = nggAdmin::rotate_image($picture, 'CW');
|
|
||||||
nggAdmin::create_thumbnail($picture);
|
|
||||||
break;
|
|
||||||
case 'rotate_ccw' :
|
|
||||||
$result = nggAdmin::rotate_image($picture, 'CCW');
|
|
||||||
nggAdmin::create_thumbnail($picture);
|
|
||||||
break;
|
|
||||||
case 'set_watermark' :
|
|
||||||
$result = nggAdmin::set_watermark($picture);
|
|
||||||
break;
|
|
||||||
case 'recover_image' :
|
|
||||||
$result = nggAdmin::recover_image($picture);
|
|
||||||
break;
|
|
||||||
case 'import_metadata' :
|
|
||||||
$result = nggAdmin::import_MetaData( $id );
|
|
||||||
break;
|
|
||||||
case 'get_image_ids' :
|
|
||||||
$result = nggAdmin::get_image_ids( $id );
|
|
||||||
break;
|
|
||||||
default :
|
|
||||||
do_action( 'ngg_ajax_' . $_POST['operation'] );
|
|
||||||
die('-1');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// A success should return a '1'
|
|
||||||
die ($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
// The script should never stop here
|
|
||||||
die('0');
|
|
||||||
}
|
|
||||||
|
|
||||||
add_action('wp_ajax_createNewThumb', 'createNewThumb');
|
|
||||||
|
|
||||||
function createNewThumb() {
|
|
||||||
|
|
||||||
global $ngg;
|
|
||||||
|
|
||||||
// check for correct capability
|
|
||||||
if ( !is_user_logged_in() )
|
|
||||||
die('-1');
|
|
||||||
|
|
||||||
// check for correct NextGEN capability
|
|
||||||
if ( !current_user_can('NextGEN Manage gallery') )
|
|
||||||
die('-1');
|
|
||||||
|
|
||||||
include_once( nggGallery::graphic_library() );
|
|
||||||
|
|
||||||
$id = (int) $_POST['id'];
|
|
||||||
$picture = nggdb::find_image( $id );
|
|
||||||
|
|
||||||
$x = round( $_POST['x'] * $_POST['rr'], 0);
|
|
||||||
$y = round( $_POST['y'] * $_POST['rr'], 0);
|
|
||||||
$w = round( $_POST['w'] * $_POST['rr'], 0);
|
|
||||||
$h = round( $_POST['h'] * $_POST['rr'], 0);
|
|
||||||
|
|
||||||
$thumb = new ngg_Thumbnail($picture->imagePath, TRUE);
|
|
||||||
|
|
||||||
$thumb->crop($x, $y, $w, $h);
|
|
||||||
|
|
||||||
// Note : the routine is a bit different to create_thumbnail(), due to rounding it's resized in the other way
|
|
||||||
if ($ngg->options['thumbfix']) {
|
|
||||||
// check for portrait format
|
|
||||||
if ($thumb->currentDimensions['height'] > $thumb->currentDimensions['width']) {
|
|
||||||
// first resize to the wanted height, here changed to create_thumbnail()
|
|
||||||
$thumb->resize(0, $ngg->options['thumbheight']);
|
|
||||||
// get optimal y startpos
|
|
||||||
$ypos = ($thumb->currentDimensions['height'] - $ngg->options['thumbheight']) / 2;
|
|
||||||
$thumb->crop(0, $ypos, $ngg->options['thumbwidth'],$ngg->options['thumbheight']);
|
|
||||||
} else {
|
|
||||||
// first resize to the wanted width, here changed to create_thumbnail()
|
|
||||||
$thumb->resize($ngg->options['thumbwidth'], 0);
|
|
||||||
//
|
|
||||||
// get optimal x startpos
|
|
||||||
$xpos = ($thumb->currentDimensions['width'] - $ngg->options['thumbwidth']) / 2;
|
|
||||||
$thumb->crop($xpos, 0, $ngg->options['thumbwidth'],$ngg->options['thumbheight']);
|
|
||||||
}
|
|
||||||
//this create a thumbnail but keep ratio settings
|
|
||||||
} else {
|
|
||||||
$thumb->resize($ngg->options['thumbwidth'],$ngg->options['thumbheight']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $thumb->save($picture->thumbPath, 100)) {
|
|
||||||
|
|
||||||
//read the new sizes
|
|
||||||
$new_size = @getimagesize ( $picture->thumbPath );
|
|
||||||
$size['width'] = $new_size[0];
|
|
||||||
$size['height'] = $new_size[1];
|
|
||||||
|
|
||||||
// add them to the database
|
|
||||||
nggdb::update_image_meta($picture->pid, array( 'thumbnail' => $size) );
|
|
||||||
|
|
||||||
echo "OK";
|
|
||||||
} else {
|
|
||||||
header('HTTP/1.1 500 Internal Server Error');
|
|
||||||
echo "KO";
|
|
||||||
}
|
|
||||||
|
|
||||||
exit();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
add_action('wp_ajax_rotateImage', 'ngg_rotateImage');
|
|
||||||
|
|
||||||
function ngg_rotateImage() {
|
|
||||||
|
|
||||||
// check for correct capability
|
|
||||||
if ( !is_user_logged_in() )
|
|
||||||
die('-1');
|
|
||||||
|
|
||||||
// check for correct NextGEN capability
|
|
||||||
if ( !current_user_can('NextGEN Manage gallery') )
|
|
||||||
die('-1');
|
|
||||||
|
|
||||||
require_once( dirname( dirname(__FILE__) ) . '/ngg-config.php');
|
|
||||||
|
|
||||||
// include the ngg function
|
|
||||||
include_once (dirname (__FILE__). '/functions.php');
|
|
||||||
|
|
||||||
$ngg_options = get_option('ngg_options');
|
|
||||||
|
|
||||||
$id = (int) $_POST['id'];
|
|
||||||
$result = '-1';
|
|
||||||
|
|
||||||
switch ( $_POST['ra'] ) {
|
|
||||||
case 'cw' :
|
|
||||||
$result = nggAdmin::rotate_image($id, 'CW');
|
|
||||||
break;
|
|
||||||
case 'ccw' :
|
|
||||||
$result = nggAdmin::rotate_image($id, 'CCW');
|
|
||||||
break;
|
|
||||||
case 'fv' :
|
|
||||||
$result = nggAdmin::rotate_image($id, 0, 'V');
|
|
||||||
break;
|
|
||||||
case 'fh' :
|
|
||||||
$result = nggAdmin::rotate_image($id, 0, 'H');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// recreate the thumbnail
|
|
||||||
nggAdmin::create_thumbnail($id);
|
|
||||||
|
|
||||||
if ( $result == 1 )
|
|
||||||
die('1');
|
|
||||||
|
|
||||||
header('HTTP/1.1 500 Internal Server Error');
|
|
||||||
die( $result );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
add_action('wp_ajax_ngg_dashboard', 'ngg_ajax_dashboard');
|
|
||||||
|
|
||||||
function ngg_ajax_dashboard() {
|
|
||||||
|
|
||||||
require_once( dirname( dirname(__FILE__) ) . '/admin/admin.php');
|
|
||||||
require_once( dirname( dirname(__FILE__) ) . '/admin/overview.php');
|
|
||||||
|
|
||||||
if ( !current_user_can('NextGEN Gallery overview') )
|
|
||||||
die('-1');
|
|
||||||
|
|
||||||
@header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
|
|
||||||
@header( 'X-Content-Type-Options: nosniff' );
|
|
||||||
|
|
||||||
switch ( $_GET['jax'] ) {
|
|
||||||
|
|
||||||
case 'ngg_lastdonators' :
|
|
||||||
ngg_overview_donators();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'dashboard_primary' :
|
|
||||||
ngg_overview_news();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'ngg_locale' :
|
|
||||||
ngg_locale();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'dashboard_plugins' :
|
|
||||||
ngg_related_plugins();
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
die();
|
|
||||||
}
|
|
||||||
|
|
||||||
add_action('wp_ajax_ngg_file_browser', 'ngg_ajax_file_browser');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* jQuery File Tree PHP Connector
|
|
||||||
* @author Cory S.N. LaViska - A Beautiful Site (http://abeautifulsite.net/)
|
|
||||||
* @version 1.0.1
|
|
||||||
*
|
|
||||||
* @return string folder content
|
|
||||||
*/
|
|
||||||
function ngg_ajax_file_browser() {
|
|
||||||
|
|
||||||
global $ngg;
|
|
||||||
|
|
||||||
// check for correct NextGEN capability
|
|
||||||
if ( !current_user_can('NextGEN Upload images') && !current_user_can('NextGEN Manage gallery') )
|
|
||||||
die('No access');
|
|
||||||
|
|
||||||
if ( !defined('ABSPATH') )
|
|
||||||
die('No access');
|
|
||||||
|
|
||||||
// if nonce is not correct it returns -1
|
|
||||||
check_ajax_referer( 'ngg-ajax', 'nonce' );
|
|
||||||
|
|
||||||
//PHP4 compat script
|
|
||||||
if (!function_exists('scandir')) {
|
|
||||||
function scandir($dir, $listDirectories = false, $skipDots = true ) {
|
|
||||||
$dirArray = array();
|
|
||||||
if ($handle = opendir($dir) ) {
|
|
||||||
while (false !== ($file = readdir($handle))) {
|
|
||||||
if (($file != '.' && $file != '..' ) || $skipDots == true) {
|
|
||||||
if($listDirectories == false) { if(is_dir($file)) { continue; } }
|
|
||||||
array_push($dirArray, basename($file) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
closedir($handle);
|
|
||||||
}
|
|
||||||
return $dirArray;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// start from the default path
|
|
||||||
$root = trailingslashit ( WINABSPATH );
|
|
||||||
// get the current directory
|
|
||||||
$dir = trailingslashit ( urldecode($_POST['dir']) );
|
|
||||||
|
|
||||||
if( file_exists($root . $dir) ) {
|
|
||||||
$files = scandir($root . $dir);
|
|
||||||
natcasesort($files);
|
|
||||||
|
|
||||||
// The 2 counts for . and ..
|
|
||||||
if( count($files) > 2 ) {
|
|
||||||
echo "<ul class=\"jqueryDirTree\" style=\"display: none;\">";
|
|
||||||
|
|
||||||
// return only directories
|
|
||||||
foreach( $files as $file ) {
|
|
||||||
|
|
||||||
//reserved name for the thumnbnails, don't use it as folder name
|
|
||||||
if ( $file == 'thumbs')
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if ( file_exists($root . $dir . $file) && $file != '.' && $file != '..' && is_dir($root . $dir . $file) ) {
|
|
||||||
echo "<li class=\"directory collapsed\"><a href=\"#\" rel=\"" . esc_html($dir . $file) . "/\">" . esc_html($file) . "</a></li>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "</ul>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
die();
|
|
||||||
}
|
|
||||||
|
|
||||||
add_action('wp_ajax_ngg_tinymce', 'ngg_ajax_tinymce');
|
|
||||||
/**
|
|
||||||
* Call TinyMCE window content via admin-ajax
|
|
||||||
*
|
|
||||||
* @since 1.7.0
|
|
||||||
* @return html content
|
|
||||||
*/
|
|
||||||
function ngg_ajax_tinymce() {
|
|
||||||
|
|
||||||
// check for rights
|
|
||||||
if ( !current_user_can('edit_pages') && !current_user_can('edit_posts') )
|
|
||||||
die(__("You are not allowed to be here"));
|
|
||||||
|
|
||||||
include_once( dirname( dirname(__FILE__) ) . '/admin/tinymce/window.php');
|
|
||||||
|
|
||||||
die();
|
|
||||||
}
|
|
||||||
|
|
||||||
add_action( 'wp_ajax_ngg_rebuild_unique_slugs', 'ngg_ajax_rebuild_unique_slugs' );
|
|
||||||
/**
|
|
||||||
* This rebuild the slugs for albums, galleries and images as ajax routine, max 50 elements per request
|
|
||||||
*
|
|
||||||
* @since 1.7.0
|
|
||||||
* @return string '1'
|
|
||||||
*/
|
|
||||||
function ngg_ajax_rebuild_unique_slugs() {
|
|
||||||
global $wpdb;
|
|
||||||
|
|
||||||
$action = $_POST['_action'];
|
|
||||||
$offset = (int) $_POST['offset'];
|
|
||||||
|
|
||||||
switch ($action) {
|
|
||||||
case 'images':
|
|
||||||
$images = $wpdb->get_results("SELECT * FROM $wpdb->nggpictures ORDER BY pid ASC LIMIT $offset, 50", OBJECT_K);
|
|
||||||
if ( is_array($images) ) {
|
|
||||||
foreach ($images as $image) {
|
|
||||||
//slug must be unique, we use the alttext for that
|
|
||||||
$image->slug = nggdb::get_unique_slug( sanitize_title( $image->alttext ), 'image' );
|
|
||||||
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->nggpictures SET image_slug= '%s' WHERE pid = '%d'" , $image->slug, $image->pid ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'gallery':
|
|
||||||
$galleries = $wpdb->get_results("SELECT * FROM $wpdb->nggallery ORDER BY gid ASC LIMIT $offset, 50", OBJECT_K);
|
|
||||||
if ( is_array($galleries) ) {
|
|
||||||
foreach ($galleries as $gallery) {
|
|
||||||
//slug must be unique, we use the title for that
|
|
||||||
$gallery->slug = nggdb::get_unique_slug( sanitize_title( $gallery->title ), 'gallery' );
|
|
||||||
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->nggallery SET slug= '%s' WHERE gid = '%d'" , $gallery->slug, $gallery->gid ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'album':
|
|
||||||
$albumlist = $wpdb->get_results("SELECT * FROM $wpdb->nggalbum ORDER BY id ASC LIMIT $offset, 50", OBJECT_K);
|
|
||||||
if ( is_array($albumlist) ) {
|
|
||||||
foreach ($albumlist as $album) {
|
|
||||||
//slug must be unique, we use the name for that
|
|
||||||
$album->slug = nggdb::get_unique_slug( sanitize_title( $album->name ), 'album' );
|
|
||||||
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->nggalbum SET slug= '%s' WHERE id = '%d'" , $album->slug, $album->id ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
die(1);
|
|
||||||
}
|
|
||||||
add_action('wp_ajax_ngg_image_check', 'ngg_ajax_image_check');
|
|
||||||
/**
|
|
||||||
* Test for various image resolution
|
|
||||||
*
|
|
||||||
* @since 1.7.3
|
|
||||||
* @return result
|
|
||||||
*/
|
|
||||||
function ngg_ajax_image_check() {
|
|
||||||
|
|
||||||
// check for correct NextGEN capability
|
|
||||||
if ( !current_user_can('NextGEN Upload images') )
|
|
||||||
die('No access');
|
|
||||||
|
|
||||||
if ( !defined('ABSPATH') )
|
|
||||||
die('No access');
|
|
||||||
|
|
||||||
$step = (int) $_POST['step'];
|
|
||||||
|
|
||||||
// build the test sizes
|
|
||||||
$sizes = array();
|
|
||||||
$sizes[1] = array ( 'width' => 800, 'height' => 600);
|
|
||||||
$sizes[2] = array ( 'width' => 1024, 'height' => 768);
|
|
||||||
$sizes[3] = array ( 'width' => 1280, 'height' => 960); // 1MP
|
|
||||||
$sizes[4] = array ( 'width' => 1600, 'height' => 1200); // 2MP
|
|
||||||
$sizes[5] = array ( 'width' => 2016, 'height' => 1512); // 3MP
|
|
||||||
$sizes[6] = array ( 'width' => 2272, 'height' => 1704); // 4MP
|
|
||||||
$sizes[7] = array ( 'width' => 2560, 'height' => 1920); // 5MP
|
|
||||||
$sizes[8] = array ( 'width' => 2848, 'height' => 2136); // 6MP
|
|
||||||
$sizes[9] = array ( 'width' => 3072, 'height' => 2304); // 7MP
|
|
||||||
$sizes[10] = array ( 'width' => 3264, 'height' => 2448); // 8MP
|
|
||||||
$sizes[11] = array ( 'width' => 4048, 'height' => 3040); // 12MP
|
|
||||||
|
|
||||||
if ( $step < 1 || $step > 11 )
|
|
||||||
die('No vaild value');
|
|
||||||
|
|
||||||
// let's test each image size
|
|
||||||
$temp = imagecreatetruecolor ($sizes[$step]['width'], $sizes[$step]['height'] );
|
|
||||||
imagedestroy ($temp);
|
|
||||||
|
|
||||||
$result = array ('stat' => 'ok', 'message' => sprintf(__('Could create image with %s x %s pixel', 'nggallery'), $sizes[$step]['width'], $sizes[$step]['height'] ) );
|
|
||||||
|
|
||||||
header('Content-Type: application/json; charset=' . get_option('blog_charset'), true);
|
|
||||||
echo json_encode($result);
|
|
||||||
|
|
||||||
die();
|
|
||||||
}
|
|
||||||
|
|
||||||
add_action('wp_ajax_ngg_test_head_footer', 'ngg_ajax_test_head_footer');
|
|
||||||
/**
|
|
||||||
* Check for the header / footer, parts taken from Matt Martz (http://sivel.net/)
|
|
||||||
*
|
|
||||||
* @see https://gist.github.com/378450
|
|
||||||
* @since 1.7.3
|
|
||||||
* @return result
|
|
||||||
*/
|
|
||||||
function ngg_ajax_test_head_footer() {
|
|
||||||
|
|
||||||
// Build the url to call, NOTE: uses home_url and thus requires WordPress 3.0
|
|
||||||
$url = add_query_arg( array( 'test-head' => '', 'test-footer' => '' ), home_url() );
|
|
||||||
// Perform the HTTP GET ignoring SSL errors
|
|
||||||
$response = wp_remote_get( $url, array( 'sslverify' => false ) );
|
|
||||||
// Grab the response code and make sure the request was sucessful
|
|
||||||
$code = (int) wp_remote_retrieve_response_code( $response );
|
|
||||||
if ( $code == 200 ) {
|
|
||||||
global $head_footer_errors;
|
|
||||||
$head_footer_errors = array();
|
|
||||||
|
|
||||||
// Strip all tabs, line feeds, carriage returns and spaces
|
|
||||||
$html = preg_replace( '/[\t\r\n\s]/', '', wp_remote_retrieve_body( $response ) );
|
|
||||||
|
|
||||||
// Check to see if we found the existence of wp_head
|
|
||||||
if ( ! strstr( $html, '<!--wp_head-->' ) )
|
|
||||||
die('Missing the call to <?php wp_head(); ?> in your theme');
|
|
||||||
// Check to see if we found the existence of wp_footer
|
|
||||||
if ( ! strstr( $html, '<!--wp_footer-->' ) )
|
|
||||||
die('Missing the call to <?php wp_footer(); ?> in your theme');
|
|
||||||
}
|
|
||||||
die('success');
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
@ -1,582 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
|
|
||||||
|
|
||||||
class nggManageAlbum {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The selected album ID
|
|
||||||
*
|
|
||||||
* @since 1.3.0
|
|
||||||
* @access privat
|
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
var $currentID = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The array for the galleries
|
|
||||||
*
|
|
||||||
* @since 1.3.0
|
|
||||||
* @access privat
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
var $galleries = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The array for the albums
|
|
||||||
*
|
|
||||||
* @since 1.3.0
|
|
||||||
* @access privat
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
var $albums = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The amount of all galleries
|
|
||||||
*
|
|
||||||
* @since 1.4.0
|
|
||||||
* @access privat
|
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
var $num_galleries = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The amount of all albums
|
|
||||||
*
|
|
||||||
* @since 1.4.0
|
|
||||||
* @access privat
|
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
var $num_albums = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PHP4 compatibility layer for calling the PHP5 constructor.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
function nggManageAlbum() {
|
|
||||||
return $this->__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Init the album output
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
function __construct() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function controller() {
|
|
||||||
global $nggdb;
|
|
||||||
|
|
||||||
$this->currentID = isset($_POST['act_album']) ? (int) $_POST['act_album'] : 0 ;
|
|
||||||
|
|
||||||
if (isset ($_POST['update']) || isset( $_POST['delete'] ) || isset( $_POST['add'] ) )
|
|
||||||
$this->processor();
|
|
||||||
|
|
||||||
if (isset ($_POST['update_album']) )
|
|
||||||
$this->update_album();
|
|
||||||
|
|
||||||
// get first all galleries & albums
|
|
||||||
$this->albums = $nggdb->find_all_album();
|
|
||||||
$this->galleries = $nggdb->find_all_galleries();
|
|
||||||
$this->num_albums = count( $this->albums );
|
|
||||||
$this->num_galleries = count( $this->galleries );
|
|
||||||
$this->output();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function processor() {
|
|
||||||
global $wpdb;
|
|
||||||
|
|
||||||
check_admin_referer('ngg_album');
|
|
||||||
|
|
||||||
if ( isset($_POST['add']) && isset ($_POST['newalbum']) ) {
|
|
||||||
|
|
||||||
if (!nggGallery::current_user_can( 'NextGEN Add/Delete album' ))
|
|
||||||
wp_die(__('Cheatin’ uh?'));
|
|
||||||
|
|
||||||
$result = nggdb::add_album( $_POST['newalbum'] );
|
|
||||||
$this->currentID = ($result) ? $result : 0 ;
|
|
||||||
|
|
||||||
if ($result)
|
|
||||||
nggGallery::show_message(__('Update Successfully','nggallery'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( isset($_POST['update']) && ($this->currentID > 0) ) {
|
|
||||||
|
|
||||||
$gid = '';
|
|
||||||
|
|
||||||
// get variable galleryContainer
|
|
||||||
parse_str($_POST['sortorder']);
|
|
||||||
if ( is_array($gid) ){
|
|
||||||
$serial_sort = serialize($gid);
|
|
||||||
$wpdb->query("UPDATE $wpdb->nggalbum SET sortorder = '$serial_sort' WHERE id = $this->currentID ");
|
|
||||||
} else {
|
|
||||||
$wpdb->query("UPDATE $wpdb->nggalbum SET sortorder = '0' WHERE id = $this->currentID ");
|
|
||||||
}
|
|
||||||
nggGallery::show_message(__('Update Successfully','nggallery'));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( isset($_POST['delete']) ) {
|
|
||||||
|
|
||||||
if (!nggGallery::current_user_can( 'NextGEN Add/Delete album' ))
|
|
||||||
wp_die(__('Cheatin’ uh?'));
|
|
||||||
|
|
||||||
$result = nggdb::delete_album( $this->currentID );
|
|
||||||
|
|
||||||
$this->currentID = 0;
|
|
||||||
|
|
||||||
if ($result)
|
|
||||||
nggGallery::show_message(__('Album deleted','nggallery'));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function update_album() {
|
|
||||||
global $wpdb, $nggdb;
|
|
||||||
|
|
||||||
check_admin_referer('ngg_thickbox_form');
|
|
||||||
|
|
||||||
if (!nggGallery::current_user_can( 'NextGEN Edit album settings' ))
|
|
||||||
wp_die(__('Cheatin’ uh?'));
|
|
||||||
|
|
||||||
$name = $_POST['album_name'];
|
|
||||||
$desc = $_POST['album_desc'];
|
|
||||||
$prev = (int) $_POST['previewpic'];
|
|
||||||
$link = (int) $_POST['pageid'];
|
|
||||||
|
|
||||||
// slug must be unique, we use the title for that
|
|
||||||
$slug = nggdb::get_unique_slug( sanitize_title( $name ), 'album' );
|
|
||||||
|
|
||||||
$result = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->nggalbum SET slug= '%s', name= '%s', albumdesc= '%s', previewpic= %d, pageid= %d WHERE id = '%d'" , $slug, $name, $desc, $prev, $link, $this->currentID ) );
|
|
||||||
|
|
||||||
//hook for other plugin to update the fields
|
|
||||||
do_action('ngg_update_album', $this->currentID, $_POST);
|
|
||||||
|
|
||||||
if ($result)
|
|
||||||
nggGallery::show_message(__('Update Successfully','nggallery'));
|
|
||||||
}
|
|
||||||
|
|
||||||
function output() {
|
|
||||||
|
|
||||||
global $wpdb, $nggdb;
|
|
||||||
|
|
||||||
//TODO:Code MUST be optimized, how to flag a used gallery better ?
|
|
||||||
$used_list = $this->get_used_galleries();
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
|
|
||||||
jQuery(document).ready(
|
|
||||||
function()
|
|
||||||
{
|
|
||||||
jQuery("#previewpic").nggAutocomplete( {
|
|
||||||
type: 'image',domain: "<?php echo site_url(); ?>/"
|
|
||||||
});
|
|
||||||
|
|
||||||
jQuery('#selectContainer').sortable( {
|
|
||||||
items: '.groupItem',
|
|
||||||
placeholder: 'sort_placeholder',
|
|
||||||
opacity: 0.7,
|
|
||||||
tolerance: 'intersect',
|
|
||||||
distance: 2,
|
|
||||||
forcePlaceholderSize: true ,
|
|
||||||
connectWith: ['#galleryContainer']
|
|
||||||
} );
|
|
||||||
|
|
||||||
jQuery('#galleryContainer').sortable( {
|
|
||||||
items: '.groupItem',
|
|
||||||
placeholder: 'sort_placeholder',
|
|
||||||
opacity: 0.7,
|
|
||||||
tolerance: 'intersect',
|
|
||||||
distance: 2,
|
|
||||||
forcePlaceholderSize: true ,
|
|
||||||
connectWith: ['#selectContainer', '#albumContainer']
|
|
||||||
} );
|
|
||||||
|
|
||||||
jQuery('#albumContainer').sortable( {
|
|
||||||
items: '.groupItem',
|
|
||||||
placeholder: 'sort_placeholder',
|
|
||||||
opacity: 0.7,
|
|
||||||
tolerance: 'intersect',
|
|
||||||
distance: 2,
|
|
||||||
forcePlaceholderSize: true ,
|
|
||||||
connectWith: ['#galleryContainer']
|
|
||||||
} );
|
|
||||||
|
|
||||||
jQuery('a.min').bind('click', toggleContent);
|
|
||||||
|
|
||||||
// Hide used galleries
|
|
||||||
jQuery('a#toggle_used').click(function()
|
|
||||||
{
|
|
||||||
jQuery('#selectContainer div.inUse').toggle();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
// Maximize All Portlets (whole site, no differentiation)
|
|
||||||
jQuery('a#all_max').click(function()
|
|
||||||
{
|
|
||||||
jQuery('div.itemContent:hidden').show();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
// Minimize All Portlets (whole site, no differentiation)
|
|
||||||
jQuery('a#all_min').click(function()
|
|
||||||
{
|
|
||||||
jQuery('div.itemContent:visible').hide();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
// Auto Minimize if more than 4 (whole site, no differentiation)
|
|
||||||
if(jQuery('a.min').length > 4)
|
|
||||||
{
|
|
||||||
jQuery('a.min').html('[+]');
|
|
||||||
jQuery('div.itemContent:visible').hide();
|
|
||||||
jQuery('#selectContainer div.inUse').toggle();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
var toggleContent = function(e)
|
|
||||||
{
|
|
||||||
var targetContent = jQuery('div.itemContent', this.parentNode.parentNode);
|
|
||||||
if (targetContent.css('display') == 'none') {
|
|
||||||
targetContent.slideDown(300);
|
|
||||||
jQuery(this).html('[-]');
|
|
||||||
} else {
|
|
||||||
targetContent.slideUp(300);
|
|
||||||
jQuery(this).html('[+]');
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function ngg_serialize(s)
|
|
||||||
{
|
|
||||||
//serial = jQuery.SortSerialize(s);
|
|
||||||
serial = jQuery('#galleryContainer').sortable('serialize');
|
|
||||||
jQuery('input[name=sortorder]').val(serial);
|
|
||||||
}
|
|
||||||
|
|
||||||
function showDialog() {
|
|
||||||
jQuery( "#editalbum").dialog({
|
|
||||||
width: 640,
|
|
||||||
resizable : false,
|
|
||||||
modal: true,
|
|
||||||
title: '<?php echo esc_js( __('Edit Album', 'nggallery') ); ?>'
|
|
||||||
});
|
|
||||||
jQuery('#editalbum .dialog-cancel').click(function() { jQuery( "#editalbum" ).dialog("close"); });
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div class="wrap album" id="wrap" >
|
|
||||||
<?php screen_icon( 'nextgen-gallery' ); ?>
|
|
||||||
<h2><?php esc_html_e('Manage Albums', 'nggallery') ?></h2>
|
|
||||||
<form id="selectalbum" method="POST" onsubmit="ngg_serialize()" accept-charset="utf-8">
|
|
||||||
<?php wp_nonce_field('ngg_album') ?>
|
|
||||||
<input name="sortorder" type="hidden" />
|
|
||||||
<div class="albumnav tablenav">
|
|
||||||
<div class="alignleft actions">
|
|
||||||
<?php esc_html_e('Select album', 'nggallery') ?>
|
|
||||||
<select id="act_album" name="act_album" onchange="this.form.submit();">
|
|
||||||
<option value="0" ><?php esc_html_e('No album selected', 'nggallery') ?></option>
|
|
||||||
<?php
|
|
||||||
if( is_array($this->albums) ) {
|
|
||||||
foreach($this->albums as $album) {
|
|
||||||
$selected = ($this->currentID == $album->id) ? 'selected="selected" ' : '';
|
|
||||||
echo '<option value="' . $album->id . '" ' . $selected . '>' . $album->id . ' - ' . $album->name . '</option>'."\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
<?php if ($this->currentID > 0){ ?>
|
|
||||||
<input class="button-primary" type="submit" name="update" value="<?php esc_attr_e('Update', 'nggallery'); ?>"/>
|
|
||||||
<?php if(nggGallery::current_user_can( 'NextGEN Edit album settings' )) { ?>
|
|
||||||
<input class="button-secondary" type="submit" name="showThickbox" value="<?php esc_attr_e( 'Edit album', 'nggallery'); ?>" onclick="showDialog(); return false;" />
|
|
||||||
<?php } ?>
|
|
||||||
<?php if(nggGallery::current_user_can( 'NextGEN Add/Delete album' )) { ?>
|
|
||||||
<input class="button-secondary action "type="submit" name="delete" value="<?php esc_attr_e('Delete', 'nggallery'); ?>" onclick="javascript:check=confirm('<?php esc_js('Delete album ?','nggallery'); ?>');if(check==false) return false;"/>
|
|
||||||
<?php } ?>
|
|
||||||
<?php } else { ?>
|
|
||||||
<?php if(nggGallery::current_user_can( 'NextGEN Add/Delete album' )) { ?>
|
|
||||||
<span><?php esc_html_e('Add new album', 'nggallery'); ?> </span>
|
|
||||||
<input class="search-input" id="newalbum" name="newalbum" type="text" value="" />
|
|
||||||
<input class="button-secondary action" type="submit" name="add" value="<?php esc_attr_e('Add', 'nggallery'); ?>"/>
|
|
||||||
<?php } ?>
|
|
||||||
<?php } ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<br class="clear"/>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<div style="float:right;">
|
|
||||||
<a href="#" title="<?php esc_attr_e('Show / hide used galleries','nggallery'); ?>" id="toggle_used"><?php esc_html_e('[Show all]', 'nggallery'); ?></a>
|
|
||||||
| <a href="#" title="<?php esc_attr_e('Maximize the widget content','nggallery'); ?>" id="all_max"><?php esc_html_e('[Maximize]', 'nggallery'); ?></a>
|
|
||||||
| <a href="#" title="<?php esc_attr_e('Minimize the widget content','nggallery'); ?>" id="all_min"><?php esc_html_e('[Minimize]', 'nggallery'); ?></a>
|
|
||||||
</div>
|
|
||||||
<?php esc_html_e('After you create and select a album, you can drag and drop a gallery or another album into your new album below','nggallery'); ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<br class="clear" />
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
|
|
||||||
<!-- /#album container -->
|
|
||||||
<div class="widget widget-right">
|
|
||||||
<div class="widget-top">
|
|
||||||
<h3><?php esc_html_e('Select album', 'nggallery'); ?></h3>
|
|
||||||
</div>
|
|
||||||
<div id="albumContainer" class="widget-holder">
|
|
||||||
<?php
|
|
||||||
if( is_array( $this->albums ) ) {
|
|
||||||
foreach($this->albums as $album) {
|
|
||||||
$this->get_container('a' . $album->id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- /#select container -->
|
|
||||||
<div class="widget widget-right">
|
|
||||||
<div class="widget-top">
|
|
||||||
<h3><?php esc_html_e('Select gallery', 'nggallery'); ?></h3>
|
|
||||||
</div>
|
|
||||||
<div id="selectContainer" class="widget-holder">
|
|
||||||
<?php
|
|
||||||
|
|
||||||
if( is_array( $this->galleries ) ) {
|
|
||||||
//get the array of galleries
|
|
||||||
$sort_array = $this->currentID > 0 ? (array) $this->albums[$this->currentID]->galleries : array() ;
|
|
||||||
foreach($this->galleries as $gallery) {
|
|
||||||
if (!in_array($gallery->gid, $sort_array)) {
|
|
||||||
if (in_array($gallery->gid,$used_list))
|
|
||||||
$this->get_container($gallery->gid,true);
|
|
||||||
else
|
|
||||||
$this->get_container($gallery->gid,false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- /#target-album -->
|
|
||||||
<div class="widget target-album widget-liquid-left">
|
|
||||||
|
|
||||||
<?php
|
|
||||||
if ($this->currentID > 0){
|
|
||||||
$album = $this->albums[$this->currentID];
|
|
||||||
?>
|
|
||||||
<div class="widget-top">
|
|
||||||
<h3><?php esc_html_e('Album ID', 'nggallery'); ?> <?php echo $album->id . ' : ' . $album->name; ?> </h3>
|
|
||||||
</div>
|
|
||||||
<div id="galleryContainer" class="widget-holder target">
|
|
||||||
<?php
|
|
||||||
$sort_array = (array) $this->albums[$this->currentID]->galleries;
|
|
||||||
foreach($sort_array as $galleryid) {
|
|
||||||
$this->get_container($galleryid, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
?>
|
|
||||||
<div class="widget-top">
|
|
||||||
<h3><?php esc_html_e('No album selected!', 'nggallery'); ?></h3>
|
|
||||||
</div>
|
|
||||||
<div class="widget-holder target">
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
</div><!-- /#target-album -->
|
|
||||||
|
|
||||||
</div><!-- /#container -->
|
|
||||||
</div><!-- /#wrap -->
|
|
||||||
|
|
||||||
<!-- #editalbum -->
|
|
||||||
<div id="editalbum" style="display: none;" >
|
|
||||||
<form id="form-edit-album" method="POST" accept-charset="utf-8">
|
|
||||||
<?php wp_nonce_field('ngg_thickbox_form') ?>
|
|
||||||
<input type="hidden" id="current_album" name="act_album" value="<?php echo $this->currentID; ?>" />
|
|
||||||
<table width="100%" border="0" cellspacing="3" cellpadding="3" >
|
|
||||||
<tr>
|
|
||||||
<th>
|
|
||||||
<?php esc_html_e('Album name:', 'nggallery'); ?><br />
|
|
||||||
<input class="search-input" id="album_name" name="album_name" type="text" value="<?php echo esc_attr( $album->name ); ?>" style="width:95%" />
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>
|
|
||||||
<?php esc_html_e('Album description:', 'nggallery'); ?><br />
|
|
||||||
<textarea class="search-input" id="album_desc" name="album_desc" cols="50" rows="2" style="width:95%" ><?php echo esc_attr( $album->albumdesc ); ?></textarea>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>
|
|
||||||
<?php esc_html_e('Select a preview image:', 'nggallery'); ?><br />
|
|
||||||
<select id="previewpic" name="previewpic" style="width:95%" >
|
|
||||||
<?php if ($album->previewpic == 0) ?>
|
|
||||||
<option value="0"><?php esc_html_e('No picture', 'nggallery'); ?></option>
|
|
||||||
<?php
|
|
||||||
if ($album->previewpic == 0)
|
|
||||||
echo '<option value="0" selected="selected">' . __('No picture', 'nggallery') . '</option>';
|
|
||||||
else {
|
|
||||||
$picture = nggdb::find_image($album->previewpic);
|
|
||||||
echo '<option value="' . $picture->pid . '" selected="selected" >'. $picture->pid . ' - ' . ( empty($picture->alltext) ? $picture->filename : $picture->alltext ) .' </option>'."\n";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>
|
|
||||||
<?php esc_html_e('Page Link to', 'nggallery')?><br />
|
|
||||||
<select name="pageid" style="width:95%">
|
|
||||||
<option value="0" ><?php esc_html_e('Not linked', 'nggallery') ?></option>
|
|
||||||
<?php
|
|
||||||
if (!isset($album->pageid))
|
|
||||||
$album->pageid = 0;
|
|
||||||
parent_dropdown($album->pageid); ?>
|
|
||||||
</select>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<?php do_action('ngg_edit_album_settings', $this->currentID); ?>
|
|
||||||
|
|
||||||
<tr align="right">
|
|
||||||
<td class="submit">
|
|
||||||
<input type="submit" class="button-primary" name="update_album" value="<?php esc_attr_e('OK', 'nggallery'); ?>" />
|
|
||||||
|
|
||||||
<input class="button-secondary dialog-cancel" type="reset" value="<?php esc_attr_e('Cancel', 'nggallery'); ?>"/>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<!-- /#editalbum -->
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the album or gallery container
|
|
||||||
*
|
|
||||||
* @param integer $id (the prefix 'a' indidcates that you look for a album
|
|
||||||
* @param bool $used (object will be hidden)
|
|
||||||
* @return $output
|
|
||||||
*/
|
|
||||||
function get_container($id = 0, $used = false) {
|
|
||||||
global $wpdb, $nggdb;
|
|
||||||
|
|
||||||
$obj = array();
|
|
||||||
$preview_image = '';
|
|
||||||
$class = '';
|
|
||||||
|
|
||||||
// if the id started with a 'a', then it's a sub album
|
|
||||||
if (substr( $id, 0, 1) == 'a') {
|
|
||||||
|
|
||||||
if ( !$album = $this->albums[ substr( $id, 1) ] )
|
|
||||||
return;
|
|
||||||
|
|
||||||
$obj['id'] = $album->id;
|
|
||||||
$obj['name'] = $obj['title'] = $album->name;
|
|
||||||
$class = 'album_obj';
|
|
||||||
|
|
||||||
// get the post name
|
|
||||||
$post = get_post($album->pageid);
|
|
||||||
$obj['pagenname'] = ($post == null) ? '---' : $post->post_title;
|
|
||||||
|
|
||||||
// for speed reason we limit it to 50
|
|
||||||
if ( $this->num_albums < 50 ) {
|
|
||||||
if ($album->previewpic != 0) {
|
|
||||||
$image = $nggdb->find_image( $album->previewpic );
|
|
||||||
$preview_image = ( !is_null($image->thumbURL) ) ? '<div class="inlinepicture"><img src="' . $image->thumbURL . '" /></div>' : '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// this indicates that we have a album container
|
|
||||||
$prefix = 'a';
|
|
||||||
|
|
||||||
} else {
|
|
||||||
if ( !$gallery = $nggdb->find_gallery( $id ) )
|
|
||||||
return;
|
|
||||||
|
|
||||||
$obj['id'] = $gallery->gid;
|
|
||||||
$obj['name'] = $gallery->name;
|
|
||||||
$obj['title'] = $gallery->title;
|
|
||||||
|
|
||||||
// get the post name
|
|
||||||
$post = get_post($gallery->pageid);
|
|
||||||
$obj['pagenname'] = ($post == null) ? '---' : $post->post_title;
|
|
||||||
|
|
||||||
// for spped reason we limit it to 50
|
|
||||||
if ( $this->num_galleries < 50 ) {
|
|
||||||
// set image url
|
|
||||||
$image = $nggdb->find_image( $gallery->previewpic );
|
|
||||||
$preview_image = isset($image->thumbURL) ? '<div class="inlinepicture"><img src="' . $image->thumbURL . '" /></div>' : '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$prefix = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// add class if it's in use in other albums
|
|
||||||
$used = $used ? ' inUse' : '';
|
|
||||||
|
|
||||||
echo '<div id="gid-' . $prefix . $obj['id'] . '" class="groupItem' . $used . '">
|
|
||||||
<div class="innerhandle">
|
|
||||||
<div class="item_top ' . $class . '">
|
|
||||||
<a href="#" class="min" title="close">[-]</a>
|
|
||||||
ID: ' . $obj['id'] . ' | ' . wp_html_excerpt( nggGallery::i18n( $obj['title'] ) , 25) . '
|
|
||||||
</div>
|
|
||||||
<div class="itemContent">
|
|
||||||
' . $preview_image . '
|
|
||||||
<p><strong>' . __('Name', 'nggallery') . ' : </strong>' . nggGallery::i18n( $obj['name'] ) . '</p>
|
|
||||||
<p><strong>' . __('Title', 'nggallery') . ' : </strong>' . nggGallery::i18n( $obj['title'] ) . '</p>
|
|
||||||
<p><strong>' . __('Page', 'nggallery'). ' : </strong>' . nggGallery::i18n( $obj['pagenname'] ) . '</p>
|
|
||||||
' . apply_filters('ngg_display_album_item_content', '', $obj['id']) . '
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get all used galleries from all albums
|
|
||||||
*
|
|
||||||
* @return array $used_galleries_ids
|
|
||||||
*/
|
|
||||||
function get_used_galleries() {
|
|
||||||
|
|
||||||
$used = array();
|
|
||||||
|
|
||||||
if ($this->albums) {
|
|
||||||
foreach($this->albums as $key => $value) {
|
|
||||||
$sort_array = $this->albums[$key]->galleries;
|
|
||||||
foreach($sort_array as $galleryid) {
|
|
||||||
if (!in_array($galleryid, $used))
|
|
||||||
$used[] = $galleryid;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $used;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PHP5 style destructor
|
|
||||||
*
|
|
||||||
* @return bool Always true
|
|
||||||
*/
|
|
||||||
function __destruct() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
Before Width: | Height: | Size: 217 B |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 4.3 KiB |
@ -1,139 +0,0 @@
|
|||||||
/*
|
|
||||||
* jQuery UI CSS Framework @VERSION
|
|
||||||
*
|
|
||||||
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
|
||||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
|
||||||
* http://jquery.org/license
|
|
||||||
*
|
|
||||||
* http://docs.jquery.com/UI/Theming/API
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Layout helpers
|
|
||||||
----------------------------------*/
|
|
||||||
.ui-helper-hidden { display: none; }
|
|
||||||
.ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
|
|
||||||
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
|
|
||||||
.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
|
|
||||||
.ui-helper-clearfix { display: inline-block; }
|
|
||||||
/* required comment for clearfix to work in Opera \*/
|
|
||||||
* html .ui-helper-clearfix { height:1%; }
|
|
||||||
.ui-helper-clearfix { display:block; }
|
|
||||||
/* end clearfix */
|
|
||||||
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
|
|
||||||
|
|
||||||
/* Interaction Cues
|
|
||||||
----------------------------------*/
|
|
||||||
.ui-state-disabled { cursor: default !important; }
|
|
||||||
|
|
||||||
/* Icons
|
|
||||||
----------------------------------*/
|
|
||||||
.ui-icon-triangle-1-s { background-position: -64px -16px; }
|
|
||||||
|
|
||||||
/* states and images */
|
|
||||||
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
|
|
||||||
|
|
||||||
/* Misc visuals
|
|
||||||
----------------------------------*/
|
|
||||||
|
|
||||||
/* Overlays */
|
|
||||||
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
|
|
||||||
|
|
||||||
/* jQuery UI CSS Framework @VERSION */
|
|
||||||
|
|
||||||
/* Component containers
|
|
||||||
----------------------------------*/
|
|
||||||
.ui-widget-content { background: #fcfdfd 50% bottom repeat-x; color: #222222; }
|
|
||||||
/* .ui-widget-content a { color: #222222; } */
|
|
||||||
.ui-widget-header { background: #222222 50% 50% repeat-x; color: #CFCFCF; }
|
|
||||||
.ui-widget-header a { color: #CFCFCF; }
|
|
||||||
|
|
||||||
/* Interaction states
|
|
||||||
----------------------------------*/
|
|
||||||
.ui-dialog-titlebar-close:hover { border: 1px solid #464646; background: #464646 50% 50% repeat-x; font-weight: normal; color: #ffffff; }
|
|
||||||
.ui-widget :active { outline: none; }
|
|
||||||
|
|
||||||
/* Icons
|
|
||||||
----------------------------------*/
|
|
||||||
|
|
||||||
/* states and images */
|
|
||||||
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_cccccc_256x240.png); }
|
|
||||||
.ui-widget-content .ui-icon {background-image: url(images/ui-icons_cccccc_256x240.png); }
|
|
||||||
.ui-widget-header .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); }
|
|
||||||
.ui-state-default .ui-icon { background-image: url(images/ui-icons_cccccc_256x240.png); }
|
|
||||||
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); }
|
|
||||||
.ui-state-active .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
|
|
||||||
|
|
||||||
/* positioning */
|
|
||||||
.ui-icon-close { background-position: -80px -128px; }
|
|
||||||
.ui-icon-closethick { background-position: -96px -128px; }
|
|
||||||
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
|
|
||||||
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
|
|
||||||
|
|
||||||
/* Misc visuals
|
|
||||||
----------------------------------*/
|
|
||||||
|
|
||||||
/* Corner radius */
|
|
||||||
.ui-corner-tl { -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; border-top-left-radius: 5px; }
|
|
||||||
.ui-corner-tr { -moz-border-radius-topright: 5px; -webkit-border-top-right-radius: 5px; border-top-right-radius: 5px; }
|
|
||||||
.ui-corner-bl { -moz-border-radius-bottomleft: 5px; -webkit-border-bottom-left-radius: 5px; border-bottom-left-radius: 5px; }
|
|
||||||
.ui-corner-br { -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; }
|
|
||||||
.ui-corner-top { -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; border-top-left-radius: 5px; -moz-border-radius-topright: 5px; -webkit-border-top-right-radius: 5px; border-top-right-radius: 5px; }
|
|
||||||
.ui-corner-bottom { -moz-border-radius-bottomleft: 5px; -webkit-border-bottom-left-radius: 5px; border-bottom-left-radius: 5px; -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; }
|
|
||||||
.ui-corner-right { -moz-border-radius-topright: 5px; -webkit-border-top-right-radius: 5px; border-top-right-radius: 5px; -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; }
|
|
||||||
.ui-corner-left { -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; border-top-left-radius: 5px; -moz-border-radius-bottomleft: 5px; -webkit-border-bottom-left-radius: 5px; border-bottom-left-radius: 5px; }
|
|
||||||
.ui-corner-all { -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }
|
|
||||||
|
|
||||||
/* Overlays */
|
|
||||||
.ui-widget-overlay { background: #000000 50% 50% repeat-x; opacity: .75;filter:Alpha(Opacity=75); }
|
|
||||||
.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #000000 50% 50% repeat-x; opacity: .75;filter:Alpha(Opacity=75); -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/*
|
|
||||||
|
|
||||||
/* jQuery UI Resizable */
|
|
||||||
.ui-resizable { position: relative;}
|
|
||||||
.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;}
|
|
||||||
.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
|
|
||||||
.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
|
|
||||||
.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
|
|
||||||
.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
|
|
||||||
.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
|
|
||||||
.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
|
|
||||||
.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
|
|
||||||
.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
|
|
||||||
.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/*
|
|
||||||
|
|
||||||
/* jQuery UI Dialog */
|
|
||||||
.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
|
|
||||||
.ui-dialog { -moz-box-shadow: rgba(0,0,0,1) 0 4px 30px; -webkit-box-shadow: rgba(0,0,0,1) 0 4px 30px; -khtml-box-shadow: rgba(0,0,0,1) 0 4px 30px; box-shadow: rgba(0,0,0,1) 0 4px 30px; }
|
|
||||||
.ui-dialog .ui-dialog-titlebar { padding: .5em 1em .3em; position: relative; }
|
|
||||||
.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .2em 0; }
|
|
||||||
.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
|
|
||||||
.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
|
|
||||||
.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
|
|
||||||
.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
|
|
||||||
.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
|
|
||||||
.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
|
|
||||||
.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
|
|
||||||
.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
|
|
||||||
.ui-draggable .ui-dialog-titlebar { cursor: move; }
|
|
||||||
|
|
||||||
/* jQuery UI Progressbar */
|
|
||||||
.ui-progressbar { height:2em; text-align: left; }
|
|
||||||
.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
|
|
||||||
|
|
||||||
/* jQuery UI Dialog loading spinner */
|
|
||||||
#spinner {display: none; width:100px; height: 100px; position: fixed; top: 50%; left: 50%; background:url(../../images/loader.gif) no-repeat center #fff; padding:10px; border:1px solid #666; margin-left: -50px; margin-top: -50px; z-index:2; overflow: auto; }
|
|
||||||
|
|
||||||
/* jQuery Autocomplete */
|
|
||||||
.ui-autocomplete { position: absolute; cursor: default; }
|
|
||||||
.ui-autocomplete-start { background: white url('images/dropdown.png') right center no-repeat; }
|
|
||||||
* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
|
|
||||||
.ui-autocomplete-loading { background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; }
|
|
||||||
/* this limit the height of the result list*/
|
|
||||||
.ui-autocomplete { max-height: 90px; overflow-y: auto; }
|
|
||||||
* html .ui-autocomplete { height: 90px; }
|
|
||||||
.ui-autocomplete .ui-state-hover, .ui-autocomplete .ui-widget-content .ui-state-hover { background: #1e90ff; color: #FFFFFF !important; }
|
|
||||||
.ui-widget-content { border: 1px solid #dddddd; border-style:outset; background: #FFFFFF; }
|
|
||||||
.ui-autocomplete, .ui-autocomplete .ui-corner-all { -moz-border-radius: 0px; -webkit-border-radius: 0px; border-radius: 0px; }
|
|
||||||
.ui-menu { list-style:none; padding: 1px; margin: 0; display:block; float: left; }
|
|
||||||
.ui-menu .ui-menu { margin-top: -3px; }
|
|
||||||
.ui-menu .ui-menu-item { margin:0; padding:0; zoom:1; float:left; clear:left; width:100%; }
|
|
||||||
.ui-menu .ui-menu-item a { text-decoration:none; display:block; zoom:1; color: black;}
|
|
||||||
@ -1,158 +0,0 @@
|
|||||||
/* Caution! Ensure accessibility in print and other media types... */
|
|
||||||
@media projection, screen { /* Use class for showing/hiding tab content, so that visibility can be better controlled in different media types... */
|
|
||||||
.ui-tabs-hide {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Hide useless elements in print layouts... */
|
|
||||||
@media print {
|
|
||||||
.ui-tabs-nav {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Skin */
|
|
||||||
#slider {
|
|
||||||
border-color:#EBEBEB rgb(204, 204, 204) rgb(204, 204, 204) rgb(235, 235, 235);
|
|
||||||
border-style:solid;
|
|
||||||
border-width:1px;
|
|
||||||
margin:15px 15% 0pt 15px;
|
|
||||||
padding:2px;
|
|
||||||
}
|
|
||||||
#tabs{
|
|
||||||
display: block;
|
|
||||||
background:#F1F1F1 none repeat scroll 0%;
|
|
||||||
font-size:14px;
|
|
||||||
overflow:hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ui-tabs-nav {
|
|
||||||
list-style: none;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0 0 0 10px;
|
|
||||||
}
|
|
||||||
.ui-tabs-nav:after { /* clearing without presentational markup, IE gets extra treatment */
|
|
||||||
display: block;
|
|
||||||
clear: both;
|
|
||||||
content: " ";
|
|
||||||
}
|
|
||||||
.ui-tabs-nav li {
|
|
||||||
float: left;
|
|
||||||
padding: 6px 5px;
|
|
||||||
min-width: 84px; /* be nice to Opera */
|
|
||||||
margin: 2px 2px 0px 1px !important;
|
|
||||||
text-decoration: none;
|
|
||||||
list-style: none;
|
|
||||||
}
|
|
||||||
.ui-tabs-nav a, .ui-tabs-nav a span {
|
|
||||||
display: block;
|
|
||||||
padding: 0 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ui-tabs-nav a {
|
|
||||||
margin: 1px 0 0; /* position: relative makes opacity fail for disabled tab in IE */
|
|
||||||
padding-left: 0;
|
|
||||||
color: #2583AD;
|
|
||||||
line-height: 1.2;
|
|
||||||
text-align: center;
|
|
||||||
text-decoration: none;
|
|
||||||
white-space: nowrap; /* required in IE 6 */
|
|
||||||
outline: 0; /* prevent dotted border in Firefox */
|
|
||||||
}
|
|
||||||
.ui-tabs-nav .ui-tabs-selected{
|
|
||||||
background: #6D6D6D url(../images/menu-bits.gif) repeat-x scroll left top;
|
|
||||||
border-color: #6D6D6D;
|
|
||||||
color: #FFFFFF;
|
|
||||||
text-shadow:0 -1px 0 #666666;
|
|
||||||
|
|
||||||
-moz-border-radius-topright: 6px;
|
|
||||||
-khtml-border-top-right-radius: 6px;
|
|
||||||
-webkit-border-top-right-radius: 6px;
|
|
||||||
border-top-right-radius: 6px;
|
|
||||||
-moz-border-radius-topleft: 6px;
|
|
||||||
-khtml-border-top-left-radius: 6px;
|
|
||||||
-webkit-border-top-left-radius: 6px;
|
|
||||||
border-top-left-radius: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ui-tabs-selected a,
|
|
||||||
.ui-tabs-selected a:hover {
|
|
||||||
color:#FFFFFF !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ui-tabs-nav .ui-tabs-selected a,
|
|
||||||
.ui-tabs-nav .ui-tabs-selected a:hover {
|
|
||||||
position: relative;
|
|
||||||
top: 1px;
|
|
||||||
z-index: 2;
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ui-tabs-nav li a:hover {
|
|
||||||
color:#D54E21;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ui-tabs-nav a span {
|
|
||||||
width: 64px; /* IE 6 treats width as min-width */
|
|
||||||
min-width: 64px;
|
|
||||||
height: 18px; /* IE 6 treats height as min-height */
|
|
||||||
min-height: 18px;
|
|
||||||
padding-top: 6px;
|
|
||||||
padding-right: 0;
|
|
||||||
}
|
|
||||||
*>.ui-tabs-nav a span { /* hide from IE 6 */
|
|
||||||
width: auto;
|
|
||||||
height: auto;
|
|
||||||
}
|
|
||||||
.ui-tabs-nav .ui-tabs-selected a span {
|
|
||||||
padding-bottom: 1px;
|
|
||||||
}
|
|
||||||
.ui-tabs-nav .ui-tabs-selected a, .ui-tabs-nav a:hover, .ui-tabs-nav a:focus, .ui-tabs-nav a:active {
|
|
||||||
background-position: 100% -150px;
|
|
||||||
}
|
|
||||||
.ui-tabs-nav a, .ui-tabs-nav .ui-tabs-disabled a:hover, .ui-tabs-nav .ui-tabs-disabled a:focus, .ui-tabs-nav .ui-tabs-disabled a:active {
|
|
||||||
background-position: 100% -100px;
|
|
||||||
}
|
|
||||||
.ui-tabs-nav .ui-tabs-selected a span, .ui-tabs-nav a:hover span, .ui-tabs-nav a:focus span, .ui-tabs-nav a:active span {
|
|
||||||
background-position: 0 -50px;
|
|
||||||
}
|
|
||||||
.ui-tabs-nav a span, .ui-tabs-nav .ui-tabs-disabled a:hover span, .ui-tabs-nav .ui-tabs-disabled a:focus span, .ui-tabs-nav .ui-tabs-disabled a:active span {
|
|
||||||
background-position: 0 0;
|
|
||||||
}
|
|
||||||
.ui-tabs-nav .ui-tabs-selected a:link, .ui-tabs-nav .ui-tabs-selected a:visited, .ui-tabs-nav .ui-tabs-disabled a:link, .ui-tabs-nav .ui-tabs-disabled a:visited { /* @ Opera, use pseudo classes otherwise it confuses cursor... */
|
|
||||||
cursor: text;
|
|
||||||
}
|
|
||||||
.ui-tabs-nav a:hover, .ui-tabs-nav a:focus, .ui-tabs-nav a:active,
|
|
||||||
.ui-tabs-nav .ui-tabs-unselect a:hover, .ui-tabs-nav .ui-tabs-unselect a:focus, .ui-tabs-nav .ui-tabs-unselect a:active { /* @ Opera, we need to be explicit again here now... */
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
.ui-tabs-disabled {
|
|
||||||
opacity: .4;
|
|
||||||
filter: alpha(opacity=40);
|
|
||||||
}
|
|
||||||
.ui-tabs-panel {
|
|
||||||
border-top: 1px solid #97a5b0 !important;
|
|
||||||
padding: 1em 8px;
|
|
||||||
background: #fff; /* declare background color for container to avoid distorted fonts in IE while fading */
|
|
||||||
|
|
||||||
/* overwrite wp-admin */
|
|
||||||
border:none !important;
|
|
||||||
height:100% !important;
|
|
||||||
margin:0pt 0pt 0pt 0px !important;
|
|
||||||
overflow:visible !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ui-tabs-panel a {
|
|
||||||
display:inline;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Additional IE specific bug fixes... */
|
|
||||||
* html .ui-tabs-nav { /* auto clear, @ IE 6 & IE 7 Quirks Mode */
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
*:first-child+html .ui-tabs-nav { /* @ IE 7 Standards Mode - do not group selectors, otherwise IE 6 will ignore complete rule (because of the unknown + combinator)... */
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
#adminmenu #toplevel_page_nextgen-gallery div.wp-menu-image,
|
|
||||||
#oam_toplevel_page_nextgen-gallery div.wp-menu-image {
|
|
||||||
background: transparent url('../images/nextgen_16_grey.png') no-repeat scroll 6px 6px;
|
|
||||||
}
|
|
||||||
#adminmenu #toplevel_page_nextgen-gallery:hover div.wp-menu-image,
|
|
||||||
#adminmenu #toplevel_page_nextgen-gallery.wp-has-current-submenu div.wp-menu-image,
|
|
||||||
#adminmenu #toplevel_page_nextgen-gallery.current div.wp-menu-image,
|
|
||||||
#oam_toplevel_page_nextgen-gallery:hover div.wp-menu-image {
|
|
||||||
background: transparent url('../images/nextgen_16_color.png') no-repeat scroll 6px 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#icon-nextgen-gallery {
|
|
||||||
background:url("../images/nextgen_32_grey.png") no-repeat scroll 1px 1px transparent;
|
|
||||||
}
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
#colorSelector{
|
|
||||||
background:transparent url(../images/select.png) repeat scroll 0 0;
|
|
||||||
height:36px;
|
|
||||||
position:relative;
|
|
||||||
width:36px;
|
|
||||||
}
|
|
||||||
#colorSelector div{
|
|
||||||
background:transparent url(../images/select.png) repeat scroll center center;
|
|
||||||
height:30px;
|
|
||||||
left:3px;
|
|
||||||
position:absolute;
|
|
||||||
top:3px;
|
|
||||||
width:30px;
|
|
||||||
}
|
|
||||||
@ -1,76 +0,0 @@
|
|||||||
.imageBox,.imageBoxHighlighted{
|
|
||||||
width:130px; /* Total width of each image box */
|
|
||||||
height:160px; /* Total height of each image box */
|
|
||||||
float:left;
|
|
||||||
}
|
|
||||||
.imageBox_theImage{
|
|
||||||
width:110px; /* Width of image */
|
|
||||||
height:125px; /* Height of image */
|
|
||||||
|
|
||||||
/*
|
|
||||||
Don't change these values *
|
|
||||||
*/
|
|
||||||
background-position: center;
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
margin: 0 auto;
|
|
||||||
margin-bottom:2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.imageBox .imageBox_theImage{
|
|
||||||
border:1px solid #DDD; /* Border color for not selected images */
|
|
||||||
padding:2px;
|
|
||||||
}
|
|
||||||
.imageBoxHighlighted .imageBox_theImage{
|
|
||||||
border:3px solid #316AC5; /* Border color for selected image */
|
|
||||||
padding:0px;
|
|
||||||
|
|
||||||
}
|
|
||||||
.imageBoxHighlighted span{ /* Title of selected image */
|
|
||||||
background-color: #316AC5;
|
|
||||||
color:#FFFFFF;
|
|
||||||
padding:2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.imageBox_label{ /* Title of images - both selected and not selected */
|
|
||||||
text-align:center;
|
|
||||||
font-family: arial;
|
|
||||||
font-size:11px;
|
|
||||||
padding-top:2px;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
DIV that indicates where the dragged image will be placed
|
|
||||||
*/
|
|
||||||
#insertionMarker{
|
|
||||||
height:150px;
|
|
||||||
width:6px;
|
|
||||||
position:absolute;
|
|
||||||
}
|
|
||||||
|
|
||||||
#insertionMarkerLine{
|
|
||||||
width:6px; /* No need to change this value */
|
|
||||||
height:145px; /* To adjust the height of the div that indicates where the dragged image will be dropped */
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#insertionMarker img{
|
|
||||||
float:left;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
DIV that shows the image as you drag it
|
|
||||||
*/
|
|
||||||
#dragDropContent{
|
|
||||||
|
|
||||||
opacity:0.4; /* 40 % opacity */
|
|
||||||
filter:alpha(opacity=40); /* 40 % opacity */
|
|
||||||
|
|
||||||
/*
|
|
||||||
No need to change these three values
|
|
||||||
*/
|
|
||||||
position:absolute;
|
|
||||||
z-index:10;
|
|
||||||
display:none;
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,462 +0,0 @@
|
|||||||
/*
|
|
||||||
** NextGEN Gallery Style for Wordpress 3.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* SETTINGS FOR Overview Gallery */
|
|
||||||
|
|
||||||
#newversion {
|
|
||||||
border-color:#CCCCCC;
|
|
||||||
border-style:solid;
|
|
||||||
border-width:1px;
|
|
||||||
margin-right:7px;
|
|
||||||
margin-top:10px;
|
|
||||||
padding:2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ngg-dashboard-widget ul.settings span {
|
|
||||||
padding-left : 10px;
|
|
||||||
color:#2583AD;
|
|
||||||
font-weight:bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ngg-overview .postbox .handlediv {
|
|
||||||
float:right;
|
|
||||||
height:24px;
|
|
||||||
width:24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.warning {
|
|
||||||
color: #9F6000;
|
|
||||||
background-color: #FEEFB3;
|
|
||||||
border: 1px solid;
|
|
||||||
margin: 5px 0px;
|
|
||||||
padding:5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#donator_message {
|
|
||||||
margin:5px 0 15px;
|
|
||||||
background-color:#BDE5F8;
|
|
||||||
border-color:#00529B;
|
|
||||||
-moz-border-radius-bottomleft:3px;
|
|
||||||
-moz-border-radius-bottomright:3px;
|
|
||||||
-moz-border-radius-topleft:3px;
|
|
||||||
-moz-border-radius-topright:3px;
|
|
||||||
border-style:solid;
|
|
||||||
border-width:1px;
|
|
||||||
margin:5px 15px 2px;
|
|
||||||
padding:0 0.6em;
|
|
||||||
}
|
|
||||||
|
|
||||||
#donator_message p{
|
|
||||||
line-height:1;
|
|
||||||
margin:0.5em 0;
|
|
||||||
padding:2px;
|
|
||||||
padding-bottom:10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#donator_message span{
|
|
||||||
padding-top:10px;
|
|
||||||
float:right;
|
|
||||||
}
|
|
||||||
|
|
||||||
#plugin_check img {
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
#plugin_check p.message {
|
|
||||||
font-size: 90%;
|
|
||||||
color: #666;
|
|
||||||
}
|
|
||||||
/* SETTING FOR FLASH UPLOAD BUTTON */
|
|
||||||
.swfupload {
|
|
||||||
position:absolute;
|
|
||||||
z-index:1;
|
|
||||||
vertical-align:top;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* SETTINGS FOR THE OPTIONS TABLE */
|
|
||||||
.ngg-options th {
|
|
||||||
width:22%;
|
|
||||||
}
|
|
||||||
|
|
||||||
a.switch-expert {
|
|
||||||
text-decoration:none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* WATERMARK */
|
|
||||||
#wm-preview {
|
|
||||||
float:right;
|
|
||||||
font-size:90%;
|
|
||||||
width:35%;
|
|
||||||
border-color:#EBEBEB rgb(204, 204, 204) rgb(204, 204, 204) rgb(235, 235, 235);
|
|
||||||
border-style:solid;
|
|
||||||
border-width:1px;
|
|
||||||
margin-bottom:10px;
|
|
||||||
margin-left:10px;
|
|
||||||
margin-right:8px;
|
|
||||||
padding:2px;
|
|
||||||
}
|
|
||||||
#wm-preview h3{
|
|
||||||
background:#F9F9F9 none repeat scroll 0%;
|
|
||||||
font-size:14px;
|
|
||||||
font-weight:bold;
|
|
||||||
margin:0pt 0pt 10px;
|
|
||||||
padding:8px 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#wm-position {
|
|
||||||
width:100%;
|
|
||||||
margin-left:40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.wm-table {
|
|
||||||
border-collapse:collapse;
|
|
||||||
margin-top:1em;
|
|
||||||
width: 60%;
|
|
||||||
clear:none;
|
|
||||||
}
|
|
||||||
.wm-table td {
|
|
||||||
border-bottom:8px solid #FFFFFF;
|
|
||||||
line-height:20px;
|
|
||||||
margin-bottom:9px;
|
|
||||||
padding:10px;
|
|
||||||
}
|
|
||||||
.wm-table th {
|
|
||||||
border-bottom:8px solid #FFFFFF;
|
|
||||||
padding:10px;
|
|
||||||
text-align:left;
|
|
||||||
}
|
|
||||||
.wm-table tr {
|
|
||||||
background:#F9F9F9 none repeat scroll 0%;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* SETTINGS FOR MANAGE TABLE */
|
|
||||||
|
|
||||||
div#poststuff #gallerydiv {
|
|
||||||
cursor:pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
p#ngg-inlinebutton {
|
|
||||||
float:right;
|
|
||||||
margin:0pt;
|
|
||||||
position:relative;
|
|
||||||
top:-25pt;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ngg-tablenav .button-secondary {
|
|
||||||
padding:2px 8px;
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fixed tbody th.column-cb {
|
|
||||||
padding:7px 0 22px;
|
|
||||||
}
|
|
||||||
.fixed .column-cb {
|
|
||||||
padding:0;
|
|
||||||
width:2.2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fixed .column-thumbnail{
|
|
||||||
width:85px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fixed .column-thumbnail img{
|
|
||||||
max-height:80px;
|
|
||||||
max-width:80px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fixed .column-id {
|
|
||||||
width: 5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fixed .column-exclude, .fixed .column-action, .fixed .column-delete {
|
|
||||||
width: 10%;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* SETTINGS FOR PROGRESS BAR */
|
|
||||||
|
|
||||||
div .progressborder {
|
|
||||||
border:1px solid #DDDDDD;
|
|
||||||
display: block;
|
|
||||||
height: 30px;
|
|
||||||
background-color: #464646;
|
|
||||||
width: 100%;
|
|
||||||
margin-top: 15px;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
-moz-border-radius: 5px;
|
|
||||||
-webkit-border-radius: 5px;
|
|
||||||
border-radius: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div .progressbar {
|
|
||||||
border: medium none ;
|
|
||||||
display: block;
|
|
||||||
height: 30px;
|
|
||||||
background-color: #D54E21;
|
|
||||||
width: 0%;
|
|
||||||
-moz-border-radius: 5px;
|
|
||||||
-webkit-border-radius: 5px;
|
|
||||||
border-radius: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div .progressbar span {
|
|
||||||
display: inline;
|
|
||||||
position: absolute;
|
|
||||||
color: white;
|
|
||||||
font-weight: bold;
|
|
||||||
padding: 5px 0 0 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.show_details
|
|
||||||
{
|
|
||||||
height: 16px;
|
|
||||||
line-height: 20px;
|
|
||||||
overflow: hidden;
|
|
||||||
min-width: 8em;
|
|
||||||
padding: 3px;
|
|
||||||
cursor:pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.show_details span
|
|
||||||
{
|
|
||||||
border-bottom:1px solid #999;
|
|
||||||
white-space:pre;
|
|
||||||
}
|
|
||||||
.show_details:hover
|
|
||||||
{
|
|
||||||
height: auto;
|
|
||||||
overflow: visible;
|
|
||||||
border: 1px solid #999;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* SETTINGS FOR ALBUM PAGE */
|
|
||||||
|
|
||||||
.albumnav select[name="act_album"] {
|
|
||||||
width:150px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.albumnav span {
|
|
||||||
padding-left: 50px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div .groupItem
|
|
||||||
{
|
|
||||||
cursor: move;
|
|
||||||
width: 295px;
|
|
||||||
padding: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div .innerhandle {
|
|
||||||
background-color:#FBFBFB;
|
|
||||||
}
|
|
||||||
|
|
||||||
.groupItem .item_top
|
|
||||||
{
|
|
||||||
background-color:#2683AE;
|
|
||||||
color: #FFFFFF;
|
|
||||||
font-weight:bold;
|
|
||||||
line-height: 28px;
|
|
||||||
height: 28px;
|
|
||||||
padding: 0 5px;
|
|
||||||
-moz-border-radius: 3px;
|
|
||||||
-khtml-border-radius: 3px;
|
|
||||||
-webkit-border-radius: 3px;
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.groupItem .album_obj
|
|
||||||
{
|
|
||||||
background-color:#D54E21;
|
|
||||||
}
|
|
||||||
|
|
||||||
.groupItem .item_top a
|
|
||||||
{
|
|
||||||
color:#FFFFFF;
|
|
||||||
float:right;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.groupItem .item_top a:hover
|
|
||||||
{
|
|
||||||
color:#FFFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
.itemContent {
|
|
||||||
border-color:#DFDFDF;
|
|
||||||
border-style:none solid solid;
|
|
||||||
border-width:0 1px 1px;
|
|
||||||
padding:2px 0 20px 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.itemContent p {
|
|
||||||
border: 0;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.inlinepicture
|
|
||||||
{
|
|
||||||
float:left;
|
|
||||||
display:inline;
|
|
||||||
margin:0pt;
|
|
||||||
padding:0pt 3px 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.inlinepicture img
|
|
||||||
{
|
|
||||||
margin:3px;
|
|
||||||
max-height:60px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sort_placeholder
|
|
||||||
{
|
|
||||||
border:1px dashed #bba !important;
|
|
||||||
margin: 5px;
|
|
||||||
background: #F9F9F9;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container {
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.target-album {
|
|
||||||
margin:10px 685px 10px 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.widget-right {
|
|
||||||
float:right;
|
|
||||||
margin:0pt 10px;
|
|
||||||
width:315px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.widget-holder {
|
|
||||||
min-height: 400px;
|
|
||||||
padding-top:1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.target {
|
|
||||||
background-color:#F1F1F1;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.widget-top h3 {
|
|
||||||
text-align:center;
|
|
||||||
line-height:25px;
|
|
||||||
margin: 0;
|
|
||||||
padding: 5px 12px;
|
|
||||||
font-size: 13px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.widget-top {
|
|
||||||
text-shadow:0 1px 0 #FFFFFF;
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
background-position: 0 0;
|
|
||||||
font-size: 13px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ui-autocomplete-start { background-position: 99% center; }
|
|
||||||
|
|
||||||
/* SETTINGS FOR SORT GALLERY */
|
|
||||||
|
|
||||||
#sortGallery {
|
|
||||||
position:relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
p#sortButton{
|
|
||||||
margin:0;
|
|
||||||
position:absolute;
|
|
||||||
right:0;
|
|
||||||
top:0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.imageBox,.imageBoxHighlighted{
|
|
||||||
width:130px; /* Total width of each image box */
|
|
||||||
height:160px; /* Total height of each image box */
|
|
||||||
float:left;
|
|
||||||
}
|
|
||||||
.imageBox_theImage{
|
|
||||||
width:110px; /* Width of image */
|
|
||||||
height:125px; /* Height of image */
|
|
||||||
|
|
||||||
background-position: center;
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
margin: 0 auto;
|
|
||||||
margin-bottom:2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.imageBox .imageBox_theImage{
|
|
||||||
border:1px solid #DDD; /* Border color for not selected images */
|
|
||||||
padding:2px;
|
|
||||||
}
|
|
||||||
.imageBoxHighlighted .imageBox_theImage{
|
|
||||||
border:3px solid #316AC5; /* Border color for selected image */
|
|
||||||
padding:0px;
|
|
||||||
|
|
||||||
}
|
|
||||||
.imageBoxHighlighted span{ /* Title of selected image */
|
|
||||||
background-color: #316AC5;
|
|
||||||
color:#FFFFFF;
|
|
||||||
padding:2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.imageBox_label{ /* Title of images - both selected and not selected */
|
|
||||||
text-align:center;
|
|
||||||
font-family: arial;
|
|
||||||
font-size:11px;
|
|
||||||
padding-top:2px;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
DIV that indicates where the dragged image will be placed
|
|
||||||
*/
|
|
||||||
|
|
||||||
#insertionMarker{
|
|
||||||
height:150px;
|
|
||||||
width:6px;
|
|
||||||
position:absolute;
|
|
||||||
}
|
|
||||||
|
|
||||||
#insertionMarkerLine{
|
|
||||||
width:6px; /* No need to change this value */
|
|
||||||
height:145px; /* To adjust the height of the div that indicates where the dragged image will be dropped */
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#insertionMarker img{
|
|
||||||
float:left;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
DIV that shows the image as you drag it
|
|
||||||
*/
|
|
||||||
|
|
||||||
#dragDropContent{
|
|
||||||
|
|
||||||
opacity:0.4; /* 40 % opacity */
|
|
||||||
filter:alpha(opacity=40); /* 40 % opacity */
|
|
||||||
|
|
||||||
/*
|
|
||||||
No need to change these three values
|
|
||||||
*/
|
|
||||||
position:absolute;
|
|
||||||
z-index:10;
|
|
||||||
display:none;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* UPGRADE PAGE */
|
|
||||||
|
|
||||||
.error_inline {
|
|
||||||
background:#FFEBE8 none repeat scroll 0%;
|
|
||||||
border:1px solid #CC0000;
|
|
||||||
margin:5px auto;
|
|
||||||
padding:10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ABOUT PAGE */
|
|
||||||
.ngg-list {
|
|
||||||
font-size:11px;
|
|
||||||
margin-left:15px;
|
|
||||||
list-style-position:inside;
|
|
||||||
list-style-type:disc;
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
.ngg_wrap .auto_list{width:98%;margin:3px 0;padding:3px 5px;}
|
|
||||||
.ngg_wrap .list_tags {width:240px;vertical-align:top;}
|
|
||||||
.ngg_wrap .forms_manage {vertical-align:top;}
|
|
||||||
.ngg_wrap .forms_manage h3 {margin-bottom:5px;}
|
|
||||||
.ngg_wrap .forms_manage .form-table {margin-top:0;}
|
|
||||||
.ngg_wrap .sort_order h3 {margin:0;}
|
|
||||||
.ngg_wrap #ajax_area_tagslist {}
|
|
||||||
.ngg_wrap #ajax_area_tagslist ul{list-style:square;margin:10px 0 10px 20px;padding:0;}
|
|
||||||
.ngg_wrap #ajax_area_tagslist ul li{margin:0;padding:0;line-height:1.4;}
|
|
||||||
.ngg_wrap #ajax_area_tagslist ul li span{cursor:pointer;}
|
|
||||||
@ -1,173 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
|
|
||||||
Custom thumbnail for NGG
|
|
||||||
Author : Simone Fumagalli | simone@iliveinperego.com
|
|
||||||
More info and update : http://www.iliveinperego.com/custom_thumbnail_for_ngg/
|
|
||||||
|
|
||||||
Credits:
|
|
||||||
NextGen Gallery : Alex Rabe | http://alexrabe.boelinger.com/wordpress-plugins/nextgen-gallery/
|
|
||||||
jCrop : Kelly Hallman <khallman@wrack.org> | http://deepliquid.com/content/Jcrop.html
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
require_once( dirname( dirname(__FILE__) ) . '/ngg-config.php');
|
|
||||||
require_once( NGGALLERY_ABSPATH . '/lib/image.php' );
|
|
||||||
|
|
||||||
if ( !is_user_logged_in() )
|
|
||||||
die(__('Cheatin’ uh?'));
|
|
||||||
|
|
||||||
if ( !current_user_can('NextGEN Manage gallery') )
|
|
||||||
die(__('Cheatin’ uh?'));
|
|
||||||
|
|
||||||
global $wpdb;
|
|
||||||
|
|
||||||
$id = (int) $_GET['id'];
|
|
||||||
|
|
||||||
// let's get the image data
|
|
||||||
$picture = nggdb::find_image($id);
|
|
||||||
|
|
||||||
include_once( nggGallery::graphic_library() );
|
|
||||||
$ngg_options=get_option('ngg_options');
|
|
||||||
|
|
||||||
$thumb = new ngg_Thumbnail($picture->imagePath, TRUE);
|
|
||||||
$thumb->resize(350,350);
|
|
||||||
// we need the new dimension
|
|
||||||
$resizedPreviewInfo = $thumb->newDimensions;
|
|
||||||
$thumb->destruct();
|
|
||||||
|
|
||||||
$preview_image = NGGALLERY_URLPATH . 'nggshow.php?pid=' . $picture->pid . '&width=350&height=350';
|
|
||||||
$imageInfo = @getimagesize($picture->imagePath);
|
|
||||||
$rr = round($imageInfo[0] / $resizedPreviewInfo['newWidth'], 2);
|
|
||||||
|
|
||||||
if ( ($ngg_options['thumbfix'] == 1) ) {
|
|
||||||
|
|
||||||
$WidthHtmlPrev = $ngg_options['thumbwidth'];
|
|
||||||
$HeightHtmlPrev = $ngg_options['thumbheight'];
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// H > W
|
|
||||||
if ($imageInfo[1] > $imageInfo[0]) {
|
|
||||||
|
|
||||||
$HeightHtmlPrev = $ngg_options['thumbheight'];
|
|
||||||
$WidthHtmlPrev = round($imageInfo[0] / ($imageInfo[1] / $ngg_options['thumbheight']),0);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
$WidthHtmlPrev = $ngg_options['thumbwidth'];
|
|
||||||
$HeightHtmlPrev = round($imageInfo[1] / ($imageInfo[0] / $ngg_options['thumbwidth']),0);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
<script src="<?php echo NGGALLERY_URLPATH; ?>/admin/js/Jcrop/js/jquery.Jcrop.js"></script>
|
|
||||||
<link rel="stylesheet" href="<?php echo NGGALLERY_URLPATH; ?>/admin/js/Jcrop/css/jquery.Jcrop.css" type="text/css" />
|
|
||||||
|
|
||||||
<script language="JavaScript">
|
|
||||||
<!--
|
|
||||||
|
|
||||||
var status = 'start';
|
|
||||||
var xT, yT, wT, hT, selectedCoords;
|
|
||||||
var selectedImage = "thumb<?php echo $id ?>";
|
|
||||||
|
|
||||||
function showPreview(coords)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (status != 'edit') {
|
|
||||||
jQuery('#actualThumb').hide();
|
|
||||||
jQuery('#previewNewThumb').show();
|
|
||||||
status = 'edit';
|
|
||||||
}
|
|
||||||
|
|
||||||
var rx = <?php echo $WidthHtmlPrev; ?> / coords.w;
|
|
||||||
var ry = <?php echo $HeightHtmlPrev; ?> / coords.h;
|
|
||||||
|
|
||||||
jQuery('#imageToEditPreview').css({
|
|
||||||
width: Math.round(rx * <?php echo $resizedPreviewInfo['newWidth']; ?>) + 'px',
|
|
||||||
height: Math.round(ry * <?php echo $resizedPreviewInfo['newHeight']; ?>) + 'px',
|
|
||||||
marginLeft: '-' + Math.round(rx * coords.x) + 'px',
|
|
||||||
marginTop: '-' + Math.round(ry * coords.y) + 'px'
|
|
||||||
});
|
|
||||||
|
|
||||||
xT = coords.x;
|
|
||||||
yT = coords.y;
|
|
||||||
wT = coords.w;
|
|
||||||
hT = coords.h;
|
|
||||||
|
|
||||||
jQuery("#sizeThumb").html(xT+" "+yT+" "+wT+" "+hT);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
function updateThumb() {
|
|
||||||
|
|
||||||
if ( (wT == 0) || (hT == 0) || (wT == undefined) || (hT == undefined) ) {
|
|
||||||
alert("<?php _e('Select with the mouse the area for the new thumbnail', 'nggallery'); ?>");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
jQuery.ajax({
|
|
||||||
url: "admin-ajax.php",
|
|
||||||
type : "POST",
|
|
||||||
data: {x: xT, y: yT, w: wT, h: hT, action: 'createNewThumb', id: <?php echo $id; ?>, rr: <?php echo $rr; ?>},
|
|
||||||
cache: false,
|
|
||||||
success: function(data){
|
|
||||||
var d = new Date();
|
|
||||||
newUrl = jQuery("#"+selectedImage).attr("src") + "?" + d.getTime();
|
|
||||||
jQuery("#"+selectedImage).attr("src" , newUrl);
|
|
||||||
|
|
||||||
jQuery('#thumbMsg').html("<?php _e('Thumbnail updated', 'nggallery') ?>");
|
|
||||||
jQuery('#thumbMsg').css({'display':'block'});
|
|
||||||
setTimeout(function(){ jQuery('#thumbMsg').fadeOut('slow'); }, 1500);
|
|
||||||
},
|
|
||||||
error: function() {
|
|
||||||
jQuery('#thumbMsg').html("<?php _e('Error updating thumbnail', 'nggallery') ?>");
|
|
||||||
jQuery('#thumbMsg').css({'display':'block'});
|
|
||||||
setTimeout(function(){ jQuery('#thumbMsg').fadeOut('slow'); }, 1500);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
-->
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<table width="98%" align="center" style="border:1px solid #DADADA">
|
|
||||||
<tr>
|
|
||||||
<td rowspan="3" valign="middle" align="center" width="350" style="background-color:#DADADA;">
|
|
||||||
<img src="<?php echo $preview_image; ?>" alt="" id="imageToEdit" />
|
|
||||||
</td>
|
|
||||||
<td width="300" style="background-color : #DADADA;">
|
|
||||||
<small style="margin-left:6px; display:block;"><?php _e('Select the area for the thumbnail from the picture on the left.', 'nggallery'); ?></small>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td align="center" width="300" height="320">
|
|
||||||
<div id="previewNewThumb" style="display:none;width:<?php echo $WidthHtmlPrev; ?>px;height:<?php echo $HeightHtmlPrev; ?>px;overflow:hidden; margin-left:5px;">
|
|
||||||
<img src="<?php echo $preview_image; ?>" id="imageToEditPreview" />
|
|
||||||
</div>
|
|
||||||
<div id="actualThumb">
|
|
||||||
<img src="<?php echo $picture->thumbURL; ?>?<?php echo time()?>" />
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr style="background-color:#DADADA;">
|
|
||||||
<td>
|
|
||||||
<input type="button" name="update" value="<?php _e('Update', 'nggallery'); ?>" onclick="updateThumb()" class="button-secondary" style="float:left; margin-left:4px;"/>
|
|
||||||
<div id="thumbMsg" style="color:#FF0000; display : none;font-size:11px; float:right; width:60%; height:2em; line-height:2em;"></div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
<!--
|
|
||||||
jQuery(document).ready(function(){
|
|
||||||
jQuery('#imageToEdit').Jcrop({
|
|
||||||
onChange: showPreview,
|
|
||||||
onSelect: showPreview,
|
|
||||||
aspectRatio: <?php echo round($WidthHtmlPrev/$HeightHtmlPrev, 3) ?>
|
|
||||||
});
|
|
||||||
});
|
|
||||||
-->
|
|
||||||
</script>
|
|
||||||
|
Before Width: | Height: | Size: 244 B |
|
Before Width: | Height: | Size: 220 B |
|
Before Width: | Height: | Size: 728 B |
|
Before Width: | Height: | Size: 819 B |
|
Before Width: | Height: | Size: 45 B |
|
Before Width: | Height: | Size: 48 B |
|
Before Width: | Height: | Size: 45 B |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 738 B |
|
Before Width: | Height: | Size: 462 B |
|
Before Width: | Height: | Size: 400 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 898 B |
|
Before Width: | Height: | Size: 506 B |
@ -1,293 +0,0 @@
|
|||||||
<?php
|
|
||||||
if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* creates all tables for the gallery
|
|
||||||
* called during register_activation hook
|
|
||||||
*
|
|
||||||
* @access internal
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function nggallery_install () {
|
|
||||||
|
|
||||||
global $wpdb , $wp_roles, $wp_version;
|
|
||||||
|
|
||||||
// Check for capability
|
|
||||||
if ( !current_user_can('activate_plugins') )
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Set the capabilities for the administrator
|
|
||||||
$role = get_role('administrator');
|
|
||||||
// We need this role, no other chance
|
|
||||||
if ( empty($role) ) {
|
|
||||||
update_option( "ngg_init_check", __('Sorry, NextGEN Gallery works only with a role called administrator',"nggallery") );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$role->add_cap('NextGEN Gallery overview');
|
|
||||||
$role->add_cap('NextGEN Use TinyMCE');
|
|
||||||
$role->add_cap('NextGEN Upload images');
|
|
||||||
$role->add_cap('NextGEN Manage gallery');
|
|
||||||
$role->add_cap('NextGEN Manage tags');
|
|
||||||
$role->add_cap('NextGEN Manage others gallery');
|
|
||||||
$role->add_cap('NextGEN Edit album');
|
|
||||||
$role->add_cap('NextGEN Change style');
|
|
||||||
$role->add_cap('NextGEN Change options');
|
|
||||||
|
|
||||||
// upgrade function changed in WordPress 2.3
|
|
||||||
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
|
||||||
|
|
||||||
// add charset & collate like wp core
|
|
||||||
$charset_collate = '';
|
|
||||||
|
|
||||||
if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') ) {
|
|
||||||
if ( ! empty($wpdb->charset) )
|
|
||||||
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
|
|
||||||
if ( ! empty($wpdb->collate) )
|
|
||||||
$charset_collate .= " COLLATE $wpdb->collate";
|
|
||||||
}
|
|
||||||
|
|
||||||
$nggpictures = $wpdb->prefix . 'ngg_pictures';
|
|
||||||
$nggallery = $wpdb->prefix . 'ngg_gallery';
|
|
||||||
$nggalbum = $wpdb->prefix . 'ngg_album';
|
|
||||||
|
|
||||||
// could be case senstive : http://dev.mysql.com/doc/refman/5.1/en/identifier-case-sensitivity.html
|
|
||||||
if( !$wpdb->get_var( "SHOW TABLES LIKE '$nggpictures'" ) ) {
|
|
||||||
|
|
||||||
$sql = "CREATE TABLE " . $nggpictures . " (
|
|
||||||
pid BIGINT(20) NOT NULL AUTO_INCREMENT ,
|
|
||||||
image_slug VARCHAR(255) NOT NULL ,
|
|
||||||
post_id BIGINT(20) DEFAULT '0' NOT NULL ,
|
|
||||||
galleryid BIGINT(20) DEFAULT '0' NOT NULL ,
|
|
||||||
filename VARCHAR(255) NOT NULL ,
|
|
||||||
description MEDIUMTEXT NULL ,
|
|
||||||
alttext MEDIUMTEXT NULL ,
|
|
||||||
imagedate DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
|
||||||
exclude TINYINT NULL DEFAULT '0' ,
|
|
||||||
sortorder BIGINT(20) DEFAULT '0' NOT NULL ,
|
|
||||||
meta_data LONGTEXT,
|
|
||||||
PRIMARY KEY pid (pid),
|
|
||||||
KEY post_id (post_id)
|
|
||||||
) $charset_collate;";
|
|
||||||
|
|
||||||
dbDelta($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !$wpdb->get_var( "SHOW TABLES LIKE '$nggallery'" )) {
|
|
||||||
|
|
||||||
$sql = "CREATE TABLE " . $nggallery . " (
|
|
||||||
gid BIGINT(20) NOT NULL AUTO_INCREMENT ,
|
|
||||||
name VARCHAR(255) NOT NULL ,
|
|
||||||
slug VARCHAR(255) NOT NULL ,
|
|
||||||
path MEDIUMTEXT NULL ,
|
|
||||||
title MEDIUMTEXT NULL ,
|
|
||||||
galdesc MEDIUMTEXT NULL ,
|
|
||||||
pageid BIGINT(20) DEFAULT '0' NOT NULL ,
|
|
||||||
previewpic BIGINT(20) DEFAULT '0' NOT NULL ,
|
|
||||||
author BIGINT(20) DEFAULT '0' NOT NULL ,
|
|
||||||
PRIMARY KEY gid (gid)
|
|
||||||
) $charset_collate;";
|
|
||||||
|
|
||||||
dbDelta($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !$wpdb->get_var( "SHOW TABLES LIKE '$nggalbum'" )) {
|
|
||||||
|
|
||||||
$sql = "CREATE TABLE " . $nggalbum . " (
|
|
||||||
id BIGINT(20) NOT NULL AUTO_INCREMENT ,
|
|
||||||
name VARCHAR(255) NOT NULL ,
|
|
||||||
slug VARCHAR(255) NOT NULL ,
|
|
||||||
previewpic BIGINT(20) DEFAULT '0' NOT NULL ,
|
|
||||||
albumdesc MEDIUMTEXT NULL ,
|
|
||||||
sortorder LONGTEXT NOT NULL,
|
|
||||||
pageid BIGINT(20) DEFAULT '0' NOT NULL,
|
|
||||||
PRIMARY KEY id (id)
|
|
||||||
) $charset_collate;";
|
|
||||||
|
|
||||||
dbDelta($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
// check one table again, to be sure
|
|
||||||
if( !$wpdb->get_var( "SHOW TABLES LIKE '$nggpictures'" ) ) {
|
|
||||||
update_option( "ngg_init_check", __('NextGEN Gallery : Tables could not created, please check your database settings',"nggallery") );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$options = get_option('ngg_options');
|
|
||||||
// set the default settings, if we didn't upgrade
|
|
||||||
if ( empty( $options ) )
|
|
||||||
ngg_default_options();
|
|
||||||
|
|
||||||
// if all is passed , save the DBVERSION
|
|
||||||
add_option("ngg_db_version", NGG_DBVERSION);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setup the default option array for the gallery
|
|
||||||
*
|
|
||||||
* @access internal
|
|
||||||
* @since version 0.33
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function ngg_default_options() {
|
|
||||||
|
|
||||||
global $blog_id, $ngg;
|
|
||||||
|
|
||||||
$ngg_options['gallerypath'] = 'wp-content/gallery/'; // set default path to the gallery
|
|
||||||
$ngg_options['deleteImg'] = true; // delete Images
|
|
||||||
$ngg_options['swfUpload'] = true; // activate the batch upload
|
|
||||||
$ngg_options['usePermalinks'] = false; // use permalinks for parameters
|
|
||||||
$ngg_options['graphicLibrary'] = 'gd'; // default graphic library
|
|
||||||
$ngg_options['imageMagickDir'] = '/usr/local/bin/'; // default path to ImageMagick
|
|
||||||
$ngg_options['useMediaRSS'] = false; // activate the global Media RSS file
|
|
||||||
$ngg_options['usePicLens'] = false; // activate the PicLens Link for galleries
|
|
||||||
|
|
||||||
// Tags / categories
|
|
||||||
$ngg_options['activateTags'] = false; // append related images
|
|
||||||
$ngg_options['appendType'] = 'tags'; // look for category or tags
|
|
||||||
$ngg_options['maxImages'] = 7; // number of images toshow
|
|
||||||
|
|
||||||
// Thumbnail Settings
|
|
||||||
$ngg_options['thumbwidth'] = 100; // Thumb Width
|
|
||||||
$ngg_options['thumbheight'] = 75; // Thumb height
|
|
||||||
$ngg_options['thumbfix'] = true; // Fix the dimension
|
|
||||||
$ngg_options['thumbquality'] = 100; // Thumb Quality
|
|
||||||
|
|
||||||
// Image Settings
|
|
||||||
$ngg_options['imgWidth'] = 800; // Image Width
|
|
||||||
$ngg_options['imgHeight'] = 600; // Image height
|
|
||||||
$ngg_options['imgQuality'] = 85; // Image Quality
|
|
||||||
$ngg_options['imgCacheSinglePic'] = true; // Cached the singlepic
|
|
||||||
$ngg_options['imgBackup'] = true; // Create a backup
|
|
||||||
$ngg_options['imgAutoResize'] = false; // Resize after upload
|
|
||||||
|
|
||||||
// Gallery Settings
|
|
||||||
$ngg_options['galImages'] = '20'; // Number of images per page
|
|
||||||
$ngg_options['galPagedGalleries'] = 0; // Number of galleries per page (in a album)
|
|
||||||
$ngg_options['galColumns'] = 0; // Number of columns for the gallery
|
|
||||||
$ngg_options['galShowSlide'] = true; // Show slideshow
|
|
||||||
$ngg_options['galTextSlide'] = __('[Show as slideshow]','nggallery'); // Text for slideshow
|
|
||||||
$ngg_options['galTextGallery'] = __('[Show picture list]','nggallery'); // Text for gallery
|
|
||||||
$ngg_options['galShowOrder'] = 'gallery'; // Show order
|
|
||||||
$ngg_options['galSort'] = 'sortorder'; // Sort order
|
|
||||||
$ngg_options['galSortDir'] = 'ASC'; // Sort direction
|
|
||||||
$ngg_options['galNoPages'] = true; // use no subpages for gallery
|
|
||||||
$ngg_options['galImgBrowser'] = false; // Show ImageBrowser, instead effect
|
|
||||||
$ngg_options['galHiddenImg'] = false; // For paged galleries we can hide image
|
|
||||||
$ngg_options['galAjaxNav'] = false; // AJAX Navigation for Shutter effect
|
|
||||||
|
|
||||||
// Thumbnail Effect
|
|
||||||
$ngg_options['thumbEffect'] = 'shutter'; // select effect
|
|
||||||
$ngg_options['thumbCode'] = 'class="shutterset_%GALLERY_NAME%"';
|
|
||||||
|
|
||||||
// Watermark settings
|
|
||||||
$ngg_options['wmPos'] = 'botRight'; // Postion
|
|
||||||
$ngg_options['wmXpos'] = 5; // X Pos
|
|
||||||
$ngg_options['wmYpos'] = 5; // Y Pos
|
|
||||||
$ngg_options['wmType'] = 'text'; // Type : 'image' / 'text'
|
|
||||||
$ngg_options['wmPath'] = ''; // Path to image
|
|
||||||
$ngg_options['wmFont'] = 'arial.ttf'; // Font type
|
|
||||||
$ngg_options['wmSize'] = 10; // Font Size
|
|
||||||
$ngg_options['wmText'] = get_option('blogname'); // Text
|
|
||||||
$ngg_options['wmColor'] = '000000'; // Font Color
|
|
||||||
$ngg_options['wmOpaque'] = '100'; // Font Opaque
|
|
||||||
|
|
||||||
// Image Rotator settings
|
|
||||||
$ngg_options['enableIR'] = false;
|
|
||||||
$ngg_options['slideFx'] = 'fade';
|
|
||||||
$ngg_options['irURL'] = '';
|
|
||||||
$ngg_options['irXHTMLvalid'] = false;
|
|
||||||
$ngg_options['irAudio'] = '';
|
|
||||||
$ngg_options['irWidth'] = 320;
|
|
||||||
$ngg_options['irHeight'] = 240;
|
|
||||||
$ngg_options['irShuffle'] = true;
|
|
||||||
$ngg_options['irLinkfromdisplay'] = true;
|
|
||||||
$ngg_options['irShownavigation'] = false;
|
|
||||||
$ngg_options['irShowicons'] = false;
|
|
||||||
$ngg_options['irWatermark'] = false;
|
|
||||||
$ngg_options['irOverstretch'] = 'true';
|
|
||||||
$ngg_options['irRotatetime'] = 10;
|
|
||||||
$ngg_options['irTransition'] = 'random';
|
|
||||||
$ngg_options['irKenburns'] = false;
|
|
||||||
$ngg_options['irBackcolor'] = '000000';
|
|
||||||
$ngg_options['irFrontcolor'] = 'FFFFFF';
|
|
||||||
$ngg_options['irLightcolor'] = 'CC0000';
|
|
||||||
$ngg_options['irScreencolor'] = '000000';
|
|
||||||
|
|
||||||
// CSS Style
|
|
||||||
$ngg_options['activateCSS'] = true; // activate the CSS file
|
|
||||||
$ngg_options['CSSfile'] = 'nggallery.css'; // set default css filename
|
|
||||||
|
|
||||||
// special overrides for WPMU
|
|
||||||
if (is_multisite()) {
|
|
||||||
// get the site options
|
|
||||||
$ngg_wpmu_options = get_site_option('ngg_options');
|
|
||||||
|
|
||||||
// get the default value during first installation
|
|
||||||
if (!is_array($ngg_wpmu_options)) {
|
|
||||||
$ngg_wpmu_options['gallerypath'] = 'wp-content/blogs.dir/%BLOG_ID%/files/';
|
|
||||||
$ngg_wpmu_options['wpmuCSSfile'] = 'nggallery.css';
|
|
||||||
update_site_option('ngg_options', $ngg_wpmu_options);
|
|
||||||
}
|
|
||||||
|
|
||||||
$ngg_options['gallerypath'] = str_replace("%BLOG_ID%", $blog_id , $ngg_wpmu_options['gallerypath']);
|
|
||||||
$ngg_options['CSSfile'] = $ngg_wpmu_options['wpmuCSSfile'];
|
|
||||||
$ngg_options['imgCacheSinglePic'] = true; // under WPMU this should be enabled
|
|
||||||
}
|
|
||||||
|
|
||||||
update_option('ngg_options', $ngg_options);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deregister a capability from all classic roles
|
|
||||||
*
|
|
||||||
* @access internal
|
|
||||||
* @param string $capability name of the capability which should be deregister
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function ngg_remove_capability($capability){
|
|
||||||
// this function remove the $capability only from the classic roles
|
|
||||||
$check_order = array("subscriber", "contributor", "author", "editor", "administrator");
|
|
||||||
|
|
||||||
foreach ($check_order as $role) {
|
|
||||||
|
|
||||||
$role = get_role($role);
|
|
||||||
$role->remove_cap($capability) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Uninstall all settings and tables
|
|
||||||
* Called via Setup and register_unstall hook
|
|
||||||
*
|
|
||||||
* @access internal
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function nggallery_uninstall() {
|
|
||||||
global $wpdb;
|
|
||||||
|
|
||||||
// first remove all tables
|
|
||||||
$wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}ngg_pictures");
|
|
||||||
$wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}ngg_gallery");
|
|
||||||
$wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}ngg_album");
|
|
||||||
|
|
||||||
// then remove all options
|
|
||||||
delete_option( 'ngg_options' );
|
|
||||||
delete_option( 'ngg_db_version' );
|
|
||||||
delete_option( 'ngg_update_exists' );
|
|
||||||
delete_option( 'ngg_next_update' );
|
|
||||||
|
|
||||||
// now remove the capability
|
|
||||||
ngg_remove_capability("NextGEN Gallery overview");
|
|
||||||
ngg_remove_capability("NextGEN Use TinyMCE");
|
|
||||||
ngg_remove_capability("NextGEN Upload images");
|
|
||||||
ngg_remove_capability("NextGEN Manage gallery");
|
|
||||||
ngg_remove_capability("NextGEN Edit album");
|
|
||||||
ngg_remove_capability("NextGEN Change style");
|
|
||||||
ngg_remove_capability("NextGEN Change options");
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
Before Width: | Height: | Size: 329 B |
@ -1,35 +0,0 @@
|
|||||||
/* Fixes issue here http://code.google.com/p/jcrop/issues/detail?id=1 */
|
|
||||||
.jcrop-holder { text-align: left; }
|
|
||||||
|
|
||||||
.jcrop-vline, .jcrop-hline
|
|
||||||
{
|
|
||||||
font-size: 0;
|
|
||||||
position: absolute;
|
|
||||||
background: white url('Jcrop.gif') top left repeat;
|
|
||||||
}
|
|
||||||
.jcrop-vline { height: 100%; width: 1px !important; }
|
|
||||||
.jcrop-hline { width: 100%; height: 1px !important; }
|
|
||||||
.jcrop-handle {
|
|
||||||
font-size: 1px;
|
|
||||||
width: 7px !important;
|
|
||||||
height: 7px !important;
|
|
||||||
border: 1px #eee solid;
|
|
||||||
background-color: #333;
|
|
||||||
*width: 9px;
|
|
||||||
*height: 9px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jcrop-tracker { width: 100%; height: 100%; }
|
|
||||||
|
|
||||||
.custom .jcrop-vline,
|
|
||||||
.custom .jcrop-hline
|
|
||||||
{
|
|
||||||
background: yellow;
|
|
||||||
}
|
|
||||||
.custom .jcrop-handle
|
|
||||||
{
|
|
||||||
border-color: black;
|
|
||||||
background-color: #C7BB00;
|
|
||||||
-moz-border-radius: 3px;
|
|
||||||
-webkit-border-radius: 3px;
|
|
||||||
}
|
|
||||||
@ -1,161 +0,0 @@
|
|||||||
.colorpicker {
|
|
||||||
width: 356px;
|
|
||||||
height: 176px;
|
|
||||||
overflow: hidden;
|
|
||||||
position: absolute;
|
|
||||||
background: url(../images/colorpicker_background.png);
|
|
||||||
font-family: Arial, Helvetica, sans-serif;
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.colorpicker_color {
|
|
||||||
width: 150px;
|
|
||||||
height: 150px;
|
|
||||||
left: 14px;
|
|
||||||
top: 13px;
|
|
||||||
position: absolute;
|
|
||||||
background: #f00;
|
|
||||||
overflow: hidden;
|
|
||||||
cursor: crosshair;
|
|
||||||
}
|
|
||||||
.colorpicker_color div {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 150px;
|
|
||||||
height: 150px;
|
|
||||||
background: url(../images/colorpicker_overlay.png);
|
|
||||||
}
|
|
||||||
.colorpicker_color div div {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 11px;
|
|
||||||
height: 11px;
|
|
||||||
overflow: hidden;
|
|
||||||
background: url(../images/colorpicker_select.gif);
|
|
||||||
margin: -5px 0 0 -5px;
|
|
||||||
}
|
|
||||||
.colorpicker_hue {
|
|
||||||
position: absolute;
|
|
||||||
top: 13px;
|
|
||||||
left: 171px;
|
|
||||||
width: 35px;
|
|
||||||
height: 150px;
|
|
||||||
cursor: n-resize;
|
|
||||||
}
|
|
||||||
.colorpicker_hue div {
|
|
||||||
position: absolute;
|
|
||||||
width: 35px;
|
|
||||||
height: 9px;
|
|
||||||
overflow: hidden;
|
|
||||||
background: url(../images/colorpicker_indic.gif) left top;
|
|
||||||
margin: -4px 0 0 0;
|
|
||||||
left: 0px;
|
|
||||||
}
|
|
||||||
.colorpicker_new_color {
|
|
||||||
position: absolute;
|
|
||||||
width: 60px;
|
|
||||||
height: 30px;
|
|
||||||
left: 213px;
|
|
||||||
top: 13px;
|
|
||||||
background: #f00;
|
|
||||||
}
|
|
||||||
.colorpicker_current_color {
|
|
||||||
position: absolute;
|
|
||||||
width: 60px;
|
|
||||||
height: 30px;
|
|
||||||
left: 283px;
|
|
||||||
top: 13px;
|
|
||||||
background: #f00;
|
|
||||||
}
|
|
||||||
.colorpicker input {
|
|
||||||
background-color: transparent;
|
|
||||||
border: 1px solid transparent;
|
|
||||||
position: absolute;
|
|
||||||
font-size: 10px;
|
|
||||||
font-family: Arial, Helvetica, sans-serif;
|
|
||||||
color: #898989;
|
|
||||||
top: 4px;
|
|
||||||
right: 11px;
|
|
||||||
text-align: right;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
height: 13px;
|
|
||||||
}
|
|
||||||
.colorpicker_hex {
|
|
||||||
position: absolute;
|
|
||||||
width: 72px;
|
|
||||||
height: 22px;
|
|
||||||
background: url(../images/colorpicker_hex.png) top;
|
|
||||||
left: 212px;
|
|
||||||
top: 142px;
|
|
||||||
}
|
|
||||||
.colorpicker_hex input {
|
|
||||||
right: 6px;
|
|
||||||
}
|
|
||||||
.colorpicker_field {
|
|
||||||
height: 22px;
|
|
||||||
width: 62px;
|
|
||||||
background-position: top;
|
|
||||||
position: absolute;
|
|
||||||
}
|
|
||||||
.colorpicker_field span {
|
|
||||||
position: absolute;
|
|
||||||
width: 12px;
|
|
||||||
height: 22px;
|
|
||||||
overflow: hidden;
|
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
cursor: n-resize;
|
|
||||||
}
|
|
||||||
.colorpicker_rgb_r {
|
|
||||||
background-image: url(../images/colorpicker_rgb_r.png);
|
|
||||||
top: 52px;
|
|
||||||
left: 212px;
|
|
||||||
}
|
|
||||||
.colorpicker_rgb_g {
|
|
||||||
background-image: url(../images/colorpicker_rgb_g.png);
|
|
||||||
top: 82px;
|
|
||||||
left: 212px;
|
|
||||||
}
|
|
||||||
.colorpicker_rgb_b {
|
|
||||||
background-image: url(../images/colorpicker_rgb_b.png);
|
|
||||||
top: 112px;
|
|
||||||
left: 212px;
|
|
||||||
}
|
|
||||||
.colorpicker_hsb_h {
|
|
||||||
background-image: url(../images/colorpicker_hsb_h.png);
|
|
||||||
top: 52px;
|
|
||||||
left: 282px;
|
|
||||||
}
|
|
||||||
.colorpicker_hsb_s {
|
|
||||||
background-image: url(../images/colorpicker_hsb_s.png);
|
|
||||||
top: 82px;
|
|
||||||
left: 282px;
|
|
||||||
}
|
|
||||||
.colorpicker_hsb_b {
|
|
||||||
background-image: url(../images/colorpicker_hsb_b.png);
|
|
||||||
top: 112px;
|
|
||||||
left: 282px;
|
|
||||||
}
|
|
||||||
.colorpicker_submit {
|
|
||||||
position: absolute;
|
|
||||||
width: 22px;
|
|
||||||
height: 22px;
|
|
||||||
background: url(../images/colorpicker_submit.png) top;
|
|
||||||
left: 322px;
|
|
||||||
top: 142px;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
.colorpicker_focus {
|
|
||||||
background-position: center;
|
|
||||||
}
|
|
||||||
.colorpicker_hex.colorpicker_focus {
|
|
||||||
background-position: bottom;
|
|
||||||
}
|
|
||||||
.colorpicker_submit.colorpicker_focus {
|
|
||||||
background-position: bottom;
|
|
||||||
}
|
|
||||||
.colorpicker_slider {
|
|
||||||
background-position: bottom;
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 49 B |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 532 B |
|
Before Width: | Height: | Size: 970 B |
|
Before Width: | Height: | Size: 1012 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 86 B |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 970 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 78 B |
|
Before Width: | Height: | Size: 984 B |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 562 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 970 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 86 B |
|
Before Width: | Height: | Size: 1008 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1018 B |
|
Before Width: | Height: | Size: 997 B |
|
Before Width: | Height: | Size: 506 B |
|
Before Width: | Height: | Size: 518 B |
|
Before Width: | Height: | Size: 315 B |
@ -1,484 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
* Color picker
|
|
||||||
* Author: Stefan Petre www.eyecon.ro
|
|
||||||
*
|
|
||||||
* Dual licensed under the MIT and GPL licenses
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
(function ($) {
|
|
||||||
var ColorPicker = function () {
|
|
||||||
var
|
|
||||||
ids = {},
|
|
||||||
inAction,
|
|
||||||
charMin = 65,
|
|
||||||
visible,
|
|
||||||
tpl = '<div class="colorpicker"><div class="colorpicker_color"><div><div></div></div></div><div class="colorpicker_hue"><div></div></div><div class="colorpicker_new_color"></div><div class="colorpicker_current_color"></div><div class="colorpicker_hex"><input type="text" maxlength="6" size="6" /></div><div class="colorpicker_rgb_r colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_g colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_h colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_s colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_submit"></div></div>',
|
|
||||||
defaults = {
|
|
||||||
eventName: 'click',
|
|
||||||
onShow: function () {},
|
|
||||||
onBeforeShow: function(){},
|
|
||||||
onHide: function () {},
|
|
||||||
onChange: function () {},
|
|
||||||
onSubmit: function () {},
|
|
||||||
color: 'ff0000',
|
|
||||||
livePreview: true,
|
|
||||||
flat: false
|
|
||||||
},
|
|
||||||
fillRGBFields = function (hsb, cal) {
|
|
||||||
var rgb = HSBToRGB(hsb);
|
|
||||||
$(cal).data('colorpicker').fields
|
|
||||||
.eq(1).val(rgb.r).end()
|
|
||||||
.eq(2).val(rgb.g).end()
|
|
||||||
.eq(3).val(rgb.b).end();
|
|
||||||
},
|
|
||||||
fillHSBFields = function (hsb, cal) {
|
|
||||||
$(cal).data('colorpicker').fields
|
|
||||||
.eq(4).val(hsb.h).end()
|
|
||||||
.eq(5).val(hsb.s).end()
|
|
||||||
.eq(6).val(hsb.b).end();
|
|
||||||
},
|
|
||||||
fillHexFields = function (hsb, cal) {
|
|
||||||
$(cal).data('colorpicker').fields
|
|
||||||
.eq(0).val(HSBToHex(hsb)).end();
|
|
||||||
},
|
|
||||||
setSelector = function (hsb, cal) {
|
|
||||||
$(cal).data('colorpicker').selector.css('backgroundColor', '#' + HSBToHex({h: hsb.h, s: 100, b: 100}));
|
|
||||||
$(cal).data('colorpicker').selectorIndic.css({
|
|
||||||
left: parseInt(150 * hsb.s/100, 10),
|
|
||||||
top: parseInt(150 * (100-hsb.b)/100, 10)
|
|
||||||
});
|
|
||||||
},
|
|
||||||
setHue = function (hsb, cal) {
|
|
||||||
$(cal).data('colorpicker').hue.css('top', parseInt(150 - 150 * hsb.h/360, 10));
|
|
||||||
},
|
|
||||||
setCurrentColor = function (hsb, cal) {
|
|
||||||
$(cal).data('colorpicker').currentColor.css('backgroundColor', '#' + HSBToHex(hsb));
|
|
||||||
},
|
|
||||||
setNewColor = function (hsb, cal) {
|
|
||||||
$(cal).data('colorpicker').newColor.css('backgroundColor', '#' + HSBToHex(hsb));
|
|
||||||
},
|
|
||||||
keyDown = function (ev) {
|
|
||||||
var pressedKey = ev.charCode || ev.keyCode || -1;
|
|
||||||
if ((pressedKey > charMin && pressedKey <= 90) || pressedKey == 32) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
var cal = $(this).parent().parent();
|
|
||||||
if (cal.data('colorpicker').livePreview === true) {
|
|
||||||
change.apply(this);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
change = function (ev) {
|
|
||||||
var cal = $(this).parent().parent(), col;
|
|
||||||
if (this.parentNode.className.indexOf('_hex') > 0) {
|
|
||||||
cal.data('colorpicker').color = col = HexToHSB(fixHex(this.value));
|
|
||||||
} else if (this.parentNode.className.indexOf('_hsb') > 0) {
|
|
||||||
cal.data('colorpicker').color = col = fixHSB({
|
|
||||||
h: parseInt(cal.data('colorpicker').fields.eq(4).val(), 10),
|
|
||||||
s: parseInt(cal.data('colorpicker').fields.eq(5).val(), 10),
|
|
||||||
b: parseInt(cal.data('colorpicker').fields.eq(6).val(), 10)
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
cal.data('colorpicker').color = col = RGBToHSB(fixRGB({
|
|
||||||
r: parseInt(cal.data('colorpicker').fields.eq(1).val(), 10),
|
|
||||||
g: parseInt(cal.data('colorpicker').fields.eq(2).val(), 10),
|
|
||||||
b: parseInt(cal.data('colorpicker').fields.eq(3).val(), 10)
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
if (ev) {
|
|
||||||
fillRGBFields(col, cal.get(0));
|
|
||||||
fillHexFields(col, cal.get(0));
|
|
||||||
fillHSBFields(col, cal.get(0));
|
|
||||||
}
|
|
||||||
setSelector(col, cal.get(0));
|
|
||||||
setHue(col, cal.get(0));
|
|
||||||
setNewColor(col, cal.get(0));
|
|
||||||
cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col)]);
|
|
||||||
},
|
|
||||||
blur = function (ev) {
|
|
||||||
var cal = $(this).parent().parent();
|
|
||||||
cal.data('colorpicker').fields.parent().removeClass('colorpicker_focus');
|
|
||||||
},
|
|
||||||
focus = function () {
|
|
||||||
charMin = this.parentNode.className.indexOf('_hex') > 0 ? 70 : 65;
|
|
||||||
$(this).parent().parent().data('colorpicker').fields.parent().removeClass('colorpicker_focus');
|
|
||||||
$(this).parent().addClass('colorpicker_focus');
|
|
||||||
},
|
|
||||||
downIncrement = function (ev) {
|
|
||||||
var field = $(this).parent().find('input').focus();
|
|
||||||
var current = {
|
|
||||||
el: $(this).parent().addClass('colorpicker_slider'),
|
|
||||||
max: this.parentNode.className.indexOf('_hsb_h') > 0 ? 360 : (this.parentNode.className.indexOf('_hsb') > 0 ? 100 : 255),
|
|
||||||
y: ev.pageY,
|
|
||||||
field: field,
|
|
||||||
val: parseInt(field.val(), 10),
|
|
||||||
preview: $(this).parent().parent().data('colorpicker').livePreview
|
|
||||||
};
|
|
||||||
$(document).bind('mouseup', current, upIncrement);
|
|
||||||
$(document).bind('mousemove', current, moveIncrement);
|
|
||||||
},
|
|
||||||
moveIncrement = function (ev) {
|
|
||||||
ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val + ev.pageY - ev.data.y, 10))));
|
|
||||||
if (ev.data.preview) {
|
|
||||||
change.apply(ev.data.field.get(0), [true]);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
upIncrement = function (ev) {
|
|
||||||
change.apply(ev.data.field.get(0), [true]);
|
|
||||||
ev.data.el.removeClass('colorpicker_slider').find('input').focus();
|
|
||||||
$(document).unbind('mouseup', upIncrement);
|
|
||||||
$(document).unbind('mousemove', moveIncrement);
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
downHue = function (ev) {
|
|
||||||
var current = {
|
|
||||||
cal: $(this).parent(),
|
|
||||||
y: $(this).offset().top
|
|
||||||
};
|
|
||||||
current.preview = current.cal.data('colorpicker').livePreview;
|
|
||||||
$(document).bind('mouseup', current, upHue);
|
|
||||||
$(document).bind('mousemove', current, moveHue);
|
|
||||||
},
|
|
||||||
moveHue = function (ev) {
|
|
||||||
change.apply(
|
|
||||||
ev.data.cal.data('colorpicker')
|
|
||||||
.fields
|
|
||||||
.eq(4)
|
|
||||||
.val(parseInt(360*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.y))))/150, 10))
|
|
||||||
.get(0),
|
|
||||||
[ev.data.preview]
|
|
||||||
);
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
upHue = function (ev) {
|
|
||||||
fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
|
|
||||||
fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
|
|
||||||
$(document).unbind('mouseup', upHue);
|
|
||||||
$(document).unbind('mousemove', moveHue);
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
downSelector = function (ev) {
|
|
||||||
var current = {
|
|
||||||
cal: $(this).parent(),
|
|
||||||
pos: $(this).offset()
|
|
||||||
};
|
|
||||||
current.preview = current.cal.data('colorpicker').livePreview;
|
|
||||||
$(document).bind('mouseup', current, upSelector);
|
|
||||||
$(document).bind('mousemove', current, moveSelector);
|
|
||||||
},
|
|
||||||
moveSelector = function (ev) {
|
|
||||||
change.apply(
|
|
||||||
ev.data.cal.data('colorpicker')
|
|
||||||
.fields
|
|
||||||
.eq(6)
|
|
||||||
.val(parseInt(100*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.pos.top))))/150, 10))
|
|
||||||
.end()
|
|
||||||
.eq(5)
|
|
||||||
.val(parseInt(100*(Math.max(0,Math.min(150,(ev.pageX - ev.data.pos.left))))/150, 10))
|
|
||||||
.get(0),
|
|
||||||
[ev.data.preview]
|
|
||||||
);
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
upSelector = function (ev) {
|
|
||||||
fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
|
|
||||||
fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
|
|
||||||
$(document).unbind('mouseup', upSelector);
|
|
||||||
$(document).unbind('mousemove', moveSelector);
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
enterSubmit = function (ev) {
|
|
||||||
$(this).addClass('colorpicker_focus');
|
|
||||||
},
|
|
||||||
leaveSubmit = function (ev) {
|
|
||||||
$(this).removeClass('colorpicker_focus');
|
|
||||||
},
|
|
||||||
clickSubmit = function (ev) {
|
|
||||||
var cal = $(this).parent();
|
|
||||||
var col = cal.data('colorpicker').color;
|
|
||||||
cal.data('colorpicker').origColor = col;
|
|
||||||
setCurrentColor(col, cal.get(0));
|
|
||||||
cal.data('colorpicker').onSubmit(col, HSBToHex(col), HSBToRGB(col), cal.data('colorpicker').el);
|
|
||||||
},
|
|
||||||
show = function (ev) {
|
|
||||||
var cal = $('#' + $(this).data('colorpickerId'));
|
|
||||||
cal.data('colorpicker').onBeforeShow.apply(this, [cal.get(0)]);
|
|
||||||
var pos = $(this).offset();
|
|
||||||
var viewPort = getViewport();
|
|
||||||
var top = pos.top + this.offsetHeight;
|
|
||||||
var left = pos.left;
|
|
||||||
if (top + 176 > viewPort.t + viewPort.h) {
|
|
||||||
top -= this.offsetHeight + 176;
|
|
||||||
}
|
|
||||||
if (left + 356 > viewPort.l + viewPort.w) {
|
|
||||||
left -= 356;
|
|
||||||
}
|
|
||||||
cal.css({left: left + 'px', top: top + 'px'});
|
|
||||||
if (cal.data('colorpicker').onShow.apply(this, [cal.get(0)]) != false) {
|
|
||||||
cal.show();
|
|
||||||
}
|
|
||||||
$(document).bind('mousedown', {cal: cal}, hide);
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
hide = function (ev) {
|
|
||||||
if (!isChildOf(ev.data.cal.get(0), ev.target, ev.data.cal.get(0))) {
|
|
||||||
if (ev.data.cal.data('colorpicker').onHide.apply(this, [ev.data.cal.get(0)]) != false) {
|
|
||||||
ev.data.cal.hide();
|
|
||||||
}
|
|
||||||
$(document).unbind('mousedown', hide);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
isChildOf = function(parentEl, el, container) {
|
|
||||||
if (parentEl == el) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (parentEl.contains) {
|
|
||||||
return parentEl.contains(el);
|
|
||||||
}
|
|
||||||
if ( parentEl.compareDocumentPosition ) {
|
|
||||||
return !!(parentEl.compareDocumentPosition(el) & 16);
|
|
||||||
}
|
|
||||||
var prEl = el.parentNode;
|
|
||||||
while(prEl && prEl != container) {
|
|
||||||
if (prEl == parentEl)
|
|
||||||
return true;
|
|
||||||
prEl = prEl.parentNode;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
getViewport = function () {
|
|
||||||
var m = document.compatMode == 'CSS1Compat';
|
|
||||||
return {
|
|
||||||
l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
|
|
||||||
t : window.pageYOffset || (m ? document.documentElement.scrollTop : document.body.scrollTop),
|
|
||||||
w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth),
|
|
||||||
h : window.innerHeight || (m ? document.documentElement.clientHeight : document.body.clientHeight)
|
|
||||||
};
|
|
||||||
},
|
|
||||||
fixHSB = function (hsb) {
|
|
||||||
return {
|
|
||||||
h: Math.min(360, Math.max(0, hsb.h)),
|
|
||||||
s: Math.min(100, Math.max(0, hsb.s)),
|
|
||||||
b: Math.min(100, Math.max(0, hsb.b))
|
|
||||||
};
|
|
||||||
},
|
|
||||||
fixRGB = function (rgb) {
|
|
||||||
return {
|
|
||||||
r: Math.min(255, Math.max(0, rgb.r)),
|
|
||||||
g: Math.min(255, Math.max(0, rgb.g)),
|
|
||||||
b: Math.min(255, Math.max(0, rgb.b))
|
|
||||||
};
|
|
||||||
},
|
|
||||||
fixHex = function (hex) {
|
|
||||||
var len = 6 - hex.length;
|
|
||||||
if (len > 0) {
|
|
||||||
var o = [];
|
|
||||||
for (var i=0; i<len; i++) {
|
|
||||||
o.push('0');
|
|
||||||
}
|
|
||||||
o.push(hex);
|
|
||||||
hex = o.join('');
|
|
||||||
}
|
|
||||||
return hex;
|
|
||||||
},
|
|
||||||
HexToRGB = function (hex) {
|
|
||||||
var hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
|
|
||||||
return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)};
|
|
||||||
},
|
|
||||||
HexToHSB = function (hex) {
|
|
||||||
return RGBToHSB(HexToRGB(hex));
|
|
||||||
},
|
|
||||||
RGBToHSB = 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;
|
|
||||||
if (max != 0) {
|
|
||||||
|
|
||||||
}
|
|
||||||
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;
|
|
||||||
},
|
|
||||||
HSBToRGB = 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)};
|
|
||||||
},
|
|
||||||
RGBToHex = 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('');
|
|
||||||
},
|
|
||||||
HSBToHex = function (hsb) {
|
|
||||||
return RGBToHex(HSBToRGB(hsb));
|
|
||||||
},
|
|
||||||
restoreOriginal = function () {
|
|
||||||
var cal = $(this).parent();
|
|
||||||
var col = cal.data('colorpicker').origColor;
|
|
||||||
cal.data('colorpicker').color = col;
|
|
||||||
fillRGBFields(col, cal.get(0));
|
|
||||||
fillHexFields(col, cal.get(0));
|
|
||||||
fillHSBFields(col, cal.get(0));
|
|
||||||
setSelector(col, cal.get(0));
|
|
||||||
setHue(col, cal.get(0));
|
|
||||||
setNewColor(col, cal.get(0));
|
|
||||||
};
|
|
||||||
return {
|
|
||||||
init: function (opt) {
|
|
||||||
opt = $.extend({}, defaults, opt||{});
|
|
||||||
if (typeof opt.color == 'string') {
|
|
||||||
opt.color = HexToHSB(opt.color);
|
|
||||||
} else if (opt.color.r != undefined && opt.color.g != undefined && opt.color.b != undefined) {
|
|
||||||
opt.color = RGBToHSB(opt.color);
|
|
||||||
} else if (opt.color.h != undefined && opt.color.s != undefined && opt.color.b != undefined) {
|
|
||||||
opt.color = fixHSB(opt.color);
|
|
||||||
} else {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
return this.each(function () {
|
|
||||||
if (!$(this).data('colorpickerId')) {
|
|
||||||
var options = $.extend({}, opt);
|
|
||||||
options.origColor = opt.color;
|
|
||||||
var id = 'collorpicker_' + parseInt(Math.random() * 1000);
|
|
||||||
$(this).data('colorpickerId', id);
|
|
||||||
var cal = $(tpl).attr('id', id);
|
|
||||||
if (options.flat) {
|
|
||||||
cal.appendTo(this).show();
|
|
||||||
} else {
|
|
||||||
cal.appendTo(document.body);
|
|
||||||
}
|
|
||||||
options.fields = cal
|
|
||||||
.find('input')
|
|
||||||
.bind('keyup', keyDown)
|
|
||||||
.bind('change', change)
|
|
||||||
.bind('blur', blur)
|
|
||||||
.bind('focus', focus);
|
|
||||||
cal
|
|
||||||
.find('span').bind('mousedown', downIncrement).end()
|
|
||||||
.find('>div.colorpicker_current_color').bind('click', restoreOriginal);
|
|
||||||
options.selector = cal.find('div.colorpicker_color').bind('mousedown', downSelector);
|
|
||||||
options.selectorIndic = options.selector.find('div div');
|
|
||||||
options.el = this;
|
|
||||||
options.hue = cal.find('div.colorpicker_hue div');
|
|
||||||
cal.find('div.colorpicker_hue').bind('mousedown', downHue);
|
|
||||||
options.newColor = cal.find('div.colorpicker_new_color');
|
|
||||||
options.currentColor = cal.find('div.colorpicker_current_color');
|
|
||||||
cal.data('colorpicker', options);
|
|
||||||
cal.find('div.colorpicker_submit')
|
|
||||||
.bind('mouseenter', enterSubmit)
|
|
||||||
.bind('mouseleave', leaveSubmit)
|
|
||||||
.bind('click', clickSubmit);
|
|
||||||
fillRGBFields(options.color, cal.get(0));
|
|
||||||
fillHSBFields(options.color, cal.get(0));
|
|
||||||
fillHexFields(options.color, cal.get(0));
|
|
||||||
setHue(options.color, cal.get(0));
|
|
||||||
setSelector(options.color, cal.get(0));
|
|
||||||
setCurrentColor(options.color, cal.get(0));
|
|
||||||
setNewColor(options.color, cal.get(0));
|
|
||||||
if (options.flat) {
|
|
||||||
cal.css({
|
|
||||||
position: 'relative',
|
|
||||||
display: 'block'
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
$(this).bind(options.eventName, show);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
showPicker: function() {
|
|
||||||
return this.each( function () {
|
|
||||||
if ($(this).data('colorpickerId')) {
|
|
||||||
show.apply(this);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
hidePicker: function() {
|
|
||||||
return this.each( function () {
|
|
||||||
if ($(this).data('colorpickerId')) {
|
|
||||||
$('#' + $(this).data('colorpickerId')).hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
setColor: function(col) {
|
|
||||||
if (typeof col == 'string') {
|
|
||||||
col = HexToHSB(col);
|
|
||||||
} else if (col.r != undefined && col.g != undefined && col.b != undefined) {
|
|
||||||
col = RGBToHSB(col);
|
|
||||||
} else if (col.h != undefined && col.s != undefined && col.b != undefined) {
|
|
||||||
col = fixHSB(col);
|
|
||||||
} else {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
return this.each(function(){
|
|
||||||
if ($(this).data('colorpickerId')) {
|
|
||||||
var cal = $('#' + $(this).data('colorpickerId'));
|
|
||||||
cal.data('colorpicker').color = col;
|
|
||||||
cal.data('colorpicker').origColor = col;
|
|
||||||
fillRGBFields(col, cal.get(0));
|
|
||||||
fillHSBFields(col, cal.get(0));
|
|
||||||
fillHexFields(col, cal.get(0));
|
|
||||||
setHue(col, cal.get(0));
|
|
||||||
setSelector(col, cal.get(0));
|
|
||||||
setCurrentColor(col, cal.get(0));
|
|
||||||
setNewColor(col, cal.get(0));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}();
|
|
||||||
$.fn.extend({
|
|
||||||
ColorPicker: ColorPicker.init,
|
|
||||||
ColorPickerHide: ColorPicker.hidePicker,
|
|
||||||
ColorPickerShow: ColorPicker.showPicker,
|
|
||||||
ColorPickerSetColor: ColorPicker.setColor
|
|
||||||
});
|
|
||||||
})(jQuery)
|
|
||||||
@ -1,391 +0,0 @@
|
|||||||
/*!
|
|
||||||
* jQuery UI 1.8.6
|
|
||||||
*
|
|
||||||
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
|
||||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
|
||||||
* http://jquery.org/license
|
|
||||||
*
|
|
||||||
* http://docs.jquery.com/UI
|
|
||||||
*/
|
|
||||||
(function(c,j){function k(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.6",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,
|
|
||||||
NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,
|
|
||||||
"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");
|
|
||||||
if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,l,m){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(l)g-=parseFloat(c.curCSS(f,
|
|
||||||
"border"+this+"Width",true))||0;if(m)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,
|
|
||||||
d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){var b=a.nodeName.toLowerCase(),d=c.attr(a,"tabindex");if("area"===b){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&k(a)}return(/input|select|textarea|button|object/.test(b)?!a.disabled:"a"==b?a.href||!isNaN(d):!isNaN(d))&&k(a)},tabbable:function(a){var b=c.attr(a,"tabindex");return(isNaN(b)||b>=0)&&c(a).is(":focusable")}});
|
|
||||||
c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&
|
|
||||||
b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&c.ui.isOverAxis(b,e,i)}})}})(jQuery);
|
|
||||||
;/*!
|
|
||||||
* jQuery UI Widget 1.8.6
|
|
||||||
*
|
|
||||||
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
|
||||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
|
||||||
* http://jquery.org/license
|
|
||||||
*
|
|
||||||
* http://docs.jquery.com/UI/Widget
|
|
||||||
*/
|
|
||||||
(function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)b(d).triggerHandler("remove");k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){b(this).triggerHandler("remove")});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=function(h){return!!b.data(h,
|
|
||||||
a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):d;if(e&&d.charAt(0)==="_")return h;
|
|
||||||
e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=b.extend(true,{},this.options,
|
|
||||||
this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},
|
|
||||||
widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",c);return this},
|
|
||||||
enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
|
|
||||||
;/*!
|
|
||||||
* jQuery UI Mouse 1.8.6
|
|
||||||
*
|
|
||||||
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
|
||||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
|
||||||
* http://jquery.org/license
|
|
||||||
*
|
|
||||||
* http://docs.jquery.com/UI/Mouse
|
|
||||||
*
|
|
||||||
* Depends:
|
|
||||||
* jquery.ui.widget.js
|
|
||||||
*/
|
|
||||||
(function(c){c.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(b){return a._mouseDown(b)}).bind("click."+this.widgetName,function(b){if(a._preventClickEvent){a._preventClickEvent=false;b.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(a){a.originalEvent=a.originalEvent||{};if(!a.originalEvent.mouseHandled){this._mouseStarted&&
|
|
||||||
this._mouseUp(a);this._mouseDownEvent=a;var b=this,e=a.which==1,f=typeof this.options.cancel=="string"?c(a.target).parents().add(a.target).filter(this.options.cancel).length:false;if(!e||f||!this._mouseCapture(a))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){b.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted=this._mouseStart(a)!==false;if(!this._mouseStarted){a.preventDefault();
|
|
||||||
return true}}this._mouseMoveDelegate=function(d){return b._mouseMove(d)};this._mouseUpDelegate=function(d){return b._mouseUp(d)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);a.preventDefault();return a.originalEvent.mouseHandled=true}},_mouseMove:function(a){if(c.browser.msie&&!(document.documentMode>=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&
|
|
||||||
this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=a.target==this._mouseDownEvent.target;this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-
|
|
||||||
a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery);
|
|
||||||
;/*
|
|
||||||
* jQuery UI Position 1.8.6
|
|
||||||
*
|
|
||||||
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
|
||||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
|
||||||
* http://jquery.org/license
|
|
||||||
*
|
|
||||||
* http://docs.jquery.com/UI/Position
|
|
||||||
*/
|
|
||||||
(function(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.setTimeout){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j={top:b.of.pageY,
|
|
||||||
left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/2;if(b.at[1]==="bottom")j.top+=
|
|
||||||
k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+parseInt(c.curCSS(this,"marginRight",true))||0,w=m+q+parseInt(c.curCSS(this,"marginBottom",true))||0,i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]==="center")i.top-=m/2;
|
|
||||||
i.left=parseInt(i.left);i.top=parseInt(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();b.left=d>0?
|
|
||||||
b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];b.left+=
|
|
||||||
a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d=c(b),
|
|
||||||
g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery);
|
|
||||||
;/*
|
|
||||||
* jQuery UI Draggable 1.8.6
|
|
||||||
*
|
|
||||||
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
|
||||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
|
||||||
* http://jquery.org/license
|
|
||||||
*
|
|
||||||
* http://docs.jquery.com/UI/Draggables
|
|
||||||
*
|
|
||||||
* Depends:
|
|
||||||
* jquery.ui.core.js
|
|
||||||
* jquery.ui.mouse.js
|
|
||||||
* jquery.ui.widget.js
|
|
||||||
*/
|
|
||||||
(function(d){d.widget("ui.draggable",d.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper==
|
|
||||||
"original"&&!/^(?:r|a|f)/.test(this.element.css("position")))this.element[0].style.position="relative";this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();return this}},_mouseCapture:function(a){var b=
|
|
||||||
this.options;if(this.helper||b.disabled||d(a.target).is(".ui-resizable-handle"))return false;this.handle=this._getHandle(a);if(!this.handle)return false;return true},_mouseStart:function(a){var b=this.options;this.helper=this._createHelper(a);this._cacheHelperProportions();if(d.ui.ddmanager)d.ui.ddmanager.current=this;this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top-
|
|
||||||
this.margins.top,left:this.offset.left-this.margins.left};d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this.position=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);b.containment&&this._setContainment();if(this._trigger("start",a)===false){this._clear();return false}this._cacheHelperProportions();
|
|
||||||
d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(a,true);return true},_mouseDrag:function(a,b){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!b){b=this._uiHash();if(this._trigger("drag",a,b)===false){this._mouseUp({});return false}this.position=b.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||
|
|
||||||
this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);return false},_mouseStop:function(a){var b=false;if(d.ui.ddmanager&&!this.options.dropBehaviour)b=d.ui.ddmanager.drop(this,a);if(this.dropped){b=this.dropped;this.dropped=false}if(!this.element[0]||!this.element[0].parentNode)return false;if(this.options.revert=="invalid"&&!b||this.options.revert=="valid"&&b||this.options.revert===true||d.isFunction(this.options.revert)&&this.options.revert.call(this.element,
|
|
||||||
b)){var c=this;d(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){c._trigger("stop",a)!==false&&c._clear()})}else this._trigger("stop",a)!==false&&this._clear();return false},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(a){var b=!this.options.handle||!d(this.options.handle,this.element).length?true:false;d(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==
|
|
||||||
a.target)b=true});return b},_createHelper:function(a){var b=this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a])):b.helper=="clone"?this.element.clone():this.element;a.parents("body").length||a.appendTo(b.appendTo=="parent"?this.element[0].parentNode:b.appendTo);a[0]!=this.element[0]&&!/(fixed|absolute)/.test(a.css("position"))&&a.css("position","absolute");return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string")a=a.split(" ");if(d.isArray(a))a={left:+a[0],top:+a[1]||
|
|
||||||
0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],
|
|
||||||
this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a={top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top-
|
|
||||||
(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var a=this.options;if(a.containment==
|
|
||||||
"parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,d(a.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(d(a.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)&&
|
|
||||||
a.containment.constructor!=Array){var b=d(a.containment)[0];if(b){a=d(a.containment).offset();var c=d(b).css("overflow")!="hidden";this.containment=[a.left+(parseInt(d(b).css("borderLeftWidth"),10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0)-this.margins.left,a.top+(parseInt(d(b).css("borderTopWidth"),10)||0)+(parseInt(d(b).css("paddingTop"),10)||0)-this.margins.top,a.left+(c?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"),
|
|
||||||
10)||0)-this.helperProportions.width-this.margins.left,a.top+(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"),10)||0)-(parseInt(d(b).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}}else if(a.containment.constructor==Array)this.containment=a.containment},_convertPositionTo:function(a,b){if(!b)b=this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],
|
|
||||||
this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName);return{top:b.top+this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():
|
|
||||||
f?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName),e=a.pageX,g=a.pageY;if(this.originalPosition){if(this.containment){if(a.pageX-this.offset.click.left<this.containment[0])e=this.containment[0]+this.offset.click.left;if(a.pageY-this.offset.click.top<this.containment[1])g=this.containment[1]+
|
|
||||||
this.offset.click.top;if(a.pageX-this.offset.click.left>this.containment[2])e=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g=this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g-this.originalPageY)/b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:!(g-this.offset.click.top<this.containment[1])?g-b.grid[1]:g+b.grid[1]:g;e=this.originalPageX+
|
|
||||||
Math.round((e-this.originalPageX)/b.grid[0])*b.grid[0];e=this.containment?!(e-this.offset.click.left<this.containment[0]||e-this.offset.click.left>this.containment[2])?e:!(e-this.offset.click.left<this.containment[0])?e-b.grid[0]:e+b.grid[0]:e}}return{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop()),left:e-this.offset.click.left-
|
|
||||||
this.offset.relative.left-this.offset.parent.left+(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove();this.helper=null;this.cancelHelperRemoval=false},_trigger:function(a,b,c){c=c||this._uiHash();d.ui.plugin.call(this,a,[b,c]);if(a=="drag")this.positionAbs=
|
|
||||||
this._convertPositionTo("absolute");return d.Widget.prototype._trigger.call(this,a,b,c)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}});d.extend(d.ui.draggable,{version:"1.8.6"});d.ui.plugin.add("draggable","connectToSortable",{start:function(a,b){var c=d(this).data("draggable"),f=c.options,e=d.extend({},b,{item:c.element});c.sortables=[];d(f.connectToSortable).each(function(){var g=d.data(this,"sortable");
|
|
||||||
if(g&&!g.options.disabled){c.sortables.push({instance:g,shouldRevert:g.options.revert});g._refreshItems();g._trigger("activate",a,e)}})},stop:function(a,b){var c=d(this).data("draggable"),f=d.extend({},b,{item:c.element});d.each(c.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;c.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert)this.instance.options.revert=true;this.instance._mouseStop(a);this.instance.options.helper=this.instance.options._helper;
|
|
||||||
c.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",a,f)}})},drag:function(a,b){var c=d(this).data("draggable"),f=this;d.each(c.sortables,function(){this.instance.positionAbs=c.positionAbs;this.instance.helperProportions=c.helperProportions;this.instance.offset.click=c.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=
|
|
||||||
1;this.instance.currentItem=d(f).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return b.helper[0]};a.target=this.instance.currentItem[0];this.instance._mouseCapture(a,true);this.instance._mouseStart(a,true,true);this.instance.offset.click.top=c.offset.click.top;this.instance.offset.click.left=c.offset.click.left;this.instance.offset.parent.left-=c.offset.parent.left-this.instance.offset.parent.left;
|
|
||||||
this.instance.offset.parent.top-=c.offset.parent.top-this.instance.offset.parent.top;c._trigger("toSortable",a);c.dropped=this.instance.element;c.currentItem=c.element;this.instance.fromOutside=c}this.instance.currentItem&&this.instance._mouseDrag(a)}else if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger("out",a,this.instance._uiHash(this.instance));this.instance._mouseStop(a,true);this.instance.options.helper=
|
|
||||||
this.instance.options._helper;this.instance.currentItem.remove();this.instance.placeholder&&this.instance.placeholder.remove();c._trigger("fromSortable",a);c.dropped=false}})}});d.ui.plugin.add("draggable","cursor",{start:function(){var a=d("body"),b=d(this).data("draggable").options;if(a.css("cursor"))b._cursor=a.css("cursor");a.css("cursor",b.cursor)},stop:function(){var a=d(this).data("draggable").options;a._cursor&&d("body").css("cursor",a._cursor)}});d.ui.plugin.add("draggable","iframeFix",{start:function(){var a=
|
|
||||||
d(this).data("draggable").options;d(a.iframeFix===true?"iframe":a.iframeFix).each(function(){d('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1E3}).css(d(this).offset()).appendTo("body")})},stop:function(){d("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});d.ui.plugin.add("draggable","opacity",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;
|
|
||||||
if(a.css("opacity"))b._opacity=a.css("opacity");a.css("opacity",b.opacity)},stop:function(a,b){a=d(this).data("draggable").options;a._opacity&&d(b.helper).css("opacity",a._opacity)}});d.ui.plugin.add("draggable","scroll",{start:function(){var a=d(this).data("draggable");if(a.scrollParent[0]!=document&&a.scrollParent[0].tagName!="HTML")a.overflowOffset=a.scrollParent.offset()},drag:function(a){var b=d(this).data("draggable"),c=b.options,f=false;if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!=
|
|
||||||
"HTML"){if(!c.axis||c.axis!="x")if(b.overflowOffset.top+b.scrollParent[0].offsetHeight-a.pageY<c.scrollSensitivity)b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop+c.scrollSpeed;else if(a.pageY-b.overflowOffset.top<c.scrollSensitivity)b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop-c.scrollSpeed;if(!c.axis||c.axis!="y")if(b.overflowOffset.left+b.scrollParent[0].offsetWidth-a.pageX<c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft+c.scrollSpeed;else if(a.pageX-
|
|
||||||
b.overflowOffset.left<c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft-c.scrollSpeed}else{if(!c.axis||c.axis!="x")if(a.pageY-d(document).scrollTop()<c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()-c.scrollSpeed);else if(d(window).height()-(a.pageY-d(document).scrollTop())<c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()+c.scrollSpeed);if(!c.axis||c.axis!="y")if(a.pageX-d(document).scrollLeft()<c.scrollSensitivity)f=d(document).scrollLeft(d(document).scrollLeft()-
|
|
||||||
c.scrollSpeed);else if(d(window).width()-(a.pageX-d(document).scrollLeft())<c.scrollSensitivity)f=d(document).scrollLeft(d(document).scrollLeft()+c.scrollSpeed)}f!==false&&d.ui.ddmanager&&!c.dropBehaviour&&d.ui.ddmanager.prepareOffsets(b,a)}});d.ui.plugin.add("draggable","snap",{start:function(){var a=d(this).data("draggable"),b=a.options;a.snapElements=[];d(b.snap.constructor!=String?b.snap.items||":data(draggable)":b.snap).each(function(){var c=d(this),f=c.offset();this!=a.element[0]&&a.snapElements.push({item:this,
|
|
||||||
width:c.outerWidth(),height:c.outerHeight(),top:f.top,left:f.left})})},drag:function(a,b){for(var c=d(this).data("draggable"),f=c.options,e=f.snapTolerance,g=b.offset.left,n=g+c.helperProportions.width,m=b.offset.top,o=m+c.helperProportions.height,h=c.snapElements.length-1;h>=0;h--){var i=c.snapElements[h].left,k=i+c.snapElements[h].width,j=c.snapElements[h].top,l=j+c.snapElements[h].height;if(i-e<g&&g<k+e&&j-e<m&&m<l+e||i-e<g&&g<k+e&&j-e<o&&o<l+e||i-e<n&&n<k+e&&j-e<m&&m<l+e||i-e<n&&n<k+e&&j-e<o&&
|
|
||||||
o<l+e){if(f.snapMode!="inner"){var p=Math.abs(j-o)<=e,q=Math.abs(l-m)<=e,r=Math.abs(i-n)<=e,s=Math.abs(k-g)<=e;if(p)b.position.top=c._convertPositionTo("relative",{top:j-c.helperProportions.height,left:0}).top-c.margins.top;if(q)b.position.top=c._convertPositionTo("relative",{top:l,left:0}).top-c.margins.top;if(r)b.position.left=c._convertPositionTo("relative",{top:0,left:i-c.helperProportions.width}).left-c.margins.left;if(s)b.position.left=c._convertPositionTo("relative",{top:0,left:k}).left-c.margins.left}var t=
|
|
||||||
p||q||r||s;if(f.snapMode!="outer"){p=Math.abs(j-m)<=e;q=Math.abs(l-o)<=e;r=Math.abs(i-g)<=e;s=Math.abs(k-n)<=e;if(p)b.position.top=c._convertPositionTo("relative",{top:j,left:0}).top-c.margins.top;if(q)b.position.top=c._convertPositionTo("relative",{top:l-c.helperProportions.height,left:0}).top-c.margins.top;if(r)b.position.left=c._convertPositionTo("relative",{top:0,left:i}).left-c.margins.left;if(s)b.position.left=c._convertPositionTo("relative",{top:0,left:k-c.helperProportions.width}).left-c.margins.left}if(!c.snapElements[h].snapping&&
|
|
||||||
(p||q||r||s||t))c.options.snap.snap&&c.options.snap.snap.call(c.element,a,d.extend(c._uiHash(),{snapItem:c.snapElements[h].item}));c.snapElements[h].snapping=p||q||r||s||t}else{c.snapElements[h].snapping&&c.options.snap.release&&c.options.snap.release.call(c.element,a,d.extend(c._uiHash(),{snapItem:c.snapElements[h].item}));c.snapElements[h].snapping=false}}}});d.ui.plugin.add("draggable","stack",{start:function(){var a=d(this).data("draggable").options;a=d.makeArray(d(a.stack)).sort(function(c,f){return(parseInt(d(c).css("zIndex"),
|
|
||||||
10)||0)-(parseInt(d(f).css("zIndex"),10)||0)});if(a.length){var b=parseInt(a[0].style.zIndex)||0;d(a).each(function(c){this.style.zIndex=b+c});this[0].style.zIndex=b+a.length}}});d.ui.plugin.add("draggable","zIndex",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("zIndex"))b._zIndex=a.css("zIndex");a.css("zIndex",b.zIndex)},stop:function(a,b){a=d(this).data("draggable").options;a._zIndex&&d(b.helper).css("zIndex",a._zIndex)}})})(jQuery);
|
|
||||||
;/*
|
|
||||||
* jQuery UI Droppable 1.8.6
|
|
||||||
*
|
|
||||||
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
|
||||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
|
||||||
* http://jquery.org/license
|
|
||||||
*
|
|
||||||
* http://docs.jquery.com/UI/Droppables
|
|
||||||
*
|
|
||||||
* Depends:
|
|
||||||
* jquery.ui.core.js
|
|
||||||
* jquery.ui.widget.js
|
|
||||||
* jquery.ui.mouse.js
|
|
||||||
* jquery.ui.draggable.js
|
|
||||||
*/
|
|
||||||
(function(d){d.widget("ui.droppable",{widgetEventPrefix:"drop",options:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect"},_create:function(){var a=this.options,b=a.accept;this.isover=0;this.isout=1;this.accept=d.isFunction(b)?b:function(c){return c.is(b)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};d.ui.ddmanager.droppables[a.scope]=d.ui.ddmanager.droppables[a.scope]||[];d.ui.ddmanager.droppables[a.scope].push(this);
|
|
||||||
a.addClasses&&this.element.addClass("ui-droppable")},destroy:function(){for(var a=d.ui.ddmanager.droppables[this.options.scope],b=0;b<a.length;b++)a[b]==this&&a.splice(b,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable");return this},_setOption:function(a,b){if(a=="accept")this.accept=d.isFunction(b)?b:function(c){return c.is(b)};d.Widget.prototype._setOption.apply(this,arguments)},_activate:function(a){var b=d.ui.ddmanager.current;this.options.activeClass&&
|
|
||||||
this.element.addClass(this.options.activeClass);b&&this._trigger("activate",a,this.ui(b))},_deactivate:function(a){var b=d.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass);b&&this._trigger("deactivate",a,this.ui(b))},_over:function(a){var b=d.ui.ddmanager.current;if(!(!b||(b.currentItem||b.element)[0]==this.element[0]))if(this.accept.call(this.element[0],b.currentItem||b.element)){this.options.hoverClass&&this.element.addClass(this.options.hoverClass);
|
|
||||||
this._trigger("over",a,this.ui(b))}},_out:function(a){var b=d.ui.ddmanager.current;if(!(!b||(b.currentItem||b.element)[0]==this.element[0]))if(this.accept.call(this.element[0],b.currentItem||b.element)){this.options.hoverClass&&this.element.removeClass(this.options.hoverClass);this._trigger("out",a,this.ui(b))}},_drop:function(a,b){var c=b||d.ui.ddmanager.current;if(!c||(c.currentItem||c.element)[0]==this.element[0])return false;var e=false;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var g=
|
|
||||||
d.data(this,"droppable");if(g.options.greedy&&!g.options.disabled&&g.options.scope==c.options.scope&&g.accept.call(g.element[0],c.currentItem||c.element)&&d.ui.intersect(c,d.extend(g,{offset:g.element.offset()}),g.options.tolerance)){e=true;return false}});if(e)return false;if(this.accept.call(this.element[0],c.currentItem||c.element)){this.options.activeClass&&this.element.removeClass(this.options.activeClass);this.options.hoverClass&&this.element.removeClass(this.options.hoverClass);this._trigger("drop",
|
|
||||||
a,this.ui(c));return this.element}return false},ui:function(a){return{draggable:a.currentItem||a.element,helper:a.helper,position:a.position,offset:a.positionAbs}}});d.extend(d.ui.droppable,{version:"1.8.6"});d.ui.intersect=function(a,b,c){if(!b.offset)return false;var e=(a.positionAbs||a.position.absolute).left,g=e+a.helperProportions.width,f=(a.positionAbs||a.position.absolute).top,h=f+a.helperProportions.height,i=b.offset.left,k=i+b.proportions.width,j=b.offset.top,l=j+b.proportions.height;
|
|
||||||
switch(c){case "fit":return i<=e&&g<=k&&j<=f&&h<=l;case "intersect":return i<e+a.helperProportions.width/2&&g-a.helperProportions.width/2<k&&j<f+a.helperProportions.height/2&&h-a.helperProportions.height/2<l;case "pointer":return d.ui.isOver((a.positionAbs||a.position.absolute).top+(a.clickOffset||a.offset.click).top,(a.positionAbs||a.position.absolute).left+(a.clickOffset||a.offset.click).left,j,i,b.proportions.height,b.proportions.width);case "touch":return(f>=j&&f<=l||h>=j&&h<=l||f<j&&h>l)&&(e>=
|
|
||||||
i&&e<=k||g>=i&&g<=k||e<i&&g>k);default:return false}};d.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(a,b){var c=d.ui.ddmanager.droppables[a.options.scope]||[],e=b?b.type:null,g=(a.currentItem||a.element).find(":data(droppable)").andSelf(),f=0;a:for(;f<c.length;f++)if(!(c[f].options.disabled||a&&!c[f].accept.call(c[f].element[0],a.currentItem||a.element))){for(var h=0;h<g.length;h++)if(g[h]==c[f].element[0]){c[f].proportions.height=0;continue a}c[f].visible=c[f].element.css("display")!=
|
|
||||||
"none";if(c[f].visible){c[f].offset=c[f].element.offset();c[f].proportions={width:c[f].element[0].offsetWidth,height:c[f].element[0].offsetHeight};e=="mousedown"&&c[f]._activate.call(c[f],b)}}},drop:function(a,b){var c=false;d.each(d.ui.ddmanager.droppables[a.options.scope]||[],function(){if(this.options){if(!this.options.disabled&&this.visible&&d.ui.intersect(a,this,this.options.tolerance))c=c||this._drop.call(this,b);if(!this.options.disabled&&this.visible&&this.accept.call(this.element[0],a.currentItem||
|
|
||||||
a.element)){this.isout=1;this.isover=0;this._deactivate.call(this,b)}}});return c},drag:function(a,b){a.options.refreshPositions&&d.ui.ddmanager.prepareOffsets(a,b);d.each(d.ui.ddmanager.droppables[a.options.scope]||[],function(){if(!(this.options.disabled||this.greedyChild||!this.visible)){var c=d.ui.intersect(a,this,this.options.tolerance);if(c=!c&&this.isover==1?"isout":c&&this.isover==0?"isover":null){var e;if(this.options.greedy){var g=this.element.parents(":data(droppable):eq(0)");if(g.length){e=
|
|
||||||
d.data(g[0],"droppable");e.greedyChild=c=="isover"?1:0}}if(e&&c=="isover"){e.isover=0;e.isout=1;e._out.call(e,b)}this[c]=1;this[c=="isout"?"isover":"isout"]=0;this[c=="isover"?"_over":"_out"].call(this,b);if(e&&c=="isout"){e.isout=0;e.isover=1;e._over.call(e,b)}}}})}}})(jQuery);
|
|
||||||
;/*
|
|
||||||
* jQuery UI Resizable 1.8.6
|
|
||||||
*
|
|
||||||
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
|
||||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
|
||||||
* http://jquery.org/license
|
|
||||||
*
|
|
||||||
* http://docs.jquery.com/UI/Resizables
|
|
||||||
*
|
|
||||||
* Depends:
|
|
||||||
* jquery.ui.core.js
|
|
||||||
* jquery.ui.mouse.js
|
|
||||||
* jquery.ui.widget.js
|
|
||||||
*/
|
|
||||||
(function(e){e.widget("ui.resizable",e.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1E3},_create:function(){var b=this,a=this.options;this.element.addClass("ui-resizable");e.extend(this,{_aspectRatio:!!a.aspectRatio,aspectRatio:a.aspectRatio,originalElement:this.element,
|
|
||||||
_proportionallyResizeElements:[],_helper:a.helper||a.ghost||a.animate?a.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){/relative/.test(this.element.css("position"))&&e.browser.opera&&this.element.css({position:"relative",top:"auto",left:"auto"});this.element.wrap(e('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),
|
|
||||||
top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=
|
|
||||||
this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=a.handles||(!e(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",
|
|
||||||
nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all")this.handles="n,e,s,w,se,sw,ne,nw";var c=this.handles.split(",");this.handles={};for(var d=0;d<c.length;d++){var f=e.trim(c[d]),g=e('<div class="ui-resizable-handle '+("ui-resizable-"+f)+'"></div>');/sw|se|ne|nw/.test(f)&&g.css({zIndex:++a.zIndex});"se"==f&&g.addClass("ui-icon ui-icon-gripsmall-diagonal-se");this.handles[f]=".ui-resizable-"+f;this.element.append(g)}}this._renderAxis=function(h){h=h||this.element;for(var i in this.handles){if(this.handles[i].constructor==
|
|
||||||
String)this.handles[i]=e(this.handles[i],this.element).show();if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var j=e(this.handles[i],this.element),k=0;k=/sw|ne|nw|se|n|s/.test(i)?j.outerHeight():j.outerWidth();j=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");h.css(j,k);this._proportionallyResize()}e(this.handles[i])}};this._renderAxis(this.element);this._handles=e(".ui-resizable-handle",this.element).disableSelection();
|
|
||||||
this._handles.mouseover(function(){if(!b.resizing){if(this.className)var h=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=h&&h[1]?h[1]:"se"}});if(a.autoHide){this._handles.hide();e(this.element).addClass("ui-resizable-autohide").hover(function(){e(this).removeClass("ui-resizable-autohide");b._handles.show()},function(){if(!b.resizing){e(this).addClass("ui-resizable-autohide");b._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var b=function(c){e(c).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};
|
|
||||||
if(this.elementIsWrapper){b(this.element);var a=this.element;a.after(this.originalElement.css({position:a.css("position"),width:a.outerWidth(),height:a.outerHeight(),top:a.css("top"),left:a.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);b(this.originalElement);return this},_mouseCapture:function(b){var a=false;for(var c in this.handles)if(e(this.handles[c])[0]==b.target)a=true;return!this.options.disabled&&a},_mouseStart:function(b){var a=this.options,c=this.element.position(),
|
|
||||||
d=this.element;this.resizing=true;this.documentScroll={top:e(document).scrollTop(),left:e(document).scrollLeft()};if(d.is(".ui-draggable")||/absolute/.test(d.css("position")))d.css({position:"absolute",top:c.top,left:c.left});e.browser.opera&&/relative/.test(d.css("position"))&&d.css({position:"relative",top:"auto",left:"auto"});this._renderProxy();c=m(this.helper.css("left"));var f=m(this.helper.css("top"));if(a.containment){c+=e(a.containment).scrollLeft()||0;f+=e(a.containment).scrollTop()||0}this.offset=
|
|
||||||
this.helper.offset();this.position={left:c,top:f};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:c,top:f};this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:b.pageX,top:b.pageY};this.aspectRatio=typeof a.aspectRatio=="number"?a.aspectRatio:
|
|
||||||
this.originalSize.width/this.originalSize.height||1;a=e(".ui-resizable-"+this.axis).css("cursor");e("body").css("cursor",a=="auto"?this.axis+"-resize":a);d.addClass("ui-resizable-resizing");this._propagate("start",b);return true},_mouseDrag:function(b){var a=this.helper,c=this.originalMousePosition,d=this._change[this.axis];if(!d)return false;c=d.apply(this,[b,b.pageX-c.left||0,b.pageY-c.top||0]);if(this._aspectRatio||b.shiftKey)c=this._updateRatio(c,b);c=this._respectSize(c,b);this._propagate("resize",
|
|
||||||
b);a.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize();this._updateCache(c);this._trigger("resize",b,this.ui());return false},_mouseStop:function(b){this.resizing=false;var a=this.options,c=this;if(this._helper){var d=this._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName);d=f&&e.ui.hasScroll(d[0],"left")?0:c.sizeDiff.height;
|
|
||||||
f={width:c.size.width-(f?0:c.sizeDiff.width),height:c.size.height-d};d=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null;var g=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null;a.animate||this.element.css(e.extend(f,{top:g,left:d}));c.helper.height(c.size.height);c.helper.width(c.size.width);this._helper&&!a.animate&&this._proportionallyResize()}e("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",
|
|
||||||
b);this._helper&&this.helper.remove();return false},_updateCache:function(b){this.offset=this.helper.offset();if(l(b.left))this.position.left=b.left;if(l(b.top))this.position.top=b.top;if(l(b.height))this.size.height=b.height;if(l(b.width))this.size.width=b.width},_updateRatio:function(b){var a=this.position,c=this.size,d=this.axis;if(b.height)b.width=c.height*this.aspectRatio;else if(b.width)b.height=c.width/this.aspectRatio;if(d=="sw"){b.left=a.left+(c.width-b.width);b.top=null}if(d=="nw"){b.top=
|
|
||||||
a.top+(c.height-b.height);b.left=a.left+(c.width-b.width)}return b},_respectSize:function(b){var a=this.options,c=this.axis,d=l(b.width)&&a.maxWidth&&a.maxWidth<b.width,f=l(b.height)&&a.maxHeight&&a.maxHeight<b.height,g=l(b.width)&&a.minWidth&&a.minWidth>b.width,h=l(b.height)&&a.minHeight&&a.minHeight>b.height;if(g)b.width=a.minWidth;if(h)b.height=a.minHeight;if(d)b.width=a.maxWidth;if(f)b.height=a.maxHeight;var i=this.originalPosition.left+this.originalSize.width,j=this.position.top+this.size.height,
|
|
||||||
k=/sw|nw|w/.test(c);c=/nw|ne|n/.test(c);if(g&&k)b.left=i-a.minWidth;if(d&&k)b.left=i-a.maxWidth;if(h&&c)b.top=j-a.minHeight;if(f&&c)b.top=j-a.maxHeight;if((a=!b.width&&!b.height)&&!b.left&&b.top)b.top=null;else if(a&&!b.top&&b.left)b.left=null;return b},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var b=this.helper||this.element,a=0;a<this._proportionallyResizeElements.length;a++){var c=this._proportionallyResizeElements[a];if(!this.borderDif){var d=[c.css("borderTopWidth"),
|
|
||||||
c.css("borderRightWidth"),c.css("borderBottomWidth"),c.css("borderLeftWidth")],f=[c.css("paddingTop"),c.css("paddingRight"),c.css("paddingBottom"),c.css("paddingLeft")];this.borderDif=e.map(d,function(g,h){g=parseInt(g,10)||0;h=parseInt(f[h],10)||0;return g+h})}e.browser.msie&&(e(b).is(":hidden")||e(b).parents(":hidden").length)||c.css({height:b.height()-this.borderDif[0]-this.borderDif[2]||0,width:b.width()-this.borderDif[1]-this.borderDif[3]||0})}},_renderProxy:function(){var b=this.options;this.elementOffset=
|
|
||||||
this.element.offset();if(this._helper){this.helper=this.helper||e('<div style="overflow:hidden;"></div>');var a=e.browser.msie&&e.browser.version<7,c=a?1:0;a=a?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+a,height:this.element.outerHeight()+a,position:"absolute",left:this.elementOffset.left-c+"px",top:this.elementOffset.top-c+"px",zIndex:++b.zIndex});this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(b,a){return{width:this.originalSize.width+
|
|
||||||
a}},w:function(b,a){return{left:this.originalPosition.left+a,width:this.originalSize.width-a}},n:function(b,a,c){return{top:this.originalPosition.top+c,height:this.originalSize.height-c}},s:function(b,a,c){return{height:this.originalSize.height+c}},se:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},sw:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,a,c]))},ne:function(b,a,c){return e.extend(this._change.n.apply(this,
|
|
||||||
arguments),this._change.e.apply(this,[b,a,c]))},nw:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,a,c]))}},_propagate:function(b,a){e.ui.plugin.call(this,b,[a,this.ui()]);b!="resize"&&this._trigger(b,a,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});e.extend(e.ui.resizable,
|
|
||||||
{version:"1.8.6"});e.ui.plugin.add("resizable","alsoResize",{start:function(){var b=e(this).data("resizable").options,a=function(c){e(c).each(function(){var d=e(this);d.data("resizable-alsoresize",{width:parseInt(d.width(),10),height:parseInt(d.height(),10),left:parseInt(d.css("left"),10),top:parseInt(d.css("top"),10),position:d.css("position")})})};if(typeof b.alsoResize=="object"&&!b.alsoResize.parentNode)if(b.alsoResize.length){b.alsoResize=b.alsoResize[0];a(b.alsoResize)}else e.each(b.alsoResize,
|
|
||||||
function(c){a(c)});else a(b.alsoResize)},resize:function(b,a){var c=e(this).data("resizable");b=c.options;var d=c.originalSize,f=c.originalPosition,g={height:c.size.height-d.height||0,width:c.size.width-d.width||0,top:c.position.top-f.top||0,left:c.position.left-f.left||0},h=function(i,j){e(i).each(function(){var k=e(this),q=e(this).data("resizable-alsoresize"),p={},r=j&&j.length?j:k.parents(a.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(r,function(n,o){if((n=
|
|
||||||
(q[o]||0)+(g[o]||0))&&n>=0)p[o]=n||null});if(e.browser.opera&&/relative/.test(k.css("position"))){c._revertToRelativePosition=true;k.css({position:"absolute",top:"auto",left:"auto"})}k.css(p)})};typeof b.alsoResize=="object"&&!b.alsoResize.nodeType?e.each(b.alsoResize,function(i,j){h(i,j)}):h(b.alsoResize)},stop:function(){var b=e(this).data("resizable"),a=b.options,c=function(d){e(d).each(function(){var f=e(this);f.css({position:f.data("resizable-alsoresize").position})})};if(b._revertToRelativePosition){b._revertToRelativePosition=
|
|
||||||
false;typeof a.alsoResize=="object"&&!a.alsoResize.nodeType?e.each(a.alsoResize,function(d){c(d)}):c(a.alsoResize)}e(this).removeData("resizable-alsoresize")}});e.ui.plugin.add("resizable","animate",{stop:function(b){var a=e(this).data("resizable"),c=a.options,d=a._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName),g=f&&e.ui.hasScroll(d[0],"left")?0:a.sizeDiff.height;f={width:a.size.width-(f?0:a.sizeDiff.width),height:a.size.height-g};g=parseInt(a.element.css("left"),10)+(a.position.left-
|
|
||||||
a.originalPosition.left)||null;var h=parseInt(a.element.css("top"),10)+(a.position.top-a.originalPosition.top)||null;a.element.animate(e.extend(f,h&&g?{top:h,left:g}:{}),{duration:c.animateDuration,easing:c.animateEasing,step:function(){var i={width:parseInt(a.element.css("width"),10),height:parseInt(a.element.css("height"),10),top:parseInt(a.element.css("top"),10),left:parseInt(a.element.css("left"),10)};d&&d.length&&e(d[0]).css({width:i.width,height:i.height});a._updateCache(i);a._propagate("resize",
|
|
||||||
b)}})}});e.ui.plugin.add("resizable","containment",{start:function(){var b=e(this).data("resizable"),a=b.element,c=b.options.containment;if(a=c instanceof e?c.get(0):/parent/.test(c)?a.parent().get(0):c){b.containerElement=e(a);if(/document/.test(c)||c==document){b.containerOffset={left:0,top:0};b.containerPosition={left:0,top:0};b.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}}else{var d=e(a),f=[];e(["Top",
|
|
||||||
"Right","Left","Bottom"]).each(function(i,j){f[i]=m(d.css("padding"+j))});b.containerOffset=d.offset();b.containerPosition=d.position();b.containerSize={height:d.innerHeight()-f[3],width:d.innerWidth()-f[1]};c=b.containerOffset;var g=b.containerSize.height,h=b.containerSize.width;h=e.ui.hasScroll(a,"left")?a.scrollWidth:h;g=e.ui.hasScroll(a)?a.scrollHeight:g;b.parentData={element:a,left:c.left,top:c.top,width:h,height:g}}}},resize:function(b){var a=e(this).data("resizable"),c=a.options,d=a.containerOffset,
|
|
||||||
f=a.position;b=a._aspectRatio||b.shiftKey;var g={top:0,left:0},h=a.containerElement;if(h[0]!=document&&/static/.test(h.css("position")))g=d;if(f.left<(a._helper?d.left:0)){a.size.width+=a._helper?a.position.left-d.left:a.position.left-g.left;if(b)a.size.height=a.size.width/c.aspectRatio;a.position.left=c.helper?d.left:0}if(f.top<(a._helper?d.top:0)){a.size.height+=a._helper?a.position.top-d.top:a.position.top;if(b)a.size.width=a.size.height*c.aspectRatio;a.position.top=a._helper?d.top:0}a.offset.left=
|
|
||||||
a.parentData.left+a.position.left;a.offset.top=a.parentData.top+a.position.top;c=Math.abs((a._helper?a.offset.left-g.left:a.offset.left-g.left)+a.sizeDiff.width);d=Math.abs((a._helper?a.offset.top-g.top:a.offset.top-d.top)+a.sizeDiff.height);f=a.containerElement.get(0)==a.element.parent().get(0);g=/relative|absolute/.test(a.containerElement.css("position"));if(f&&g)c-=a.parentData.left;if(c+a.size.width>=a.parentData.width){a.size.width=a.parentData.width-c;if(b)a.size.height=a.size.width/a.aspectRatio}if(d+
|
|
||||||
a.size.height>=a.parentData.height){a.size.height=a.parentData.height-d;if(b)a.size.width=a.size.height*a.aspectRatio}},stop:function(){var b=e(this).data("resizable"),a=b.options,c=b.containerOffset,d=b.containerPosition,f=b.containerElement,g=e(b.helper),h=g.offset(),i=g.outerWidth()-b.sizeDiff.width;g=g.outerHeight()-b.sizeDiff.height;b._helper&&!a.animate&&/relative/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g});b._helper&&!a.animate&&/static/.test(f.css("position"))&&
|
|
||||||
e(this).css({left:h.left-d.left-c.left,width:i,height:g})}});e.ui.plugin.add("resizable","ghost",{start:function(){var b=e(this).data("resizable"),a=b.options,c=b.size;b.ghost=b.originalElement.clone();b.ghost.css({opacity:0.25,display:"block",position:"relative",height:c.height,width:c.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof a.ghost=="string"?a.ghost:"");b.ghost.appendTo(b.helper)},resize:function(){var b=e(this).data("resizable");b.ghost&&b.ghost.css({position:"relative",
|
|
||||||
height:b.size.height,width:b.size.width})},stop:function(){var b=e(this).data("resizable");b.ghost&&b.helper&&b.helper.get(0).removeChild(b.ghost.get(0))}});e.ui.plugin.add("resizable","grid",{resize:function(){var b=e(this).data("resizable"),a=b.options,c=b.size,d=b.originalSize,f=b.originalPosition,g=b.axis;a.grid=typeof a.grid=="number"?[a.grid,a.grid]:a.grid;var h=Math.round((c.width-d.width)/(a.grid[0]||1))*(a.grid[0]||1);a=Math.round((c.height-d.height)/(a.grid[1]||1))*(a.grid[1]||1);if(/^(se|s|e)$/.test(g)){b.size.width=
|
|
||||||
d.width+h;b.size.height=d.height+a}else if(/^(ne)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}else{if(/^(sw)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a}else{b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}b.position.left=f.left-h}}});var m=function(b){return parseInt(b,10)||0},l=function(b){return!isNaN(parseInt(b,10))}})(jQuery);
|
|
||||||
;/*
|
|
||||||
* jQuery UI Selectable 1.8.6
|
|
||||||
*
|
|
||||||
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
|
||||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
|
||||||
* http://jquery.org/license
|
|
||||||
*
|
|
||||||
* http://docs.jquery.com/UI/Selectables
|
|
||||||
*
|
|
||||||
* Depends:
|
|
||||||
* jquery.ui.core.js
|
|
||||||
* jquery.ui.mouse.js
|
|
||||||
* jquery.ui.widget.js
|
|
||||||
*/
|
|
||||||
(function(e){e.widget("ui.selectable",e.ui.mouse,{options:{appendTo:"body",autoRefresh:true,distance:0,filter:"*",tolerance:"touch"},_create:function(){var c=this;this.element.addClass("ui-selectable");this.dragged=false;var f;this.refresh=function(){f=e(c.options.filter,c.element[0]);f.each(function(){var d=e(this),b=d.offset();e.data(this,"selectable-item",{element:this,$element:d,left:b.left,top:b.top,right:b.left+d.outerWidth(),bottom:b.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"),
|
|
||||||
selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this.selectees=f.addClass("ui-selectee");this._mouseInit();this.helper=e("<div class='ui-selectable-helper'></div>")},destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item");this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();return this},_mouseStart:function(c){var f=this;this.opos=[c.pageX,
|
|
||||||
c.pageY];if(!this.options.disabled){var d=this.options;this.selectees=e(d.filter,this.element[0]);this._trigger("start",c);e(d.appendTo).append(this.helper);this.helper.css({left:c.clientX,top:c.clientY,width:0,height:0});d.autoRefresh&&this.refresh();this.selectees.filter(".ui-selected").each(function(){var b=e.data(this,"selectable-item");b.startselected=true;if(!c.metaKey){b.$element.removeClass("ui-selected");b.selected=false;b.$element.addClass("ui-unselecting");b.unselecting=true;f._trigger("unselecting",
|
|
||||||
c,{unselecting:b.element})}});e(c.target).parents().andSelf().each(function(){var b=e.data(this,"selectable-item");if(b){var g=!c.metaKey||!b.$element.hasClass("ui-selected");b.$element.removeClass(g?"ui-unselecting":"ui-selected").addClass(g?"ui-selecting":"ui-unselecting");b.unselecting=!g;b.selecting=g;(b.selected=g)?f._trigger("selecting",c,{selecting:b.element}):f._trigger("unselecting",c,{unselecting:b.element});return false}})}},_mouseDrag:function(c){var f=this;this.dragged=true;if(!this.options.disabled){var d=
|
|
||||||
this.options,b=this.opos[0],g=this.opos[1],h=c.pageX,i=c.pageY;if(b>h){var j=h;h=b;b=j}if(g>i){j=i;i=g;g=j}this.helper.css({left:b,top:g,width:h-b,height:i-g});this.selectees.each(function(){var a=e.data(this,"selectable-item");if(!(!a||a.element==f.element[0])){var k=false;if(d.tolerance=="touch")k=!(a.left>h||a.right<b||a.top>i||a.bottom<g);else if(d.tolerance=="fit")k=a.left>b&&a.right<h&&a.top>g&&a.bottom<i;if(k){if(a.selected){a.$element.removeClass("ui-selected");a.selected=false}if(a.unselecting){a.$element.removeClass("ui-unselecting");
|
|
||||||
a.unselecting=false}if(!a.selecting){a.$element.addClass("ui-selecting");a.selecting=true;f._trigger("selecting",c,{selecting:a.element})}}else{if(a.selecting)if(c.metaKey&&a.startselected){a.$element.removeClass("ui-selecting");a.selecting=false;a.$element.addClass("ui-selected");a.selected=true}else{a.$element.removeClass("ui-selecting");a.selecting=false;if(a.startselected){a.$element.addClass("ui-unselecting");a.unselecting=true}f._trigger("unselecting",c,{unselecting:a.element})}if(a.selected)if(!c.metaKey&&
|
|
||||||
!a.startselected){a.$element.removeClass("ui-selected");a.selected=false;a.$element.addClass("ui-unselecting");a.unselecting=true;f._trigger("unselecting",c,{unselecting:a.element})}}}});return false}},_mouseStop:function(c){var f=this;this.dragged=false;e(".ui-unselecting",this.element[0]).each(function(){var d=e.data(this,"selectable-item");d.$element.removeClass("ui-unselecting");d.unselecting=false;d.startselected=false;f._trigger("unselected",c,{unselected:d.element})});e(".ui-selecting",this.element[0]).each(function(){var d=
|
|
||||||
e.data(this,"selectable-item");d.$element.removeClass("ui-selecting").addClass("ui-selected");d.selecting=false;d.selected=true;d.startselected=true;f._trigger("selected",c,{selected:d.element})});this._trigger("stop",c);this.helper.remove();return false}});e.extend(e.ui.selectable,{version:"1.8.6"})})(jQuery);
|
|
||||||
;/*
|
|
||||||
* jQuery UI Sortable 1.8.6
|
|
||||||
*
|
|
||||||
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
|
||||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
|
||||||
* http://jquery.org/license
|
|
||||||
*
|
|
||||||
* http://docs.jquery.com/UI/Sortables
|
|
||||||
*
|
|
||||||
* Depends:
|
|
||||||
* jquery.ui.core.js
|
|
||||||
* jquery.ui.mouse.js
|
|
||||||
* jquery.ui.widget.js
|
|
||||||
*/
|
|
||||||
(function(d){d.widget("ui.sortable",d.ui.mouse,{widgetEventPrefix:"sort",options:{appendTo:"parent",axis:false,connectWith:false,containment:false,cursor:"auto",cursorAt:false,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1E3},_create:function(){this.containerCache={};this.element.addClass("ui-sortable");
|
|
||||||
this.refresh();this.floating=this.items.length?/left|right/.test(this.items[0].item.css("float")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var a=this.items.length-1;a>=0;a--)this.items[a].item.removeData("sortable-item");return this},_setOption:function(a,b){if(a==="disabled"){this.options[a]=b;this.widget()[b?"addClass":"removeClass"]("ui-sortable-disabled")}else d.Widget.prototype._setOption.apply(this,
|
|
||||||
arguments)},_mouseCapture:function(a,b){if(this.reverting)return false;if(this.options.disabled||this.options.type=="static")return false;this._refreshItems(a);var c=null,e=this;d(a.target).parents().each(function(){if(d.data(this,"sortable-item")==e){c=d(this);return false}});if(d.data(a.target,"sortable-item")==e)c=d(a.target);if(!c)return false;if(this.options.handle&&!b){var f=false;d(this.options.handle,c).find("*").andSelf().each(function(){if(this==a.target)f=true});if(!f)return false}this.currentItem=
|
|
||||||
c;this._removeCurrentsFromItems();return true},_mouseStart:function(a,b,c){b=this.options;var e=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(a);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");d.extend(this.offset,
|
|
||||||
{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};this.helper[0]!=this.currentItem[0]&&this.currentItem.hide();this._createPlaceholder();b.containment&&this._setContainment();
|
|
||||||
if(b.cursor){if(d("body").css("cursor"))this._storedCursor=d("body").css("cursor");d("body").css("cursor",b.cursor)}if(b.opacity){if(this.helper.css("opacity"))this._storedOpacity=this.helper.css("opacity");this.helper.css("opacity",b.opacity)}if(b.zIndex){if(this.helper.css("zIndex"))this._storedZIndex=this.helper.css("zIndex");this.helper.css("zIndex",b.zIndex)}if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML")this.overflowOffset=this.scrollParent.offset();this._trigger("start",
|
|
||||||
a,this._uiHash());this._preserveHelperProportions||this._cacheHelperProportions();if(!c)for(c=this.containers.length-1;c>=0;c--)this.containers[c]._trigger("activate",a,e._uiHash(this));if(d.ui.ddmanager)d.ui.ddmanager.current=this;d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(a);return true},_mouseDrag:function(a){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");
|
|
||||||
if(!this.lastPositionAbs)this.lastPositionAbs=this.positionAbs;if(this.options.scroll){var b=this.options,c=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if(this.overflowOffset.top+this.scrollParent[0].offsetHeight-a.pageY<b.scrollSensitivity)this.scrollParent[0].scrollTop=c=this.scrollParent[0].scrollTop+b.scrollSpeed;else if(a.pageY-this.overflowOffset.top<b.scrollSensitivity)this.scrollParent[0].scrollTop=c=this.scrollParent[0].scrollTop-b.scrollSpeed;if(this.overflowOffset.left+
|
|
||||||
this.scrollParent[0].offsetWidth-a.pageX<b.scrollSensitivity)this.scrollParent[0].scrollLeft=c=this.scrollParent[0].scrollLeft+b.scrollSpeed;else if(a.pageX-this.overflowOffset.left<b.scrollSensitivity)this.scrollParent[0].scrollLeft=c=this.scrollParent[0].scrollLeft-b.scrollSpeed}else{if(a.pageY-d(document).scrollTop()<b.scrollSensitivity)c=d(document).scrollTop(d(document).scrollTop()-b.scrollSpeed);else if(d(window).height()-(a.pageY-d(document).scrollTop())<b.scrollSensitivity)c=d(document).scrollTop(d(document).scrollTop()+
|
|
||||||
b.scrollSpeed);if(a.pageX-d(document).scrollLeft()<b.scrollSensitivity)c=d(document).scrollLeft(d(document).scrollLeft()-b.scrollSpeed);else if(d(window).width()-(a.pageX-d(document).scrollLeft())<b.scrollSensitivity)c=d(document).scrollLeft(d(document).scrollLeft()+b.scrollSpeed)}c!==false&&d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a)}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+
|
|
||||||
"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";for(b=this.items.length-1;b>=0;b--){c=this.items[b];var e=c.item[0],f=this._intersectsWithPointer(c);if(f)if(e!=this.currentItem[0]&&this.placeholder[f==1?"next":"prev"]()[0]!=e&&!d.ui.contains(this.placeholder[0],e)&&(this.options.type=="semi-dynamic"?!d.ui.contains(this.element[0],e):true)){this.direction=f==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(c))this._rearrange(a,
|
|
||||||
c);else break;this._trigger("change",a,this._uiHash());break}}this._contactContainers(a);d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);this._trigger("sort",a,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(a,b){if(a){d.ui.ddmanager&&!this.options.dropBehaviour&&d.ui.ddmanager.drop(this,a);if(this.options.revert){var c=this;b=c.placeholder.offset();c.reverting=true;d(this.helper).animate({left:b.left-this.offset.parent.left-c.margins.left+(this.offsetParent[0]==
|
|
||||||
document.body?0:this.offsetParent[0].scrollLeft),top:b.top-this.offset.parent.top-c.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){c._clear(a)})}else this._clear(a,b);return false}},cancel:function(){var a=this;if(this.dragging){this._mouseUp();this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var b=this.containers.length-1;b>=0;b--){this.containers[b]._trigger("deactivate",
|
|
||||||
null,a._uiHash(this));if(this.containers[b].containerCache.over){this.containers[b]._trigger("out",null,a._uiHash(this));this.containers[b].containerCache.over=0}}}this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]);this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove();d.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});this.domPosition.prev?d(this.domPosition.prev).after(this.currentItem):
|
|
||||||
d(this.domPosition.parent).prepend(this.currentItem);return this},serialize:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};d(b).each(function(){var e=(d(a.item||this).attr(a.attribute||"id")||"").match(a.expression||/(.+)[-=_](.+)/);if(e)c.push((a.key||e[1]+"[]")+"="+(a.key&&a.expression?e[1]:e[2]))});!c.length&&a.key&&c.push(a.key+"=");return c.join("&")},toArray:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};b.each(function(){c.push(d(a.item||this).attr(a.attribute||
|
|
||||||
"id")||"")});return c},_intersectsWith:function(a){var b=this.positionAbs.left,c=b+this.helperProportions.width,e=this.positionAbs.top,f=e+this.helperProportions.height,g=a.left,h=g+a.width,i=a.top,k=i+a.height,j=this.offset.click.top,l=this.offset.click.left;j=e+j>i&&e+j<k&&b+l>g&&b+l<h;return this.options.tolerance=="pointer"||this.options.forcePointerForContainers||this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>a[this.floating?"width":"height"]?j:g<b+
|
|
||||||
this.helperProportions.width/2&&c-this.helperProportions.width/2<h&&i<e+this.helperProportions.height/2&&f-this.helperProportions.height/2<k},_intersectsWithPointer:function(a){var b=d.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,a.top,a.height);a=d.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,a.left,a.width);b=b&&a;a=this._getDragVerticalDirection();var c=this._getDragHorizontalDirection();if(!b)return false;return this.floating?c&&c=="right"||a=="down"?2:1:a&&(a=="down"?
|
|
||||||
2:1)},_intersectsWithSides:function(a){var b=d.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,a.top+a.height/2,a.height);a=d.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,a.left+a.width/2,a.width);var c=this._getDragVerticalDirection(),e=this._getDragHorizontalDirection();return this.floating&&e?e=="right"&&a||e=="left"&&!a:c&&(c=="down"&&b||c=="up"&&!b)},_getDragVerticalDirection:function(){var a=this.positionAbs.top-this.lastPositionAbs.top;return a!=0&&(a>0?"down":"up")},
|
|
||||||
_getDragHorizontalDirection:function(){var a=this.positionAbs.left-this.lastPositionAbs.left;return a!=0&&(a>0?"right":"left")},refresh:function(a){this._refreshItems(a);this.refreshPositions();return this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(a){var b=[],c=[],e=this._connectWith();if(e&&a)for(a=e.length-1;a>=0;a--)for(var f=d(e[a]),g=f.length-1;g>=0;g--){var h=d.data(f[g],"sortable");if(h&&h!=
|
|
||||||
this&&!h.options.disabled)c.push([d.isFunction(h.options.items)?h.options.items.call(h.element):d(h.options.items,h.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),h])}c.push([d.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):d(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(a=c.length-1;a>=0;a--)c[a][0].each(function(){b.push(this)});return d(b)},_removeCurrentsFromItems:function(){for(var a=
|
|
||||||
this.currentItem.find(":data(sortable-item)"),b=0;b<this.items.length;b++)for(var c=0;c<a.length;c++)a[c]==this.items[b].item[0]&&this.items.splice(b,1)},_refreshItems:function(a){this.items=[];this.containers=[this];var b=this.items,c=[[d.isFunction(this.options.items)?this.options.items.call(this.element[0],a,{item:this.currentItem}):d(this.options.items,this.element),this]],e=this._connectWith();if(e)for(var f=e.length-1;f>=0;f--)for(var g=d(e[f]),h=g.length-1;h>=0;h--){var i=d.data(g[h],"sortable");
|
|
||||||
if(i&&i!=this&&!i.options.disabled){c.push([d.isFunction(i.options.items)?i.options.items.call(i.element[0],a,{item:this.currentItem}):d(i.options.items,i.element),i]);this.containers.push(i)}}for(f=c.length-1;f>=0;f--){a=c[f][1];e=c[f][0];h=0;for(g=e.length;h<g;h++){i=d(e[h]);i.data("sortable-item",a);b.push({item:i,instance:a,width:0,height:0,left:0,top:0})}}},refreshPositions:function(a){if(this.offsetParent&&this.helper)this.offset.parent=this._getParentOffset();for(var b=this.items.length-1;b>=
|
|
||||||
0;b--){var c=this.items[b],e=this.options.toleranceElement?d(this.options.toleranceElement,c.item):c.item;if(!a){c.width=e.outerWidth();c.height=e.outerHeight()}e=e.offset();c.left=e.left;c.top=e.top}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(b=this.containers.length-1;b>=0;b--){e=this.containers[b].element.offset();this.containers[b].containerCache.left=e.left;this.containers[b].containerCache.top=e.top;this.containers[b].containerCache.width=
|
|
||||||
this.containers[b].element.outerWidth();this.containers[b].containerCache.height=this.containers[b].element.outerHeight()}return this},_createPlaceholder:function(a){var b=a||this,c=b.options;if(!c.placeholder||c.placeholder.constructor==String){var e=c.placeholder;c.placeholder={element:function(){var f=d(document.createElement(b.currentItem[0].nodeName)).addClass(e||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!e)f.style.visibility="hidden";return f},
|
|
||||||
update:function(f,g){if(!(e&&!c.forcePlaceholderSize)){g.height()||g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10));g.width()||g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||0,10))}}}}b.placeholder=d(c.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);c.placeholder.update(b,b.placeholder)},_contactContainers:function(a){for(var b=
|
|
||||||
null,c=null,e=this.containers.length-1;e>=0;e--)if(!d.ui.contains(this.currentItem[0],this.containers[e].element[0]))if(this._intersectsWith(this.containers[e].containerCache)){if(!(b&&d.ui.contains(this.containers[e].element[0],b.element[0]))){b=this.containers[e];c=e}}else if(this.containers[e].containerCache.over){this.containers[e]._trigger("out",a,this._uiHash(this));this.containers[e].containerCache.over=0}if(b)if(this.containers.length===1){this.containers[c]._trigger("over",a,this._uiHash(this));
|
|
||||||
this.containers[c].containerCache.over=1}else if(this.currentContainer!=this.containers[c]){b=1E4;e=null;for(var f=this.positionAbs[this.containers[c].floating?"left":"top"],g=this.items.length-1;g>=0;g--)if(d.ui.contains(this.containers[c].element[0],this.items[g].item[0])){var h=this.items[g][this.containers[c].floating?"left":"top"];if(Math.abs(h-f)<b){b=Math.abs(h-f);e=this.items[g]}}if(e||this.options.dropOnEmpty){this.currentContainer=this.containers[c];e?this._rearrange(a,e,null,true):this._rearrange(a,
|
|
||||||
null,this.containers[c].element,true);this._trigger("change",a,this._uiHash());this.containers[c]._trigger("change",a,this._uiHash(this));this.options.placeholder.update(this.currentContainer,this.placeholder);this.containers[c]._trigger("over",a,this._uiHash(this));this.containers[c].containerCache.over=1}}},_createHelper:function(a){var b=this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a,this.currentItem])):b.helper=="clone"?this.currentItem.clone():this.currentItem;a.parents("body").length||
|
|
||||||
d(b.appendTo!="parent"?b.appendTo:this.currentItem[0].parentNode)[0].appendChild(a[0]);if(a[0]==this.currentItem[0])this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")};if(a[0].style.width==""||b.forceHelperSize)a.width(this.currentItem.width());if(a[0].style.height==""||b.forceHelperSize)a.height(this.currentItem.height());return a},_adjustOffsetFromHelper:function(a){if(typeof a==
|
|
||||||
"string")a=a.split(" ");if(d.isArray(a))a={left:+a[0],top:+a[1]||0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition==
|
|
||||||
"absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a={top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition==
|
|
||||||
"relative"){var a=this.currentItem.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},
|
|
||||||
_setContainment:function(){var a=this.options;if(a.containment=="parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,d(a.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(d(a.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-
|
|
||||||
this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)){var b=d(a.containment)[0];a=d(a.containment).offset();var c=d(b).css("overflow")!="hidden";this.containment=[a.left+(parseInt(d(b).css("borderLeftWidth"),10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0)-this.margins.left,a.top+(parseInt(d(b).css("borderTopWidth"),10)||0)+(parseInt(d(b).css("paddingTop"),10)||0)-this.margins.top,a.left+(c?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),
|
|
||||||
10)||0)-(parseInt(d(b).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,a.top+(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"),10)||0)-(parseInt(d(b).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(a,b){if(!b)b=this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?
|
|
||||||
this.offsetParent:this.scrollParent,e=/(html|body)/i.test(c[0].tagName);return{top:b.top+this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():e?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():e?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=
|
|
||||||
this.options,c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(c[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0]))this.offset.relative=this._getRelativeOffset();var f=a.pageX,g=a.pageY;if(this.originalPosition){if(this.containment){if(a.pageX-this.offset.click.left<this.containment[0])f=this.containment[0]+
|
|
||||||
this.offset.click.left;if(a.pageY-this.offset.click.top<this.containment[1])g=this.containment[1]+this.offset.click.top;if(a.pageX-this.offset.click.left>this.containment[2])f=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g=this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g-this.originalPageY)/b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?
|
|
||||||
g:!(g-this.offset.click.top<this.containment[1])?g-b.grid[1]:g+b.grid[1]:g;f=this.originalPageX+Math.round((f-this.originalPageX)/b.grid[0])*b.grid[0];f=this.containment?!(f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2])?f:!(f-this.offset.click.left<this.containment[0])?f-b.grid[0]:f+b.grid[0]:f}}return{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(d.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():
|
|
||||||
e?0:c.scrollTop()),left:f-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(d.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():e?0:c.scrollLeft())}},_rearrange:function(a,b,c,e){c?c[0].appendChild(this.placeholder[0]):b.item[0].parentNode.insertBefore(this.placeholder[0],this.direction=="down"?b.item[0]:b.item[0].nextSibling);this.counter=this.counter?++this.counter:1;var f=this,g=this.counter;window.setTimeout(function(){g==
|
|
||||||
f.counter&&f.refreshPositions(!e)},0)},_clear:function(a,b){this.reverting=false;var c=[];!this._noFinalSort&&this.currentItem[0].parentNode&&this.placeholder.before(this.currentItem);this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var e in this._storedCSS)if(this._storedCSS[e]=="auto"||this._storedCSS[e]=="static")this._storedCSS[e]="";this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();this.fromOutside&&!b&&c.push(function(f){this._trigger("receive",
|
|
||||||
f,this._uiHash(this.fromOutside))});if((this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!b)c.push(function(f){this._trigger("update",f,this._uiHash())});if(!d.ui.contains(this.element[0],this.currentItem[0])){b||c.push(function(f){this._trigger("remove",f,this._uiHash())});for(e=this.containers.length-1;e>=0;e--)if(d.ui.contains(this.containers[e].element[0],this.currentItem[0])&&!b){c.push(function(f){return function(g){f._trigger("receive",
|
|
||||||
g,this._uiHash(this))}}.call(this,this.containers[e]));c.push(function(f){return function(g){f._trigger("update",g,this._uiHash(this))}}.call(this,this.containers[e]))}}for(e=this.containers.length-1;e>=0;e--){b||c.push(function(f){return function(g){f._trigger("deactivate",g,this._uiHash(this))}}.call(this,this.containers[e]));if(this.containers[e].containerCache.over){c.push(function(f){return function(g){f._trigger("out",g,this._uiHash(this))}}.call(this,this.containers[e]));this.containers[e].containerCache.over=
|
|
||||||
0}}this._storedCursor&&d("body").css("cursor",this._storedCursor);this._storedOpacity&&this.helper.css("opacity",this._storedOpacity);if(this._storedZIndex)this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex);this.dragging=false;if(this.cancelHelperRemoval){if(!b){this._trigger("beforeStop",a,this._uiHash());for(e=0;e<c.length;e++)c[e].call(this,a);this._trigger("stop",a,this._uiHash())}return false}b||this._trigger("beforeStop",a,this._uiHash());this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
|
|
||||||
this.helper[0]!=this.currentItem[0]&&this.helper.remove();this.helper=null;if(!b){for(e=0;e<c.length;e++)c[e].call(this,a);this._trigger("stop",a,this._uiHash())}this.fromOutside=false;return true},_trigger:function(){d.Widget.prototype._trigger.apply(this,arguments)===false&&this.cancel()},_uiHash:function(a){var b=a||this;return{helper:b.helper,placeholder:b.placeholder||d([]),position:b.position,originalPosition:b.originalPosition,offset:b.positionAbs,item:b.currentItem,sender:a?a.element:null}}});
|
|
||||||
d.extend(d.ui.sortable,{version:"1.8.6"})})(jQuery);
|
|
||||||
;/*
|
|
||||||
* jQuery UI Autocomplete 1.8.6
|
|
||||||
*
|
|
||||||
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
|
||||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
|
||||||
* http://jquery.org/license
|
|
||||||
*
|
|
||||||
* http://docs.jquery.com/UI/Autocomplete
|
|
||||||
*
|
|
||||||
* Depends:
|
|
||||||
* jquery.ui.core.js
|
|
||||||
* jquery.ui.widget.js
|
|
||||||
* jquery.ui.position.js
|
|
||||||
*/
|
|
||||||
(function(e){e.widget("ui.autocomplete",{options:{appendTo:"body",delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},_create:function(){var a=this,b=this.element[0].ownerDocument,f;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(!(a.options.disabled||a.element.attr("readonly"))){f=false;var d=e.ui.keyCode;switch(c.keyCode){case d.PAGE_UP:a._move("previousPage",
|
|
||||||
c);break;case d.PAGE_DOWN:a._move("nextPage",c);break;case d.UP:a._move("previous",c);c.preventDefault();break;case d.DOWN:a._move("next",c);c.preventDefault();break;case d.ENTER:case d.NUMPAD_ENTER:if(a.menu.active){f=true;c.preventDefault()}case d.TAB:if(!a.menu.active)return;a.menu.select(c);break;case d.ESCAPE:a.element.val(a.term);a.close(c);break;default:clearTimeout(a.searching);a.searching=setTimeout(function(){if(a.term!=a.element.val()){a.selectedItem=null;a.search(null,c)}},a.options.delay);
|
|
||||||
break}}}).bind("keypress.autocomplete",function(c){if(f){f=false;c.preventDefault()}}).bind("focus.autocomplete",function(){if(!a.options.disabled){a.selectedItem=null;a.previous=a.element.val()}}).bind("blur.autocomplete",function(c){if(!a.options.disabled){clearTimeout(a.searching);a.closing=setTimeout(function(){a.close(c);a._change(c)},150)}});this._initSource();this.response=function(){return a._response.apply(a,arguments)};this.menu=e("<ul></ul>").addClass("ui-autocomplete").appendTo(e(this.options.appendTo||
|
|
||||||
"body",b)[0]).mousedown(function(c){var d=a.menu.element[0];e(c.target).closest(".ui-menu-item").length||setTimeout(function(){e(document).one("mousedown",function(g){g.target!==a.element[0]&&g.target!==d&&!e.ui.contains(d,g.target)&&a.close()})},1);setTimeout(function(){clearTimeout(a.closing)},13)}).menu({focus:function(c,d){d=d.item.data("item.autocomplete");false!==a._trigger("focus",c,{item:d})&&/^key/.test(c.originalEvent.type)&&a.element.val(d.value)},selected:function(c,d){d=d.item.data("item.autocomplete");
|
|
||||||
var g=a.previous;if(a.element[0]!==b.activeElement){a.element.focus();a.previous=g;setTimeout(function(){a.previous=g},1)}false!==a._trigger("select",c,{item:d})&&a.element.val(d.value);a.term=a.element.val();a.close(c);a.selectedItem=d},blur:function(){a.menu.element.is(":visible")&&a.element.val()!==a.term&&a.element.val(a.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu");e.fn.bgiframe&&this.menu.element.bgiframe()},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");
|
|
||||||
this.menu.element.remove();e.Widget.prototype.destroy.call(this)},_setOption:function(a,b){e.Widget.prototype._setOption.apply(this,arguments);a==="source"&&this._initSource();if(a==="appendTo")this.menu.element.appendTo(e(b||"body",this.element[0].ownerDocument)[0])},_initSource:function(){var a=this,b,f;if(e.isArray(this.options.source)){b=this.options.source;this.source=function(c,d){d(e.ui.autocomplete.filter(b,c.term))}}else if(typeof this.options.source==="string"){f=this.options.source;this.source=
|
|
||||||
function(c,d){a.xhr&&a.xhr.abort();a.xhr=e.getJSON(f,c,function(g,i,h){h===a.xhr&&d(g);a.xhr=null})}}else this.source=this.options.source},search:function(a,b){a=a!=null?a:this.element.val();this.term=this.element.val();if(a.length<this.options.minLength)return this.close(b);clearTimeout(this.closing);if(this._trigger("search",b)!==false)return this._search(a)},_search:function(a){this.element.addClass("ui-autocomplete-loading");this.source({term:a},this.response)},_response:function(a){if(a&&a.length){a=
|
|
||||||
this._normalize(a);this._suggest(a);this._trigger("open")}else this.close();this.element.removeClass("ui-autocomplete-loading")},close:function(a){clearTimeout(this.closing);if(this.menu.element.is(":visible")){this._trigger("close",a);this.menu.element.hide();this.menu.deactivate()}},_change:function(a){this.previous!==this.element.val()&&this._trigger("change",a,{item:this.selectedItem})},_normalize:function(a){if(a.length&&a[0].label&&a[0].value)return a;return e.map(a,function(b){if(typeof b===
|
|
||||||
"string")return{label:b,value:b};return e.extend({label:b.label||b.value,value:b.value||b.label},b)})},_suggest:function(a){this._renderMenu(this.menu.element.empty().zIndex(this.element.zIndex()+1),a);this.menu.deactivate();this.menu.refresh();this.menu.element.show().position(e.extend({of:this.element},this.options.position));this._resizeMenu()},_resizeMenu:function(){var a=this.menu.element;a.outerWidth(Math.max(a.width("").outerWidth(),this.element.outerWidth()))},_renderMenu:function(a,b){var f=
|
|
||||||
this;e.each(b,function(c,d){f._renderItem(a,d)})},_renderItem:function(a,b){return e("<li></li>").data("item.autocomplete",b).append(e("<a></a>").text(b.label)).appendTo(a)},_move:function(a,b){if(this.menu.element.is(":visible"))if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term);this.menu.deactivate()}else this.menu[a](b);else this.search(null,b)},widget:function(){return this.menu.element}});e.extend(e.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,
|
|
||||||
"\\$&")},filter:function(a,b){var f=new RegExp(e.ui.autocomplete.escapeRegex(b),"i");return e.grep(a,function(c){return f.test(c.label||c.value||c)})}})})(jQuery);
|
|
||||||
(function(e){e.widget("ui.menu",{_create:function(){var a=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(b){if(e(b.target).closest(".ui-menu-item a").length){b.preventDefault();a.select(b)}});this.refresh()},refresh:function(){var a=this;this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem").children("a").addClass("ui-corner-all").attr("tabindex",
|
|
||||||
-1).mouseenter(function(b){a.activate(b,e(this).parent())}).mouseleave(function(){a.deactivate()})},activate:function(a,b){this.deactivate();if(this.hasScroll()){var f=b.offset().top-this.element.offset().top,c=this.element.attr("scrollTop"),d=this.element.height();if(f<0)this.element.attr("scrollTop",c+f);else f>=d&&this.element.attr("scrollTop",c+f-d+b.height())}this.active=b.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",a,{item:b})},
|
|
||||||
deactivate:function(){if(this.active){this.active.children("a").removeClass("ui-state-hover").removeAttr("id");this._trigger("blur");this.active=null}},next:function(a){this.move("next",".ui-menu-item:first",a)},previous:function(a){this.move("prev",".ui-menu-item:last",a)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(a,b,f){if(this.active){a=this.active[a+"All"](".ui-menu-item").eq(0);
|
|
||||||
a.length?this.activate(f,a):this.activate(f,this.element.children(b))}else this.activate(f,this.element.children(b))},nextPage:function(a){if(this.hasScroll())if(!this.active||this.last())this.activate(a,this.element.children(".ui-menu-item:first"));else{var b=this.active.offset().top,f=this.element.height(),c=this.element.children(".ui-menu-item").filter(function(){var d=e(this).offset().top-b-f+e(this).height();return d<10&&d>-10});c.length||(c=this.element.children(".ui-menu-item:last"));this.activate(a,
|
|
||||||
c)}else this.activate(a,this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"))},previousPage:function(a){if(this.hasScroll())if(!this.active||this.first())this.activate(a,this.element.children(".ui-menu-item:last"));else{var b=this.active.offset().top,f=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var c=e(this).offset().top-b+f-e(this).height();return c<10&&c>-10});result.length||(result=this.element.children(".ui-menu-item:first"));
|
|
||||||
this.activate(a,result)}else this.activate(a,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"))},hasScroll:function(){return this.element.height()<this.element.attr("scrollHeight")},select:function(a){this._trigger("selected",a,{item:this.active})}})})(jQuery);
|
|
||||||
;/*
|
|
||||||
* jQuery UI Dialog 1.8.6
|
|
||||||
*
|
|
||||||
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
|
||||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
|
||||||
* http://jquery.org/license
|
|
||||||
*
|
|
||||||
* http://docs.jquery.com/UI/Dialog
|
|
||||||
*
|
|
||||||
* Depends:
|
|
||||||
* jquery.ui.core.js
|
|
||||||
* jquery.ui.widget.js
|
|
||||||
* jquery.ui.button.js
|
|
||||||
* jquery.ui.draggable.js
|
|
||||||
* jquery.ui.mouse.js
|
|
||||||
* jquery.ui.position.js
|
|
||||||
* jquery.ui.resizable.js
|
|
||||||
*/
|
|
||||||
(function(c,j){var k={buttons:true,height:true,maxHeight:true,maxWidth:true,minHeight:true,minWidth:true,width:true},l={maxHeight:true,maxWidth:true,minHeight:true,minWidth:true};c.widget("ui.dialog",{options:{autoOpen:true,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,position:{my:"center",at:"center",of:window,collision:"fit",using:function(a){var b=c(this).css(a).offset().top;
|
|
||||||
b<0&&c(this).css("top",a.top-b)}},resizable:true,show:null,stack:true,title:"",width:300,zIndex:1E3},_create:function(){this.originalTitle=this.element.attr("title");if(typeof this.originalTitle!=="string")this.originalTitle="";this.options.title=this.options.title||this.originalTitle;var a=this,b=a.options,d=b.title||" ",e=c.ui.dialog.getTitleId(a.element),g=(a.uiDialog=c("<div></div>")).appendTo(document.body).hide().addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+b.dialogClass).css({zIndex:b.zIndex}).attr("tabIndex",
|
|
||||||
-1).css("outline",0).keydown(function(i){if(b.closeOnEscape&&i.keyCode&&i.keyCode===c.ui.keyCode.ESCAPE){a.close(i);i.preventDefault()}}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(i){a.moveToTop(false,i)});a.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g);var f=(a.uiDialogTitlebar=c("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g),h=c('<a href="#"></a>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role",
|
|
||||||
"button").hover(function(){h.addClass("ui-state-hover")},function(){h.removeClass("ui-state-hover")}).focus(function(){h.addClass("ui-state-focus")}).blur(function(){h.removeClass("ui-state-focus")}).click(function(i){a.close(i);return false}).appendTo(f);(a.uiDialogTitlebarCloseText=c("<span></span>")).addClass("ui-icon ui-icon-closethick").text(b.closeText).appendTo(h);c("<span></span>").addClass("ui-dialog-title").attr("id",e).html(d).prependTo(f);if(c.isFunction(b.beforeclose)&&!c.isFunction(b.beforeClose))b.beforeClose=
|
|
||||||
b.beforeclose;f.find("*").add(f).disableSelection();b.draggable&&c.fn.draggable&&a._makeDraggable();b.resizable&&c.fn.resizable&&a._makeResizable();a._createButtons(b.buttons);a._isOpen=false;c.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;a.overlay&&a.overlay.destroy();a.uiDialog.hide();a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");a.uiDialog.remove();a.originalTitle&&
|
|
||||||
a.element.attr("title",a.originalTitle);return a},widget:function(){return this.uiDialog},close:function(a){var b=this,d;if(false!==b._trigger("beforeClose",a)){b.overlay&&b.overlay.destroy();b.uiDialog.unbind("keypress.ui-dialog");b._isOpen=false;if(b.options.hide)b.uiDialog.hide(b.options.hide,function(){b._trigger("close",a)});else{b.uiDialog.hide();b._trigger("close",a)}c.ui.dialog.overlay.resize();if(b.options.modal){d=0;c(".ui-dialog").each(function(){if(this!==b.uiDialog[0])d=Math.max(d,c(this).css("z-index"))});
|
|
||||||
c.ui.dialog.maxZ=d}return b}},isOpen:function(){return this._isOpen},moveToTop:function(a,b){var d=this,e=d.options;if(e.modal&&!a||!e.stack&&!e.modal)return d._trigger("focus",b);if(e.zIndex>c.ui.dialog.maxZ)c.ui.dialog.maxZ=e.zIndex;if(d.overlay){c.ui.dialog.maxZ+=1;d.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=c.ui.dialog.maxZ)}a={scrollTop:d.element.attr("scrollTop"),scrollLeft:d.element.attr("scrollLeft")};c.ui.dialog.maxZ+=1;d.uiDialog.css("z-index",c.ui.dialog.maxZ);d.element.attr(a);
|
|
||||||
d._trigger("focus",b);return d},open:function(){if(!this._isOpen){var a=this,b=a.options,d=a.uiDialog;a.overlay=b.modal?new c.ui.dialog.overlay(a):null;a._size();a._position(b.position);d.show(b.show);a.moveToTop(true);b.modal&&d.bind("keypress.ui-dialog",function(e){if(e.keyCode===c.ui.keyCode.TAB){var g=c(":tabbable",this),f=g.filter(":first");g=g.filter(":last");if(e.target===g[0]&&!e.shiftKey){f.focus(1);return false}else if(e.target===f[0]&&e.shiftKey){g.focus(1);return false}}});c(a.element.find(":tabbable").get().concat(d.find(".ui-dialog-buttonpane :tabbable").get().concat(d.get()))).eq(0).focus();
|
|
||||||
a._isOpen=true;a._trigger("open");return a}},_createButtons:function(a){var b=this,d=false,e=c("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),g=c("<div></div>").addClass("ui-dialog-buttonset").appendTo(e);b.uiDialog.find(".ui-dialog-buttonpane").remove();typeof a==="object"&&a!==null&&c.each(a,function(){return!(d=true)});if(d){c.each(a,function(f,h){h=c.isFunction(h)?{click:h,text:f}:h;f=c('<button type="button"></button>').attr(h,true).unbind("click").click(function(){h.click.apply(b.element[0],
|
|
||||||
arguments)}).appendTo(g);c.fn.button&&f.button()});e.appendTo(b.uiDialog)}},_makeDraggable:function(){function a(f){return{position:f.position,offset:f.offset}}var b=this,d=b.options,e=c(document),g;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(f,h){g=d.height==="auto"?"auto":c(this).height();c(this).height(c(this).height()).addClass("ui-dialog-dragging");b._trigger("dragStart",f,a(h))},drag:function(f,
|
|
||||||
h){b._trigger("drag",f,a(h))},stop:function(f,h){d.position=[h.position.left-e.scrollLeft(),h.position.top-e.scrollTop()];c(this).removeClass("ui-dialog-dragging").height(g);b._trigger("dragStop",f,a(h));c.ui.dialog.overlay.resize()}})},_makeResizable:function(a){function b(f){return{originalPosition:f.originalPosition,originalSize:f.originalSize,position:f.position,size:f.size}}a=a===j?this.options.resizable:a;var d=this,e=d.options,g=d.uiDialog.css("position");a=typeof a==="string"?a:"n,e,s,w,se,sw,ne,nw";
|
|
||||||
d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:a,start:function(f,h){c(this).addClass("ui-dialog-resizing");d._trigger("resizeStart",f,b(h))},resize:function(f,h){d._trigger("resize",f,b(h))},stop:function(f,h){c(this).removeClass("ui-dialog-resizing");e.height=c(this).height();e.width=c(this).width();d._trigger("resizeStop",f,b(h));c.ui.dialog.overlay.resize()}}).css("position",
|
|
||||||
g).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(a){var b=[],d=[0,0],e;if(a){if(typeof a==="string"||typeof a==="object"&&"0"in a){b=a.split?a.split(" "):[a[0],a[1]];if(b.length===1)b[1]=b[0];c.each(["left","top"],function(g,f){if(+b[g]===b[g]){d[g]=b[g];b[g]=f}});a={my:b.join(" "),at:b.join(" "),offset:d.join(" ")}}a=c.extend({},c.ui.dialog.prototype.options.position,
|
|
||||||
a)}else a=c.ui.dialog.prototype.options.position;(e=this.uiDialog.is(":visible"))||this.uiDialog.show();this.uiDialog.css({top:0,left:0}).position(a);e||this.uiDialog.hide()},_setOptions:function(a){var b=this,d={},e=false;c.each(a,function(g,f){b._setOption(g,f);if(g in k)e=true;if(g in l)d[g]=f});e&&this._size();this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",d)},_setOption:function(a,b){var d=this,e=d.uiDialog;switch(a){case "beforeclose":a="beforeClose";break;case "buttons":d._createButtons(b);
|
|
||||||
break;case "closeText":d.uiDialogTitlebarCloseText.text(""+b);break;case "dialogClass":e.removeClass(d.options.dialogClass).addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+b);break;case "disabled":b?e.addClass("ui-dialog-disabled"):e.removeClass("ui-dialog-disabled");break;case "draggable":var g=e.is(":data(draggable)");g&&!b&&e.draggable("destroy");!g&&b&&d._makeDraggable();break;case "position":d._position(b);break;case "resizable":(g=e.is(":data(resizable)"))&&!b&&e.resizable("destroy");
|
|
||||||
g&&typeof b==="string"&&e.resizable("option","handles",b);!g&&b!==false&&d._makeResizable(b);break;case "title":c(".ui-dialog-title",d.uiDialogTitlebar).html(""+(b||" "));break}c.Widget.prototype._setOption.apply(d,arguments)},_size:function(){var a=this.options,b,d;this.element.show().css({width:"auto",minHeight:0,height:0});if(a.minWidth>a.width)a.width=a.minWidth;b=this.uiDialog.css({height:"auto",width:a.width}).height();d=Math.max(0,a.minHeight-b);if(a.height==="auto")if(c.support.minHeight)this.element.css({minHeight:d,
|
|
||||||
height:"auto"});else{this.uiDialog.show();a=this.element.css("height","auto").height();this.uiDialog.hide();this.element.height(Math.max(a,d))}else this.element.height(Math.max(a.height-b,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}});c.extend(c.ui.dialog,{version:"1.8.6",uuid:0,maxZ:0,getTitleId:function(a){a=a.attr("id");if(!a){this.uuid+=1;a=this.uuid}return"ui-dialog-title-"+a},overlay:function(a){this.$el=c.ui.dialog.overlay.create(a)}});
|
|
||||||
c.extend(c.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "),create:function(a){if(this.instances.length===0){setTimeout(function(){c.ui.dialog.overlay.instances.length&&c(document).bind(c.ui.dialog.overlay.events,function(d){if(c(d.target).zIndex()<c.ui.dialog.overlay.maxZ)return false})},1);c(document).bind("keydown.dialog-overlay",function(d){if(a.options.closeOnEscape&&
|
|
||||||
d.keyCode&&d.keyCode===c.ui.keyCode.ESCAPE){a.close(d);d.preventDefault()}});c(window).bind("resize.dialog-overlay",c.ui.dialog.overlay.resize)}var b=(this.oldInstances.pop()||c("<div></div>").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),height:this.height()});c.fn.bgiframe&&b.bgiframe();this.instances.push(b);return b},destroy:function(a){this.oldInstances.push(this.instances.splice(c.inArray(a,this.instances),1)[0]);this.instances.length===0&&c([document,window]).unbind(".dialog-overlay");
|
|
||||||
a.remove();var b=0;c.each(this.instances,function(){b=Math.max(b,this.css("z-index"))});this.maxZ=b},height:function(){var a,b;if(c.browser.msie&&c.browser.version<7){a=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);b=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);return a<b?c(window).height()+"px":a+"px"}else return c(document).height()+"px"},width:function(){var a,b;if(c.browser.msie&&c.browser.version<7){a=Math.max(document.documentElement.scrollWidth,
|
|
||||||
document.body.scrollWidth);b=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);return a<b?c(window).width()+"px":a+"px"}else return c(document).width()+"px"},resize:function(){var a=c([]);c.each(c.ui.dialog.overlay.instances,function(){a=a.add(this)});a.css({width:0,height:0}).css({width:c.ui.dialog.overlay.width(),height:c.ui.dialog.overlay.height()})}});c.extend(c.ui.dialog.overlay.prototype,{destroy:function(){c.ui.dialog.overlay.destroy(this.$el)}})})(jQuery);
|
|
||||||
;/*
|
|
||||||
* jQuery UI Tabs 1.8.6
|
|
||||||
*
|
|
||||||
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
|
||||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
|
||||||
* http://jquery.org/license
|
|
||||||
*
|
|
||||||
* http://docs.jquery.com/UI/Tabs
|
|
||||||
*
|
|
||||||
* Depends:
|
|
||||||
* jquery.ui.core.js
|
|
||||||
* jquery.ui.widget.js
|
|
||||||
*/
|
|
||||||
(function(d,p){function u(){return++v}function w(){return++x}var v=0,x=0;d.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"<div></div>",remove:null,select:null,show:null,spinner:"<em>Loading…</em>",tabTemplate:"<li><a href='#{href}'><span>#{label}</span></a></li>"},_create:function(){this._tabify(true)},_setOption:function(b,e){if(b=="selected")this.options.collapsible&&
|
|
||||||
e==this.options.selected||this.select(e);else{this.options[b]=e;this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+u()},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+w());return d.cookie.apply(null,[b].concat(d.makeArray(arguments)))},_ui:function(b,e){return{tab:b,panel:e,index:this.anchors.index(b)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=
|
|
||||||
d(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(b){function e(g,f){g.css("display","");!d.support.opacity&&f.opacity&&g[0].style.removeAttribute("filter")}var a=this,c=this.options,h=/^#.+/;this.list=this.element.find("ol,ul").eq(0);this.lis=d(" > li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return d("a",this)[0]});this.panels=d([]);this.anchors.each(function(g,f){var i=d(f).attr("href"),l=i.split("#")[0],q;if(l&&(l===location.toString().split("#")[0]||
|
|
||||||
(q=d("base")[0])&&l===q.href)){i=f.hash;f.href=i}if(h.test(i))a.panels=a.panels.add(a._sanitizeSelector(i));else if(i&&i!=="#"){d.data(f,"href.tabs",i);d.data(f,"load.tabs",i.replace(/#.*$/,""));i=a._tabId(f);f.href="#"+i;f=d("#"+i);if(!f.length){f=d(c.panelTemplate).attr("id",i).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(a.panels[g-1]||a.list);f.data("destroy.tabs",true)}a.panels=a.panels.add(f)}else c.disabled.push(g)});if(b){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");
|
|
||||||
this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(c.selected===p){location.hash&&this.anchors.each(function(g,f){if(f.hash==location.hash){c.selected=g;return false}});if(typeof c.selected!=="number"&&c.cookie)c.selected=parseInt(a._cookie(),10);if(typeof c.selected!=="number"&&this.lis.filter(".ui-tabs-selected").length)c.selected=
|
|
||||||
this.lis.index(this.lis.filter(".ui-tabs-selected"));c.selected=c.selected||(this.lis.length?0:-1)}else if(c.selected===null)c.selected=-1;c.selected=c.selected>=0&&this.anchors[c.selected]||c.selected<0?c.selected:0;c.disabled=d.unique(c.disabled.concat(d.map(this.lis.filter(".ui-state-disabled"),function(g){return a.lis.index(g)}))).sort();d.inArray(c.selected,c.disabled)!=-1&&c.disabled.splice(d.inArray(c.selected,c.disabled),1);this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");
|
|
||||||
if(c.selected>=0&&this.anchors.length){d(a._sanitizeSelector(a.anchors[c.selected].hash)).removeClass("ui-tabs-hide");this.lis.eq(c.selected).addClass("ui-tabs-selected ui-state-active");a.element.queue("tabs",function(){a._trigger("show",null,a._ui(a.anchors[c.selected],d(a._sanitizeSelector(a.anchors[c.selected].hash))))});this.load(c.selected)}d(window).bind("unload",function(){a.lis.add(a.anchors).unbind(".tabs");a.lis=a.anchors=a.panels=null})}else c.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"));
|
|
||||||
this.element[c.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");c.cookie&&this._cookie(c.selected,c.cookie);b=0;for(var j;j=this.lis[b];b++)d(j)[d.inArray(b,c.disabled)!=-1&&!d(j).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");c.cache===false&&this.anchors.removeData("cache.tabs");this.lis.add(this.anchors).unbind(".tabs");if(c.event!=="mouseover"){var k=function(g,f){f.is(":not(.ui-state-disabled)")&&f.addClass("ui-state-"+g)},n=function(g,f){f.removeClass("ui-state-"+
|
|
||||||
g)};this.lis.bind("mouseover.tabs",function(){k("hover",d(this))});this.lis.bind("mouseout.tabs",function(){n("hover",d(this))});this.anchors.bind("focus.tabs",function(){k("focus",d(this).closest("li"))});this.anchors.bind("blur.tabs",function(){n("focus",d(this).closest("li"))})}var m,o;if(c.fx)if(d.isArray(c.fx)){m=c.fx[0];o=c.fx[1]}else m=o=c.fx;var r=o?function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.hide().removeClass("ui-tabs-hide").animate(o,o.duration||"normal",
|
|
||||||
function(){e(f,o);a._trigger("show",null,a._ui(g,f[0]))})}:function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");a._trigger("show",null,a._ui(g,f[0]))},s=m?function(g,f){f.animate(m,m.duration||"normal",function(){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");e(f,m);a.element.dequeue("tabs")})}:function(g,f){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");a.element.dequeue("tabs")};
|
|
||||||
this.anchors.bind(c.event+".tabs",function(){var g=this,f=d(g).closest("li"),i=a.panels.filter(":not(.ui-tabs-hide)"),l=d(a._sanitizeSelector(g.hash));if(f.hasClass("ui-tabs-selected")&&!c.collapsible||f.hasClass("ui-state-disabled")||f.hasClass("ui-state-processing")||a.panels.filter(":animated").length||a._trigger("select",null,a._ui(this,l[0]))===false){this.blur();return false}c.selected=a.anchors.index(this);a.abort();if(c.collapsible)if(f.hasClass("ui-tabs-selected")){c.selected=-1;c.cookie&&
|
|
||||||
a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){s(g,i)}).dequeue("tabs");this.blur();return false}else if(!i.length){c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this));this.blur();return false}c.cookie&&a._cookie(c.selected,c.cookie);if(l.length){i.length&&a.element.queue("tabs",function(){s(g,i)});a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this))}else throw"jQuery UI Tabs: Mismatching fragment identifier.";
|
|
||||||
d.browser.msie&&this.blur()});this.anchors.bind("click.tabs",function(){return false})},_getIndex:function(b){if(typeof b=="string")b=this.anchors.index(this.anchors.filter("[href$="+b+"]"));return b},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var e=
|
|
||||||
d.data(this,"href.tabs");if(e)this.href=e;var a=d(this).unbind(".tabs");d.each(["href","load","cache"],function(c,h){a.removeData(h+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){d.data(this,"destroy.tabs")?d(this).remove():d(this).removeClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-state-hover ui-state-focus ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide")});b.cookie&&this._cookie(null,b.cookie);return this},add:function(b,
|
|
||||||
e,a){if(a===p)a=this.anchors.length;var c=this,h=this.options;e=d(h.tabTemplate.replace(/#\{href\}/g,b).replace(/#\{label\}/g,e));b=!b.indexOf("#")?b.replace("#",""):this._tabId(d("a",e)[0]);e.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var j=d("#"+b);j.length||(j=d(h.panelTemplate).attr("id",b).data("destroy.tabs",true));j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(a>=this.lis.length){e.appendTo(this.list);j.appendTo(this.list[0].parentNode)}else{e.insertBefore(this.lis[a]);
|
|
||||||
j.insertBefore(this.panels[a])}h.disabled=d.map(h.disabled,function(k){return k>=a?++k:k});this._tabify();if(this.anchors.length==1){h.selected=0;e.addClass("ui-tabs-selected ui-state-active");j.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){c._trigger("show",null,c._ui(c.anchors[0],c.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[a],this.panels[a]));return this},remove:function(b){b=this._getIndex(b);var e=this.options,a=this.lis.eq(b).remove(),c=this.panels.eq(b).remove();
|
|
||||||
if(a.hasClass("ui-tabs-selected")&&this.anchors.length>1)this.select(b+(b+1<this.anchors.length?1:-1));e.disabled=d.map(d.grep(e.disabled,function(h){return h!=b}),function(h){return h>=b?--h:h});this._tabify();this._trigger("remove",null,this._ui(a.find("a")[0],c[0]));return this},enable:function(b){b=this._getIndex(b);var e=this.options;if(d.inArray(b,e.disabled)!=-1){this.lis.eq(b).removeClass("ui-state-disabled");e.disabled=d.grep(e.disabled,function(a){return a!=b});this._trigger("enable",null,
|
|
||||||
this._ui(this.anchors[b],this.panels[b]));return this}},disable:function(b){b=this._getIndex(b);var e=this.options;if(b!=e.selected){this.lis.eq(b).addClass("ui-state-disabled");e.disabled.push(b);e.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[b],this.panels[b]))}return this},select:function(b){b=this._getIndex(b);if(b==-1)if(this.options.collapsible&&this.options.selected!=-1)b=this.options.selected;else return this;this.anchors.eq(b).trigger(this.options.event+".tabs");return this},
|
|
||||||
load:function(b){b=this._getIndex(b);var e=this,a=this.options,c=this.anchors.eq(b)[0],h=d.data(c,"load.tabs");this.abort();if(!h||this.element.queue("tabs").length!==0&&d.data(c,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(b).addClass("ui-state-processing");if(a.spinner){var j=d("span",c);j.data("label.tabs",j.html()).html(a.spinner)}this.xhr=d.ajax(d.extend({},a.ajaxOptions,{url:h,success:function(k,n){d(e._sanitizeSelector(c.hash)).html(k);e._cleanup();a.cache&&d.data(c,"cache.tabs",
|
|
||||||
true);e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.success(k,n)}catch(m){}},error:function(k,n){e._cleanup();e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.error(k,n,b,c)}catch(m){}}}));e.element.dequeue("tabs");return this}},abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup();return this},url:function(b,
|
|
||||||
e){this.anchors.eq(b).removeData("cache.tabs").data("load.tabs",e);return this},length:function(){return this.anchors.length}});d.extend(d.ui.tabs,{version:"1.8.6"});d.extend(d.ui.tabs.prototype,{rotation:null,rotate:function(b,e){var a=this,c=this.options,h=a._rotate||(a._rotate=function(j){clearTimeout(a.rotation);a.rotation=setTimeout(function(){var k=c.selected;a.select(++k<a.anchors.length?k:0)},b);j&&j.stopPropagation()});e=a._unrotate||(a._unrotate=!e?function(j){j.clientX&&a.rotate(null)}:
|
|
||||||
function(){t=c.selected;h()});if(b){this.element.bind("tabsshow",h);this.anchors.bind(c.event+".tabs",e);h()}else{clearTimeout(a.rotation);this.element.unbind("tabsshow",h);this.anchors.unbind(c.event+".tabs",e);delete this._rotate;delete this._unrotate}return this}})})(jQuery);
|
|
||||||
;/*
|
|
||||||
* jQuery UI Progressbar 1.8.6
|
|
||||||
*
|
|
||||||
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
|
||||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
|
||||||
* http://jquery.org/license
|
|
||||||
*
|
|
||||||
* http://docs.jquery.com/UI/Progressbar
|
|
||||||
*
|
|
||||||
* Depends:
|
|
||||||
* jquery.ui.core.js
|
|
||||||
* jquery.ui.widget.js
|
|
||||||
*/
|
|
||||||
(function(b,c){b.widget("ui.progressbar",{options:{value:0},min:0,max:100,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.max,"aria-valuenow":this._value()});this.valueDiv=b("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element);this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow");
|
|
||||||
this.valueDiv.remove();b.Widget.prototype.destroy.apply(this,arguments)},value:function(a){if(a===c)return this._value();this._setOption("value",a);return this},_setOption:function(a,d){if(a==="value"){this.options.value=d;this._refreshValue();this._trigger("change");this._value()===this.max&&this._trigger("complete")}b.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;if(typeof a!=="number")a=0;return Math.min(this.max,Math.max(this.min,a))},_refreshValue:function(){var a=
|
|
||||||
this.value();this.valueDiv.toggleClass("ui-corner-right",a===this.max).width(a+"%");this.element.attr("aria-valuenow",a)}});b.extend(b.ui.progressbar,{version:"1.8.6"})})(jQuery);
|
|
||||||
;
|
|
||||||