CBPHelper::CBPVirtualDocumentCloneRow

  1. Bitrix24 API (v. 23.675.0)
  2. bizproc
  3. CBPHelper
  4. CBPVirtualDocumentCloneRow
  • Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/classes/general/helper.php
  • Класс: CBPHelper
  • Вызов: CBPHelper::CBPVirtualDocumentCloneRow
function CBPVirtualDocumentCloneRow(tableID)
			{
				var tbl = document.getElementById(tableID);
				var cnt = tbl.rows.length;
				var oRow = tbl.insertRow(cnt);
				var oCell = oRow.insertCell(0);
				var sHTML = tbl.rows[cnt - 1].cells[0].innerHTML;
				var p = 0;
				while (true)
				{
					var s = sHTML.indexOf('[n', p);
					if (s < 0)
						break;
					var e = sHTML.indexOf(']', s);
					if (e < 0)
						break;
					var n = parseInt(sHTML.substr(s + 2, e - s));
					sHTML = sHTML.substr(0, s) + '[n' + (++n) + ']' + sHTML.substr(e + 1);
					p = s + 1;
				}
				var p = 0;
				while (true)
				{
					var s = sHTML.indexOf('__n', p);
					if (s < 0)
						break;
					var e = sHTML.indexOf('_', s + 2);
					if (e < 0)
						break;
					var n = parseInt(sHTML.substr(s + 3, e - s));
					sHTML = sHTML.substr(0, s) + '__n' + (++n) + '_' + sHTML.substr(e + 1);
					p = e + 1;
				}
				oCell.innerHTML = sHTML;
				var patt = new RegExp('<' + 'script' + '>[^00]*?<' + '/' + 'script' + '>', 'ig');
				var code = sHTML.match(patt);
				if (code)
				{
					for (var i = 0; i < code.length; i++)
					{
						if (code[i] != '')
						{
							var s = code[i].substring(8, code[i].length - 9);
							jsUtils.EvalGlobal(s);
						}
					}
				}
			}

Добавить комментарий