Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Mon, Aug 25, 2:09 AM

in-portal

Index: branches/unlabeled/unlabeled-1.1.2/core/admin_templates/incs/blocks.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.1.2/core/admin_templates/incs/blocks.tpl (revision 7067)
+++ branches/unlabeled/unlabeled-1.1.2/core/admin_templates/incs/blocks.tpl (revision 7068)
@@ -1,36 +1,36 @@
-<inp2:m_DefineElement name="kernel_form">
+<inp2:m_DefineElement name="kernel_form" style="">
<inp2:m_if check="m_ParamEquals" name="form_name" value="" inverse="inverse">
<inp2:m_set form_name="$form_name"/>
<inp2:m_else/>
<inp2:m_set form_name="kernel_form"/>
</inp2:m_if>
-
- <form id="<inp2:m_get name="form_name"/>" name="<inp2:m_get name="form_name"/>" enctype="multipart/form-data" method="post" action="<inp2:m_t pass="all"/>">
+
+ <form style="<inp2:m_Param name="style"/>" id="<inp2:m_get name="form_name"/>" name="<inp2:m_get name="form_name"/>" enctype="multipart/form-data" method="post" action="<inp2:m_t pass="all"/>">
<input type="hidden" name="MAX_FILE_SIZE" id="MAX_FILE_SIZE" value="<inp2:m_getconst name="MAX_UPLOAD_SIZE"/>" />
</inp2:m_DefineElement>
<inp2:m_block name="kernel_form_end"/>
<inp2:m_DumpSystemInfo/>
</form>
<inp2:m_if check="m_IsDebugMode">
<script type="text/javascript">
addEvent(window, 'resize', OnResizePopup);
</script>
</inp2:m_if>
<inp2:m_blockend/>
<inp2:m_block name="field_caption"/>
<td><inp2:m_param name="title"/><inp2:m_if prefix="$prefix" function="IsRequired"/>*<inp2:m_endif/>:</td>
<inp2:m_blockend/>
<inp2:m_block name="edit_box"/>
<tr>
<inp2:m_ParseBlock name="field_caption" prefix="$prefix" title="$title" field="$field" />
<td><input type="text" name="<inp2:$prefix_InputName field="$field"/>" value="<inp2:$prefix_Field field="$field"/>"></td>
</tr>
<inp2:m_blockend/>
<inp2:m_block name="column_header"/>
<td><a href="javascript:resort_grid('<inp2:m_param name="PrefixSpecial"/>','<inp2:m_param name="field"/>')"><inp2:m_param name="title"/></a></td>
<inp2:m_blockend/>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.1.2/core/admin_templates/incs/blocks.tpl
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1.2.3
\ No newline at end of property
+1.1.2.4
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.1.2/core/admin_templates/js/inp_styles.xml
===================================================================
--- branches/unlabeled/unlabeled-1.1.2/core/admin_templates/js/inp_styles.xml (nonexistent)
+++ branches/unlabeled/unlabeled-1.1.2/core/admin_templates/js/inp_styles.xml (revision 7068)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+ * 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: fckstyles.xml
+ * This is the sample style definitions file. It makes the styles combo
+ * completely customizable.
+ * See FCKConfig.StylesXmlPath in the configuration file.
+ *
+ * Version: 2.0 RC3
+ * Modified: 2005-02-09 13:51:09
+ *
+ * File Authors:
+ * Frederico Caldeira Knabben (fredck@fckeditor.net)
+-->
+<Styles>
+ <Style name="Page Title" element="h1">
+ </Style>
+ <Style name="Subtitle" element="h2">
+ </Style>
+ <Style name="Caption" element="h3">
+ </Style>
+</Styles>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.1.2/core/admin_templates/js/inp_styles.xml
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.1.2.1
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.1.2/core/admin_templates/js/inp_fckconfig.js
===================================================================
--- branches/unlabeled/unlabeled-1.1.2/core/admin_templates/js/inp_fckconfig.js (nonexistent)
+++ branches/unlabeled/unlabeled-1.1.2/core/admin_templates/js/inp_fckconfig.js (revision 7068)
@@ -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.1.2/core/admin_templates/js/inp_fckconfig.js
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.1.2.1
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.22.2/admin/editor/cmseditor/editor/filemanager/browser/default/frmresourceslist.html
===================================================================
--- branches/unlabeled/unlabeled-1.22.2/admin/editor/cmseditor/editor/filemanager/browser/default/frmresourceslist.html (revision 7067)
+++ branches/unlabeled/unlabeled-1.22.2/admin/editor/cmseditor/editor/filemanager/browser/default/frmresourceslist.html (revision 7068)
@@ -1,477 +1,501 @@
<!--
* 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: frmresourceslist.html
* This page shows all resources available in a folder in the File Browser.
*
* Version: 2.0 RC3
* Modified: 2005-02-25 22:01:23
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link href="Browser.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="js/common.js"></script>
<script language="javascript">
var oListManager = new Object() ;
var current_sort_order = '_asc';
var current_sort_by = 'name';
oListManager.Init = function()
{
this.Table = document.getElementById('tableFiles') ;
}
oListManager.Clear = function()
{
// Remove all other rows available.
while ( this.Table.rows.length > 0 )
this.Table.deleteRow(0) ;
}
function is_msie()
{
var browser = "";
browser = navigator.appName;
if (browser == 'Microsoft Internet Explorer')
return 1;
else
return 0;
}
oListManager.AddFolder = function( folderName, folderPath )
{
// Create the new row.
var oRow = this.Table.insertRow(-1) ;
// Build the link to view the folder.
var sLink = '<a href="#" onclick="OpenFolder(\'' + folderPath + '\');return false;">' ;
var oCell = oRow.insertCell(-1);
oCell.width = 16;
// Add the folder icon cell.
var oCell = oRow.insertCell(-1) ;
oCell.width = 16 ;
oCell.innerHTML = sLink + '<img alt="" src="images/Folder.gif" width="16" height="16" border="0"></a>' ;
// Add the folder name cell.
oCell = oRow.insertCell(-1) ;
oCell.noWrap = true ;
oCell.colSpan = 4 ;
oCell.innerHTML = '&nbsp;' + sLink + folderName + '</a>' ;
}
oListManager.AddFile = function( fileName, fileUrl, fileSize, fileDate )
{
// Create the new row.
var oRow = this.Table.insertRow(-1) ;
// Build the link to view the folder.
var sLink = '<a href="#" onclick="OpenFile(\'' + fileUrl + '\',\''+fileSize+'\'); return false;">' ;
// Get the file icon.
var sIcon = oIcons.GetIcon( fileName ) ;
// Add the checkbox cell
var oCell = oRow.insertCell(-1);
oCell.width = 25;
oCell.innerHTML = '<input type="checkbox" name="file_checkbox" value='+fileName+' onclick="HandleCheckboxes();"/>';
// Add the file icon cell.
var oCell = oRow.insertCell(-1) ;
oCell.width = 16 ;
oCell.innerHTML = sLink + ' <img alt="" src="images/icons/' + sIcon + '.gif" width="16" height="16" border="0"></a>' ;
// Add the file name cell.
oCell = oRow.insertCell(-1) ;
oCell.innerHTML = '&nbsp;' + sLink + '<span id=\'' + fileName + '\'oncontextmenu="ShowContextMenu(event);">' + fileName + '</span></a>' ;
// Add the file size cell.
oCell = oRow.insertCell(-1) ;
oCell.width = 50;
oCell.noWrap = true ;
oCell.align = 'right' ;
oCell.innerHTML = '&nbsp;' + fileSize + ' KB' ;
oCell = oRow.insertCell(-1) ;
oCell.width = 10;
oCell.noWrap = true ;
oCell.innerHTML = "&nbsp;" ;
//Add the file date cell.
oCell = oRow.insertCell(-1) ;
oCell.width = 120;
oCell.noWrap = true ;
oCell.innerHTML = fileDate ;
}
oListManager.AddEmptyRow = function()
{
var oRow = this.Table.insertRow(-1) ;
var oCell = oRow.insertCell(-1);
oCell.width = 25;
oCell.innerHTML = '&nbsp;';
oCell = oRow.insertCell(-1) ;
oCell.width = 16 ;
oCell.innerHTML = '&nbsp;';
oCell = oRow.insertCell(-1) ;
oCell.innerHTML = '&nbsp;';
oCell = oRow.insertCell(-1) ;
oCell.width = 50;
oCell.innerHTML = '&nbsp;';
oCell = oRow.insertCell(-1) ;
oCell.width = 10;
oCell.innerHTML = '&nbsp;';
oCell = oRow.insertCell(-1) ;
oCell.width = 120;
oCell.innerHTML = '&nbsp;';
}
function GetCheckedFileName(method)
{
var files = '';
checkboxes = document.getElementsByName('file_checkbox');
for (var i = 0; i< checkboxes.length; i++) {
if (checkboxes[i].checked && checkboxes[i].value) {
if (method == 'first')
return checkboxes[i].value;
if (method == 'cnt') {
files++;
} else
files = files+checkboxes[i].value+'|';
}
}
return files;
}
function HandleCheckboxes() {
var checked_num = 0, i, count = 0;
checkboxes = document.getElementsByName('file_checkbox');
for (var i = 0; i< checkboxes.length; i++)
{
if (checkboxes[i].checked && checkboxes[i].value)
checked_num++;
}
if (checked_num == 0) {
document.getElementById("selector").checked = false;
}
if (checked_num > 0) {
window.parent.frames['frmUpload'].SetElementVisibility("none", "");
if (checked_num > 1) {
window.parent.frames['frmUpload'].SetButtonAvalability("rename", false);
}
else {
window.parent.frames['frmUpload'].SetButtonAvalability("rename", true);
}
}
else {
window.parent.frames['frmUpload'].SetElementVisibility("", "none");
}
}
function ShowContextMenu(event) {
if (event.target) {
var targ = event.target;
}
else if (event.srcElement) {
var targ = event.srcElement;
}
if (targ.nodeType == 3) {
targ = targ.parentNode; // defeat Safari bug
}
document.getElementById("context_menu").style.display = "";
document.getElementById("context_menu").style.top = event.clientY;
document.getElementById("context_menu").style.left = event.clientX;
id = targ.id;
document.getElementById("context_menu_file").value = id;
}
function HideContextMenu() {
document.getElementById("context_menu").style.display = "none";
}
-function RenameFromContextMenu() {
- file_name = document.getElementById("context_menu_file").value;
+function RenameFromContextMenu(old_name) {
+ if (old_name)
+ file_name = old_name;
+ else
+ file_name = document.getElementById("context_menu_file").value;
f=prompt('Rename file "'+file_name+'"?',file_name);
if (f) {
RenameFile(file_name,f);
}
}
+
function DeleteFromContextMenu() {
file_name = document.getElementById("context_menu_file").value;
f=confirm('Delete file "'+file_name+'"?',file_name);
if (f) {
oConnector.PostCommand( 'DeleteFiles', 'files='+file_name, DeleteCallBack );
}
}
function UncheckSelector() {
document.getElementById("selector").checked = false;
}
function ToggleSelectAll() {
checkboxes = document.getElementsByName('file_checkbox');
if (document.getElementById('selector').checked)
{
for (var i = 0; i< checkboxes.length; i++)
checkboxes[i].checked = true;
} else {
for (var i = 0; i < checkboxes.length; i++)
checkboxes[i].checked = false;
}
HandleCheckboxes();
}
function OpenFolder( folderPath )
{
// Load the resources list for this folder.
window.parent.frames['frmFolders'].LoadFolders( folderPath ) ;
}
function OpenFile( fileUrl, fileSize)
{
window.top.opener.SetUrl( fileUrl, '', '', '', fileSize);
window.close() ;
window.top.close() ;
window.top.opener.focus() ;
}
+
+function ValidateFileName(file_name)
+{
+ var sp = file_name.replace(/\\/g, '\/');
+ sp=sp.split("/");
+ file_name = sp[sp.length-1];
+ var re = /^([\/a-zA-Z0-9\(\)_\.-]+)$/
+
+ if (!re.test(file_name)) {
+ alert('Please name your files to be web-friendly. We recommend using only these characters in file names:'+"\n"+
+ 'Letters a-z, A-Z, Numbers 0-9, "_" (underscore), "-" (dash), " " (space), "." (period)'+"\n"+
+ 'Please avoid using any other characters like quotes, brackets, quotation marks, "?", "!", "=", foreign symbols, etc.');
+ return false;
+ } else
+ return true;
+}
+
function RenameFile(old_name,new_name)
{
- oConnector.SendCommand( 'RenameFile_'+old_name+'|'+new_name, null, RenameCallBack );
+ if (ValidateFileName(new_name))
+ oConnector.SendCommand( 'RenameFile_'+old_name+'|'+new_name, null, RenameCallBack );
+ else
+ RenameFromContextMenu(old_name);
}
function DeleteFiles(confirm)
{
var files = GetCheckedFileName('All');
oConnector.PostCommand( 'DeleteFiles', 'files='+files+'&confirm='+confirm, DeleteCallBack );
}
function DeleteCallBack(fckXml)
{
var oNodes = fckXml.SelectNodes( 'Connector/Error' );
var msg = '';
if (oNodes.length > 0) {
for ( var i = 0 ; i < oNodes.length ; i++ )
{
var iErrorNumber = parseInt( oNodes[i].attributes.getNamedItem('number').value ) ;
if (iErrorNumber == '100') {
Refresh();
return;
}
msg = msg + oNodes[i].attributes.getNamedItem('originalDescription').value+"\n" ;
}
if (oNodes.length > 1)
$base_msg = "Selected Files used in Your SMS "+"\n"+msg+"Delete All Selected Files";
if (oNodes.length == 1)
$base_msg = "Selected File used in Your SMS "+"\n"+msg+"Delete All Selected File?";
if (confirm($base_msg)) {
DeleteFiles(1);
}
}
}
function RenameCallBack(fckXml)
{
var oNode = fckXml.SelectSingleNode( 'Connector/Error' ) ;
var iErrorNumber = parseInt( oNode.attributes.getNamedItem('number').value ) ;
switch ( iErrorNumber )
{
case 0 :
window.parent.frames['frmResourcesList'].Refresh() ;
break ;
case 203 :
alert( 'Invalid file type for this foder' ) ;
break ;
case 204 :
alert( 'A file with the same name is already available' ) ;
break ;
default :
alert( 'Error on file upload. Error number: ' + errorNumber ) ;
break ;
}
}
function LoadResources( resourceType, folderPath )
{
oListManager.Clear() ;
oConnector.ResourceType = resourceType ;
oConnector.CurrentFolder = folderPath
oConnector.SendCommand( 'GetFoldersAndFiles_'+current_sort_by+current_sort_order, null, GetFoldersAndFilesCallBack ) ;
}
function Refresh()
{
LoadResources( oConnector.ResourceType, oConnector.CurrentFolder ) ;
window.parent.frames['frmUpload'].SetElementVisibility("", "none");
}
function GetFoldersAndFilesCallBack( fckXml )
{
// Get the current folder path.
var oNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ;
var sCurrentFolderPath = oNode.attributes.getNamedItem('path').value ;
var sCurrentFolderUrl = oNode.attributes.getNamedItem('url').value ;
if (current_sort_order == '_asc') {
// Add the Folders.
var oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ;
for ( var i = 0 ; i < oNodes.length ; i++ )
{
var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
oListManager.AddFolder( sFolderName, sCurrentFolderPath + sFolderName + "/" ) ;
}
// Add the Files.
var oNodes = fckXml.SelectNodes( 'Connector/Files/File' ) ;
for ( var i = 0 ; i < oNodes.length ; i++ )
{
var sFileName = oNodes[i].attributes.getNamedItem('name').value ;
var sFileSize = oNodes[i].attributes.getNamedItem('size').value ;
var sFileDate = oNodes[i].attributes.getNamedItem('date').value;
oListManager.AddFile( sFileName, sCurrentFolderUrl + sFileName, sFileSize, sFileDate) ;
}
} else {
// Add the Files.
var oNodes = fckXml.SelectNodes( 'Connector/Files/File' ) ;
for ( var i = 0 ; i < oNodes.length ; i++ )
{
var sFileName = oNodes[i].attributes.getNamedItem('name').value ;
var sFileSize = oNodes[i].attributes.getNamedItem('size').value ;
var sFileDate = oNodes[i].attributes.getNamedItem('date').value;
oListManager.AddFile( sFileName, sCurrentFolderUrl + sFileName, sFileSize, sFileDate) ;
}
// Add the Folders.
var oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ;
for ( var i = 0 ; i < oNodes.length ; i++ )
{
var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
oListManager.AddFolder( sFolderName, sCurrentFolderPath + sFolderName + "/" ) ;
}
}
oListManager.AddEmptyRow();
if (document.getElementById('selector'))
document.getElementById('selector').checked=false;
UpdateDivSize();
}
function UpdateDivSize()
{
table_height = document.getElementById('tableFiles').clientHeight;
if(is_msie())
window_height = document.body.clientHeight - 20;
else
window_height = window.outerHeight - 165;
if (document.getElementById('data_div')) {
document.getElementById('data_div').style.height = window_height;
if (window_height < table_height) {
document.getElementById('data_div').scroll = 'yes';
document.getElementById('sortFiles').style.width = document.getElementById('tableFiles').clientWidth;
} else {
document.getElementById('data_div').scroll = 'yes';
document.getElementById('sortFiles').style.width = document.getElementById('tableFiles').clientWidth;
}
}
}
window.onload = function()
{
oListManager.Init() ;
window.top.IsLoadedResourcesList = true ;
UncheckSelector();
}
function sortBy(sort_by)
{
if (sort_by == current_sort_by)
current_sort_order = (current_sort_order == '_asc')?'_desc':'_asc';
else {
document.getElementById('sort_'+current_sort_by).src = document.getElementById('_no').src;
current_sort_by = sort_by;
current_sort_order = '_asc';
}
document.getElementById('sort_'+current_sort_by).src = document.getElementById(current_sort_order).src;
//alert('GetFoldersAndFiles_'+current_sort_by+current_sort_order);
LoadResources( oConnector.ResourceType, oConnector.CurrentFolder ) ;
}
window.onresize = UpdateDivSize;
</script>
</head>
<body class="FileArea" bottomMargin="10" leftMargin="10" topMargin="3" rightMargin="10" onclick="HideContextMenu();" oncontextmenu="return false;">
<div id="sort_div" style="padding: 0; border: none; overflow: hidden; width: 100%; position: relative;">
<table id="sortFiles" border="0" cellSpacing="1" cellPadding="0" width="100%" border="0" style="border-bottom:1px solid #000000; margin-bottom:0px; padding-bottom:0px;">
<tr>
<td width="25">
<input type="checkbox" id="selector" value="unchecked" onclick="ToggleSelectAll();" />
</td>
<td>
<table border="0" cellSpacing="0" cellPadding="0"border="0">
<tr>
<td><a href="javascript:sortBy('name');"><img id="sort_name" src="images/sort_asc.gif" alt="" border="0"></a></td>
<td><a href="javascript:sortBy('name');" class='order-link'>&nbsp;File Name</a></td>
</tr>
</table>
</td>
<td width="50" align="center">
<table border="0" cellSpacing="0" cellPadding="0"border="0">
<tr>
<td><a href="javascript:sortBy('size');"><img id="sort_size" src="images/sort_no.gif" alt="" border="0"></a></td>
<td><a href="javascript:sortBy('size');" class='order-link'>&nbsp;Size</a></td>
</tr>
</table>
</td>
<td width="10"> </td>
<td width="120">
<table border="0" cellSpacing="0" cellPadding="0"border="0">
<tr>
<td><a href="javascript:sortBy('date');"><img id="sort_date" src="images/sort_no.gif" alt="" border="0"></a></td>
<td><a href="javascript:sortBy('date');" class='order-link'>&nbsp;Date</a></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div id="data_div" style="padding: 0; border: none; overflow: auto; width: 100%; position: relative;">
<img src="images/s.gif" width="1" height="3"><br />
<table id="tableFiles" border="0" cellSpacing="1" cellPadding="0" width="100%" border="0" style="padding-top:0px;">
</table>
</div>
<div style="display:none">
<img id='_desc' src="images/sort_desc.gif" alt="" border="0">
<img id='_asc' src="images/sort_asc.gif" alt="" border="0">
<img id='_no' src="images/sort_no.gif" alt="" border="0">
</div>
<table id="context_menu" cellpadding="0" cellspacing="2" style="position: absolute; background-color: #FFFFFF; border: 1px solid #000000; display: none">
<tr>
<td>
<table id="context_menu" cellpadding="0" cellspacing="0">
<tr style="height:18px;" onmouseover="document.getElementById('rename').bgColor = '#8f8f73'; document.getElementById('rename_dot').bgColor = '#737357';" onmouseout="document.getElementById('rename').bgColor = '#FFFFFF'; document.getElementById('rename_dot').bgColor = '#E3E3C7';">
<td id="rename_dot" bgcolor="#E3E3C7" align="center" valign="middle" width="15"><img src="images/blackpix.gif" style="width: 5; height: 5" /></td>
<td id="rename" align="left" style="font-size: 11px; font-family: 'Microsoft Sans Serif' , Arial, Helvetica, Verdana" onclick="RenameFromContextMenu();">&nbsp;<a href="#" style="text-decoration: none; color: #000000">Rename</a>&nbsp;&nbsp;</td>
</tr>
<tr style="height:18px;" onmouseover="document.getElementById('delete').bgColor = '#8f8f73'; document.getElementById('delete_dot').bgColor = '#737357';" onmouseout="document.getElementById('delete').bgColor = '#FFFFFF'; document.getElementById('delete_dot').bgColor = '#E3E3C7';">
<td id="delete_dot" bgcolor="#E3E3C7" align="center" valign="middle" width="15"><img src="images/blackpix.gif" style="width: 5; height: 5" /></td>
<td id="delete" align="left" style="font-size: 11px; font-family: 'Microsoft Sans Serif' , Arial, Helvetica, Verdana" onclick="DeleteFromContextMenu();">
&nbsp;<a href="#" style="text-decoration: none; color: #000000">Delete</a>&nbsp;&nbsp;
<input type="hidden" value="" id="context_menu_file">
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
Property changes on: branches/unlabeled/unlabeled-1.22.2/admin/editor/cmseditor/editor/filemanager/browser/default/frmresourceslist.html
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.22
\ No newline at end of property
+1.22.2.1
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.68.4/core/kernel/db/db_tag_processor.php
===================================================================
--- branches/unlabeled/unlabeled-1.68.4/core/kernel/db/db_tag_processor.php (revision 7067)
+++ branches/unlabeled/unlabeled-1.68.4/core/kernel/db/db_tag_processor.php (revision 7068)
@@ -1,1735 +1,1735 @@
<?php
class kDBTagProcessor extends TagProcessor {
/**
* Description
*
* @var kDBConnection
* @access public
*/
var $Conn;
function kDBTagProcessor()
{
parent::kBase();
$this->Conn =& $this->Application->GetADODBConnection();
}
/**
* Returns true if "new" button was pressed in toolbar
*
* @param Array $params
* @return bool
*/
function IsNewMode($params)
{
$object =& $this->getObject($params);
return $object->GetID() <= 0;
}
/**
* Returns view menu name for current prefix
*
* @param Array $params
* @return string
*/
function GetItemName($params)
{
$item_name = $this->Application->getUnitOption($this->Prefix, 'ViewMenuPhrase');
return $this->Application->Phrase($item_name);
}
function ViewMenu($params)
{
$block_params = $params;
unset($block_params['block']);
$block_params['name'] = $params['block'];
$list =& $this->GetList($params);
$block_params['PrefixSpecial'] = $list->getPrefixSpecial();
return $this->Application->ParseBlock($block_params);
}
function SearchKeyword($params)
{
$list =& $this->GetList($params);
return $this->Application->RecallVar($list->getPrefixSpecial().'_search_keyword');
}
/**
* Draw filter menu content (for ViewMenu) based on filters defined in config
*
* @param Array $params
* @return string
*/
function DrawFilterMenu($params)
{
$block_params = $this->prepareTagParams($params);
$block_params['name'] = $params['spearator_block'];
$separator = $this->Application->ParseBlock($block_params);
$filter_menu = $this->Application->getUnitOption($this->Prefix,'FilterMenu');
if(!$filter_menu)
{
trigger_error('<span class="debug_error">no filters defined</span> for prefix <b>'.$this->Prefix.'</b>, but <b>DrawFilterMenu</b> tag used', E_USER_WARNING);
return '';
}
// Params: label, filter_action, filter_status
$block_params['name'] = $params['item_block'];
$view_filter = $this->Application->RecallVar($this->getPrefixSpecial().'_view_filter');
if($view_filter === false)
{
$event_params = Array('prefix'=>$this->Prefix,'special'=>$this->Special,'name'=>'OnRemoveFilters');
$this->Application->HandleEvent( new kEvent($event_params) );
$view_filter = $this->Application->RecallVar($this->getPrefixSpecial().'_view_filter');
}
$view_filter = unserialize($view_filter);
$filters = Array();
$prefix_special = $this->getPrefixSpecial();
foreach ($filter_menu['Filters'] as $filter_key => $filter_params) {
$group_params = isset($filter_params['group_id']) ? $filter_menu['Groups'][ $filter_params['group_id'] ] : Array();
if (!isset($group_params['element_type'])) {
$group_params['element_type'] = 'checkbox';
}
if (!$filter_params) {
$filters[] = $separator;
continue;
}
$block_params['label'] = addslashes( $this->Application->Phrase($filter_params['label']) );
if (getArrayValue($view_filter,$filter_key)) {
$submit = 0;
$status = $group_params['element_type'] == 'checkbox' ? '[\'img/check_on.gif\']' : '[\'img/menu_dot.gif\']';
}
else {
$submit = 1;
$status = 'null';
}
$block_params['filter_action'] = 'set_filter("'.$prefix_special.'","'.$filter_key.'","'.$submit.'",'.$params['ajax'].');';
$block_params['filter_status'] = $status; // 1 - checkbox, 2 - radio, 0 - no image
$filters[] = $this->Application->ParseBlock($block_params);
}
return implode('', $filters);
}
function IterateGridFields($params)
{
$mode = $params['mode'];
$def_block = isset($params['block']) ? $params['block'] : '';
$force_block = isset($params['force_block']) ? $params['force_block'] : false;
$grids = $this->Application->getUnitOption($this->Prefix,'Grids');
$grid_config = $grids[$params['grid']]['Fields'];
$picker_helper =& $this->Application->RecallObject('ColumnPickerHelper');
/* @var $picker_helper kColumnPickerHelper */
$picker_helper->ApplyPicker($this->getPrefixSpecial(), $grid_config);
$std_params['pass_params']='true';
$std_params['PrefixSpecial']=$this->getPrefixSpecial();
$o = '';
$i = 0;
foreach ($grid_config as $field => $options) {
$i++;
$block_params = Array();
$block_params['name'] = $force_block ? $force_block : (isset($options[$mode.'_block']) ? $options[$mode.'_block'] : $def_block);
$block_params['field'] = $field;
$block_params['sort_field'] = isset($options['sort_field']) ? $options['sort_field'] : $field;
$block_params['filter_field'] = isset($options['filter_field']) ? $options['filter_field'] : $field;
$field_options = $this->Application->getUnitOption($this->Prefix.'.'.$field, 'Fields');
if (isset($field_options['use_phrases'])) {
$block_params['use_phrases'] = $field_options['use_phrases'];
}
$block_params['is_last'] = ($i == count($grid_config));
$block_params = array_merge($std_params, $block_params, $options);
$o.= $this->Application->ParseBlock($block_params, 1);
}
return $o;
}
function GridFieldsCount($params)
{
$grids = $this->Application->getUnitOption($this->Prefix, 'Grids');
$grid_config = $grids[$params['grid']]['Fields'];
return count($grid_config);
}
/**
* Prints list content using block specified
*
* @param Array $params
* @return string
* @access public
*/
function PrintList($params)
{
$list =& $this->GetList($params);
$id_field = $this->Application->getUnitOption($this->Prefix,'IDField');
$list->Query();
$o = '';
$list->GoFirst();
$block_params=$this->prepareTagParams($params);
$block_params['name'] = $this->SelectParam($params, 'render_as,block');
$block_params['pass_params'] = 'true';
while (!$list->EOL())
{
$this->Application->SetVar( $this->getPrefixSpecial().'_id', $list->GetDBField($id_field) ); // for edit/delete links using GET
$o.= $this->Application->ParseBlock($block_params, 1);
$list->GoNext();
}
$this->Application->SetVar( $this->getPrefixSpecial().'_id', '');
return $o;
}
function InitList($params)
{
$list_name = isset($params['list_name']) ? $params['list_name'] : '';
$names_mapping = $this->Application->GetVar('NamesToSpecialMapping');
if( !getArrayValue($names_mapping, $this->Prefix, $list_name) )
{
$list =& $this->GetList($params);
}
}
function BuildListSpecial($params)
{
return $this->Special;
}
/**
* Enter description here...
*
* @param Array $params
* @return kDBList
*/
function &GetList($params)
{
$list_name = $this->SelectParam($params, 'list_name,name');
if (!$list_name) {
$list_name = $this->Application->Parser->GetParam('list_name');
}
$requery = getArrayValue($params, 'requery');
if ($list_name && !$requery){
$names_mapping = $this->Application->GetVar('NamesToSpecialMapping');
$special = getArrayValue($names_mapping, $this->Prefix, $list_name);
if(!$special)
{
$special = $this->BuildListSpecial($params);
}
}
else
{
$special = $this->BuildListSpecial($params);
}
$prefix_special = rtrim($this->Prefix.'.'.$special, '.');
$params['skip_counting'] = true;
$list =& $this->Application->recallObject( $prefix_special, $this->Prefix.'_List', $params);
if ($requery) {
$this->Application->HandleEvent($an_event, $prefix_special.':OnListBuild', $params);
}
$list->Query($requery);
$this->Special = $special;
if ($list_name) {
$names_mapping[$this->Prefix][$list_name] = $special;
$this->Application->SetVar('NamesToSpecialMapping', $names_mapping);
}
return $list;
}
function ListMarker($params)
{
$list =& $this->GetList($params);
$ret = $list->getPrefixSpecial();
if( getArrayValue($params, 'as_preg') ) $ret = preg_quote($ret, '/');
return $ret;
}
function SubmitName($params)
{
$list =& $this->GetList($params);
$prefix_special = $list->getPrefixSpecial();
return 'events['.$prefix_special.']['.$params['event'].']';
}
function CombinedSortingDropDownName($params)
{
$list =& $this->GetList($params);
$prefix_special = $list->getPrefixSpecial();
return $prefix_special.'_CombinedSorting';
}
function SortingSelected($params)
{
$list =& $this->GetList($params);
$user_sorting_start = $this->getUserSortIndex();
$sorting = strtolower($list->GetOrderField($user_sorting_start).'|'.$list->GetOrderDirection($user_sorting_start));
if ($sorting == strtolower($params['sorting'])) return $params['selected'];
}
/**
* Prints list content using block specified
*
* @param Array $params
* @return string
* @access public
*/
function PrintList2($params)
{
$per_page = $this->SelectParam($params, 'per_page,max_items');
if ($per_page !== false) $params['per_page'] = $per_page;
$list =& $this->GetList($params);
$o = '';
$direction = (isset($params['direction']) && $params['direction']=="H")?"H":"V";
$columns = (isset($params['columns'])) ? $params['columns'] : 1;
$id_field = (isset($params['id_field'])) ? $params['id_field'] : $this->Application->getUnitOption($this->Prefix, 'IDField');
if ($columns>1 && $direction=="V") {
$list->Records = $this->LinearToVertical($list->Records, $columns, $list->GetPerPage());
$list->SelectedCount=count($list->Records);
ksort($list->Records); // this is issued twice, maybe need to be removed
}
$list->GoFirst();
$block_params=$this->prepareTagParams($params);
$block_params['name']=$this->SelectParam($params, 'render_as,block');
$block_params['pass_params']='true';
$block_params['column_width'] = 100 / $columns;
$block_start_row_params = $this->prepareTagParams($params);
$block_start_row_params['name'] = $this->SelectParam($params, 'row_start_render_as,block_row_start,row_start_block');
$block_end_row_params=$this->prepareTagParams($params);
$block_end_row_params['name'] = $this->SelectParam($params, 'row_end_render_as,block_row_end,row_end_block');
$block_empty_cell_params = $this->prepareTagParams($params);
$block_empty_cell_params['name'] = $this->SelectParam($params, 'empty_cell_render_as,block_empty_cell,empty_cell_block');
$i=0;
$backup_id=$this->Application->GetVar($this->Prefix."_id");
$displayed = array();
$column_number = 1;
$cache_mod_rw = $this->Application->getUnitOption($this->Prefix, 'CacheModRewrite') && $this->Application->RewriteURLs();
while (!$list->EOL())
{
$this->Application->SetVar( $this->getPrefixSpecial().'_id', $list->GetDBField($id_field) ); // for edit/delete links using GET
$this->Application->SetVar( $this->Prefix.'_id', $list->GetDBField($id_field) );
if ($cache_mod_rw) {
$this->Application->setCache('filenames', $this->Prefix.'_'.$list->GetDBField($id_field), $list->GetDBField('Filename'));
$this->Application->setCache('filenames', 'c_'.$list->GetDBField('CategoryId'), $list->GetDBField('CategoryFilename'));
}
if ($i % $columns == 0) {
// record in this iteration is first in row, then open row
$column_number = 1;
$o.= $block_start_row_params['name'] ?
$this->Application->ParseBlock($block_start_row_params, 1) :
(!isset($params['no_table']) ? '<tr>' : '');
}
else {
$column_number++;
}
$block_params['column_number'] = $column_number;
$o.= $this->Application->ParseBlock($block_params, 1);
array_push($displayed, $list->GetDBField($id_field));
if (($i+1) % $columns == 0) {
// record in next iteration is first in row too, then close this row
$o.= $block_end_row_params['name'] ?
$this->Application->ParseBlock($block_end_row_params, 1) :
(!isset($params['no_table']) ? '<tr>' : '');
}
$list->GoNext();
$i++;
}
// append empty cells in place of missing cells in last row
while ($i % $columns != 0) {
// until next cell will be in new row append empty cells
$o .= $block_empty_cell_params['name'] ? $this->Application->ParseBlock($block_empty_cell_params, 1) : '<td>&nbsp;</td>';
if (($i+1) % $columns == 0) {
// record in next iteration is first in row too, then close this row
$o .= $block_end_row_params['name'] ? $this->Application->ParseBlock($block_end_row_params, 1) : '</tr>';
}
$i++;
}
$cur_displayed = $this->Application->GetVar($this->Prefix.'_displayed_ids');
if (!$cur_displayed) {
$cur_displayed = Array();
}
else {
$cur_displayed = explode(',', $cur_displayed);
}
$displayed = array_unique(array_merge($displayed, $cur_displayed));
$this->Application->SetVar($this->Prefix.'_displayed_ids', implode(',',$displayed));
$this->Application->SetVar( $this->Prefix.'_id', $backup_id);
$this->Application->SetVar( $this->getPrefixSpecial().'_id', '');
if (isset($params['more_link_render_as'])) {
$block_params = $params;
$params['render_as'] = $params['more_link_render_as'];
$o .= $this->MoreLink($params);
}
return $o;
}
function MoreLink($params)
{
$per_page = $this->SelectParam($params, 'per_page,max_items');
if ($per_page !== false) $params['per_page'] = $per_page;
$list =& $this->GetList($params);
if ($list->PerPage < $list->RecordsCount) {
$block_params = array();
$block_params['name'] = $this->SelectParam($params, 'render_as,block');
return $this->Application->ParseBlock($block_params, 1);
}
}
function NotLastItem($params)
{
$object =& $this->getList($params); // maybe we should use $this->GetList($params) instead
return ($object->CurrentIndex < min($object->PerPage == -1 ? $object->RecordsCount : $object->PerPage, $object->RecordsCount) - 1);
}
function PageLink($params)
{
$t = isset($params['template']) ? $param['template'] : '';
if (!$t) $t = $this->Application->GetVar('t');
if (isset($params['page'])) {
$this->Application->SetVar($this->getPrefixSpecial().'_Page', $params['page']);
}
// $http_query =& $this->Application->recallObject('HTTPQuery');
// $get = $http_query->getRedirectParams();
$pass = Array('pass' => 'm,'.$this->getPrefixSpecial());
// $pass = array_merge($get, $pass);
return $this->Application->HREF($t, '', $pass);
}
function ColumnWidth($params)
{
$columns = $this->Application->Parser->GetParam('columns');
return round(100/$columns).'%';
}
/**
* Append prefix and special to tag
* params (get them from tagname) like
* they were really passed as params
*
* @param Array $tag_params
* @return Array
* @access protected
*/
function prepareTagParams($tag_params = Array())
{
/*if (isset($tag_params['list_name'])) {
$list =& $this->GetList($tag_params);
$this->Init($list->Prefix, $list->Special);
}*/
$ret = $tag_params;
$ret['Prefix'] = $this->Prefix;
$ret['Special'] = $this->Special;
$ret['PrefixSpecial'] = $this->getPrefixSpecial();
return $ret;
}
function GetISO($currency)
{
if ($currency == 'selected') {
$iso = $this->Application->RecallVar('curr_iso');
}
elseif ($currency == 'primary' || $currency == '') {
$iso = $this->Application->GetPrimaryCurrency();
}
else { //explicit currency
$iso = $currency;
}
return $iso;
}
function ConvertCurrency($value, $iso)
{
$converter =& $this->Application->recallObject('kCurrencyRates');
// convery primary currency to selected (if they are the same, converter will just return)
$value = $converter->Convert($value, 'PRIMARY', $iso);
return $value;
}
function AddCurrencySymbol($value, $iso)
{
$currency =& $this->Application->recallObject('curr.-'.$iso, null, Array('skip_autoload' => true));
if( !$currency->isLoaded() ) $currency->Load($iso, 'ISO');
$symbol = $currency->GetDBField('Symbol');
if (!$symbol) $symbol = $currency->GetDBField('ISO').'&nbsp;';
if ($currency->GetDBField('SymbolPosition') == 0) {
$value = $symbol.$value;
}
if ($currency->GetDBField('SymbolPosition') == 1) {
$value = $value.$symbol;
}
return $value;
}
/**
* Get's requested field value
*
* @param Array $params
* @return string
* @access public
*/
function Field($params)
{
$field = $this->SelectParam($params, 'name,field');
if( !$this->Application->IsAdmin() ) $params['no_special'] = 'no_special';
$object =& $this->getObject($params);
if ( $this->HasParam($params, 'db') )
{
$value = $object->GetDBField($field);
}
else
{
if( $this->HasParam($params, 'currency') )
{
$iso = $this->GetISO($params['currency']);
$original = $object->GetDBField($field);
$value = $this->ConvertCurrency($original, $iso);
$object->SetDBField($field, $value);
$object->Fields[$field]['converted'] = true;
}
$format = getArrayValue($params, 'format');
if( !$format || $format == '$format' )
{
$format = null;
}
else
{
if(preg_match("/_regional_(.*)/", $format, $regs))
{
$lang =& $this->Application->recallObject('lang.current');
$format = $lang->GetDBField($regs[1]);
}
}
$value = $object->GetField($field, $format);
if( $this->SelectParam($params, 'negative') )
{
if(strpos($value, '-') === 0)
{
$value = substr($value, 1);
}
else
{
$value = '-'.$value;
}
}
if( $this->HasParam($params, 'currency') )
{
$value = $this->AddCurrencySymbol($value, $iso);
$params['no_special'] = 1;
}
}
if( !$this->HasParam($params, 'no_special') ) $value = htmlspecialchars($value);
if( getArrayValue($params,'checked' ) ) $value = ($value == ( isset($params['value']) ? $params['value'] : 1)) ? 'checked' : '';
if( isset($params['plus_or_as_label']) ) {
$value = substr($value, 0,1) == '+' ? substr($value, 1) : $this->Application->Phrase($value);
}
elseif( getArrayValue($params,'as_label') ) $value = $this->Application->Phrase($value);
$first_chars = $this->SelectParam($params,'first_chars,cut_first');
if($first_chars)
{
$needs_cut = strlen($value) > $first_chars;
$value = substr($value,0,$first_chars);
if($needs_cut) $value .= ' ...';
}
if( getArrayValue($params,'nl2br' ) ) $value = nl2br($value);
if ($value != '') $this->Application->Parser->DataExists = true;
if( $this->HasParam($params, 'currency') )
{
//restoring value in original currency, for other Field tags to work properly
$object->SetDBField($field, $original);
}
return $value;
}
function SetField($params)
{
// <inp2:SetField field="Value" src=p:cust_{$custom_name}"/>
$object =& $this->getObject($params);
$dst_field = $this->SelectParam($params, 'name,field');
list($prefix_special, $src_field) = explode(':', $params['src']);
$src_object =& $this->Application->recallObject($prefix_special);
$object->SetDBField($dst_field, $src_object->GetDBField($src_field));
}
/**
* Checks if parameter is passed
* Note: works like Tag and line simple method too
*
* @param Array $params
* @param string $param_name
* @return bool
*/
function HasParam($params, $param_name = null)
{
if( !isset($param_name) )
{
$param_name = $this->SelectParam($params, 'name');
$params = $this->Application->Parser->Params;
}
$value = getArrayValue($params, $param_name);
return $value && ($value != '$'.$param_name);
}
function PhraseField($params)
{
$field_label = $this->Field($params);
$translation = $this->Application->Phrase( $field_label );
return $translation;
}
function Error($params)
{
$field = $this->SelectParam($params, 'name,field');
$object =& $this->getObject($params);
$msg = $object->GetErrorMsg($field, false);
return $msg;
}
function HasError($params)
{
if ($params['field'] == 'any')
{
$object =& $this->getObject($params);
$skip_fields = getArrayValue($params, 'except');
$skip_fields = $skip_fields ? explode(',', $skip_fields) : Array();
return $object->HasErrors($skip_fields);
}
else
{
$fields = $this->SelectParam($params, 'field,fields');
$fields = explode(',', $fields);
$res = false;
foreach($fields as $field)
{
$params['field'] = $field;
$res = $res || ($this->Error($params) != '');
}
return $res;
}
}
function IsRequired($params)
{
$field = $params['field'];
$object =& $this->getObject($params);;
$formatter_class = getArrayValue($object->Fields, $field, 'formatter');
if ($formatter_class == 'kMultiLanguage')
{
$formatter =& $this->Application->recallObject($formatter_class);
$field = $formatter->LangFieldName($field);
}
$options = $object->GetFieldOptions($field);
return getArrayValue($options,'required');
}
function PredefinedOptions($params)
{
$field = $params['field'];
$object =& $this->getObject($params);
$value = $object->GetDBField($field);
$options = $object->GetFieldOptions($field);
if( $this->HasParam($params,'has_empty') )
{
$empty_value = getArrayValue($params, 'empty_value');
if($empty_value === false) $empty_value = '';
$options['options'] = array_merge_recursive2( Array($empty_value => ''), $options['options'] );
}
$block_params = $this->prepareTagParams($params);
$block_params['name'] = $this->SelectParam($params, 'render_as,block');
$block_params['field'] = $params['field'];
$block_params['pass_params'] = 'true';
$block_params['field_name'] = $this->InputName($params);
$block_params['PrefixSpecial'] = $this->getPrefixSpecial();
$selected_param_name = getArrayValue($params,'selected_param');
if(!$selected_param_name) $selected_param_name = $params['selected'];
$selected = $params['selected'];
$o = '';
if( $this->HasParam($params,'no_empty') && !getArrayValue($options['options'],'') ) array_shift($options['options']);
if( strpos($value, '|') !== false )
{
// multiple selection checkboxes
$value = explode('|', substr($value, 1, -1) );
foreach ($options['options'] as $key => $val)
{
$block_params['key'] = $key;
$block_params['option'] = $val;
$block_params[$selected_param_name] = ( in_array($key, $value) ? ' '.$selected : '');
$o .= $this->Application->ParseBlock($block_params, 1);
}
}
else
{
// single selection radio or checkboxes
foreach ($options['options'] as $key => $val)
{
$block_params['key'] = $key;
$block_params['option'] = $val;
$block_params[$selected_param_name] = (strlen($key) == strlen($value) && ($key == $value) ? ' '.$selected : '');
$o .= $this->Application->ParseBlock($block_params, 1);
}
}
return $o;
}
function PredefinedSearchOptions($params)
{
$object =& $this->getObject($params);
/* @var $object kDBList */
-
+
$field = $params['field'];
$saved_value = $object->Queried ? $object->GetDBField($field) : null;
$object->SetDBField($field, $this->SearchField($params));
$view_name = $this->Application->RecallVar($this->getPrefixSpecial().'_current_view');
$custom_filter = $this->Application->RecallPersistentVar($this->getPrefixSpecial().'_custom_filter.'.$view_name);
$ret = $this->PredefinedOptions($params);
$object->SetDBField($field, $saved_value);
return $ret;
}
function Format($params)
{
$field = $this->SelectParam($params, 'name,field');
$object =& $this->getObject($params);
$options = $object->GetFieldOptions($field);
$format = $options[ $this->SelectParam($params, 'input_format') ? 'input_format' : 'format' ];
$formatter_class = getArrayValue($options,'formatter');
if($formatter_class)
{
$formatter =& $this->Application->recallObject($formatter_class);
$human_format = getArrayValue($params,'human');
$edit_size = getArrayValue($params,'edit_size');
$sample = getArrayValue($params,'sample');
if($sample)
{
return $formatter->GetSample($field, $options, $object);
}
elseif($human_format || $edit_size)
{
$format = $formatter->HumanFormat($format);
return $edit_size ? strlen($format) : $format;
}
}
return $format;
}
/**
* Print grid pagination using
* block names specified
*
* @param Array $params
* @return string
* @access public
*/
function PrintPages($params)
{
$list =& $this->GetList($params);
$prefix_special = $list->getPrefixSpecial();
$total_pages = $list->GetTotalPages();
if ($total_pages > 1) $this->Application->Parser->DataExists = true;
if($total_pages == 0) $total_pages = 1; // display 1st page as selected in case if we have no pages at all
$o = '';
// what are these 2 lines for?
$this->Application->SetVar($prefix_special.'_event','');
$this->Application->SetVar($prefix_special.'_id','');
$current_page = $list->Page; // $this->Application->RecallVar($prefix_special.'_Page');
$block_params = $this->prepareTagParams($params);
$split = ( isset($params['split'] ) ? $params['split'] : 10 );
$split_start = $current_page - ceil($split/2);
if ($split_start < 1){
$split_start = 1;
}
$split_end = $split_start + $split-1;
if ($split_end > $total_pages) {
$split_end = $total_pages;
$split_start = max($split_end - $split + 1, 1);
}
if ($current_page > 1){
$prev_block_params = $this->prepareTagParams();
if ($total_pages > $split){
$prev_block_params['page'] = max($current_page-$split, 1);
$prev_block_params['name'] = $this->SelectParam($params, 'prev_page_split_render_as,prev_page_split_block');
if ($prev_block_params['name']){
$o .= $this->Application->ParseBlock($prev_block_params, 1);
}
}
$prev_block_params['name'] = 'page';
$prev_block_params['page'] = $current_page-1;
$prev_block_params['name'] = $this->SelectParam($params, 'prev_page_render_as,block_prev_page,prev_page_block');
if ($prev_block_params['name']) {
$this->Application->SetVar($this->getPrefixSpecial().'_Page', $current_page-1);
$o .= $this->Application->ParseBlock($prev_block_params, 1);
}
}
else {
if ( $no_prev_page_block = $this->SelectParam($params, 'no_prev_page_render_as,block_no_prev_page') ) {
$block_params['name'] = $no_prev_page_block;
$o .= $this->Application->ParseBlock($block_params, 1);
}
}
$separator_params['name'] = $this->SelectParam($params, 'separator_render_as,block_separator');
for ($i = $split_start; $i <= $split_end; $i++)
{
if ($i == $current_page) {
$block = $this->SelectParam($params, 'current_render_as,active_render_as,block_current,active_block');
}
else {
$block = $this->SelectParam($params, 'link_render_as,inactive_render_as,block_link,inactive_block');
}
$block_params['name'] = $block;
$block_params['page'] = $i;
$this->Application->SetVar($this->getPrefixSpecial().'_Page', $i);
$o .= $this->Application->ParseBlock($block_params, 1);
if ($this->SelectParam($params, 'separator_render_as,block_separator')
&& $i < $split_end)
{
$o .= $this->Application->ParseBlock($separator_params, 1);
}
}
if ($current_page < $total_pages){
$next_block_params = $this->prepareTagParams();
$next_block_params['page']=$current_page+1;
$next_block_params['name'] = $this->SelectParam($params, 'next_page_render_as,block_next_page,next_page_block');
if ($next_block_params['name']){
$this->Application->SetVar($this->getPrefixSpecial().'_Page', $current_page+1);
$o .= $this->Application->ParseBlock($next_block_params, 1);
}
if ($total_pages > $split){
$next_block_params['page']=min($current_page+$split, $total_pages);
$next_block_params['name'] = $this->SelectParam($params, 'next_page_split_render_as,next_page_split_block');
if ($next_block_params['name']){
$o .= $this->Application->ParseBlock($next_block_params, 1);
}
}
}
$this->Application->SetVar($this->getPrefixSpecial().'_Page', $current_page);
return $o;
}
/**
* Print grid pagination using
* block names specified
*
* @param Array $params
* @return string
* @access public
*/
function PaginationBar($params)
{
return $this->PrintPages($params);
}
/**
* Returns field name (processed by kMultiLanguage formatter
* if required) and item's id from it's IDField or field required
*
* @param Array $params
* @return Array (id,field)
* @access private
*/
function prepareInputName($params)
{
$field = $this->SelectParam($params, 'name,field');
$object =& $this->getObject($params);
$formatter_class = getArrayValue($object->Fields, $field, 'formatter');
if ($formatter_class == 'kMultiLanguage')
{
$formatter =& $this->Application->recallObject($formatter_class);
$field = $formatter->LangFieldName($field);
}
$id_field = getArrayValue($params, 'IdField');
$id = $id_field ? $object->GetDBField($id_field) : $object->GetID();
return Array($id, $field);
}
/**
* Returns input field name to
* be placed on form (for correct
* event processing)
*
* @param Array $params
* @return string
* @access public
*/
function InputName($params)
{
list($id, $field) = $this->prepareInputName($params);
$ret = $this->getPrefixSpecial().'['.$id.']['.$field.']';
if( getArrayValue($params, 'as_preg') ) $ret = preg_quote($ret, '/');
return $ret;
}
/**
* Allows to override various field options through hidden fields with specific names in submit.
* This tag generates this special names
*
* @param Array $params
* @return string
* @author Alex
*/
function FieldModifier($params)
{
list($id, $field) = $this->prepareInputName($params);
$ret = 'field_modifiers['.$this->getPrefixSpecial().']['.$field.']['.$params['type'].']';
if( getArrayValue($params, 'as_preg') ) $ret = preg_quote($ret, '/');
return $ret;
}
/**
* Returns index where 1st changable sorting field begins
*
* @return int
* @access private
*/
function getUserSortIndex()
{
$list_sortings = $this->Application->getUnitOption($this->Prefix, 'ListSortings');
$sorting_prefix = getArrayValue($list_sortings, $this->Special) ? $this->Special : '';
$user_sorting_start = 0;
if ( $forced_sorting = getArrayValue($list_sortings, $sorting_prefix, 'ForcedSorting') ) {
$user_sorting_start = count($forced_sorting);
}
return $user_sorting_start;
}
/**
* Returns order direction for given field
*
*
*
* @param Array $params
* @return string
* @access public
*/
function Order($params)
{
$field = $params['field'];
$user_sorting_start = $this->getUserSortIndex();
$list =& $this->GetList($params);
if ($list->GetOrderField($user_sorting_start) == $field)
{
return strtolower($list->GetOrderDirection($user_sorting_start));
}
elseif($list->GetOrderField($user_sorting_start+1) == $field)
{
return '2_'.strtolower($list->GetOrderDirection($user_sorting_start+1));
}
else
{
return 'no';
}
}
/**
* Get's information of sorting field at "pos" position,
* like sorting field name (type="field") or sorting direction (type="direction")
*
* @param Array $params
* @return mixed
*/
function OrderInfo($params)
{
$user_sorting_start = $this->getUserSortIndex() + --$params['pos'];
$list =& $this->GetList($params);
// $object =& $this->Application->recallObject( $this->getPrefixSpecial() );
if($params['type'] == 'field') return $list->GetOrderField($user_sorting_start);
if($params['type'] == 'direction') return $list->GetOrderDirection($user_sorting_start);
}
/**
* Checks if sorting field/direction matches passed field/direction parameter
*
* @param Array $params
* @return bool
*/
function IsOrder($params)
{
$params['type'] = isset($params['field']) ? 'field' : 'direction';
$value = $this->OrderInfo($params);
if( isset($params['field']) ) return $params['field'] == $value;
if( isset($params['direction']) ) return $params['direction'] == $value;
}
/**
* Returns list perpage
*
* @param Array $params
* @return int
*/
function PerPage($params)
{
$object =& $this->getObject($params);
return $object->PerPage;
}
/**
* Checks if list perpage matches value specified
*
* @param Array $params
* @return bool
*/
function PerPageEquals($params)
{
$object =& $this->getObject($params);
return $object->PerPage == $params['value'];
}
function SaveEvent($params)
{
// SaveEvent is set during OnItemBuild, but we may need it before any other tag calls OnItemBuild
$object =& $this->getObject($params);
return $this->Application->GetVar($this->getPrefixSpecial().'_SaveEvent');
}
function NextId($params)
{
$object =& $this->getObject($params);
$wid = $this->Application->GetTopmostWid($this->Prefix);
$session_name = rtrim($this->getPrefixSpecial().'_selected_ids_'.$wid, '_');
$ids = explode(',', $this->Application->RecallVar($session_name));
$cur_id = $object->GetID();
$i = array_search($cur_id, $ids);
if ($i !== false) {
return $i < count($ids) - 1 ? $ids[$i + 1] : '';
}
return '';
}
function PrevId($params)
{
$object =& $this->getObject($params);
$wid = $this->Application->GetTopmostWid($this->Prefix);
$session_name = rtrim($this->getPrefixSpecial().'_selected_ids_'.$wid, '_');
$ids = explode(',', $this->Application->RecallVar($session_name));
$cur_id = $object->GetID();
$i = array_search($cur_id, $ids);
if ($i !== false) {
return $i > 0 ? $ids[$i - 1] : '';
}
return '';
}
function IsSingle($params)
{
return ($this->NextId($params) === '' && $this->PrevId($params) === '');
}
function IsLast($params)
{
return ($this->NextId($params) === '');
}
function IsFirst($params)
{
return ($this->PrevId($params) === '');
}
/**
* Checks if field value is equal to proposed one
*
* @param Array $params
* @return bool
*/
function FieldEquals($params)
{
$object =& $this->getObject($params);
$ret = $object->GetDBField($this->SelectParam($params, 'name,field')) == $params['value'];
// if( getArrayValue($params,'inverse') ) $ret = !$ret;
return $ret;
}
function ItemIcon($params)
{
$object =& $this->getObject($params);
$grids = $this->Application->getUnitOption($this->Prefix,'Grids');
$icons =& $grids[ $params['grid'] ]['Icons'];
$key = '';
$status_fields = $this->Application->getUnitOption($this->Prefix,'StatusField');
if(!$status_fields) return $icons['default'];
foreach($status_fields as $status_field)
{
$key .= $object->GetDBField($status_field).'_';
}
$key = rtrim($key,'_');
$value = ($key !== false) ? $key : 'default';
return isset($icons[$value]) ? $icons[$value] : $icons['default'];
}
/**
* Generates bluebar title + initializes prefixes used on page
*
* @param Array $params
* @return string
*/
function SectionTitle($params)
{
$preset_name = replaceModuleSection($params['title_preset']);
$title_presets = $this->Application->getUnitOption($this->Prefix,'TitlePresets');
$title_info = getArrayValue($title_presets, $preset_name);
if($title_info === false) return str_replace('#preset_name#', $preset_name, $params['title']);
if( getArrayValue($title_presets,'default') )
{
// use default labels + custom labels specified in preset used
$title_info = array_merge_recursive2($title_presets['default'], $title_info);
}
$title = $title_info['format'];
// 1. get objects in use for title construction
$objects = Array();
$object_status = Array();
$status_labels = Array();
$prefixes = getArrayValue($title_info,'prefixes');
$all_tag_params = getArrayValue($title_info,'tag_params');
if($prefixes)
{
// extract tag_perams passed directly to SectionTitle tag for specific prefix
foreach ($params as $tp_name => $tp_value) {
if (preg_match('/(.*)\[(.*)\]/', $tp_name, $regs)) {
$all_tag_params[ $regs[1] ][ $regs[2] ] = $tp_value;
unset($params[$tp_name]);
}
}
$tag_params = Array();
foreach($prefixes as $prefix_special)
{
$prefix_data = $this->Application->processPrefix($prefix_special);
$prefix_data['prefix_special'] = rtrim($prefix_data['prefix_special'],'.');
if($all_tag_params)
{
$tag_params = getArrayValue($all_tag_params, $prefix_data['prefix_special']);
if(!$tag_params) $tag_params = Array();
}
$tag_params = array_merge_recursive2($params, $tag_params);
$objects[ $prefix_data['prefix_special'] ] =& $this->Application->recallObject($prefix_data['prefix_special'], $prefix_data['prefix'], $tag_params);
$object_status[ $prefix_data['prefix_special'] ] = $objects[ $prefix_data['prefix_special'] ]->IsNewItem() ? 'new' : 'edit';
// a. set object's status field (adding item/editing item) for each object in title
if( getArrayValue($title_info[ $object_status[ $prefix_data['prefix_special'] ].'_status_labels' ],$prefix_data['prefix_special']) )
{
$status_labels[ $prefix_data['prefix_special'] ] = $title_info[ $object_status[ $prefix_data['prefix_special'] ].'_status_labels' ][ $prefix_data['prefix_special'] ];
$title = str_replace('#'.$prefix_data['prefix_special'].'_status#', $status_labels[ $prefix_data['prefix_special'] ], $title);
}
// b. setting object's titlefield value (in titlebar ONLY) to default in case if object beeing created with no titlefield filled in
if( $object_status[ $prefix_data['prefix_special'] ] == 'new' )
{
$new_value = $this->getInfo( $objects[ $prefix_data['prefix_special'] ], 'titlefield' );
if(!$new_value && getArrayValue($title_info['new_titlefield'],$prefix_data['prefix_special']) ) $new_value = $this->Application->Phrase($title_info['new_titlefield'][ $prefix_data['prefix_special'] ]);
$title = str_replace('#'.$prefix_data['prefix_special'].'_titlefield#', $new_value, $title);
}
}
}
// 2. replace phrases if any found in format string
$title = $this->Application->ReplaceLanguageTags($title,false);
// 3. find and replace any replacement vars
preg_match_all('/#(.*_.*)#/Uis',$title,$rets);
if($rets[1])
{
$replacement_vars = array_keys( array_flip($rets[1]) );
foreach($replacement_vars as $replacement_var)
{
$var_info = explode('_',$replacement_var,2);
$object =& $objects[ $var_info[0] ];
$new_value = $this->getInfo($object,$var_info[1]);
$title = str_replace('#'.$replacement_var.'#', $new_value, $title);
}
}
$cut_first = getArrayValue($params,'cut_first');
if( $cut_first && strlen($title) > $cut_first && !preg_match('/<a href="(.*)">(.*)<\/a>/',$title) ) $title = substr($title, 0, $cut_first).' ...';
return $title;
}
function getInfo(&$object, $info_type)
{
switch ($info_type)
{
case 'titlefield':
$field = $this->Application->getUnitOption($object->Prefix,'TitleField');
return $field !== false ? $object->GetField($field) : 'TitleField Missing';
break;
case 'recordcount':
$of_phrase = $this->Application->Phrase('la_of');
return $object->NoFilterCount != $object->RecordsCount ? $object->RecordsCount.' '.$of_phrase.' '.$object->NoFilterCount : $object->RecordsCount;
break;
default:
return $object->GetField($info_type);
break;
}
}
function GridInfo($params) {
$object =& $this->getObject($params);
/* @var $object kDBList */
switch ($params['type'])
{
case 'filtered':
return $object->RecordsCount;
case 'total':
return $object->NoFilterCount;
case 'from':
return $object->Offset+1; //0-based
case 'to':
return min($object->Offset + $object->PerPage, $object->RecordsCount);
}
}
/**
* Parses block depending on its element type.
* For radio and select elements values are taken from 'value_list_field' in key1=value1,key2=value2
* format. key=value can be substituted by <SQL>SELECT f1 AS OptionName, f2 AS OptionValue... FROM <PREFIX>TableName </SQL>
* where prefix is TABLE_PREFIX
*
* @param Array $params
* @return string
*/
function ConfigFormElement($params)
{
$object =& $this->getObject($params);
$field = $params['field'];
$helper =& $this->Application->recallObject('InpCustomFieldsHelper');
$element_type = $object->GetDBField($params['element_type_field']);
if($element_type == 'label') $element_type = 'text';
$params['name'] = $params['blocks_prefix'].$element_type;
switch ($element_type) {
case 'select':
case 'radio':
$field_options = $object->GetFieldOptions($field, 'options');
$field_options['options'] = $helper->GetValuesHash( $object->GetDBField($params['value_list_field']) );
$object->SetFieldOptions($field, $field_options);
break;
case 'text':
case 'textarea':
$params['field_params'] = $helper->ParseConfigSQL($object->GetDBField($params['value_list_field']));
break;
case 'password':
case 'checkbox':
default:
break;
}
return $this->Application->ParseBlock($params, 1);
}
/**
* Get's requested custom field value
*
* @param Array $params
* @return string
* @access public
*/
function CustomField($params)
{
$params['name'] = 'cust_'.$this->SelectParam($params, 'name,field');
return $this->Field($params);
}
function CustomFieldLabel($params)
{
$object =& $this->getObject($params);
$field = $this->SelectParam($params, 'name,field');
$sql = 'SELECT FieldLabel
FROM '.$this->Application->getUnitOption('cf', 'TableName').'
WHERE FieldName = '.$this->Conn->qstr($field);
return $this->Application->Phrase($this->Conn->GetOne($sql));
}
/**
* transposes 1-dimensional array elements for vertical alignment according to given columns and per_page parameters
*
* @param array $arr
* @param int $columns
* @param int $per_page
* @return array
*/
function LinearToVertical(&$arr, $columns, $per_page)
{
$rows = $columns;
// in case if after applying per_page limit record count less then
// can fill requrested column count, then fill as much as we can
$cols = min(ceil($per_page / $columns), ceil(count($arr) / $columns));
$imatrix = array();
for ($row = 0; $row < $rows; $row++) {
for ($col = 0; $col < $cols; $col++) {
$source_index = $row * $cols + $col;
if (!isset($arr[$source_index])) {
// in case if source array element count is less then element count in one row
continue;
}
$imatrix[$col * $rows + $row] = $arr[$source_index];
}
}
ksort($imatrix);
reset($imatrix);
return $imatrix;
}
/**
* If data was modfied & is in TempTables mode, then parse block with name passed;
* remove modification mark if not in TempTables mode
*
* @param Array $params
* @return string
* @access public
* @author Alexey
*/
function SaveWarning($params)
{
$main_prefix = getArrayValue($params, 'main_prefix');
if ($main_prefix && $main_prefix != '$main_prefix') {
$top_prefix = $main_prefix;
}
else {
$top_prefix = $this->Application->GetTopmostPrefix($this->Prefix);
}
$temp_tables = substr($this->Application->GetVar($top_prefix.'_mode'), 0, 1) == 't';
$modified = $this->Application->RecallVar($top_prefix.'_modified');
if ($temp_tables && $modified) {
$block_params = $this->prepareTagParams($params);
$block_params['name'] = $this->SelectParam($params, 'render_as,name');
$block_params['edit_mode'] = $temp_tables ? 1 : 0;
return $this->Application->ParseBlock($block_params);
}
$this->Application->RemoveVar($top_prefix.'_modified');
return '';
}
/**
* Returns list record count queries (on all pages)
*
* @param Array $params
* @return int
*/
function TotalRecords($params)
{
$list =& $this->GetList($params);
if (!$list->Counted) $list->CountRecs();
return $list->RecordsCount;
}
/**
* Range filter field name
*
* @param Array $params
* @return string
*/
function SearchInputName($params)
{
$field = $this->SelectParam($params, 'field,name');
$ret = 'custom_filters['.$this->getPrefixSpecial().']['.$params['grid'].']['.$field.']['.$params['filter_type'].']';
if (isset($params['type'])) {
$ret .= '['.$params['type'].']';
}
return $ret;
}
/**
* Return range filter field value
*
* @param Array $params
* @return string
*/
function SearchField($params) // RangeValue
{
$field = $this->SelectParam($params, 'field,name');
$view_name = $this->Application->RecallVar($this->getPrefixSpecial().'_current_view');
$custom_filter = $this->Application->RecallPersistentVar($this->getPrefixSpecial().'_custom_filter.'.$view_name);
$custom_filter = $custom_filter ? unserialize($custom_filter) : Array();
if (isset($custom_filter[ $params['grid'] ][$field])) {
$ret = $custom_filter[ $params['grid'] ][$field][ $params['filter_type'] ]['submit_value'];
if (isset($params['type'])) {
$ret = $ret[ $params['type'] ];
}
return $ret;
}
return '';
}
function SearchFormat($params)
{
$field = $params['field'];
$object =& $this->GetList($params);
$options = $object->GetFieldOptions($field);
$format = $options[ $this->SelectParam($params, 'input_format') ? 'input_format' : 'format' ];
$formatter_class = getArrayValue($options,'formatter');
if($formatter_class)
{
$formatter =& $this->Application->recallObject($formatter_class);
$human_format = getArrayValue($params,'human');
$edit_size = getArrayValue($params,'edit_size');
$sample = getArrayValue($params,'sample');
if($sample)
{
return $formatter->GetSample($field, $options, $object);
}
elseif($human_format || $edit_size)
{
$format = $formatter->HumanFormat($format);
return $edit_size ? strlen($format) : $format;
}
}
return $format;
}
/**
* Returns error of range field
*
* @param unknown_type $params
* @return unknown
*/
function SearchError($params)
{
$field = $this->SelectParam($params, 'field,name');
$error_var_name = $this->getPrefixSpecial().'_'.$field.'_'.$params['type'].'_error';
$error_msg = $this->Application->RecallVar($error_var_name);
if($error_msg)
{
$this->Application->StoreVar($error_var_name, '');
}
$object =& $this->Application->recallObject($this->Prefix.'.'.$this->Special.'-item', null, Array('skip_autoload' => true));
return $object->ErrorMsgs[$error_msg];
}
/**
* Returns templates path for module, which is gathered from prefix module
*
* @param Array $params
* @return string
* @author Alex
*/
function ModulePath($params)
{
$force_module = getArrayValue($params, 'module');
if ($force_module) {
if ($force_module == '#session#') {
$force_module = $this->Application->RecallVar('module');
if (!$force_module) $force_module = 'core';
}
else {
$force_module = strtolower($force_module);
}
if ($force_module == 'core') {
$module_folder = 'core';
}
else {
$module_folder = trim( $this->Application->findModule('Name', $force_module, 'Path'), '/');
}
}
else {
$module_folder = $this->Application->getUnitOption($this->Prefix, 'ModuleFolder');
}
return '../../'.$module_folder.'/admin_templates/';
}
/**
* Returns object used in tag processor
*
* @access public
* @return kDBBase
*/
function &getObject($params = Array())
{
$object =& $this->Application->recallObject($this->getPrefixSpecial(), $this->Prefix, $params);
return $object;
}
/**
* Checks if object propery value matches value passed
*
* @param Array $params
* @return bool
*/
function PropertyEquals($params)
{
$object =& $this->getObject($params);
$property_name = $this->SelectParam($params, 'name,var,property');
return $object->$property_name == $params['value'];
}
/**
* Group list records by header, saves internal order in group
*
* @param Array $records
* @param string $heading_field
*/
function groupRecords(&$records, $heading_field)
{
$sorted = Array();
$i = 0; $record_count = count($records);
while ($i < $record_count) {
$sorted[ $records[$i][$heading_field] ][] = $records[$i];
$i++;
}
$records = Array();
foreach ($sorted as $heading => $heading_records) {
$records = array_merge_recursive($records, $heading_records);
}
}
function DisplayOriginal($params)
{
return false;
}
function MultipleEditing($params)
{
$wid = $this->Application->GetTopmostWid($this->Prefix);
$session_name = rtrim($this->getPrefixSpecial().'_selected_ids_'.$wid, '_');
$selected_ids = explode(',', $this->Application->RecallVar($session_name));
$ret = '';
if ($selected_ids) {
$selected_ids = explode(',', $selected_ids);
$object =& $this->getObject( array_merge_recursive2($params, Array('skip_autoload' => true)) );
$params['name'] = $params['render_as'];
foreach ($selected_ids as $id) {
$object->Load($id);
$ret .= $this->Application->ParseBlock($params);
}
}
return $ret;
}
function ExportStatus($params)
{
$export_object =& $this->Application->recallObject('CatItemExportHelper');
$event = new kEvent($this->getPrefixSpecial().':OnDummy');
$action_method = 'perform'.ucfirst($this->Special);
$field_values = $export_object->$action_method($event);
// finish code is done from JS now
if ($field_values['start_from'] == $field_values['total_records'])
{
if ($this->Special == 'import') {
$this->Application->StoreVar('PermCache_UpdateRequired', 1);
$this->Application->Redirect('categories/cache_updater', Array('m_opener' => 'r', 'pass' => 'm', 'continue' => 1, 'no_amp' => 1));
}
elseif ($this->Special == 'export') {
$finish_t = $this->Application->RecallVar('export_finish_t');
$this->Application->Redirect($finish_t, Array('pass' => 'all'));
$this->Application->RemoveVar('export_finish_t');
}
}
$export_options = $export_object->loadOptions($event);
return $export_options['start_from'] * 100 / $export_options['total_records'];
}
/**
* Returns path where exported category items should be saved
*
* @param Array $params
*/
function ExportPath($params)
{
$ret = EXPORT_PATH.'/';
if( getArrayValue($params, 'as_url') )
{
$ret = str_replace( FULL_PATH.'/', $this->Application->BaseURL(), $ret);
}
$export_options = unserialize($this->Application->RecallVar($this->getPrefixSpecial().'_options'));
$ret .= $export_options['ExportFilename'].'.'.($export_options['ExportFormat'] == 1 ? 'csv' : 'xml');
return $ret;
}
function FieldTotal($params)
{
$list =& $this->GetList($params);
return $list->getTotal($this->SelectParam($params, 'field,name'), $params['function']);
}
function FCKEditor($params) {
$params['no_special'] = 1;
$value = $this->Field($params);
$name = $this->InputName($params);
include_once(FULL_PATH.'/core/cmseditor/fckeditor.php');
$oFCKeditor = new FCKeditor($name);
$oFCKeditor->BasePath = BASE_PATH.'/core/cmseditor/';
$oFCKeditor->Width = $params['width'] ;
$oFCKeditor->Height = $params['height'] ;
$oFCKeditor->ToolbarSet = 'Advanced' ;
$oFCKeditor->Value = $value ;
$oFCKeditor->Config = Array(
//'UserFilesPath' => $pathtoroot.'kernel/user_files',
'ProjectPath' => BASE_PATH.'/',
- 'CustomConfigurationsPath' => $this->Application->BaseURL().'core/cmseditor/inp_fckconfig.js',
+ 'CustomConfigurationsPath' => $this->Application->BaseURL().'core/admin_templates/js/inp_fckconfig.js',
// 'EditorAreaCSS' => $this->Application->BaseURL().'/themes/inportal_site/inc/inportal.css', //GetThemeCSS(),
- //'StylesXmlPath' => '../../inp_styles.xml',
+ 'StylesXmlPath' => $this->Application->BaseURL().'core/admin_templates/js/inp_styles.xml',
// 'Debug' => 1,
'Admin' => 1,
'K4' => 1,
);
return $oFCKeditor->CreateHtml();
}
}
?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.68.4/core/kernel/db/db_tag_processor.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.68.4.14
\ No newline at end of property
+1.68.4.15
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.10.2/admin/editor/cmseditor/editor/filemanager/browser/default/frmupload.html
===================================================================
--- branches/unlabeled/unlabeled-1.10.2/admin/editor/cmseditor/editor/filemanager/browser/default/frmupload.html (revision 7067)
+++ branches/unlabeled/unlabeled-1.10.2/admin/editor/cmseditor/editor/filemanager/browser/default/frmupload.html (revision 7068)
@@ -1,161 +1,175 @@
<!--
* 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: frmupload.html
* Page used to upload new files in the current folder.
*
* Version: 2.0 RC3
* Modified: 2004-11-29 16:04:32
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link href="Browser.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="js/common.js"></script>
<script language="javascript">
function SetCurrentFolder( resourceType, folderPath )
{
var sUrl = oConnector.ConnectorUrl +'Command=FileUpload' ;
sUrl += '&Type=' + resourceType ;
sUrl += '&CurrentFolder=' + folderPath ;
document.getElementById('frmUpload').action = sUrl ;
}
function OnSubmit()
{
if ( document.getElementById('NewFile').value.length == 0 )
{
alert( 'Please select a file from your computer' ) ;
return false ;
}
// Set the interface elements.
document.getElementById('eUploadMessage').innerHTML = 'Upload a new file in this folder (Upload in progress, please wait...)' ;
document.getElementById('btnUpload').disabled = true ;
return true ;
}
function outputErrorMsg(errorNumber, fileName) {
switch ( errorNumber )
{
case 0 :
window.parent.frames['frmResourcesList'].Refresh() ;
break ;
case 201 :
window.parent.frames['frmResourcesList'].Refresh() ;
alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ;
break ;
case 202 :
alert( 'Invalid file' ) ;
break ;
case 203 :
alert( 'Invalid file type for this foder' ) ;
break ;
case 204 :
alert( 'A file with the same name is already available' ) ;
break ;
default :
alert( 'Error on file upload. Error number: ' + errorNumber ) ;
break ;
}
}
function OnUploadCompleted( errorNumber, fileName )
{
// Reset the Upload Worker Frame.
window.parent.frames['frmUploadWorker'].location = 'about:blank' ;
// Reset the upload form (On IE we must do a little trick to avout problems).
if ( document.all )
document.getElementById('NewFile').outerHTML = '<input id="NewFile" name="NewFile" style="WIDTH: 100%" type="file">' ;
else
document.getElementById('frmUpload').reset() ;
// Reset the interface elements.
document.getElementById('eUploadMessage').innerHTML = 'Upload a new file in this folder' ;
document.getElementById('btnUpload').disabled = false ;
outputErrorMsg(errorNumber, fileName);
}
window.onload = function()
{
window.top.IsLoadedUpload = true ;
}
function SetElementVisibility(upload_visibility, del_rename_visibility) {
document.getElementById("upload").style.display = upload_visibility;
document.getElementById("del_rename").style.display = del_rename_visibility;
}
function SetButtonAvalability(button_name, avalability) {
//alert(button_name+', '+avalability);
//document.getElementById(button_name).disabled = !avalability;
if (avalability == false) {
document.getElementById(button_name).disabled = true;
document.getElementById(button_name).style.color = '#666666';
}
else {
document.getElementById(button_name).disabled = false;
document.getElementById(button_name).style.color = '#000000';
}
}
function RenameFile()
{
filename = window.parent.frames['frmResourcesList'].GetCheckedFileName('first');
f=prompt('Rename file "'+filename+'"?',filename);
if (f) {
window.parent.frames['frmResourcesList'].RenameFile(filename,f);
}
}
function DeleteFiles()
{
cnt = window.parent.frames['frmResourcesList'].GetCheckedFileName('cnt');
if (cnt > 0) {
a = (cnt > 1) ? "Delete "+cnt+" selected files?": "Delete selected file?";
if (confirm(a)) {
window.parent.frames['frmResourcesList'].DeleteFiles(0);
}
}
}
- </script>
+function UploadNewFile()
+{
+
+ var file_name = document.frmUpload.elements['NewFile'].value;
+ if (file_name.length > 0) {
+
+ var ret = window.parent.frames['frmResourcesList'].ValidateFileName(file_name);
+ if (!ret)
+ return false;
+ else
+ document.frmUpload.submit();
+ } return false;
+}
+
+</script>
</head>
<body bottomMargin="0" topMargin="0">
- <form id="frmUpload" action="" target="frmUploadWorker" method="post" enctype="multipart/form-data" onsubmit="return OnSubmit();">
+ <form id="frmUpload" name="frmUpload" action="" target="frmUploadWorker" method="post" enctype="multipart/form-data" onsubmit="return OnSubmit();">
<table height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0">
<tr>
<td nowrap>
<div id="upload">
<span id="eUploadMessage">Upload a new file in this folder</span><br>
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
<tr>
<td width="100%"><input id="NewFile" name="NewFile" size="50" type="file"></td>
- <td nowrap>&nbsp;<input id="btnUpload" type="submit" value="Upload"></td>
+ <td nowrap>&nbsp;<input id="btnUpload" type="button" value="Upload" OnClick="UploadNewFile();"></td>
</tr>
</table>
</div>
<div id="del_rename" style="display : none">
<img src="images/s.gif" width="1" height="10" /><br />
<button type="button" id="rename" style="color:#000000; font-size: 11px; font-family: 'Microsoft Sans Serif' , Arial, Helvetica, Verdana" onClick="RenameFile();">Rename</button>
<button type="button" id="delete" style="color:#000000; font-size: 11px; font-family: 'Microsoft Sans Serif' , Arial, Helvetica, Verdana" onClick="DeleteFiles();">Delete</button>
</div>
</td>
</tr>
</table>
</form>
</body>
</html>
Property changes on: branches/unlabeled/unlabeled-1.10.2/admin/editor/cmseditor/editor/filemanager/browser/default/frmupload.html
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.10
\ No newline at end of property
+1.10.2.1
\ No newline at end of property

Event Timeline