Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Sat, Sep 20, 8:35 AM

in-portal

Index: branches/unlabeled/unlabeled-1.6.2/kernel/units/relationship/relationship_event_handler.php
===================================================================
--- branches/unlabeled/unlabeled-1.6.2/kernel/units/relationship/relationship_event_handler.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.6.2/kernel/units/relationship/relationship_event_handler.php (revision 5561)
@@ -0,0 +1,200 @@
+<?php
+
+ class RelationshipEventHandler extends InpDBEventHandler
+ {
+ /**
+ * Allows to override standart permission mapping
+ *
+ */
+ function mapPermissions()
+ {
+ parent::mapPermissions();
+ $permissions = Array(
+ 'OnAddRelation' => Array('subitem' => 'add|edit'),
+ );
+ $this->permMapping = array_merge($this->permMapping, $permissions);
+ }
+
+ /**
+ * Add new relation
+ *
+ * @param kEvent $event
+ */
+ function OnAddRelation(&$event)
+ {
+ $object =& $event->getObject( Array('skip_autoload' => true) );
+
+ $table_info = $object->getLinkedInfo();
+ $main_item_type = $this->Application->getUnitOption($table_info['ParentPrefix'],'ItemType');
+
+ $target['id'] = $this->Application->GetVar('TargetId');
+ $target['type'] = $this->Application->GetVar('TargetType');
+
+
+ $object->SetDBField($table_info['ForeignKey'], $table_info['ParentId']);
+ $object->SetDBField('SourceType', $main_item_type);
+ $object->SetDBField('TargetId', $target['id']);
+ $object->SetDBField('TargetType', $target['type']);
+
+ // 1. get item info used in relation
+ $configs = $this->extractModulesInfo();
+ foreach($configs as $prefix => $config_data)
+ {
+ if($config_data['ItemType'] == $target['type']) break;
+ }
+
+ // this forces prepareOptions of kMultiLanguge formatter to substiture title field (if multilingual) of target item
+ // BUT this is not the solution, find out another way to get correct title field here
+
+ $target_object =& $this->Application->recallObject($prefix, null, Array('skip_autoload' => true));
+ $title_field = $this->Application->getUnitOption($prefix, 'TitleField');
+
+ $item['name'] = $this->Conn->GetOne('SELECT '.$title_field.' FROM '.$config_data['TableName'].' WHERE ResourceId = '.$target['id']);
+ $item['type'] = $this->Application->Phrase($config_data['TitlePhrase']);
+ $object->SetDBField('ItemName', $item['name']);
+ $object->SetDBField('ItemType', $item['type']);
+
+ $object->setID(0);
+
+ $event->redirect = false;
+
+ // 2. substitute opener
+ $opener_stack = $this->Application->RecallVar('opener_stack');
+ $opener_stack = $opener_stack ? unserialize($opener_stack) : Array();
+ array_pop($opener_stack);
+
+ $return_template = $this->Application->RecallVar('return_template');
+ $new_level = 'index4.php|'.ltrim($this->Application->BuildEnv($return_template, Array('m_opener'=>'u'),'all'),ENV_VAR_NAME.'=');
+ array_push($opener_stack,$new_level);
+ $this->Application->StoreVar('opener_stack',serialize($opener_stack));
+
+ $this->Application->SetVar($event->Prefix_Special.'_SaveEvent','OnCreate');
+ }
+
+ /**
+ * Creates needed sql query to load list,
+ * if no query is defined in config for
+ * special requested, then use default
+ * query
+ *
+ * @param kEvent $event
+ * @access protected
+ */
+ function ListPrepareQuery(&$event)
+ {
+ return $this->BaseQuery($event,'ListSQLs');
+ }
+
+ /**
+ * Creates needed sql query to load item,
+ * if no query is defined in config for
+ * special requested, then use default
+ * query
+ *
+ * @param kEvent $event
+ * @access protected
+ */
+ function ItemPrepareQuery(&$event)
+ {
+ return $this->BaseQuery($event,'ItemSQLs');
+ }
+
+
+ /**
+ * Get item name & type based on relation type & modules installed
+ *
+ * @param kEvent $event
+ * @param string $sql_field
+ */
+ function BaseQuery(&$event, $sql_field)
+ {
+ $sqls = $this->Application->getUnitOption($event->Prefix,$sql_field);
+ $sql = isset($sqls[$event->Special]) ? $sqls[$event->Special] : $sqls[''];
+
+ $configs = $this->extractModulesInfo();
+
+ // 2. build sql based on information queried
+ $sql_templates['ItemName'] = 'IFNULL(%s.%s,\' \')';
+ $sql_templates['TableJoin'] = 'LEFT JOIN %1$s ON %1$s.ResourceId = rel.TargetId';
+ $sql_templates['TargetName'] = 'IF(rel.TargetType = %s, \'%s\', %s)';
+
+ $sql_parts = Array();
+ $sql_parts['TargetName'] = "''";
+ foreach ($configs as $prefix => $config_data) {
+ // convert TitleField field of kMultiLanguage formatter used for it: begin
+ $title_field = $config_data['TitleField'];
+ $formatter_class = isset($config_data['Fields'][$title_field]['formatter']) ? $config_data['Fields'][$title_field]['formatter'] : '';
+ if ($formatter_class == 'kMultiLanguage') {
+ $ml_formatter =& $this->Application->recallObject('kMultiLanguage');
+ $title_field = $ml_formatter->LangFieldName($title_field);
+ }
+ // convert TitleField field of kMultiLanguage formatter used for it: end
+
+ $sql_parts['ItemName'][] = sprintf($sql_templates['ItemName'], $config_data['TableName'], $title_field);
+ $sql_parts['TableJoin'][] = sprintf($sql_templates['TableJoin'], $config_data['TableName']);
+
+ $sql_parts['TargetName'] = sprintf( $sql_templates['TargetName'],
+ $config_data['ItemType'],
+ '!'.$config_data['TitlePhrase'].'!',
+ $sql_parts['TargetName']);
+ $sql_parts['TargetName'] = str_replace('rel','%1$s',$sql_parts['TargetName']);
+ }
+
+ $object =& $event->getObject();
+
+ $vars = Array('#ITEM_NAMES#', '#ITEM_TYPES#');
+ $replacements = Array( implode(', ',$sql_parts['ItemName']), $sql_parts['TargetName'] );
+
+ $calculated_fields =& $object->getProperty('CalculatedFields');
+ foreach ($calculated_fields as $field_name => $field_expression) {
+ $calculated_fields[$field_name] = str_replace($vars, $replacements, $field_expression);
+ }
+
+ $object->setProperty('CalculatedFields', $calculated_fields);
+
+ $sql = str_replace('#ITEM_JOIN#', implode(' ',$sql_parts['TableJoin']), $sql);
+ $sql = str_replace('rel.','%1$s.',$sql);
+
+ return $sql;
+ }
+
+ /**
+ * Get configs from modules installed
+ *
+ * @return Array
+ * @access private
+ */
+ function extractModulesInfo()
+ {
+ // get installed modules & their config info
+ // maybe we should leave only prefixes, that have "view" permission
+ $configs = Array();
+ foreach ($this->Application->ModuleInfo as $module_name => $module_data) {
+ $prefix = $module_data['Var'];
+ $configs[$prefix] = $this->Application->getUnitOptions($prefix);
+ if($configs[$prefix] === false) unset($configs[$prefix]);
+ }
+ return $configs;
+ }
+
+
+ /**
+ * Deletes relations to hooked item from other items
+ *
+ * @param kEvent $event
+ */
+ function OnDeleteForeignRelations(&$event)
+ {
+ $main_object =& $event->MasterEvent->getObject();
+ $resource_id = $main_object->GetDBField('ResourceId');
+
+ $table = $this->Application->getUnitOption($event->Prefix,'TableName');
+ $sql = 'DELETE FROM '.$table.' WHERE TargetId = '.$resource_id;
+ $this->Conn->Query($sql);
+ }
+
+
+ }
+
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.6.2/kernel/units/relationship/relationship_event_handler.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.6
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.6.2/kernel/units/reviews/reviews_event_handler.php
===================================================================
--- branches/unlabeled/unlabeled-1.6.2/kernel/units/reviews/reviews_event_handler.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.6.2/kernel/units/reviews/reviews_event_handler.php (revision 5561)
@@ -0,0 +1,186 @@
+<?php
+
+ class ReviewsEventHandler extends InpDBEventHandler
+ {
+ /**
+ * Checks permissions of user
+ *
+ * @param kEvent $event
+ */
+ function CheckPermission(&$event)
+ {
+ if ($event->Name == 'OnAddReview') {
+ $item_prefix = $this->getPermPrefix($event);
+ $res = $this->Application->CheckPermission($item_prefix.'.REVIEW.PENDING', 0) || $this->Application->CheckPermission($item_prefix.'.REVIEW', 0);
+ if (!$res) {
+ $event->status = erPERM_FAIL;
+ }
+ return $res;
+ }
+
+ return parent::CheckPermission($event);
+ }
+
+ /**
+ * Returns prefix for permissions
+ *
+ * @param kEvent $event
+ */
+ function getPermPrefix(&$event)
+ {
+ $main_prefix = $this->Application->GetTopmostPrefix($event->Prefix);
+ // this will return LINK for l, ARTICLE for n, TOPIC for bb, PRODUCT for p
+ $item_prefix = $this->Application->getUnitOption($main_prefix, 'PermItemPrefix');
+
+ return $item_prefix;
+ }
+
+
+ /**
+ * Apply any custom changes to list's sql query
+ *
+ * @param kEvent $event
+ * @access protected
+ * @see OnListBuild
+ */
+ function SetCustomQuery(&$event)
+ {
+ $object =& $event->getObject();
+ switch ($event->Special)
+ {
+ case 'showall':
+ $object->clearFilters();
+ break;
+
+ case 'products':
+ $object->removeFilter('parent_filter'); // this is important
+ $object->addFilter('product_reviews', '%1$s.ItemId = pr.ResourceId');
+ // $object->addFilter('active', '%1$s.Status = 1');
+
+ /*$this->Application->setUnitOption('p', 'AutoLoad', true);
+ $product =& $this->Application->recallObject('p');
+ $object->addFilter('current_product', 'pr.ResourceId = '.$product->GetDBField('ResourceId'));*/
+ break;
+
+ case 'item':
+ $object->clearFilters();
+ $info = $object->getLinkedInfo();
+ $this->Application->setUnitOption($info['ParentPrefix'], 'AutoLoad', true);
+ $parent =& $this->Application->recallObject($info['ParentPrefix']);
+ $object->addFilter('item_reviews', '%1$s.ItemId = '.$parent->GetDBField('ResourceId'));
+ $object->addFilter('active', '%1$s.Status = 1');
+ break;
+
+ case 'product':
+ $object->clearFilters();
+ $object->addFilter('product_reviews', '%1$s.ItemId = pr.ResourceId');
+ $object->addFilter('active', '%1$s.Status = 1');
+ $this->Application->setUnitOption('p', 'AutoLoad', true);
+ $product =& $this->Application->recallObject('p');
+ $object->addFilter('current_product', 'pr.ResourceId = '.$product->GetDBField('ResourceId'));
+
+ break;
+ }
+
+ if($event->getEventParam('type') == 'current_user')
+ {
+ $user_id = $this->Application->GetVar('u_id') ? $this->Application->GetVar('u_id') : -2;
+ $ip = $_SERVER['REMOTE_ADDR'];
+ $object =& $event->getObject( Array('skip_autoload' => true) );
+ $product_info = $object->getLinkedInfo();
+ $object->addFilter('current_item', '%1$s.ItemId = '.$product_info['ParentId']);
+ $object->addFilter('current_user', '%1$s.CreatedById = '.$user_id);
+ $object->addFilter('current_ip', '%1$s.IPAddress = "'.$ip.'"');
+
+ }
+ }
+
+ /**
+ * Adds review from front in case if user is logged in
+ *
+ * @param kEvent $event
+ */
+ function OnAddReview(&$event)
+ {
+ $user_id = ($this->Application->GetVar('u_id') == 0) ? -2 : $this->Application->GetVar('u_id');
+ $event->redirect_params = Array('pass' => 'all,p');
+
+ $object =& $event->getObject( Array('skip_autoload' => true) );
+ $parent_info = $object->getLinkedInfo();
+ $review_fields = $this->Application->GetVar($event->getPrefixSpecial(true));
+
+ $sql = ' SELECT * FROM '.TABLE_PREFIX.'SpamControl
+ WHERE ItemResourceId='.$parent_info['ParentId'].'
+ AND IPaddress="'.$_SERVER['REMOTE_ADDR'].'"
+ AND PortalUserId='.$user_id.'
+ AND DataType="Review"';
+ $res = $this->Conn->GetRow($sql);
+
+ if( $res && $res['Expire'] < adodb_mktime() )
+ {
+ $sql = ' DELETE FROM '.TABLE_PREFIX.'SpamControl
+ WHERE ItemResourceId='.$parent_info['ParentId'].'
+ AND IPaddress="'.$_SERVER['REMOTE_ADDR'].'"
+ AND PortalUserId='.$user_id.'
+ AND DataType="Review"';
+ $this->Conn->Query($sql);
+ unset($res);
+ }
+
+ if(!$res)
+ {
+ $object->SetFieldsFromHash( array_shift($review_fields) );
+ $object->SetDBField('CreatedById', $user_id);
+ $object->SetDBField('IPAddress', $_SERVER['REMOTE_ADDR']);
+ $object->SetDBField('CreatedOn', adodb_mktime());
+
+ $module_info = $this->Application->findModule('Var',$parent_info['ParentPrefix']);
+ $object->SetDBField('Module', $module_info['Name']);
+ if( $this->Application->CheckPermission( $this->getPermPrefix($event).'REVIEW.PENDING', 0) )
+ {
+ $object->SetDBField('Status', 2);
+ }
+ if( $this->Application->CheckPermission($this->getPermPrefix($event).'REVIEW', 0) )
+ {
+ $object->SetDBField('Status', 1);
+ }
+
+ $object->SetDBField('ItemId', $parent_info['ParentId']);
+
+ $event->CallSubEvent('OnCreate');
+
+ if($event->status == erSUCCESS)
+ {
+ $parent =& $this->Application->recallObject($parent_info['ParentPrefix']);
+ $sql = ' SELECT COUNT(ReviewId)
+ FROM '.$object->TableName.'
+ WHERE ItemId='.$parent_info['ParentId'];
+ $review_qty = $this->Conn->GetOne($sql);
+ $parent->SetDBField('CachedReviewsQty', $review_qty);
+ $parent->Update();
+ $expire = adodb_mktime() + $this->Application->ConfigValue('product_ReviewDelay_Value') * $this->Application->ConfigValue('product_ReviewDelay_Interval');
+ $sql = ' INSERT INTO '.TABLE_PREFIX.'SpamControl
+ (ItemResourceId, IPaddress, PortalUserId, DataType, Expire)
+ VALUES ('.$parent_info['ParentId'].',
+ "'.$_SERVER['REMOTE_ADDR'].'",
+ '.$user_id.',
+ "Review",
+ '.$expire.')';
+ $this->Conn->Query($sql);
+
+ $event->redirect_params = Array('pass' => 'all,'.$parent_info['ParentPrefix']);
+ $event->redirect = $this->Application->GetVar('success_template');
+ }
+ }
+ else
+ {
+// $this->Application->removeObject($event->getPrefixSpecial());
+ $event->status == erFAIL;
+ $event->redirect=false;
+ $object->FieldErrors['ReviewText']['pseudo'] = 'too_frequent';
+ $object->ErrorMsgs['too_frequent'] = $this->Application->Phrase('lu_ferror_review_duplicate');
+ }
+ }
+ }
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.6.2/kernel/units/reviews/reviews_event_handler.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.6
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.6.2/kernel/units/categories/cache_updater.php
===================================================================
--- branches/unlabeled/unlabeled-1.6.2/kernel/units/categories/cache_updater.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.6.2/kernel/units/categories/cache_updater.php (revision 5561)
@@ -0,0 +1,360 @@
+<?php
+class clsRecursionStack
+{
+ var $Stack;
+
+ function clsRecursionStack()
+ {
+ $this->Stack = Array();
+ }
+
+ function Push($values)
+ {
+ array_push($this->Stack, $values);
+ }
+
+ function Pop()
+ {
+ if ($this->Count() > 0) {
+ return array_pop($this->Stack);
+ }
+ else {
+ return false;
+ }
+ }
+
+ function Get()
+ {
+ if ($this->Count() > 0) {
+// return end($this->Stack);
+ return $this->Stack[count($this->Stack)-1];
+ }
+ else {
+ return false;
+ }
+ }
+
+ function Update($values)
+ {
+ $this->Stack[count($this->Stack)-1] = $values;
+ }
+
+ function Count()
+ {
+ return count($this->Stack);
+ }
+}
+
+
+class clsCachedPermissions
+{
+ var $Allow = Array();
+ var $Deny = Array();
+ var $CatId;
+
+ function clsCachedPermissions($CatId)
+ {
+ $this->CatId = $CatId;
+ }
+
+ function SetCatId($CatId)
+ {
+ $this->CatId = $CatId;
+ }
+
+ function CheckPermArray($Perm)
+ {
+ if (!isset($this->Allow[$Perm])) {
+ $this->Allow[$Perm] = array();
+ $this->Deny[$Perm] = array();
+ }
+ }
+
+ function AddAllow($Perm, $GroupId)
+ {
+ $this->CheckPermArray($Perm);
+ if (!in_array($GroupId, $this->Allow[$Perm])) {
+ array_push($this->Allow[$Perm], $GroupId);
+ $this->RemoveDeny($Perm, $GroupId);
+ }
+ }
+
+ function AddDeny($Perm, $GroupId)
+ {
+ $this->CheckPermArray($Perm);
+ if (!in_array($GroupId, $this->Deny[$Perm])) {
+ array_push($this->Deny[$Perm], $GroupId);
+ $this->RemoveAllow($Perm, $GroupId);
+ }
+ }
+
+ function RemoveDeny($Perm, $GroupId)
+ {
+ if (in_array($GroupId, $this->Deny[$Perm])) {
+ array_splice($this->Deny[$Perm], array_search($GroupId, $this->Deny[$Perm]), 1);
+ }
+ }
+
+ function RemoveAllow($Perm, $GroupId)
+ {
+ if (in_array($GroupId, $this->Allow[$Perm])) {
+ array_splice($this->Allow[$Perm], array_search($GroupId, $this->Allow[$Perm]), 1);
+ }
+ }
+
+ function GetInsertSQL()
+ {
+ $values = array();
+
+ $has_deny = array();
+
+ // don't write DACL at all
+ /*foreach ($this->Deny as $perm => $groups) {
+ if (count($groups) > 0) {
+ $values[] = '('.$this->CatId.', '.$perm.', "", "'.join(',', $groups).'")';
+ $has_deny[] = $perm;
+ }
+ }*/
+
+ foreach ($this->Allow as $perm => $groups) {
+// if (in_array($perm, $has_deny)) continue;
+ if (count($groups) > 0) {
+ $values[] = '(' .$this->CatId. ', ' .$perm. ', "' .join(',', $groups). '", "")';
+ }
+ }
+ if (!$values) return '';
+ $sql = 'INSERT INTO '.TABLE_PREFIX.'PermCache (CategoryId, PermId, ACL, DACL) VALUES '.join(',', $values);
+ return $sql;
+ }
+}
+
+class kPermCacheUpdater extends kHelper
+{
+ var $Stack;
+ var $iteration;
+ var $totalCats;
+ var $doneCats;
+ var $table;
+
+ var $root_prefixes = Array();
+ var $TitleField = '';
+
+ function Init($prefix, $special, $event_params = null)
+ {
+ parent::Init($prefix, $special, $event_params);
+
+ $ml_formatter =& $this->Application->recallObject('kMultiLanguage');
+ $this->TitleField = $ml_formatter->LangFieldName('Name');
+
+ $continuing = $event_params['continue'];
+
+ foreach ($this->Application->ModuleInfo as $module_name => $module_info) {
+ $this->root_prefixes[ $module_info['RootCat'] ] = $module_info['Var'];
+ }
+
+ $this->iteration = 0;
+ $this->table = $this->Application->GetTempName('permCacheUpdate');
+
+ if ($continuing == 1) {
+ $this->InitUpdater();
+ }
+ elseif ($continuing == 2) {
+ $this->getData();
+ }
+ }
+
+ function InitUpdater($continue)
+ {
+ $this->Stack =& new clsRecursionStack();
+ $sql = 'DELETE FROM '.TABLE_PREFIX.'PermCache';
+ $this->Conn->Query($sql);
+ $this->initData();
+ }
+
+ function getDonePercent()
+ {
+ if(!$this->totalCats)return 0;
+ return intval( round( $this->doneCats / $this->totalCats * 100 ) );
+ }
+
+ function getData()
+ {
+ $tmp = $this->Conn->GetOne('SELECT data FROM '.$this->table);
+ if ($tmp) $tmp = unserialize($tmp);
+
+ $this->totalCats = isset($tmp['totalCats']) ? $tmp['totalCats'] : 0;
+ $this->doneCats = isset($tmp['doneCats']) ? $tmp['doneCats'] : 0;
+ if (isset($tmp['stack'])) {
+ $this->Stack = $tmp['stack'];
+ }
+ else {
+ $this->Stack = & new clsRecursionStack();
+ }
+ }
+
+ function setData()
+ {
+ $tmp = Array (
+ 'totalCats' => $this->totalCats,
+ 'doneCats' => $this->doneCats,
+ 'stack' => $this->Stack,
+ );
+
+ $this->Conn->Query('DELETE FROM '.$this->table);
+
+ $fields_hash = Array('data' => serialize($tmp));
+ $this->Conn->doInsert($fields_hash, $this->table);
+ }
+
+ function initData()
+ {
+ $this->clearData(); // drop table before starting anyway
+
+ $this->Conn->Query('CREATE TABLE '.$this->table.'(data LONGTEXT)');
+
+ $this->totalCats = (int)$this->Conn->GetOne('SELECT COUNT(*) FROM '.TABLE_PREFIX.'Category');
+ $this->doneCats = 0;
+ }
+
+ function clearData()
+ {
+ $this->Conn->Query('DROP TABLE IF EXISTS '.$this->table);
+ }
+
+ function DoTheJob()
+ {
+ $data = $this->Stack->Get();
+ if ($data === false) { //If Stack is empty
+ $data['current_id'] = 0;
+ $data['title'] = Array();
+ $data['named_path'] = Array();
+ $data['category_template'] = '';
+ $data['item_template'] = '';
+ $this->Stack->Push($data);
+ }
+
+ if (!isset($data['queried'])) {
+ $this->QueryTitle($data);
+ $this->QueryChildren($data);
+ $this->QueryPermissions($data);
+ $data['queried'] = 1;
+
+ if ($sql = $data['perms']->GetInsertSQL()) {
+ $this->Conn->Query($sql);
+ $this->doneCats++;
+ }
+ $this->iteration++;
+ }
+
+ // start with first child if we haven't started yet
+ if (!isset($data['current_child'])) $data['current_child'] = 0;
+
+ // if we have more children
+ if (isset($data['children'][$data['current_child']])) {
+ $next_data = Array();
+ $next_data['title'] = $data['title'];
+ $next_data['named_path'] = $data['named_path'];
+ $next_data['category_template'] = $data['category_template'];
+ $next_data['item_template'] = $data['item_template'];
+ $next_data['current_id'] = $data['children'][ $data['current_child'] ]; //next iteration should process child
+ $next_data['perms'] = $data['perms']; //we should copy our permissions to child - inheritance
+ $next_data['perms']->SetCatId($next_data['current_id']);
+ $data['current_child']++;
+ $this->Stack->Update($data); //we need to update ourself for the iteration after the next (or further) return to next child
+ $this->Stack->Push($next_data); //next iteration should process this child
+ return true;
+ }
+ else {
+ $this->UpdateCachedPath($data);
+ $this->Stack->Pop(); //remove ourself from stack if we have finished all the childs (or there are none)
+ // we are getting here if we finished with current level, so check if it's first level - then bail out.
+ return $this->Stack->Count() > 0;
+ }
+ }
+
+ function UpdateCachedPath(&$data)
+ {
+ $fields_hash = Array( 'CachedNavbar' => implode('>', $data['title']),
+ 'NamedParentPath' => implode('/', $data['named_path'] ),
+ 'CachedCategoryTemplate'=> $data['category_template'],
+ 'CachedItemTemplate' => $data['item_template'],
+ );
+
+ $this->Conn->doUpdate($fields_hash, TABLE_PREFIX.'Category', 'CategoryId = '.$data['current_id']);
+ }
+
+ function QueryTitle(&$data)
+ {
+ $category_id = $data['current_id'];
+ $sql = 'SELECT '.$this->TitleField.', Filename, CategoryTemplate, ItemTemplate
+ FROM '.TABLE_PREFIX.'Category
+ WHERE CategoryId = '.$category_id;
+
+ $record = $this->Conn->GetRow($sql);
+ if ($record) {
+ $data['title'][] = $record[$this->TitleField];
+ $data['named_path'][] = $record['Filename'];
+
+ // it is one of the modules root category
+ $root_prefix = isset($this->root_prefixes[$category_id]) ? $this->root_prefixes[$category_id] : false;
+ if ($root_prefix) {
+ $fields_hash = Array();
+ if (!$record['CategoryTemplate']) {
+ $record['CategoryTemplate'] = $this->Application->ConfigValue($root_prefix.'_CategoryTemplate');
+ $fields_hash['CategoryTemplate'] = $record['CategoryTemplate'];
+ }
+
+ if (!$record['ItemTemplate']) {
+ $record['ItemTemplate'] = $this->Application->ConfigValue($root_prefix.'_ItemTemplate');
+ $fields_hash['ItemTemplate'] = $record['ItemTemplate'];
+ }
+
+ $this->Conn->doUpdate($fields_hash, TABLE_PREFIX.'Category', 'CategoryId = '.$category_id);
+ }
+
+ // if explicitly set, then use it; use parent template otherwise
+ if ($record['CategoryTemplate']) {
+ $data['category_template'] = $record['CategoryTemplate'];
+ }
+
+ if ($record['ItemTemplate']) {
+ $data['item_template'] = $record['ItemTemplate'];
+ }
+ }
+
+ }
+
+ function QueryChildren(&$data)
+ {
+ $sql = 'SELECT CategoryId
+ FROM '.TABLE_PREFIX.'Category
+ WHERE ParentId = '.$data['current_id'];
+ $data['children'] = $this->Conn->GetCol($sql);
+ }
+
+ function QueryPermissions(&$data)
+ {
+ // don't search for section "view" permissions here :)
+ $sql = 'SELECT ipc.PermissionConfigId, ip.GroupId, ip.PermissionValue
+ FROM '.TABLE_PREFIX.'Permissions AS ip
+ LEFT JOIN '.TABLE_PREFIX.'PermissionConfig AS ipc ON ipc.PermissionName = ip.Permission
+ WHERE (CatId = '.$data['current_id'].') AND (Permission LIKE "%.VIEW") AND (ip.Type = 0)';
+
+ $records = $this->Conn->Query($sql);
+
+ //create permissions array only if we don't have it yet (set by parent)
+ if (!isset($data['perms'])) {
+ $data['perms'] = new clsCachedPermissions($data['current_id']);
+ }
+
+ foreach ($records as $record) {
+ if ($record['PermissionValue'] == 1) {
+ $data['perms']->AddAllow($record['PermissionConfigId'], $record['GroupId']);
+ }
+ else {
+ $data['perms']->AddDeny($record['PermissionConfigId'], $record['GroupId']);
+ }
+ }
+ }
+}
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.6.2/kernel/units/categories/cache_updater.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.6
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.6.2/kernel/units/modules/modules_config.php
===================================================================
--- branches/unlabeled/unlabeled-1.6.2/kernel/units/modules/modules_config.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.6.2/kernel/units/modules/modules_config.php (revision 5561)
@@ -0,0 +1,121 @@
+<?php
+
+$config = Array(
+ 'Prefix' => 'mod',
+ 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
+ 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
+ 'EventHandlerClass' => Array('class'=>'ModulesEventHandler','file'=>'modules_event_handler.php','build_event'=>'OnBuild'),
+ 'TagProcessorClass' => Array('class'=>'ModulesTagProcessor','file'=>'modules_tag_processor.php','build_event'=>'OnBuild'),
+ 'AutoLoad' => true,
+ 'QueryString' => Array(
+ 1 => 'id',
+ 2 => 'page',
+ 3 => 'event',
+ 4 => 'mode',
+ ),
+
+ 'IDField' => 'Name',
+ 'TitleField' => 'Name', // field, used in bluebar when editing existing item
+ 'StatusField' => Array('Loaded'),
+
+ 'TitlePresets' => Array(
+ 'modules_list' => Array( 'prefixes' => Array('mod_List'), 'format' => "!la_title_Configuration! - !la_title_Module_Status! (#mod_recordcount#)"),
+
+ 'tree_modules' => Array('format' => '!la_section_overview!'),
+ ),
+
+ 'PermSection' => Array('main' => 'in-portal:mod_status'),
+
+ 'Sections' => Array(
+ // "Configuration" -> "Modules and Settings"
+ 'in-portal:modules' => Array(
+ 'parent' => 'in-portal:system',
+ 'icon' => 'modules',
+ 'label' => 'la_tab_ModulesManagement',
+ 'url' => Array('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 5,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:mod_status' => Array(
+ 'parent' => 'in-portal:modules',
+ 'icon' => 'modules',
+ 'label' => 'la_title_Module_Status',
+ 'url' => Array('t' => 'modules/modules_list', 'pass' => 'm'),
+ 'permissions' => Array('view', 'edit', 'advanced:approve', 'advanced:decline'),
+ 'priority' => 1,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:addmodule' => Array(
+ 'parent' => 'in-portal:modules',
+ 'icon' => 'modules',
+ 'label' => 'la_title_Add_Module',
+ 'url' => Array('index_file' => 'modules/addmodule.php', 'pass' => 'm'),
+ 'permissions' => Array('view', 'add', 'edit'),
+ 'priority' => 2,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:tag_library' => Array(
+ 'parent' => 'in-portal:modules',
+ 'icon' => 'modules',
+ 'label' => 'la_tab_TagLibrary',
+ 'url' => Array('index_file' => 'tag_listing.php', 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 3,
+ 'type' => stTREE,
+ ),
+ ),
+
+ 'TableName' => TABLE_PREFIX.'Modules',
+
+ 'FilterMenu' => Array(
+ 'Groups' => Array(
+ Array('mode' => 'AND', 'filters' => Array('enabled', 'disabled'), 'type' => WHERE_FILTER),
+ ),
+ 'Filters' => Array(
+ 'enabled' => Array('label' =>'la_Enabled', 'on_sql' => '', 'off_sql' => '%1$s.Loaded != 1'),
+ 'disabled' => Array('label' => 'la_Disabled', 'on_sql' => '', 'off_sql' => '%1$s.Loaded != 0'),
+ )
+ ),
+
+ 'ListSQLs' => Array( ''=>'SELECT * FROM %s',
+ ), // key - special, value - list select sql
+ 'ItemSQLs' => Array( ''=>'SELECT * FROM %s',
+ ),
+ 'ListSortings' => Array(
+ '' => Array(
+ 'Sorting' => Array('LoadOrder' => 'asc'),
+ )
+ ),
+
+ 'Fields' => Array(
+ 'Name' => Array('type' => 'string','not_null' => '1','default' => ''),
+ 'Path' => Array('type' => 'string','not_null' => '1','default' => ''),
+ 'Var' => Array('type' => 'string','not_null' => '1','default' => ''),
+ 'Version' => Array('type' => 'string','not_null' => '1','default' => ''),
+ 'Loaded' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array(1 => 'la_Enabled', 0 => 'la_Disabled'), 'use_phrases' => 1, 'not_null' => '1','default' => '1'),
+ 'LoadOrder' => Array('type' => 'int','not_null' => '1','default' => '0'),
+ 'TemplatePath' => Array('type' => 'string','not_null' => '1','default' => ''),
+ 'RootCat' => Array('type' => 'int','not_null' => '1','default' => '0'),
+ 'BuildDate' => Array('type' => 'double', 'formatter' => 'kDateFormatter', 'not_null' => '1','default' => ''),
+ ),
+
+ 'VirtualFields' => Array(),
+
+ 'Grids' => Array(
+ 'Default' => Array(
+ 'Icons' => Array('default' => 'icon16_custom.gif'),
+ 'Fields' => Array(
+ 'Name' => Array('title' => 'la_col_Name', 'data_block' => 'grid_checkbox_td_no_icon'),
+ 'Loaded' => Array('title' => 'la_col_Status'),
+ 'Version' => Array('title' => 'la_col_Version'),
+ ),
+
+ ),
+ ),
+ );
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.6.2/kernel/units/modules/modules_config.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.6
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.6.2/kernel/units/permissions/permissions_event_handler.php
===================================================================
--- branches/unlabeled/unlabeled-1.6.2/kernel/units/permissions/permissions_event_handler.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.6.2/kernel/units/permissions/permissions_event_handler.php (revision 5561)
@@ -0,0 +1,183 @@
+<?php
+
+class PermissionsEventHandler extends InpDBEventHandler {
+
+ /**
+ * Allows to override standart permission mapping
+ *
+ */
+ function mapPermissions()
+ {
+ parent::mapPermissions();
+ $permissions = Array(
+ 'OnGroupSavePermissions' => Array('subitem' => 'advanced:manage_permissions'),
+ );
+ $this->permMapping = array_merge($this->permMapping, $permissions);
+ }
+
+ /**
+ * Save category permissions
+ *
+ * @param kEvent $event
+ */
+ function OnCategorySavePermissions(&$event)
+ {
+ $group_id = $this->Application->GetVar('current_group_id');
+ $category_id = $this->Application->GetVar('c_id');
+ $permissions = $this->Application->GetVar($event->getPrefixSpecial(true));
+ if (isset($permissions[$group_id])) {
+ $permissions = $permissions[$group_id];
+
+ $object =& $event->getObject( Array('skip_autoload' => true) );
+ $permissions_helper =& $this->Application->recallObject('PermissionsHelper');
+ $permissions_helper->LoadPermissions($group_id, $category_id, 0, true);
+
+ // format: <perm_name>['inherited'] || <perm_name>['value']
+
+ $delete_ids = Array();
+ $create_sql = Array();
+ $update_sql = Array();
+ $create_mask = '(%s,%s,'.$group_id.',%s,0,'.$category_id.')';
+ $new_id = (int)$this->Conn->GetOne('SELECT MIN('.$object->IDField.') FROM '.$object->TableName);
+ if($new_id > 0) $new_id = 0;
+ --$new_id;
+
+ foreach ($permissions as $perm_name => $perm_data) {
+ $inherited = $perm_data['inherited'];
+ $perm_value = isset($perm_data['value']) ? $perm_data['value'] : false;
+ $perm_id = $permissions_helper->getPermissionID($perm_name);
+
+ if ($inherited && ($perm_id != 0)) {
+ // permission become inherited (+ direct value was set before) => DELETE
+ $delete_ids[] = $permissions_helper->getPermissionID($perm_name);
+ }
+
+ if (!$inherited) {
+ // not inherited
+ if (($perm_id != 0) && ($perm_value != $permissions_helper->getPermissionValue($perm_name))) {
+ // record was found in db & new value differs from old one => UPDATE
+ $update_sql[] = ' UPDATE '.$object->TableName.'
+ SET PermissionValue = '.$perm_value.'
+ WHERE (PermissionId = '.$perm_id.')';
+ }
+
+ if ($perm_id == 0) {
+ // not found in db, but set directly => INSERT
+ $create_sql[] = sprintf($create_mask, $new_id--, $this->Conn->qstr($perm_name), $this->Conn->qstr($perm_value));
+ }
+ }
+ // permission state was not changed in all other cases
+ }
+
+ $this->UpdatePermissions($event, $create_sql, $update_sql, $delete_ids);
+ }
+
+ $event->MasterEvent->SetRedirectParam('item_prefix', $this->Application->GetVar('item_prefix'));
+ $event->MasterEvent->SetRedirectParam('group_id', $this->Application->GetVar('group_id'));
+ }
+
+ /**
+ * Saves permissions while editing group
+ *
+ * @param kEvent $event
+ */
+ function OnGroupSavePermissions(&$event)
+ {
+ if (!$this->Application->CheckPermission('in-portal:user_groups.advanced:manage_permissions', 1)) {
+ // no permission to save permissions
+ return false;
+ }
+
+ $permissions = $this->Application->GetVar($event->getPrefixSpecial(true));
+ if (!$permissions) {
+ return false;
+ }
+
+ $object =& $event->getObject( Array('skip_autoload' => true) );
+ $group_id = $this->Application->GetVar('g_id');
+ $permissions_helper =& $this->Application->recallObject('PermissionsHelper');
+ $permissions_helper->LoadPermissions($group_id, 0, 1);
+
+ $delete_ids = Array();
+ $create_sql = Array();
+ $create_mask = '(%s,%s,'.$group_id.',%s,1,0)';
+
+ $new_id = (int)$this->Conn->GetOne('SELECT MIN('.$object->IDField.') FROM '.$object->TableName);
+ if($new_id > 0) $new_id = 0;
+ --$new_id;
+
+ foreach ($permissions as $section_name => $section_permissions) {
+ foreach ($section_permissions as $perm_name => $perm_value) {
+
+ if (!$permissions_helper->isOldPermission($section_name, $perm_name)) {
+ $perm_name = $section_name.'.'.$perm_name;
+ }
+
+ $db_perm_value = $permissions_helper->getPermissionValue($perm_name);
+ if ($db_perm_value == 1 && $perm_value == 0) {
+ // permission was disabled => delete it's record
+ $delete_ids[] = $permissions_helper->getPermissionID($perm_name);
+ }
+ elseif ($db_perm_value == 0 && $perm_value == 1) {
+ // permission was enabled => created it's record
+ $create_sql[] = sprintf($create_mask, $new_id--, $this->Conn->qstr($perm_name), $this->Conn->qstr($perm_value));
+ }
+ // permission state was not changed in all other cases
+ }
+ }
+
+ $this->UpdatePermissions($event, $create_sql, Array(), $delete_ids);
+
+ if ($this->Application->GetVar('advanced_save') == 1) {
+ // advanced permission popup [save button]
+ $this->finalizePopup($event);
+// $event->redirect = 'incs/just_close';
+ }
+ elseif ($this->Application->GetVar('section_name') != '') {
+ // save simple permissions before opening advanced permission popup
+ $event->redirect = false;
+ }
+
+ }
+
+ /**
+ * Apply modification sqls to permissions table
+ *
+ * @param kEvent $event
+ * @param Array $create_sql
+ * @param Array $update_sql
+ * @param Array $delete_ids
+ */
+ function UpdatePermissions(&$event, $create_sql, $update_sql, $delete_ids)
+ {
+ $object =& $event->getObject();
+
+ if ($delete_ids) {
+ $delete_sql = ' DELETE FROM '.$object->TableName.'
+ WHERE '.$object->IDField.' IN ('.implode(',', $delete_ids).')';
+ $this->Conn->Query($delete_sql);
+ }
+
+ if ($create_sql) {
+ $create_sql = ' INSERT INTO '.$object->TableName.'
+ VALUES '.implode(',', $create_sql);
+ $this->Conn->Query($create_sql);
+ }
+
+ if ($update_sql) {
+ foreach ($update_sql as $sql) {
+ $this->Conn->Query($sql);
+ }
+ }
+
+ if ($delete_ids || $create_sql || $update_sql) {
+ $object->setModifiedFlag();
+
+ if ($event->Name == 'OnCategorySavePermissions') {
+ $this->Application->StoreVar('PermCache_UpdateRequired', 1);
+ }
+ }
+ }
+}
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.6.2/kernel/units/permissions/permissions_event_handler.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.6
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.6.2/kernel/admin_templates/categories/permissions_tab.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.6.2/kernel/admin_templates/categories/permissions_tab.tpl (nonexistent)
+++ branches/unlabeled/unlabeled-1.6.2/kernel/admin_templates/categories/permissions_tab.tpl (revision 5561)
@@ -0,0 +1,72 @@
+<inp2:m_if check="m_ParamEquals" name="tab_init" value="1">
+ <div id="<inp2:m_param name="item_prefix"/>_div" prefix="<inp2:m_param name="item_prefix"/>" group_id="-1" class="catalog-tab"></div>
+ <script type="text/javascript">$PermManager.registerTab('<inp2:m_param name="item_prefix"/>');</script>
+<inp2:m_else/>
+ if ($request_visible) {
+ document.getElementById('<inp2:m_get name="item_prefix"/>_div').setAttribute('group_id', <inp2:m_get name="group_id"/>);
+ }
+ <inp2:m_if check="c_SaveWarning">
+ document.getElementById('save_warning').style.display = 'block';
+ $edit_mode = true;
+ </inp2:m_if>
+ #separator#
+ <inp2:m_DefineElement name="permission_element">
+ <tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>">
+ <td>
+ <inp2:m_phrase name="$Description"/> [<inp2:m_param name="PermissionName"/>]
+ </td>
+
+ <td>
+ <!-- Inherited checkbox -->
+ <input
+ type="hidden"
+ id="<inp2:PermInputName sub_key="inherited"/>"
+ name="<inp2:PermInputName sub_key="inherited"/>"
+ value="<inp2:m_if check="m_ParamEquals" name="Inherited" value="1">1<inp2:m_else/>0</inp2:m_if>" />
+
+ <input
+ type="checkbox"
+ id="_cb_<inp2:PermInputName sub_key="inherited"/>"
+ <inp2:m_if check="m_ParamEquals" name="Inherited" value="1">checked</inp2:m_if>
+ onchange="update_checkbox(this, document.getElementById('<inp2:PermInputName sub_key="inherited"/>'));"
+ onclick="inherited_click('<inp2:m_param name="PermissionName"/>', <inp2:m_param name="InheritedValue"/>, this.checked, '_cb_<inp2:PermInputName sub_key="value"/>')" />
+ </td>
+
+ <td>
+ <inp2:CategoryPath cat_id="$InheritedFrom"/>
+ </td>
+
+ <td>
+ <!-- Access checkbox -->
+ <input
+ type="hidden"
+ id="<inp2:PermInputName sub_key="value"/>"
+ name="<inp2:PermInputName sub_key="value"/>"
+ value="<inp2:m_if check="m_ParamEquals" name="Value" value="1">1<inp2:m_else/>0</inp2:m_if>" />
+
+ <input
+ type="checkbox"
+ id="_cb_<inp2:PermInputName sub_key="value"/>"
+ <inp2:m_if check="m_ParamEquals" name="Inherited" value="1">disabled="disabled"</inp2:m_if>
+ <inp2:m_if check="m_ParamEquals" name="Value" value="1">checked</inp2:m_if>
+ onchange="update_checkbox(this, document.getElementById('<inp2:PermInputName sub_key="value"/>'));"
+ onclick="update_light('<inp2:m_param name="PermissionName"/>', this.checked)" />
+ </td>
+
+ <td>
+ <img id="light_<inp2:m_param name="PermissionName"/>" src="<inp2:m_TemplatesBase/>/img/perm_<inp2:m_if check="m_ParamEquals" name="Value" value="1">green<inp2:m_else/>red</inp2:m_if>.gif"/>
+ </td>
+ </tr>
+ </inp2:m_DefineElement>
+ <table width="100%" border="0" cellspacing="0" cellpadding="4" class="tableborder_full">
+ <inp2:m_set odd_even="table_color1"/>
+ <thead class="subsectiontitle">
+ <td><inp2:m_phrase name="la_col_Description"/></td>
+ <td><inp2:m_phrase name="la_col_Inherited"/></td>
+ <td><inp2:m_phrase name="la_col_InheritedFrom"/></td>
+ <td><inp2:m_phrase name="la_col_Access"/></td>
+ <td><inp2:m_phrase name="la_col_Effective"/></td>
+ </thead>
+ <inp2:c-perm_PrintPermissions render_as="permission_element"/>
+ </table>
+</inp2:m_if>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.6.2/kernel/admin_templates/categories/permissions_tab.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.6
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.6.2/kernel/admin_templates/stylesheets/stylesheets_edit_base.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.6.2/kernel/admin_templates/stylesheets/stylesheets_edit_base.tpl (nonexistent)
+++ branches/unlabeled/unlabeled-1.6.2/kernel/admin_templates/stylesheets/stylesheets_edit_base.tpl (revision 5561)
@@ -0,0 +1,103 @@
+<inp2:m_RequireLogin permissions="in-portal:configure_styles.view" system="1"/>
+<inp2:m_include t="incs/header" nobody="yes"/>
+
+<body topmargin="0" leftmargin="8" marginheight="0" marginwidth="8" bgcolor="#FFFFFF">
+<inp2:m_ParseBlock name="section_header" icon="icon46_style" title="!la_title_Stylesheets!"/>
+
+<inp2:m_include t="stylesheets/stylesheets_tabs"/>
+
+<inp2:m_ParseBlock name="blue_bar" prefix="css" title_preset="base_styles" module="in-portal" icon="icon46_style"/>
+
+<!-- ToolBar --->
+<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
+<tbody>
+ <tr>
+ <td>
+ <script type="text/javascript">
+ a_toolbar = new ToolBar();
+ a_toolbar.AddButton( new ToolBarButton('select', '<inp2:m_phrase label="la_ToolTip_Save" escape="1"/>', function() {
+ submit_event('css','<inp2:css_SaveEvent/>');
+ }
+ ) );
+ a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
+ submit_event('css','OnCancelEdit');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep1') );
+
+ a_toolbar.AddButton( new ToolBarButton('prev', '<inp2:m_phrase label="la_ToolTip_Prev" escape="1"/>', function() {
+ go_to_id('css', '<inp2:css_PrevId/>');
+ }
+ ) );
+ a_toolbar.AddButton( new ToolBarButton('next', '<inp2:m_phrase label="la_ToolTip_Next" escape="1"/>', function() {
+ go_to_id('css', '<inp2:css_NextId/>');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep2') );
+
+ a_toolbar.AddButton( new ToolBarButton('new_selector', '<inp2:m_phrase label="la_ToolTip_NewBaseStyle" escape="1"/>',
+ function() {
+ set_hidden_field('remove_specials[selectors.base]',1);
+ std_new_item('selectors.base', 'stylesheets/base_style_edit')
+ } ) );
+
+ function edit()
+ {
+ set_hidden_field('remove_specials[selectors.base]',1);
+ std_edit_temp_item('selectors.base', 'stylesheets/base_style_edit');
+ }
+
+ a_toolbar.AddButton( new ToolBarButton('edit', '<inp2:m_phrase label="la_ToolTip_Edit" escape="1"/>', edit) );
+ a_toolbar.AddButton( new ToolBarButton('delete', '<inp2:m_phrase label="la_ToolTip_Delete" escape="1"/>',
+ function() {
+ std_delete_items('selectors.base')
+ } ) );
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep3') );
+
+ a_toolbar.AddButton( new ToolBarButton('clone', '<inp2:m_phrase label="la_ToolTip_Clone" escape="1"/>', function() {
+ set_hidden_field('remove_specials[selectors.base]',1);
+ submit_event('selectors.base','OnMassClone');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep4') );
+
+ a_toolbar.AddButton( new ToolBarButton('view', '<inp2:m_phrase label="la_ToolTip_View" escape="1"/>', function() {
+ show_viewmenu(a_toolbar,'view');
+ }
+ ) );
+
+ a_toolbar.Render();
+
+ <inp2:m_if prefix="css" function="IsSingle"/>
+ a_toolbar.HideButton('prev');
+ a_toolbar.HideButton('next');
+ a_toolbar.HideButton('sep1');
+ //a_toolbar.HideButton('sep2');
+ <inp2:m_else/>
+ <inp2:m_if prefix="css" function="IsLast"/>
+ a_toolbar.DisableButton('next');
+ <inp2:m_endif/>
+ <inp2:m_if prefix="css" function="IsFirst"/>
+ a_toolbar.DisableButton('prev');
+ <inp2:m_endif/>
+ <inp2:m_endif/>
+ </script>
+ </td>
+ </tr>
+</tbody>
+</table>
+
+<inp2:m_block name="grid_description_td" />
+ <td valign="top" class="text"><inp2:$PrefixSpecial_field field="$field" grid="$grid" no_special="$no_special" cut_first="100"/></td>
+<inp2:m_blockend />
+
+<inp2:m_ParseBlock name="grid" PrefixSpecial="selectors.base" IdField="SelectorId" grid="Default" header_block="grid_column_title" data_block="grid_data_td" search="on"/>
+<script type="text/javascript">
+ Grids['selectors.base'].SetDependantToolbarButtons( new Array('edit','delete','clone') );
+</script>
+
+<inp2:m_include t="incs/footer"/>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.6.2/kernel/admin_templates/stylesheets/stylesheets_edit_base.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.6
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.6.2/kernel/admin_templates/help.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.6.2/kernel/admin_templates/help.tpl (nonexistent)
+++ branches/unlabeled/unlabeled-1.6.2/kernel/admin_templates/help.tpl (revision 5561)
@@ -0,0 +1,61 @@
+<inp2:m_include t="incs/header" nobody="yes"/>
+
+<body topmargin="0" leftmargin="8" marginheight="0" marginwidth="8" bgcolor="#FFFFFF">
+
+<!-- section header: begin -->
+ <table cellpadding="0" cellspacing="0" border="0" width="100%">
+ <tr class="section_header_bg">
+ <td valign="top" class="admintitle" align="left">
+ <img width="46" height="46" src="img/icons/<inp2:h_GetIcon var_name="h_icon" default_icon="icon46_help"/>.gif" align="absmiddle" title="<inp2:m_phrase name="la_Help"/>">&nbsp;<inp2:m_phrase name="la_Help"/><br>
+ <img src="img/spacer.gif" width="1" height="4"><br>
+ </td>
+ </tr>
+ </table>
+<!-- section header: end -->
+
+<!-- blue_bar: begin -->
+ <table border="0" cellpadding="2" cellspacing="0" class="tableborder_full" width="100%" height="30">
+ <tr>
+ <td class="header_left_bg" nowrap width="80%" valign="middle">
+ <span class="tablenav_link"><inp2:h_SectionTitle/></span>
+ </td>
+ <td align="right" class="tablenav" width="20%" valign="middle">
+ </td>
+ </tr>
+ </table>
+<!-- blue_bar: end -->
+<inp2:m_if check="m_ConstOn" name="DBG_HELP">
+<!-- ToolBar --->
+<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
+<tbody>
+ <tr>
+ <td>
+ <script type="text/javascript">
+ a_toolbar = new ToolBar();
+ a_toolbar.AddButton( new ToolBarButton('select', '<inp2:m_phrase label="la_ToolTip_Save" escape="1"/>', function() {
+ submit_event('h','OnSaveHelp');
+ }
+ ) );
+ a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
+ window.close();
+ }
+ ) );
+ a_toolbar.Render();
+ </script>
+ </td>
+ </tr>
+</tbody>
+</table>
+</inp2:m_if>
+<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
+<tbody>
+ <tr>
+ <td class="help_box">
+ <inp2:h_ShowHelp/>
+ </td>
+ </tr>
+</tbody>
+</table>
+
+<inp2:m_include t="incs/footer"/>
+
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.6.2/kernel/admin_templates/help.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.6
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.6.2/kernel/admin/include/toolbar/editcategory_relationselect.php
===================================================================
--- branches/unlabeled/unlabeled-1.6.2/kernel/admin/include/toolbar/editcategory_relationselect.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.6.2/kernel/admin/include/toolbar/editcategory_relationselect.php (revision 5561)
@@ -0,0 +1,799 @@
+<?php
+global $objConfig,$objSections,$section, $rootURL,$adminURL,$imagesURL,$envar,
+ $m_var_list_update,$objCatList, $homeURL, $upURL, $objSession,$CatScopeClause,$DefaultTab;
+
+global $CategoryFilter,$TotalItemCount;
+
+global $Bit_All,$Bit_Pending,$Bit_Disabled,$Bit_New,$Bit_Pop,$Bit_Hot,$Bit_Ed;
+
+global $hideSelectAll;
+
+
+/* bit place holders for category view menu */
+$Bit_Active=64;
+$Bit_Pending=32;
+$Bit_Disabled=16;
+$Bit_New=8;
+$Bit_Pop=4;
+$Bit_Hot=2;
+$Bit_Ed=1;
+
+if(strlen($_GET["SetTab"]))
+{
+ if($_GET["SetTab"] != "categories")
+ {
+ $m_tab_CatTab_Hide = 1;
+ $DefaultTab = $_GET["SetTab"];
+ }
+ else
+ {
+ $DefaultTab="categories";
+ $m_tab_CatTab_Hide = 0;
+ }
+}
+else
+ $m_tab_CatTab_Hide = (int)$objConfig->Get("CatTab_Hide");
+
+$CategoryView = $objConfig->Get("Category_View");
+if(!is_numeric($CategoryView))
+{
+ $CategoryView = 127;
+}
+
+$Category_Sortfield = $objConfig->Get("Category_Sortfield");
+if(!strlen($Category_Sortfield))
+ $Category_Sortfield = "Name";
+
+$Category_Sortorder = $objConfig->Get("Category_Sortorder");
+if(!strlen($Category_Sortorder))
+ $Category_Sortorder = "desc";
+
+$Perpage_Category = (int)$objConfig->Get("Perpage_Category");
+if(!$Perpage_Category)
+ $Perpage_Category="'all'";
+
+
+if($CategoryView == 127)
+{
+ $Category_ShowAll = 1;
+}
+else
+{
+ $Category_ShowAll=0;
+ $Status = array();
+ $Mod = array();
+ if($CategoryView & $Bit_Pending)
+ $Status[] = STATUS_PENDING;
+
+ if($CategoryView & $Bit_Active)
+ $Status[] = STATUS_ACTIVE;
+
+
+ if($CategoryView & $Bit_Disabled)
+ $Status[] = STATUS_DISABLED;
+
+ if(count($Status))
+ {
+ $CategoryFilter .= " AND (Status IN (".implode(",",$Status).") ";
+ }
+ else
+ $CategoryFilter .= " AND ((Status=-1) ";
+
+ if($CategoryView & $Bit_Ed)
+ {
+ $CategoryFilter .= " OR (EditorsPick=1) ";
+ }
+
+ if($CategoryView & $Bit_New)
+ {
+ $cutoff = adodb_date("U") - ($objConfig->Get("Category_DaysNew") * 86400);
+ $CategoryFilter .= " OR (CreatedOn > ".$cutoff.") ";
+ }
+ $CategoryFilter .= ")";
+}
+
+$list = $objSession->GetVariable("SearchWord");
+if(strlen($list))
+{
+ $CatScope = $objSession->GetVariable("SearchScope");
+ switch($CatScope)
+ {
+ case 0 :
+ $CatScopeClause = "";
+ break;
+ case 1:
+ $cat = $objCatList->CurrentCategoryID();
+ if($cat>0)
+ {
+ $allcats = $objCatList->AllSubCats($cat);
+ if(count($allcats)>0)
+ {
+ $catlist = implode(",",$allcats);
+ $CatScopeClause = " CategoryId IN ($catlist) ";
+ }
+ }
+ break;
+ case 2:
+ $CatScopeClause = "CategoryId=".$objCatList->CurrentCategoryID();
+ break;
+ }
+}
+else
+ $CatScopeClause="";
+
+$mnuClearSearch = language("la_SearchMenu_Clear");
+$mnuNewSearch = language("la_SearchMenu_New");
+$mnuSearchCategory = language("la_SearchMenu_Categories");
+
+$lang_New = language("la_Text_New");
+$lang_Hot = language("la_Text_Hot");
+$lang_EdPick = language("la_prompt_EditorsPick");
+$lang_Pop = language("la_Text_Pop");
+
+$lang_Rating = language("la_prompt_Rating");
+$lang_Hits = language("la_prompt_Hits");
+$lang_Votes = language("la_prompt_Votes");
+$lang_Name = language("la_prompt_Name");
+
+$lang_Categories = language("la_ItemTab_Categories");
+$lang_Description = language("la_prompt_Description");
+$lang_MetaKeywords = language("la_prompt_MetaKeywords");
+$lang_SubSearch = language("la_prompt_SubSearch");
+$lang_Within = language("la_Text_Within");
+$lang_Current = language("la_Text_Current");
+$lang_Active = language("la_Text_Active");
+$lang_SubCats = language("la_Text_SubCats");
+$lang_SubItems = language("la_Text_Subitems");
+
+$selector = isset($_GET['Selector']) ? '&Selector='.$_GET['Selector'] : '';
+$destform = GetVar('destform');
+print <<<END
+
+<script language="JavaScript">
+var Category_Sortfield = '$Category_Sortfield';
+var Category_Sortorder = '$Category_Sortorder';
+var Category_Perpage = $Perpage_Category;
+var Category_ShowAll = $Category_ShowAll;
+var CategoryView = $CategoryView;
+var default_tab = "$DefaultTab";
+
+//JS Language variables
+var lang_New = "$lang_New";
+var lang_Hot = "$lang_Hot";
+var lang_EdPick = "$lang_EdPick";
+
+var lang_Pop = "$lang_Pop";
+var lang_Rating = "$lang_Rating";
+var lang_Hits = "$lang_Hits";
+var lang_Votes = "$lang_Votes";
+var lang_Name = "$lang_Name";
+var lang_Categories = "$lang_Categories";
+var lang_Description = "$lang_Description";
+var lang_MetaKeywords = "$lang_MetaKeywords";
+var lang_SubSearch = "$lang_SubSearch";
+var lang_Within="$lang_Within";
+var lang_Current = "$lang_Current";
+var lang_Active = "$lang_Active";
+var lang_SubCats = "$lang_SubCats";
+var lang_SubItems = "$lang_SubItems";
+
+var m_tab_CatTab_hide = $m_tab_CatTab_Hide;
+var hostname = '$rootURL';
+var env = '$envar';
+var actionlist = new Array();
+var homeURL = "$homeURL$selector&destform=$destform";
+var upURL = "$upURL$selector&destform=$destform";
+var Categories_Paste = false;
+
+ // K4 code for handling toolbar operations: begin
+ var \$TabRegistry = Array();
+
+ function InpGrid(tab)
+ {
+ this.TabId = tab;
+ }
+
+ InpGrid.prototype.ClearSelection = function(force,called_from)
+ {
+ unselectAll(this.TabId, 1); //1 means don't upate toolbar
+ }
+
+ function registerTab(\$tab_id)
+ {
+ var \$tab = document.getElementById(\$tab_id);
+ var \$index = \$TabRegistry.length;
+
+ \$TabRegistry[\$index] = new Array();
+ \$TabRegistry[\$index]['tab_id'] = \$tab_id;
+ \$TabRegistry[\$index]['prefix_special'] = \$tab.getAttribute('PrefixSpecial');
+ \$TabRegistry[\$index]['edit_template'] = \$tab.getAttribute('EditURL');
+ }
+
+ function queryTabRegistry(\$search_key, \$search_value, \$return_key)
+ {
+ var \$i = 0;
+ while(\$i < \$TabRegistry.length)
+ {
+ if(\$TabRegistry[\$i][\$search_key] == \$search_value)
+ {
+ return \$TabRegistry[\$i][\$return_key];
+ break;
+ }
+ \$i++;
+ }
+ return '<'+\$search_key+'='+\$search_value+'>';
+ }
+
+ function k4_actionHandler(action, prefix_special)
+ {
+ var k4_action = '';
+ switch (action)
+ {
+ case 'edit':
+ k4_action = 'edit_item("'+prefix_special+'")';
+ break;
+ case 'delete':
+ k4_action = 'delete_items("'+prefix_special+'")';
+ break;
+ case 'unselect':
+ k4_action = 'unselect("'+prefix_special+'")';
+ break;
+ case 'approve':
+ k4_action = 'approve_items("'+prefix_special+'")';
+ break;
+ case 'decline':
+ k4_action = 'decine_items("'+prefix_special+'")';
+ break;
+
+ case 'copy':
+ k4_action = 'copy_items("'+prefix_special+'")';
+ break;
+ case 'cut':
+ k4_action = 'cut_items("'+prefix_special+'")';
+ break;
+ case 'move_up':
+ k4_action = 'move_up("'+prefix_special+'")';
+ break;
+ case 'move_down':
+ k4_action = 'move_down("'+prefix_special+'")';
+ break;
+ }
+
+ if (k4_action != '')
+ {
+ \$form_name = queryTabRegistry('prefix_special', prefix_special, 'tab_id') + '_form';
+ eval(k4_action);
+ }
+ else alert(action+' not implemented');
+
+ }
+
+ function approve_items(prefix_special)
+ {
+ set_hidden_field('remove_specials['+prefix_special+']',1);
+ submit_event(prefix_special,'OnMassApprove','')
+ }
+
+ function decine_items(prefix_special)
+ {
+ set_hidden_field('remove_specials['+prefix_special+']',1);
+ submit_event(prefix_special,'OnMassDecline','')
+ }
+
+ function edit()
+ {
+ edit_item( queryTabRegistry('tab_id', activeTab.id, 'prefix_special') );
+ }
+
+ function edit_item(prefix_special)
+ {
+ opener_action('d');
+ set_hidden_field(prefix_special+'_mode', 't');
+ submit_event(prefix_special, 'OnEdit', queryTabRegistry('prefix_special', prefix_special, 'edit_template'), '../../admin/index4.php');
+ }
+
+ function delete_items(prefix_special)
+ {
+ set_hidden_field('remove_specials['+prefix_special+']',1);
+ submit_event(prefix_special,'OnMassDelete','')
+ }
+
+ function copy_items(prefix_special)
+ {
+ submit_event(prefix_special,'OnCopy','')
+ }
+
+ function cut_items(prefix_special)
+ {
+ submit_event(prefix_special,'OnCut','')
+ }
+
+ function move_up(prefix_special)
+ {
+ submit_event(prefix_special,'OnMassMoveUp','')
+ }
+
+ function move_down(prefix_special)
+ {
+ submit_event(prefix_special,'OnMassMoveDown','')
+ }
+
+ function unselect(prefix_special)
+ {
+ Grids[prefix_special].ClearSelection(null,'Inp_AdvancedView.Unselect');
+ }
+ // K4 code for handling toolbar operations: end
+
+ function InitPage()
+ {
+ var main_form='kernel_form';
+ if('$destform') main_form='$destform';
+ addCommonActions(main_form);
+ initToolbar('mainToolBar', actionHandler);
+ initCheckBoxes();
+ //toggleMenu();
+ }
+
+ function AddButtonAction(actionname,actionval)
+ {
+ var item = new Array(actionname,actionval);
+ actionlist[actionlist.length] = item;
+ }
+
+ function actionHandler(button)
+ {
+ //alert('a button has been pressed!');
+ for(i=0; i<actionlist.length;i++)
+ {
+
+ a = actionlist[i];
+ if(button.action==a[0])
+ {
+ //alert('Button action '+a[0]+' is '+a[1]);
+ eval(a[1]);
+ break;
+ }
+ }
+ }
+
+ function addCommonActions(main_form)
+ {
+ AddButtonAction('upcat',"get_to_server(upURL,'');");// UP
+ AddButtonAction('homecat',"get_to_server(homeURL,'');"); //home
+ AddButtonAction('select',"check_submit('"+main_form+"');"); //edit
+ AddButtonAction('stop',"window.close();"); //delete
+ AddButtonAction('view',"toggleMenu(); window.FW_showMenu(window.cat_menu,getRealLeft(button) - ((document.all) ? 6 : -2),getRealTop(button)+32);");
+ //AddButtonAction('search_a',"setSearchMenu(); window.FW_showMenu(window.SearchMenu,getRealLeft(button)-134 - ((document.all) ? 8 : -1),getRealTop(button)+22);");
+ AddButtonAction('search_b',"search_submit();");
+ AddButtonAction('search_c',"ClearSearch();");
+ }
+
+ function AdminCatNav(url)
+ {
+ f = document.getElementById("admin_search");
+ if(f)
+ {
+ f.action = url;
+ new_search_submit();
+ }
+ }
+
+ function search_submit()
+ {
+ f = document.getElementById("admin_search");
+ if(f)
+ {
+ //alert('Setting SearchWord to ' + f.value);
+ f.Action.value = "m_SearchWord";
+ f.submit();
+ }
+ }
+ function new_search_submit()
+ {
+ var newSearchInput = document.getElementById("NewSearch");
+ if (newSearchInput) newSearchInput.value = 1;
+ search_submit();
+ }
+
+ function ClearSearch()
+ {
+ //alert('Clearing Search');
+ f = document.getElementById("admin_search");
+ if(f)
+ {
+ f.Action.value = "m_ClearSearch";
+ f.submit();
+ }
+ }
+
+ function SetSearchType(value)
+ {
+ f = document.getElementById("admin_search");
+ if(f)
+ {
+ f.SearchType.value = value;
+ }
+ }
+
+ function SetSearchScope(value)
+ {
+ f = document.getElementById("admin_search");
+ if(f)
+ {
+ f.SearchScope.value = value;
+ }
+ }
+
+ function ToggleNewSearch()
+ {
+ f = document.getElementById("admin_search");
+ if(f)
+ {
+ value = f.NewSearch.value;
+ if(value==1)
+ {
+ f.NewSearch.value=0;
+ }
+ else
+ f.NewSearch.value=1;
+ }
+ }
+ function isNewSearch()
+ {
+ f = document.getElementById("admin_search");
+ if(f)
+ {
+ return f.NewSearch.value;
+ }
+ else return 0;
+ }
+
+
+ function get_to_server(path,attr)
+ {
+ if(attr.length>0)
+ path = path + '?'+attr;
+
+ //alert(path);
+ window.location.href=path;
+ return true;
+ }
+
+ function check_submit(main_form)
+ {
+ var formname = '';
+
+ if ((activeTab) && (!isAnyChecked('categories')))
+ {
+ form_name = activeTab.id;
+ }
+ else
+ {
+ form_name = 'categories';
+ }
+ var f = document.getElementsByName(form_name+'_form')[0];
+ var bf = window.opener.document.getElementById(main_form);
+
+ if(bf)
+ {
+ if(typeof(LastCheckedItem.value) != 'undefined')
+ {
+ try{
+ item_id = LastCheckedItem.value;
+ item_type = LastCheckedItem.ItemType;
+ }
+ catch(err)
+ {
+ }
+ bf.TargetId.value = item_id;
+ bf.TargetType.value = item_type;
+ bf.submit();
+ window.close();
+ }
+ else {
+ theMainScript.Alert(lang_Selection_Empty);
+ }
+ }
+ } // check submit
+
+ function flip_current(field_suffix)
+ {
+ if(activeTab)
+ {
+ field = activeTab.getAttribute("tabTitle")+field_suffix;
+ return flip(eval(field));
+ }
+ }
+
+ function config_current(field_suffix,value)
+ {
+ if(activeTab)
+ {
+ field = activeTab.getAttribute("tabTitle")+field_suffix;
+ config_val(field,value);
+ }
+ }
+
+ function getSType(type,value)
+ {
+ f = document.getElementById("admin_search");
+ if(f)
+ {
+ if (f.SearchType.value == type) return 2; else return 0;
+ } else return 0;
+
+ }
+
+ function getSScope(scope)
+ {
+ f = document.getElementById("admin_search");
+ if(f)
+ {
+ if (f.SearchScope.value == scope) return 2; else return 0;
+ } else return 0;
+
+ }
+
+// function setSearchMenu()
+// {
+//
+// window.SearchMenu = new Menu("search");
+// SearchMenu.addMenuItem(lang_All,"SetSearchType('all');",getSType('all'));
+// SearchMenu.addMenuSeparator()
+//
+// SearchMenu.addMenuItem(lang_Categories, "SetSearchType('categories');",getSType('categories'));
+// param = "";
+//
+// for (var i = 0; i < tabIDs.length; i++)
+// {
+// d = document.getElementById(tabIDs[i]);
+// if(d)
+// {
+// tabname = d.getAttribute("tabTitle");
+// param = "SetSearchType('"+tabname+"');";
+//
+// SearchMenu.addMenuItem(tabname,param,getSType(tabname));
+// }
+// }
+//
+// SearchMenu.addMenuSeparator();
+// SearchMenu.addMenuItem(lang_All+' '+lang_Categories,"SetSearchScope('0');",getSScope(0));
+// SearchMenu.addMenuItem(lang_SubSearch,"ToggleNewSearch();",isNewSearch());
+// SearchMenu.addMenuItem(lang_Current+' '+lang_Categories,"SetSearchScope('2');",getSScope(2));
+// SearchMenu.addMenuItem(lang_Within+' '+lang_Categories,"SetSearchScope('1');",getSScope(1));
+//
+// SearchMenu.addMenuSeparator();
+//
+// window.SearchMenu.addMenuItem('$mnuClearSearch',"ClearSearch();","");
+// window.triedToWriteMenus = false;
+// window.SearchMenu.writeMenus();
+// }
+
+ function Category_SortMenu(caption)
+ {
+ menu_sorting = new Menu(caption);
+
+ menu_sorting.addMenuItem(lang_Asc,"config_val('Category_Sortorder','asc');",RadioIsSelected(Category_Sortorder,'asc'));
+ menu_sorting.addMenuItem(lang_Desc,"config_val('Category_Sortorder','desc');",RadioIsSelected(Category_Sortorder,'desc'));
+ menu_sorting.addMenuSeparator();
+
+ menu_sorting.addMenuItem(lang_Default,"config_val('Category_Sortfield','Name');","");
+ menu_sorting.addMenuItem(lang_Name,"config_val('Category_Sortfield','Name');",RadioIsSelected(Category_Sortfield,'Name'));
+ menu_sorting.addMenuItem(lang_Description,"config_val('Category_Sortfield','Description');",RadioIsSelected(Category_Sortfield,'Description'));
+
+ menu_sorting.addMenuItem(lang_CreatedOn,"config_val('Category_Sortfield','CreatedOn');",RadioIsSelected(Category_Sortfield,'CreatedOn'));
+ menu_sorting.addMenuItem(lang_SubCats,"config_val('Category_Sortfield','CachedDescendantCatsQty');",RadioIsSelected(Category_Sortfield,'CachedDescendantCatsQty'));
+ menu_sorting.addMenuItem(lang_SubItems,"config_val('Category_Sortfield','SubItems');",RadioIsSelected(Category_Sortfield,'SubItems'));
+
+ return menu_sorting;
+
+ }
+
+
+ function Category_FilterMenu(caption)
+ {
+ menu_filter = new Menu(caption);
+ menu_filter.addMenuItem(lang_All,"config_val('Category_View', 127);",CategoryView==127);
+ menu_filter.addMenuSeparator();
+ menu_filter.addMenuItem(lang_Active,"FlipBit('Category_View',CategoryView,6);",BitStatus(CategoryView,6));
+ menu_filter.addMenuItem(lang_Pending,"FlipBit('Category_View',CategoryView,5);", BitStatus(CategoryView,5));
+ menu_filter.addMenuItem(lang_Disabled,"FlipBit('Category_View',CategoryView,4);",BitStatus(CategoryView,4));
+
+ menu_filter.addMenuSeparator();
+ menu_filter.addMenuItem(lang_New,"FlipBit('Category_View',CategoryView,3);",BitStatus(CategoryView,3));
+ menu_filter.addMenuItem(lang_EdPick,"FlipBit('Category_View',CategoryView,0);",BitStatus(CategoryView,0));
+
+ return menu_filter;
+ }
+
+ function toggleMenu()
+ {
+ //var tab_title = GetTabTitle(activeTab.id);
+ //alert(tab_title);
+ if ((document.getElementById('categories').active) && (activeTab))
+ {
+ filterfunc = activeTab.getAttribute("tabTitle")+'_FilterMenu();';
+
+ window.cat_menu_filter_sub = Category_FilterMenu(lang_Categories);
+ window.sub_menu_filter_sub = eval(filterfunc);
+
+ window.cat_menu_filter = new Menu(lang_View);
+ cat_menu_filter.addMenuItem(cat_menu_filter_sub);
+ cat_menu_filter.addMenuItem(sub_menu_filter_sub);
+ }
+ else
+ {
+ if (document.getElementById('categories').active)
+ {
+ window.cat_menu_filter = Category_FilterMenu(lang_View);
+ }
+ if (activeTab)
+ {
+ filterfunc = activeTab.getAttribute("tabTitle")+'_FilterMenu();';
+ window.cat_menu_filter = eval(filterfunc);
+ }
+ } // Filter
+
+ //Sorting
+ if ((document.getElementById('categories').active) && (activeTab))
+ {
+ //Sort->Categories
+ sortfunc = activeTab.getAttribute("tabTitle")+'_SortMenu();';
+
+ window.cat_menu_sorting_sub = Category_SortMenu(lang_Categories);
+ window.sub_menu_sorting_sub = eval(sortfunc);
+
+ window.cat_menu_sorting = new Menu(lang_Sort);
+ cat_menu_sorting.addMenuItem(cat_menu_sorting_sub);
+ cat_menu_sorting.addMenuItem(sub_menu_sorting_sub);
+ }
+ else
+ {
+ if (document.getElementById('categories').active)
+ {
+ window.cat_menu_sorting = Category_SortMenu(lang_Sort);
+
+ } // categories
+ if (activeTab)
+ {
+ window.cat_menu_sorting = Category_SortMenu(lang_Sort);
+ }
+
+ } // && Sorting
+ if ((document.getElementById('categories').active) && (activeTab))
+ {
+ window.cat_menu_select_sub = new Menu(lang_Categories);
+ cat_menu_select_sub.addMenuItem(lang_All,"javascript:selectAll('categories');","");
+ cat_menu_select_sub.addMenuItem(lang_Unselect,"javascript:unselectAll('categories');","");
+ cat_menu_select_sub.addMenuItem(lang_Invert,"javascript:invert('categories');","");
+
+ selectfunc = activeTab.getAttribute("tabTitle")+"_SelectMenu();";
+
+ window.sub_menu_select_sub = eval(selectfunc);
+// sub_menu_select_sub.addMenuItem(lang_All,"javascript:selectAll('"+activeTab.id+"');","");
+// sub_menu_select_sub.addMenuItem(lang_Unselect,"javascript:unselectAll('"+activeTab.id+"');","");
+// sub_menu_select_sub.addMenuItem(lang_Invert,"javascript:invert('"+activeTab.id+"');","");
+
+END;
+if (!$hideSelectAll) {
+echo "
+ window.cat_menu_select = new Menu(lang_Select);
+ cat_menu_select.addMenuItem(cat_menu_select_sub);
+ cat_menu_select.addMenuItem(sub_menu_select_sub);";
+}
+print <<<END
+ }
+ else
+ {
+END;
+if (!$hideSelectAll) {
+echo '
+ if (document.getElementById(\'categories\').active)
+ {
+ window.cat_menu_select = new Menu(lang_Select);
+ cat_menu_select.addMenuItem(lang_All,"javascript:selectAll(\'categories\');","");
+ cat_menu_select.addMenuItem(lang_Unselect,"javascript:unselectAll(\'categories\');","");
+ cat_menu_select.addMenuItem(lang_Invert,"javascript:invert(\'categories\');","");
+ } ';
+
+echo ' if (activeTab)
+ {
+
+ window.cat_menu_select = new Menu(lang_Select);
+ cat_menu_select.addMenuItem(lang_All,"javascript:selectAllC(\'"+activeTab.id+"\');","");
+ cat_menu_select.addMenuItem(lang_Unselect,"javascript:unselectAll(\'"+activeTab.id+"\');","");
+ cat_menu_select.addMenuItem(lang_Invert,"javascript:invert(\'"+activeTab.id+"\');","");
+ } ';
+}
+print <<<END
+ }
+ if(activeTab)
+ {
+ pagefunc = activeTab.getAttribute("tabTitle")+"_PerPageMenu();";
+ window.PerPageMenu = eval(pagefunc);
+ }
+ window.cat_menu = new Menu("root");
+ if ((document.getElementById('categories').active) || (activeTab)) window.cat_menu.addMenuItem(cat_menu_filter);
+ if ((document.getElementById('categories').active) || (activeTab)) window.cat_menu.addMenuItem(cat_menu_sorting);
+ if(activeTab) window.cat_menu.addMenuItem(PerPageMenu);
+
+END;
+if (!$hideSelectAll) {
+echo '
+ if ((document.getElementById(\'categories\').active) || (activeTab)) window.cat_menu.addMenuItem(cat_menu_select);
+';
+}
+print <<<END
+
+ window.triedToWriteMenus = false;
+ window.cat_menu.writeMenus();
+
+ }
+
+function toggleCategoriesA(tabHeader)
+{
+ var categories = document.getElementById('categories');
+ if (!categories) return;
+ toggleCategories();
+ tabHeader.setAttribute("background", '$imagesURL'+'/itemtabs/' + ((categories.active) ? "tab_active" : "tab_inactive") + ".gif")
+ var images = tabHeader.getElementsByTagName("IMG");
+ if (images.length < 1) return;
+ images[0].src = '$imagesURL'+'/itemtabs/' + ((categories.active) ? "divider_up" : "divider_dn") + ".gif";
+}
+
+function toggleTabA(tabId, atm)
+{
+ var hl = document.getElementById("hidden_line");
+ var activeTabId;
+ if (activeTab) activeTabId = activeTab.id;
+ if (activeTabId == tabId)
+ {
+ var devider = document.getElementById("tabsDevider");
+ devider.style.display = "";
+
+ unselectAll(tabId);
+ var tab = document.getElementById(tabId);
+ tab.active = false;
+ activeTab = null;
+ collapseTab = tab;
+ toolbar.setTab(null);
+ showTab();
+ }
+
+ else
+ {
+ if (activeTab) toggleTab(tabId, true)
+ else toggleTab(tabId, atm)
+
+ if (hl) hl.style.display = "none";
+ }
+ tab_hdr = document.getElementById('tab_headers');
+ if (!tab_hdr) return;
+ for (var i = 0; i < tabIDs.length; i++)
+ {
+ var tabHeader;
+ TDs = tab_hdr.getElementsByTagName("TD");
+ for (var j = 0; j < TDs.length; j++)
+ if (TDs[j].getAttribute("tabHeaderOf") == tabIDs[i])
+ {
+ tabHeader = TDs[j];
+ break;
+ }
+ if (!tabHeader) continue;
+
+ var tab = document.getElementById(tabIDs[i]);
+ if (!tab) continue;
+
+ tabHeader.setAttribute("background", "$imagesURL/itemtabs/" + ((tab.active) ? "tab_active" : "tab_inactive") + ".gif")
+
+ var images = tabHeader.getElementsByTagName("IMG");
+ if (images.length < 1) continue;
+
+ images[0].src = "$imagesURL/itemtabs/" + ((tab.active) ? "divider_up" : "divider_empty") + ".gif";
+ }
+}
+
+</script>
+
+END;
+?>
Property changes on: branches/unlabeled/unlabeled-1.6.2/kernel/admin/include/toolbar/editcategory_relationselect.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.6
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.6.2/admin/browse/fw_menu.js
===================================================================
--- branches/unlabeled/unlabeled-1.6.2/admin/browse/fw_menu.js (nonexistent)
+++ branches/unlabeled/unlabeled-1.6.2/admin/browse/fw_menu.js (revision 5561)
@@ -0,0 +1,762 @@
+/**
+ * fw_menu 24OCT2000 Version 4.0
+ * John Ahlquist, October 2000
+ * Copyright (c) 2000 Macromedia, Inc.
+ *
+ * based on menu.js
+ * by gary smith, July 1997
+ * Copyright (c) 1997-1999 Netscape Communications Corp.
+ *
+ * Netscape grants you a royalty free license to use or modify this
+ * software provided that this copyright notice appears on all copies.
+ * This software is provided "AS IS," without a warranty of any kind.
+ *
+ * Modified By Intechnic Corporation for use in In-Portal
+ * 6/28/02
+ *
+ */
+function Menu(label)
+{
+ this.version = "990702 [xMenu; fw_menu.js]";
+ this.type = "Menu";
+ this.menuWidth = 0;
+ this.menuItemHeight = 0;
+ this.fontSize = 11;
+ this.fontWeight = "normal";
+ this.fontFamily = "helvetica, arial, verdana, helvetica";
+ this.fontColor = "#000000";
+ this.fontColorHilite = "#000000";
+ this.bgColor = "#555555";
+ this.menuBorder = 1;
+ this.menuItemBorder = 0;
+ this.menuItemBgColor = "#f0f1eb";
+ this.menuLiteBgColor = "#ffffff";
+ this.menuBorderBgColor = "#777777";
+ this.menuHiliteBgColor = "#e0e0da";
+ this.menuContainerBgColor = "#cccccc";
+
+ var $base_path = '';
+ var $base_tag = document.getElementsByTagName('BASE');
+ if ($base_tag.length) {
+ $base_path = $base_tag[0].href.replace('kernel/admin_templates', 'admin');
+ }
+
+ this.imagePath = $base_path + 'images/';
+
+ this.childMenuIcon = "menu_arrow.gif";
+ this.items = new Array();
+ this.actions = new Array();
+ this.types = new Array(); //for check/radio type to show pics
+ this.childMenus = new Array();
+
+ this.hideOnMouseOut = true;
+
+ this.addMenuItem = addMenuItem;
+ this.addMenuSeparator = addMenuSeparator;
+ this.writeMenus = writeMenus;
+ this.FW_showMenu = FW_showMenu;
+ this.onMenuItemOver = onMenuItemOver;
+ this.onMenuItemAction = onMenuItemAction;
+ this.hideMenu = hideMenu;
+ this.hideChildMenu = hideChildMenu;
+
+ label = RemoveTranslationLink(label);
+ if (!window.menus) window.menus = new Array();
+ this.label = label || "menuLabel" + window.menus.length;
+ window.menus[this.label] = this;
+ window.menus[window.menus.length] = this;
+ if (!window.activeMenus) window.activeMenus = new Array();
+}
+
+function RemoveTranslationLink($string)
+{
+ return $string.match(/<a href="(.*)">(.*)<\/a>/) ? RegExp.$2 : $string;
+}
+
+function addMenuItem(label, action, type)
+{
+ if( typeof(label) == 'string' ) label = RemoveTranslationLink(label);
+ if( isset(type) ) type = parseInt(type);
+ this.items[this.items.length] = label;
+ this.actions[this.actions.length] = action;
+ switch(type)
+ {
+ case 1:
+ this.types[this.types.length] = this.imagePath+'check_on.gif';
+ break;
+ case 2:
+ this.types[this.types.length] = this.imagePath+'menu_dot.gif';
+ break;
+ default:
+ this.types[this.types.length] = '';
+ }
+}
+
+function addMenuSeparator() {
+ this.items[this.items.length] = "separator";
+ this.actions[this.actions.length] = "";
+ this.types[this.types.length] = "";
+ this.menuItemBorder = 0;
+}
+
+// For NS6.
+function FIND(item,called_from)
+{
+ if (document.all) return(document.all[item]);
+ if (document.getElementById) return(document.getElementById(item));
+ return(false);
+}
+
+function writeMenus(container_id) {
+
+ if (window.triedToWriteMenus) return;
+ var container = null;
+
+ if (!container_id && document.layers) {
+ window.delayWriteMenus = this.writeMenus;
+ var timer = setTimeout('delayWriteMenus()', 100);
+ container = new Layer(100);
+ clearTimeout(timer);
+ } else if (document.all || document.hasChildNodes) {
+ if( !isset(container_id) ) container_id = 'menuContainer';
+ container = FIND(container_id);
+ if (!container)
+ {
+ if( isset(document.body) )
+ {
+ container = document.createElement('SPAN');
+ container.id = container_id;
+ document.body.appendChild(container);
+ container = FIND(container_id);
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ container.innerHTML = '';
+ }
+ }
+
+ window.fwHideMenuTimer = null;
+ if (!container) return; window.triedToWriteMenus = true;
+ container.isContainer = true;
+ container.menus = new Array();
+
+ for (var i=0; i<window.menus.length; i++)
+ container.menus[i] = window.menus[i];
+ window.menus.length = 0;
+ var countMenus = 0;
+ var countItems = 0;
+ var top = 0;
+ var content = '';
+ var lrs = false;
+ var theStat = "";
+ var tsc = 0;
+ if (document.layers) lrs = true;
+ for (var i=0; i<container.menus.length; i++, countMenus++) {
+ var menu = container.menus[i];
+ if (menu.bgImageUp) {
+ menu.menuBorder = 0;
+ menu.menuItemBorder = 0;
+ }
+ if (lrs) {
+ var menuLayer = new Layer(100, container);
+ var lite = new Layer(100, menuLayer);
+ lite.top = menu.menuBorder;
+ lite.left = menu.menuBorder;
+ var body = new Layer(100, lite);
+ body.top = menu.menuBorder;
+ body.left = menu.menuBorder;
+ } else {
+ content += ''+
+ '<DIV ID="menuLayer'+ countMenus +'" STYLE="position:absolute;z-index:100;left:10;top:'+ (i * 100) +';visibility:hidden;">\n'+
+ ' <DIV ID="menuLite'+ countMenus +'" STYLE="position:absolute;z-index:100;left:'+ menu.menuBorder +';top:'+ menu.menuBorder +';visibility:hide;" onMouseOut="mouseoutMenu();">\n'+
+ ' <DIV ID="menuFg'+ countMenus +'" STYLE="position:absolute;left:'+ menu.menuBorder +';top:'+ menu.menuBorder +';visibility:hide;">\n'+
+ '';
+ }
+ var x=i;
+ for (var i=0; i<menu.items.length; i++) {
+ var item = menu.items[i];
+ var type = menu.types[i];
+ var childMenu = false;
+ var defaultHeight = menu.fontSize+6;
+ var defaultIndent = menu.fontSize+7;
+ if (item.label) {
+ item = item.label;
+ childMenu = true;
+ }
+ menu.menuItemHeight = menu.menuItemHeight || defaultHeight;
+ menu.menuItemIndent = menu.menuItemIndent || defaultIndent;
+ var itemProps = 'font-family:' + menu.fontFamily +';font-weight:' + menu.fontWeight + ';fontSize:' + menu.fontSize + ';';
+ if (menu.fontStyle) itemProps += 'font-style:' + menu.fontStyle + ';';
+ if (document.all)
+ itemProps += 'font-size:' + menu.fontSize + ';" onMouseOver="onMenuItemOver(null,this);" onClick="onMenuItemAction(null,this);';
+ else if (!document.layers) {
+ itemProps += 'font-size:' + menu.fontSize + 'px;'; // zilla wants 12px.
+ }
+ var l;
+ if (lrs) {
+ l = new Layer(800,body);
+ }
+ var dTag = '<DIV ID="menuItem'+ countItems +'" STYLE="position:absolute;left:0;top:'+ (i * menu.menuItemHeight) +';'+ itemProps +'">';
+ var dClose = '</DIV>'
+ if (menu.bgImageUp) {
+ menu.menuBorder = 0;
+ menu.menuItemBorder = 0;
+ dTag = '<DIV ID="menuItem'+ countItems +'" STYLE="background:url('+menu.bgImageUp+');position:absolute;left:0;top:'+ (i * menu.menuItemHeight) +';'+ itemProps +'">';
+ if (document.layers) {
+ dTag = '<LAYER BACKGROUND="'+menu.bgImageUp+'" ID="menuItem'+ countItems +'" TOP="'+ (i * menu.menuItemHeight) +'" style="' + itemProps +'">';
+ dClose = '</LAYER>';
+ }
+ }
+ var textProps = 'position:absolute;left:' + menu.menuItemIndent + ';top:1;';
+ if (lrs) {
+ textProps +=itemProps;
+ dTag = "";
+ dClose = "";
+ }
+
+ var dText = '';
+
+ if (type != '' && childMenu == false)
+ {
+ dText = '&nbsp;<img border="0" src="' + type + '" valign="center">';
+ }
+
+
+ dText += '<DIV ID="menuItemText'+ countItems +'" STYLE="' + textProps + 'color:'+ menu.fontColor +';">' + item +'&nbsp</DIV>\n<DIV ID="menuItemHilite'+ countItems +'" STYLE="' + textProps + 'top:1;color:'+ menu.fontColorHilite +';visibility:hidden;">'+ item +'&nbsp</DIV>';
+ if (item == "separator") {
+ content += ( dTag + '<DIV ID="menuSeparator'+ countItems +'" STYLE="position:absolute;left:1;top:2;"></DIV>\n<DIV ID="menuSeparatorLite'+ countItems +'" STYLE="position:absolute;left:1;top:2;"></DIV>\n' + dClose);
+ } else if (childMenu) {
+ content += ( dTag + dText + '<DIV ID="childMenu'+ countItems +'" STYLE="position:absolute;left:0;top:3;"><IMG SRC="'+ menu.imagePath+menu.childMenuIcon +'"></DIV>\n' + dClose);
+ } else {
+ content += ( dTag + dText + dClose);
+ }
+ if (lrs) {
+ l.document.open("text/html");
+ l.document.writeln(content);
+ l.document.close();
+ content = '';
+ theStat += "-";
+ tsc++;
+ if (tsc > 50) {
+ tsc = 0;
+ theStat = "";
+ }
+ status = theStat;
+ }
+ countItems++;
+ }
+ if (lrs) {
+ // focus layer
+ var focusItem = new Layer(100, body);
+ focusItem.visiblity="hidden";
+ focusItem.document.open("text/html");
+ focusItem.document.writeln("&nbsp;");
+ focusItem.document.close();
+ } else {
+ content += ' <DIV ID="focusItem'+ countMenus +'" STYLE="position:absolute;left:0;top:0;visibility:hide;" onClick="onMenuItemAction(null,this);">&nbsp;</DIV>\n';
+ content += ' </DIV>\n </DIV>\n</DIV>\n';
+ }
+ i=x;
+ }
+ if (document.layers) {
+ container.clip.width = window.innerWidth;
+ container.clip.height = window.innerHeight;
+ container.onmouseout = mouseoutMenu;
+ container.menuContainerBgColor = this.menuContainerBgColor;
+ for (var i=0; i<container.document.layers.length; i++) {
+ proto = container.menus[i];
+ var menu = container.document.layers[i];
+ container.menus[i].menuLayer = menu;
+ container.menus[i].menuLayer.Menu = container.menus[i];
+ container.menus[i].menuLayer.Menu.container = container;
+ var body = menu.document.layers[0].document.layers[0];
+ body.clip.width = proto.menuWidth || body.clip.width;
+ body.clip.height = proto.menuHeight || body.clip.height;
+ for (var n=0; n<body.document.layers.length-1; n++) {
+ var l = body.document.layers[n];
+ l.Menu = container.menus[i];
+ l.menuHiliteBgColor = proto.menuHiliteBgColor;
+ l.document.bgColor = proto.menuItemBgColor;
+ l.saveColor = proto.menuItemBgColor;
+ l.onmouseover = proto.onMenuItemOver;
+ l.onclick = proto.onMenuItemAction;
+ l.action = container.menus[i].actions[n];
+ l.focusItem = body.document.layers[body.document.layers.length-1];
+ l.clip.width = proto.menuWidth || body.clip.width + proto.menuItemIndent;
+ l.clip.height = proto.menuItemHeight || l.clip.height;
+ if (n>0) l.top = body.document.layers[n-1].top + body.document.layers[n-1].clip.height + proto.menuItemBorder;
+ l.hilite = l.document.layers[1];
+ if (proto.bgImageUp) l.background.src = proto.bgImageUp;
+ l.document.layers[1].isHilite = true;
+ if (l.document.layers[0].id.indexOf("menuSeparator") != -1) {
+ l.hilite = null;
+ l.clip.height -= l.clip.height / 2;
+ l.document.layers[0].document.bgColor = proto.bgColor;
+ l.document.layers[0].clip.width = l.clip.width -2;
+ l.document.layers[0].clip.height = 1;
+ l.document.layers[1].document.bgColor = proto.menuLiteBgColor;
+ l.document.layers[1].clip.width = l.clip.width -2;
+ l.document.layers[1].clip.height = 1;
+ l.document.layers[1].top = l.document.layers[0].top + 1;
+ } else if (l.document.layers.length > 2) {
+ l.childMenu = container.menus[i].items[n].menuLayer;
+ l.document.layers[2].left = l.clip.width -13;
+ l.document.layers[2].top = (l.clip.height / 2) -4;
+ l.document.layers[2].clip.left += 3;
+ l.Menu.childMenus[l.Menu.childMenus.length] = l.childMenu;
+ }
+ }
+ body.document.bgColor = proto.bgColor;
+ body.clip.width = l.clip.width +proto.menuBorder;
+ body.clip.height = l.top + l.clip.height +proto.menuBorder;
+ var focusItem = body.document.layers[n];
+ focusItem.clip.width = body.clip.width;
+ focusItem.Menu = l.Menu;
+ focusItem.top = -30;
+ focusItem.captureEvents(Event.MOUSEDOWN);
+ focusItem.onmousedown = onMenuItemDown;
+ menu.document.bgColor = proto.menuBorderBgColor;
+ var lite = menu.document.layers[0];
+ lite.document.bgColor = proto.menuLiteBgColor;
+ lite.clip.width = body.clip.width +1;
+ lite.clip.height = body.clip.height +1;
+ menu.clip.width = body.clip.width + (proto.menuBorder * 3) ;
+ menu.clip.height = body.clip.height + (proto.menuBorder * 3);
+ }
+ } else {
+ if ((document.all) || (container.hasChildNodes)) {
+ container.innerHTML=content;
+ } else {
+ container.document.open("text/html");
+ container.document.writeln(content);
+ container.document.close();
+ }
+ if (!FIND("menuLayer0")) return;
+ var menuCount = 0;
+ for (var x=0; x<container.menus.length; x++) {
+ var menuLayer = FIND("menuLayer" + x);
+ container.menus[x].menuLayer = "menuLayer" + x;
+ menuLayer.Menu = container.menus[x];
+ menuLayer.Menu.container = "menuLayer" + x;
+ menuLayer.style.zIndex = 100;
+ var s = menuLayer.style;
+ s.top = s.pixelTop = -300;
+ s.left = s.pixelLeft = -300;
+
+ var menu = container.menus[x];
+ menu.menuItemWidth = menu.menuWidth || menu.menuIEWidth || 140;
+ menuLayer.style.backgroundColor = menu.menuBorderBgColor;
+ var top = 0;
+ for (var i=0; i<container.menus[x].items.length; i++) {
+ var l = FIND("menuItem" + menuCount);
+ l.Menu = container.menus[x];
+ if (l.addEventListener) { // ns6
+ l.style.width = menu.menuItemWidth;
+ l.style.height = menu.menuItemHeight;
+ l.style.top = top;
+ l.addEventListener("mouseover", onMenuItemOver, false);
+ l.addEventListener("click", onMenuItemAction, false);
+ l.addEventListener("mouseout", mouseoutMenu, false);
+ } else { //ie
+ l.style.pixelWidth = menu.menuItemWidth;
+ l.style.pixelHeight = menu.menuItemHeight;
+ l.style.pixelTop = top;
+ }
+ top = top + menu.menuItemHeight+menu.menuItemBorder;
+ l.style.fontSize = menu.fontSize;
+ l.style.backgroundColor = menu.menuItemBgColor;
+ l.style.visibility = "inherit";
+ l.saveColor = menu.menuItemBgColor;
+ l.menuHiliteBgColor = menu.menuHiliteBgColor;
+ l.action = container.menus[x].actions[i];
+ l.hilite = FIND("menuItemHilite" + menuCount);
+ l.focusItem = FIND("focusItem" + x);
+ l.focusItem.style.pixelTop = l.focusItem.style.top = -30;
+ var childItem = FIND("childMenu" + menuCount);
+ if (childItem) {
+ l.childMenu = container.menus[x].items[i].menuLayer;
+ childItem.style.pixelLeft = childItem.style.left = menu.menuItemWidth -11;
+ childItem.style.pixelTop = childItem.style.top =(menu.menuItemHeight /2) -4;
+ //childItem.style.pixelWidth = 30 || 7;
+ //childItem.style.clip = "rect(0 7 7 3)";
+ l.Menu.childMenus[l.Menu.childMenus.length] = l.childMenu;
+ }
+ var sep = FIND("menuSeparator" + menuCount);
+ if (sep) {
+ sep.style.clip = "rect(0 " + (menu.menuItemWidth - 3) + " 1 0)";
+ sep.style.width = sep.style.pixelWidth = menu.menuItemWidth;
+ sep.style.backgroundColor = menu.bgColor;
+ sep = FIND("menuSeparatorLite" + menuCount);
+ sep.style.clip = "rect(1 " + (menu.menuItemWidth - 3) + " 2 0)";
+ sep.style.width = sep.style.pixelWidth = menu.menuItemWidth;
+ sep.style.backgroundColor = menu.menuLiteBgColor;
+ l.style.height = l.style.pixelHeight = menu.menuItemHeight/2;
+ l.isSeparator = true
+ top -= (menu.menuItemHeight - l.style.pixelHeight)
+ } else {
+ l.style.cursor = "hand"
+ }
+ menuCount++;
+ }
+ menu.menuHeight = top-1;
+ var lite = FIND("menuLite" + x);
+ var s = lite.style;
+ s.height = s.pixelHeight = menu.menuHeight +(menu.menuBorder * 2);
+ s.width = s.pixelWidth = menu.menuItemWidth + (menu.menuBorder * 2);
+ s.backgroundColor = menu.menuLiteBgColor;
+
+ var body = FIND("menuFg" + x);
+ s = body.style;
+ s.height = s.pixelHeight = menu.menuHeight + menu.menuBorder;
+ s.width = s.pixelWidth = menu.menuItemWidth + menu.menuBorder;
+ s.backgroundColor = menu.bgColor;
+
+ s = menuLayer.style;
+ s.width = s.pixelWidth = menu.menuItemWidth + (menu.menuBorder * 4);
+ s.height = s.pixelHeight = menu.menuHeight+(menu.menuBorder*4);
+ }
+ }
+ if (document.captureEvents) {
+ document.captureEvents(Event.MOUSEUP);
+ }
+ if (document.addEventListener) {
+ document.addEventListener("mouseup", onMenuItemOver, false);
+ }
+ if (document.layers && window.innerWidth) {
+ window.onresize = NS4resize;
+ window.NS4sIW = window.innerWidth;
+ window.NS4sIH = window.innerHeight;
+ }
+ document.onmouseup = mouseupMenu;
+ window.fwWroteMenu = true;
+ status = "";
+}
+
+function NS4resize() {
+ if (NS4sIW < window.innerWidth ||
+ NS4sIW > window.innerWidth ||
+ NS4sIH > window.innerHeight ||
+ NS4sIH < window.innerHeight )
+ {
+ window.location.reload();
+ }
+}
+
+function onMenuItemOver(e, l) {
+ FW_clearTimeout();
+ l = l || this;
+ a = window.ActiveMenuItem;
+ if (document.layers) {
+ if (a) {
+ a.document.bgColor = a.saveColor;
+ if (a.hilite) a.hilite.visibility = "hidden";
+ if (a.Menu.bgImageOver) {
+ a.background.src = a.Menu.bgImageUp;
+ }
+ a.focusItem.top = -100;
+ a.clicked = false;
+ }
+ if (l.hilite) {
+ l.document.bgColor = l.menuHiliteBgColor;
+ l.zIndex = 100;
+ l.hilite.visibility = "inherit";
+ l.hilite.zIndex = 101;
+ l.document.layers[1].zIndex = 100;
+ l.focusItem.zIndex = this.zIndex +2;
+ }
+ if (l.Menu.bgImageOver) {
+ l.background.src = l.Menu.bgImageOver;
+ }
+ l.focusItem.top = this.top;
+ l.Menu.hideChildMenu(l);
+ } else if (l.style && l.Menu) {
+ if (a) {
+ a.style.backgroundColor = a.saveColor;
+ if (a.hilite) a.hilite.style.visibility = "hidden";
+ if (a.Menu.bgImageUp) {
+ a.style.background = "url(" + a.Menu.bgImageUp +")";;
+ }
+ }
+ if (l.isSeparator) return;
+ l.style.backgroundColor = l.menuHiliteBgColor;
+ l.zIndex = 100; // magic IE 4.5 mac happy doohicky. jba
+ if (l.Menu.bgImageOver) {
+ l.style.background = "url(" + l.Menu.bgImageOver +")";
+ }
+ if (l.hilite) {
+ l.style.backgroundColor = l.menuHiliteBgColor;
+ l.hilite.style.visibility = "inherit";
+ }
+ l.focusItem.style.top = l.focusItem.style.pixelTop = l.style.pixelTop;
+ l.focusItem.style.zIndex = l.zIndex +1;
+ l.Menu.hideChildMenu(l);
+ } else {
+ return; // not a menu - magic IE 4.5 mac happy doohicky. jba
+ }
+ window.ActiveMenuItem = l;
+}
+
+function onMenuItemAction(e, l) {
+ l = window.ActiveMenuItem;
+ if (!l) return;
+ hideActiveMenus();
+ //alert(l.action);
+ if (l.action) {
+ eval("" + l.action);
+ }
+ window.ActiveMenuItem = 0;
+}
+
+function FW_clearTimeout()
+{
+ if (fwHideMenuTimer) clearTimeout(fwHideMenuTimer);
+ fwHideMenuTimer = null;
+ fwDHFlag = false;
+}
+function FW_startTimeout()
+{
+ fwStart = new Date();
+ fwDHFlag = true;
+ fwHideMenuTimer = setTimeout("fwDoHide()", 1000);
+}
+
+function fwDoHide()
+{
+ if (!fwDHFlag) return;
+ var elapsed = new Date() - fwStart;
+ if (elapsed < 1000) {
+ fwHideMenuTimer = setTimeout("fwDoHide()", 1100-elapsed);
+ return;
+ }
+ fwDHFlag = false;
+ hideActiveMenus();
+ window.ActiveMenuItem = 0;
+}
+
+function FW_showMenu(menu, x, y, child) {
+ if (!window.fwWroteMenu)
+ {
+ alert('No Menu Written');
+ return;
+ }
+ FW_clearTimeout();
+ if (document.layers) {
+ if (menu) {
+ var l = menu.menuLayer || menu;
+ l.left = 1;
+ l.top = 1;
+ hideActiveMenus();
+ if (this.visibility) l = this;
+ window.ActiveMenu = l;
+ } else {
+ var l = child;
+ }
+ if (!l) return;
+ for (var i=0; i<l.layers.length; i++) {
+ if (!l.layers[i].isHilite)
+ l.layers[i].visibility = "inherit";
+ if (l.layers[i].document.layers.length > 0)
+ FW_showMenu(null, "relative", "relative", l.layers[i]);
+ }
+ if (l.parentLayer) {
+ if (x != "relative")
+ l.parentLayer.left = x || window.pageX || 0;
+ if (l.parentLayer.left + l.clip.width > window.innerWidth)
+ l.parentLayer.left -= (l.parentLayer.left + l.clip.width - window.innerWidth);
+ if (y != "relative")
+ l.parentLayer.top = y || window.pageY || 0;
+ if (l.parentLayer.isContainer) {
+ l.Menu.xOffset = window.pageXOffset;
+ l.Menu.yOffset = window.pageYOffset;
+ l.parentLayer.clip.width = window.ActiveMenu.clip.width +2;
+ l.parentLayer.clip.height = window.ActiveMenu.clip.height +2;
+ if (l.parentLayer.menuContainerBgColor) l.parentLayer.document.bgColor = l.parentLayer.menuContainerBgColor;
+ }
+ }
+ l.visibility = "inherit";
+ if (l.Menu) l.Menu.container.visibility = "inherit";
+ } else if (FIND("menuItem0")) {
+ var l = menu.menuLayer || menu;
+ hideActiveMenus();
+ if (typeof(l) == "string") {
+ l = FIND(l);
+ }
+ window.ActiveMenu = l;
+ var s = l.style;
+ s.visibility = "inherit";
+ if (x != "relative")
+ s.left = s.pixelLeft = x || (window.pageX + document.body.scrollLeft) || 0;
+ if (y != "relative")
+ s.top = s.pixelTop = y || (window.pageY + document.body.scrollTop) || 0;
+ l.Menu.xOffset = document.body.scrollLeft;
+ l.Menu.yOffset = document.body.scrollTop;
+ }
+ if (menu) {
+ window.activeMenus[window.activeMenus.length] = l;
+ }
+}
+
+function onMenuItemDown(e, l) {
+ var a = window.ActiveMenuItem;
+ if (document.layers) {
+ if (a) {
+ a.eX = e.pageX;
+ a.eY = e.pageY;
+ a.clicked = true;
+ }
+ }
+}
+
+function mouseupMenu(e)
+{
+ hideMenu(true, e);
+ hideActiveMenus();
+ return true;
+}
+
+function mouseoutMenu()
+{
+ hideMenu(false, false);
+ return true;
+}
+
+
+function hideMenu(mouseup, e) {
+ var a = window.ActiveMenuItem;
+ if (a && document.layers) {
+ a.document.bgColor = a.saveColor;
+ a.focusItem.top = -30;
+ if (a.hilite) a.hilite.visibility = "hidden";
+ if (mouseup && a.action && a.clicked && window.ActiveMenu) {
+ if (a.eX <= e.pageX+15 && a.eX >= e.pageX-15 && a.eY <= e.pageY+10 && a.eY >= e.pageY-10) {
+ setTimeout('window.ActiveMenu.Menu.onMenuItemAction();', 2);
+ }
+ }
+ a.clicked = false;
+ if (a.Menu.bgImageOver) {
+ a.background.src = a.Menu.bgImageUp;
+ }
+ } else if (window.ActiveMenu && FIND("menuItem0")) {
+ if (a) {
+ a.style.backgroundColor = a.saveColor;
+ if (a.hilite) a.hilite.style.visibility = "hidden";
+ if (a.Menu.bgImageUp) {
+ a.style.background = "url(" + a.Menu.bgImageUp +")";;
+ }
+ }
+ }
+ if (!mouseup && window.ActiveMenu) {
+ if (window.ActiveMenu.Menu) {
+ if (window.ActiveMenu.Menu.hideOnMouseOut) {
+ FW_startTimeout();
+ }
+ return(true);
+ }
+ }
+ return(true);
+}
+
+function PxToNum(pxStr)
+{ // pxStr == 27px, we want 27.
+ if (pxStr.length > 2) {
+ n = Number(pxStr.substr(0, pxStr.length-2));
+ return(n);
+ }
+ return(0);
+}
+
+function hideChildMenu(hcmLayer) {
+ FW_clearTimeout();
+ var l = hcmLayer;
+ for (var i=0; i < l.Menu.childMenus.length; i++) {
+ var theLayer = l.Menu.childMenus[i];
+ if (document.layers) {
+ theLayer.visibility = "hidden";
+ } else {
+ theLayer = FIND(theLayer);
+ theLayer.style.visibility = "hidden";
+ }
+ theLayer.Menu.hideChildMenu(theLayer);
+ }
+
+ if (l.childMenu) {
+ var childMenu = l.childMenu;
+ if (document.layers) {
+ l.Menu.FW_showMenu(null,null,null,childMenu.layers[0]);
+ childMenu.zIndex = l.parentLayer.zIndex +1;
+ childMenu.top = l.top + l.parentLayer.top + l.Menu.menuLayer.top + l.Menu.menuItemHeight/3;
+ if (childMenu.left + childMenu.clip.width > window.innerWidth) {
+ childMenu.left = l.parentLayer.left - childMenu.clip.width + l.Menu.menuLayer.left + 15;
+ l.Menu.container.clip.left -= childMenu.clip.width;
+ } else {
+ childMenu.left = l.parentLayer.left + l.parentLayer.clip.width + l.Menu.menuLayer.left -5;
+ }
+ var w = childMenu.clip.width+childMenu.left-l.Menu.container.clip.left;
+ if (w > l.Menu.container.clip.width)
+ l.Menu.container.clip.width = w;
+ var h = childMenu.clip.height+childMenu.top-l.Menu.container.clip.top;
+ if (h > l.Menu.container.clip.height) l.Menu.container.clip.height = h;
+ l.document.layers[1].zIndex = 0;
+ childMenu.visibility = "inherit";
+ } else if (FIND("menuItem0")) {
+ childMenu = FIND(l.childMenu);
+ var menuLayer = FIND(l.Menu.menuLayer);
+ var s = childMenu.style;
+ s.zIndex = menuLayer.style.zIndex+1;
+ if (document.all) { // ie case.
+ s.pixelTop = l.style.pixelTop + menuLayer.style.pixelTop + l.Menu.menuItemHeight/3;
+ left = s.pixelLeft = (menuLayer.style.pixelWidth) + menuLayer.style.pixelLeft -5;
+// alert(left + parseInt(s.width) - document.body.scrollLeft)
+ if (left + parseInt(s.width) > document.body.scrollLeft + document.body.offsetWidth)
+ left -= parseInt(s.width) + l.offsetWidth - 5;
+ s.left = left;
+
+
+ } else { // zilla case
+ var top = PxToNum(l.style.top) + PxToNum(menuLayer.style.top) + l.Menu.menuItemHeight/3;
+ var left = (PxToNum(menuLayer.style.width)) + PxToNum(menuLayer.style.left) -5;
+ s.top = top;
+// alert()
+ if (left + parseInt(s.width) > document.body.offsetWidth)
+ left -= parseInt(s.width) + l.offsetWidth - 5;
+ s.left = left;
+ }
+ childMenu.style.visibility = "inherit";
+ } else {
+ return;
+ }
+ window.activeMenus[window.activeMenus.length] = childMenu;
+ }
+}
+
+function hideActiveMenus() {
+ if (!window.activeMenus) return;
+ for (var i=0; i < window.activeMenus.length; i++) {
+ if (!activeMenus[i]) continue;
+ if (activeMenus[i].visibility && activeMenus[i].Menu) {
+ activeMenus[i].visibility = "hidden";
+ activeMenus[i].Menu.container.visibility = "hidden";
+ activeMenus[i].Menu.container.clip.left = 0;
+ } else if (activeMenus[i].style) {
+ var s = activeMenus[i].style;
+ s.visibility = "hidden";
+ s.left = -200;
+ s.top = -200;
+ }
+ }
+ if (window.ActiveMenuItem) {
+ hideMenu(false, false);
+ }
+ window.activeMenus.length = 0;
+}
+
+function isset(variable)
+{
+ if(variable==null) return false;
+ return (typeof(variable)=='undefined')?false:true;
+}
Property changes on: branches/unlabeled/unlabeled-1.6.2/admin/browse/fw_menu.js
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.6
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.6.2/admin/editor/inp_fckconfig.js
===================================================================
--- branches/unlabeled/unlabeled-1.6.2/admin/editor/inp_fckconfig.js (nonexistent)
+++ branches/unlabeled/unlabeled-1.6.2/admin/editor/inp_fckconfig.js (revision 5561)
@@ -0,0 +1,114 @@
+/*
+ * Edited by Kostja
+ * FCKeditor - The text editor for internet
+ * Copyright (C) 2003-2004 Frederico Caldeira Knabben
+ *
+ * Licensed under the terms of the GNU Lesser General Public License:
+ * http://www.opensource.org/licenses/lgpl-license.php
+ *
+ * For further information visit:
+ * http://www.fckeditor.net/
+ *
+ * File Name: fckconfig.js
+ * Editor configuration settings.
+ * See the documentation for more info.
+ *
+ * Version: 2.0 RC3
+ * Modified: 2005-02-27 21:31:48
+ *
+ * File Authors:
+ * Frederico Caldeira Knabben (fredck@fckeditor.net)
+*/
+
+//FCKConfig.CustomConfigurationsPath = '' ;
+
+//FCKConfig.EditorAreaCSS = FCKConfig.ProjectPath + 'themes/inportal_site/inc/inportal.css' ;
+
+FCKConfig.BaseHref = '' ;
+
+FCKConfig.FullPage = false ;
+
+FCKConfig.Debug = false ;
+
+FCKConfig.SkinPath = FCKConfig.BasePath + 'skins/default/' ;
+
+FCKConfig.PluginsPath = FCKConfig.BasePath + 'plugins/' ;
+
+// FCKConfig.Plugins.Add( 'placeholder', 'en,it' ) ;
+
+FCKConfig.AutoDetectLanguage = true ;
+FCKConfig.DefaultLanguage = 'en' ;
+FCKConfig.ContentLangDirection = 'ltr' ;
+
+FCKConfig.EnableXHTML = true ;
+FCKConfig.EnableSourceXHTML = true ;
+FCKConfig.FillEmptyBlocks = true ;
+FCKConfig.FormatSource = true ;
+FCKConfig.FormatOutput = true ;
+FCKConfig.FormatIndentator = ' ' ;
+FCKConfig.GeckoUseSPAN = true ;
+FCKConfig.StartupFocus = false ;
+FCKConfig.ForcePasteAsPlainText = true ;
+FCKConfig.ForceSimpleAmpersand = false ;
+FCKConfig.TabSpaces = 0;
+FCKConfig.ShowBorders = true;
+FCKConfig.ShowTableBorders = true;
+FCKConfig.UseBROnCarriageReturn = false ;
+FCKConfig.ToolbarStartExpanded = true ;
+FCKConfig.ToolbarCanCollapse = true ;
+//FCKConfig.ProjectPath = FCKConfig.BasePath.replace(/\/cmseditor\/editor\/$/,'');
+FCKConfig.IconImagesUrl = FCKConfig.ProjectPath+'kernel/user_files/icons';
+
+
+FCKConfig.ToolbarSets["Default"] = [
+ ['Cut','Copy','Paste','PasteText','PasteWord','NewPage','SelectAll','-','Link','Unlink','Anchor','-','Image','SpecialChar','-','Find','Replace','-','Rule'],
+ ['Source'],
+ '/',
+ ['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyFull','-','OrderedList','UnorderedList','Outdent','Indent'],
+ '/',
+ ['Style','RemoveFormat']
+] ;
+FCKConfig.ToolbarSets["Advanced"] = [
+ ['Cut','Copy','Paste','PasteText','PasteWord','-','NewPage','SelectAll','-','Find','Replace','-','Print','-','Link','Unlink','Anchor','Rule','-','Image','Document','Table','SpecialChar'],
+ '/',
+ ['Bold','Italic','Underline','StrikeThrough','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyFull','-','OrderedList','UnorderedList','Outdent','Indent','-','Subscript','Superscript','-','TextColor','BGColor','-','Undo','Redo'],
+ '/',
+ ['Style','FontName','FontSize','RemoveFormat','-','SpellCheck','100%','|','Source']
+] ;
+
+FCKConfig.ToolbarSets["Basic"] = [
+ ['Bold','Italic','-','OrderedList','UnorderedList','-','Link','Unlink','-','About']
+] ;
+FCKConfig.ContextMenu = ['Generic','Link','Anchor','Image','Select','Document','Textarea','Checkbox','Radio','TextField','HiddenField','ImageButton','Button','BulletedList','NumberedList','TableCell','Table','Form'] ;
+FCKConfig.FontColors = '000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,808080,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF' ;
+FCKConfig.FontNames = 'Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana' ;
+FCKConfig.FontSizes = '1/xx-small;2/x-small;3/small;4/medium;5/large;6/x-large;7/xx-large' ;
+FCKConfig.FontFormats = 'p;div;pre;address;h1;h2;h3;h4;h5;h6' ;
+FCKConfig.StylesXmlPath = '../../inp_styles.xml' ;
+FCKConfig.SpellChecker = 'ieSpell' ; // 'ieSpell' | 'SpellerPages'
+FCKConfig.IeSpellDownloadUrl = 'http://www.iespell.com/rel/ieSpellSetup211325.exe' ;
+FCKConfig.LinkBrowser = true ;
+FCKConfig.LinkBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Connector=connectors/php/connector.php&ServerPath='+FCKConfig.ProjectPath+'kernel/user_files' ;
+FCKConfig.LinkBrowserWindowWidth = screen.width * 0.7 ; // 70%
+FCKConfig.LinkBrowserWindowHeight = screen.height * 0.7 ; // 70%
+FCKConfig.ImageBrowser = true ;
+FCKConfig.ImageBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Type=Images&Connector=connectors/php/connector.php&ServerPath='+FCKConfig.ProjectPath+'kernel/user_files' ;
+FCKConfig.ImageBrowserWindowWidth = screen.width * 0.7 ; // 70% ;
+FCKConfig.ImageBrowserWindowHeight = screen.height * 0.7 ; // 70% ;
+FCKConfig.DocumentBrowser = true ;
+FCKConfig.DocumentBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Type=Documents&Connector=connectors/php/connector.php&ServerPath='+FCKConfig.ProjectPath+'kernel/user_files' ;
+FCKConfig.ImageBrowserWindowWidth = screen.width * 0.7 ; // 70% ;
+FCKConfig.ImageBrowserWindowHeight = screen.height * 0.7 ; // 70% ;
+FCKConfig.DocumentsServerPath = FCKConfig.ProjectPath+'kernel/user_files/Documents'
+FCKConfig.StructureBrowser = true ;
+FCKConfig.StructureBrowserURL = FCKConfig.ProjectPath+'/admin/index.php?t=structure/tree' ;
+FCKConfig.StructureBrowserWindowWidth = screen.width * 0.5 ; // 50%
+FCKConfig.StructureBrowserWindowHeight = screen.height * 0.7 ; // 70%
+FCKConfig.FilesBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Type=Files&Connector=connectors/php/connector.php&ServerPath='+FCKConfig.ProjectPath+'kernel/user_files/' ;
+FCKConfig.SmileyPath = FCKConfig.BasePath + 'images/smiley/msn/' ;
+FCKConfig.SmileyImages = ['regular_smile.gif','sad_smile.gif','wink_smile.gif','teeth_smile.gif','confused_smile.gif','tounge_smile.gif','embaressed_smile.gif','omg_smile.gif','whatchutalkingabout_smile.gif','angry_smile.gif','angel_smile.gif','shades_smile.gif','devil_smile.gif','cry_smile.gif','lightbulb.gif','thumbs_down.gif','thumbs_up.gif','heart.gif','broken_heart.gif','kiss.gif','envelope.gif'] ;
+FCKConfig.SmileyColumns = 8 ;
+FCKConfig.SmileyWindowWidth = 320 ;
+FCKConfig.SmileyWindowHeight = 240 ;
+
+FCKConfig.K4Mode = 1;
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.6.2/admin/editor/inp_fckconfig.js
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.6
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.6.2/admin/install/prerequisit_errors.php
===================================================================
--- branches/unlabeled/unlabeled-1.6.2/admin/install/prerequisit_errors.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.6.2/admin/install/prerequisit_errors.php (revision 5561)
@@ -0,0 +1,151 @@
+<?php
+
+define('THIS_FILE', 'admin/install/prerequisit_errors.php');
+define('IS_INSTALL',1);
+
+$pathtoroot = "";
+if( !(isset($pathtoroot) && $pathtoroot) )
+{
+ //$path=dirname(realpath(__FILE__));PATH_TRANSLATED
+ $path=dirname(realpath(__FILE__));
+ if(strlen($path))
+ {
+ /* determine the OS type for path parsing */
+ $pos = strpos($path,":");
+ if ($pos === false)
+ {
+ $gOS_TYPE="unix";
+ $pathchar = "/";
+ }
+ else
+ {
+ $gOS_TYPE="win";
+ $pathchar="\\";
+ }
+ $p = $path.$pathchar;
+ /*Start looking for the root flag file */
+ if( !isset($pathtoroot) ) $pathtoroot = '';
+ while(!strlen($pathtoroot) && strlen($p))
+ {
+ $sub = substr($p,strlen($pathchar)*-1);
+ if($sub==$pathchar)
+ {
+ $filename = $p."root.flg";
+ }
+ else
+ $filename = $p.$pathchar."root.flg";
+ if(file_exists($filename))
+ {
+ $pathtoroot = $p;
+ }
+ else
+ {
+ $parent = realpath($p.$pathchar."..".$pathchar);
+ if($parent!=$p)
+ {
+ $p = $parent;
+ }
+ else
+ $p = "";
+ }
+ }
+ if( !(isset($pathtoroot) && $pathtoroot) )
+ $pathtoroot = ".".$pathchar;
+ }
+ else
+ {
+ $pathtoroot = ".".$pathchar;
+ }
+}
+
+$sub = substr($pathtoroot,strlen($pathchar)*-1);
+if($sub!=$pathchar)
+{
+ $pathtoroot = $pathtoroot.$pathchar;
+}
+
+function GetPathChar($path = null)
+{
+ if( !isset($path) ) $path = $GLOBALS['pathtoroot'];
+ $pos = strpos($path, ':');
+ return ($pos === false) ? "/" : "\\";
+}
+$path_char = GetPathChar();
+
+$rootURL = 'http://'.dirname($_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']);
+$rootURL = str_replace('/install','',$rootURL);
+
+$tmp = explode('/', $rootURL);
+if( $tmp[ count($tmp) - 1 ] == $admin) unset( $tmp[ count($tmp) - 1 ] );
+$rootURL = implode('/', $tmp).'/';
+unset($tmp);
+
+error_reporting('E_ALL');
+ini_set('display_errors', 1);
+require_once($pathtoroot."/kernel/startup.php");
+
+$prerequisit_path = $pathtoroot.$_GET['module'].$pathchar."admin".$pathchar."install".$pathchar."prerequisit.php";
+
+if( function_exists('GetRegionalOption') )
+{
+ $charset = GetRegionalOption('Charset');
+}
+else
+{
+ $charset = 'iso-8859-1';
+}
+
+$rootURL .= 'admin/';
+
+?>
+<html>
+ <head>
+ <title>In-Portal - Module Errors</title>
+ <meta http-equiv="content-type" content="text/html;charset=<?php echo $charset; ?>">
+ <meta http-equiv="Pragma" content="no-cache">
+ <link rel="stylesheet" type="text/css" href="<?php echo $rootURL; ?>include/style.css">
+ </head>
+ <body topmargin="0" leftmargin="8" marginheight="8" marginwidth="8" bgcolor="#FFFFFF">
+ <DIV style='position:relative; z-Index: 1; background-color: #ffffff; padding-top:1px;'>
+ <div style='position:absolute; width:100%;top:0px;' align='right'>
+ <img src='<?php echo $rootURL; ?>images/logo_bg.gif'>
+ </div>
+ <img src="<?php echo $rootURL; ?>images/spacer.gif" width="1" height="7"><br>
+ <div style='z-Index:1; position:relative'>
+ <!-- ADMIN TITLE -->
+ <table cellpadding="0" cellspacing="0" border="0" width="100%">
+ <tr><td valign="top" class="admintitle" align="left">
+ <img alt="" width="46" height="46" src="<?php echo $rootURL; ?>install/ic_install.gif" align="absmiddle">&nbsp;Module Errors<br>
+ <img src='<?php echo $rootURL; ?>images/spacer.gif' width=1 height=4><br>
+ </td></tr></table>
+ <!-- SECTION NAVIGATOR -->
+ <table border="0" cellpadding="2" cellspacing="0" class="tableborder_full" width="100%" height="30"><tr>
+ <TD class="header_left_bg" width="100%">
+ <span class="tablenav_link">Install</span>
+ </td>
+ <td align="right" class="tablenav" background="<?php echo $rootURL; ?>inst_bg.jpg" width="10">
+ </td>
+ </tr>
+ </table>
+ <!-- END SECTION NAVIGATOR -->
+ <table width="100%" border="0" cellspacing="0" cellpadding="4" class="tableborder">
+ <tr>
+ <td bgcolor="F6F6F6">
+ <div class="help_box">
+<?php
+ if( file_exists($prerequisit_path) )
+ {
+ $pathtoroot .= $pathchar;
+ $show_errors = true;
+ include_once($prerequisit_path);
+ }
+
+?>
+ </h3> </div>
+
+ </td>
+
+ </tr>
+</table>
+</body>
+</html>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.6.2/admin/install/prerequisit_errors.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.6
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.6.2/core/units/relationship/relationship_event_handler.php
===================================================================
--- branches/unlabeled/unlabeled-1.6.2/core/units/relationship/relationship_event_handler.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.6.2/core/units/relationship/relationship_event_handler.php (revision 5561)
@@ -0,0 +1,200 @@
+<?php
+
+ class RelationshipEventHandler extends InpDBEventHandler
+ {
+ /**
+ * Allows to override standart permission mapping
+ *
+ */
+ function mapPermissions()
+ {
+ parent::mapPermissions();
+ $permissions = Array(
+ 'OnAddRelation' => Array('subitem' => 'add|edit'),
+ );
+ $this->permMapping = array_merge($this->permMapping, $permissions);
+ }
+
+ /**
+ * Add new relation
+ *
+ * @param kEvent $event
+ */
+ function OnAddRelation(&$event)
+ {
+ $object =& $event->getObject( Array('skip_autoload' => true) );
+
+ $table_info = $object->getLinkedInfo();
+ $main_item_type = $this->Application->getUnitOption($table_info['ParentPrefix'],'ItemType');
+
+ $target['id'] = $this->Application->GetVar('TargetId');
+ $target['type'] = $this->Application->GetVar('TargetType');
+
+
+ $object->SetDBField($table_info['ForeignKey'], $table_info['ParentId']);
+ $object->SetDBField('SourceType', $main_item_type);
+ $object->SetDBField('TargetId', $target['id']);
+ $object->SetDBField('TargetType', $target['type']);
+
+ // 1. get item info used in relation
+ $configs = $this->extractModulesInfo();
+ foreach($configs as $prefix => $config_data)
+ {
+ if($config_data['ItemType'] == $target['type']) break;
+ }
+
+ // this forces prepareOptions of kMultiLanguge formatter to substiture title field (if multilingual) of target item
+ // BUT this is not the solution, find out another way to get correct title field here
+
+ $target_object =& $this->Application->recallObject($prefix, null, Array('skip_autoload' => true));
+ $title_field = $this->Application->getUnitOption($prefix, 'TitleField');
+
+ $item['name'] = $this->Conn->GetOne('SELECT '.$title_field.' FROM '.$config_data['TableName'].' WHERE ResourceId = '.$target['id']);
+ $item['type'] = $this->Application->Phrase($config_data['TitlePhrase']);
+ $object->SetDBField('ItemName', $item['name']);
+ $object->SetDBField('ItemType', $item['type']);
+
+ $object->setID(0);
+
+ $event->redirect = false;
+
+ // 2. substitute opener
+ $opener_stack = $this->Application->RecallVar('opener_stack');
+ $opener_stack = $opener_stack ? unserialize($opener_stack) : Array();
+ array_pop($opener_stack);
+
+ $return_template = $this->Application->RecallVar('return_template');
+ $new_level = 'index4.php|'.ltrim($this->Application->BuildEnv($return_template, Array('m_opener'=>'u'),'all'),ENV_VAR_NAME.'=');
+ array_push($opener_stack,$new_level);
+ $this->Application->StoreVar('opener_stack',serialize($opener_stack));
+
+ $this->Application->SetVar($event->Prefix_Special.'_SaveEvent','OnCreate');
+ }
+
+ /**
+ * Creates needed sql query to load list,
+ * if no query is defined in config for
+ * special requested, then use default
+ * query
+ *
+ * @param kEvent $event
+ * @access protected
+ */
+ function ListPrepareQuery(&$event)
+ {
+ return $this->BaseQuery($event,'ListSQLs');
+ }
+
+ /**
+ * Creates needed sql query to load item,
+ * if no query is defined in config for
+ * special requested, then use default
+ * query
+ *
+ * @param kEvent $event
+ * @access protected
+ */
+ function ItemPrepareQuery(&$event)
+ {
+ return $this->BaseQuery($event,'ItemSQLs');
+ }
+
+
+ /**
+ * Get item name & type based on relation type & modules installed
+ *
+ * @param kEvent $event
+ * @param string $sql_field
+ */
+ function BaseQuery(&$event, $sql_field)
+ {
+ $sqls = $this->Application->getUnitOption($event->Prefix,$sql_field);
+ $sql = isset($sqls[$event->Special]) ? $sqls[$event->Special] : $sqls[''];
+
+ $configs = $this->extractModulesInfo();
+
+ // 2. build sql based on information queried
+ $sql_templates['ItemName'] = 'IFNULL(%s.%s,\' \')';
+ $sql_templates['TableJoin'] = 'LEFT JOIN %1$s ON %1$s.ResourceId = rel.TargetId';
+ $sql_templates['TargetName'] = 'IF(rel.TargetType = %s, \'%s\', %s)';
+
+ $sql_parts = Array();
+ $sql_parts['TargetName'] = "''";
+ foreach ($configs as $prefix => $config_data) {
+ // convert TitleField field of kMultiLanguage formatter used for it: begin
+ $title_field = $config_data['TitleField'];
+ $formatter_class = isset($config_data['Fields'][$title_field]['formatter']) ? $config_data['Fields'][$title_field]['formatter'] : '';
+ if ($formatter_class == 'kMultiLanguage') {
+ $ml_formatter =& $this->Application->recallObject('kMultiLanguage');
+ $title_field = $ml_formatter->LangFieldName($title_field);
+ }
+ // convert TitleField field of kMultiLanguage formatter used for it: end
+
+ $sql_parts['ItemName'][] = sprintf($sql_templates['ItemName'], $config_data['TableName'], $title_field);
+ $sql_parts['TableJoin'][] = sprintf($sql_templates['TableJoin'], $config_data['TableName']);
+
+ $sql_parts['TargetName'] = sprintf( $sql_templates['TargetName'],
+ $config_data['ItemType'],
+ '!'.$config_data['TitlePhrase'].'!',
+ $sql_parts['TargetName']);
+ $sql_parts['TargetName'] = str_replace('rel','%1$s',$sql_parts['TargetName']);
+ }
+
+ $object =& $event->getObject();
+
+ $vars = Array('#ITEM_NAMES#', '#ITEM_TYPES#');
+ $replacements = Array( implode(', ',$sql_parts['ItemName']), $sql_parts['TargetName'] );
+
+ $calculated_fields =& $object->getProperty('CalculatedFields');
+ foreach ($calculated_fields as $field_name => $field_expression) {
+ $calculated_fields[$field_name] = str_replace($vars, $replacements, $field_expression);
+ }
+
+ $object->setProperty('CalculatedFields', $calculated_fields);
+
+ $sql = str_replace('#ITEM_JOIN#', implode(' ',$sql_parts['TableJoin']), $sql);
+ $sql = str_replace('rel.','%1$s.',$sql);
+
+ return $sql;
+ }
+
+ /**
+ * Get configs from modules installed
+ *
+ * @return Array
+ * @access private
+ */
+ function extractModulesInfo()
+ {
+ // get installed modules & their config info
+ // maybe we should leave only prefixes, that have "view" permission
+ $configs = Array();
+ foreach ($this->Application->ModuleInfo as $module_name => $module_data) {
+ $prefix = $module_data['Var'];
+ $configs[$prefix] = $this->Application->getUnitOptions($prefix);
+ if($configs[$prefix] === false) unset($configs[$prefix]);
+ }
+ return $configs;
+ }
+
+
+ /**
+ * Deletes relations to hooked item from other items
+ *
+ * @param kEvent $event
+ */
+ function OnDeleteForeignRelations(&$event)
+ {
+ $main_object =& $event->MasterEvent->getObject();
+ $resource_id = $main_object->GetDBField('ResourceId');
+
+ $table = $this->Application->getUnitOption($event->Prefix,'TableName');
+ $sql = 'DELETE FROM '.$table.' WHERE TargetId = '.$resource_id;
+ $this->Conn->Query($sql);
+ }
+
+
+ }
+
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.6.2/core/units/relationship/relationship_event_handler.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.6
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.6.2/core/units/reviews/reviews_event_handler.php
===================================================================
--- branches/unlabeled/unlabeled-1.6.2/core/units/reviews/reviews_event_handler.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.6.2/core/units/reviews/reviews_event_handler.php (revision 5561)
@@ -0,0 +1,186 @@
+<?php
+
+ class ReviewsEventHandler extends InpDBEventHandler
+ {
+ /**
+ * Checks permissions of user
+ *
+ * @param kEvent $event
+ */
+ function CheckPermission(&$event)
+ {
+ if ($event->Name == 'OnAddReview') {
+ $item_prefix = $this->getPermPrefix($event);
+ $res = $this->Application->CheckPermission($item_prefix.'.REVIEW.PENDING', 0) || $this->Application->CheckPermission($item_prefix.'.REVIEW', 0);
+ if (!$res) {
+ $event->status = erPERM_FAIL;
+ }
+ return $res;
+ }
+
+ return parent::CheckPermission($event);
+ }
+
+ /**
+ * Returns prefix for permissions
+ *
+ * @param kEvent $event
+ */
+ function getPermPrefix(&$event)
+ {
+ $main_prefix = $this->Application->GetTopmostPrefix($event->Prefix);
+ // this will return LINK for l, ARTICLE for n, TOPIC for bb, PRODUCT for p
+ $item_prefix = $this->Application->getUnitOption($main_prefix, 'PermItemPrefix');
+
+ return $item_prefix;
+ }
+
+
+ /**
+ * Apply any custom changes to list's sql query
+ *
+ * @param kEvent $event
+ * @access protected
+ * @see OnListBuild
+ */
+ function SetCustomQuery(&$event)
+ {
+ $object =& $event->getObject();
+ switch ($event->Special)
+ {
+ case 'showall':
+ $object->clearFilters();
+ break;
+
+ case 'products':
+ $object->removeFilter('parent_filter'); // this is important
+ $object->addFilter('product_reviews', '%1$s.ItemId = pr.ResourceId');
+ // $object->addFilter('active', '%1$s.Status = 1');
+
+ /*$this->Application->setUnitOption('p', 'AutoLoad', true);
+ $product =& $this->Application->recallObject('p');
+ $object->addFilter('current_product', 'pr.ResourceId = '.$product->GetDBField('ResourceId'));*/
+ break;
+
+ case 'item':
+ $object->clearFilters();
+ $info = $object->getLinkedInfo();
+ $this->Application->setUnitOption($info['ParentPrefix'], 'AutoLoad', true);
+ $parent =& $this->Application->recallObject($info['ParentPrefix']);
+ $object->addFilter('item_reviews', '%1$s.ItemId = '.$parent->GetDBField('ResourceId'));
+ $object->addFilter('active', '%1$s.Status = 1');
+ break;
+
+ case 'product':
+ $object->clearFilters();
+ $object->addFilter('product_reviews', '%1$s.ItemId = pr.ResourceId');
+ $object->addFilter('active', '%1$s.Status = 1');
+ $this->Application->setUnitOption('p', 'AutoLoad', true);
+ $product =& $this->Application->recallObject('p');
+ $object->addFilter('current_product', 'pr.ResourceId = '.$product->GetDBField('ResourceId'));
+
+ break;
+ }
+
+ if($event->getEventParam('type') == 'current_user')
+ {
+ $user_id = $this->Application->GetVar('u_id') ? $this->Application->GetVar('u_id') : -2;
+ $ip = $_SERVER['REMOTE_ADDR'];
+ $object =& $event->getObject( Array('skip_autoload' => true) );
+ $product_info = $object->getLinkedInfo();
+ $object->addFilter('current_item', '%1$s.ItemId = '.$product_info['ParentId']);
+ $object->addFilter('current_user', '%1$s.CreatedById = '.$user_id);
+ $object->addFilter('current_ip', '%1$s.IPAddress = "'.$ip.'"');
+
+ }
+ }
+
+ /**
+ * Adds review from front in case if user is logged in
+ *
+ * @param kEvent $event
+ */
+ function OnAddReview(&$event)
+ {
+ $user_id = ($this->Application->GetVar('u_id') == 0) ? -2 : $this->Application->GetVar('u_id');
+ $event->redirect_params = Array('pass' => 'all,p');
+
+ $object =& $event->getObject( Array('skip_autoload' => true) );
+ $parent_info = $object->getLinkedInfo();
+ $review_fields = $this->Application->GetVar($event->getPrefixSpecial(true));
+
+ $sql = ' SELECT * FROM '.TABLE_PREFIX.'SpamControl
+ WHERE ItemResourceId='.$parent_info['ParentId'].'
+ AND IPaddress="'.$_SERVER['REMOTE_ADDR'].'"
+ AND PortalUserId='.$user_id.'
+ AND DataType="Review"';
+ $res = $this->Conn->GetRow($sql);
+
+ if( $res && $res['Expire'] < adodb_mktime() )
+ {
+ $sql = ' DELETE FROM '.TABLE_PREFIX.'SpamControl
+ WHERE ItemResourceId='.$parent_info['ParentId'].'
+ AND IPaddress="'.$_SERVER['REMOTE_ADDR'].'"
+ AND PortalUserId='.$user_id.'
+ AND DataType="Review"';
+ $this->Conn->Query($sql);
+ unset($res);
+ }
+
+ if(!$res)
+ {
+ $object->SetFieldsFromHash( array_shift($review_fields) );
+ $object->SetDBField('CreatedById', $user_id);
+ $object->SetDBField('IPAddress', $_SERVER['REMOTE_ADDR']);
+ $object->SetDBField('CreatedOn', adodb_mktime());
+
+ $module_info = $this->Application->findModule('Var',$parent_info['ParentPrefix']);
+ $object->SetDBField('Module', $module_info['Name']);
+ if( $this->Application->CheckPermission( $this->getPermPrefix($event).'REVIEW.PENDING', 0) )
+ {
+ $object->SetDBField('Status', 2);
+ }
+ if( $this->Application->CheckPermission($this->getPermPrefix($event).'REVIEW', 0) )
+ {
+ $object->SetDBField('Status', 1);
+ }
+
+ $object->SetDBField('ItemId', $parent_info['ParentId']);
+
+ $event->CallSubEvent('OnCreate');
+
+ if($event->status == erSUCCESS)
+ {
+ $parent =& $this->Application->recallObject($parent_info['ParentPrefix']);
+ $sql = ' SELECT COUNT(ReviewId)
+ FROM '.$object->TableName.'
+ WHERE ItemId='.$parent_info['ParentId'];
+ $review_qty = $this->Conn->GetOne($sql);
+ $parent->SetDBField('CachedReviewsQty', $review_qty);
+ $parent->Update();
+ $expire = adodb_mktime() + $this->Application->ConfigValue('product_ReviewDelay_Value') * $this->Application->ConfigValue('product_ReviewDelay_Interval');
+ $sql = ' INSERT INTO '.TABLE_PREFIX.'SpamControl
+ (ItemResourceId, IPaddress, PortalUserId, DataType, Expire)
+ VALUES ('.$parent_info['ParentId'].',
+ "'.$_SERVER['REMOTE_ADDR'].'",
+ '.$user_id.',
+ "Review",
+ '.$expire.')';
+ $this->Conn->Query($sql);
+
+ $event->redirect_params = Array('pass' => 'all,'.$parent_info['ParentPrefix']);
+ $event->redirect = $this->Application->GetVar('success_template');
+ }
+ }
+ else
+ {
+// $this->Application->removeObject($event->getPrefixSpecial());
+ $event->status == erFAIL;
+ $event->redirect=false;
+ $object->FieldErrors['ReviewText']['pseudo'] = 'too_frequent';
+ $object->ErrorMsgs['too_frequent'] = $this->Application->Phrase('lu_ferror_review_duplicate');
+ }
+ }
+ }
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.6.2/core/units/reviews/reviews_event_handler.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.6
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.6.2/core/units/categories/cache_updater.php
===================================================================
--- branches/unlabeled/unlabeled-1.6.2/core/units/categories/cache_updater.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.6.2/core/units/categories/cache_updater.php (revision 5561)
@@ -0,0 +1,360 @@
+<?php
+class clsRecursionStack
+{
+ var $Stack;
+
+ function clsRecursionStack()
+ {
+ $this->Stack = Array();
+ }
+
+ function Push($values)
+ {
+ array_push($this->Stack, $values);
+ }
+
+ function Pop()
+ {
+ if ($this->Count() > 0) {
+ return array_pop($this->Stack);
+ }
+ else {
+ return false;
+ }
+ }
+
+ function Get()
+ {
+ if ($this->Count() > 0) {
+// return end($this->Stack);
+ return $this->Stack[count($this->Stack)-1];
+ }
+ else {
+ return false;
+ }
+ }
+
+ function Update($values)
+ {
+ $this->Stack[count($this->Stack)-1] = $values;
+ }
+
+ function Count()
+ {
+ return count($this->Stack);
+ }
+}
+
+
+class clsCachedPermissions
+{
+ var $Allow = Array();
+ var $Deny = Array();
+ var $CatId;
+
+ function clsCachedPermissions($CatId)
+ {
+ $this->CatId = $CatId;
+ }
+
+ function SetCatId($CatId)
+ {
+ $this->CatId = $CatId;
+ }
+
+ function CheckPermArray($Perm)
+ {
+ if (!isset($this->Allow[$Perm])) {
+ $this->Allow[$Perm] = array();
+ $this->Deny[$Perm] = array();
+ }
+ }
+
+ function AddAllow($Perm, $GroupId)
+ {
+ $this->CheckPermArray($Perm);
+ if (!in_array($GroupId, $this->Allow[$Perm])) {
+ array_push($this->Allow[$Perm], $GroupId);
+ $this->RemoveDeny($Perm, $GroupId);
+ }
+ }
+
+ function AddDeny($Perm, $GroupId)
+ {
+ $this->CheckPermArray($Perm);
+ if (!in_array($GroupId, $this->Deny[$Perm])) {
+ array_push($this->Deny[$Perm], $GroupId);
+ $this->RemoveAllow($Perm, $GroupId);
+ }
+ }
+
+ function RemoveDeny($Perm, $GroupId)
+ {
+ if (in_array($GroupId, $this->Deny[$Perm])) {
+ array_splice($this->Deny[$Perm], array_search($GroupId, $this->Deny[$Perm]), 1);
+ }
+ }
+
+ function RemoveAllow($Perm, $GroupId)
+ {
+ if (in_array($GroupId, $this->Allow[$Perm])) {
+ array_splice($this->Allow[$Perm], array_search($GroupId, $this->Allow[$Perm]), 1);
+ }
+ }
+
+ function GetInsertSQL()
+ {
+ $values = array();
+
+ $has_deny = array();
+
+ // don't write DACL at all
+ /*foreach ($this->Deny as $perm => $groups) {
+ if (count($groups) > 0) {
+ $values[] = '('.$this->CatId.', '.$perm.', "", "'.join(',', $groups).'")';
+ $has_deny[] = $perm;
+ }
+ }*/
+
+ foreach ($this->Allow as $perm => $groups) {
+// if (in_array($perm, $has_deny)) continue;
+ if (count($groups) > 0) {
+ $values[] = '(' .$this->CatId. ', ' .$perm. ', "' .join(',', $groups). '", "")';
+ }
+ }
+ if (!$values) return '';
+ $sql = 'INSERT INTO '.TABLE_PREFIX.'PermCache (CategoryId, PermId, ACL, DACL) VALUES '.join(',', $values);
+ return $sql;
+ }
+}
+
+class kPermCacheUpdater extends kHelper
+{
+ var $Stack;
+ var $iteration;
+ var $totalCats;
+ var $doneCats;
+ var $table;
+
+ var $root_prefixes = Array();
+ var $TitleField = '';
+
+ function Init($prefix, $special, $event_params = null)
+ {
+ parent::Init($prefix, $special, $event_params);
+
+ $ml_formatter =& $this->Application->recallObject('kMultiLanguage');
+ $this->TitleField = $ml_formatter->LangFieldName('Name');
+
+ $continuing = $event_params['continue'];
+
+ foreach ($this->Application->ModuleInfo as $module_name => $module_info) {
+ $this->root_prefixes[ $module_info['RootCat'] ] = $module_info['Var'];
+ }
+
+ $this->iteration = 0;
+ $this->table = $this->Application->GetTempName('permCacheUpdate');
+
+ if ($continuing == 1) {
+ $this->InitUpdater();
+ }
+ elseif ($continuing == 2) {
+ $this->getData();
+ }
+ }
+
+ function InitUpdater($continue)
+ {
+ $this->Stack =& new clsRecursionStack();
+ $sql = 'DELETE FROM '.TABLE_PREFIX.'PermCache';
+ $this->Conn->Query($sql);
+ $this->initData();
+ }
+
+ function getDonePercent()
+ {
+ if(!$this->totalCats)return 0;
+ return intval( round( $this->doneCats / $this->totalCats * 100 ) );
+ }
+
+ function getData()
+ {
+ $tmp = $this->Conn->GetOne('SELECT data FROM '.$this->table);
+ if ($tmp) $tmp = unserialize($tmp);
+
+ $this->totalCats = isset($tmp['totalCats']) ? $tmp['totalCats'] : 0;
+ $this->doneCats = isset($tmp['doneCats']) ? $tmp['doneCats'] : 0;
+ if (isset($tmp['stack'])) {
+ $this->Stack = $tmp['stack'];
+ }
+ else {
+ $this->Stack = & new clsRecursionStack();
+ }
+ }
+
+ function setData()
+ {
+ $tmp = Array (
+ 'totalCats' => $this->totalCats,
+ 'doneCats' => $this->doneCats,
+ 'stack' => $this->Stack,
+ );
+
+ $this->Conn->Query('DELETE FROM '.$this->table);
+
+ $fields_hash = Array('data' => serialize($tmp));
+ $this->Conn->doInsert($fields_hash, $this->table);
+ }
+
+ function initData()
+ {
+ $this->clearData(); // drop table before starting anyway
+
+ $this->Conn->Query('CREATE TABLE '.$this->table.'(data LONGTEXT)');
+
+ $this->totalCats = (int)$this->Conn->GetOne('SELECT COUNT(*) FROM '.TABLE_PREFIX.'Category');
+ $this->doneCats = 0;
+ }
+
+ function clearData()
+ {
+ $this->Conn->Query('DROP TABLE IF EXISTS '.$this->table);
+ }
+
+ function DoTheJob()
+ {
+ $data = $this->Stack->Get();
+ if ($data === false) { //If Stack is empty
+ $data['current_id'] = 0;
+ $data['title'] = Array();
+ $data['named_path'] = Array();
+ $data['category_template'] = '';
+ $data['item_template'] = '';
+ $this->Stack->Push($data);
+ }
+
+ if (!isset($data['queried'])) {
+ $this->QueryTitle($data);
+ $this->QueryChildren($data);
+ $this->QueryPermissions($data);
+ $data['queried'] = 1;
+
+ if ($sql = $data['perms']->GetInsertSQL()) {
+ $this->Conn->Query($sql);
+ $this->doneCats++;
+ }
+ $this->iteration++;
+ }
+
+ // start with first child if we haven't started yet
+ if (!isset($data['current_child'])) $data['current_child'] = 0;
+
+ // if we have more children
+ if (isset($data['children'][$data['current_child']])) {
+ $next_data = Array();
+ $next_data['title'] = $data['title'];
+ $next_data['named_path'] = $data['named_path'];
+ $next_data['category_template'] = $data['category_template'];
+ $next_data['item_template'] = $data['item_template'];
+ $next_data['current_id'] = $data['children'][ $data['current_child'] ]; //next iteration should process child
+ $next_data['perms'] = $data['perms']; //we should copy our permissions to child - inheritance
+ $next_data['perms']->SetCatId($next_data['current_id']);
+ $data['current_child']++;
+ $this->Stack->Update($data); //we need to update ourself for the iteration after the next (or further) return to next child
+ $this->Stack->Push($next_data); //next iteration should process this child
+ return true;
+ }
+ else {
+ $this->UpdateCachedPath($data);
+ $this->Stack->Pop(); //remove ourself from stack if we have finished all the childs (or there are none)
+ // we are getting here if we finished with current level, so check if it's first level - then bail out.
+ return $this->Stack->Count() > 0;
+ }
+ }
+
+ function UpdateCachedPath(&$data)
+ {
+ $fields_hash = Array( 'CachedNavbar' => implode('>', $data['title']),
+ 'NamedParentPath' => implode('/', $data['named_path'] ),
+ 'CachedCategoryTemplate'=> $data['category_template'],
+ 'CachedItemTemplate' => $data['item_template'],
+ );
+
+ $this->Conn->doUpdate($fields_hash, TABLE_PREFIX.'Category', 'CategoryId = '.$data['current_id']);
+ }
+
+ function QueryTitle(&$data)
+ {
+ $category_id = $data['current_id'];
+ $sql = 'SELECT '.$this->TitleField.', Filename, CategoryTemplate, ItemTemplate
+ FROM '.TABLE_PREFIX.'Category
+ WHERE CategoryId = '.$category_id;
+
+ $record = $this->Conn->GetRow($sql);
+ if ($record) {
+ $data['title'][] = $record[$this->TitleField];
+ $data['named_path'][] = $record['Filename'];
+
+ // it is one of the modules root category
+ $root_prefix = isset($this->root_prefixes[$category_id]) ? $this->root_prefixes[$category_id] : false;
+ if ($root_prefix) {
+ $fields_hash = Array();
+ if (!$record['CategoryTemplate']) {
+ $record['CategoryTemplate'] = $this->Application->ConfigValue($root_prefix.'_CategoryTemplate');
+ $fields_hash['CategoryTemplate'] = $record['CategoryTemplate'];
+ }
+
+ if (!$record['ItemTemplate']) {
+ $record['ItemTemplate'] = $this->Application->ConfigValue($root_prefix.'_ItemTemplate');
+ $fields_hash['ItemTemplate'] = $record['ItemTemplate'];
+ }
+
+ $this->Conn->doUpdate($fields_hash, TABLE_PREFIX.'Category', 'CategoryId = '.$category_id);
+ }
+
+ // if explicitly set, then use it; use parent template otherwise
+ if ($record['CategoryTemplate']) {
+ $data['category_template'] = $record['CategoryTemplate'];
+ }
+
+ if ($record['ItemTemplate']) {
+ $data['item_template'] = $record['ItemTemplate'];
+ }
+ }
+
+ }
+
+ function QueryChildren(&$data)
+ {
+ $sql = 'SELECT CategoryId
+ FROM '.TABLE_PREFIX.'Category
+ WHERE ParentId = '.$data['current_id'];
+ $data['children'] = $this->Conn->GetCol($sql);
+ }
+
+ function QueryPermissions(&$data)
+ {
+ // don't search for section "view" permissions here :)
+ $sql = 'SELECT ipc.PermissionConfigId, ip.GroupId, ip.PermissionValue
+ FROM '.TABLE_PREFIX.'Permissions AS ip
+ LEFT JOIN '.TABLE_PREFIX.'PermissionConfig AS ipc ON ipc.PermissionName = ip.Permission
+ WHERE (CatId = '.$data['current_id'].') AND (Permission LIKE "%.VIEW") AND (ip.Type = 0)';
+
+ $records = $this->Conn->Query($sql);
+
+ //create permissions array only if we don't have it yet (set by parent)
+ if (!isset($data['perms'])) {
+ $data['perms'] = new clsCachedPermissions($data['current_id']);
+ }
+
+ foreach ($records as $record) {
+ if ($record['PermissionValue'] == 1) {
+ $data['perms']->AddAllow($record['PermissionConfigId'], $record['GroupId']);
+ }
+ else {
+ $data['perms']->AddDeny($record['PermissionConfigId'], $record['GroupId']);
+ }
+ }
+ }
+}
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.6.2/core/units/categories/cache_updater.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.6
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.6.2/core/units/modules/modules_config.php
===================================================================
--- branches/unlabeled/unlabeled-1.6.2/core/units/modules/modules_config.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.6.2/core/units/modules/modules_config.php (revision 5561)
@@ -0,0 +1,121 @@
+<?php
+
+$config = Array(
+ 'Prefix' => 'mod',
+ 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
+ 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
+ 'EventHandlerClass' => Array('class'=>'ModulesEventHandler','file'=>'modules_event_handler.php','build_event'=>'OnBuild'),
+ 'TagProcessorClass' => Array('class'=>'ModulesTagProcessor','file'=>'modules_tag_processor.php','build_event'=>'OnBuild'),
+ 'AutoLoad' => true,
+ 'QueryString' => Array(
+ 1 => 'id',
+ 2 => 'page',
+ 3 => 'event',
+ 4 => 'mode',
+ ),
+
+ 'IDField' => 'Name',
+ 'TitleField' => 'Name', // field, used in bluebar when editing existing item
+ 'StatusField' => Array('Loaded'),
+
+ 'TitlePresets' => Array(
+ 'modules_list' => Array( 'prefixes' => Array('mod_List'), 'format' => "!la_title_Configuration! - !la_title_Module_Status! (#mod_recordcount#)"),
+
+ 'tree_modules' => Array('format' => '!la_section_overview!'),
+ ),
+
+ 'PermSection' => Array('main' => 'in-portal:mod_status'),
+
+ 'Sections' => Array(
+ // "Configuration" -> "Modules and Settings"
+ 'in-portal:modules' => Array(
+ 'parent' => 'in-portal:system',
+ 'icon' => 'modules',
+ 'label' => 'la_tab_ModulesManagement',
+ 'url' => Array('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 5,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:mod_status' => Array(
+ 'parent' => 'in-portal:modules',
+ 'icon' => 'modules',
+ 'label' => 'la_title_Module_Status',
+ 'url' => Array('t' => 'modules/modules_list', 'pass' => 'm'),
+ 'permissions' => Array('view', 'edit', 'advanced:approve', 'advanced:decline'),
+ 'priority' => 1,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:addmodule' => Array(
+ 'parent' => 'in-portal:modules',
+ 'icon' => 'modules',
+ 'label' => 'la_title_Add_Module',
+ 'url' => Array('index_file' => 'modules/addmodule.php', 'pass' => 'm'),
+ 'permissions' => Array('view', 'add', 'edit'),
+ 'priority' => 2,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:tag_library' => Array(
+ 'parent' => 'in-portal:modules',
+ 'icon' => 'modules',
+ 'label' => 'la_tab_TagLibrary',
+ 'url' => Array('index_file' => 'tag_listing.php', 'pass' => 'm'),
+ 'permissions' => Array('view'),
+ 'priority' => 3,
+ 'type' => stTREE,
+ ),
+ ),
+
+ 'TableName' => TABLE_PREFIX.'Modules',
+
+ 'FilterMenu' => Array(
+ 'Groups' => Array(
+ Array('mode' => 'AND', 'filters' => Array('enabled', 'disabled'), 'type' => WHERE_FILTER),
+ ),
+ 'Filters' => Array(
+ 'enabled' => Array('label' =>'la_Enabled', 'on_sql' => '', 'off_sql' => '%1$s.Loaded != 1'),
+ 'disabled' => Array('label' => 'la_Disabled', 'on_sql' => '', 'off_sql' => '%1$s.Loaded != 0'),
+ )
+ ),
+
+ 'ListSQLs' => Array( ''=>'SELECT * FROM %s',
+ ), // key - special, value - list select sql
+ 'ItemSQLs' => Array( ''=>'SELECT * FROM %s',
+ ),
+ 'ListSortings' => Array(
+ '' => Array(
+ 'Sorting' => Array('LoadOrder' => 'asc'),
+ )
+ ),
+
+ 'Fields' => Array(
+ 'Name' => Array('type' => 'string','not_null' => '1','default' => ''),
+ 'Path' => Array('type' => 'string','not_null' => '1','default' => ''),
+ 'Var' => Array('type' => 'string','not_null' => '1','default' => ''),
+ 'Version' => Array('type' => 'string','not_null' => '1','default' => ''),
+ 'Loaded' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array(1 => 'la_Enabled', 0 => 'la_Disabled'), 'use_phrases' => 1, 'not_null' => '1','default' => '1'),
+ 'LoadOrder' => Array('type' => 'int','not_null' => '1','default' => '0'),
+ 'TemplatePath' => Array('type' => 'string','not_null' => '1','default' => ''),
+ 'RootCat' => Array('type' => 'int','not_null' => '1','default' => '0'),
+ 'BuildDate' => Array('type' => 'double', 'formatter' => 'kDateFormatter', 'not_null' => '1','default' => ''),
+ ),
+
+ 'VirtualFields' => Array(),
+
+ 'Grids' => Array(
+ 'Default' => Array(
+ 'Icons' => Array('default' => 'icon16_custom.gif'),
+ 'Fields' => Array(
+ 'Name' => Array('title' => 'la_col_Name', 'data_block' => 'grid_checkbox_td_no_icon'),
+ 'Loaded' => Array('title' => 'la_col_Status'),
+ 'Version' => Array('title' => 'la_col_Version'),
+ ),
+
+ ),
+ ),
+ );
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.6.2/core/units/modules/modules_config.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.6
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.6.2/core/units/permissions/permissions_event_handler.php
===================================================================
--- branches/unlabeled/unlabeled-1.6.2/core/units/permissions/permissions_event_handler.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.6.2/core/units/permissions/permissions_event_handler.php (revision 5561)
@@ -0,0 +1,183 @@
+<?php
+
+class PermissionsEventHandler extends InpDBEventHandler {
+
+ /**
+ * Allows to override standart permission mapping
+ *
+ */
+ function mapPermissions()
+ {
+ parent::mapPermissions();
+ $permissions = Array(
+ 'OnGroupSavePermissions' => Array('subitem' => 'advanced:manage_permissions'),
+ );
+ $this->permMapping = array_merge($this->permMapping, $permissions);
+ }
+
+ /**
+ * Save category permissions
+ *
+ * @param kEvent $event
+ */
+ function OnCategorySavePermissions(&$event)
+ {
+ $group_id = $this->Application->GetVar('current_group_id');
+ $category_id = $this->Application->GetVar('c_id');
+ $permissions = $this->Application->GetVar($event->getPrefixSpecial(true));
+ if (isset($permissions[$group_id])) {
+ $permissions = $permissions[$group_id];
+
+ $object =& $event->getObject( Array('skip_autoload' => true) );
+ $permissions_helper =& $this->Application->recallObject('PermissionsHelper');
+ $permissions_helper->LoadPermissions($group_id, $category_id, 0, true);
+
+ // format: <perm_name>['inherited'] || <perm_name>['value']
+
+ $delete_ids = Array();
+ $create_sql = Array();
+ $update_sql = Array();
+ $create_mask = '(%s,%s,'.$group_id.',%s,0,'.$category_id.')';
+ $new_id = (int)$this->Conn->GetOne('SELECT MIN('.$object->IDField.') FROM '.$object->TableName);
+ if($new_id > 0) $new_id = 0;
+ --$new_id;
+
+ foreach ($permissions as $perm_name => $perm_data) {
+ $inherited = $perm_data['inherited'];
+ $perm_value = isset($perm_data['value']) ? $perm_data['value'] : false;
+ $perm_id = $permissions_helper->getPermissionID($perm_name);
+
+ if ($inherited && ($perm_id != 0)) {
+ // permission become inherited (+ direct value was set before) => DELETE
+ $delete_ids[] = $permissions_helper->getPermissionID($perm_name);
+ }
+
+ if (!$inherited) {
+ // not inherited
+ if (($perm_id != 0) && ($perm_value != $permissions_helper->getPermissionValue($perm_name))) {
+ // record was found in db & new value differs from old one => UPDATE
+ $update_sql[] = ' UPDATE '.$object->TableName.'
+ SET PermissionValue = '.$perm_value.'
+ WHERE (PermissionId = '.$perm_id.')';
+ }
+
+ if ($perm_id == 0) {
+ // not found in db, but set directly => INSERT
+ $create_sql[] = sprintf($create_mask, $new_id--, $this->Conn->qstr($perm_name), $this->Conn->qstr($perm_value));
+ }
+ }
+ // permission state was not changed in all other cases
+ }
+
+ $this->UpdatePermissions($event, $create_sql, $update_sql, $delete_ids);
+ }
+
+ $event->MasterEvent->SetRedirectParam('item_prefix', $this->Application->GetVar('item_prefix'));
+ $event->MasterEvent->SetRedirectParam('group_id', $this->Application->GetVar('group_id'));
+ }
+
+ /**
+ * Saves permissions while editing group
+ *
+ * @param kEvent $event
+ */
+ function OnGroupSavePermissions(&$event)
+ {
+ if (!$this->Application->CheckPermission('in-portal:user_groups.advanced:manage_permissions', 1)) {
+ // no permission to save permissions
+ return false;
+ }
+
+ $permissions = $this->Application->GetVar($event->getPrefixSpecial(true));
+ if (!$permissions) {
+ return false;
+ }
+
+ $object =& $event->getObject( Array('skip_autoload' => true) );
+ $group_id = $this->Application->GetVar('g_id');
+ $permissions_helper =& $this->Application->recallObject('PermissionsHelper');
+ $permissions_helper->LoadPermissions($group_id, 0, 1);
+
+ $delete_ids = Array();
+ $create_sql = Array();
+ $create_mask = '(%s,%s,'.$group_id.',%s,1,0)';
+
+ $new_id = (int)$this->Conn->GetOne('SELECT MIN('.$object->IDField.') FROM '.$object->TableName);
+ if($new_id > 0) $new_id = 0;
+ --$new_id;
+
+ foreach ($permissions as $section_name => $section_permissions) {
+ foreach ($section_permissions as $perm_name => $perm_value) {
+
+ if (!$permissions_helper->isOldPermission($section_name, $perm_name)) {
+ $perm_name = $section_name.'.'.$perm_name;
+ }
+
+ $db_perm_value = $permissions_helper->getPermissionValue($perm_name);
+ if ($db_perm_value == 1 && $perm_value == 0) {
+ // permission was disabled => delete it's record
+ $delete_ids[] = $permissions_helper->getPermissionID($perm_name);
+ }
+ elseif ($db_perm_value == 0 && $perm_value == 1) {
+ // permission was enabled => created it's record
+ $create_sql[] = sprintf($create_mask, $new_id--, $this->Conn->qstr($perm_name), $this->Conn->qstr($perm_value));
+ }
+ // permission state was not changed in all other cases
+ }
+ }
+
+ $this->UpdatePermissions($event, $create_sql, Array(), $delete_ids);
+
+ if ($this->Application->GetVar('advanced_save') == 1) {
+ // advanced permission popup [save button]
+ $this->finalizePopup($event);
+// $event->redirect = 'incs/just_close';
+ }
+ elseif ($this->Application->GetVar('section_name') != '') {
+ // save simple permissions before opening advanced permission popup
+ $event->redirect = false;
+ }
+
+ }
+
+ /**
+ * Apply modification sqls to permissions table
+ *
+ * @param kEvent $event
+ * @param Array $create_sql
+ * @param Array $update_sql
+ * @param Array $delete_ids
+ */
+ function UpdatePermissions(&$event, $create_sql, $update_sql, $delete_ids)
+ {
+ $object =& $event->getObject();
+
+ if ($delete_ids) {
+ $delete_sql = ' DELETE FROM '.$object->TableName.'
+ WHERE '.$object->IDField.' IN ('.implode(',', $delete_ids).')';
+ $this->Conn->Query($delete_sql);
+ }
+
+ if ($create_sql) {
+ $create_sql = ' INSERT INTO '.$object->TableName.'
+ VALUES '.implode(',', $create_sql);
+ $this->Conn->Query($create_sql);
+ }
+
+ if ($update_sql) {
+ foreach ($update_sql as $sql) {
+ $this->Conn->Query($sql);
+ }
+ }
+
+ if ($delete_ids || $create_sql || $update_sql) {
+ $object->setModifiedFlag();
+
+ if ($event->Name == 'OnCategorySavePermissions') {
+ $this->Application->StoreVar('PermCache_UpdateRequired', 1);
+ }
+ }
+ }
+}
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.6.2/core/units/permissions/permissions_event_handler.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.6
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.6.2/core/units/general/helpers/modules.php
===================================================================
--- branches/unlabeled/unlabeled-1.6.2/core/units/general/helpers/modules.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.6.2/core/units/general/helpers/modules.php (revision 5561)
@@ -0,0 +1,370 @@
+<?php
+
+ class kModulesHelper extends kHelper {
+
+ function checkLogin()
+ {
+ return $this->_GetModules();
+ }
+
+ function getWhereClause()
+ {
+ $where_clause = Array('Loaded = 1');
+
+ if (!$this->Application->IsAdmin()) return implode(' AND ', $where_clause);
+
+ $modules = $this->_GetModules();
+ if ($modules) {
+ foreach ($modules as $module_index => $module) {
+ $modules[$module_index] = $this->Conn->qstr($module);
+ }
+ $where_clause[] = 'Name IN ('.implode(',', $modules).')';
+ }
+
+ return implode(' AND ', $where_clause);
+ }
+
+ function _EnableCookieSID()
+ {
+ $session =& $this->Application->recallObject('Session');
+ return $session->CookiesEnabled;
+ }
+
+ function _IsSpider($UserAgent)
+ {
+ global $robots;
+ $lines = file(FULL_PATH.'/robots_list.txt');
+
+ if (!is_array($robots)) {
+ $robots = Array();
+ for($i = 0; $i < count($lines); $i++) {
+ $l = $lines[$i];
+ $p = explode("\t", $l, 3);
+ $robots[] = $p[2];
+ }
+ }
+ return in_array($UserAgent, $robots);
+ }
+
+ function _MatchIp($ip1, $ip2)
+ {
+ $matched = TRUE;
+
+ $ip = explode('.', $ip1);
+ $MatchIp = explode('.', $ip2);
+ for ($i = 0; $i < count($ip); $i++) {
+ if($i == count($MatchIp)) break;
+ if (trim($ip[$i]) != trim($MatchIp[$i]) || trim($ip[$i]) == '*') {
+ $matched = FALSE;
+ break;
+ }
+ }
+ return $matched;
+ }
+
+ function _IpAccess($IpAddress, $AllowList, $DenyList)
+ {
+ $allowed = explode(',', $AllowList);
+ $denied = explode(',', $DenyList);
+
+ $MatchAllowed = FALSE;
+ for ($x = 0; $x < count($allowed); $x++) {
+ $ip = explode('.', $allowed[$x]);
+
+ $MatchAllowed = $this->_MatchIp($IpAddress, $allowed[$x]);
+ if ($MatchAllowed)
+ break;
+ }
+ $MatchDenied = FALSE;
+ for ($x = 0; $x < count($denied); $x++) {
+ $ip = explode('.', $denied[$x]);
+
+ $MatchDenied = $this->_MatchIp($IpAddress, $denied[$x]);
+ if ($MatchDenied)
+ break;
+ }
+
+ $Result = (($MatchAllowed && !$MatchDenied) || (!$MatchAllowed && !$MatchDenied) ||
+ ($MatchAllowed && $MatchDenied));
+ return $Result;
+ }
+
+ /**
+ * Reads config.php file and parses it
+ *
+ */
+ function _readConfig()
+ {
+ $vars = parse_portal_ini(FULL_PATH.'/config.php');
+
+ foreach ($vars as $config_key => $config_value) {
+ $GLOBALS['g_'.$config_key] = $config_value;
+ }
+ }
+
+ /**
+ * Leaves only domain part from hostname (e.g. extract "intechnic.lv" from "test.intechnic.lv")
+ * Used for admin login license check
+ *
+ * @param string $d
+ * @return string
+ */
+ function _StripDomainHost($d)
+ {
+ $IsIp = false;
+ $dotcount = substr_count($d, '.');
+ if ($dotcount == 3) {
+ $IsIp = true;
+ for ($x = 0; $x < strlen($d); $x++) {
+ if (!is_numeric(substr($d, $x, 1)) && substr($d, $x, 1) != '.')
+ {
+ $IsIp = false;
+ break;
+ }
+ }
+ }
+
+ if ($dotcount > 1 && !$IsIp) {
+ $p = explode('.', $d);
+ $ret = $p[count($p) - 2].'.'.$p[count($p) - 1];
+ }
+ else {
+ $ret = $d;
+ }
+ return $ret;
+ }
+
+ /**
+ * When logging into admin then check only last 2 parts of host name VS domain in license
+ *
+ * @param string $user_domain
+ * @param string $license_domain
+ * @return int
+ */
+ function _CheckDomain($user_domain, $license_domain)
+ {
+ if ($this->Application->IsAdmin()) {
+ $user_domain = $this->_StripDomainHost($user_domain);
+ return preg_match('/(.*)'.preg_quote($user_domain, '/').'$/', $license_domain);
+ }
+ else {
+ return preg_match('/(.*)'.preg_quote($license_domain, '/').'$/', $user_domain);
+ }
+ }
+
+ /**
+ * Returns modules list, that are in license
+ *
+ * @return Array
+ */
+ function _GetModules()
+ {
+ global $i_Keys;
+ static $modules = null;
+
+ if (isset($modules)) return $modules;
+
+ $this->_readConfig();
+ $license = base64_decode($GLOBALS['g_License']);
+ $this->_ParseLicense($license);
+
+ $modules = Array();
+ $domain = $this->_GetDomain();
+ if (!$this->_IsLocalSite($domain)) {
+ for ($x = 0; $x < count($i_Keys); $x++) {
+ $key = $i_Keys[$x];
+ if ($this->_CheckDomain($domain, $key['domain'])) {
+ // used hostname is subdomain or matches domain from license
+ $modules = explode(',', $key['mod']);
+ }
+ }
+ }
+ else {
+ $modules = array_keys($this->Application->ModuleInfo);
+ }
+
+ return $modules;
+ }
+
+ /**
+ * Allows to determine if module is licensed
+ *
+ * @param string $name
+ * @return bool
+ */
+ function _ModuleLicensed($name)
+ {
+ $modules = $this->_GetModules();
+ return in_array($name, $modules);
+ }
+
+ /**
+ * Returns domain from licences (and direct in case of install script)
+ *
+ * @return string
+ */
+ function _GetDomain()
+ {
+ return $this->Application->ConfigValue('DomainDetect') ? $_SERVER['HTTP_HOST'] : $GLOBALS['g_Domain'];
+ }
+
+ function _keyED($txt, $encrypt_key)
+ {
+ $encrypt_key = md5($encrypt_key);
+ $ctr = 0;
+ $tmp = '';
+ for ($i = 0; $i < strlen($txt); $i++) {
+ if ($ctr == strlen($encrypt_key)) $ctr = 0;
+ $tmp .= substr($txt, $i, 1) ^ substr($encrypt_key, $ctr, 1);
+ $ctr++;
+ }
+ return $tmp;
+ }
+
+
+ function _decrypt($txt, $key)
+ {
+ $txt = $this->_keyED($txt,$key);
+ $tmp = '';
+ for ($i = 0; $i < strlen($txt); $i++) {
+ $md5 = substr($txt, $i, 1);
+ $i++;
+ $tmp .= (substr($txt, $i, 1) ^ $md5);
+ }
+ return $tmp;
+ }
+
+ function LoadFromRemote()
+ {
+ return '';
+ }
+
+ function DLid()
+ {
+ die($GLOBALS['lid']."\n");
+ }
+
+ function _LoadLicense($LoadRemote = false)
+ {
+ $f = FULL_PATH.'/intechnic.php';
+ if ($this->_falseIsLocalSite($f)) $ret = true;
+ if (file_exists($f)) {
+ $contents = file($f);
+ $data = base64_decode($contents[1]);
+ }
+ else {
+ if ($LoadRemote) return $LoadFromRemote;
+ }
+ return $data;
+ }
+
+ function _VerifyKey($domain, $k)
+ {
+ $key = md5($domain);
+ $lkey = substr($key, 0, strlen($key) / 2);
+ $rkey = substr($key, strlen($key) / 2);
+ $r = $rkey.$lkey;
+ if ($k == $r) return true;
+ return false;
+ }
+
+ function _ParseLicense($txt)
+ {
+ global $i_User, $i_Pswd, $i_Keys;
+ if (!$this->_falseIsLocalSite($txt)) $nah = false;
+ $data = $this->_decrypt($txt, 'beagle');
+ $i_Keys = Array();
+ $lines = explode("\n", $data);
+ for ($x = 0; $x < count($lines); $x++) {
+ $l = $lines[$x];
+ $p = explode('=', $l, 2);
+ switch($p[0]) {
+ case 'Username':
+ $i_User = $p[1];
+ break;
+
+ case 'UserPass':
+ $i_Pswd = $p[1];
+ break;
+
+ default:
+ if (substr($p[0], 0, 3) == 'key') {
+ $parts = explode('|', $p[1]);
+ if ($this->_VerifyKey($parts[0], $parts[1])) {
+ unset($K);
+ $k['domain'] = $parts[0];
+ $k['key'] = $parts[1];
+ $k['desc'] = $parts[2];
+ $k['mod'] = $parts[3];
+ $i_Keys[] = $k;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ function _GetObscureValue($i)
+ {
+ if ($i == 'x') return 0254; $z = '';
+ if ($i == 'z') return 0x7F.'.';
+ if ($i == 'c') return '--code--';
+ if ($i >= 5 && $i < 7) return $this->_GetObscureValue($z)*$this->_GetObscureValue('e');
+ if ($i > 30) return Array(0x6c,0x6f,0x63,0x61,0x6c,0x68,0x6f,0x73,0x74);
+ if ($i > 20) return 99;
+ if ($i > 10) return '.'.($this->_GetObscureValue(6.5)+1);
+ if ($i == 'a') return 0xa;
+ }
+
+ function _Chr($val)
+ {
+ $x = $this->_GetObscureValue(25);
+ $f = chr($x).chr($x+5).chr($x+15);
+ return $f($val);
+ }
+
+ function _IsLocalSite($domain)
+ {
+ $ee = $this->_GetObscureValue(35); $yy = '';
+ foreach ($ee as $e) $yy .= $this->_Chr($e);
+ $localb = FALSE;
+ if(substr($domain,0,3)==$this->_GetObscureValue('x'))
+ {
+ $b = substr($domain,0,6);
+ $p = explode(".",$domain);
+ $subnet = $p[1];
+ if($p[1]>15 && $p[1]<32)
+ $localb=TRUE;
+ }
+ $zz = $this->_GetObscureValue('z').$this->_GetObscureValue(5).'.'.(int)$this->_GetObscureValue(7).$this->_GetObscureValue(12);
+ $ff = $this->_GetObscureValue('z')+65;
+ $hh = $ff-0x18;
+ if($domain==$yy || $domain==$zz || substr($domain,0,7)==$ff.$this->_Chr(46).$hh ||
+ substr($domain,0,3)==$this->_GetObscureValue('a').$this->_Chr(46) || $localb || strpos($domain,".")==0)
+ {
+ return TRUE;
+ }
+ return FALSE;
+ }
+
+ function _falseIsLocalSite($domain)
+ {
+ $localb = FALSE;
+ if(substr($domain,0,3)=="172")
+ {
+ $b = substr($domain,0,6);
+ $p = explode(".",$domain);
+ $subnet = $p[1];
+ if($p[1]>15 && $p[1]<32)
+ $localb=TRUE;
+ }
+ if($domain=="localhost" || $domain=="127.0.0.1" || substr($domain,0,7)=="192.168" ||
+ substr($domain,0,3)=="10." || $localb || strpos($domain,".")==0)
+ {
+ return TRUE;
+ }
+ return FALSE;
+ }
+ }
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.6.2/core/units/general/helpers/modules.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.6
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.6.2/core/admin_templates/categories/permissions_tab.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.6.2/core/admin_templates/categories/permissions_tab.tpl (nonexistent)
+++ branches/unlabeled/unlabeled-1.6.2/core/admin_templates/categories/permissions_tab.tpl (revision 5561)
@@ -0,0 +1,72 @@
+<inp2:m_if check="m_ParamEquals" name="tab_init" value="1">
+ <div id="<inp2:m_param name="item_prefix"/>_div" prefix="<inp2:m_param name="item_prefix"/>" group_id="-1" class="catalog-tab"></div>
+ <script type="text/javascript">$PermManager.registerTab('<inp2:m_param name="item_prefix"/>');</script>
+<inp2:m_else/>
+ if ($request_visible) {
+ document.getElementById('<inp2:m_get name="item_prefix"/>_div').setAttribute('group_id', <inp2:m_get name="group_id"/>);
+ }
+ <inp2:m_if check="c_SaveWarning">
+ document.getElementById('save_warning').style.display = 'block';
+ $edit_mode = true;
+ </inp2:m_if>
+ #separator#
+ <inp2:m_DefineElement name="permission_element">
+ <tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>">
+ <td>
+ <inp2:m_phrase name="$Description"/> [<inp2:m_param name="PermissionName"/>]
+ </td>
+
+ <td>
+ <!-- Inherited checkbox -->
+ <input
+ type="hidden"
+ id="<inp2:PermInputName sub_key="inherited"/>"
+ name="<inp2:PermInputName sub_key="inherited"/>"
+ value="<inp2:m_if check="m_ParamEquals" name="Inherited" value="1">1<inp2:m_else/>0</inp2:m_if>" />
+
+ <input
+ type="checkbox"
+ id="_cb_<inp2:PermInputName sub_key="inherited"/>"
+ <inp2:m_if check="m_ParamEquals" name="Inherited" value="1">checked</inp2:m_if>
+ onchange="update_checkbox(this, document.getElementById('<inp2:PermInputName sub_key="inherited"/>'));"
+ onclick="inherited_click('<inp2:m_param name="PermissionName"/>', <inp2:m_param name="InheritedValue"/>, this.checked, '_cb_<inp2:PermInputName sub_key="value"/>')" />
+ </td>
+
+ <td>
+ <inp2:CategoryPath cat_id="$InheritedFrom"/>
+ </td>
+
+ <td>
+ <!-- Access checkbox -->
+ <input
+ type="hidden"
+ id="<inp2:PermInputName sub_key="value"/>"
+ name="<inp2:PermInputName sub_key="value"/>"
+ value="<inp2:m_if check="m_ParamEquals" name="Value" value="1">1<inp2:m_else/>0</inp2:m_if>" />
+
+ <input
+ type="checkbox"
+ id="_cb_<inp2:PermInputName sub_key="value"/>"
+ <inp2:m_if check="m_ParamEquals" name="Inherited" value="1">disabled="disabled"</inp2:m_if>
+ <inp2:m_if check="m_ParamEquals" name="Value" value="1">checked</inp2:m_if>
+ onchange="update_checkbox(this, document.getElementById('<inp2:PermInputName sub_key="value"/>'));"
+ onclick="update_light('<inp2:m_param name="PermissionName"/>', this.checked)" />
+ </td>
+
+ <td>
+ <img id="light_<inp2:m_param name="PermissionName"/>" src="<inp2:m_TemplatesBase/>/img/perm_<inp2:m_if check="m_ParamEquals" name="Value" value="1">green<inp2:m_else/>red</inp2:m_if>.gif"/>
+ </td>
+ </tr>
+ </inp2:m_DefineElement>
+ <table width="100%" border="0" cellspacing="0" cellpadding="4" class="tableborder_full">
+ <inp2:m_set odd_even="table_color1"/>
+ <thead class="subsectiontitle">
+ <td><inp2:m_phrase name="la_col_Description"/></td>
+ <td><inp2:m_phrase name="la_col_Inherited"/></td>
+ <td><inp2:m_phrase name="la_col_InheritedFrom"/></td>
+ <td><inp2:m_phrase name="la_col_Access"/></td>
+ <td><inp2:m_phrase name="la_col_Effective"/></td>
+ </thead>
+ <inp2:c-perm_PrintPermissions render_as="permission_element"/>
+ </table>
+</inp2:m_if>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.6.2/core/admin_templates/categories/permissions_tab.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.6
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.6.2/core/admin_templates/stylesheets/stylesheets_edit_base.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.6.2/core/admin_templates/stylesheets/stylesheets_edit_base.tpl (nonexistent)
+++ branches/unlabeled/unlabeled-1.6.2/core/admin_templates/stylesheets/stylesheets_edit_base.tpl (revision 5561)
@@ -0,0 +1,103 @@
+<inp2:m_RequireLogin permissions="in-portal:configure_styles.view" system="1"/>
+<inp2:m_include t="incs/header" nobody="yes"/>
+
+<body topmargin="0" leftmargin="8" marginheight="0" marginwidth="8" bgcolor="#FFFFFF">
+<inp2:m_ParseBlock name="section_header" icon="icon46_style" title="!la_title_Stylesheets!"/>
+
+<inp2:m_include t="stylesheets/stylesheets_tabs"/>
+
+<inp2:m_ParseBlock name="blue_bar" prefix="css" title_preset="base_styles" module="in-portal" icon="icon46_style"/>
+
+<!-- ToolBar --->
+<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
+<tbody>
+ <tr>
+ <td>
+ <script type="text/javascript">
+ a_toolbar = new ToolBar();
+ a_toolbar.AddButton( new ToolBarButton('select', '<inp2:m_phrase label="la_ToolTip_Save" escape="1"/>', function() {
+ submit_event('css','<inp2:css_SaveEvent/>');
+ }
+ ) );
+ a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
+ submit_event('css','OnCancelEdit');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep1') );
+
+ a_toolbar.AddButton( new ToolBarButton('prev', '<inp2:m_phrase label="la_ToolTip_Prev" escape="1"/>', function() {
+ go_to_id('css', '<inp2:css_PrevId/>');
+ }
+ ) );
+ a_toolbar.AddButton( new ToolBarButton('next', '<inp2:m_phrase label="la_ToolTip_Next" escape="1"/>', function() {
+ go_to_id('css', '<inp2:css_NextId/>');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep2') );
+
+ a_toolbar.AddButton( new ToolBarButton('new_selector', '<inp2:m_phrase label="la_ToolTip_NewBaseStyle" escape="1"/>',
+ function() {
+ set_hidden_field('remove_specials[selectors.base]',1);
+ std_new_item('selectors.base', 'stylesheets/base_style_edit')
+ } ) );
+
+ function edit()
+ {
+ set_hidden_field('remove_specials[selectors.base]',1);
+ std_edit_temp_item('selectors.base', 'stylesheets/base_style_edit');
+ }
+
+ a_toolbar.AddButton( new ToolBarButton('edit', '<inp2:m_phrase label="la_ToolTip_Edit" escape="1"/>', edit) );
+ a_toolbar.AddButton( new ToolBarButton('delete', '<inp2:m_phrase label="la_ToolTip_Delete" escape="1"/>',
+ function() {
+ std_delete_items('selectors.base')
+ } ) );
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep3') );
+
+ a_toolbar.AddButton( new ToolBarButton('clone', '<inp2:m_phrase label="la_ToolTip_Clone" escape="1"/>', function() {
+ set_hidden_field('remove_specials[selectors.base]',1);
+ submit_event('selectors.base','OnMassClone');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep4') );
+
+ a_toolbar.AddButton( new ToolBarButton('view', '<inp2:m_phrase label="la_ToolTip_View" escape="1"/>', function() {
+ show_viewmenu(a_toolbar,'view');
+ }
+ ) );
+
+ a_toolbar.Render();
+
+ <inp2:m_if prefix="css" function="IsSingle"/>
+ a_toolbar.HideButton('prev');
+ a_toolbar.HideButton('next');
+ a_toolbar.HideButton('sep1');
+ //a_toolbar.HideButton('sep2');
+ <inp2:m_else/>
+ <inp2:m_if prefix="css" function="IsLast"/>
+ a_toolbar.DisableButton('next');
+ <inp2:m_endif/>
+ <inp2:m_if prefix="css" function="IsFirst"/>
+ a_toolbar.DisableButton('prev');
+ <inp2:m_endif/>
+ <inp2:m_endif/>
+ </script>
+ </td>
+ </tr>
+</tbody>
+</table>
+
+<inp2:m_block name="grid_description_td" />
+ <td valign="top" class="text"><inp2:$PrefixSpecial_field field="$field" grid="$grid" no_special="$no_special" cut_first="100"/></td>
+<inp2:m_blockend />
+
+<inp2:m_ParseBlock name="grid" PrefixSpecial="selectors.base" IdField="SelectorId" grid="Default" header_block="grid_column_title" data_block="grid_data_td" search="on"/>
+<script type="text/javascript">
+ Grids['selectors.base'].SetDependantToolbarButtons( new Array('edit','delete','clone') );
+</script>
+
+<inp2:m_include t="incs/footer"/>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.6.2/core/admin_templates/stylesheets/stylesheets_edit_base.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.6
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property

Event Timeline