From: <sv...@cy...> - 2009-09-29 20:56:20
|
Author: comsultia Date: 2009-09-29 22:55:56 +0200 (Tue, 29 Sep 2009) New Revision: 4844 Log: [+][xuladmin:docroot] a730 - added modules and services to manipulate with a730_event_cat Added: trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_down.0.mdl trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_down.0.soap.xsgn trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_to.0.mdl trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_to.0.soap.xsgn trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_to_trash.0.mdl trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_to_trash.0.soap.xsgn trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_up.0.mdl trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_up.0.soap.xsgn trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_rename.0.mdl trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_rename.0.soap.xsgn trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_rel_cat_fromto.0.mdl trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_rel_cat_fromto.0.soap.xsgn trunk/xuladmin/docroot/_addons/App/730/_type/l_a730_event_cat_move_down.pub.type trunk/xuladmin/docroot/_addons/App/730/_type/l_a730_event_cat_move_to.pub.type trunk/xuladmin/docroot/_addons/App/730/_type/l_a730_event_cat_move_to_trash.pub.type trunk/xuladmin/docroot/_addons/App/730/_type/l_a730_event_cat_move_up.pub.type trunk/xuladmin/docroot/_addons/App/730/_type/l_a730_event_cat_rename.pub.type trunk/xuladmin/docroot/_addons/App/730/_type/l_a730_event_rel_cat_fromto.pub.type Modified: trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_list.0.mdl trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_list.0.soap.xsgn trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_tree.0.mdl trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_new.0.mdl trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_update.0.mdl trunk/xuladmin/docroot/_addons/App/730/_type/l_a730_event_new.pub.type Modified: trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_list.0.mdl =================================================================== --- trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_list.0.mdl 2009-09-29 20:55:08 UTC (rev 4843) +++ trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_list.0.mdl 2009-09-29 20:55:56 UTC (rev 4844) @@ -34,8 +34,8 @@ { $sql_where.="AND status='Y' "; } -=head1 + # find ID LIKE * if ($env{'event_cat.ID'}=~s/\*$//) { @@ -43,7 +43,7 @@ SELECT ID_charindex FROM - `$App::730::db_name`.a730_EVENT_cat + `$App::730::db_name`.a730_event_cat WHERE ID=$env{'event_cat.ID'} LIMIT 1 @@ -66,6 +66,7 @@ if ($env{'event_cat.ID'}) { + $XSGN{'TMP'}=~s|<%ID%>|$env{'event_cat.ID'}|g; my %data=App::020::SQL::functions::get_ID( @@ -107,7 +108,7 @@ # add parent as first folder item :)) my %db0_line=App::020::SQL::functions::tree::get_parent_ID ( - 'ID' => $env{'article_cat.ID'}, + 'ID' => $env{'event_cat.ID'}, 'db_h' => 'main', 'db_name' => $App::730::db_name, 'tb_name' => 'a730_event_cat', @@ -117,7 +118,7 @@ if ($db0_line{'ID'}) { main::_log('adding parent'); - $XSGN{'NULL'}=$XSGN{'ITEM'}; + $XSGN{'NULL'}=$XSGN{'item'}; $XSGN{'NULL'}=~s|<%ID%>|$db0_line{'ID'}|g; $XSGN{'NULL'}=~s|<%db_name%>|..|g; @@ -127,7 +128,7 @@ } else { - $XSGN{'NULL'}=$XSGN{'ITEM'}; + $XSGN{'NULL'}=$XSGN{'item'}; $XSGN{'NULL'}=~s|<%ID%>||g; $XSGN{'NULL'}=~s|<%db_name%>|..|g; @@ -136,7 +137,7 @@ $XSGN{'TMP'}=~s|<#item#>|$XSGN{'NULL'}|; } } - } + } @@ -179,7 +180,7 @@ my $level_prev; my $level_next; - if (!$env{'event_cat.ID*'} && $env{'sql_limit'}=~/^0/ && !$env{'keywords'} && $env{'folders'} ne "false") + if (!$env{'event_cat.ID*'} && $env{'sql_limit'}=~/^0/ && !$env{'keywords'} && $env{'folders'} eq "true") # if ($sth0{'sth'} && !$env{'event_cat.ID*'}) { my %sth0=TOM::Database::SQL::execute($sql,'log'=>1,'slave'=>1); @@ -190,16 +191,17 @@ $dbg=~s|^(.*?)(.{0,4})$|\1|; $db0_line{'ID_parent'}=$charindex_ID{$dbg}; - $XSGN{'NULL'}=$XSGN{'ITEM'}; + my $item=$XSGN{'item'}; - $XSGN{'NULL'}=~s|<%db_(.*?)%>|$db0_line{$1}|g; + $item=~s|<%db_(.*?)%>|$db0_line{$1}|g; - $XSGN{'NULL'}=~s|<%ID%>|$db0_line{'ID'}|g; - $XSGN{'NULL'}=~s|<%ID_entity%>|$db0_line{'ID_entity'}|g; - $XSGN{'NULL'}=~s|<%ID_parent%>|$db0_line{'ID_parent'}|g; - $XSGN{'NULL'}=~s|<%folder%>|Y|g; + $item=~s|<%ID%>|$db0_line{'ID'}|g; + $item=~s|<%ID_entity%>|$db0_line{'ID_entity'}|g; + $item=~s|<%ID_parent%>|$db0_line{'ID_parent'}|g; + $item=~s|<%folder%>|Y|g; - $XSGN{'TMP'}=~s|<#item#>|$XSGN{'NULL'}|; + $XSGN{'TMP'}=~s|<#item#>|$item|; + } } @@ -208,13 +210,13 @@ main::_log("can't select"); } -=cut + # WHERE CATEGORY my $where_category; - $where_category="AND event_rel_cat.ID_cat='$env{'event_cat.ID'}'" if $env{'event_cat.ID'}; - $where_category="AND event_rel_cat.ID_cat IN ($env{'article_cat.ID*'})" if $env{'event_cat.ID*'}; + $where_category="AND event_rel_cat.ID_category='$env{'event_cat.ID'}'" if $env{'event_cat.ID'}; + $where_category="AND event_rel_cat.ID_category IN ($env{'event_cat.ID*'})" if $env{'event_cat.ID*'}; $where_category="" unless $env{'event_cat.ID'}; - if (!$env{'event_cat.ID'} && !$env{'event_cat.ID*'}){$where_category="AND event_rel_cat.ID_cat IS NULL";} + if (!$env{'event_cat.ID'} && !$env{'event_cat.ID*'}){$where_category="AND event_rel_cat.ID_category IS NULL";} $where_category="" if $env{'event_cat.ID*'} eq "*"; @@ -240,7 +242,21 @@ DATE(event.datetime_start) AS date_start, DATE(event.datetime_finish) AS date_finish, LEFT(event.datetime_publish_start,16) AS datetime_publish_start, - event_lng.name_long AS name_long + event_lng.name_long AS name_long, + event_cat.ID as ID_category, + event_cat.name as category_name, + IF + ( + ( + SELECT + COUNT(*) + FROM + `$App::730::db_name`.`a730_event_rel_cat` AS sym_event + WHERE + event.ID_entity=sym_event.ID_event + ) > 1, + 'Y','N' + ) AS symlink FROM `$App::730::db_name`.a730_event AS event @@ -250,6 +266,9 @@ event_lng.lng = '$env{'lng'}' ) LEFT JOIN `$App::730::db_name`.a730_event_rel_cat AS event_rel_cat ON ( event.ID_entity = event_rel_cat.ID_event ) + LEFT JOIN `$App::730::db_name`.a730_event_cat AS event_cat ON + ( event_rel_cat.ID_category = event_cat.ID_entity AND + event_cat.lng = '$env{'lng'}' ) WHERE event.ID IS NOT NULL $sql_where @@ -265,7 +284,8 @@ { while (my %db0_line=$sth0{'sth'}->fetchhash()) { - + #main::_log("EVENT: ".$db0_line{'name'}); + my $item=$XSGN{'item'}; # icon Modified: trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_list.0.soap.xsgn =================================================================== --- trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_list.0.soap.xsgn 2009-09-29 20:55:08 UTC (rev 4843) +++ trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_list.0.soap.xsgn 2009-09-29 20:55:56 UTC (rev 4844) @@ -18,10 +18,11 @@ <datetime_create><![CDATA[<%db_datetime_create%>]]></datetime_create> <status><![CDATA[<%db_status%>]]></status> <folder><![CDATA[<%folder%>]]></folder> + <symlink><![CDATA[<%db_symlink%>]]></symlink> <IDparent><![CDATA[<%ID_parent%>]]></IDparent> <name_url><![CDATA[<%db_name_url%>]]></name_url> <ID_category><![CDATA[<%db_ID_category%>]]></ID_category> - <ID_category_name><![CDATA[<%db_ID_category_name%>]]></ID_category_name> + <category_name><![CDATA[<%db_category_name%>]]></category_name> <path><![CDATA[<%path%>]]></path> <name><![CDATA[<%db_name%>]]></name> Added: trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_down.0.mdl =================================================================== --- trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_down.0.mdl (rev 0) +++ trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_down.0.mdl 2009-09-29 20:55:56 UTC (rev 4844) @@ -0,0 +1,62 @@ +#!/usr/bin/perl +# USE UTF-8 !!! +package Tomahawk::module; +use open ':utf8', ':std'; +use encoding 'utf8'; +use utf8; +use strict; + +use App::020::_init; + + +sub execute +{ + my %env=@_; + Tomahawk::GetXSGN('-convertvars'=>1) || return undef; + + if (!$env{'ID'}) + { + $XSGN{'TMP'}=$XSGN{'RESULT_failure_no_input'}; + $XSGN{'TMP'}=~s|<%missing_parameter%>|ID|g; + return 1; + } + + my $out; + my $tb_name='a730_event_cat'; + + $out=App::020::SQL::functions::tree::move_down( + 'db_h' => "main", + 'db_name' => $App::730::db_name, + 'tb_name' => $tb_name, + '-journalize' => 1, + 'ID' => $env{'ID'}, + 'where' => "hostname='$tom::H_cookie'" + ); + + if ($out) + { + $XSGN{'TMP'}=$XSGN{'RESULT_success'}; + $XSGN{'TMP'}=~s|<%ID%>|$env{'ID'}|g; + return 1; + } + else + { + $XSGN{'TMP'}=$XSGN{'RESULT_failure_set'}; + $XSGN{'TMP'}=~s|<%ID%>|$env{'ID'}|g; + return 1; + } + + return 1; +} + + + +our $authors='op...@co...'; + +=head1 AUTHORS + +Comsultia, Ltd. (op...@co...) + +=cut + +1; Added: trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_down.0.soap.xsgn =================================================================== --- trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_down.0.soap.xsgn (rev 0) +++ trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_down.0.soap.xsgn 2009-09-29 20:55:56 UTC (rev 4844) @@ -0,0 +1,27 @@ +# áéíóú - UTF-8!!! +<XML_DESIGN_DEFINITION> + +<DEFINITION id="TMP"> +<response addon="a730" addon_type="event_cat" type="move_down" result="0"> + <reason>Default error message.</reason> +</response> +</DEFINITION> + +<DEFINITION id="RESULT_success"> +<response addon="a730" addon_type="event_cat" type="move_down" result="1"/> +</DEFINITION> + +<DEFINITION id="RESULT_failure_set"> +<response addon="a730" addon_type="event_cat" type="move_down" result="0"> + <reason>Could not move up</reason> +</response> +</DEFINITION> + +<DEFINITION id="RESULT_failure_no_input"> +<response addon="a730" addon_type="event_cat" type="move_down" result="0"> + <reason>Not enough information to act. Missing parameter '<%missing_parameter%>'</reason> +</response> +</DEFINITION> + +</XML_DESIGN_DEFINITION> + Added: trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_to.0.mdl =================================================================== --- trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_to.0.mdl (rev 0) +++ trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_to.0.mdl 2009-09-29 20:55:56 UTC (rev 4844) @@ -0,0 +1,51 @@ +#!/usr/bin/perl +# USE UTF-8 !!! +package Tomahawk::module; +use open ':utf8', ':std'; +use encoding 'utf8'; +use utf8; +use strict; + +use App::020::_init; + +sub execute +{ + my %env=@_; + Tomahawk::GetXSGN('-convertvars'=>1) || return undef; + + if (!$env{'ID'}) + { + $XSGN{'TMP'}=$XSGN{'RESULT_failure_no_input'}; + $XSGN{'TMP'}=~s|<%missing_parameter%>|ID|g; + return 1; + } + + my $out; + + $out=App::020::SQL::functions::tree::move_to( + 'db_h' => "main", + 'db_name' => $App::730::db_name, + 'tb_name' => "a730_event_cat", + '-journalize' => 1, + 'ID' => $env{'ID'}, + 'parent_ID' => $env{'parent_ID'} + ); + + if ($out) + { + $XSGN{'TMP'}=$XSGN{'RESULT_success'}; + $XSGN{'TMP'}=~s|<%ID%>|$env{'ID'}|g; + return 1; + } + else + { + $XSGN{'TMP'}=$XSGN{'RESULT_failure_set'}; + $XSGN{'TMP'}=~s|<%ID%>|$env{'ID'}|g; + return 1; + } + + return 1; +} + + +1; Added: trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_to.0.soap.xsgn =================================================================== --- trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_to.0.soap.xsgn (rev 0) +++ trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_to.0.soap.xsgn 2009-09-29 20:55:56 UTC (rev 4844) @@ -0,0 +1,27 @@ +# áéíóú - UTF-8!!! +<XML_DESIGN_DEFINITION> + + +<DEFINITION id="TMP"> +<response addon="a730" addon_type="event_cat" type="move_to" result="0"> + <reason>default error</reason> +</response> +</DEFINITION> + + +<DEFINITION id="RESULT_success"> +<response addon="a730" addon_type="event_cat" type="move_to" result="1"> + <ID><![CDATA[<%ID%>]]></ID> +</response> +</DEFINITION> + + +<DEFINITION id="RESULT_failure_no_input"> +<response addon="a730" addon_type="event_cat" type="move_to" result="0"> + <reason>Not enough information to act. Missing parameter '<%missing_parameter%>'</reason> +</response> +</DEFINITION> + + +</XML_DESIGN_DEFINITION> + Added: trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_to_trash.0.mdl =================================================================== --- trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_to_trash.0.mdl (rev 0) +++ trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_to_trash.0.mdl 2009-09-29 20:55:56 UTC (rev 4844) @@ -0,0 +1,121 @@ +#!/usr/bin/perl +# USE UTF-8 !!! +package Tomahawk::module; +use open ':utf8', ':std'; +use encoding 'utf8'; +use utf8; +use strict; + +use App::020::_init; + +=head1 NAME + +730-event_cat_move_to_trash.0.mdl + +=cut + +=head1 DESCRIPTION + +Remove folder (and subfolders) contained to Trash + +=cut + + +sub execute +{ + my %env=@_; + Tomahawk::GetXSGN('-convertvars'=>1) || return undef; + + if (!$env{'ID'}) + { + $XSGN{'TMP'}=$XSGN{'RESULT_failure_no_input'}; + $XSGN{'TMP'}=~s|<%missing_parameter%>|ID|g; + return 1; + } + + + + my $tr=new TOM::Database::SQL::transaction('db_h'=>"main"); + + $env{'ID'}.=';'; + foreach my $ID(split(';',$env{'ID'})) + { + next unless $ID; + + # get this ID + my %data=App::020::SQL::functions::get_ID( + 'db_h' => 'main', + 'db_name' => $App::730::db_name, + 'tb_name' => 'a730_event_cat', + 'ID' => $ID, + 'columns' => + { + 'ID_charindex' => 1, + 'lng' => 1 + } + ); + + # get ID and list of ID's childs + my $sql=qq{ + SELECT + ID, ID_entity, ID_charindex + FROM + `$App::730::db_name`.a730_event_cat + WHERE + ID_charindex LIKE '$data{'ID_charindex'}%' + AND status IN ('Y','N') + AND lng='$data{'lng'}' + ORDER BY + ID_charindex DESC + }; + + my %sth0=TOM::Database::SQL::execute($sql); + while (my %db0_line=$sth0{'sth'}->fetchhash()) + { + + my $id_entity = $db0_line{'ID_entity'}; + + App::020::SQL::functions::to_trash + ( + 'ID' => $db0_line{'ID'}, + 'db_h' => 'main', + 'db_name' => $App::730::db_name, + 'tb_name' => 'a730_event_cat', + '-journalize' => 1, + ); + + if ($id_entity) + { + my $sql_del=qq{ + DELETE + + FROM + `$App::730::db_name`.a730_event_rel_cat + WHERE + ID_category=$id_entity + }; + my %sth1=TOM::Database::SQL::execute($sql_del); + } + + $XSGN{'TMP'}=$XSGN{'RESULT_success'}; + } + } + + $tr->close(); + + + $XSGN{'TMP'}=$XSGN{'RESULT_success'}; + + return 1; +} + + +our $authors='op...@co...'; + +=head1 AUTHORS + +Comsultia, Ltd. (op...@co...) + +=cut + +1; Added: trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_to_trash.0.soap.xsgn =================================================================== --- trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_to_trash.0.soap.xsgn (rev 0) +++ trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_to_trash.0.soap.xsgn 2009-09-29 20:55:56 UTC (rev 4844) @@ -0,0 +1,27 @@ +# áéíóú - UTF-8!!! +<XML_DESIGN_DEFINITION> + + +<DEFINITION id="TMP"> +<response addon="a730" addon_type="event_cat" type="move_to_trash" result="0"> + <reason>default error</reason> +</response> +</DEFINITION> + + +<DEFINITION id="RESULT_success"> +<response addon="a730" addon_type="event_cat" type="move_to_trash" result="1"> + <ID><![CDATA[<%ID%>]]></ID> +</response> +</DEFINITION> + + +<DEFINITION id="RESULT_failure_no_input"> +<response addon="a730" addon_type="event_cat" type="move_to_trash" result="0"> + <reason>Not enough information to act. Missing parameter '<%missing_parameter%>'</reason> +</response> +</DEFINITION> + + +</XML_DESIGN_DEFINITION> + Added: trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_up.0.mdl =================================================================== --- trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_up.0.mdl (rev 0) +++ trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_up.0.mdl 2009-09-29 20:55:56 UTC (rev 4844) @@ -0,0 +1,61 @@ +#!/usr/bin/perl +# USE UTF-8 !!! +package Tomahawk::module; +use open ':utf8', ':std'; +use encoding 'utf8'; +use utf8; +use strict; + +use App::020::_init; + +sub execute +{ + my %env=@_; + Tomahawk::GetXSGN('-convertvars'=>1) || return undef; + + if (!$env{'ID'}) + { + $XSGN{'TMP'}=$XSGN{'RESULT_failure_no_input'}; + $XSGN{'TMP'}=~s|<%missing_parameter%>|ID|g; + return 1; + } + + my $out; + my $tb_name='a730_event_cat'; + + $out=App::020::SQL::functions::tree::move_up( + 'db_h' => "main", + 'db_name' => $App::730::db_name, + 'tb_name' => $tb_name, + '-journalize' => 1, + 'ID' => $env{'ID'}, + 'where' => "hostname='$tom::H_cookie'" + ); + + if ($out) + { + $XSGN{'TMP'}=$XSGN{'RESULT_success'}; + $XSGN{'TMP'}=~s|<%ID%>|$env{'ID'}|g; + return 1; + } + else + { + $XSGN{'TMP'}=$XSGN{'RESULT_failure_set'}; + $XSGN{'TMP'}=~s|<%ID%>|$env{'ID'}|g; + return 1; + } + + return 1; +} + + + +our $authors='op...@co...'; + +=head1 AUTHORS + +Comsultia, Ltd. (op...@co...) + +=cut + +1; Added: trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_up.0.soap.xsgn =================================================================== --- trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_up.0.soap.xsgn (rev 0) +++ trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_move_up.0.soap.xsgn 2009-09-29 20:55:56 UTC (rev 4844) @@ -0,0 +1,27 @@ +# áéíóú - UTF-8!!! +<XML_DESIGN_DEFINITION> + +<DEFINITION id="TMP"> +<response addon="a730" addon_type="event_cat" type="move_up" result="0"> + <reason>Default error message.</reason> +</response> +</DEFINITION> + +<DEFINITION id="RESULT_success"> +<response addon="a730" addon_type="event_cat" type="move_up" result="1"/> +</DEFINITION> + +<DEFINITION id="RESULT_failure_set"> +<response addon="a730" addon_type="event_cat" type="move_up" result="0"> + <reason>Could not move up</reason> +</response> +</DEFINITION> + +<DEFINITION id="RESULT_failure_no_input"> +<response addon="a730" addon_type="event_cat" type="move_up" result="0"> + <reason>Not enough information to act. Missing parameter '<%missing_parameter%>'</reason> +</response> +</DEFINITION> + +</XML_DESIGN_DEFINITION> + Added: trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_rename.0.mdl =================================================================== --- trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_rename.0.mdl (rev 0) +++ trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_rename.0.mdl 2009-09-29 20:55:56 UTC (rev 4844) @@ -0,0 +1,68 @@ +#!/usr/bin/perl +# USE UTF-8 !!! +package Tomahawk::module; +use open ':utf8', ':std'; +use encoding 'utf8'; +use utf8; +use strict; + +use App::020::_init; + +sub execute +{ + my %env=@_; + Tomahawk::GetXSGN('-convertvars'=>1) || return undef; + + if (!$env{'ID'}) + { + $XSGN{'TMP'}=$XSGN{'RESULT_failure_no_input'}; + $XSGN{'TMP'}=~s|<%missing_parameter%>|ID|g; + return 1; + } + + if (!$env{'name'}) + { + $XSGN{'TMP'}=$XSGN{'RESULT_failure_no_input'}; + $XSGN{'TMP'}=~s|<%missing_parameter%>|name|g; + return 1; + } + + my $out; + my $tb_name='a730_event_cat'; + + $out=App::020::SQL::functions::tree::rename( + $env{'name'}, + 'ID' => $env{'ID'}, + 'db_h' => "main", + 'db_name' => $App::730::db_name, + 'tb_name' => $tb_name, + '-journalize' => 1, + ); + + if ($out) + { + $XSGN{'TMP'}=$XSGN{'RESULT_success'}; + $XSGN{'TMP'}=~s|<%ID%>|$env{'ID'}|g; + return 1; + } + else + { + $XSGN{'TMP'}=$XSGN{'RESULT_failure_set'}; + $XSGN{'TMP'}=~s|<%ID%>|$env{'ID'}|g; + return 1; + } + + return 1; +} + + + +our $authors='op...@co...'; + +=head1 AUTHORS + +Comsultia, Ltd. (op...@co...) + +=cut + +1; Added: trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_rename.0.soap.xsgn =================================================================== --- trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_rename.0.soap.xsgn (rev 0) +++ trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_rename.0.soap.xsgn 2009-09-29 20:55:56 UTC (rev 4844) @@ -0,0 +1,27 @@ +# áéíóú - UTF-8!!! +<XML_DESIGN_DEFINITION> + +<DEFINITION id="TMP"> +<response addon="a730" addon_type="event_cat" type="rename" result="0"> + <reason>Default error message.</reason> +</response> +</DEFINITION> + +<DEFINITION id="RESULT_success"> +<response addon="a730" addon_type="event_cat" type="rename" result="1"/> +</DEFINITION> + +<DEFINITION id="RESULT_failure_set"> +<response addon="a730" addon_type="event_cat" type="rename" result="0"> + <reason>Could not rename</reason> +</response> +</DEFINITION> + +<DEFINITION id="RESULT_failure_no_input"> +<response addon="a730" addon_type="event_cat" type="rename" result="0"> + <reason>Not enough information to act. Missing parameter '<%missing_parameter%>'</reason> +</response> +</DEFINITION> + +</XML_DESIGN_DEFINITION> + Modified: trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_tree.0.mdl =================================================================== --- trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_tree.0.mdl 2009-09-29 20:55:08 UTC (rev 4843) +++ trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_cat_tree.0.mdl 2009-09-29 20:55:56 UTC (rev 4844) @@ -278,15 +278,15 @@ # count of items my $sql=qq{ - SELECT COUNT(event_rel_cat.ID_cat) AS itemcount + SELECT COUNT(event_rel_cat.ID_category) AS itemcount FROM `$App::730::db_name`.`a730_event_rel_cat` AS event_rel_cat - LEFT JOIN + JOIN `$App::730::db_name`.a730_event AS event ON (event_rel_cat.ID_event = event.ID_entity AND event.status IN ('Y','N','W','L')) WHERE - event_rel_cat.ID_cat=$entity->{'ID'} + event_rel_cat.ID_category=$entity->{'ID'} }; my %sth1=TOM::Database::SQL::execute($sql,'quiet'=>1,'-slave'=>1,'_cache'=>30); if (my %db1_line=$sth1{'sth'}->fetchhash()) Modified: trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_new.0.mdl =================================================================== --- trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_new.0.mdl 2009-09-29 20:55:08 UTC (rev 4843) +++ trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_new.0.mdl 2009-09-29 20:55:56 UTC (rev 4844) @@ -21,9 +21,12 @@ return 1; } + main::_log("CAT: ".$env{'ID_category'}); + my %event=App::730::functions::event_add( 'event.name' => $env{'name'}, - 'event.status' => 'Y' + 'event.status' => 'Y', + 'category' => $env{'ID_category'} ); $XSGN{'TMP'}=$XSGN{'RESULT_success'}; Added: trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_rel_cat_fromto.0.mdl =================================================================== --- trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_rel_cat_fromto.0.mdl (rev 0) +++ trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_rel_cat_fromto.0.mdl 2009-09-29 20:55:56 UTC (rev 4844) @@ -0,0 +1,130 @@ +#!/usr/bin/perl +# USE UTF-8 !!! +package Tomahawk::module; +use open ':utf8', ':std'; +use encoding 'utf8'; +use utf8; +use strict; + + + +sub execute +{ + my %env=@_; + Tomahawk::GetXSGN('-convertvars'=>1) || return undef; + + my $from; + + if (!$env{'ID_event'}) + { + $XSGN{'TMP'}=$XSGN{'RESULT_failure_no_input'}; + $XSGN{'TMP'}=~s|<%missing_parameter%>|ID_event|g; + return 1; + } + + if (!$env{'ID_category_from'} && !$env{'ID_category_to'}) + { + $XSGN{'TMP'}=$XSGN{'RESULT_failure_no_input'}; + $XSGN{'TMP'}=~s|<%missing_parameter%>|ID_category_from or ID_category_to|g; + return 1; + } + + + #convert ID_event to ID_entity + + if (!$env{'event.ID_entity'}) + { + # convert ID to ID_entity + my $sql=qq{ + SELECT + ID_entity + FROM + `$App::730::db_name`.`a730_event` + WHERE + ID=$env{'ID_event'} + LIMIT 1 + }; + my %sth0=TOM::Database::SQL::execute($sql,'quiet'=>1); + my %event=$sth0{'sth'}->fetchhash(); + $env{'event.ID_entity'}=$event{'ID_entity'}; + } + + if ($env{'ID_category_from'}) + { + if (!$env{'event.ID_entity_category_from'}) + { + # convert ID to ID_entity + my $sql=qq{ + SELECT + ID_entity + FROM + `$App::730::db_name`.`a730_event_cat` + WHERE + ID=$env{'ID_category_from'} + LIMIT 1 + }; + my %sth0=TOM::Database::SQL::execute($sql,'quiet'=>1); + my %event_cat=$sth0{'sth'}->fetchhash(); + $env{'event.ID_entity_category_from'}=$event_cat{'ID_entity'}; + } + } + + if ($env{'ID_category_to'}) + { + if (!$env{'event.ID_entity_category_to'}) + { + # convert ID to ID_entity + my $sql=qq{ + SELECT + ID_entity + FROM + `$App::730::db_name`.`a730_event_cat` + WHERE + ID=$env{'ID_category_to'} + LIMIT 1 + }; + my %sth0=TOM::Database::SQL::execute($sql,'quiet'=>1); + my %event_cat=$sth0{'sth'}->fetchhash(); + $env{'event.ID_entity_category_to'}=$event_cat{'ID_entity'}; + } + } + + if ($env{'event.ID_entity'} && $env{'event.ID_entity_category_from'}) + { + my $sql=qq{ + DELETE + FROM + `$App::730::db_name`.a730_event_rel_cat + WHERE + ID_category=$env{'event.ID_entity_category_from'} AND + ID_event=$env{'event.ID_entity'} + }; + my %sth0=TOM::Database::SQL::execute($sql); + } + + if ($env{'event.ID_entity'} && $env{'event.ID_entity_category_to'}) + { + my $sql=qq{ + REPLACE + INTO + `$App::730::db_name`.a730_event_rel_cat + ( + ID_event, + ID_category + ) + VALUES + ( + $env{'event.ID_entity'}, + $env{'event.ID_entity_category_to'} + ) + }; + my %sth0=TOM::Database::SQL::execute($sql); + } + + $XSGN{'TMP'}=$XSGN{'RESULT_success'}; + + return 1; +} + + +1; Added: trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_rel_cat_fromto.0.soap.xsgn =================================================================== --- trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_rel_cat_fromto.0.soap.xsgn (rev 0) +++ trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_rel_cat_fromto.0.soap.xsgn 2009-09-29 20:55:56 UTC (rev 4844) @@ -0,0 +1,27 @@ +# áéíóú - UTF-8!!! +<XML_DESIGN_DEFINITION> + + +<DEFINITION id="TMP"> +<response addon="a730" addon_type="event_rel_cat" type="fromto" result="0"> + <reason>default error</reason> +</response> +</DEFINITION> + + +<DEFINITION id="RESULT_success"> +<response addon="a730" addon_type="event_rel_cat" type="fromto" result="1"> + <ID><![CDATA[<%ID%>]]></ID> +</response> +</DEFINITION> + + +<DEFINITION id="RESULT_failure_no_input"> +<response addon="a730" addon_type="event_rel_cat" type="fromto" result="0"> + <reason>Not enough information to act. Missing parameter '<%missing_parameter%>'</reason> +</response> +</DEFINITION> + + +</XML_DESIGN_DEFINITION> + Modified: trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_update.0.mdl =================================================================== --- trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_update.0.mdl 2009-09-29 20:55:08 UTC (rev 4843) +++ trunk/xuladmin/docroot/_addons/App/730/_mdl/730-event_update.0.mdl 2009-09-29 20:55:56 UTC (rev 4844) @@ -306,6 +306,9 @@ $columns{'event.datetime_publish_stop'}=$main::RPC->{'event.datetime_publish_stop'} if exists $main::RPC->{'event.datetime_publish_stop'}; $columns{'event.status'}=$main::RPC->{'event.status'} if $main::RPC->{'event.status'}; + #cat + $columns{'categories'}=$main::RPC->{'event.cat'} if $main::RPC->{'event.cat'}; + # metadata $columns{'event.metadata'}=$main::RPC->{'event.metadata'} if $main::RPC->{'event.metadata'}; Added: trunk/xuladmin/docroot/_addons/App/730/_type/l_a730_event_cat_move_down.pub.type =================================================================== --- trunk/xuladmin/docroot/_addons/App/730/_type/l_a730_event_cat_move_down.pub.type (rev 0) +++ trunk/xuladmin/docroot/_addons/App/730/_type/l_a730_event_cat_move_down.pub.type 2009-09-29 20:55:56 UTC (rev 4844) @@ -0,0 +1,21 @@ +<!CMLTYPE type:name="Cyclone-Markup-Language" type:version="1.0" type:cp="UTF-8"!> + +<CONF_VAR id="layers" value="default" /> + +<MODULE> + <VAR id="-type" value="mdl" /> + <VAR id="-category" value="301" /> + <VAR id="-name" value="check" /> + <VAR id="-TMP" value="OUTPUT" /> + <VAR id="groups" value="editor" /> +</MODULE> + +<MODULE> + <VAR id="-type" value="mdl" /> + <VAR id="-category" value="730" /> + <VAR id="-name" value="event_cat_move_down" /> + <VAR id="-global" value="0" /> + <VAR id="-TMP" value="OUTPUT" /> + <VAR id="-xsgn" value="soap" /> + <VAR id="ID" value="<$main::RPC->{'ID'}>" /> +</MODULE> \ No newline at end of file Added: trunk/xuladmin/docroot/_addons/App/730/_type/l_a730_event_cat_move_to.pub.type =================================================================== --- trunk/xuladmin/docroot/_addons/App/730/_type/l_a730_event_cat_move_to.pub.type (rev 0) +++ trunk/xuladmin/docroot/_addons/App/730/_type/l_a730_event_cat_move_to.pub.type 2009-09-29 20:55:56 UTC (rev 4844) @@ -0,0 +1,23 @@ +<!CMLTYPE type:name="Cyclone-Markup-Language" type:version="1.0" type:cp="UTF-8"!> + +<CONF_VAR id="layers" value="default" /> + +<MODULE> + <VAR id="-type" value="mdl" /> + <VAR id="-category" value="301" /> + <VAR id="-name" value="check" /> + <VAR id="-TMP" value="OUTPUT" /> + <VAR id="groups" value="editor" /> +</MODULE> + +<MODULE> + <VAR id="-type" value="mdl" /> + <VAR id="-category" value="730" /> + <VAR id="-name" value="event_cat_move_to" /> + <VAR id="-global" value="0" /> + <VAR id="-TMP" value="OUTPUT" /> + <VAR id="-xlng" value="<$main::RPC->{'lng'}>" /> + <VAR id="-xsgn" value="soap" /> + <VAR id="ID" value="<$main::RPC->{'ID'}>" /> + <VAR id="parent_ID" value="<$main::RPC->{'parent_ID'}>" /> +</MODULE> \ No newline at end of file Added: trunk/xuladmin/docroot/_addons/App/730/_type/l_a730_event_cat_move_to_trash.pub.type =================================================================== --- trunk/xuladmin/docroot/_addons/App/730/_type/l_a730_event_cat_move_to_trash.pub.type (rev 0) +++ trunk/xuladmin/docroot/_addons/App/730/_type/l_a730_event_cat_move_to_trash.pub.type 2009-09-29 20:55:56 UTC (rev 4844) @@ -0,0 +1,21 @@ +<!CMLTYPE type:name="Cyclone-Markup-Language" type:version="1.0" type:cp="UTF-8"!> + +<CONF_VAR id="layers" value="default" /> + +<MODULE> + <VAR id="-type" value="mdl" /> + <VAR id="-category" value="301" /> + <VAR id="-name" value="check" /> + <VAR id="-TMP" value="OUTPUT" /> + <VAR id="groups" value="editor" /> +</MODULE> + +<MODULE> + <VAR id="-type" value="mdl" /> + <VAR id="-category" value="730" /> + <VAR id="-name" value="event_cat_move_to_trash" /> + <VAR id="-global" value="0" /> + <VAR id="-TMP" value="OUTPUT" /> + <VAR id="-xsgn" value="soap" /> + <VAR id="ID" value="<$main::RPC->{'ID'}>" /> +</MODULE> \ No newline at end of file Added: trunk/xuladmin/docroot/_addons/App/730/_type/l_a730_event_cat_move_up.pub.type =================================================================== --- trunk/xuladmin/docroot/_addons/App/730/_type/l_a730_event_cat_move_up.pub.type (rev 0) +++ trunk/xuladmin/docroot/_addons/App/730/_type/l_a730_event_cat_move_up.pub.type 2009-09-29 20:55:56 UTC (rev 4844) @@ -0,0 +1,21 @@ +<!CMLTYPE type:name="Cyclone-Markup-Language" type:version="1.0" type:cp="UTF-8"!> + +<CONF_VAR id="layers" value="default" /> + +<MODULE> + <VAR id="-type" value="mdl" /> + <VAR id="-category" value="301" /> + <VAR id="-name" value="check" /> + <VAR id="-TMP" value="OUTPUT" /> + <VAR id="groups" value="editor" /> +</MODULE> + +<MODULE> + <VAR id="-type" value="mdl" /> + <VAR id="-category" value="730" /> + <VAR id="-name" value="event_cat_move_up" /> + <VAR id="-global" value="0" /> + <VAR id="-TMP" value="OUTPUT" /> + <VAR id="-xsgn" value="soap" /> + <VAR id="ID" value="<$main::RPC->{'ID'}>" /> +</MODULE> \ No newline at end of file Added: trunk/xuladmin/docroot/_addons/App/730/_type/l_a730_event_cat_rename.pub.type =================================================================== --- trunk/xuladmin/docroot/_addons/App/730/_type/l_a730_event_cat_rename.pub.type (rev 0) +++ trunk/xuladmin/docroot/_addons/App/730/_type/l_a730_event_cat_rename.pub.type 2009-09-29 20:55:56 UTC (rev 4844) @@ -0,0 +1,23 @@ +<!CMLTYPE type:name="Cyclone-Markup-Language" type:version="1.0" type:cp="UTF-8"!> + +<CONF_VAR id="layers" value="default" /> + +<MODULE> + <VAR id="-type" value="mdl" /> + <VAR id="-category" value="301" /> + <VAR id="-name" value="check" /> + <VAR id="-TMP" value="OUTPUT" /> + <VAR id="groups" value="editor" /> +</MODULE> + +<MODULE> + <VAR id="-type" value="mdl" /> + <VAR id="-category" value="730" /> + <VAR id="-name" value="event_cat_rename" /> + <VAR id="-global" value="0" /> + <VAR id="-TMP" value="OUTPUT" /> + <VAR id="-xlng" value="<$main::RPC->{'lng'}>" /> + <VAR id="-xsgn" value="soap" /> + <VAR id="ID" value="<$main::RPC->{'ID'}>" /> + <VAR id="name" value="<$main::RPC->{'name'}>" /> +</MODULE> \ No newline at end of file Modified: trunk/xuladmin/docroot/_addons/App/730/_type/l_a730_event_new.pub.type =================================================================== --- trunk/xuladmin/docroot/_addons/App/730/_type/l_a730_event_new.pub.type 2009-09-29 20:55:08 UTC (rev 4843) +++ trunk/xuladmin/docroot/_addons/App/730/_type/l_a730_event_new.pub.type 2009-09-29 20:55:56 UTC (rev 4844) @@ -19,4 +19,5 @@ <VAR id="-xlng" value="<$main::RPC->{'lng'}>" /> <VAR id="-xsgn" value="soap" /> <VAR id="name" value="<$main::RPC->{'name'}>" /> + <VAR id="ID_category" value="<$main::RPC->{'ID_category'}>" /> </MODULE> \ No newline at end of file Added: trunk/xuladmin/docroot/_addons/App/730/_type/l_a730_event_rel_cat_fromto.pub.type =================================================================== --- trunk/xuladmin/docroot/_addons/App/730/_type/l_a730_event_rel_cat_fromto.pub.type (rev 0) +++ trunk/xuladmin/docroot/_addons/App/730/_type/l_a730_event_rel_cat_fromto.pub.type 2009-09-29 20:55:56 UTC (rev 4844) @@ -0,0 +1,23 @@ +<!CMLTYPE type:name="Cyclone-Markup-Language" type:version="1.0" type:cp="UTF-8"!> + +<CONF_VAR id="layers" value="default" /> + +<MODULE> + <VAR id="-type" value="mdl" /> + <VAR id="-category" value="301" /> + <VAR id="-name" value="check" /> + <VAR id="-TMP" value="OUTPUT" /> + <VAR id="groups" value="admin" /> +</MODULE> + +<MODULE> + <VAR id="-type" value="mdl" /> + <VAR id="-category" value="730" /> + <VAR id="-name" value="event_rel_cat_fromto" /> + <VAR id="-global" value="0" /> + <VAR id="-TMP" value="OUTPUT" /> + <VAR id="-xsgn" value="soap" /> + <VAR id="ID_event" value="<$main::RPC->{'ID_event'}>" /> + <VAR id="ID_category_from" value="<$main::RPC->{'ID_category_from'}>" /> + <VAR id="ID_category_to" value="<$main::RPC->{'ID_category_to'}>" /> +</MODULE> |