Index: branches/RC/core/units/related_searches/related_searches_tag_processor.php
===================================================================
diff -u -r9329 -r9334
--- branches/RC/core/units/related_searches/related_searches_tag_processor.php (.../related_searches_tag_processor.php) (revision 9329)
+++ branches/RC/core/units/related_searches/related_searches_tag_processor.php (.../related_searches_tag_processor.php) (revision 9334)
@@ -2,7 +2,6 @@
class RelatedSearchTagProcessor extends kDBTagProcessor {
-
/**
* Returns url for search on the Fornt End
*
@@ -14,8 +13,7 @@
$object =& $this->getObject($params);
$keyword = $object->GetDBField('Keyword');
- return $this->Application->HREF($params['search_template'],'', Array(
- 'keywords' => $keyword,));
+ return $this->Application->HREF($params['search_template'],'', Array('keywords' => $keyword));
}
}
Index: branches/RC/core/admin_templates/js/uploader.js
===================================================================
diff -u -r8929 -r9334
--- branches/RC/core/admin_templates/js/uploader.js (.../uploader.js) (revision 8929)
+++ branches/RC/core/admin_templates/js/uploader.js (.../uploader.js) (revision 9334)
@@ -15,13 +15,15 @@
{
var holder = document.createElement('DIV');
document.body.appendChild(holder);
-
+
+ document.getElementById($form_name).style.display = 'block';
+
// moving out progress div to overcome loosing of flash object after setting opacity
-
this.div = document.getElementById(this.id+'_progress');
var clone = this.div.cloneNode(true);
this.div.parentNode.removeChild(this.div)
this.div = document.body.appendChild(clone);
+ this.IconPath = this.params.IconPath ? this.params.IconPath : '../cmseditor/editor/images';
this.filename = document.getElementById(this.id+'_progress_filename');
this.progress = document.getElementById(this.id+'_progress_progress');
@@ -37,38 +39,38 @@
this.swf.setAttribute('style', '');
this.swf.addVariable("uploadScript", '');
this.swf.addVariable("maxFiles", escape(this.params.multiple));
- this.swf.addVariable("allowedFilesize", escape(this.params.allowedFilesize));
- this.swf.addVariable("allowedFiletypes", escape(this.params.allowedFiletypes));
- this.swf.addVariable("allowedFiletypesDescription", escape(this.params.allowedFiletypesDescription));
+ this.swf.addVariable("allowedFilesize", escape(this.params.allowedFilesize));
+ this.swf.addVariable("allowedFiletypes", escape(this.params.allowedFiletypes));
+ this.swf.addVariable("allowedFiletypesDescription", escape(this.params.allowedFiletypesDescription));
- this.swf.addVariable("uploadFileQueuedCallback", escape('UploadsManager.FileSelected'));
- this.swf.addVariable("uploadFileStartCallback", escape('UploadsManager.UploadFileStart'));
- this.swf.addVariable("uploadProgressCallback", escape('UploadsManager.UploadProgress'));
- this.swf.addVariable("uploadFileCompleteCallback", escape('UploadsManager.UploadFileComplete'));
- this.swf.addVariable("uploadFileCancelCallback", escape('UploadsManager.FileCancelled'));
- this.swf.addVariable("uploadQueueCompleteCallback", escape('UploadsManager.UploadQueueComplete'));
- this.swf.addVariable("uploadFileErrorCallback", escape('UploadsManager.UploadError'));
- this.swf.addVariable("autoUpload", escape('false'));
-// this.swf.addVariable("flashLoadedCallback", 'flashLoadedCallback');
+ this.swf.addVariable("uploadFileQueuedCallback", escape('UploadsManager.FileSelected'));
+ this.swf.addVariable("uploadFileStartCallback", escape('UploadsManager.UploadFileStart'));
+ this.swf.addVariable("uploadProgressCallback", escape('UploadsManager.UploadProgress'));
+ this.swf.addVariable("uploadFileCompleteCallback", escape('UploadsManager.UploadFileComplete'));
+ this.swf.addVariable("uploadFileCancelCallback", escape('UploadsManager.FileCancelled'));
+ this.swf.addVariable("uploadQueueCompleteCallback", escape('UploadsManager.UploadQueueComplete'));
+ this.swf.addVariable("uploadFileErrorCallback", escape('UploadsManager.UploadError'));
+ this.swf.addVariable("autoUpload", escape('false'));
+// this.swf.addVariable("flashLoadedCallback", 'flashLoadedCallback');
- this.swf.addVariable("uploadScriptCallback", escape('UploadsManager.GetUploadScript'));
- this.swf.addVariable("uploaderId", escape(this.id));
+ this.swf.addVariable("uploadScriptCallback", escape('UploadsManager.GetUploadScript'));
+ this.swf.addVariable("uploaderId", escape(this.id));
this.swf.write(holder);
- this.flash = document.getElementById(this.flash_id);
- /*if (this.flash != null) {
- if(this.flash.PercentLoaded() == 100) {
- alert('done movie: '+this.flash.PercentLoaded());
- }
+ this.flash = document.getElementById(this.flash_id);
+/* if (this.flash != null) {
+ if(this.flash.PercentLoaded() == 100) {
+ alert('done movie: '+this.flash.PercentLoaded());
+ }
}
else {
alert('this.flash is null')
}*/
if (this.params.urls != '') {
- var urls = this.params.urls.split('|');
- var names = this.params.names.split('|');
- var sizes = this.params.sizes.split('|');
- for (var i in urls) {
+ var urls = this.params.urls.split('|');
+ var names = this.params.names.split('|');
+ var sizes = this.params.sizes.split('|');
+ for (var i in urls) {
var a_file = {
id : names[i],
name : names[i],
@@ -78,9 +80,9 @@
}
this.files.push(a_file)
this.files_count++;
- }
- this.UpdateInfo();
- }
+ }
+ this.UpdateInfo();
+ }
}
Uploader.prototype.UpdateInfo = function()
@@ -90,7 +92,7 @@
this.files[f].name.match(/\.([^.]*)$/);
var ext = RegExp.$1;
var icon = ext.match(/^(ai|avi|bmp|cs|dll|doc|dot|exe|fla|gif|htm|html|jpg|js|mdb|mp3|pdf|ppt|rdp|swf|swt|txt|vsd|xls|xml|zip)$/) ? ext : 'default.icon';
- o += '
';
+ o += '
';
if (isset(this.files[f].uploaded)) {
o += ''+this.files[f].name + ' ('+this.FormatSize(this.files[f].size)+') [Delete]
';
}
@@ -225,7 +227,6 @@
Uploader.prototype.UploadProgress = function(file, bytesLoaded)
{
this.cur_file_uploaded = bytesLoaded;
-
var uploaded = this.uploaded+this.cur_file_uploaded;
this.ProgressTime = this.GetMicroTime() - this.StartTime;
@@ -337,6 +338,7 @@
UploadsManager.UploadError = function(errno, file, msg)
{
this.Uploaders[file.uploader_id].RemoveFile(file);
+
if (errno == -10) {
switch (msg.toString()) {
case '403':
Index: branches/RC/core/kernel/db/dbitem.php
===================================================================
diff -u -r9270 -r9334
--- branches/RC/core/kernel/db/dbitem.php (.../dbitem.php) (revision 9270)
+++ branches/RC/core/kernel/db/dbitem.php (.../dbitem.php) (revision 9334)
@@ -800,6 +800,8 @@
function PopulateMultiLangFields()
{
$ml_helper =& $this->Application->recallObject('kMultiLanguageHelper');
+ /* @var $ml_helper kMultiLanguageHelper */
+
$lang_count = $ml_helper->getLanguageCount();
foreach ($this->Fields as $field => $options)
{
@@ -809,7 +811,7 @@
$name = $regs[2];
unset($options['required']); // all non-primary language field set to non-required
for ($i=1; $i<=$lang_count; $i++) {
- if ($i == $l) continue;
+ if ($i == $l || !$ml_helper->LanguageFound($i)) continue;
$this->Fields['l'.$i.'_'.$name] = $options;
}
}
Index: branches/RC/kernel/admin_templates/categories/categories_edit_related_searches.tpl
===================================================================
diff -u -r9329 -r9334
--- branches/RC/kernel/admin_templates/categories/categories_edit_related_searches.tpl (.../categories_edit_related_searches.tpl) (revision 9329)
+++ branches/RC/kernel/admin_templates/categories/categories_edit_related_searches.tpl (.../categories_edit_related_searches.tpl) (revision 9334)
@@ -38,7 +38,7 @@
a_toolbar.AddButton( new ToolBarSeparator('sep2') );
//Relations related:
- a_toolbar.AddButton( new ToolBarButton('new_related_search', '',
+ a_toolbar.AddButton( new ToolBarButton('in-portal:new_related_search', '',
function() {
std_new_item('c-search', 'in-portal/categories/related_searches_edit')
} ) );
Index: branches/RC/core/units/general/helpers/multilanguage.php
===================================================================
diff -u -r8929 -r9334
--- branches/RC/core/units/general/helpers/multilanguage.php (.../multilanguage.php) (revision 8929)
+++ branches/RC/core/units/general/helpers/multilanguage.php (.../multilanguage.php) (revision 9334)
@@ -6,9 +6,21 @@
*/
class kMultiLanguageHelper extends kHelper {
+ /**
+ * Maximal language id
+ *
+ * @var int
+ */
var $languageCount = 0;
/**
+ * Languages created in system
+ *
+ * @var Array
+ */
+ var $languagesIDs = Array ();
+
+ /**
* Structure of table, that is currently processed
*
* @var Array
@@ -43,18 +55,30 @@
}
/**
+ * Checks if language with specified id is created
+ *
+ * @param int $language_id
+ * @return bool
+ */
+ function LanguageFound($language_id)
+ {
+ return in_array($language_id, $this->languagesIDs) || $language_id <= 5;
+ }
+
+ /**
* Returns language count in system (always is divisible by 5)
*
*/
function getLanguageCount()
{
+ $id_field = $this->Application->getUnitOption('lang', 'IDField');
$table_name = $this->Application->getUnitOption('lang', 'TableName');
- $languages_count = $this->Conn->GetOne('SELECT COUNT(*) FROM '.$table_name);
- if (!$languages_count) {
- // during installation we have not languages, but we need to created custom field columns
- $languages_count = 1;
- }
- return $languages_count + 5 - ( $languages_count % 5 ? ($languages_count % 5) : 5 );
+
+ $this->languagesIDs = $this->Conn->GetCol('SELECT '.$id_field.' FROM '.$table_name);
+
+ $languages_count = $this->Conn->GetOne('SELECT MAX('.$id_field.') FROM '.$table_name);
+
+ return max($languages_count, 5);
}
@@ -112,10 +136,9 @@
unset($this->curFields[$field_name]);
continue;
}
-
- $created_count = $this->getCreatedCount($field_name);
- $create_count = $this->languageCount - $created_count;
- if ($create_count > 0) {
+
+ $this->setSourceField($field_name);
+ if ($this->languageCount > 0) {
// `l77_Name` VARCHAR( 255 ) NULL DEFAULT '0';
$field_mask = Array();
$field_mask['name'] = 'l%s_'.$field_name;
@@ -130,16 +153,19 @@
$field_mask['type'] = $field_options['db_type'];
}
$field_mask['default'] = 'DEFAULT '.$default_value;
-
+
if (strtoupper($field_mask['type']) == 'TEXT') {
// text fields in mysql doesn't have default value
$field_mask = $field_mask['name'].' '.$field_mask['type'].' '.$field_mask['null'];
}
else {
$field_mask = $field_mask['name'].' '.$field_mask['type'].' '.$field_mask['null'].' '.$field_mask['default'];
}
-
- $sqls[] = 'ALTER TABLE '.$table_name.( $this->generateAlterSQL($field_mask, $created_count + 1, $create_count) );
+
+ $alter_sqls = $this->generateAlterSQL($field_mask, 1, $this->languageCount);
+ if ($alter_sqls) {
+ $sqls[] = 'ALTER TABLE '.$table_name.' '.$alter_sqls;
+ }
}
}
}
@@ -175,7 +201,12 @@
return $this->curStructure[$this->curSourceField][$param_name];
}
- function getCreatedCount($field_name)
+ /**
+ * Detects field name to create other fields from
+ *
+ * @param string $field_name
+ */
+ function setSourceField($field_name)
{
$ret = $this->scanTable('/^l[\d]+_'.preg_quote($field_name, '/').'$/');
if (!$ret) {
@@ -186,8 +217,8 @@
else {
$this->curSourceField = 'l1_'.$field_name;
}
- return $ret;
}
+
/**
* Returns ALTER statement part for adding required fields to table
*
@@ -209,12 +240,22 @@
$single_lang = $this->Conn->GetOne($sql) == 1;
}
- $ret = ' ';
- $ml_field = preg_replace('/l(.*)_(.*?) (.*)/', '\\2', $field_mask);
-
+ $ret = '';
+ $ml_field = preg_replace('/l(.*?)_(.*?) (.*)/', '\\2', $field_mask);
+
$i_count = $start_index + $create_count;
while ($start_index < $i_count) {
- list($prev_field,$type) = explode(' ', sprintf($field_mask, $start_index - 1) );
+
+ if (isset($this->curStructure['l'.$start_index.'_'.$ml_field]) || (!$this->LanguageFound($start_index)) ) {
+ $start_index++;
+ continue;
+ }
+
+ $prev_index = $start_index - 1;
+ do {
+ list($prev_field,$type) = explode(' ', sprintf($field_mask, $prev_index) );
+ } while ($prev_index > 0 && !$this->LanguageFound($prev_index--));
+
if (substr($prev_field, 0, 3) == 'l0_') {
$prev_field = substr($prev_field, 3, strlen($prev_field));
if (!$this->curSourceField) {
@@ -234,16 +275,16 @@
if ($this->curIndexCount < 32 && ($start_index == $this->Application->GetDefaultLanguageId() || !$single_lang)) {
// create index for primary language column + for all others (if multiple languages installed)
list($field_name, $field_params) = explode(' ', $field_expression, 2);
-
+
$index_type = isset($this->curFields[$ml_field]['index_type']) ? $this->curFields[$prev_field]['index_type'] : 'string';
-
+
$ret .= $index_type == 'string' ? 'ADD INDEX (`'.$field_name.'` (5) ), ' : 'ADD INDEX (`'.$field_name.'`), ';
$this->curIndexCount++;
}
$start_index++;
}
- return preg_replace('/, $/',';',$ret);
+ return preg_replace('/, $/', ';', $ret);
}
}
Index: branches/RC/core/admin_templates/categories/categories_edit_related_searches.tpl
===================================================================
diff -u -r9329 -r9334
--- branches/RC/core/admin_templates/categories/categories_edit_related_searches.tpl (.../categories_edit_related_searches.tpl) (revision 9329)
+++ branches/RC/core/admin_templates/categories/categories_edit_related_searches.tpl (.../categories_edit_related_searches.tpl) (revision 9334)
@@ -38,7 +38,7 @@
a_toolbar.AddButton( new ToolBarSeparator('sep2') );
//Relations related:
- a_toolbar.AddButton( new ToolBarButton('new_related_search', '',
+ a_toolbar.AddButton( new ToolBarButton('in-portal:new_related_search', '',
function() {
std_new_item('c-search', 'in-portal/categories/related_searches_edit')
} ) );
Index: branches/RC/core/admin_templates/incs/form_blocks.tpl
===================================================================
diff -u -r9305 -r9334
--- branches/RC/core/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 9305)
+++ branches/RC/core/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 9334)
@@ -179,25 +179,21 @@
-
-
+
+ " alt=""/>
+
+
+
+ " id="" tabindex="" size="" class="">
" id="" tabindex="" size="" class="">
@@ -213,8 +209,78 @@
-
+
">
+
+
+ _progress">
+ _percent">0%
+
+
+
+
+ Uploading: | | _progress_filename">
+
+
+ Progress: | | _progress_progress">
+
+
+ Time elapsed: | | _progress_elapsed">
+
+
+ Time remaining: | | _progress_remaining">
+
+
+ ')">Cancel |
+
+
+
+
+
+ ')" value="Browse"/>
+ ')" value="Upload"/>
+
+
+ _queueinfo">
+ _holder">
+
+ [upload]" id="[upload]" value="">
+ [tmp_ids]" id="[tmp_ids]" value="">
+ [tmp_names]" id="[tmp_names]" value="">
+ [tmp_deleted]" id="[tmp_deleted]" value="">
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ ">
error">
*:
Index: branches/RC/kernel/admin_templates/img/toolbar/tool_new_related_search.gif
===================================================================
diff -u
Binary files differ
Index: branches/RC/core/admin_templates/incs/style.css
===================================================================
diff -u -r8966 -r9334
--- branches/RC/core/admin_templates/incs/style.css (.../style.css) (revision 8966)
+++ branches/RC/core/admin_templates/incs/style.css (.../style.css) (revision 9334)
@@ -668,3 +668,45 @@
padding: 4px;
margin: 0px;
}
+
+/* Uploader */
+
+.uploader-main {
+ position: absolute;
+ display: none;
+ z-index: 10;
+ border: 1px solid #777;
+ padding: 10px;
+ width: 350px;
+ height: 120px;
+ overflow: hidden;
+ background-color: #fff;
+}
+
+.uploader-percent {
+ width: 100%;
+ padding-top: 3px;
+ text-align: center;
+ position: relative;
+ z-index: 20;
+ float: left;
+ font-weight: bold;
+}
+
+.uploader-left {
+ width: 100%;
+ border: 1px solid black;
+ height: 20px;
+ background: #fff url(../img/progress_left.gif);
+}
+
+.uploader-done {
+ width: 0%;
+ background-color: green;
+ height: 20px;
+ background: #4A92CE url(../img/progress_done.gif);
+}
+
+.uploader-text {
+ font-size: 11px;
+}
\ No newline at end of file
Index: branches/RC/themes/default2007/platform/elements/side_boxes/related_searches.tpl
===================================================================
diff -u -r9330 -r9334
--- branches/RC/themes/default2007/platform/elements/side_boxes/related_searches.tpl (.../related_searches.tpl) (revision 9330)
+++ branches/RC/themes/default2007/platform/elements/side_boxes/related_searches.tpl (.../related_searches.tpl) (revision 9334)
@@ -3,11 +3,13 @@
-
-">
- |
+
+
+ ">
+ |
+
\ No newline at end of file
Index: branches/RC/core/kernel/utility/formatters/options_formatter.php
===================================================================
diff -u -r8929 -r9334
--- branches/RC/core/kernel/utility/formatters/options_formatter.php (.../options_formatter.php) (revision 8929)
+++ branches/RC/core/kernel/utility/formatters/options_formatter.php (.../options_formatter.php) (revision 9334)
@@ -10,6 +10,7 @@
$label = getArrayValue($options['options'], $value);
if ($label !== false) {
+ // option_id found in options array
if (getArrayValue($options, 'use_phrases')) {
return $this->Application->Phrase($label);
}
@@ -18,7 +19,8 @@
}
}
else {
- return $value;
+ // option_id not found
+ return $value == 0 ? '' : $value;
}
}
Index: branches/RC/core/admin_templates/img/toolbar/tool_new_related_search.gif
===================================================================
diff -u -r9329 -r9334
Binary files differ
Index: branches/RC/core/admin_templates/img/toolbar/tool_new_related_search_f2.gif
===================================================================
diff -u -r9329 -r9334
Binary files differ
Index: branches/RC/kernel/admin_templates/img/toolbar/tool_new_related_search_f2.gif
===================================================================
diff -u
Binary files differ
Index: branches/RC/kernel/units/related_searches/related_searches_tag_processor.php
===================================================================
diff -u -r9329 -r9334
--- branches/RC/kernel/units/related_searches/related_searches_tag_processor.php (.../related_searches_tag_processor.php) (revision 9329)
+++ branches/RC/kernel/units/related_searches/related_searches_tag_processor.php (.../related_searches_tag_processor.php) (revision 9334)
@@ -2,7 +2,6 @@
class RelatedSearchTagProcessor extends kDBTagProcessor {
-
/**
* Returns url for search on the Fornt End
*
@@ -14,8 +13,7 @@
$object =& $this->getObject($params);
$keyword = $object->GetDBField('Keyword');
- return $this->Application->HREF($params['search_template'],'', Array(
- 'keywords' => $keyword,));
+ return $this->Application->HREF($params['search_template'],'', Array('keywords' => $keyword));
}
}
| |