You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
(83) |
Apr
(159) |
May
(106) |
Jun
(86) |
Jul
(36) |
Aug
(19) |
Sep
(52) |
Oct
(37) |
Nov
(36) |
Dec
(99) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(87) |
Feb
(150) |
Mar
(82) |
Apr
(78) |
May
(71) |
Jun
(62) |
Jul
(42) |
Aug
(165) |
Sep
(110) |
Oct
(165) |
Nov
(107) |
Dec
(57) |
| 2009 |
Jan
(94) |
Feb
(46) |
Mar
(19) |
Apr
(119) |
May
(33) |
Jun
(31) |
Jul
(131) |
Aug
(174) |
Sep
(123) |
Oct
(47) |
Nov
(99) |
Dec
(40) |
| 2010 |
Jan
(94) |
Feb
(73) |
Mar
(37) |
Apr
(15) |
May
|
Jun
|
Jul
(51) |
Aug
(136) |
Sep
(68) |
Oct
(13) |
Nov
(29) |
Dec
(78) |
| 2011 |
Jan
(46) |
Feb
(54) |
Mar
(29) |
Apr
(33) |
May
(29) |
Jun
(21) |
Jul
(19) |
Aug
(15) |
Sep
(92) |
Oct
(53) |
Nov
(36) |
Dec
(53) |
| 2012 |
Jan
(19) |
Feb
(38) |
Mar
(54) |
Apr
(39) |
May
(13) |
Jun
(89) |
Jul
(32) |
Aug
(107) |
Sep
(45) |
Oct
(13) |
Nov
(22) |
Dec
(17) |
| 2013 |
Jan
(70) |
Feb
(33) |
Mar
(21) |
Apr
(21) |
May
(34) |
Jun
(19) |
Jul
(28) |
Aug
(38) |
Sep
(47) |
Oct
(32) |
Nov
(95) |
Dec
(23) |
| 2014 |
Jan
(41) |
Feb
(33) |
Mar
(46) |
Apr
(24) |
May
(19) |
Jun
(34) |
Jul
(47) |
Aug
(94) |
Sep
(88) |
Oct
(74) |
Nov
(79) |
Dec
(15) |
| 2015 |
Jan
(31) |
Feb
(36) |
Mar
(33) |
Apr
(67) |
May
(50) |
Jun
(54) |
Jul
(49) |
Aug
(59) |
Sep
(77) |
Oct
(58) |
Nov
(74) |
Dec
(41) |
| 2016 |
Jan
(23) |
Feb
(37) |
Mar
(26) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <sv...@cy...> - 2016-03-01 13:53:39
|
Author: rlaucik
Date: 2016-03-01 14:53:29 +0100 (Tue, 01 Mar 2016)
New Revision: 8627
Log:
added view and list modules for 740 joboffer
Added:
trunk/frame/_addons/App/740/_mdl/
trunk/frame/_addons/App/740/_mdl/740-joboffer_list.2013.mdl
trunk/frame/_addons/App/740/_mdl/740-joboffer_view.2013.mdl
Added: trunk/frame/_addons/App/740/_mdl/740-joboffer_list.2013.mdl
===================================================================
--- trunk/frame/_addons/App/740/_mdl/740-joboffer_list.2013.mdl (rev 0)
+++ trunk/frame/_addons/App/740/_mdl/740-joboffer_list.2013.mdl 2016-03-01 13:53:29 UTC (rev 8627)
@@ -0,0 +1,261 @@
+#!/usr/bin/perl
+# USE UTF-8 !!!
+package Tomahawk::module;
+use open ':utf8', ':std';
+use if $] < 5.018, 'encoding','utf8';
+use utf8;
+use strict;
+use DateTime;
+
+
+use App::740::_init;
+
+use Data::Dumper;
+
+sub execute
+{
+ my %env=@_;
+ my %env_out;
+
+ $env{'joboffer.status'}='Y' unless $env{'joboffer.status'};
+ my $sql_joboffer_status=join "','", split('',$env{'joboffer.status'});
+
+ # paging
+ $env{'page_limit'} = 10 unless $env{'page_limit'};
+ $env{'page'} = 1 unless $env{'page'};
+ $env{'page_offset'} = 0 unless $env{'page_offset'};
+ $env{'page_plus'} = 1 unless $env{'page_plus'};
+ $env{'sql_limit'}=((($env{'page'}-1)*$env{'page_limit'})+$env{'page_offset'}).",".($env{'page_limit'}+$env{'page_plus'});
+ my @sql_bind;
+ my $sql_where;
+ my $sql_join;
+ my $sql_columns;
+ my $sql_changetime;
+ my $sql_limit=$env{'sql_limit'} || 10;
+ my $sql_order_by=$env{'sql_order_by'} || 'joboffer.datetime_publish_start DESC';
+ my $sql_group_by;
+
+ if ($env{'unique'})
+ {
+ $sql_group_by="joboffer.ID_entity";
+ }
+
+ if ($env{'joboffer_cat.ID_entity'})
+ {
+ my $sql_cat;
+ foreach my $ID_category (split(';',$env{'joboffer_cat.ID_entity'}))
+ {
+ next unless $ID_category;
+ if ($ID_category=~s/\*$//)
+ {
+ my $cat_sql=qq{SELECT ID_charindex FROM `$App::740::db_name`.a740_joboffer_cat WHERE ID_entity=$ID_category AND lng='$env{'lng'}' AND status IN ('Y','L') LIMIT 1};
+ $ID_category=qq{SELECT ID_entity FROM `$App::740::db_name`.a740_joboffer_cat WHERE ID_charindex LIKE CONCAT(($cat_sql),"%") AND lng='$env{'lng'}' AND status IN ('Y','L')};
+ }
+ $sql_cat.=" OR joboffer_rel_cat.ID_category IN ($ID_category)";
+ $sql_cat=~s/^ OR //;
+ }
+ if ($sql_cat)
+ {
+ $sql_where.=" AND (".$sql_cat.") ";
+ }
+ }
+
+ if ($env{'joboffer_cat.ID'})
+ {
+ my $sql_cat;
+ foreach my $ID_category (split(';',$env{'joboffer_cat.ID'}))
+ {
+ next unless $ID_category;
+ if ($ID_category=~s/\*$//)
+ {
+ my $cat_sql=qq{SELECT ID_charindex FROM `$App::740::db_name`.a740_joboffer_cat WHERE ID=$ID_category AND lng='$env{'lng'}' AND status IN ('Y','L') LIMIT 1};
+ $ID_category=qq{SELECT ID FROM `$App::740::db_name`.a740_joboffer_cat WHERE ID_charindex LIKE CONCAT(($cat_sql),"%") AND lng='$env{'lng'}' AND status IN ('Y','L')};
+ }
+ $sql_cat.=" OR joboffer_cat.ID IN ($ID_category)";
+ $sql_cat=~s/^ OR //;
+ }
+ if ($sql_cat)
+ {
+ $sql_where.=" AND (".$sql_cat.") ";
+ }
+ }
+
+ if ($env{'joboffer.ID_entity'}=~/^[0-9;]+$/)
+ {
+ $sql_where.=" AND joboffer.ID_entity IN (".join(',',split(';',$env{'joboffer.ID_entity'})).")";
+ $sql_limit=scalar split(';',$env{'joboffer.ID_entity'});
+ }
+
+ if ($env{'datetime_mode'} eq "present")
+ {
+ $sql_where.=" AND (joboffer.datetime_publish_start IS NULL OR joboffer.datetime_publish_start <= NOW())";
+ $sql_where.=" AND (joboffer.datetime_publish_stop IS NULL OR joboffer.datetime_publish_stop >= NOW())";
+ }
+ elsif ($env{'datetime_mode'} eq "past")
+ {
+ $sql_where.=" AND (joboffer.datetime_publish_start IS NULL OR joboffer.datetime_publish_start <= NOW())";
+ $sql_where.=" AND joboffer.datetime_publish_stop <= NOW()";
+ }
+ elsif ($env{'datetime_mode'} eq "future")
+ {
+ $sql_where.=" AND joboffer.datetime_publish_start >= NOW()";
+ $sql_where.=" AND (joboffer.datetime_publish_stop IS NULL OR joboffer.datetime_publish_stop >= NOW())";
+ }
+ elsif ($env{'datetime_mode'} eq "all")
+ {
+
+ }
+ else # present & upcoming
+ {
+ $sql_where.=" AND (joboffer.datetime_publish_stop IS NULL OR joboffer.datetime_publish_stop >= NOW())";
+ }
+
+ # filters
+ if ($env{'joboffer.education'}) {
+ $sql_where.=" AND joboffer.education = '".TOM::Security::form::sql_escape($env{'joboffer.education'})."'";
+ }
+ if ($env{'joboffer.location_city'}) {
+ $sql_where.=" AND joboffer.location_city = '".TOM::Security::form::sql_escape($env{'joboffer.location_city'})."'";
+ }
+ if ($env{'joboffer.contract_type'}) {
+ $sql_where.=" AND joboffer.contract_type = '".TOM::Security::form::sql_escape($env{'joboffer.contract_type'})."'";
+ }
+ if ($env{'joboffer_lng.name'}) {
+ $sql_where.=" AND joboffer_lng.name = '".TOM::Security::form::sql_escape($env{'joboffer_lng.name'})."'";
+ }
+ if ($env{'joboffer_lng.name_search'}) {
+ $sql_where.=" AND joboffer_lng.name LIKE '".TOM::Security::form::sql_escape($env{'joboffer_lng.name_search'})."%'";
+ }
+
+ if ($env{'get_org_data'}) {
+ use App::710::_init;
+ $sql_columns .= ",
+ org.ID AS org_ID,
+ org.ID_entity org_ID_entity,
+ org.name AS org_name
+ ";
+ $sql_join = "
+ LEFT JOIN `$App::710::db_name`.a710_org AS org ON (
+ org.ID = joboffer.contact_org
+ )
+ ";
+ }
+
+ $sql_where.=" AND ".$env{'sql_where'} if $env{'sql_where'};
+
+ main::_log('-------------------------------------------------------'.$env{'sql_where'});
+
+ $sql_where=~s|^ ||;
+
+ Tomahawk::GetTpl('env'=>\%env) || return undef;
+
+ use App::020::mimetypes::html;
+ my $parser=new App::020::mimetypes::html(
+ 'tpl_ext' => $TPL # extend
+ );
+
+ my $i;
+ my %sth0=TOM::Database::SQL::execute(qq{
+ SELECT
+
+ joboffer.ID,
+ joboffer.ID_entity,
+ joboffer.posix_owner,
+ joboffer.datetime_publish_start,
+ joboffer.datetime_publish_stop,
+ joboffer.location_city,
+ joboffer.education,
+ joboffer.contract_type,
+ joboffer.contact_org,
+
+ joboffer_lng.name,
+ joboffer_lng.name_url,
+ joboffer_lng.description,
+ joboffer_lng.lng,
+
+ joboffer.metadata,
+ joboffer.status,
+
+ joboffer_cat.ID AS cat_ID,
+ joboffer_cat.name AS cat_name,
+ joboffer_cat.name_url AS cat_name_url
+ $sql_columns
+
+ FROM `$App::740::db_name`.a740_joboffer AS joboffer
+ LEFT JOIN `$App::740::db_name`.a740_joboffer_lng AS joboffer_lng ON
+ (
+ joboffer.ID_entity = joboffer_lng.ID_entity AND
+ joboffer_lng.lng = '$env{'lng'}'
+ )
+ LEFT JOIN `$App::740::db_name`.a740_joboffer_rel_cat AS joboffer_rel_cat ON
+ (
+ joboffer_rel_cat.ID_joboffer = joboffer.ID_entity
+ )
+ LEFT JOIN `$App::740::db_name`.a740_joboffer_cat AS joboffer_cat ON
+ (
+ joboffer_cat.ID_entity = joboffer_rel_cat.ID_category AND
+ joboffer_cat.lng = '$env{'lng'}'
+ )$sql_join
+ WHERE
+ joboffer.status IN ('$sql_joboffer_status')
+ $sql_where}.do{if($sql_group_by){qq{
+ GROUP BY
+ $sql_group_by}}}.qq{
+ ORDER BY
+ $sql_order_by
+ LIMIT
+ $sql_limit
+ },'bind'=>[@sql_bind],'log'=>1,'-slave'=>1,
+ '-changetime'=>App::020::SQL::functions::_get_changetime(
+ {
+ 'db_h'=>"main",
+ 'db_name' => `$App::740::db_name`,
+ 'tb_name' => "a740_joboffer",
+ 'ID_entity' => do{$env{'joboffer.ID_entity'} if $env{'joboffer.ID_entity'}=~/^\d+$/}
+ }),
+ );
+
+ $TPL->{'variables'}->{'rows'}=$sth0{'rows'};
+ while (my %joboffer=$sth0{'sth'}->fetchhash())
+ {
+ $i++;
+ last if $i > $env{'page_limit'};
+
+ main::_log("[$i/$env{'page_limit'}] found joboffer.ID_entity=$joboffer{'ID_entity'}");
+
+ push @{$env_out{'entity'}},{
+ 'db_h' => 'main',
+ 'db_name' => `$App::740::db_name`,
+ 'tb_name' => 'a740_joboffer',
+ 'ID_entity' => $joboffer{'ID_entity'}
+ };
+
+ if ($env{'parser.description'})
+ {
+ $parser->parse($joboffer{'description'});
+ $parser->eof();
+ $joboffer{'description_parser'}={
+ 'output' => $parser->{'output'},
+ 'addon' => $parser->{'addon'},
+ 'entity' => $parser->{'entity'},
+ 'thumbnail' => $parser->{'thumbnail'},
+ };
+ }
+ $joboffer{'location_city_url'} = TOM::Net::URI::rewrite::convert($joboffer{'location_city'});
+
+ push @{$TPL->{'variables'}{'items'}},\%joboffer;
+ }
+
+ return 1,%env_out;
+}
+
+
+our $authors="open\@comsultia.com";
+
+=head1 AUTHORS
+
+Comsultia, Ltd. (op...@co...)
+
+=cut
+
+1;
Added: trunk/frame/_addons/App/740/_mdl/740-joboffer_view.2013.mdl
===================================================================
--- trunk/frame/_addons/App/740/_mdl/740-joboffer_view.2013.mdl (rev 0)
+++ trunk/frame/_addons/App/740/_mdl/740-joboffer_view.2013.mdl 2016-03-01 13:53:29 UTC (rev 8627)
@@ -0,0 +1,162 @@
+#!/usr/bin/perl
+# USE UTF-8 !!!
+package Tomahawk::module;
+use open ':utf8', ':std';
+use if $] < 5.018, 'encoding','utf8';
+use utf8;
+use strict;
+
+use App::740::_init;
+
+sub execute
+{
+ my %env=@_;
+ my %env_out;
+
+ $env{'joboffer.status'}='Y' unless $env{'joboffer.status'};
+ my $sql_joboffer_status=join "','", split('',$env{'joboffer.status'});
+
+ my @sql_bind;
+ my $sql_where;
+ my $sql_columns;
+ my $sql_join;
+ if ($env{'joboffer.ID_entity'})
+ {
+ main::_log("search by joboffer.ID_entity");
+ push @{$env_out{'entity'}},{
+ 'db_h' => 'main',
+ 'db_name' => $App::740::db_name,
+ 'tb_name' => 'a740_joboffer',
+ 'ID_entity' => $env{'joboffer.ID_entity'}
+ };
+ $sql_where.="AND joboffer.ID_entity=? ";
+ push @sql_bind,$env{'joboffer.ID_entity'};
+ }
+
+ if ($env{'joboffer.ID'})
+ {
+ main::_log("search by joboffer.ID");
+ $sql_where.="AND joboffer.ID=? ";
+ push @sql_bind,$env{'joboffer.ID'};
+ }
+
+
+ if ($env{'get_org_data'}) {
+ use App::710::_init;
+ $sql_columns .= ",
+ org.ID AS org_ID,
+ org.ID_entity org_ID_entity,
+ org.name AS org_name
+ ";
+ $sql_join = "
+ LEFT JOIN $App::710::db_name.a710_org AS org ON (
+ org.ID = joboffer.contact_org
+ )
+ ";
+ }
+
+ $sql_where.=" AND ".$env{'sql_where'} if $env{'sql_where'};
+
+ $sql_where=~s|^ ||;
+
+ # get template
+ Tomahawk::GetTpl('env' => \%env) || return undef;
+
+ return 1 unless $sql_where;
+
+ use App::020::mimetypes::html;
+ my $parser=new App::020::mimetypes::html(
+ 'tpl_ext' => $TPL # extend
+ );
+
+ my $i;
+ my %sth0=TOM::Database::SQL::execute(qq{
+ SELECT
+ joboffer.ID,
+ joboffer.ID_entity,
+ joboffer.posix_owner,
+ joboffer.datetime_publish_start,
+ joboffer.datetime_publish_stop,
+ joboffer.location_city,
+ joboffer.education,
+ joboffer.contract_type,
+ joboffer.contact_org,
+
+ joboffer_lng.name,
+ joboffer_lng.name_url,
+ joboffer_lng.description,
+ joboffer_lng.lng,
+
+ joboffer.metadata,
+ joboffer.status,
+
+ joboffer_cat.ID AS cat_ID,
+ joboffer_cat.name AS cat_name,
+ joboffer_cat.name_url AS cat_name_url
+ $sql_columns
+
+ FROM $App::740::db_name.a740_joboffer AS joboffer
+ LEFT JOIN $App::740::db_name.a740_joboffer_lng AS joboffer_lng ON
+ (
+ joboffer.ID_entity = joboffer_lng.ID_entity AND
+ joboffer_lng.lng = '$env{'lng'}'
+ )
+ LEFT JOIN $App::740::db_name.a740_joboffer_rel_cat AS joboffer_rel_cat ON
+ (
+ joboffer_rel_cat.ID_joboffer = joboffer.ID_entity
+ )
+ LEFT JOIN $App::740::db_name.a740_joboffer_cat AS joboffer_cat ON
+ (
+ joboffer_cat.ID_entity = joboffer_rel_cat.ID_category AND
+ joboffer_cat.lng = '$env{'lng'}'
+ )
+ $sql_join
+ WHERE
+ joboffer.status IN ('$sql_joboffer_status')
+ AND joboffer.datetime_publish_start <= NOW()
+ AND (joboffer.datetime_publish_stop IS NULL OR joboffer.datetime_publish_stop >= NOW())
+ $sql_where
+ LIMIT
+ 1
+ },'bind'=>[@sql_bind],'log_'=>1,'-slave'=>1,
+ '-changetime'=>App::020::SQL::functions::_get_changetime(
+ {
+ 'db_h'=>"main",
+ 'db_name' => $App::740::db_name,
+ 'tb_name' => "a740_joboffer",
+ 'ID_entity' => do{$env{'joboffer.ID_entity'} if $env{'joboffer.ID_entity'}=~/^\d+$/}
+ }),
+ );
+
+ my %joboffer=$sth0{'sth'}->fetchhash();
+
+ return 1 unless $joboffer{'ID_entity'};
+
+ main::_log("found joboffer.ID_entity=$joboffer{'ID_entity'}");
+
+ push @{$env_out{'entity'}},{
+ 'db_h' => 'main',
+ 'db_name' => $App::740::db_name,
+ 'tb_name' => 'a740_joboffer',
+ 'ID_entity' => $joboffer{'ID_entity'}
+ };
+
+ # parser body
+ $parser->parse($joboffer{'description'});
+ $parser->eof();
+ $joboffer{'description_parser'}={
+ 'output' => $parser->{'output'},
+ 'addon' => $parser->{'addon'},
+ 'entity' => $parser->{'entity'},
+ 'thumbnail' => $parser->{'thumbnail'},
+ };
+ push @{$env_out{'entity'}},@{$parser->{'entity'}} if $parser->{'entity'}; # depend on this too
+
+ $main::env{'joboffer.location_city_url'} = TOM::Net::URI::rewrite::convert($joboffer{'location_city'});
+
+ $TPL->{'variables'}{'item'} = \%joboffer;
+
+ return 1,%env_out;
+}
+
+1;
|
|
From: <sv...@cy...> - 2016-02-29 16:12:47
|
Author: rlaucik
Date: 2016-02-29 17:12:37 +0100 (Mon, 29 Feb 2016)
New Revision: 8626
Log:
Modified:
trunk/frame/_addons/Ext/Elastic/_mdl/eElastic-setup.job
Modified: trunk/frame/_addons/Ext/Elastic/_mdl/eElastic-setup.job
===================================================================
--- trunk/frame/_addons/Ext/Elastic/_mdl/eElastic-setup.job 2016-02-29 16:11:19 UTC (rev 8625)
+++ trunk/frame/_addons/Ext/Elastic/_mdl/eElastic-setup.job 2016-02-29 16:12:37 UTC (rev 8626)
@@ -22,29 +22,12 @@
return undef;
}
- $Elastic->indices->open('index'=>'cyclone3.tom');
main::_log_stdout("check if cyclone3.tom exists");
# $Elastic->indices->open('index'=>'cyclone3.*');
- if (!$Elastic->exists(
- 'index' => 'cyclone3.tom',
- 'type' => 'a010_test',
- 'id' => 1
- ))
- {
- main::_log_stdout("first index");
- eval {$Elastic->index(
- 'index' => 'cyclone3.tom',
- 'type' => 'a010_test',
- 'id' => 1,
- 'body' => {
- 'test' => 'test'
- }
- )};
- }
-
- main::_log_stdout("delete_template");
- eval{$Elastic->indices->delete_template('name'=>'cyclone3.*')};
+# main::_log_stdout("delete_template");
+# eval{$Elastic->indices->delete_template('name'=>'cyclone3.*')};
+ my $version='1.07';
main::_log_stdout("put_template");
$Elastic->indices->put_template(
'name'=>'cyclone3.*',
@@ -53,7 +36,7 @@
'mappings' => {
'_default_' => {
"_meta" => {
- "version" => "1.02"
+ "version" => $version
},
'properties' => {
'status' => {
@@ -67,11 +50,20 @@
"match" => "*_status",
'mapping' => {
'type' => 'string',
- 'format' => 'not_analyzed'
+ 'index' => 'not_analyzed'
}
}
},
{
+ "status_" => {
+ "match" => "status_*",
+ 'mapping' => {
+ 'type' => 'string',
+ 'index' => 'not_analyzed'
+ }
+ }
+ },
+ {
"datetime" => {
"match" => "datetime_*",
'mapping' => {
@@ -79,13 +71,54 @@
'format' => 'yyyy-MM-dd HH:mm:ss'
}
}
- }
+ },
+
+ # metadata in metahash tree
+ {'metadata_string' => {
+ "path_match" => "metahash.*.*_s",
+ "mapping" => {
+ "type" => "string",
+ "index" => "not_analyzed"
+ }
+ }},
+ {'metadata_text' => {
+ "path_match" => "metahash.*.*_t",
+ "mapping" => {
+ "type" => "string"
+ }
+ }},
+ {'metadata_integer' => {
+ "path_match" => "metahash.*.*_i",
+ "mapping" => {
+ "type" => "integer"
+ }
+ }},
+ {'metadata_float' => {
+ "path_match" => "metahash.*.*_f",
+ "mapping" => {
+ "type" => "float"
+ }
+ }},
+ {'metadata_date' => {
+ "path_match" => "metahash.*.*_d",
+ "mapping" => {
+ "type" => "date",
+# 'format' => 'yyyy-MM-dd HH:mm:ss'
+ }
+ }},
+ {'metadata_other' => {
+ "path_match" => "metahash.*.*",
+ "mapping" => {
+ "type" => "string",
+ "index" => "not_analyzed"
+ }
+ }},
]
},
'a401_article' => {
"_meta" => {
- "version" => "1.00"
+ "version" => $version
},
'properties' => {
'status' => {
@@ -111,24 +144,77 @@
}
}
}
+ },
+
+ 'a910_product' => {
+ "_meta" => {
+ "version" => $version
+ },
+ 'properties' => {
+ 'ID' => {'type' => 'long'},
+ 'ID_entity' => {'type' => 'long'},
+ 'name' => {
+ 'type' => "string",
+ 'copy_to' => 'name_completion',
+ },
+ 'name_completion' => {
+ 'type' => "completion",
+ 'analyzer' => "simple",
+ 'search_analyzer' => "simple",
+# 'payloads' => 'true'
+ },
+ 'full_name' => {
+ 'type' => "string",
+ 'copy_to' => 'full_name_completion',
+ },
+ 'full_name_completion' => {
+ 'type' => "completion",
+ 'analyzer' => "simple",
+ 'search_analyzer' => "simple",
+# 'payloads' => 'true'
+ },
+ 'price' => {'type' => 'float'},
+ 'price_full' => {'type' => 'float'},
+ 'status' => {
+ 'type' => 'string',
+ 'index' => 'not_analyzed'
+ }
+ },
+ 'dynamic_templates' => [
+ # prices
+ {'prices' => {
+ "path_match" => "prices.*.*",
+ "mapping" => {
+ "type" => "float"
+ }
+ }},
+ # locale
+ {'locale' => {
+ "path_match" => "locale.*.*",
+ "mapping" => {
+ "type" => "string"
+ }
+ }}
+ ]
}
},
+
'settings' => {
- 'version' => '1.03',
+ 'version' => $version,
'analysis' => {
'analyzer' => {
'default_index' => {
- 'tokenizer' => 'lowercase',
- 'filter' => ['standard', 'lowercase', 'asciifolding', 'unique'],
+ 'tokenizer' => 'standard',
+ 'filter' => ['cyclone3_delimiter','cyclone3_word_size','standard', 'lowercase', 'asciifolding', 'unique'],
'char_filter' => ['html_strip']
},
'default_search' => {
- 'tokenizer' => "lowercase",
- 'filter' => ['standard', "lowercase", "asciifolding"]
+ 'tokenizer' => "standard",
+ 'filter' => ['cyclone3_delimiter','standard', "lowercase", "asciifolding"]
}
},
- "filter" => {
+ 'filter' => {
"cyclone3_delimiter" => {
"type" => "word_delimiter",
"generate_word_parts" => 'true',
@@ -139,6 +225,14 @@
"preserve_original" => 'true',
"split_on_numerics" => 'true',
"stem_english_possessive" => 'true'
+ },
+ "cyclone3_synonym" => {
+ "type" => "synonym",
+ "synonyms_path" => "/etc/elasticsearch/synonym.txt"
+ },
+ "cyclone3_word_size" => {
+ "type" => "length",
+ "min" => '2'
}
}
}
@@ -147,9 +241,25 @@
}
);
+ if (!$Elastic->exists(
+ 'index' => 'cyclone3.tom',
+ 'type' => 'a010_test',
+ 'id' => 1
+ ))
+ {
+ main::_log_stdout("first index");
+ eval {$Elastic->index(
+ 'index' => 'cyclone3.tom',
+ 'type' => 'a010_test',
+ 'id' => 1,
+ 'body' => {
+ 'test' => 'test'
+ }
+ )};
+ }
- main::_log_stdout("open index cyclone3.tom");
- $Elastic->indices->open('index'=>'cyclone3.tom');
+# main::_log_stdout("open index cyclone3.tom");
+# $Elastic->indices->open('index'=>'cyclone3.tom');
if ($env->{'recreate'})
{
@@ -166,171 +276,11 @@
);
}
-=head1
- main::_log_stdout("put settings");
- $Elastic->indices->close('index'=>'cyclone3.*');
- $Elastic->indices->put_settings(
- 'index'=>'cyclone3.*',
- 'body' => {
- 'version' => '1.03',
- 'analysis' => {
- 'analyzer' => {
- 'default_index' => {
- 'tokenizer' => 'lowercase',
-# 'tokenizer' => 'word_delimiter',
-# 'filter' => ['standard', 'lowercase', 'asciifolding', 'trim', 'stop', 'unique'],
- 'filter' => ['standard', 'lowercase', 'asciifolding', 'unique'],
-# 'filter' => ['cyclone3_delimiter'],
- 'char_filter' => ['html_strip']
- },
- 'default_search' => {
- 'tokenizer' => "lowercase",
-# 'filter' => ["standard", "lowercase", "asciifolding", "stop", "porter_stem"]
- 'filter' => ['standard', "lowercase", "asciifolding"]
- }
- },
- "filter" => {
- "cyclone3_delimiter" => {
- "type" => "word_delimiter",
- "generate_word_parts" => 'true',
- "catenate_words" => 'true',
- "catenate_numbers" => 'true',
- "catenate_all" => 'true',
- "split_on_case_change" => 'true',
- "preserve_original" => 'true',
- "split_on_numerics" => 'true',
- "stem_english_possessive" => 'true'
- }
- }
- }
- }
- );
-=cut
+# main::_log_stdout("getting settings");
+# my $result = $Elastic->indices->get_settings(
+# 'index' => 'cyclone3.tom',
+# );
+# print Dumper($result);
-=head1
- # _default_
- main::_log_stdout("put mapping _default_");
- $Elastic->indices->put_template(
- 'name' => "cyclone3",
- 'body' => {
- 'template' => 'cyclone3.*',
- 'mappings' => {
- '_default_' => {
- "dynamic_templates" => [
- { "metahash" => {
- 'path_match' => "metahash.*.*",
- 'mapping' => {
- 'type' => 'string',
- 'index' => 'not_analyzed'
- }
- }},
- ],
- 'properties' => {
- 'status' => {
- 'type' => 'string',
- 'index' => 'not_analyzed'
- }
- }
- }
- }
- }
- );
-
-
-
-=head1
- $Elastic->indices->put_mapping(
- 'index' => "cyclone3.*",
- 'type' => "_default_",
- 'body' => {
- "_meta" => {
- "version" => "1.01"
- },
-# "dynamic_templates" => [
- { "metahash" => {
- 'path_match' => "metahash.*",
-# 'date_detection' => "false",
-# "match" => "metahash.*",
- 'mapping' => {
-# 'date_detection' => "false",
-# 'type' => 'string',
- 'index' => 'not_analyzed',
-# "fields" => {
-# "{name}" => {"type"=> "string", "index"=> "not_analyzed"}
-# "raw" : {"type": "string", "index" : "not_analyzed"}
-# }
- }
- }},
-# { "metahash_in" => {
-# 'path_match' => "metahash.*.*",
-# 'date_detection' => "false",
-## "match" => "metahash.*",
-# 'mapping' => {
-# 'date_detection' => "false",
-# 'type' => 'string',
-# 'index' => 'not_analyzed'
-# }
-# }},
-# ],
- 'properties' => {
- 'status' => {
- 'type' => 'string',
- 'index' => 'not_analyzed'
- }
- }
- }
- );
-#=cut
-
-#=head1
- # a401
- main::_log_stdout("put mapping a401_article");
- $Elastic->indices->put_mapping(
- 'index' => "cyclone3.*",
- 'type' => "a401_article",
- 'body' => {
- "_meta" => {
- "version" => "1.00"
- },
- 'properties' => {
- 'status' => {
- 'type' => 'string',
- 'index' => 'not_analyzed'
- },
- 'cat' => {
- 'properties' => {
- 'ID' => { 'type' => 'integer' },
- 'charindex' => {
- 'type' => 'string',
- "index" => "not_analyzed"
- },
- },
- },
- 'article_attrs' => {
- 'properties' => {
- 'datetime_start' => {
- 'type' => 'date',
- 'format' => 'YYYY-MM-dd HH:mm:ss',
- 'store' => 'yes'
- }
- }
- }
- }
- }
- );
-=cut
-
-# main::_log_stdout("open indexes cyclone3.*");
-
-# $Elastic->indices->open('index'=>'cyclone3.*');
-
- main::_log_stdout("getting settings");
-
- my $result = $Elastic->indices->get_settings(
- 'index' => 'cyclone3.tom',
- );
-
- print Dumper($result);
-
return 1}
1;
|
|
From: <sv...@cy...> - 2016-02-29 16:11:26
|
Author: rlaucik
Date: 2016-02-29 17:11:19 +0100 (Mon, 29 Feb 2016)
New Revision: 8625
Log:
Modified:
trunk/frame/_addons/App/910/functions.pm
Modified: trunk/frame/_addons/App/910/functions.pm
===================================================================
--- trunk/frame/_addons/App/910/functions.pm 2016-02-29 12:10:45 UTC (rev 8624)
+++ trunk/frame/_addons/App/910/functions.pm 2016-02-29 16:11:19 UTC (rev 8625)
@@ -387,8 +387,13 @@
$env{'product.metadata'}=App::020::functions::metadata::serialize(%metadata);
# print $env{'product.metadata'};
$columns{'metadata'}="'".TOM::Security::form::sql_escape($env{'product.metadata'})."'"
- if (exists $env{'product.metadata'} && ($env{'product.metadata'} ne $product{'metadata'}));
+ if (exists $env{'product.metadata'} && ($env{'product.metadata'} ne $product{'metadata'}));
+# if (exists $env{'product.metadata'} && ($env{'product.metadata'} ne $product{'metadata'}))
+# {
+# print $product{'metadata'}."\n";
+# }
+
# print "metadata=".$columns{'metadata'};
if ($columns{'metadata'} && $App::910::metaindex eq 'Y')
@@ -2281,12 +2286,16 @@
if $product{'datetime_publish_start'}=~/^0/;
# main::_log("index ID=$product{'ID'}",3,"elastic");
+ my %log_date=main::ctogmdatetime(time(),format=>1);
$Elastic->index(
'index' => 'cyclone3.'.$App::910::db_name,
'type' => 'a910_product',
'id' => $env{'ID'},
'body' => {
- %product
+ %product,
+ '_datetime_index' =>
+ $log_date{'year'}.'-'.$log_date{'mom'}.'-'.$log_date{'mday'}
+ .'T'.$log_date{'hour'}.":".$log_date{'min'}.":".$log_date{'sec'}.'Z'
}
);
# main::_log("/index ID=$product{'ID'}",3,"elastic");
|
|
From: <sv...@cy...> - 2016-02-29 12:10:54
|
Author: rlaucik Date: 2016-02-29 13:10:45 +0100 (Mon, 29 Feb 2016) New Revision: 8624 Log: added name_url for joboffer, fixed comments Modified: trunk/frame/_addons/App/740/a740_struct.sql Modified: trunk/frame/_addons/App/740/a740_struct.sql =================================================================== --- trunk/frame/_addons/App/740/a740_struct.sql 2016-02-26 15:03:11 UTC (rev 8623) +++ trunk/frame/_addons/App/740/a740_struct.sql 2016-02-29 12:10:45 UTC (rev 8624) @@ -53,6 +53,7 @@ `posix_owner` varchar(8) character set ascii collate ascii_bin NOT NULL, `posix_modified` varchar(8) character set ascii collate ascii_bin NOT NULL, `name` varchar(128) character set utf8 collate utf8_unicode_ci NOT NULL, + `name_url` varchar(128) character set utf8 collate utf8_unicode_ci NOT NULL, `description` longtext character set utf8 collate utf8_unicode_ci NOT NULL, `lng` char(5) character set ascii NOT NULL default '', `status` char(1) character set ascii NOT NULL default 'Y', @@ -69,6 +70,7 @@ `posix_owner` varchar(8) character set ascii collate ascii_bin NOT NULL, `posix_modified` varchar(8) character set ascii collate ascii_bin NOT NULL, `name` varchar(128) character set utf8 collate utf8_unicode_ci NOT NULL, + `name_url` varchar(128) character set utf8 collate utf8_unicode_ci NOT NULL, `description` longtext character set utf8 collate utf8_unicode_ci NOT NULL, `lng` char(5) character set ascii NOT NULL default '', `status` char(1) character set ascii NOT NULL default 'Y', @@ -118,9 +120,9 @@ -- -------------------------------------------------- CREATE TABLE `/*db_name*/`.`/*addon*/_joboffer_rel_cat` ( - `ID_category` bigint(20) unsigned NOT NULL auto_increment, -- rel _event_cat.ID_entity - `ID_event` bigint(20) unsigned NOT NULL, -- rel _event.ID_entity, - PRIMARY KEY (`ID_category`,`ID_event`) + `ID_category` bigint(20) unsigned NOT NULL auto_increment, -- rel _joboffer_cat.ID_entity + `ID_joboffer` bigint(20) unsigned NOT NULL, -- rel _joboffer.ID_entity, + PRIMARY KEY (`ID_category`,`ID_joboffer`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -------------------------------------------------- |
|
From: <sv...@cy...> - 2016-02-26 15:03:24
|
Author: comsultia
Date: 2016-02-26 16:03:11 +0100 (Fri, 26 Feb 2016)
New Revision: 8623
Log:
fixed to use only default JSON lib to parse JSON
Modified:
trunk/xuladmin/docroot/_addons/App/910/_mdl/910-product_generate_modifications.new.mdl
Modified: trunk/xuladmin/docroot/_addons/App/910/_mdl/910-product_generate_modifications.new.mdl
===================================================================
--- trunk/xuladmin/docroot/_addons/App/910/_mdl/910-product_generate_modifications.new.mdl 2016-02-26 12:51:31 UTC (rev 8622)
+++ trunk/xuladmin/docroot/_addons/App/910/_mdl/910-product_generate_modifications.new.mdl 2016-02-26 15:03:11 UTC (rev 8623)
@@ -37,8 +37,7 @@
delete_existing_modifications('ID_entity' => $main::RPC->{'product_main.ID_entity'});
}
- use JSON::Parse 'parse_json';
- my $generator_hash = parse_json($main::RPC->{'generator_json'});
+ my $generator_hash = decode_json($main::RPC->{'generator_json'});
my $generated = generate_modifications(
'groups' => \@{$generator_hash},
|
|
From: <sv...@cy...> - 2016-02-26 12:51:47
|
Author: comsultia
Date: 2016-02-26 13:51:31 +0100 (Fri, 26 Feb 2016)
New Revision: 8622
Log:
[+][xuladmin:xul] search in source code, source code editor update
Added:
trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/js/codemirror/dialog.css
trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/js/codemirror/dialog.js
trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/js/codemirror/jump-to-line.js
trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/js/codemirror/search.js
trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/js/codemirror/searchcursor.js
Modified:
trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/js/codemirror/codemirror.css
trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/js/codemirror/codemirror.html
trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/js/codemirror/codemirror.js
trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/js/codemirror/css.js
trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/js/codemirror/htmlmixed.js
trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/js/codemirror/xml.js
trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/xhtml_edit.xul
Modified: trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/js/codemirror/codemirror.css
===================================================================
--- trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/js/codemirror/codemirror.css 2016-02-26 12:45:35 UTC (rev 8621)
+++ trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/js/codemirror/codemirror.css 2016-02-26 12:51:31 UTC (rev 8622)
@@ -41,19 +41,21 @@
/* CURSOR */
-.CodeMirror div.CodeMirror-cursor {
+.CodeMirror-cursor {
border-left: 1px solid black;
+ border-right: none;
+ width: 0;
}
/* Shown when moving in bi-directional text */
.CodeMirror div.CodeMirror-secondarycursor {
border-left: 1px solid silver;
}
-.CodeMirror.cm-fat-cursor div.CodeMirror-cursor {
+.cm-fat-cursor .CodeMirror-cursor {
width: auto;
border: 0;
background: #7e7;
}
-.CodeMirror.cm-fat-cursor div.CodeMirror-cursors {
+.cm-fat-cursor div.CodeMirror-cursors {
z-index: 1;
}
@@ -63,25 +65,26 @@
-webkit-animation: blink 1.06s steps(1) infinite;
-moz-animation: blink 1.06s steps(1) infinite;
animation: blink 1.06s steps(1) infinite;
+ background-color: #7e7;
}
@-moz-keyframes blink {
- 0% { background: #7e7; }
- 50% { background: none; }
- 100% { background: #7e7; }
+ 0% {}
+ 50% { background-color: transparent; }
+ 100% {}
}
@-webkit-keyframes blink {
- 0% { background: #7e7; }
- 50% { background: none; }
- 100% { background: #7e7; }
+ 0% {}
+ 50% { background-color: transparent; }
+ 100% {}
}
@keyframes blink {
- 0% { background: #7e7; }
- 50% { background: none; }
- 100% { background: #7e7; }
+ 0% {}
+ 50% { background-color: transparent; }
+ 100% {}
}
/* Can style cursor different in overwrite (non-insert) mode */
-div.CodeMirror-overwrite div.CodeMirror-cursor {}
+.CodeMirror-overwrite .CodeMirror-cursor {}
.cm-tab { display: inline-block; text-decoration: inherit; }
@@ -92,6 +95,15 @@
/* DEFAULT THEME */
+.cm-s-default .cm-header {color: blue;}
+.cm-s-default .cm-quote {color: #090;}
+.cm-negative {color: #d44;}
+.cm-positive {color: #292;}
+.cm-header, .cm-strong {font-weight: bold;}
+.cm-em {font-style: italic;}
+.cm-link {text-decoration: underline;}
+.cm-strikethrough {text-decoration: line-through;}
+
.cm-s-default .cm-keyword {color: #708;}
.cm-s-default .cm-atom {color: #219;}
.cm-s-default .cm-number {color: #164;}
@@ -111,21 +123,14 @@
.cm-s-default .cm-bracket {color: #997;}
.cm-s-default .cm-tag {color: #170;}
.cm-s-default .cm-attribute {color: #00c;}
-.cm-s-default .cm-header {color: blue;}
-.cm-s-default .cm-quote {color: #090;}
.cm-s-default .cm-hr {color: #999;}
.cm-s-default .cm-link {color: #00c;}
-.cm-negative {color: #d44;}
-.cm-positive {color: #292;}
-.cm-header, .cm-strong {font-weight: bold;}
-.cm-em {font-style: italic;}
-.cm-link {text-decoration: underline;}
-.cm-strikethrough {text-decoration: line-through;}
-
.cm-s-default .cm-error {color: #f00;}
.cm-invalidchar {color: #f00;}
+.CodeMirror-composing { border-bottom: 2px solid; }
+
/* Default styles for common addons */
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
@@ -160,7 +165,7 @@
}
/* The fake, visible scrollbars. Used to force redraw during scrolling
- before actuall scrolling happens, thus preventing shaking and
+ before actual scrolling happens, thus preventing shaking and
flickering artifacts. */
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
position: absolute;
@@ -192,6 +197,7 @@
white-space: normal;
height: 100%;
display: inline-block;
+ vertical-align: top;
margin-bottom: -30px;
/* Hack to make IE7 behave */
*zoom:1;
@@ -200,8 +206,14 @@
.CodeMirror-gutter-wrapper {
position: absolute;
z-index: 4;
- height: 100%;
+ background: none !important;
+ border: none !important;
}
+.CodeMirror-gutter-background {
+ position: absolute;
+ top: 0; bottom: 0;
+ z-index: 4;
+}
.CodeMirror-gutter-elt {
position: absolute;
cursor: default;
@@ -275,19 +287,19 @@
overflow: hidden;
visibility: hidden;
}
+
+.CodeMirror-cursor { position: absolute; }
.CodeMirror-measure pre { position: static; }
-.CodeMirror div.CodeMirror-cursor {
- position: absolute;
- border-right: none;
- width: 0;
-}
-
div.CodeMirror-cursors {
visibility: hidden;
position: relative;
z-index: 3;
}
+div.CodeMirror-dragcursors {
+ visibility: visible;
+}
+
.CodeMirror-focused div.CodeMirror-cursors {
visibility: visible;
}
@@ -295,8 +307,8 @@
.CodeMirror-selected { background: #d9d9d9; }
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
.CodeMirror-crosshair { cursor: crosshair; }
-.CodeMirror ::selection { background: #d7d4f0; }
-.CodeMirror ::-moz-selection { background: #d7d4f0; }
+.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }
+.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }
.cm-searching {
background: #ffa;
Modified: trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/js/codemirror/codemirror.html
===================================================================
--- trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/js/codemirror/codemirror.html 2016-02-26 12:45:35 UTC (rev 8621)
+++ trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/js/codemirror/codemirror.html 2016-02-26 12:51:31 UTC (rev 8622)
@@ -4,6 +4,7 @@
<title>CodeMirror: HTML completion demo</title>
<meta charset="utf-8"/>
<link rel="stylesheet" href="codemirror.css">
+ <link rel="stylesheet" href="dialog.css">
<script src="codemirror.js"></script>
<script src="xml.js"></script>
<script src="xml-hint.js"></script>
@@ -14,6 +15,10 @@
<script src="css-hint.js"></script>
<script src="htmlmixed.js"></script>
<script src="formatting.js"></script>
+ <script src="searchcursor.js"></script>
+ <script src="search.js"></script>
+ <script src="jump-to-line.js"></script>
+ <script src="dialog.js"></script>
<style>
html,body {
height: 100%;
@@ -41,7 +46,12 @@
document.getElementById("code_source"),
{
mode: "text/html",
- extraKeys: {"Ctrl-Space": "autocomplete"},
+ lineNumbers: true,
+ autofocus: true,
+ extraKeys: {
+ "Ctrl-Space": "autocomplete",
+ "Ctrl-F": "findPersistent"
+ },
}
);
window.clearInterval(loadTimer);
Modified: trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/js/codemirror/codemirror.js
===================================================================
--- trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/js/codemirror/codemirror.js 2016-02-26 12:45:35 UTC (rev 8621)
+++ trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/js/codemirror/codemirror.js 2016-02-26 12:51:31 UTC (rev 8622)
@@ -13,7 +13,7 @@
else if (typeof define == "function" && define.amd) // AMD
return define([], mod);
else // Plain browser env
- this.CodeMirror = mod();
+ (this || window).CodeMirror = mod();
})(function() {
"use strict";
@@ -21,27 +21,29 @@
// Kludges for bugs and behavior differences that can't be feature
// detected are enabled based on userAgent etc sniffing.
+ var userAgent = navigator.userAgent;
+ var platform = navigator.platform;
- var gecko = /gecko\/\d/i.test(navigator.userAgent);
- var ie_upto10 = /MSIE \d/.test(navigator.userAgent);
- var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);
+ var gecko = /gecko\/\d/i.test(userAgent);
+ var ie_upto10 = /MSIE \d/.test(userAgent);
+ var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent);
var ie = ie_upto10 || ie_11up;
var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : ie_11up[1]);
- var webkit = /WebKit\//.test(navigator.userAgent);
- var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(navigator.userAgent);
- var chrome = /Chrome\//.test(navigator.userAgent);
- var presto = /Opera\//.test(navigator.userAgent);
+ var webkit = /WebKit\//.test(userAgent);
+ var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent);
+ var chrome = /Chrome\//.test(userAgent);
+ var presto = /Opera\//.test(userAgent);
var safari = /Apple Computer/.test(navigator.vendor);
- var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent);
- var phantom = /PhantomJS/.test(navigator.userAgent);
+ var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent);
+ var phantom = /PhantomJS/.test(userAgent);
- var ios = /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent);
+ var ios = /AppleWebKit/.test(userAgent) && /Mobile\/\w+/.test(userAgent);
// This is woefully incomplete. Suggestions for alternative methods welcome.
- var mobile = ios || /Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent);
- var mac = ios || /Mac/.test(navigator.platform);
- var windows = /win/i.test(navigator.platform);
+ var mobile = ios || /Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);
+ var mac = ios || /Mac/.test(platform);
+ var windows = /win/i.test(platform);
- var presto_version = presto && navigator.userAgent.match(/Version\/(\d*\.\d*)/);
+ var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/);
if (presto_version) presto_version = Number(presto_version[1]);
if (presto_version && presto_version >= 15) { presto = false; webkit = true; }
// Some browsers use the wrong event properties to signal cmd/ctrl on OS X
@@ -65,7 +67,7 @@
setGuttersForLineNumbers(options);
var doc = options.value;
- if (typeof doc == "string") doc = new Doc(doc, options.mode);
+ if (typeof doc == "string") doc = new Doc(doc, options.mode, null, options.lineSeparator);
this.doc = doc;
var input = new CodeMirror.inputStyles[options.inputStyle](this);
@@ -87,6 +89,7 @@
focused: false,
suppressEdits: false, // used to disable editing during key handlers when in readOnly mode
pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll
+ selectingText: false,
draggingText: false,
highlight: new Delayed(), // stores highlight worker timeout
keySeq: null, // Unfinished key sequence
@@ -407,7 +410,7 @@
if (horiz.clientWidth) scroll(horiz.scrollLeft, "horizontal");
});
- this.checkedOverlay = false;
+ this.checkedZeroWidth = false;
// Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
if (ie && ie_version < 8) this.horiz.style.minHeight = this.vert.style.minWidth = "18px";
}
@@ -442,9 +445,9 @@
this.horiz.firstChild.style.width = "0";
}
- if (!this.checkedOverlay && measure.clientHeight > 0) {
- if (sWidth == 0) this.overlayHack();
- this.checkedOverlay = true;
+ if (!this.checkedZeroWidth && measure.clientHeight > 0) {
+ if (sWidth == 0) this.zeroWidthHack();
+ this.checkedZeroWidth = true;
}
return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0};
@@ -451,21 +454,35 @@
},
setScrollLeft: function(pos) {
if (this.horiz.scrollLeft != pos) this.horiz.scrollLeft = pos;
+ if (this.disableHoriz) this.enableZeroWidthBar(this.horiz, this.disableHoriz);
},
setScrollTop: function(pos) {
if (this.vert.scrollTop != pos) this.vert.scrollTop = pos;
+ if (this.disableVert) this.enableZeroWidthBar(this.vert, this.disableVert);
},
- overlayHack: function() {
+ zeroWidthHack: function() {
var w = mac && !mac_geMountainLion ? "12px" : "18px";
- this.horiz.style.minHeight = this.vert.style.minWidth = w;
- var self = this;
- var barMouseDown = function(e) {
- if (e_target(e) != self.vert && e_target(e) != self.horiz)
- operation(self.cm, onMouseDown)(e);
- };
- on(this.vert, "mousedown", barMouseDown);
- on(this.horiz, "mousedown", barMouseDown);
+ this.horiz.style.height = this.vert.style.width = w;
+ this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none";
+ this.disableHoriz = new Delayed;
+ this.disableVert = new Delayed;
},
+ enableZeroWidthBar: function(bar, delay) {
+ bar.style.pointerEvents = "auto";
+ function maybeDisable() {
+ // To find out whether the scrollbar is still visible, we
+ // check whether the element under the pixel in the bottom
+ // left corner of the scrollbar box is the scrollbar box
+ // itself (when the bar is still visible) or its filler child
+ // (when the bar is hidden). If it is still visible, we keep
+ // it enabled, if it's hidden, we disable pointer events.
+ var box = bar.getBoundingClientRect();
+ var elt = document.elementFromPoint(box.left + 1, box.bottom - 1);
+ if (elt != bar) bar.style.pointerEvents = "none";
+ else delay.set(1000, maybeDisable);
+ }
+ delay.set(1000, maybeDisable);
+ },
clear: function() {
var parent = this.horiz.parentNode;
parent.removeChild(this.horiz);
@@ -526,6 +543,7 @@
d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px";
d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px";
+ d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent"
if (sizes.right && sizes.bottom) {
d.scrollbarFiller.style.display = "block";
@@ -714,7 +732,7 @@
// width and height.
removeChildren(display.cursorDiv);
removeChildren(display.selectionDiv);
- display.gutters.style.height = 0;
+ display.gutters.style.height = display.sizer.style.minHeight = 0;
if (different) {
display.lastWrapHeight = update.wrapperHeight;
@@ -728,12 +746,9 @@
}
function postUpdateDisplay(cm, update) {
- var force = update.force, viewport = update.viewport;
+ var viewport = update.viewport;
for (var first = true;; first = false) {
- if (first && cm.options.lineWrapping && update.oldDisplayWidth != displayWidth(cm)) {
- force = true;
- } else {
- force = false;
+ if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {
// Clip forced viewport to actual scrollable area.
if (viewport && viewport.top != null)
viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)};
@@ -773,9 +788,9 @@
function setDocumentHeight(cm, measure) {
cm.display.sizer.style.minHeight = measure.docHeight + "px";
- var total = measure.docHeight + cm.display.barHeight;
- cm.display.heightForcer.style.top = total + "px";
- cm.display.gutters.style.height = Math.max(total + scrollGap(cm), measure.clientHeight) + "px";
+ cm.display.heightForcer.style.top = measure.docHeight + "px";
+ cm.display.gutters.style.height = Math.max(measure.docHeight + cm.display.barHeight + scrollGap(cm),
+ measure.clientHeight) + "px";
}
// Read the actual heights of the rendered lines, and update their
@@ -809,7 +824,7 @@
// given line.
function updateWidgetHeight(line) {
if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)
- line.widgets[i].height = line.widgets[i].node.offsetHeight;
+ line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight;
}
// Do a bulk-read of the DOM positions and sizes needed to draw the
@@ -958,12 +973,22 @@
lineView.node.removeChild(lineView.gutter);
lineView.gutter = null;
}
+ if (lineView.gutterBackground) {
+ lineView.node.removeChild(lineView.gutterBackground);
+ lineView.gutterBackground = null;
+ }
+ if (lineView.line.gutterClass) {
+ var wrap = ensureLineWrapped(lineView);
+ lineView.gutterBackground = elt("div", null, "CodeMirror-gutter-background " + lineView.line.gutterClass,
+ "left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) +
+ "px; width: " + dims.gutterTotalWidth + "px");
+ wrap.insertBefore(lineView.gutterBackground, lineView.text);
+ }
var markers = lineView.line.gutterMarkers;
if (cm.options.lineNumbers || markers) {
var wrap = ensureLineWrapped(lineView);
var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", "left: " +
- (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) +
- "px; width: " + dims.gutterTotalWidth + "px");
+ (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px");
cm.display.input.setUneditable(gutterWrap);
wrap.insertBefore(gutterWrap, lineView.text);
if (lineView.line.gutterClass)
@@ -1070,27 +1095,29 @@
if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm); }
}
- function isReadOnly(cm) {
- return cm.options.readOnly || cm.doc.cantEdit;
- }
-
// This will be set to an array of strings when copying, so that,
// when pasting, we know what kind of selections the copied text
// was made out of.
var lastCopied = null;
- function applyTextInput(cm, inserted, deleted, sel) {
+ function applyTextInput(cm, inserted, deleted, sel, origin) {
var doc = cm.doc;
cm.display.shift = false;
if (!sel) sel = doc.sel;
- var textLines = splitLines(inserted), multiPaste = null;
+ var paste = cm.state.pasteIncoming || origin == "paste";
+ var textLines = doc.splitLines(inserted), multiPaste = null;
// When pasing N lines into N selections, insert one line per selection
- if (cm.state.pasteIncoming && sel.ranges.length > 1) {
- if (lastCopied && lastCopied.join("\n") == inserted)
- multiPaste = sel.ranges.length % lastCopied.length == 0 && map(lastCopied, splitLines);
- else if (textLines.length == sel.ranges.length)
+ if (paste && sel.ranges.length > 1) {
+ if (lastCopied && lastCopied.join("\n") == inserted) {
+ if (sel.ranges.length % lastCopied.length == 0) {
+ multiPaste = [];
+ for (var i = 0; i < lastCopied.length; i++)
+ multiPaste.push(doc.splitLines(lastCopied[i]));
+ }
+ } else if (textLines.length == sel.ranges.length) {
multiPaste = map(textLines, function(l) { return [l]; });
+ }
}
// Normal behavior is to insert the new text into every selection
@@ -1100,32 +1127,18 @@
if (range.empty()) {
if (deleted && deleted > 0) // Handle deletion
from = Pos(from.line, from.ch - deleted);
- else if (cm.state.overwrite && !cm.state.pasteIncoming) // Handle overwrite
+ else if (cm.state.overwrite && !paste) // Handle overwrite
to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length));
}
var updateInput = cm.curOp.updateInput;
var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i % multiPaste.length] : textLines,
- origin: cm.state.pasteIncoming ? "paste" : cm.state.cutIncoming ? "cut" : "+input"};
+ origin: origin || (paste ? "paste" : cm.state.cutIncoming ? "cut" : "+input")};
makeChange(cm.doc, changeEvent);
signalLater(cm, "inputRead", cm, changeEvent);
- // When an 'electric' character is inserted, immediately trigger a reindent
- if (inserted && !cm.state.pasteIncoming && cm.options.electricChars &&
- cm.options.smartIndent && range.head.ch < 100 &&
- (!i || sel.ranges[i - 1].head.line != range.head.line)) {
- var mode = cm.getModeAt(range.head);
- var end = changeEnd(changeEvent);
- if (mode.electricChars) {
- for (var j = 0; j < mode.electricChars.length; j++)
- if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {
- indentLine(cm, end.line, "smart");
- break;
- }
- } else if (mode.electricInput) {
- if (mode.electricInput.test(getLine(doc, end.line).text.slice(0, end.ch)))
- indentLine(cm, end.line, "smart");
- }
- }
}
+ if (inserted && !paste)
+ triggerElectric(cm, inserted);
+
ensureCursorVisible(cm);
cm.curOp.updateInput = updateInput;
cm.curOp.typing = true;
@@ -1132,6 +1145,40 @@
cm.state.pasteIncoming = cm.state.cutIncoming = false;
}
+ function handlePaste(e, cm) {
+ var pasted = e.clipboardData && e.clipboardData.getData("text/plain");
+ if (pasted) {
+ e.preventDefault();
+ if (!cm.isReadOnly() && !cm.options.disableInput)
+ runInOp(cm, function() { applyTextInput(cm, pasted, 0, null, "paste"); });
+ return true;
+ }
+ }
+
+ function triggerElectric(cm, inserted) {
+ // When an 'electric' character is inserted, immediately trigger a reindent
+ if (!cm.options.electricChars || !cm.options.smartIndent) return;
+ var sel = cm.doc.sel;
+
+ for (var i = sel.ranges.length - 1; i >= 0; i--) {
+ var range = sel.ranges[i];
+ if (range.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range.head.line)) continue;
+ var mode = cm.getModeAt(range.head);
+ var indented = false;
+ if (mode.electricChars) {
+ for (var j = 0; j < mode.electricChars.length; j++)
+ if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {
+ indented = indentLine(cm, range.head.line, "smart");
+ break;
+ }
+ } else if (mode.electricInput) {
+ if (mode.electricInput.test(getLine(cm.doc, range.head.line).text.slice(0, range.head.ch)))
+ indented = indentLine(cm, range.head.line, "smart");
+ }
+ if (indented) signalLater(cm, "electricInput", cm, range.head.line);
+ }
+ }
+
function copyableRanges(cm) {
var text = [], ranges = [];
for (var i = 0; i < cm.doc.sel.ranges.length; i++) {
@@ -1167,6 +1214,7 @@
this.inaccurateSelection = false;
// Used to work around IE issue with selection being forgotten when focus moves away from textarea
this.hasSelection = false;
+ this.composing = null;
};
function hiddenTextarea() {
@@ -1203,26 +1251,15 @@
input.poll();
});
- on(te, "paste", function() {
- // Workaround for webkit bug https://bugs.webkit.org/show_bug.cgi?id=90206
- // Add a char to the end of textarea before paste occur so that
- // selection doesn't span to the end of textarea.
- if (webkit && !cm.state.fakedLastChar && !(new Date - cm.state.lastMiddleDown < 200)) {
- var start = te.selectionStart, end = te.selectionEnd;
- te.value += "$";
- // The selection end needs to be set before the start, otherwise there
- // can be an intermediate non-empty selection between the two, which
- // can override the middle-click paste buffer on linux and cause the
- // wrong thing to get pasted.
- te.selectionEnd = end;
- te.selectionStart = start;
- cm.state.fakedLastChar = true;
- }
+ on(te, "paste", function(e) {
+ if (signalDOMEvent(cm, e) || handlePaste(e, cm)) return
+
cm.state.pasteIncoming = true;
input.fastPoll();
});
function prepareCopyCut(e) {
+ if (signalDOMEvent(cm, e)) return
if (cm.somethingSelected()) {
lastCopied = cm.getSelections();
if (input.inaccurateSelection) {
@@ -1231,6 +1268,8 @@
te.value = lastCopied.join("\n");
selectInput(te);
}
+ } else if (!cm.options.lineWiseCopyCut) {
+ return;
} else {
var ranges = copyableRanges(cm);
lastCopied = ranges.text;
@@ -1248,7 +1287,7 @@
on(te, "copy", prepareCopyCut);
on(display.scroller, "paste", function(e) {
- if (eventInWidget(display, e)) return;
+ if (eventInWidget(display, e) || signalDOMEvent(cm, e)) return;
cm.state.pasteIncoming = true;
input.focus();
});
@@ -1257,6 +1296,22 @@
on(display.lineSpace, "selectstart", function(e) {
if (!eventInWidget(display, e)) e_preventDefault(e);
});
+
+ on(te, "compositionstart", function() {
+ var start = cm.getCursor("from");
+ if (input.composing) input.composing.range.clear()
+ input.composing = {
+ start: start,
+ range: cm.markText(start, cm.getCursor("to"), {className: "CodeMirror-composing"})
+ };
+ });
+ on(te, "compositionend", function() {
+ if (input.composing) {
+ input.poll();
+ input.composing.range.clear();
+ input.composing = null;
+ }
+ });
},
prepareSelection: function() {
@@ -1364,14 +1419,11 @@
// possible when it is clear that nothing happened. hasSelection
// will be the case when there is a lot of text in the textarea,
// in which case reading its value would be expensive.
- if (!cm.state.focused || (hasSelection(input) && !prevInput) ||
- isReadOnly(cm) || cm.options.disableInput || cm.state.keySeq)
+ if (this.contextMenuPending || !cm.state.focused ||
+ (hasSelection(input) && !prevInput && !this.composing) ||
+ cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq)
return false;
- // See paste handler for more on the fakedLastChar kludge
- if (cm.state.pasteIncoming && cm.state.fakedLastChar) {
- input.value = input.value.substring(0, input.value.length - 1);
- cm.state.fakedLastChar = false;
- }
+
var text = input.value;
// If nothing changed, bail.
if (text == prevInput && !cm.somethingSelected()) return false;
@@ -1384,8 +1436,11 @@
return false;
}
- if (text.charCodeAt(0) == 0x200b && cm.doc.sel == cm.display.selForContextMenu && !prevInput)
- prevInput = "\u200b";
+ if (cm.doc.sel == cm.display.selForContextMenu) {
+ var first = text.charCodeAt(0);
+ if (first == 0x200b && !prevInput) prevInput = "\u200b";
+ if (first == 0x21da) { this.reset(); return this.cm.execCommand("undo"); }
+ }
// Find the part of the input that is actually new
var same = 0, l = Math.min(prevInput.length, text.length);
while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) ++same;
@@ -1392,11 +1447,18 @@
var self = this;
runInOp(cm, function() {
- applyTextInput(cm, text.slice(same), prevInput.length - same);
+ applyTextInput(cm, text.slice(same), prevInput.length - same,
+ null, self.composing ? "*compose" : null);
// Don't leave long text in the textarea, since it makes further polling slow
if (text.length > 1000 || text.indexOf("\n") > -1) input.value = self.prevInput = "";
else self.prevInput = text;
+
+ if (self.composing) {
+ self.composing.range.clear();
+ self.composing.range = cm.markText(self.composing.start, cm.getCursor("to"),
+ {className: "CodeMirror-composing"});
+ }
});
return true;
},
@@ -1421,10 +1483,11 @@
if (reset && cm.doc.sel.contains(pos) == -1)
operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll);
- var oldCSS = te.style.cssText;
- input.wrapper.style.position = "absolute";
- te.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.clientY - 5) +
- "px; left: " + (e.clientX - 5) + "px; z-index: 1000; background: " +
+ var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText;
+ input.wrapper.style.cssText = "position: absolute"
+ var wrapperBox = input.wrapper.getBoundingClientRect()
+ te.style.cssText = "position: absolute; width: 30px; height: 30px; top: " + (e.clientY - wrapperBox.top - 5) +
+ "px; left: " + (e.clientX - wrapperBox.left - 5) + "px; z-index: 1000; background: " +
(ie ? "rgba(255, 255, 255, .05)" : "transparent") +
"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
if (webkit) var oldScrollY = window.scrollY; // Work around Chrome issue (#2712)
@@ -1443,7 +1506,9 @@
function prepareSelectAllHack() {
if (te.selectionStart != null) {
var selected = cm.somethingSelected();
- var extval = te.value = "\u200b" + (selected ? te.value : "");
+ var extval = "\u200b" + (selected ? te.value : "");
+ te.value = "\u21da"; // Used to catch context-menu undo
+ te.value = extval;
input.prevInput = selected ? "" : "\u200b";
te.selectionStart = 1; te.selectionEnd = extval.length;
// Re-set this, in case some other handler touched the
@@ -1453,7 +1518,7 @@
}
function rehide() {
input.contextMenuPending = false;
- input.wrapper.style.position = "relative";
+ input.wrapper.style.cssText = oldWrapperCSS
te.style.cssText = oldCSS;
if (ie && ie_version < 9) display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos);
@@ -1461,7 +1526,8 @@
if (te.selectionStart != null) {
if (!ie || (ie && ie_version < 9)) prepareSelectAllHack();
var i = 0, poll = function() {
- if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0)
+ if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 &&
+ te.selectionEnd > 0 && input.prevInput == "\u200b")
operation(cm, commands.selectAll)(cm);
else if (i++ < 10) display.detectingSelectAll = setTimeout(poll, 500);
else display.input.reset();
@@ -1483,6 +1549,10 @@
}
},
+ readOnlyChanged: function(val) {
+ if (!val) this.reset();
+ },
+
setUneditable: nothing,
needsContentAttribute: false
@@ -1501,16 +1571,11 @@
init: function(display) {
var input = this, cm = input.cm;
var div = input.div = display.lineDiv;
- div.contentEditable = "true";
disableBrowserMagic(div);
on(div, "paste", function(e) {
- var pasted = e.clipboardData && e.clipboardData.getData("text/plain");
- if (pasted) {
- e.preventDefault();
- cm.replaceSelection(pasted, null, "paste");
- }
- });
+ if (!signalDOMEvent(cm, e)) handlePaste(e, cm);
+ })
on(div, "compositionstart", function(e) {
var data = e.data;
@@ -1548,14 +1613,17 @@
on(div, "input", function() {
if (input.composing) return;
- if (!input.pollContent())
+ if (cm.isReadOnly() || !input.pollContent())
runInOp(input.cm, function() {regChange(cm);});
});
function onCopyCut(e) {
+ if (signalDOMEvent(cm, e)) return
if (cm.somethingSelected()) {
lastCopied = cm.getSelections();
if (e.type == "cut") cm.replaceSelection("", null, "cut");
+ } else if (!cm.options.lineWiseCopyCut) {
+ return;
} else {
var ranges = copyableRanges(cm);
lastCopied = ranges.text;
@@ -1626,8 +1694,13 @@
try { var rng = range(start.node, start.offset, end.offset, end.node); }
catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible
if (rng) {
- sel.removeAllRanges();
- sel.addRange(rng);
+ if (!gecko && this.cm.state.focused) {
+ sel.collapse(start.node, start.offset);
+ if (!rng.collapsed) sel.addRange(rng);
+ } else {
+ sel.removeAllRanges();
+ sel.addRange(rng);
+ }
if (old && sel.anchorNode == null) sel.addRange(old);
else if (gecko) this.startGracePeriod();
}
@@ -1721,13 +1794,13 @@
var toIndex = findViewIndex(cm, to.line);
if (toIndex == display.view.length - 1) {
var toLine = display.viewTo - 1;
- var toNode = display.view[toIndex].node;
+ var toNode = display.lineDiv.lastChild;
} else {
var toLine = lineNo(display.view[toIndex + 1].line) - 1;
var toNode = display.view[toIndex + 1].node.previousSibling;
}
- var newText = splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine));
+ var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine));
var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length));
while (newText.length > 1 && oldText.length > 1) {
if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine--; }
@@ -1771,19 +1844,26 @@
this.div.focus();
},
applyComposition: function(composing) {
- if (composing.data && composing.data != composing.startData)
+ if (this.cm.isReadOnly())
+ operation(this.cm, regChange)(this.cm)
+ else if (composing.data && composing.data != composing.startData)
operation(this.cm, applyTextInput)(this.cm, composing.data, 0, composing.sel);
},
setUneditable: function(node) {
- node.setAttribute("contenteditable", "false");
+ node.contentEditable = "false"
},
onKeyPress: function(e) {
e.preventDefault();
- operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0);
+ if (!this.cm.isReadOnly())
+ operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0);
},
+ readOnlyChanged: function(val) {
+ this.div.contentEditable = String(val != "nocursor")
+ },
+
onContextMenu: nothing,
resetPosition: nothing,
@@ -1801,7 +1881,7 @@
var partPos = getBidiPartAt(order, pos.ch);
side = partPos % 2 ? "right" : "left";
}
- var result = nodeAndOffsetInLineMap(info.map, pos.ch, "left");
+ var result = nodeAndOffsetInLineMap(info.map, pos.ch, side);
result.offset = result.collapse == "right" ? result.end : result.start;
return result;
}
@@ -1883,7 +1963,7 @@
}
function domTextBetween(cm, from, to, fromLine, toLine) {
- var text = "", closing = false;
+ var text = "", closing = false, lineSep = cm.doc.lineSeparator();
function recognizeMarker(id) { return function(marker) { return marker.id == id; }; }
function walk(node) {
if (node.nodeType == 1) {
@@ -1897,7 +1977,7 @@
if (markerID) {
var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID));
if (found.length && (range = found[0].find()))
- text += getBetween(cm.doc, range.from, range.to).join("\n");
+ text += getBetween(cm.doc, range.from, range.to).join(lineSep);
return;
}
if (node.getAttribute("contenteditable") == "false") return;
@@ -1909,7 +1989,7 @@
var val = node.nodeValue;
if (!val) return;
if (closing) {
- text += "\n";
+ text += lineSep;
closing = false;
}
text += val;
@@ -2081,7 +2161,7 @@
// Give beforeSelectionChange handlers a change to influence a
// selection update.
- function filterSelectionChange(doc, sel) {
+ function filterSelectionChange(doc, sel, options) {
var obj = {
ranges: sel.ranges,
update: function(ranges) {
@@ -2089,7 +2169,8 @@
for (var i = 0; i < ranges.length; i++)
this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
clipPos(doc, ranges[i].head));
- }
+ },
+ origin: options && options.origin
};
signal(doc, "beforeSelectionChange", doc, obj);
if (doc.cm) signal(doc.cm, "beforeSelectionChange", doc.cm, obj);
@@ -2115,7 +2196,7 @@
function setSelectionNoUndo(doc, sel, options) {
if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange"))
- sel = filterSelectionChange(doc, sel);
+ sel = filterSelectionChange(doc, sel, options);
var bias = options && options.bias ||
(cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1);
@@ -2149,8 +2230,9 @@
var out;
for (var i = 0; i < sel.ranges.length; i++) {
var range = sel.ranges[i];
- var newAnchor = skipAtomic(doc, range.anchor, bias, mayClear);
- var newHead = skipAtomic(doc, range.head, bias, mayClear);
+ var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];
+ var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);
+ var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);
if (out || newAnchor != range.anchor || newHead != range.head) {
if (!out) out = sel.ranges.slice(0, i);
out[i] = new Range(newAnchor, newHead);
@@ -2159,57 +2241,62 @@
return out ? normalizeSelection(out, sel.primIndex) : sel;
}
- // Ensure a given position is not inside an atomic range.
- function skipAtomic(doc, pos, bias, mayClear) {
- var flipped = false, curPos = pos;
- var dir = bias || 1;
- doc.cantEdit = false;
- search: for (;;) {
- var line = getLine(doc, curPos.line);
- if (line.markedSpans) {
- for (var i = 0; i < line.markedSpans.length; ++i) {
- var sp = line.markedSpans[i], m = sp.marker;
- if ((sp.from == null || (m.inclusiveLeft ? sp.from <= curPos.ch : sp.from < curPos.ch)) &&
- (sp.to == null || (m.inclusiveRight ? sp.to >= curPos.ch : sp.to > curPos.ch))) {
- if (mayClear) {
- signal(m, "beforeCursorEnter");
- if (m.explicitlyCleared) {
- if (!line.markedSpans) break;
- else {--i; continue;}
- }
- }
- if (!m.atomic) continue;
- var newPos = m.find(dir < 0 ? -1 : 1);
- if (cmp(newPos, curPos) == 0) {
- newPos.ch += dir;
- if (newPos.ch < 0) {
- if (newPos.line > doc.first) newPos = clipPos(doc, Pos(newPos.line - 1));
- else newPos = null;
- } else if (newPos.ch > line.text.length) {
- if (newPos.line < doc.first + doc.size - 1) newPos = Pos(newPos.line + 1, 0);
- else newPos = null;
- }
- if (!newPos) {
- if (flipped) {
- // Driven in a corner -- no valid cursor position found at all
- // -- try again *with* clearing, if we didn't already
- if (!mayClear) return skipAtomic(doc, pos, bias, true);
- // Otherwise, turn off editing until further notice, and return the start of the doc
- doc.cantEdit = true;
- return Pos(doc.first, 0);
- }
- flipped = true; newPos = pos; dir = -dir;
- }
- }
- curPos = newPos;
- continue search;
+ function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {
+ var line = getLine(doc, pos.line);
+ if (line.markedSpans) for (var i = 0; i < line.markedSpans.length; ++i) {
+ var sp = line.markedSpans[i], m = sp.marker;
+ if ((sp.from == null || (m.inclusiveLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&
+ (sp.to == null || (m.inclusiveRight ? sp.to >= pos.ch : sp.to > pos.ch))) {
+ if (mayClear) {
+ signal(m, "beforeCursorEnter");
+ if (m.explicitlyCleared) {
+ if (!line.markedSpans) break;
+ else {--i; continue;}
}
}
+ if (!m.atomic) continue;
+
+ if (oldPos) {
+ var near = m.find(dir < 0 ? 1 : -1), diff;
+ if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft) near = movePos(doc, near, -dir, line);
+ if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))
+ return skipAtomicInner(doc, near, pos, dir, mayClear);
+ }
+
+ var far = m.find(dir < 0 ? -1 : 1);
+ if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight) far = movePos(doc, far, dir, line);
+ return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null;
}
- return curPos;
}
+ return pos;
}
+ // Ensure a given position is not inside an atomic range.
+ function skipAtomic(doc, pos, oldPos, bias, mayClear) {
+ var dir = bias || 1;
+ var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||
+ (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||
+ skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||
+ (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true));
+ if (!found) {
+ doc.cantEdit = true;
+ return Pos(doc.first, 0);
+ }
+ return found;
+ }
+
+ function movePos(doc, pos, dir, line) {
+ if (dir < 0 && pos.ch == 0) {
+ if (pos.line > doc.first) return clipPos(doc, Pos(pos.line - 1));
+ else return null;
+ } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {
+ if (pos.line < doc.first + doc.size - 1) return Pos(pos.line + 1, 0);
+ else return null;
+ } else {
+ return new Pos(pos.line, pos.ch + dir);
+ }
+ }
+
// SELECTION DRAWING
function updateSelection(cm) {
@@ -2226,7 +2313,7 @@
var range = doc.sel.ranges[i];
var collapsed = range.empty();
if (collapsed || cm.options.showCursorWhenSelecting)
- drawSelectionCursor(cm, range, curFragment);
+ drawSelectionCursor(cm, range.head, curFragment);
if (!collapsed)
drawSelectionRange(cm, range, selFragment);
}
@@ -2234,8 +2321,8 @@
}
// Draws a cursor for the given range
- function drawSelectionCursor(cm, range, output) {
- var pos = cursorCoords(cm, range.head, "div", null, null, !cm.options.singleCursorHeightPerLine);
+ function drawSelectionCursor(cm, head, output) {
+ var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine);
var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor"));
cursor.style.left = pos.left + "px";
@@ -2359,8 +2446,8 @@
doc.iter(doc.frontier, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function(line) {
if (doc.frontier >= cm.display.viewFrom) { // Visible
- var oldStyles = line.styles;
- var highlighted = highlightLine(cm, line, state, true);
+ var oldStyles = line.styles, tooLong = line.text.length > cm.options.maxHighlightLength;
+ var highlighted = highlightLine(cm, line, tooLong ? copyState(doc.mode, state) : state, true);
line.styles = highlighted.styles;
var oldCls = line.styleClasses, newCls = highlighted.classes;
if (newCls) line.styleClasses = newCls;
@@ -2369,9 +2456,10 @@
oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass);
for (var i = 0; !ischange && i < oldStyles.length; ++i) ischange = oldStyles[i] != line.styles[i];
if (ischange) changedLines.push(doc.frontier);
- line.stateAfter = copyState(doc.mode, state);
+ line.stateAfter = tooLong ? state : copyState(doc.mode, state);
} else {
- processLine(cm, line.text, state);
+ if (line.text.length <= cm.options.maxHighlightLength)
+ processLine(cm, line.text, state);
line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null;
}
++doc.frontier;
@@ -2516,10 +2604,12 @@
function prepareMeasureForLine(cm, line) {
var lineN = lineNo(line);
var view = findViewForLine(cm, lineN);
- if (view && !view.text)
+ if (view && !view.text) {
view = null;
- else if (view && view.changes)
+ } else if (view && view.changes) {
updateLineForChanges(cm, view, lineN, getDimensions(cm));
+ cm.curOp.forceUpdate = true;
+ }
if (!view)
view = updateExternalMeasurement(cm, line);
@@ -2913,6 +3003,7 @@
updateMaxLine: false, // Set when the widest line needs to be determined anew
scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet
scrollToPos: null, // Used to scroll to a specific position
+ focus: false,
id: ++nextOpId // Unique ID
};
if (operationGroup) {
@@ -2931,12 +3022,12 @@
var callbacks = group.delayedCallbacks, i = 0;
do {
for (; i < callbacks.length; i++)
- callbacks[i]();
+ callbacks[i].call(null);
for (var j = 0; j < group.ops.length; j++) {
var op = group.ops[j];
if (op.cursorActivityHandlers)
while (op.cursorActivityCalled < op.cursorActivityHandlers.length)
- op.cursorActivityHandlers[op.cursorActivityCalled++](op.cm);
+ op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm);
}
} while (i < callbacks.length);
}
@@ -3030,6 +3121,8 @@
if (cm.state.focused && op.updateInput)
cm.display.input.reset(op.typing);
+ if (op.focus && op.focus == activeElt() && (!document.hasFocus || document.hasFocus()))
+ ensureFocus(op.cm);
}
function endOperation_finish(op) {
@@ -3048,7 +3141,7 @@
display.scroller.scrollTop = doc.scrollTop;
}
if (op.scrollLeft != null && (display.scroller.scrollLeft != op.scrollLeft || op.forceScroll)) {
- doc.scrollLeft = Math.max(0, Math.min(display.scroller.scrollWidth - displayWidth(cm), op.scrollLeft));
+ doc.scrollLeft = Math.max(0, Math.min(display.scroller.scrollWidth - display.scroller.clientWidth, op.scrollLeft));
display.scrollbars.setScrollLeft(doc.scrollLeft);
display.scroller.scrollLeft = doc.scrollLeft;
alignHorizontally(cm);
@@ -3344,7 +3437,7 @@
return dx * dx + dy * dy > 20 * 20;
}
on(d.scroller, "touchstart", function(e) {
- if (!isMouseLikeTouchEvent(e)) {
+ if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e)) {
clearTimeout(touchFinished);
var now = +new Date;
d.activeTouch = {start: now, moved: false,
@@ -3394,15 +3487,13 @@
// Prevent wrapper from ever scrolling
on(d.wrapper, "scroll", function() { d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });
- function drag_(e) {
- if (!signalDOMEvent(cm, e)) e_stop(e);
- }
- if (cm.options.dragDrop) {
- on(d.scroller, "dragstart", function(e){onDragStart(cm, e);});
- on(d.scroller, "dragenter", drag_);
- on(d.scroller, "dragover", drag_);
- on(d.scroller, "drop", operation(cm, onDrop));
- }
+ d.dragFunctions = {
+ enter: function(e) {if (!signalDOMEvent(cm, e)) e_stop(e);},
+ over: function(e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }},
+ start: function(e){onDragStart(cm, e);},
+ drop: operation(cm, onDrop),
+ leave: function() {clearDragCursor(cm);}
+ };
var inp = d.input.getField();
on(inp, "keyup", function(e) { onKeyUp.call(cm, e); });
@@ -3412,6 +3503,19 @@
on(inp, "blur", bind(onBlur, cm));
}
+ function dragDropChanged(cm, value, old) {
+ var wasOn = old && old != CodeMirror.Init;
+ if (!value != !wasOn) {
+ var funcs = cm.display.dragFunctions;
+ var toggle = value ? on : off;
+ toggle(cm.display.scroller, "dragstart", funcs.start);
+ toggle(cm.display.scroller, "dragenter", funcs.enter);
+ toggle(cm.display.scroller, "dragover", funcs.over);
+ toggle(cm.display.scroller, "dragleave", funcs.leave);
+ toggle(cm.display.scroller, "drop", funcs.drop);
+ }
+ }
+
// Called when the window resizes
function onResize(cm) {
var d = cm.display;
@@ -3462,7 +3566,7 @@
// not interfere with, such as a scrollbar or widget.
function onMouseDown(e) {
var cm = this, display = cm.display;
- if (display.activeTouch && display.input.supportsTouch() || signalDOMEvent(cm, e)) return;
+ if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) return;
display.shift = e.shiftKey;
if (eventInWidget(display, e)) {
@@ -3480,7 +3584,10 @@
switch (e_button(e)) {
case 1:
- if (start)
+ // #3261: make sure, that we're not starting a second selection
+ if (cm.state.selectingText)
+ cm.state.selectingText(e);
+ else if (start)
leftButtonDown(cm, e, start);
else if (e_target(e) == display.scroller)
e_preventDefault(e);
@@ -3501,7 +3608,7 @@
var lastClick, lastDoubleClick;
function leftButtonDown(cm, e, start) {
if (ie) setTimeout(bind(ensureFocus, cm), 0);
- else ensureFocus(cm);
+ else cm.curOp.focus = activeElt();
var now = +new Date, type;
if (lastDoubleClick && lastDoubleClick.time > now - 400 && cmp(lastDoubleClick.pos, start) == 0) {
@@ -3515,9 +3622,10 @@
}
var sel = cm.doc.sel, modifier = mac ? e.metaKey : e.ctrlKey, contained;
- if (cm.options.dragDrop && dragAndDrop && !isReadOnly(cm) &&
+ if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() &&
type == "single" && (contained = sel.contains(start)) > -1 &&
- !sel.ranges[contained].empty())
+ (cmp((contained = sel.ranges[contained]).from(), start) < 0 || start.xRel > 0) &&
+ (cmp(contained.to(), start) > 0 || start.xRel < 0))
leftButtonStartDrag(cm, e, start, modifier);
else
leftButtonSelect(cm, e, start, type, modifier);
@@ -3526,7 +3634,7 @@
// Start a text drag. When it ends, see if any dragging actually
// happen, and treat as a click if it didn't.
function leftButtonStartDrag(cm, e, start, modifier) {
- var display = cm.display;
+ var display = cm.display, startTime = +new Date;
var dragEnd = operation(cm, function(e2) {
if (webkit) display.scroller.draggable = false;
cm.state.draggingText = false;
@@ -3534,7 +3642,7 @@
off(display.scroller, "drop", dragEnd);
if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {
e_preventDefault(e2);
- if (!modifier)
+ if (!modifier && +new Date - 200 < startTime)
extendSelection(cm.doc, start);
// Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)
if (webkit || ie && ie_version == 9)
@@ -3599,7 +3707,8 @@
setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),
{scroll: false, origin: "*mouse"});
} else if (ranges.length > 1 && ranges[ourIndex].empty() && type == "single" && !e.shiftKey) {
- setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0));
+ setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),
+ {scroll: false, origin: "*mouse"});
startSel = doc.sel;
} else {
replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);
@@ -3661,7 +3770,7 @@
var cur = posFromMouse(cm, e, true, type == "rect");
if (!cur) return;
if (cmp(cur, lastPos) != 0) {
- ensureFocus(cm);
+ cm.curOp.focus = activeElt();
extendTo(cur);
var visible = visibleLines(display, doc);
if (cur.line >= visible.to || cur.line < visible.from)
@@ -3677,6 +3786,7 @@
}
function done(e) {
+ cm.state.selectingText = false;
counter = Infinity;
e_preventDefault(e);
display.input.focus();
@@ -3690,6 +3800,7 @@
else extend(e);
});
var up = operation(cm, done);
+ cm.state.selectingText = up;
on(document, "mousemove", move);
on(document, "mouseup", up);
}
@@ -3696,7 +3807,7 @@
// Determines whether an event happened in the gutter, and fires the
// handlers for the corresponding event.
- function gutterEvent(cm, e, type, prevent, signalfn) {
+ function gutterEvent(cm, e, type, prevent) {
try { var mX = e.clientX, mY = e.clientY; }
catch(e) { return false; }
if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;
@@ -3713,7 +3824,7 @@
if (g && g.getBoundingClientRect().right >= mX) {
var line = lineAtHeight(cm.doc, mY);
var gutter = cm.options.gutters[i];
- signalfn(cm, type, cm, line, gutter, e);
+ signal(cm, type, cm, line, gutter, e);
return e_defaultPrevented(e);
}
}
@@ -3720,7 +3831,7 @@
}
function clickInGutter(cm, e) {
- return gutterEvent(cm, e, "gutterClick", true, signalLater);
+ return gutterEvent(cm, e, "gutterClick", true);
}
// Kludge to work around strange IE behavior where it'll sometimes
@@ -3729,23 +3840,32 @@
function onDrop(e) {
var cm = this;
+ clearDragCursor(cm);
if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))
return;
e_preventDefault(e);
if (ie) lastDrop = +new Date;
var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;
- if (!pos || isReadOnly(cm)) return;
+ if (!pos || cm.isReadOnly()) return;
// Might be a file drop, in which case we simply extract the text
// and insert it.
if (files && files.length && window.FileReader && window.File) {
var n = files.length, text = Array(n), read = 0;
var loadFile = function(file, i) {
+ if (cm.options.allowDropFileTypes &&
+ indexOf(cm.options.allowDropFileTypes, file.type) == -1)
+ return;
+
var reader = new FileReader;
reader.onload = operation(cm, function() {
- text[i] = reader.result;
+ var content = reader.result;
+ if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) content = "";
+ text[i] = content;
if (++read == n) {
pos = clipPos(cm.doc, pos);
- var change = {from: pos, to: pos, text: splitLines(text.join("\n")), origin: "paste"};
+ var change = {from: pos, to: pos,
+ text: cm.doc.splitLines(text.join(cm.doc.lineSeparator())),
+ origin: "paste"};
makeChange(cm.doc, change);
setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change)));
}
@@ -3764,7 +3884,7 @@
try {
var text = e.dataTransfer.getData("Text");
if (text) {
- if (cm.state.draggingText && !(mac ? e.metaKey : e.ctrlKey))
+ if (cm.state.draggingText && !(mac ? e.altKey : e.ctrlKey))
var selected = cm.listSelections();
setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));
if (selected) for (var i = 0; i < selected.length; ++i)
@@ -3799,6 +3919,25 @@
}
}
+ function onDragOver(cm, e) {
+ var pos = posFromMouse(cm, e);
+ if (!pos) return;
+ var frag = document.createDocumentFragment();
+ drawSelectionCursor(cm, pos, frag);
+ if (!cm.display.dragCursor) {
+ cm.display.dragCursor = elt("div", null, "CodeMirror-cursors CodeMirror-dragcursors");
+ cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv);
+ }
+ removeChildrenAndAdd(cm.display.dragCursor, frag);
+ }
+
+ function clearDragCursor(cm) {
+ if (cm.display.dragCursor) {
+ cm.display.lineSpace.removeChild(cm.display.dragCursor);
+ cm.display.dragCursor = null;
+ }
+ }
+
// SCROLL EVENTS
// Sync the scrollable area and scrollbars, ensure the viewport
@@ -3863,8 +4002,9 @@
var display = cm.display, scroll = display.scroller;
// Quit if there's nothing to scroll here
- if (!(dx && scroll.scrollWidth > scroll.clientWidth ||
- dy && scroll.scrollHeight > scroll.clientHeight)) return;
+ var canScrollX = scroll.scrollWidth > scroll.clientWidth;
+ var canScrollY = scroll.scrollHeight > scroll.clientHeight;
+ if (!(dx && canScrollX || dy && canScrollY)) return;
// Webkit browsers on OS X abort momentum scrolls when the target
// of the scroll event is removed from the scrollable element.
@@ -3888,10 +4028,15 @@
// scrolling entirely here. It'll be slightly off from native, but
// better than glitching out.
if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {
- if (dy)
+ if (dy && canScrollY)
setScrollTop(cm, Math.max(0, Math.min(scroll.scrollTop + dy * wheelPixelsPerUnit, scroll.scrollHeight - scroll.clientHeight)));
setScrollLeft(cm, Math.max(0, Math.min(scroll.scrollLeft + dx * wheelPixelsPerUnit, scroll.scrollWidth - scroll.clientWidth)));
- e_preventDefault(e);
+ // Only prevent default scrolling if vertical scrolling is
+ // actually possible. Otherwise, it causes vertical scroll
+ // jitter on OSX trackpads when deltaX is small and deltaY
+ // is large (issue #3579)
+ if (!dy || (dy && canScrollY))
+ e_preventDefault(e);
display.wheelStartX = null; // Abort measurement, if in progress
return;
}
@@ -3940,7 +4085,7 @@
cm.display.input.ensurePolled();
var prevShift = cm.display.shift, done = false;
try {
- if (isReadOnly(cm)) cm.state.suppressEdits = true;
+ if (cm.isReadOnly()) cm.state.suppressEdits = true;
if (dropShift) cm.display.shift = false;
done = bound(cm) != Pass;
} finally {
@@ -4019,7 +4164,7 @@
var lastStoppedKey = null;
function onKeyDown(e) {
var cm = this;
- ensureFocus(cm);
+ cm.curOp.focus = activeElt();
if (signalDOMEvent(cm, e)) return;
// IE does strange things with escape.
if (ie && ie_version < 11 && e.keyCode == 27) e.returnValue = false;
@@ -4119,12 +4264,13 @@
// right-click take effect on it.
function onContextMenu(cm, e) {
if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) return;
+ if (signalDOMEvent(cm, e, "contextmenu")) return;
cm.display.input.onContextMenu(e);
}
function contextMenuInGutter(cm, e) {
if (!hasHandler(cm, "gutterContextMenu")) return false;
- return gutterEvent(cm, e, "gutterContextMenu", false, signal);
+ return gutterEvent(cm, e, "gutterContextMenu", false);
}
// UPDATING
@@ -4428,7 +4574,7 @@
function replaceRange(doc, code, from, to, origin) {
if (!to) to = from;
if (cmp(to, from) < 0) { var tmp = to; to = from; from = tmp; }
- if (typeof code == "string") code = splitLines(code);
+ if (typeof code == "string") code = doc.splitLines(code);
makeChange(doc, {from: from, to: to, text: code, origin: origin});
}
@@ -4607,6 +4753,8 @@
if (indentString != curSpaceString) {
replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input");
+ line.stateAfter = null;
+ return true;...
[truncated message content] |
|
From: <sv...@cy...> - 2016-02-26 12:45:45
|
Author: rlaucik
Date: 2016-02-26 13:45:35 +0100 (Fri, 26 Feb 2016)
New Revision: 8621
Log:
1. fixed fnc_set when trying to use undefined value (outdated rpc)
2. added EAN entity to stringlist
Modified:
trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/a910/product_edit.xbl
trunk/xuladmin/xpi-source-22/chrome/chromeFiles/locale/en-US/stringlist.ent
trunk/xuladmin/xpi-source-22/chrome/chromeFiles/locale/sk-SK/stringlist.ent
Modified: trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/a910/product_edit.xbl
===================================================================
--- trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/a910/product_edit.xbl 2016-02-25 16:32:20 UTC (rev 8620)
+++ trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/a910/product_edit.xbl 2016-02-26 12:45:35 UTC (rev 8621)
@@ -978,6 +978,12 @@
<![CDATA[
try
{
+
+ if (typeof value === 'undefined') {
+ log('[product.edit.xbl] {fnc_set} silent error: trying to set undefined value for '+variable+'. backend is probably outdated.');
+ value = "";
+ }
+
if (variable == 'status_new' || variable == 'status_special' || variable == 'status_sale' || variable == 'status_recommended' || variable == 'status_main')
{
if (value == 'Y')
@@ -988,6 +994,7 @@
document.getAnonymousElementByAttribute(this,'IDdata',variable).setAttribute('checked', 'false');
}
}
+
document.getAnonymousElementByAttribute(this,'IDdata',variable)
.value=value;
Modified: trunk/xuladmin/xpi-source-22/chrome/chromeFiles/locale/en-US/stringlist.ent
===================================================================
--- trunk/xuladmin/xpi-source-22/chrome/chromeFiles/locale/en-US/stringlist.ent 2016-02-25 16:32:20 UTC (rev 8620)
+++ trunk/xuladmin/xpi-source-22/chrome/chromeFiles/locale/en-US/stringlist.ent 2016-02-26 12:45:35 UTC (rev 8621)
@@ -544,6 +544,7 @@
<!ENTITY variable.price_currency "Currency">
<!ENTITY variable.price_without_VAT "Price (without VAT)">
<!ENTITY variable.product_number "Code">
+<!ENTITY variable.product_EAN "EAN">
<!ENTITY variable.amount "Amount">
<!ENTITY variable.amount_limit "Stop limit amount">
<!ENTITY variable.amount_order_min "Min. Order Quantity">
Modified: trunk/xuladmin/xpi-source-22/chrome/chromeFiles/locale/sk-SK/stringlist.ent
===================================================================
--- trunk/xuladmin/xpi-source-22/chrome/chromeFiles/locale/sk-SK/stringlist.ent 2016-02-25 16:32:20 UTC (rev 8620)
+++ trunk/xuladmin/xpi-source-22/chrome/chromeFiles/locale/sk-SK/stringlist.ent 2016-02-26 12:45:35 UTC (rev 8621)
@@ -545,6 +545,7 @@
<!ENTITY variable.price_currency "Mena">
<!ENTITY variable.price_without_VAT "Cena (bez DPH)">
<!ENTITY variable.product_number "Kód">
+<!ENTITY variable.product_EAN "EAN">
<!ENTITY variable.amount "Množstvo">
<!ENTITY variable.amount_limit "Stop limit množstvo">
<!ENTITY variable.amount_order_min "Minimálne v objednávke">
|
|
From: <sv...@cy...> - 2016-02-25 16:32:28
|
Author: comsultia
Date: 2016-02-25 17:32:20 +0100 (Thu, 25 Feb 2016)
New Revision: 8620
Log:
Modified:
trunk/frame/.core/.libs/TOM/Database/SQL.pm
Modified: trunk/frame/.core/.libs/TOM/Database/SQL.pm
===================================================================
--- trunk/frame/.core/.libs/TOM/Database/SQL.pm 2016-02-25 12:43:54 UTC (rev 8619)
+++ trunk/frame/.core/.libs/TOM/Database/SQL.pm 2016-02-25 16:32:20 UTC (rev 8620)
@@ -797,16 +797,16 @@
)
{
my $caller_plus;
- my ($package_, $filename_, $line_) = caller(1);
- if ($filename_)
- {
- $caller_plus.="/$package_:$filename_:$line_";
+# my ($package_, $filename_, $line_) = caller(1);
+# if ($filename_)
+# {
+# $caller_plus.="/$package_:$filename_:$line_";
# ($package_, $filename_, $line_) = caller(2);
# if ($filename_)
# {
# $caller_plus.="/$package_:$filename_:$line_";
# }
- }
+# }
main::_log($SQL_orig,{
'severity' => 3,
'facility' => 'sql',
|
Author: comsultia
Date: 2016-02-25 13:43:54 +0100 (Thu, 25 Feb 2016)
New Revision: 8619
Log:
[!][xuladmin:xul] fix for onclick events in sidebar tree (accidental action on visibility/status columns when clicking on context menu
Modified:
trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/_administration/administration_tree.xbl
trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/_content/content_tree.xbl
trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/_ecommerce/ecommerce_tree.xbl
trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/_intranet/intranet_tree.xbl
Modified: trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/_administration/administration_tree.xbl
===================================================================
--- trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/_administration/administration_tree.xbl 2016-02-25 10:08:51 UTC (rev 8618)
+++ trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/_administration/administration_tree.xbl 2016-02-25 12:43:54 UTC (rev 8619)
@@ -11,7 +11,7 @@
- <xul:popupset id="tree_popupset" hidden="false">
+ <xul:popupset id="tree_popupset" hidden="false" onclick="event.stopPropagation()">
<xul:menupopup
@@ -1085,6 +1085,8 @@
<![CDATA[
try
{
+ log("[administration_tree.xbl] {fnc_onClick}");
+
var xulNode = document.getAnonymousElementByAttribute(this,'IDanon','tree')
var row = {}, col = {}, obj = {}
xulNode.treeBoxObject.getCellAt(event.clientX, event.clientY, row, col, obj)
@@ -1565,8 +1567,9 @@
var selected=this.get_selected();
- log('[administration_tree.xbl] {fnc_status} ' + selected.addon + ' ' + selected.addon_type )
+ log('[administration_tree.xbl] {fnc_visible} ' + selected.addon + ' ' + selected.addon_type )
+
this.obj_SOAP.fnc_create(
selected.addon + '_' + selected.addon_type + '_visible',
{
Modified: trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/_content/content_tree.xbl
===================================================================
--- trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/_content/content_tree.xbl 2016-02-25 10:08:51 UTC (rev 8618)
+++ trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/_content/content_tree.xbl 2016-02-25 12:43:54 UTC (rev 8619)
@@ -11,7 +11,7 @@
- <xul:popupset id="tree_popupset" hidden="false">
+ <xul:popupset id="tree_popupset" hidden="false" onclick="event.stopPropagation()">
<!-- a460_tag_cat -->
@@ -2701,6 +2701,7 @@
<![CDATA[
try
{
+ log("[content_tree.xbl] {fnc_onClick}");
var clicked=this.get_clicked(event);
Modified: trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/_ecommerce/ecommerce_tree.xbl
===================================================================
--- trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/_ecommerce/ecommerce_tree.xbl 2016-02-25 10:08:51 UTC (rev 8618)
+++ trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/_ecommerce/ecommerce_tree.xbl 2016-02-25 12:43:54 UTC (rev 8619)
@@ -11,7 +11,7 @@
- <xul:popupset id="tree_popupset" hidden="false">
+ <xul:popupset id="tree_popupset" hidden="false" onclick="event.stopPropagation()">
<!-- a900_banner_cat -->
@@ -1368,6 +1368,8 @@
<![CDATA[
try
{
+ log("[ecommerce_tree.xbl] {fnc_onClick}");
+
var xulNode = document.getAnonymousElementByAttribute(this,'IDanon','tree')
var row = {}, col = {}, obj = {}
xulNode.treeBoxObject.getCellAt(event.clientX, event.clientY, row, col, obj)
Modified: trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/_intranet/intranet_tree.xbl
===================================================================
--- trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/_intranet/intranet_tree.xbl 2016-02-25 10:08:51 UTC (rev 8618)
+++ trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/_intranet/intranet_tree.xbl 2016-02-25 12:43:54 UTC (rev 8619)
@@ -11,7 +11,7 @@
- <xul:popupset id="tree_popupset" hidden="false">
+ <xul:popupset id="tree_popupset" hidden="false" onclick="event.stopPropagation()">
<!-- a301_contact_ask -->
@@ -1323,6 +1323,8 @@
<![CDATA[
try
{
+ log("[intranet_tree.xbl] {fnc_onClick}");
+
var xulNode = document.getAnonymousElementByAttribute(this,'IDanon','tree')
var row = {}, col = {}, obj = {}
xulNode.treeBoxObject.getCellAt(event.clientX, event.clientY, row, col, obj)
|
|
From: <sv...@cy...> - 2016-02-25 10:09:02
|
Author: comsultia
Date: 2016-02-25 11:08:51 +0100 (Thu, 25 Feb 2016)
New Revision: 8618
Log:
Modified:
trunk/frame/.core/.libs/Tomahawk.pm
Modified: trunk/frame/.core/.libs/Tomahawk.pm
===================================================================
--- trunk/frame/.core/.libs/Tomahawk.pm 2016-02-24 15:46:21 UTC (rev 8617)
+++ trunk/frame/.core/.libs/Tomahawk.pm 2016-02-25 10:08:51 UTC (rev 8618)
@@ -1108,7 +1108,7 @@
$smdl_env{'-xlng'}=$tom::lng unless $smdl_env{'-xlng'};
# main::_log("adding supermodule ".$smdl_env{-category}."-".$smdl_env{-name}."/".$smdl_env{-version}."/".$smdl_env{-global});
- my $t=track TOM::Debug("supermodule",'attrs'=>$smdl_env{-category}."-".$smdl_env{-name},'timer'=>1);
+ my $t=track TOM::Debug("supermodule",'attrs'=>$smdl_env{-addon}."-".$smdl_env{-name}.'.'.$smdl_env{'-version'},'timer'=>1);
foreach (sort keys %smdl_env)
{
|
|
From: <sv...@cy...> - 2016-02-24 15:46:28
|
Author: comsultia
Date: 2016-02-24 16:46:21 +0100 (Wed, 24 Feb 2016)
New Revision: 8617
Log:
added product EAN code, view and update
Modified:
trunk/xuladmin/docroot/_addons/App/910/_mdl/910-product_cat_list.0.mdl
trunk/xuladmin/docroot/_addons/App/910/_mdl/910-product_cat_list.0.soap.xsgn
trunk/xuladmin/docroot/_addons/App/910/_mdl/910-product_update.0.mdl
trunk/xuladmin/docroot/_addons/App/910/_mdl/910-product_view.lite.mdl
trunk/xuladmin/docroot/_addons/App/910/_mdl/910-product_view.lite.soap.xsgn
Modified: trunk/xuladmin/docroot/_addons/App/910/_mdl/910-product_cat_list.0.mdl
===================================================================
--- trunk/xuladmin/docroot/_addons/App/910/_mdl/910-product_cat_list.0.mdl 2016-02-24 15:45:21 UTC (rev 8616)
+++ trunk/xuladmin/docroot/_addons/App/910/_mdl/910-product_cat_list.0.mdl 2016-02-24 15:46:21 UTC (rev 8617)
@@ -411,6 +411,7 @@
product.amount_unit,
product.amount_availability,
product.product_number,
+ product.EAN,
product.metadata,
product.status_new,
Modified: trunk/xuladmin/docroot/_addons/App/910/_mdl/910-product_cat_list.0.soap.xsgn
===================================================================
--- trunk/xuladmin/docroot/_addons/App/910/_mdl/910-product_cat_list.0.soap.xsgn 2016-02-24 15:45:21 UTC (rev 8616)
+++ trunk/xuladmin/docroot/_addons/App/910/_mdl/910-product_cat_list.0.soap.xsgn 2016-02-24 15:46:21 UTC (rev 8617)
@@ -18,6 +18,7 @@
<ID_entity><![CDATA[<%ID_entity%>]]></ID_entity>
<ico><![CDATA[<%ico%>]]></ico>
<product_number><![CDATA[<%db_product_number%>]]></product_number>
+ <EAN><![CDATA[<%db_EAN%>]]></EAN>
<IDparent><![CDATA[<%ID_parent%>]]></IDparent>
<name write="<%name_write%>" _array="true"><![CDATA[<%db_name%>]]></name>
<name_url><![CDATA[<%db_name_url%>]]></name_url>
Modified: trunk/xuladmin/docroot/_addons/App/910/_mdl/910-product_update.0.mdl
===================================================================
--- trunk/xuladmin/docroot/_addons/App/910/_mdl/910-product_update.0.mdl 2016-02-24 15:45:21 UTC (rev 8616)
+++ trunk/xuladmin/docroot/_addons/App/910/_mdl/910-product_update.0.mdl 2016-02-24 15:46:21 UTC (rev 8617)
@@ -166,8 +166,9 @@
}
if ($new_supplier_person) {$columns{'product.supplier_person'}=$new_supplier_person; }
+ $columns{'product.EAN'}=$main::RPC->{'product.EAN'}
+ if exists $main::RPC->{'product.EAN'};
-
$columns{'product_ent.VAT'}=$main::RPC->{'product_ent.VAT'}
if exists $main::RPC->{'product_ent.VAT'};
Modified: trunk/xuladmin/docroot/_addons/App/910/_mdl/910-product_view.lite.mdl
===================================================================
--- trunk/xuladmin/docroot/_addons/App/910/_mdl/910-product_view.lite.mdl 2016-02-24 15:45:21 UTC (rev 8616)
+++ trunk/xuladmin/docroot/_addons/App/910/_mdl/910-product_view.lite.mdl 2016-02-24 15:46:21 UTC (rev 8617)
@@ -38,6 +38,7 @@
product.amount_order_max,
product.amount_order_div,
product.product_number,
+ product.EAN,
product.metadata,
product.supplier_org,
Modified: trunk/xuladmin/docroot/_addons/App/910/_mdl/910-product_view.lite.soap.xsgn
===================================================================
--- trunk/xuladmin/docroot/_addons/App/910/_mdl/910-product_view.lite.soap.xsgn 2016-02-24 15:45:21 UTC (rev 8616)
+++ trunk/xuladmin/docroot/_addons/App/910/_mdl/910-product_view.lite.soap.xsgn 2016-02-24 15:46:21 UTC (rev 8617)
@@ -12,6 +12,8 @@
<product_number><![CDATA[<%db_product_number%>]]></product_number>
+ <EAN><![CDATA[<%db_EAN%>]]></EAN>
+
<price><![CDATA[<%db_price%>]]></price>
<price_previous><![CDATA[<%db_price_previous%>]]></price_previous>
<price_max><![CDATA[<%db_price_max%>]]></price_max>
|
|
From: <sv...@cy...> - 2016-02-24 15:45:34
|
Author: rlaucik
Date: 2016-02-24 16:45:21 +0100 (Wed, 24 Feb 2016)
New Revision: 8616
Log:
added product EAN code into edit and listing
Modified:
trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/a910/product_cat_list.xbl
trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/a910/product_edit.xbl
Modified: trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/a910/product_cat_list.xbl
===================================================================
--- trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/a910/product_cat_list.xbl 2016-02-23 16:47:49 UTC (rev 8615)
+++ trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/a910/product_cat_list.xbl 2016-02-24 15:45:21 UTC (rev 8616)
@@ -722,6 +722,14 @@
_onclick="document.getBindingParent(this).fnc_sort(this)"
hidden="false"
persist="hidden ordinal"/>
+
+ <xul:treecol
+ id="list_col-EAN" IDanon="list_col-EAN"
+ width="100px"
+ label="&variable.product_EAN;"
+ _onclick="document.getBindingParent(this).fnc_sort(this)"
+ hidden="true"
+ persist="hidden ordinal"/>
<xul:treecol
Modified: trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/a910/product_edit.xbl
===================================================================
--- trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/a910/product_edit.xbl 2016-02-23 16:47:49 UTC (rev 8615)
+++ trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/a910/product_edit.xbl 2016-02-24 15:45:21 UTC (rev 8616)
@@ -186,9 +186,17 @@
</xul:hbox>
<xul:hbox flex="1" align="center">
<xul:textbox style="font-family:monospace;text-align:right;" maxlength="20" size="20" IDdata="product_number" value=""/>
-
</xul:hbox>
</xul:row>
+
+ <xul:row align="center">
+ <xul:hbox flex="1" align="center">
+ <xul:label class="bold" value="&variable.product_EAN;:"/>
+ </xul:hbox>
+ <xul:hbox flex="1" align="center">
+ <xul:textbox style="font-family:monospace;text-align:right;" maxlength="20" size="20" IDdata="EAN" value=""/>
+ </xul:hbox>
+ </xul:row>
<xul:row align="center">
<xul:hbox flex="1" align="center">
@@ -859,6 +867,7 @@
this.fnc_set('name_label',body.response.name_label);
this.fnc_set('keywords',body.response.keywords);
this.fnc_set('product_number',body.response.product_number);
+ this.fnc_set('EAN',body.response.EAN);
this.fnc_set('price',body.response.price);
this.fnc_set('price_previous',body.response.price_previous);
this.fnc_set('VAT',body.response.VAT);
@@ -1226,6 +1235,7 @@
'product.ID': this.load_param.ID,
'product.ID_entity': this.load_param.ID_entity,
'product.product_number': this.fnc_get('product_number'),
+ 'product.EAN': this.fnc_get('EAN'),
'product.price': this.fnc_get('price'),
'product.price_previous': this.fnc_get('price_previous'),
'product.price_max': this.fnc_get('price_max'),
|
|
From: <sv...@cy...> - 2016-02-23 16:47:57
|
Author: comsultia
Date: 2016-02-23 17:47:49 +0100 (Tue, 23 Feb 2016)
New Revision: 8615
Log:
[!][xuladmin:xul] fix for type reload
Modified:
trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/a210/page_edit.xbl
Modified: trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/a210/page_edit.xbl
===================================================================
--- trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/a210/page_edit.xbl 2016-02-23 16:02:57 UTC (rev 8614)
+++ trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/a210/page_edit.xbl 2016-02-23 16:47:49 UTC (rev 8615)
@@ -237,7 +237,7 @@
this.fnc_init();
- }catch(e){alert('[page_edit.xbl] {} '+e)}
+ }catch(e){alert('[page_edit.xbl] {constructor} '+e)}
]]>
</constructor>
@@ -263,7 +263,7 @@
- }catch(e){alert('[page_edit.xbl] {} '+e)}
+ }catch(e){alert('[page_edit.xbl] {fnc_init} '+e)}
]]>
</body>
</method>
@@ -443,7 +443,7 @@
}
}
- }catch(e){alert('[page_edit.xbl] {} '+e)}
+ }catch(e){alert('[page_edit.xbl] {fnc_onSOAPLoad} '+e)}
]]>
</body>
</method>
@@ -719,7 +719,7 @@
return true
- }catch(e){alert('[page_edit.xbl] fnc_attachTreeview ' + e)}
+ }catch(e){alert('[page_edit.xbl] {fnc_attachTreeview} ' + e)}
]]>
</body>
</method>
@@ -748,7 +748,7 @@
// this.load_param
// )
- }catch(e){alert('[page_edit.xbl] {} '+e)}
+ }catch(e){alert('[page_edit.xbl] {fnc_reload} '+e)}
]]>
</body>
</method>
@@ -759,15 +759,17 @@
<![CDATA[
try
{
- this.only_type = 1;
- document.getAnonymousElementByAttribute(this,'IDanon','TypeID_list_refresh').setAttribute('src','chrome://c3xuladmin/skin/icons/16x16/load.gif');
+ var tthis = document.getBindingParent(this);
- this.obj_SOAP.fnc_create(
- 'a170_type_list',
- {}
+ tthis.only_type = 1;
+ document.getAnonymousElementByAttribute(tthis,'IDanon','TypeID_list_refresh').setAttribute('src','chrome://c3xuladmin/skin/icons/16x16/load.gif');
+
+ tthis.obj_SOAP.fnc_create(
+ 'a170_type_list',
+ {}
);
- }catch(e){alert('[page_edit.xbl] {} '+e)}
+ }catch(e){alert('[page_edit.xbl] {fnc_reloadType} '+e)}
]]>
</body>
</method>
@@ -793,7 +795,7 @@
document.getAnonymousElementByAttribute(tthis,'IDanon','infobox')
.setAttribute('collapsed',false)
- }catch(e){alert('[page_edit.xbl] {} '+e)}
+ }catch(e){alert('[page_edit.xbl] {fnc_create} '+e)}
]]>
</body>
</method>
@@ -869,7 +871,7 @@
// this is for renaming, it should be included into previous request in the future
// var new_name = document.getAnonymousElementByAttribute(this,'IDdata','name').value
- }catch(e){alert('[page_edit.xbl] {} '+e)}
+ }catch(e){alert('[page_edit.xbl] {fnc_save} '+e)}
]]>
</body>
</method>
@@ -1458,7 +1460,7 @@
}
- }catch(e){alert('[page_edit.xbl] {} '+e)}
+ }catch(e){alert('[page_edit.xbl] {fnc_listTreecellClick} '+e)}
]]>
</body>
</method>
@@ -1510,7 +1512,7 @@
}
}
- }catch(e){alert('[page_edit.xbl] {} '+e)}
+ }catch(e){alert('[page_edit.xbl] {fnc_listTreecellDblClick} '+e)}
]]>
</body>
</method>
@@ -1623,7 +1625,7 @@
false
)
- }catch(e){alert('[page_edit.xbl] {} '+e)}
+ }catch(e){alert('[page_edit.xbl] {fnc_type_list} '+e)}
]]>
</body>
</method>
@@ -1661,7 +1663,7 @@
}
}
- }catch(e){alert('[page_edit.xbl] {} '+e)}
+ }catch(e){alert('[page_edit.xbl] {fnc_editItem} '+e)}
]]>
</body>
</method>
@@ -1674,7 +1676,7 @@
{
this.selectedIndex = 0
- }catch(e){alert('[page_edit.xbl] {} '+e)}
+ }catch(e){alert('[page_edit.xbl] {fnc_deselect_type} '+e)}
]]>
</body>
</method>
@@ -1700,7 +1702,7 @@
popup_element.openPopup(null, "", event.clientX,event.clientY, true, false);
}
}
- }catch(e){alert('[page_edit.xbl] {} '+e)}
+ }catch(e){alert('[page_edit.xbl] {fnc_tree_onClick} '+e)}
]]>
</body>
</method>
@@ -1725,7 +1727,7 @@
}
}
- }catch(e){alert('[page_edit.xbl] {} '+e)}
+ }catch(e){alert('[page_edit.xbl] {fnc_tree_onKeyPress} '+e)}
]]>
</body>
</method>
@@ -1740,7 +1742,7 @@
gClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components.interfaces.nsIClipboardHelper); gClipboardHelper.copyString(sel.value);
- }catch(e){alert('[page_edit.xbl] {} '+e)}
+ }catch(e){alert('[page_edit.xbl] {fnc_copy} '+e)}
]]>
</body>
</method>
@@ -1772,7 +1774,7 @@
listXulNode.view.setCellValue(sel.index, col_value, pastetext);
- }catch(e){alert('[page_edit.xbl] {} '+e)}
+ }catch(e){alert('[page_edit.xbl] {fnc_paste} '+e)}
]]>
</body>
</method>
@@ -1818,7 +1820,7 @@
return selected;
- }catch(e){alert('[page_edit.xbl] {} '+e)}
+ }catch(e){alert('[page_edit.xbl] {get_selected} '+e)}
]]>
</body>
</method>
@@ -1842,7 +1844,7 @@
document.getAnonymousElementByAttribute(tthis,'IDanon','img_status')
.setAttribute('src','chrome://c3xuladmin/skin/icons/switches/status_Y.png');
}
- }catch(e){alert('[page_edit.xbl] {} '+e)}
+ }catch(e){alert('[page_edit.xbl] {fnc_switch_status} '+e)}
]]>
</body>
</method>
@@ -1866,7 +1868,7 @@
document.getAnonymousElementByAttribute(tthis,'IDanon','img_visible')
.setAttribute('src','chrome://c3xuladmin/skin/icons/switches/visible_Y.png');
}
- }catch(e){alert('[page_edit.xbl] {} '+e)}
+ }catch(e){alert('[page_edit.xbl] {fnc_switch_visible} '+e)}
]]>
</body>
</method>
|
|
From: <sv...@cy...> - 2016-02-23 16:03:05
|
Author: comsultia
Date: 2016-02-23 17:02:57 +0100 (Tue, 23 Feb 2016)
New Revision: 8614
Log:
Modified:
trunk/frame/.core/job.workerd
Modified: trunk/frame/.core/job.workerd
===================================================================
--- trunk/frame/.core/job.workerd 2016-02-23 16:02:13 UTC (rev 8613)
+++ trunk/frame/.core/job.workerd 2016-02-23 16:02:57 UTC (rev 8614)
@@ -135,8 +135,8 @@
$ENV{'WORKERS'}=1 unless exists $ENV{'WORKERS'}; # spawning workers?
$ENV{'AUTORESTART'}=1 unless exists $ENV{'AUTORESTART'}; # spawning workers?
$TOM::job_domain_max_workers||=16; # max X workers parallel on same domain
-$TOM::job_worker_start_delay||=5; # start next worker after delay
-$TOM::job_domain_worker_start_delay||=10; # start next worker after delay on same domain
+$TOM::job_worker_start_delay||=1; # start next worker after delay
+$TOM::job_domain_worker_start_delay||=5; # start next worker after delay on same domain
# $MAX_WORKERS = 2;
|
|
From: <sv...@cy...> - 2016-02-23 16:02:22
|
Author: comsultia
Date: 2016-02-23 17:02:13 +0100 (Tue, 23 Feb 2016)
New Revision: 8613
Log:
Modified:
trunk/frame/.core/job.workerd
Modified: trunk/frame/.core/job.workerd
===================================================================
--- trunk/frame/.core/job.workerd 2016-02-23 14:13:39 UTC (rev 8612)
+++ trunk/frame/.core/job.workerd 2016-02-23 16:02:13 UTC (rev 8613)
@@ -78,7 +78,7 @@
my $loadstat = $loadinfo->get;
main::_log_stdout("running on host with ".$sysstat->{'tcpucount'}." CPU cores PID $$",3,"job.workerd");# if $ENV{'WORKERS'};
-our $MAX_LOAD=($sysstat->{'tcpucount'} * 3);
+our $MAX_LOAD=($sysstat->{'tcpucount'} * 4);
main::_log_stdout("max load $MAX_LOAD",3,"job.workerd");# if $ENV{'WORKERS'};
main::_log_stdout("declaring default job exchange, queue, binding",3,"job.workerd");
@@ -131,7 +131,7 @@
}
our $WORKERS = get_workers();
-my $MAX_WORKERS = $TOM::job_host_max_processes || ($sysstat->{'tcpucount'} * 2) +1;
+my $MAX_WORKERS = $TOM::job_host_max_processes || ($sysstat->{'tcpucount'} * 4) +1;
$ENV{'WORKERS'}=1 unless exists $ENV{'WORKERS'}; # spawning workers?
$ENV{'AUTORESTART'}=1 unless exists $ENV{'AUTORESTART'}; # spawning workers?
$TOM::job_domain_max_workers||=16; # max X workers parallel on same domain
@@ -305,6 +305,17 @@
}
last if $WORKERS >= $MAX_WORKERS;
+
+ # check consumers
+ my $t = new Proc::ProcessTable;
+ if ($class && $domain)
+ {
+ my $workers_local=(scalar (grep {$_->{'cmndline'}=~/^c3\-job\.worker \[$domain\] :$class /;} @{$t->table}))-1;
+ $queue->{'consumers'} = $workers_local
+ if $workers_local > $queue->{'consumers'};
+ main::_log_stdout("real local consumers=".$queue->{'consumers'}." in domain=$domain class=$class",3,"job.workerd");
+ }
+
if ($class && exists $TOM::job_class_max_workers{$class})
{
next if $TOM::job_class_max_workers{$class} <= $queue->{'consumers'};
@@ -315,6 +326,7 @@
if ($queue->{'messages_ready'}) # !$queue->{'consumers'} &&
{
main::_log_stdout("starting new worker for '$domain$class_'",3,"job.workerd");
+
$domain_worker{$domain.$class_}{'request_time'}=time();
# $domain_worker{$domain.$class_}{'count'}++;
@@ -360,22 +372,8 @@
my $ttime=$seconds.'.'.$microseconds;
# main::_log("insert master $ttime");
$Redis->set('C3|db_main|modified',$ttime,sub{});
- $Redis->expire('C3|db_main|modified',10,sub {});
- TOM::Database::SQL::execute(qq{
- REPLACE INTO
- TOM.a100_master
- (
- ID,
- datetime_create,
- timestamp
- )
- VALUES
- (
- 1,
- FROM_UNIXTIME($ttime),
- $ttime
- )
- },'quiet'=>1);
+ $Redis->expire('C3|db_main|modified',86400,sub {});
+ TOM::Database::SQL::execute(qq{REPLACE INTO TOM.a100_master (ID,datetime_create,timestamp) VALUES (1,FROM_UNIXTIME($ttime),$ttime)},'quiet'=>1);
}
my $w=AnyEvent->timer(after => 60, interval => 30, cb => \&check_domains);
|
|
From: <sv...@cy...> - 2016-02-23 14:13:47
|
Author: rlaucik
Date: 2016-02-23 15:13:39 +0100 (Tue, 23 Feb 2016)
New Revision: 8612
Log:
added sorting by datetime order
Modified:
trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/a920/order_product_list.xbl
Modified: trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/a920/order_product_list.xbl
===================================================================
--- trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/a920/order_product_list.xbl 2016-02-23 14:12:25 UTC (rev 8611)
+++ trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/a920/order_product_list.xbl 2016-02-23 14:13:39 UTC (rev 8612)
@@ -749,7 +749,7 @@
tthis.load_param = {order_by: 'ID_entity DESC'}
tthis.load_param.limit=50;
- tthis.order_by = ['ID_entity']
+ tthis.order_by = ['ID','ID_entity','datetime_order'];
document.getAnonymousElementByAttribute(tthis, 'IDanon', 'list').addEventListener('click', function(evt){ tthis.fnc_tree_onClick(tthis, evt) }, false);
|
|
From: <sv...@cy...> - 2016-02-23 14:12:38
|
Author: comsultia
Date: 2016-02-23 15:12:25 +0100 (Tue, 23 Feb 2016)
New Revision: 8611
Log:
added search in product names, ability to display order_product names instead of product_lng
Modified:
trunk/xuladmin/docroot/_addons/App/920/_mdl/920-order_product.list.mdl
Modified: trunk/xuladmin/docroot/_addons/App/920/_mdl/920-order_product.list.mdl
===================================================================
--- trunk/xuladmin/docroot/_addons/App/920/_mdl/920-order_product.list.mdl 2016-02-22 15:37:19 UTC (rev 8610)
+++ trunk/xuladmin/docroot/_addons/App/920/_mdl/920-order_product.list.mdl 2016-02-23 14:12:25 UTC (rev 8611)
@@ -19,7 +19,7 @@
main::_log("req=".Dumper($main::RPC));
my @bind;
- my $sql_order='a920_order_product.ID DESC';
+ my $sql_order=$main::RPC->{'order_by'} || 'a920_order.datetime_order DESC';
my $sql_status="IN ('".(join("','", split('',$main::RPC->{'status'} || 'YNWL') ))."')";
my $sql_limit=($main::RPC->{'offset'} || 0).','.$main::RPC->{'limit'};
my $sql_where;
@@ -26,9 +26,11 @@
my $sql_collumn;
my $sql_join;
- if ($main::RPC->{'keywords'})
+ if ($main::RPC->{'keywords'} =~ /^\d+$/)
{
-# $sql_where.=" AND a920_order.ID_entity LIKE '".$main::RPC->{'keywords'}."%'";
+ $sql_where.=" AND (a920_order.ID_entity LIKE '".$main::RPC->{'keywords'}."%' OR a920_order_product.name LIKE '[".$main::RPC->{'keywords'}."%')";
+ } elsif ($main::RPC->{'keywords'}) {
+ $sql_where.=" AND a920_order_product.name LIKE '%".$main::RPC->{'keywords'}."%'";
}
if (ref($main::RPC->{'sql_where_filter'}) eq "ARRAY")
@@ -87,8 +89,10 @@
(
a910_product.supplier_org = a710_org.ID_entity
)};
- $sql_collumn=qq{,a910_product_lng.name,
- a710_org.name AS supplier_name,
+ # use name from a920_order_product instead of a910_product_lng
+ $sql_collumn=",a910_product_lng.name" unless $App::920::order_product_name eq 'order_product';
+ $sql_collumn.=qq{
+ ,a710_org.name AS supplier_name,
a710_org.ID_entity AS org_ID_entity,
a710_org.ID AS org_ID
};
@@ -134,7 +138,6 @@
%{$db0_line{'user'}} = App::301::authors::get_author($db0_line{'ID_user'})
if $db0_line{'ID_user'};
-
if ($db0_line{'ID_org'})
{
use App::710::_init;
|
|
From: <sv...@cy...> - 2016-02-22 15:37:26
|
Author: comsultia
Date: 2016-02-22 16:37:19 +0100 (Mon, 22 Feb 2016)
New Revision: 8610
Log:
Modified:
trunk/frame/_addons/Ext/Elastic/_mdl/eElastic-rlog_clean.job
Modified: trunk/frame/_addons/Ext/Elastic/_mdl/eElastic-rlog_clean.job
===================================================================
--- trunk/frame/_addons/Ext/Elastic/_mdl/eElastic-rlog_clean.job 2016-02-22 15:33:10 UTC (rev 8609)
+++ trunk/frame/_addons/Ext/Elastic/_mdl/eElastic-rlog_clean.job 2016-02-22 15:37:19 UTC (rev 8610)
@@ -74,7 +74,7 @@
if ($tom::Thour >= 18 || $tom::Thour <= 6) # do it only when developers sleep
{
# main::_log("'$indice' $old days " . ($TOM::DEBUG_log_type{'pub'}{'max_days'}+3));
- if ($Ext::Elastic_rlog->{'_manage'} && ($old > ($TOM::DEBUG_log_type{'pub'}{'max_days'}+3)) && $indice=~/\d\d\d\d\-\d\d\-\d\d$/)
+ if ($Ext::Elastic_rlog->{'_manage'} && ($old > ($TOM::DEBUG_log_type{'pub'}{'max_days'} + 14)) && $indice=~/\d\d\d\d\-\d\d\-\d\d$/)
{
my $indice_new=$indice;
$indice_new=~s/\-\d\d$//;
@@ -93,7 +93,7 @@
'on_success' => sub {
my ($action,$response) = @_;
$i++;
- main::_log(" reindex [$i]") if ($i/10000 == int($i/10000));
+ main::_log(" reindex [$i]") if ($i/100000 == int($i/100000));
$bulk_delete->delete({'id' => $response->{'_id'}});
},
);
@@ -107,6 +107,10 @@
}
);
};
+ if ($@)
+ {
+ main::_log("error in reindex ".$@,1);
+ }
$bulk->flush();
$bulk_delete->flush();
@@ -158,7 +162,7 @@
if ($max_days <= $old)
{
- main::_log(" remove older than $max_days days");
+ main::_log(" remove older than $max_days days 1");
my $bulk_delete = $Elastic->bulk_helper(
'index' => $indice,
|
|
From: <sv...@cy...> - 2016-02-22 15:33:17
|
Author: comsultia
Date: 2016-02-22 16:33:10 +0100 (Mon, 22 Feb 2016)
New Revision: 8609
Log:
Modified:
trunk/frame/_addons/Ext/Elastic/_mdl/eElastic-rlog_clean.job
Modified: trunk/frame/_addons/Ext/Elastic/_mdl/eElastic-rlog_clean.job
===================================================================
--- trunk/frame/_addons/Ext/Elastic/_mdl/eElastic-rlog_clean.job 2016-02-22 15:32:51 UTC (rev 8608)
+++ trunk/frame/_addons/Ext/Elastic/_mdl/eElastic-rlog_clean.job 2016-02-22 15:33:10 UTC (rev 8609)
@@ -15,7 +15,7 @@
my $env=$self->env;
return if $self->running({'max'=>(3600+600)}); # check if not already running
- alarm 3600;
+ alarm 3500;
if (!$Ext::Elastic_rlog && !$Ext::Elastic)
{
|
|
From: <sv...@cy...> - 2016-02-22 15:33:03
|
Author: comsultia
Date: 2016-02-22 16:32:51 +0100 (Mon, 22 Feb 2016)
New Revision: 8608
Log:
Modified:
trunk/frame/_addons/Ext/Elastic/_mdl/eElastic-rlog_clean.job
Modified: trunk/frame/_addons/Ext/Elastic/_mdl/eElastic-rlog_clean.job
===================================================================
--- trunk/frame/_addons/Ext/Elastic/_mdl/eElastic-rlog_clean.job 2016-02-19 09:01:04 UTC (rev 8607)
+++ trunk/frame/_addons/Ext/Elastic/_mdl/eElastic-rlog_clean.job 2016-02-22 15:32:51 UTC (rev 8608)
@@ -13,8 +13,10 @@
{
my $self=shift;
my $env=$self->env;
- return if $self->running({'max'=>(3600*12)}); # check if not already running
+ return if $self->running({'max'=>(3600+600)}); # check if not already running
+ alarm 3600;
+
if (!$Ext::Elastic_rlog && !$Ext::Elastic)
{
return 1;
|
|
From: <sv...@cy...> - 2016-02-19 09:01:14
|
Author: comsultia
Date: 2016-02-19 10:01:04 +0100 (Fri, 19 Feb 2016)
New Revision: 8607
Log:
Added:
trunk/frame/.bin/c3-sass
Added: trunk/frame/.bin/c3-sass
===================================================================
--- trunk/frame/.bin/c3-sass (rev 0)
+++ trunk/frame/.bin/c3-sass 2016-02-19 09:01:04 UTC (rev 8607)
@@ -0,0 +1,155 @@
+#!/usr/bin/perl
+use open ':utf8', ':std';
+use if $] < 5.018, 'encoding','utf8';
+use utf8;
+use Data::Dumper;
+use Term::ANSIColor;
+use DateTime;
+
+BEGIN
+{
+ $TOM::engine='cli';
+ $main::debug=1 if $ENV{'CYCLONE3DEBUG'};
+# $main::stdout=0 unless $ENV{'CYCLONE3DEBUG'};
+ if (!$ENV{'CYCLONE3PATH'})
+ {
+ $ENV{'CYCLONE3PATH'}="/www/TOM" if -d "/www/TOM"; # obsolete
+ $ENV{'CYCLONE3PATH'}="/Cyclone3" if -d "/Cyclone3";
+ $ENV{'CYCLONE3PATH'}="/srv/Cyclone3" if -d "/srv/Cyclone3";
+ }
+}
+END {use Inline;$SIG{__WARN__} = sub {};}
+
+our $argv=join " ",@ARGV;
+
+our $job_file;
+if ($ARGV[0] && not($ARGV[0]=~/^\-/)) # direct link to job file
+{
+ $job_file=$ARGV[0];
+ delete $ARGV[0];
+}
+
+our %arg;
+foreach my $key(@ARGV)
+{
+ $key=~s/^\-\-// && do
+ {
+ my @ref=split('=',$key,2);
+ $ref[1]=1 unless exists $ref[1];
+ if (ref($main::arg{$ref[0]}) eq "ARRAY")
+ {
+ push @{$main::arg{$ref[0]}},$ref[1];
+ }
+ elsif ($main::arg{$ref[0]})
+ {
+ my $oldval=$main::arg{$ref[0]};
+ delete $main::arg{$ref[0]};
+ $main::arg{$ref[0]}=[
+ $oldval,
+ $ref[1]
+ ];
+ }
+ else
+ {
+ $main::arg{$ref[0]}=$ref[1];
+ }
+ next;
+ };
+ $key=~s/^\-// && do
+ {
+ foreach (split('',$key)){$main::arg{$_}++;}
+ };
+}
+
+
+if ($main::arg{'v'} >= 2)
+{
+# $main::stdout=1;
+ $main::debug=1;# if ($main::arg{'v'} >= 2);
+# delete $main::arg{'v'};
+}
+
+if ($main::arg{'domain'})
+{
+ $main::arg{'domain'}=~s|^www\.||i;
+ $main::h=$main::arg{'domain'};$main::h=~s|\.|_|g;$main::h=~s|/|__|g;
+
+ my $path=$main::arg{'domain'};$path=~s|^(.[^/]*)(.*)||;
+ my $path_dom=$1;my $path_sub=$2;
+ $path_dom=~s|(.*\.\|)(.*?\..*?)$|$1|;
+ $tom::p="!$2";$path_dom=~s|\.$||;
+
+ foreach (reverse split('\.',$path_dom)){$tom::p.="/!$_";}
+ foreach (split('/',$path_sub)){$tom::p.="/$_";}
+
+ $tom::p=~s|//|/|g;
+ $tom::p=$ENV{'CYCLONE3PATH'}."/".$tom::p;
+
+ $tom::P=$tom::p;
+ delete $main::arg{'domain'};
+}
+
+require $ENV{'CYCLONE3PATH'}."/.core/.libs/TOM.pm";
+require TOM::Engine::job;
+$0.=" ".$argv if $argv;
+use open ':utf8', ':std';
+use if $] < 5.018, 'encoding','utf8';
+use utf8;
+use strict;
+use vars qw//;
+
+package main;
+use open ':utf8', ':std';
+use if $] < 5.018, 'encoding','utf8';
+use utf8;
+use strict;
+use Cwd 'abs_path';
+
+$TOM::engine_ready=1;
+
+print color 'reset';
+
+if (!keys %main::arg)
+{
+ print qq{Cyclone3 SASS processor
+Usage: c3-sass [options]
+
+Basic options:
+ --c=<compile> compile
+
+};
+ exit;
+}
+
+
+require CSS::Sass;
+
+if ($main::arg{'c'})
+{
+
+ opendir(my $dh,$tom::P.'/_dsgn/') || die "can't $!";
+ while (readdir($dh)){
+ next unless /^[^_].*\.scss$/;
+ my $shortfile=$_;$shortfile=~s|\.scss$||;
+ my $file=$tom::P."/_dsgn/".$shortfile.'.scss';
+ print "process '$file'\n";
+
+ my $sass = CSS::Sass->new(include_paths => [$tom::P.'/_dsgn/']);
+ $sass->options->{'source_map_file'} = $tom::P.'/_dsgn/'.$shortfile.'.css.map';
+ my ($css, $err, $stats) = $sass->compile_file($file);
+
+ open(HND,'>'.$tom::P.'/!media/css/'.$shortfile.'.css');
+ print HND $css;
+ close(HND);
+
+ open(HND,'>'.$tom::P.'/!media/css/'.$shortfile.'.css.map');
+ print HND $err->{'source_map_string'};
+ close(HND);
+ }
+ closedir($dh);
+
+}
+
+
+print "\n";
+1;
Property changes on: trunk/frame/.bin/c3-sass
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
|
|
From: <sv...@cy...> - 2016-02-18 11:55:24
|
Author: rlaucik
Date: 2016-02-18 12:55:16 +0100 (Thu, 18 Feb 2016)
New Revision: 8605
Log:
changed text fields to popup menus for education and contract_type fields
Modified:
trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/a740/joboffer_edit.xbl
Modified: trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/a740/joboffer_edit.xbl
===================================================================
--- trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/a740/joboffer_edit.xbl 2016-02-18 11:51:38 UTC (rev 8604)
+++ trunk/xuladmin/xpi-source-22/chrome/chromeFiles/content/addons/a740/joboffer_edit.xbl 2016-02-18 11:55:16 UTC (rev 8605)
@@ -72,7 +72,11 @@
<xul:label class="bold" value="&addon.a740_joboffer_required_education;:"/>
</xul:vbox>
<xul:vbox flex="6">
- <xul:textbox flex="6" maxlength="128" IDdata="education" value="" spellcheck="false" />
+ <!--xul:textbox flex="6" maxlength="128" IDdata="education" value="" spellcheck="false" /-->
+ <xul:menulist flex="2"
+ sizetopopup="none" IDdata="education" width="128" >
+ <xul:menupopup IDdata="education_popup" flex="1" />
+ </xul:menulist>
</xul:vbox>
</xul:hbox>
</xul:vbox>
@@ -84,7 +88,11 @@
<xul:label class="bold" value="&addon.a740_contract_type;:"/>
</xul:vbox>
<xul:vbox>
- <xul:textbox maxlength="128" IDdata="contract_type" value="" spellcheck="false" />
+ <!--xul:textbox maxlength="128" IDdata="contract_type" value="" spellcheck="false" /-->
+ <xul:menulist flex="2"
+ sizetopopup="none" IDdata="contract_type" width="128" >
+ <xul:menupopup IDdata="contract_type_popup" flex="1" />
+ </xul:menulist>
</xul:vbox>
</xul:hbox>
</xul:vbox>
@@ -321,6 +329,33 @@
}
}
+ // education popup values
+ var education = document.getAnonymousElementByAttribute(tthis,'IDdata','education_popup')
+ while(education.hasChildNodes()){
+ education.removeChild(education.firstChild);
+ }
+ for (var i=0; i<body.response.education_options.length; i++) {
+
+ var menuItem = document.createElement("menuitem");
+ menuItem.setAttribute("label", body.response.education_options[i].value);
+ menuItem.setAttribute("value", body.response.education_options[i].value);
+ education.appendChild(menuItem);
+ }
+ // contract_type popup values
+ var contract_type = document.getAnonymousElementByAttribute(tthis,'IDdata','contract_type_popup')
+ while(contract_type.hasChildNodes()){
+ contract_type.removeChild(contract_type.firstChild);
+ }
+ for (var i=0; i<body.response.contract_type_options.length; i++) {
+ var menuItem = document.createElement("menuitem");
+ menuItem.setAttribute("label", body.response.contract_type_options[i].value);
+ menuItem.setAttribute("value", body.response.contract_type_options[i].value);
+ contract_type.appendChild(menuItem);
+ }
+
+ this.fnc_set('education',body.response.education);
+ this.fnc_set('contract_type',body.response.contract_type);
+
if(body.response.localset && body.response.localset.local)
{
|
|
From: <sv...@cy...> - 2016-02-18 11:51:46
|
Author: rlaucik
Date: 2016-02-18 12:51:38 +0100 (Thu, 18 Feb 2016)
New Revision: 8604
Log:
added support for default dropdown/popup options
Modified:
trunk/xuladmin/docroot/_addons/App/740/_mdl/740-joboffer.detail.default.tpl
trunk/xuladmin/docroot/_addons/App/740/_mdl/740-joboffer.detail.mdl
trunk/xuladmin/docroot/_addons/App/740/_mdl/740-joboffer.new.mdl
trunk/xuladmin/docroot/_addons/App/740/_mdl/740-joboffer.update.mdl
Modified: trunk/xuladmin/docroot/_addons/App/740/_mdl/740-joboffer.detail.default.tpl
===================================================================
--- trunk/xuladmin/docroot/_addons/App/740/_mdl/740-joboffer.detail.default.tpl 2016-02-17 17:18:31 UTC (rev 8603)
+++ trunk/xuladmin/docroot/_addons/App/740/_mdl/740-joboffer.detail.default.tpl 2016-02-18 11:51:38 UTC (rev 8604)
@@ -31,6 +31,12 @@
</local>
[%END%]
</localset>
+ [%FOREACH option IN joboffer.education_options%]
+ <education_options _array="true">[%option%]</education_options>
+ [%END%]
+ [%FOREACH option IN joboffer.contract_type_options%]
+ <contract_type_options _array="true">[%option%]</contract_type_options>
+ [%END%]
[%END%]
</response>
]]></entity>
Modified: trunk/xuladmin/docroot/_addons/App/740/_mdl/740-joboffer.detail.mdl
===================================================================
--- trunk/xuladmin/docroot/_addons/App/740/_mdl/740-joboffer.detail.mdl 2016-02-17 17:18:31 UTC (rev 8603)
+++ trunk/xuladmin/docroot/_addons/App/740/_mdl/740-joboffer.detail.mdl 2016-02-18 11:51:38 UTC (rev 8604)
@@ -80,6 +80,9 @@
};
push @{$db0_line{'localset'}},\%db1_line;
}
+ # default values for education and contract_type popups
+ $db0_line{'education_options'} = $App::740::education_options_default || ['undefined'];
+ $db0_line{'contract_type_options'} = $App::740::contract_type_options_default || ['undefined'];
}
$TPL->{'variables'}{'joboffer'}=\%db0_line;
Modified: trunk/xuladmin/docroot/_addons/App/740/_mdl/740-joboffer.new.mdl
===================================================================
--- trunk/xuladmin/docroot/_addons/App/740/_mdl/740-joboffer.new.mdl 2016-02-17 17:18:31 UTC (rev 8603)
+++ trunk/xuladmin/docroot/_addons/App/740/_mdl/740-joboffer.new.mdl 2016-02-18 11:51:38 UTC (rev 8604)
@@ -26,12 +26,17 @@
'tb_name' => "a740_joboffer",
'-journalize' => 1,
'-posix' => 1,
+ 'columns' => {
+ 'datetime_publish_start' => 'NOW()'
+ },
);
my %columns;
+
my %data = (
'ID_entity' => $env{'joboffer.ID'},
'name' => $main::RPC->{'joboffer.name'},
+ 'name_url' => TOM::Net::URI::rewrite::convert($main::RPC->{'joboffer.name'}),
'lng' => $main::RPC->{'lng'},
);
App::020::SQL::functions::new(
Modified: trunk/xuladmin/docroot/_addons/App/740/_mdl/740-joboffer.update.mdl
===================================================================
--- trunk/xuladmin/docroot/_addons/App/740/_mdl/740-joboffer.update.mdl 2016-02-17 17:18:31 UTC (rev 8603)
+++ trunk/xuladmin/docroot/_addons/App/740/_mdl/740-joboffer.update.mdl 2016-02-18 11:51:38 UTC (rev 8604)
@@ -38,28 +38,32 @@
'contact_person',
'metadata'
);
- my %data;
+ my %columns;
foreach (@fields) {
if (exists $main::RPC->{'joboffer.'.$_}) {
if ($_ eq 'contact_org') {
my $org_ID = get_org_ID($main::RPC->{'joboffer.'.$_});
- $data{$_} = $org_ID if $org_ID;
+ $columns{$_} = "'" . TOM::Security::form::sql_escape($org_ID) . "'" if $org_ID;
} else {
- $data{$_} = $main::RPC->{'joboffer.'.$_};
+ $columns{$_} = "'" . TOM::Security::form::sql_escape($main::RPC->{'joboffer.'.$_}) . "'";
}
} elsif (exists $main::RPC->{'update'}{$_}) {
- $data{$_} = $main::RPC->{'update'}{$_};
+ $columns{$_} = "'" . TOM::Security::form::sql_escape($main::RPC->{'update'}{$_}) . "'";
}
};
- #main::_log('data to update dump'.Dumper(%data));
+ $columns{'datetime_publish_start'}="NULL" if $columns{'datetime_publish_start'} eq "''";
+ $columns{'datetime_publish_stop'}="NULL" if $columns{'datetime_publish_stop'} eq "''";
+ #main::_log("publish start is $columns{'datetime_publish_start'}");
+
+ #main::_log('columns to update dump'.Dumper(%columns));
App::020::SQL::functions::update(
'db_h' => 'main',
'db_name' => $App::740::db_name,
'tb_name' => 'a740_joboffer',
'ID' => $main::RPC->{'joboffer.ID'},
- 'data' =>
+ 'columns' =>
{
- %data
+ %columns
},
'-journalize' => 1,
'-posix' => 1,
@@ -74,7 +78,11 @@
my $lng = $1; my $varname = $2;
$joboffer_lng{$lng} = {} unless (exists $joboffer_lng{$lng});
$joboffer_lng{$lng}{$varname} = $main::RPC->{$key};
- # main::_log("pridavam pre $lng field $varname hodnotu $main::RPC->{$key}");
+
+ # name_url
+ if ($varname eq 'name') {
+ $joboffer_lng{$lng}{'name_url'}=TOM::Security::form::sql_escape(TOM::Net::URI::rewrite::convert($main::RPC->{$key}));
+ }
}
}
@@ -105,7 +113,7 @@
{
my $local = $lng_line{'lng'};
if (%joboffer_lng && $joboffer_lng{$local}) {
- # main::_log('lng dump'.Dumper(\$joboffer_lng{$local}));
+ #main::_log('lng dump'.Dumper(\$joboffer_lng{$local}));
$App::020::SQL::functions::debug = 1;
App::020::SQL::functions::update(
|
|
From: <sv...@cy...> - 2016-02-17 17:18:38
|
Author: comsultia
Date: 2016-02-17 18:18:31 +0100 (Wed, 17 Feb 2016)
New Revision: 8603
Log:
added search by customer name
Modified:
trunk/xuladmin/docroot/_addons/App/920/_mdl/920-order.list.mdl
Modified: trunk/xuladmin/docroot/_addons/App/920/_mdl/920-order.list.mdl
===================================================================
--- trunk/xuladmin/docroot/_addons/App/920/_mdl/920-order.list.mdl 2016-02-17 13:32:07 UTC (rev 8602)
+++ trunk/xuladmin/docroot/_addons/App/920/_mdl/920-order.list.mdl 2016-02-17 17:18:31 UTC (rev 8603)
@@ -8,6 +8,7 @@
use App::920::_init;
+use App::301::_init;
sub execute
{
@@ -26,7 +27,10 @@
if ($main::RPC->{'keywords'})
{
- $sql_where.=" AND a920_order.ID_entity LIKE '".$main::RPC->{'keywords'}."%'";
+ $sql_where.="
+ AND a920_order.ID_entity LIKE '".$main::RPC->{'keywords'}."%'
+ OR a301_user_profile.firstname LIKE '".$main::RPC->{'keywords'}."%'
+ OR a301_user_profile.surname LIKE '".$main::RPC->{'keywords'}."%'";
}
if (ref($main::RPC->{'sql_where_filter'}) eq "ARRAY")
@@ -45,11 +49,16 @@
my $sql=qq{
SELECT
- a920_order.*
+ a920_order.*,
+ a301_user_profile.firstname,
+ a301_user_profile.surname
FROM
$App::920::db_name.a920_order
+ LEFT JOIN $App::301::db_name.a301_user_profile AS a301_user_profile ON (
+ a301_user_profile.ID_entity = a920_order.ID_user
+ )
WHERE
- status $sql_status
+ a920_order.status $sql_status
$sql_where
ORDER BY
$sql_order
|
|
From: <sv...@cy...> - 2016-02-17 13:32:16
|
Author: comsultia
Date: 2016-02-17 14:32:07 +0100 (Wed, 17 Feb 2016)
New Revision: 8602
Log:
Modified:
trunk/frame/_addons/App/020/functions/metadata.pm
Modified: trunk/frame/_addons/App/020/functions/metadata.pm
===================================================================
--- trunk/frame/_addons/App/020/functions/metadata.pm 2016-02-16 21:34:31 UTC (rev 8601)
+++ trunk/frame/_addons/App/020/functions/metadata.pm 2016-02-17 13:32:07 UTC (rev 8602)
@@ -218,10 +218,10 @@
my %metadata=@_;
my $text="<metatree>\n";
- foreach my $section (keys %metadata)
+ foreach my $section (sort keys %metadata)
{
$text.="<section name=\"$section\">\n";
- foreach my $variable(keys %{$metadata{$section}})
+ foreach my $variable(sort keys %{$metadata{$section}})
{
$text.="<variable name=\"$variable\">$metadata{$section}{$variable}</variable>\n";
}
@@ -233,4 +233,4 @@
return $text;
}
-1;
\ No newline at end of file
+1;
|