Property changes on: admin_templates\country_states ___________________________________________________________________ Added: bugtraq:url + http://tracker.in-portal.org/view.php?id=%BUGID% Added: bugtraq:logregex + (?:[Bb]ugs?|[Ii]ssues?|[Rr]eports?|[Ff]ixe?s?|[Rr]esolves?)+\s+(?:#?(?:\d+)[,\.\s]*)+ (\d+) Index: admin_templates/country_states/country_state_edit.tpl =================================================================== --- admin_templates/country_states/country_state_edit.tpl (revision 0) +++ admin_templates/country_states/country_state_edit.tpl (revision 0) @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + + + + + + +
+
+ + \ No newline at end of file Index: admin_templates/country_states/country_state_list.tpl =================================================================== --- admin_templates/country_states/country_state_list.tpl (revision 0) +++ admin_templates/country_states/country_state_list.tpl (revision 0) @@ -0,0 +1,48 @@ + + + + + + + + + + + +
+ +
+ + + + \ No newline at end of file Index: kernel/utility/http_query.php =================================================================== --- kernel/utility/http_query.php (revision 13329) +++ kernel/utility/http_query.php (working copy) @@ -234,11 +234,9 @@ function AfterInit() { -// $vars = $this->processQueryString($this->Get(ENV_VAR_NAME)); -// $this->AddParams($vars); -// $this->convertPostEvents(); - // if ($this->Application->RewriteURLs()) { if ($this->Application->RewriteURLs() || $this->Get('_mod_rw_url_')) { + // maybe call onafterconfigread here + if (defined('DEBUG_MODE') && $this->Application->isDebugMode()) { $this->Application->Debugger->profileStart('url_parsing'); $this->processRewriteURL(); @@ -375,7 +373,9 @@ $module_params['editing_mode'] = ''; } - $env = $this->Application->BuildEnv( $this->Get('t'), $module_params, $passed, false, false ); + $module_params['__URLENCODE__'] = 1; + + $env = $this->Application->BuildEnv( $this->Get('t'), $module_params, $passed, false, false); $this->Set(ENV_VAR_NAME, $env); $_REQUEST['env'] = $_GET['env'] = $env; // for capability with old in-portal code } Property changes on: units\country_states ___________________________________________________________________ Added: bugtraq:url + http://tracker.in-portal.org/view.php?id=%BUGID% Added: bugtraq:logregex + (?:[Bb]ugs?|[Ii]ssues?|[Rr]eports?|[Ff]ixe?s?|[Rr]esolves?)+\s+(?:#?(?:\d+)[,\.\s]*)+ (\d+) Index: units/country_states/country_state_eh.php =================================================================== --- units/country_states/country_state_eh.php (revision 0) +++ units/country_states/country_state_eh.php (revision 0) @@ -0,0 +1,85 @@ +getObject(); + /* @var $object kDBList */ + + if (($event->Special == 'selected') || ($event->Special == 'available')) { + $edit_picker_helper =& $this->Application->recallObject('EditPickerHelper'); + /* @var $edit_picker_helper EditPickerHelper */ + + $edit_picker_helper->applyFilter($event, 'Countries'); + + // only countries + $object->addFilter('type_filter', '%1$s.Type = ' . DESTINATION_TYPE_COUNTRY); + } + } + + /** + * Makes sure, that state country is always specified + * + * @param kEvent $event + */ + function OnBeforeItemCreate(&$event) + { + parent::OnBeforeItemCreate($event); + + $this->_setRequired($event); + } + + /** + * Makes sure, that state country is always specified + * + * @param kEvent $event + */ + function OnBeforeItemUpdate(&$event) + { + parent::OnBeforeItemUpdate($event); + + $this->_setRequired($event); + } + + /** + * Makes sure, that state country is always specified + * + * @param kEvent $event + */ + function _setRequired(&$event) + { + $object =& $event->getObject(); + /* @var $object kDBItem */ + + $object->setRequired('StateCountryId', $object->GetDBField('Type') == DESTINATION_TYPE_STATE); + } + + /** + * Don't allow to delete countries, that have states + * + * @param kEvent $event + */ + function OnBeforeItemDelete(&$event) + { + parent::OnBeforeItemDelete($event); + + $object =& $event->getObject(); + /* @var $object kDBItem */ + + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); + /* @var $cs_helper kCountryStatesHelper */ + + if ($cs_helper->CountryHasStates( $object->GetDBField('IsoCode') )) { + $event->status = erFAIL; + return ; + } + } + } \ No newline at end of file Index: units/country_states/country_states_config.php =================================================================== --- units/country_states/country_states_config.php (revision 0) +++ units/country_states/country_states_config.php (revision 0) @@ -0,0 +1,116 @@ + 'country-state', + 'ItemClass' => Array ('class' => 'kDBItem', 'file' => '', 'build_event' => 'OnItemBuild'), + 'ListClass' => Array ('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'), + 'EventHandlerClass' => Array ('class' => 'CountryStateEventHandler', 'file' => 'country_state_eh.php', 'build_event' => 'OnBuild'), + 'TagProcessorClass' => Array ('class' => 'kDBTagProcessor', 'file' => '', 'build_event' => 'OnBuild'), + + 'AutoLoad' => true, + + 'QueryString' => Array ( + 1 => 'id', + 2 => 'Page', + 3 => 'event', + 4 => 'mode', + ), + + 'IDField' => 'CountryStateId', + + 'TableName' => TABLE_PREFIX . 'CountryStates', + + 'TitleField' => 'Translation', + + 'TitlePresets' => Array ( + 'default' => Array ( + 'new_status_labels' => Array ('country-state' => '!la_title_AddingCountryState!'), + 'edit_status_labels' => Array ('country-state' => '!la_title_EditingCountryState!'), + ), + + 'country_state_list' => Array ( + 'prefixes' => Array ('country-state_List'), 'format' => "!la_title_CountryStates!", + 'toolbar_buttons' => Array ('new_item', 'edit', 'delete', 'view', 'dbl-click'), + ), + + 'country_state_edit' => Array ( + 'prefixes' => Array ('country-state'), 'format' => "#country-state_status# '#country-state_titlefield#'", + 'toolbar_buttons' => Array ('select', 'cancel', 'reset_edit', 'prev', 'next'), + ), + ), + + 'PermSection' => Array('main' => 'in-portal:country_states'), + + 'Sections' => Array ( + 'in-portal:country_states' => Array ( + 'parent' => 'in-portal:website_setting_folder', + 'icon' => 'conf_country_states', + 'label' => 'la_title_CountryStates', + 'url' => Array('t' => 'country_states/country_state_list', 'pass' => 'm'), + 'permissions' => Array('view', 'add', 'edit', 'delete'), + 'priority' => 10, + 'type' => stTREE, + ), + ), + + 'ListSQLs' => Array ( + '' => ' SELECT %1$s.* %2$s FROM %1$s', + ), + + 'ListSortings' => Array ( + '' => Array ( + 'Sorting' => Array ('Type' => 'asc', 'Translation' => 'asc'), + ) + ), + + 'CalculatedFields' => Array ( + '' => Array ( + 'Translation' => 'l%2$s_Name', + ), + ), + + 'Fields' => Array ( + 'CountryStateId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0), + + 'Type' => Array ( + 'type' => 'int', + 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_opt_Country', 2 => 'la_opt_State'), 'use_phrases' => 1, + 'not_null' => 1, 'required' => 1, 'default' => 1 + ), + + 'StateCountryId' => Array ( + 'type' => 'int', + 'formatter' => 'kOptionsFormatter', 'options_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'CountryStates WHERE Type = ' . DESTINATION_TYPE_COUNTRY . ' ORDER BY l%2$s_Name', 'option_key_field' => 'CountryStateId', 'option_title_field' => 'l%2$s_Name', + 'default' => NULL + ), + + 'Name' => Array ( + 'type' => 'string', 'max_len' => 255, + 'formatter' => 'kMultiLanguage', 'db_type' => 'varchar(255)', + 'not_null' => 1, 'required' => 1, 'default' => '' + ), + + 'IsoCode' => Array ('type' => 'string', 'max_len' => 3, 'not_null' => 1, 'required' => 1, 'default' => ''), + 'ShortIsoCode' => Array ('type' => 'string', 'max_len' => 2, 'default' => NULL), + ), + + 'VirtualFields' => Array ( + 'Translation' => Array ('type' => 'string', 'default' => ''), + ), + + 'Grids' => Array ( + 'Default' => Array ( + 'Icons' => Array ('default' => 'icon16_item.png'), + 'Fields' => Array ( + 'CountryStateId' => Array ('title' => 'la_col_Id', 'filter_block' => 'grid_range_filter', 'width' => 70, ), + 'Name' => Array ('title' => 'la_col_Name', 'filter_block' => 'grid_like_filter', 'width' => 200, ), + 'IsoCode' => Array ('title' => 'la_col_IsoCode', 'filter_block' => 'grid_like_filter', 'width' => 100, ), + 'Type' => Array ('title' => 'la_col_Type', 'filter_block' => 'grid_options_filter', 'width' => 100, ), + 'StateCountryId' => Array ('title' => 'la_col_StateCountry', 'filter_block' => 'grid_options_filter', 'width' => 200, ), + 'ShortIsoCode' => Array ('title' => 'la_col_ShortIsoCode', 'filter_block' => 'grid_like_filter', 'width' => 125, ), + ), + ), + ), + ); \ No newline at end of file Index: units/helpers/mod_rewrite_helper.php =================================================================== --- units/helpers/mod_rewrite_helper.php (revision 13329) +++ units/helpers/mod_rewrite_helper.php (working copy) @@ -1009,7 +1009,8 @@ { static $init_done = false; - if ($init_done) { + if ($init_done || count($this->Application->RewriteListeners) == 0) { + // not inited OR mod-rewrite url with missing config cache return ; }