Index: branches/unlabeled/unlabeled-1.36.2/core/units/admin/admin_tag_processor.php =================================================================== diff -u -N -r8698 -r8699 --- branches/unlabeled/unlabeled-1.36.2/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 8698) +++ branches/unlabeled/unlabeled-1.36.2/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 8699) @@ -460,10 +460,18 @@ $oFCKeditor->Height = $params['height'] ; $oFCKeditor->ToolbarSet = 'Advanced' ; $oFCKeditor->Value = '' ; + + if ($this->Application->isModuleEnabled('In-Portal')) { + $config_path = $this->Application->BaseURL().'kernel/admin_templates/incs/inp_fckconfig.js'; + } + else { + $config_path = $this->Application->BaseURL().'core/admin_templates/js/inp_fckconfig.js'; + } + $oFCKeditor->Config = Array( // 'UserFilesPath' => FULL_PATH.'/kernel/user_files', 'ProjectPath' => BASE_PATH.'/', - 'CustomConfigurationsPath' => $this->Application->isModuleEnabled('In-Portal') ? $this->Application->BaseURL().'kernel/admin_templates/incs/inp_fckconfig.js' : $this->Application->BaseURL().$editor_path.'fckconfig.js', + 'CustomConfigurationsPath' => $config_path, // 'EditorAreaCSS' => $this->Application->BaseURL().'/themes/inportal_site/inc/inportal.css', //GetThemeCSS(), //'StylesXmlPath' => '../../inp_styles.xml', // 'Debug' => 1, @@ -811,10 +819,10 @@ // not found (try to compile on the fly) $object =& $this->Application->recallObject('skin.-item', null, Array ('skip_autoload' => true)); /* @var $object kDBItem */ - + $skin_eh =& $this->Application->recallObject('skin_EventHandler'); /* @var $skin_eh SkinEventHandler */ - + $object->Load(1, 'IsPrimary'); $skin_eh->Compile($object); $ret = $css_url.'admin-'.$style_name.'-'.adodb_mktime().'.css'; Index: branches/unlabeled/unlabeled-1.53.4/admin/editor/cmseditor/editor/filemanager/browser/default/connectors/php/commands.php =================================================================== diff -u -N -r7930 -r8699 --- branches/unlabeled/unlabeled-1.53.4/admin/editor/cmseditor/editor/filemanager/browser/default/connectors/php/commands.php (.../commands.php) (revision 7930) +++ branches/unlabeled/unlabeled-1.53.4/admin/editor/cmseditor/editor/filemanager/browser/default/connectors/php/commands.php (.../commands.php) (revision 8699) @@ -81,6 +81,15 @@ { global $Config; if (isset($Config['K4Mode'])) { + if (isset($Config['K4Mode'])) { + define('ADMIN',1); + $application =& kApplication::Instance(); + $application->Init(); + if (!$application->CheckPermission('LOGIN',1)) { + echo 'NO PERMISSION'; + return false; + } + } return true; } else { @@ -297,6 +306,7 @@ $aFileSizes = array(); $sFolders = '' ; $sFiles = '' ; + CreateServerFolder( $sServerDir ) ; $oCurrentFolder = opendir( $sServerDir ) ; while ( $sFile = readdir( $oCurrentFolder ) ) { @@ -537,21 +547,100 @@ } function DeleteConfirmedFiles($resourceType, $currentFolder, $aFiles) -{ global $Config; -$sServerDir = ServerMapFolder( $resourceType, $currentFolder ) ; -foreach ($aFiles AS $k=>$v) { - @unlink($sServerDir.$v); +{ + global $Config; + $sServerDir = ServerMapFolder( $resourceType, $currentFolder ) ; + foreach ($aFiles AS $k=>$v) { + @unlink($sServerDir.$v); + } + } +function K4DeleteFiles($resourceType, $currentFolder, $aFiles, $confirm) +{ + $application =& kApplication::Instance(); + $application->Init(); + + $conn =& $application->Conn; + + $sErrorNumber = 230; + if ($confirm == 1) { + DeleteConfirmedFiles($resourceType, $currentFolder, $aFiles); + echo '' ; + } + $ret_xml = ''; + if (!$confirm) { + // we need to check all the fields in database for the file being deleted + // this is impossible when FCK is used all over the system + // it was possible for CMS/SMS only - need to be implemented there + // in some special mode... + + + $ml_helper =& $application->recallObject('kMultiLanguageHelper'); + /* @var $ml_helper kMultiLanguageHelper */ + $langs = $ml_helper->getLanguageCount(); + + foreach ($aFiles AS $k=>$v) { + $add_sql = ''; + if ($v == '') { + continue; + } + $deleted_file = $Config['UserFilesPathNoBase'].$resourceType.$currentFolder.addslashes($v); + for($i=1; $i<=$langs; $i++) { + $add_sql.= " l".$i."_Content LIKE '%".$deleted_file."%' OR"; + } + + if (strlen($add_sql) > 0) { + $add_sql = rtrim($add_sql," OR"); + $sql = 'SELECT c.CategoryId, c.l1_Name FROM '.TABLE_PREFIX.'PageContent AS pc + LEFT JOIN '.TABLE_PREFIX.'Category AS c + ON pc.PageId = c.CategoryId + WHERE '.$add_sql; + $rs = $conn->Query($sql); + foreach ($rs as $row) { + $used = 1; + $page = $row['l'.$application->GetVar('lang_id').'_Name']; + $page = @html_entity_decode($page,ENT_NOQUOTES,'UTF-8'); + $page = @htmlspecialchars($page); + $ret_xml.= '' ; + $rs->MoveNext(); + } + } + } + if ($ret_xml && !$confirm) { + echo $ret_xml; + } + if (!$ret_xml && !$confirm) { + DeleteConfirmedFiles($resourceType, $currentFolder, $aFiles); + echo '' ; + } + } } + function DeleteFiles($resourceType, $currentFolder, $files = '', $confirm=0) { global $Config ; if ($files == '') return; //$files = rtrim("|",$files); + echo "files: [$files]"; $aFiles=explode("|",$files); if (count($aFiles) == 0) return; + + if (isset($Config['K4Mode'])) { + define('ADMIN',1); + $application =& kApplication::Instance(); + $application->Init(); + if (!$application->CheckPermission('LOGIN',1)) { + echo 'NO PERMISSION'; + return; + } + + K4DeleteFiles($resourceType, $currentFolder, $aFiles, $confirm); + return ; + } + + $conn = GetADODbConnection(); $aLangs = array(); $multilang = GetConfigValue('multilingual_mode'); @@ -573,6 +662,7 @@ DeleteConfirmedFiles($resourceType, $currentFolder, $aFiles); echo '' ; } + if (!$confirm) { foreach ($aFiles AS $k=>$v) { $add_sql = ''; Index: branches/unlabeled/unlabeled-1.2.2/core/admin_templates/js/forms.js =================================================================== diff -u -N -r8180 -r8699 --- branches/unlabeled/unlabeled-1.2.2/core/admin_templates/js/forms.js (.../forms.js) (revision 8180) +++ branches/unlabeled/unlabeled-1.2.2/core/admin_templates/js/forms.js (.../forms.js) (revision 8699) @@ -42,7 +42,8 @@ Form.Controls = new Array(); Form.Div = false; Form.MinControlsHeight = 0; -Form.Coeffs = new Object(); +Form.Options = new Object(); +Form.FlexibleCount = 0; Form.ScrollerW = 17; Form.ScrollerH = 17; @@ -54,27 +55,42 @@ for (var i in this.Controls) { dim = getDimensions(document.getElementById(this.Controls[i])); - this.MinControlsHeight += dim.innerHeight; -// alert('adding element '+this.Controls[i]+' height: '+dim.innerHeight+' total: '+this.MinControlsHeight) + options = this.Options[this.Controls[i]]; + if (options.height) { // fixed height + options.min_height = options.height; + options.max_height = options.height; + } + if (!options.min_height) options.min_height = dim.innerHeight; + this.MinControlsHeight += options.min_height; + if (dim.innerHeight < options.min_height) { + document.getElementById(this.Controls[i]).style.height = options.min_height+'px'; + } +// alert('adding element '+this.Controls[i]+' height: '+options.min_height+' total: '+this.MinControlsHeight) } + /*alert('one more time'); document.body.style.height = '100%'; document.body.style.overflow = 'hidden'; document.body.scroll = 'no' + alert('done');*/ var a_div = document.createElement('DIV'); a_div.style.position = 'relative'; a_div.style.overflow = 'auto'; a_div.style.width = '100%'; - a_div.style.height = '100%'; +// a_div.style.height = '100%'; +// a_div.style.backgroundColor = 'yellow'; a_div.appendChild(el.parentNode.replaceChild(a_div, el)) this.Table = this.Div.getElementsByTagName('table')[0]; this.Table.style.height = 'auto'; + this.Table.style.width = 'auto'; this.MinHeight = this.Table.offsetHeight; this.MinWidth = this.Table.offsetWidth; +// alert('Measuring min width now') + addEvent(window, 'resize', function() {Form.Resize()}) this.Resize() @@ -90,9 +106,19 @@ } } -Form.addControl = function(id, coeff) { +Form.addControl = function(id, options) { this.Controls.push(id); - this.Coeffs[id] = coeff ? coeff : 1; // for future use + if (!options) { + options = {coeff: 1, max_height: 0, min_height: 0}; + } + else { + if (typeof(options['coeff']) == 'undefined') options['coeff'] = 1; + if (typeof(options['max_height']) == 'undefined') options['max_height'] = 0; + if (typeof(options['min_height']) == 'undefined') options['min_height'] = 0; + } + options['real_height'] = 0; + this.Options[id] = options; // for future use +// print_pre(this.Options[id]); } Form.Resize = function() @@ -101,32 +127,120 @@ var pos = findPos(el); var dim = getDimensions(this.Div); h -= pos[1] + dim.padding[0] + dim.padding[2] + dim.borders[0] + dim.borders[2]; +// alert('h after correction is '+h); var w = (document.all ? window.document.body.offsetWidth : window.innerWidth); w -= pos[0] + dim.padding[1] + dim.padding[3] + dim.borders[1] + dim.borders[3]; - scroller_height = this.MinWidth >= w ? this.ScrollerH : 0; - scroller_width = this.MinHeight >= h - scroller_height ? this.ScrollerW : 0; - scroller_height = this.MinWidth >= w - scroller_width ? this.ScrollerH : 0; + scroller_height = this.MinWidth > w ? this.ScrollerH : 0; + scroller_width = this.MinHeight > h - scroller_height ? this.ScrollerW : 0; + scroller_height = this.MinWidth > w - scroller_width ? this.ScrollerH : 0; + var st = document.getElementById('width_status'); + if (st) st.innerHTML = 'minWdith: '+this.MinWidth+' minHeight: '+this.MinHeight+' w: '+w+' h: '+h+' scroll_w: '+scroller_width+' scroll_h: '+scroller_height; + +// alert('scroller W x H = '+scroller_width+' x '+scroller_height); + // alert('resize: '+w+'x'+h) +// h -= 100; + this.Table.style.width = (w-scroller_width) + 'px'; - this.Div.style.width = (w)+'px'; + this.Div.style.width = (w-scroller_width)+'px'; this.Div.style.height = (h)+'px'; var count = this.Controls.length; // -count here is adjustment - 1px for each control - var split = h - count - this.MinHeight + this.MinControlsHeight; + var split = h - count*2 - this.MinHeight + this.MinControlsHeight; if (split < this.MinControlsHeight) split = this.MinControlsHeight; - var new_height = Math.round(split / count) -2; + this.ResetHeights(); + var used = this.SetMinHeights(); + split -= used; + + var cur_diff = 0; + var iterations = 0; + do { + var prev_diff = cur_diff; + var cur_diff = this.SplitExtra(split); + split = cur_diff; + iterations++; + } while (cur_diff != 0 && cur_diff != prev_diff && iterations < 10); + + for (var i in this.Controls) { + document.getElementById(this.Controls[i]).style.height = this.Options[this.Controls[i]]['real_height'] + 'px'; +// document.getElementById(this.Controls[i]).value = this.Options[this.Controls[i]]['real_height']; + } + // alert('h is: '+h+' min height is '+this.MinHeight+' MinControlsHeight is '+this.MinControlsHeight+' -> '+split+' to split between '+count+' new height is '+new_height); // print_pre(this.Controls) +} + +Form.ResetHeights = function() +{ for (var i in this.Controls) { - document.getElementById(this.Controls[i]).style.height = new_height + 'px'; + var options = this.Options[this.Controls[i]] + options['real_height'] = 0; + options.fixed = false; } + this.FlexibleCount = this.Controls.length; } + + +// Enlarge heights when possible +// Return any not split pixels number +Form.SplitExtra = function(split) +{ + var number = 0; + + for (var i in this.Controls) { + var options = this.Options[this.Controls[i]] + if (options['max_height'] ==0 || options['real_height'] < options.max_height) { + number++; + } + } + + if (number == 0) return 0; + + var delta = Math.floor(split / number); +// alert('splitting '+split+' between '+number+' delta is '+delta) + var added = 0; + for (var i in this.Controls) { + var options = this.Options[this.Controls[i]]; + var to_add; + if (options['max_height'] != 0 && options['real_height']+delta > options['max_height']) { + to_add = options['max_height']-options['real_height']; + } + else { + to_add = delta; + } +// alert('delta: '+delta+' current real: '+options['real_height']+' min: '+options['min_height']+' max:'+options['max_height']+' to_add: '+to_add) + options['real_height'] = options['real_height']+to_add; + added += to_add; + } +// alert('added total '+added) + + // removing extra added from the last (any) control + if (added > split) { + extra = added-split; + options['real_height'] -= extra; + added -= extra; + } + return split - added; +} + +Form.SetMinHeights = function() +{ + var used = 0; + for (var i in this.Controls) { + var options = this.Options[this.Controls[i]] + if (options['real_height'] < options['min_height']) { + options['real_height'] = options.min_height; + used += options.min_height; + } + } + return used; +} \ No newline at end of file Index: branches/unlabeled/unlabeled-1.3.10/admin/editor/cmseditor/editor/filemanager/browser/default/connectors/php/io.php =================================================================== diff -u -N -r4359 -r8699 --- branches/unlabeled/unlabeled-1.3.10/admin/editor/cmseditor/editor/filemanager/browser/default/connectors/php/io.php (.../io.php) (revision 4359) +++ branches/unlabeled/unlabeled-1.3.10/admin/editor/cmseditor/editor/filemanager/browser/default/connectors/php/io.php (.../io.php) (revision 8699) @@ -1,20 +1,20 @@ -Conn->qstr($template_path).' AND Status IN (1,4) '; $template_found = $this->Conn->GetRow($sql); if ($template_found) { + // IsIndex = 2 is a Container-only page, meaning it should go to index-page child + if ($template_found['IsIndex'] == 2) { + $template_found = $this->Conn->GetRow(' + SELECT CategoryId, NamedParentPath FROM '.TABLE_PREFIX.'Category + WHERE ParentId = '.$template_found['CategoryId'].' AND IsIndex = 1 + '); + $vars['t'] = preg_replace('/^content\//i', '', $template_found['NamedParentPath']); + } + else { + $vars['t'] = implode('/', $url_parts); + } $vars['m_cat_id'] = $template_found['CategoryId']; - $vars['t'] = implode('/', $url_parts); $vars['is_virtual'] = true; // for template from POST return true; } @@ -365,7 +375,7 @@ $vars = $this->parseRewriteURL($url,$passed); $cache = array('vars'=>$vars,'passed'=>$passed); $this->Conn->Query('REPLACE '.TABLE_PREFIX.'Cache (VarName, Data, Cached) VALUES ("mod_rw_'.md5($url).'", '.$this->Conn->qstr(serialize($cache)).', '.adodb_mktime().')'); - + if (isset($this->HTTPQuery->Post['t']) && $this->HTTPQuery->Post['t']) { // template from POST overrides template from URL. $vars['t'] = $this->HTTPQuery->Post['t']; Index: branches/unlabeled/unlabeled-1.23.2/admin/editor/cmseditor/editor/filemanager/browser/default/frmresourceslist.html =================================================================== diff -u -N -r7645 -r8699 --- branches/unlabeled/unlabeled-1.23.2/admin/editor/cmseditor/editor/filemanager/browser/default/frmresourceslist.html (.../frmresourceslist.html) (revision 7645) +++ branches/unlabeled/unlabeled-1.23.2/admin/editor/cmseditor/editor/filemanager/browser/default/frmresourceslist.html (.../frmresourceslist.html) (revision 8699) @@ -1,27 +1,27 @@ - +