Index: trunk/kernel/include/usersession.php =================================================================== diff -u -N -r4896 -r5185 --- trunk/kernel/include/usersession.php (.../usersession.php) (revision 4896) +++ trunk/kernel/include/usersession.php (.../usersession.php) (revision 5185) @@ -935,8 +935,10 @@ while($rs && !$rs->EOF) { $index = $rs->fields["CatId"]; - if(!is_numeric($PermValue[$index])) + if(!is_numeric($PermValue[$index]) || $rs->fields["PermissionValue"]) { + // remember permission value of not set or allowed $PermValue[$index] = $rs->fields["PermissionValue"]; + } $rs->MoveNext(); } $cats = array_reverse(explode(",",$CatList)); Index: trunk/kernel/units/general/cat_event_handler.php =================================================================== diff -u -N -r5179 -r5185 --- trunk/kernel/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 5179) +++ trunk/kernel/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 5185) @@ -141,49 +141,6 @@ } /** - * Enter description here... - * - * @param kEvent $event - */ - function OnPreSaveAndOpenTranslator(&$event) - { - $this->Application->SetVar('allow_translation', true); - $object =& $event->getObject(); - $this->RemoveRequiredFields($object); - $event->CallSubEvent('OnPreSave'); - - if ($event->status == erSUCCESS) { - - $resource_id = $this->Application->GetVar('translator_resource_id'); - if ($resource_id) { - $t_prefixes = explode(',', $this->Application->GetVar('translator_prefixes')); - - $cdata =& $this->Application->recallObject($t_prefixes[1], null, Array('skip_autoload' => true)); - $cdata->Load($resource_id, 'ResourceId'); - if (!$cdata->isLoaded()) { - $cdata->SetDBField('ResourceId', $resource_id); - $cdata->Create(); - } - $this->Application->SetVar($cdata->getPrefixSpecial().'_id', $cdata->GetID()); - } - - $event->redirect = $this->Application->GetVar('translator_t'); - $event->redirect_params = Array('pass'=>'all,trans,'.$this->Application->GetVar('translator_prefixes'), - $event->getPrefixSpecial(true).'_id' => $object->GetID(), - 'trans_event' => 'OnLoad', - 'trans_prefix' => $this->Application->GetVar('translator_prefixes'), - 'trans_field' => $this->Application->GetVar('translator_field'), - 'trans_multi_line' => $this->Application->GetVar('translator_multi_line'), - ); - - // 1. SAVE LAST TEMPLATE TO SESSION (really needed here, because of tweaky redirect) - $last_template = $this->Application->RecallVar('last_template'); - preg_match('/index4\.php\|'.$this->Application->GetSID().'-(.*):/U', $last_template, $rets); - $this->Application->StoreVar('return_template', $this->Application->GetVar('t')); - } - } - - /** * Return type clauses for list bulding on front * * @param kEvent $event Index: trunk/admin/install/upgrades/inportal_upgrade_v1.2.1.sql =================================================================== diff -u -N -r5136 -r5185 --- trunk/admin/install/upgrades/inportal_upgrade_v1.2.1.sql (.../inportal_upgrade_v1.2.1.sql) (revision 5136) +++ trunk/admin/install/upgrades/inportal_upgrade_v1.2.1.sql (.../inportal_upgrade_v1.2.1.sql) (revision 5185) @@ -60,4 +60,6 @@ UPDATE ConfigurationAdmin SET DisplayOrder = '30.07' WHERE VariableName = 'Smtp_AdminMailFrom'; UPDATE ConfigurationAdmin SET DisplayOrder = '40.01' WHERE VariableName = 'Backup_Path'; +ALTER TABLE Category ADD COLUMN l1_Name varchar(255) NOT NULL default '' AFTER Name, ADD INDEX (l1_Name(5)), ADD COLUMN l2_Name varchar(255) NOT NULL default '' AFTER l1_Name, ADD INDEX (l2_Name(5)), ADD COLUMN l3_Name varchar(255) NOT NULL default '' AFTER l2_Name, ADD INDEX (l3_Name(5)), ADD COLUMN l4_Name varchar(255) NOT NULL default '' AFTER l3_Name, ADD INDEX (l4_Name(5)), ADD COLUMN l5_Name varchar(255) NOT NULL default '' AFTER l4_Name, ADD INDEX (l5_Name(5)), ADD COLUMN l1_Description text NOT NULL AFTER Description, ADD INDEX (l1_Description(5)), ADD COLUMN l2_Description text NOT NULL AFTER l1_Description, ADD INDEX (l2_Description(5)), ADD COLUMN l3_Description text NOT NULL AFTER l2_Description, ADD INDEX (l3_Description(5)), ADD COLUMN l4_Description text NOT NULL AFTER l3_Description, ADD INDEX (l4_Description(5)), ADD COLUMN l5_Description text NOT NULL AFTER l4_Description, ADD INDEX (l5_Description(5)); + UPDATE Modules SET Version = '1.2.1' WHERE Name = 'In-Portal'; \ No newline at end of file Index: trunk/core/units/general/cat_event_handler.php =================================================================== diff -u -N -r5179 -r5185 --- trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 5179) +++ trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 5185) @@ -141,49 +141,6 @@ } /** - * Enter description here... - * - * @param kEvent $event - */ - function OnPreSaveAndOpenTranslator(&$event) - { - $this->Application->SetVar('allow_translation', true); - $object =& $event->getObject(); - $this->RemoveRequiredFields($object); - $event->CallSubEvent('OnPreSave'); - - if ($event->status == erSUCCESS) { - - $resource_id = $this->Application->GetVar('translator_resource_id'); - if ($resource_id) { - $t_prefixes = explode(',', $this->Application->GetVar('translator_prefixes')); - - $cdata =& $this->Application->recallObject($t_prefixes[1], null, Array('skip_autoload' => true)); - $cdata->Load($resource_id, 'ResourceId'); - if (!$cdata->isLoaded()) { - $cdata->SetDBField('ResourceId', $resource_id); - $cdata->Create(); - } - $this->Application->SetVar($cdata->getPrefixSpecial().'_id', $cdata->GetID()); - } - - $event->redirect = $this->Application->GetVar('translator_t'); - $event->redirect_params = Array('pass'=>'all,trans,'.$this->Application->GetVar('translator_prefixes'), - $event->getPrefixSpecial(true).'_id' => $object->GetID(), - 'trans_event' => 'OnLoad', - 'trans_prefix' => $this->Application->GetVar('translator_prefixes'), - 'trans_field' => $this->Application->GetVar('translator_field'), - 'trans_multi_line' => $this->Application->GetVar('translator_multi_line'), - ); - - // 1. SAVE LAST TEMPLATE TO SESSION (really needed here, because of tweaky redirect) - $last_template = $this->Application->RecallVar('last_template'); - preg_match('/index4\.php\|'.$this->Application->GetSID().'-(.*):/U', $last_template, $rets); - $this->Application->StoreVar('return_template', $this->Application->GetVar('t')); - } - } - - /** * Return type clauses for list bulding on front * * @param kEvent $event Index: trunk/kernel/admin_templates/incs/script.js =================================================================== diff -u -N -r5085 -r5185 --- trunk/kernel/admin_templates/incs/script.js (.../script.js) (revision 5085) +++ trunk/kernel/admin_templates/incs/script.js (.../script.js) (revision 5185) @@ -304,62 +304,6 @@ } // in-portal compatibility functions: end -function PreSaveAndOpenTranslator(prefix,field,t,multi_line,$width,$height) -{ - var $kf = document.getElementById($form_name); - - if(!isset($window_name)) var $window_name = 'select_'+t.replace(/(\/|-)/g, '_'); - if(!isset($width)) $width=750; - if(!isset($height)) $height=400; - if(!isset(multi_line)) multi_line=0; - openwin('',$window_name,$width,$height); - set_hidden_field('return_template', $kf.elements['t'].value); // where should return after popup is done - set_hidden_field('translator_wnd_name', $window_name); - set_hidden_field('translator_field', field); - set_hidden_field('translator_t', t); - set_hidden_field('translator_prefixes', prefix); - set_hidden_field('translator_multi_line', multi_line); - $kf.target = $window_name; - - var split_prefix = prefix.split(','); - submit_event(split_prefix[0],'OnPreSaveAndOpenTranslator'); -} - -function PreSaveAndOpenTranslatorCV(prefix,field,t,resource_id,multi_line) -{ - var $kf = document.getElementById($form_name); - - if(!isset($window_name)) var $window_name = 'select_'+t.replace(/(\/|-)/g, '_'); - if(!isset(multi_line)) multi_line=0; - openwin('',$window_name,750,400); - set_hidden_field('return_template', $kf.elements['t'].value); // where should return after popup is done - set_hidden_field('translator_wnd_name', $window_name); - set_hidden_field('translator_field', field); - set_hidden_field('translator_t', t); - set_hidden_field('translator_prefixes', prefix); - set_hidden_field('translator_resource_id', resource_id); - set_hidden_field('translator_multi_line', multi_line); - $kf.target = $window_name; - - var split_prefix = prefix.split(','); - submit_event(split_prefix[0],'OnPreSaveAndOpenTranslator'); -} - - -function openTranslator(prefix,field,url,wnd) -{ - var $kf = document.getElementById($form_name); - - set_hidden_field('trans_prefix', prefix); - set_hidden_field('trans_field', field); - set_hidden_field('events[trans]', 'OnLoad'); - - var $regex = new RegExp('(.*)\?env=' + document.getElementById('sid').value + '-(.*?):(.*)'); - var $t = $regex.exec(url)[2]; - $kf.target = wnd; - submit_event(prefix,'',$t,url); -} - function openSelector($prefix, $url, $dst_field, $window_size, $event) { var $kf = document.getElementById($form_name); @@ -396,6 +340,66 @@ set_hidden_field('m_opener', $prev_opener); } +function InitTranslator(prefix, field, t, multi_line) +{ + var $kf = document.getElementById($form_name); + var $window_name = 'select_'+t.replace(/(\/|-)/g, '_'); + var $regex = new RegExp('(.*)\?env=' + document.getElementById('sid').value + '-(.*?):(m[^:]+)'); + + $regex = $regex.exec($kf.action); + set_hidden_field('return_m', $regex[3]); + var $prev_opener = get_hidden_field('m_opener'); + if (!isset(multi_line)) multi_line = 0; + openwin('', $window_name, 750, 400); + set_hidden_field('return_template', $kf.elements['t'].value); // where should return after popup is done + set_hidden_field('m_opener', 'p'); + + set_hidden_field('translator_wnd_name', $window_name); + set_hidden_field('translator_field', field); + set_hidden_field('translator_t', t); + set_hidden_field('translator_prefixes', prefix); + set_hidden_field('translator_multi_line', multi_line); + $kf.target = $window_name; + + return $prev_opener; +} + +function PreSaveAndOpenTranslator(prefix, field, t, multi_line) +{ + var $prev_opener = InitTranslator(prefix, field, t, multi_line); + + var split_prefix = prefix.split(','); + submit_event(split_prefix[0], 'OnPreSaveAndOpenTranslator'); + + set_hidden_field('m_opener', $prev_opener); +} + + +function PreSaveAndOpenTranslatorCV(prefix, field, t, resource_id, multi_line) +{ + var $prev_opener = InitTranslator(prefix, field, t, multi_line); + set_hidden_field('translator_resource_id', resource_id); + + var split_prefix = prefix.split(','); + submit_event(split_prefix[0],'OnPreSaveAndOpenTranslator'); + + set_hidden_field('m_opener', $prev_opener); +} + +function openTranslator(prefix,field,url,wnd) +{ + var $kf = document.getElementById($form_name); + + set_hidden_field('trans_prefix', prefix); + set_hidden_field('trans_field', field); + set_hidden_field('events[trans]', 'OnLoad'); + + var $regex = new RegExp('(.*)\?env=' + document.getElementById('sid').value + '-(.*?):(.*)'); + var $t = $regex.exec(url)[2]; + $kf.target = wnd; + submit_event(prefix,'',$t,url); +} + function openwin($url,$name,$width,$height) { var $window_params = 'width='+$width+',height='+$height+',status=yes,resizable=yes,menubar=no,scrollbars=yes,toolbar=no'; Index: trunk/admin/install/inportal_schema.sql =================================================================== diff -u -N -r5110 -r5185 --- trunk/admin/install/inportal_schema.sql (.../inportal_schema.sql) (revision 5110) +++ trunk/admin/install/inportal_schema.sql (.../inportal_schema.sql) (revision 5185) @@ -15,15 +15,25 @@ CREATE TABLE Category ( CategoryId int(11) NOT NULL auto_increment, - Type int(11) NOT NULL default '0', + `Type` int(11) NOT NULL default '0', ParentId int(11) NOT NULL default '0', Name varchar(255) NOT NULL default '', - Filename varchar(255) NOT NULL, + l1_Name varchar(255) NOT NULL default '', + l2_Name varchar(255) NOT NULL default '', + l3_Name varchar(255) NOT NULL default '', + l4_Name varchar(255) NOT NULL default '', + l5_Name varchar(255) NOT NULL default '', + Filename varchar(255) NOT NULL default '', AutomaticFilename tinyint(3) unsigned NOT NULL default '1', Description text NOT NULL, + l1_Description text NOT NULL, + l2_Description text NOT NULL, + l3_Description text NOT NULL, + l4_Description text NOT NULL, + l5_Description text NOT NULL, CreatedOn int(11) NOT NULL default '0', EditorsPick tinyint(4) NOT NULL default '0', - Status tinyint(4) NOT NULL default '0', + `Status` tinyint(4) NOT NULL default '0', Pop tinyint(4) default NULL, Priority int(11) NOT NULL default '0', MetaKeywords varchar(255) default NULL, @@ -44,13 +54,23 @@ CachedCategoryTemplate varchar(255) NOT NULL default '', CachedItemTemplate varchar(255) NOT NULL default '', PRIMARY KEY (CategoryId), - KEY ParentId (ParentId), UNIQUE KEY ResourceId (ResourceId), + KEY ParentId (ParentId), KEY Modified (Modified), KEY Priority (Priority), KEY sorting (Name,Priority), - KEY Filename (Filename(5)) -) + KEY Filename (Filename(5)), + KEY l1_Name (l1_Name(5)), + KEY l2_Name (l2_Name(5)), + KEY l3_Name (l3_Name(5)), + KEY l4_Name (l4_Name(5)), + KEY l5_Name (l5_Name(5)), + KEY l1_Description (l1_Description(5)), + KEY l2_Description (l2_Description(5)), + KEY l3_Description (l3_Description(5)), + KEY l4_Description (l4_Description(5)), + KEY l5_Description (l5_Description(5)) +) # -------------------------------------------------------- Index: trunk/core/units/categories/categories_config.php =================================================================== diff -u -N -r5173 -r5185 --- trunk/core/units/categories/categories_config.php (.../categories_config.php) (revision 5173) +++ trunk/core/units/categories/categories_config.php (.../categories_config.php) (revision 5185) @@ -64,6 +64,8 @@ 'tree_site' => Array('format' => '!la_selecting_categories!'), ), + 'PermItemPrefix' => 'CATEGORY', + 'PermSection' => Array('main' => 'CATEGORY:in-portal:categories', /*'search' => 'in-portal:configuration_search',*/ 'email' => 'in-portal:configuration_email', 'custom' => 'in-portal:configuration_custom'), 'Sections' => Array( @@ -208,10 +210,10 @@ 'CategoryId' => Array('type' => 'int','not_null' => 1,'default' => ''), 'Type' => Array('type' => 'int','not_null' => 1,'default' => 0), 'ParentId' => Array('type' => 'int','not_null' => 1,'default' => 0), - 'Name' => Array('type' => 'string', 'not_null' => 1, 'required' => 1, 'default' => ''), + 'Name' => Array('type' => 'string', 'formatter' => 'kMultiLanguage', 'not_null' => 1, 'required' => 1, 'default' => ''), 'Filename' => Array('type' => 'string', 'not_null' => 1, 'default' => ''), 'AutomaticFilename' => Array('type' => 'int', 'not_null' => 1, 'default' => 1), - 'Description' => Array('type' => 'string', 'not_null' => 1, 'required' => 1, 'default' => ''), + 'Description' => Array('type' => 'string', 'formatter' => 'kMultiLanguage', 'not_null' => 1, 'required' => 1, 'default' => ''), 'CreatedOn' => Array('formatter' => 'kDateFormatter', 'default'=>'#NOW#', 'required' => 1, 'not_null' => 1), 'EditorsPick' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), 'Status' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Active', 2 => 'la_Pending', 0 => 'la_Disabled' ), 'use_phrases' => 1, 'not_null' => 1,'default' => 2), Index: trunk/core/kernel/db/db_event_handler.php =================================================================== diff -u -N -r5098 -r5185 --- trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 5098) +++ trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 5185) @@ -1672,18 +1672,38 @@ $object =& $event->getObject(); $this->RemoveRequiredFields($object); $event->CallSubEvent('OnPreSave'); + if ($event->status == erSUCCESS) { + + $resource_id = $this->Application->GetVar('translator_resource_id'); + if ($resource_id) { + $t_prefixes = explode(',', $this->Application->GetVar('translator_prefixes')); + + $cdata =& $this->Application->recallObject($t_prefixes[1], null, Array('skip_autoload' => true)); + $cdata->Load($resource_id, 'ResourceId'); + if (!$cdata->isLoaded()) { + $cdata->SetDBField('ResourceId', $resource_id); + $cdata->Create(); + } + $this->Application->SetVar($cdata->getPrefixSpecial().'_id', $cdata->GetID()); + } + $event->redirect = $this->Application->GetVar('translator_t'); $event->redirect_params = Array('pass'=>'all,trans,'.$this->Application->GetVar('translator_prefixes'), - $event->getPrefixSpecial(true).'_id' => $object->GetId(), - 'trans_event'=>'OnLoad', - 'trans_prefix'=> $this->Application->GetVar('translator_prefixes'), - 'trans_field'=>$this->Application->GetVar('translator_field'), - 'trans_multi_line'=>$this->Application->GetVar('translator_multi_line'), + $event->getPrefixSpecial(true).'_id' => $object->GetID(), + 'trans_event' => 'OnLoad', + 'trans_prefix' => $this->Application->GetVar('translator_prefixes'), + 'trans_field' => $this->Application->GetVar('translator_field'), + 'trans_multi_line' => $this->Application->GetVar('translator_multi_line'), ); + + // 1. SAVE LAST TEMPLATE TO SESSION (really needed here, because of tweaky redirect) + $last_template = $this->Application->RecallVar('last_template'); + preg_match('/index4\.php\|'.$this->Application->GetSID().'-(.*):/U', $last_template, $rets); + $this->Application->StoreVar('return_template', $this->Application->GetVar('t')); } } - + function RemoveRequiredFields(&$object) { // making all field non-required to achieve successful presave Index: trunk/kernel/units/categories/categories_config.php =================================================================== diff -u -N -r5173 -r5185 --- trunk/kernel/units/categories/categories_config.php (.../categories_config.php) (revision 5173) +++ trunk/kernel/units/categories/categories_config.php (.../categories_config.php) (revision 5185) @@ -64,6 +64,8 @@ 'tree_site' => Array('format' => '!la_selecting_categories!'), ), + 'PermItemPrefix' => 'CATEGORY', + 'PermSection' => Array('main' => 'CATEGORY:in-portal:categories', /*'search' => 'in-portal:configuration_search',*/ 'email' => 'in-portal:configuration_email', 'custom' => 'in-portal:configuration_custom'), 'Sections' => Array( @@ -208,10 +210,10 @@ 'CategoryId' => Array('type' => 'int','not_null' => 1,'default' => ''), 'Type' => Array('type' => 'int','not_null' => 1,'default' => 0), 'ParentId' => Array('type' => 'int','not_null' => 1,'default' => 0), - 'Name' => Array('type' => 'string', 'not_null' => 1, 'required' => 1, 'default' => ''), + 'Name' => Array('type' => 'string', 'formatter' => 'kMultiLanguage', 'not_null' => 1, 'required' => 1, 'default' => ''), 'Filename' => Array('type' => 'string', 'not_null' => 1, 'default' => ''), 'AutomaticFilename' => Array('type' => 'int', 'not_null' => 1, 'default' => 1), - 'Description' => Array('type' => 'string', 'not_null' => 1, 'required' => 1, 'default' => ''), + 'Description' => Array('type' => 'string', 'formatter' => 'kMultiLanguage', 'not_null' => 1, 'required' => 1, 'default' => ''), 'CreatedOn' => Array('formatter' => 'kDateFormatter', 'default'=>'#NOW#', 'required' => 1, 'not_null' => 1), 'EditorsPick' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), 'Status' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Active', 2 => 'la_Pending', 0 => 'la_Disabled' ), 'use_phrases' => 1, 'not_null' => 1,'default' => 2), Index: trunk/admin/install/upgrades/inportal_upgrade_v1.2.1.php =================================================================== diff -u -N -r5181 -r5185 --- trunk/admin/install/upgrades/inportal_upgrade_v1.2.1.php (.../inportal_upgrade_v1.2.1.php) (revision 5181) +++ trunk/admin/install/upgrades/inportal_upgrade_v1.2.1.php (.../inportal_upgrade_v1.2.1.php) (revision 5185) @@ -1,11 +1,20 @@ ConfigValue('User_LoggedInGroup'); $sql = str_replace('#GROUP_ID#', $everyone_group, $sql); - RunSQLText($application->Conn, Array($sql), 'dbconnection'); - + RunSQLText($application->Conn, Array($sql), 'dbconnection'); + + // set Categories Name & Description to their multilingual equialents + $ml_formatter =& $application->recallObject('kMultiLanguage'); + $table_name = $this->Application->getUnitOption('c', 'TableName'); + + $sql = 'UPDATE '.$table_name.' + SET '.$ml_formatter->LangFieldName('Name').' = Name, '.$ml_formatter->LangFieldName('Description').' = Description'; + $application->Conn->Query($sql); ?> \ No newline at end of file