diff --git a/cal/Tasks.class.php b/cal/Tasks.class.php index 9ce982de0ad..2938b512795 100644 --- a/cal/Tasks.class.php +++ b/cal/Tasks.class.php @@ -3183,7 +3183,7 @@ public function act_New() $successMsg = 'Благодарим Ви за сигнала'; if ($isReportFromStream) { - echo tr($successMsg); + echo 'OK'; shutdown(); } diff --git a/cms/GalleryDialogWrapper.class.php b/cms/GalleryDialogWrapper.class.php index 1f869707e79..98d46af2d07 100644 --- a/cms/GalleryDialogWrapper.class.php +++ b/cms/GalleryDialogWrapper.class.php @@ -86,8 +86,8 @@ public function on_AfterRenderDialog($mvc, &$res, $tpl) /** * * - * @param unknown_type $mvc - * @param unknown_type $tabs + * @param core_Mvc $mvc + * @param array $tabs */ public function on_AfterGetGalleryTabsArr($mvc, &$tabs) { diff --git a/core/Debug.class.php b/core/Debug.class.php index 03aad3d6d53..e7a14f18446 100644 --- a/core/Debug.class.php +++ b/core/Debug.class.php @@ -667,7 +667,7 @@ public static function getDebugPage($state) $data['errTitle'] .= '|'; } - $data['errTitle'] .= ht::createLink(tr('сигнал'), array('log_Debug', 'report', 'debugFile' => $bName), false, array('title' => 'Изпращане на сигнал към разработчиците на bgERP')); + $data['errTitle'] .= log_Debug::getReportLink($bName, 'сигнал', false); } $data['errTitle'] .= ''; @@ -705,7 +705,7 @@ private static function getErrorPage(&$state) if (log_Debug::haveRightFor('report') && $state['_debugFileName']) { $bName = basename($state['_debugFileName'], '.debug'); - $state['signal'] = ht::createLink(tr('Сигнал'), array('log_Debug', 'report', 'debugFile' => $bName), false, array('title' => 'Изпращане на сигнал към разработчиците на bgERP', 'ef_icon' => 'img/16/headset.png', 'class' => 'signalLink')); + $state['signal'] = log_Debug::getReportLink($bName, 'Сигнал', 'img/16/headset.png', 'signalLink'); } $page = $tpl->render($state); diff --git a/core/tpl/Debug.shtml b/core/tpl/Debug.shtml index 3a0fdfc847e..dcd17f1208b 100644 --- a/core/tpl/Debug.shtml +++ b/core/tpl/Debug.shtml @@ -193,6 +193,29 @@ div.simpleTabsContent.currentTab { * @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html */ eval(function(p,a,c,k,e,r){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('3 4={O:"Z",P:"10",9:"11",w:"12",x:"13",r:"14",Q:o(){5(!s.t)y E;5(!s.F)y E;3 b=s.t("G");u(3 i=0;i -1; + if (isChrome && popup.parent) { + popup.parent.blur(); + } + + // Фокусиране върху новия прозорец + popup.focus(); + } + } diff --git a/core/tpl/Error.shtml b/core/tpl/Error.shtml index d2b6a070fad..8fa017a93dc 100644 --- a/core/tpl/Error.shtml +++ b/core/tpl/Error.shtml @@ -107,6 +107,31 @@ + + \ No newline at end of file diff --git a/doc/DialogWrapper.class.php b/doc/DialogWrapper.class.php index ffbe9d26d00..d328a2b885d 100644 --- a/doc/DialogWrapper.class.php +++ b/doc/DialogWrapper.class.php @@ -82,8 +82,8 @@ public function on_AfterRenderDialog($mvc, &$res, $tpl) /** * * - * @param unknown_type $mvc - * @param unknown_type $tabs + * @param core_Mvc $mvc + * @param array $tabs */ public function on_AfterGetGalleryTabsArr($mvc, &$tabs) { diff --git a/doc/Log.class.php b/doc/Log.class.php index 3304c6d6c13..0649dab081d 100644 --- a/doc/Log.class.php +++ b/doc/Log.class.php @@ -214,7 +214,7 @@ public function prepareAddDocDialog(&$data) /** * Задаваме броя на всички елементи * - * @param oject $data + * @param object $data */ public function setLimitAddDocDialogPager(&$data) { diff --git a/log/Debug.class.php b/log/Debug.class.php index ef7f1df94b2..3dff42b8133 100644 --- a/log/Debug.class.php +++ b/log/Debug.class.php @@ -53,6 +53,50 @@ class log_Debug extends core_Manager public $loadList = 'plg_SystemWrapper'; + /** + * Връща линк към създаване на сигнал от грешката + * + * @param string $debugFile + * @param string $btnName + * @param string $icon + * @param NULL|string $class + * + * @return core_ET + */ + public static function getReportLink($debugFile, $btnName = 'Сигнал', $icon = 'img/16/debug_bug.png', $class = null) + { + $btnName = tr($btnName); + + $urlArr = array('log_Debug', 'report', 'debugFile' => $debugFile, 'ret_url' => true); + + $url = toUrl($urlArr); + + // Ако е мобилен/тесем режим + if (Mode::is('screenMode', 'narrow')) { + // Парамтери към отварянето на прозореца + $args = 'resizable=yes,scrollbars=yes,status=no,location=no,menubar=no,location=no'; + } else { + $args = 'width=450,height=600,resizable=yes,scrollbars=yes,status=no,location=no,menubar=no,location=no'; + } + + $attr = array('onClick' => "openWindow('{$url}', 'bgerp_tracer_report', '{$args}'); return false;", 'title' => 'Изпращане на сигнал към разработчиците на bgERP'); + + if ($icon) { + $attr['ef_icon'] = $icon; + } + + if ($class) { + $attr['class'] = $class; + } + + $attr['target'] = '_blank'; + + $link = ht::createLink($btnName, $urlArr, false, $attr); + + return $link; + } + + /** * Показва дебъг лога */ @@ -202,6 +246,8 @@ public function act_Default() $tpl->append('bgERP tracer', 'PAGE_TITLE'); + $this->logInAct('Листване', null, 'read'); + // Показва съдъражаниете на дебъга, ако е избран файла if ($debugFile) { $fPath = $this->getDebugFilePath($debugFile); @@ -225,7 +271,8 @@ public function act_Default() } if ($this->haveRightFor('report')) { - $singal = ht::createLink(tr('Сигнал'), array('log_Debug', 'report', 'debugFile' => $debugFile, 'ret_url' => true), false, array('title' => 'Изпращане на сигнал към разработчиците на bgERP', 'ef_icon' => 'img/16/debug_bug.png')); + $singal = $this->getReportLink($debugFile); + $tpl->append($singal, 'SIGNAL'); } @@ -271,7 +318,7 @@ public function act_Report() $retUrl = array('Portal', 'Show'); } - $form->toolbar->addBtn('Отказ', $retUrl, 'id=cancel, ef_icon = img/16/close-red.png,title=Отказ'); + $form->toolbar->addBtn('Отказ', $retUrl, 'id=cancel, ef_icon = img/16/close-red.png,title=Отказ, onclick=self.close();'); $email = email_Inboxes::getUserEmail(); if (!$email) { @@ -289,6 +336,8 @@ public function act_Report() $form->input(); + Mode::set('wrapper', 'page_Dialog'); + if ($form->isSubmitted()) { $dataArr = array(); @@ -322,15 +371,26 @@ public function act_Report() $url = help_Setup::get('BGERP_SUPPORT_URL', true); $resStr = @file_get_contents($url, false, $context); - $msg = null; - if ($resStr && is_string($resStr)) { - $msg = str::limitLen($resStr, 500); + + if ($resStr == 'OK') { + $tpl = new ET(); + jquery_Jquery::run($tpl, 'self.close();'); + } else { + $form->setError('description', 'Възникна грешка при изпращане на сигнала.'); + $tpl = $form->renderHtml(); } - return new Redirect($retUrl, $msg); + $this->logInAct('Изпращане на сигнал'); + } else { + $tpl = $form->renderHtml(); } - return $this->renderWrapping($form->renderHtml()); + // Добавяме клас към бодито + $tpl->append('dialog-window', 'BODY_CLASS_NAME'); + + $tpl->append(""); + + return $tpl; } @@ -525,14 +585,18 @@ protected static function getDebugFilesArr(&$fName = null, $before = null, $afte try { $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::LEAVES_ONLY); + + $iterator->setFlags(FilesystemIterator::NEW_CURRENT_AND_KEY | FilesystemIterator::SKIP_DOTS); } catch (ErrorException $e) { self::logNotice('Не може да се обходи директорията', $dir); + return $fArr; + } catch (Throwable $e) { + self::logNotice('Не може да се обходи директорията', $dir); + return $fArr; } - $iterator->setFlags(FilesystemIterator::NEW_CURRENT_AND_KEY | FilesystemIterator::SKIP_DOTS); - // Намираме шаблонното име от файла $fNameTemplate = null; if (isset($fName)) { @@ -554,40 +618,46 @@ protected static function getDebugFilesArr(&$fName = null, $before = null, $afte // Намираме всички файлове и им вземаме времето на създаване while ($iterator->valid()) { - $mTime = null; - $fileName = $iterator->key(); - $path = $iterator->current()->getPath(); - @$currentDepth = $iterator->getDepth(); - - if (($currentDepth < 1) && !$iterator->isDir()) { - $canShow = true; - - $search = trim($search); + try { + $mTime = null; + $fileName = $iterator->key(); + $path = $iterator->current()->getPath(); + @$currentDepth = $iterator->getDepth(); - if ($search) { - if (strpos($fileName, $search) === false) { - $canShow = false; + if (($currentDepth < 1) && !$iterator->isDir()) { + $canShow = true; + + $search = trim($search); + + if ($search) { + if (strpos($fileName, $search) === false) { + $canShow = false; + } } - } - - // Ако се търси определен файл и отговаря на изискванията - го показваме - if ($canShow) { - $mTime = $iterator->current()->getMTime(); - $fArr[$fileName] = $mTime . '|' . $fileName; - } - - if ($fName) { - if (strpos($fileName, $fNameTemplate)) { - if ($fileName != $fName) { - if (!isset($mTime)) { - $mTime = $iterator->current()->getMTime(); + + // Ако се търси определен файл и отговаря на изискванията - го показваме + if ($canShow) { + $mTime = $iterator->current()->getMTime(); + $fArr[$fileName] = $mTime . '|' . $fileName; + } + + if ($fName) { + if (strpos($fileName, $fNameTemplate)) { + if ($fileName != $fName) { + if (!isset($mTime)) { + $mTime = $iterator->current()->getMTime(); + } + + // Ако има друг файл от същия хит + $otherFilesFromSameHitArr[$fileName] = $mTime . '|' . $fileName; } - - // Ако има друг файл от същия хит - $otherFilesFromSameHitArr[$fileName] = $mTime . '|' . $fileName; } } } + } catch (Exception $e) { + // Не правим нищо + } catch (Throwable $e) { + // Не правим нищо } $iterator->next(); @@ -733,6 +803,8 @@ public static function cron_clearOldDebugFiles() $cnt = 0; + $allCnt = count($fArr); + foreach ($fArr as $fName => $cDate) { list($v) = explode('_', $fName, 2); @@ -762,7 +834,7 @@ public static function cron_clearOldDebugFiles() } if ($cnt) { - $me->logNotice('Изтрити дебъг файлове: ' . $cnt); + $me->logNotice("Изтрити дебъг файлове {$cnt} от {$allCnt}"); } }