Пример #1
0
 public function GetControlHtml()
 {
     $strLogContents = '';
     foreach (NarroLog::QueryArray(QQ::AndCondition(QQ::Equal(QQN::NarroLog()->ProjectId, $this->intProjectId), QQ::Equal(QQN::NarroLog()->LanguageId, $this->intLanguageId), QQ::GreaterThan(QQN::NarroLog()->Date, $this->dttStart))) as $objLogEntry) {
         switch ($objLogEntry->Priority) {
             case NarroLog::PRIORITY_INFO:
                 $strLogContents .= '<div class="info"';
                 break;
             case NarroLog::PRIORITY_WARN:
                 $strLogContents .= '<div class="warning"';
                 break;
             case NarroLog::PRIORITY_ERROR:
                 $strLogContents .= '<div class="error"';
                 break;
             default:
                 $strLogContents .= '<div';
         }
         $strLogContents .= sprintf('title="%s">%s</div>', $objLogEntry->Date, nl2br(NarroString::HtmlEntities($objLogEntry->Message)));
     }
     $this->strText = sprintf('<div class="ui-accordion ui-widget ui-helper-reset ui-accordion-icons">
             <h3 class="ui-accordion-header ui-helper-reset ui-state-default ui-state-active ui-corner-top">
             <span class="ui-icon ui-icon-triangle-1-s"></span>
             <a>%s</a>
             </h3>
             <div class="ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content-active" style="max-height:300px;overflow:auto">
             %s
             </div>
             </div>', t('Operation log'), $strLogContents);
     return parent::GetControlHtml();
 }
Пример #2
0
 public function colMessage_Render(NarroLog $objLog)
 {
     switch ($objLog->Priority) {
         case NarroLog::PRIORITY_INFO:
             $strMessage = '<div class="info"';
             break;
         case NarroLog::PRIORITY_WARN:
             $strMessage = '<div class="warning"';
             break;
         case NarroLog::PRIORITY_ERROR:
             $strMessage = '<div class="error"';
             break;
         default:
             $strMessage = '<div';
     }
     return sprintf('%s title="%s">%s</div>', $strMessage, $objLog->Date, nl2br(NarroString::HtmlEntities($objLog->Message)));
 }
Пример #3
0
 public function lblContextInfo_Create()
 {
     if (!$this->lblContextInfo) {
         $this->lblContextInfo = new QLabel($this);
         $this->lblContextInfo->CssClass = 'instructions ctxinfo';
         $this->lblContextInfo->TagName = 'div';
         $this->lblContextInfo->DisplayStyle = QDisplayStyle::None;
         if (QApplication::QueryString('p')) {
             $this->lblContextInfo->Text = sprintf('%s<br /><span>%s</span>', $this->objContextInfo->Context->File->FilePath, NarroString::HtmlEntities($this->objContextInfo->Context->Context));
         } else {
             $this->lblContextInfo->Text = sprintf('<b>%s</b>%s<br /><span>%s</span>', $this->objContextInfo->Context->Project->ProjectName, $this->objContextInfo->Context->File->FilePath, NarroString::HtmlEntities($this->objContextInfo->Context->Context));
         }
         $this->lblContextInfo->HtmlEntities = false;
         if ($this->objContextInfo->Context->Comment) {
             $this->lblContextInfo->Text .= '<br />' . nl2br(str_replace(array('<!--', '-->'), array('', ''), NarroString::HtmlEntities($this->objContextInfo->Context->Comment)));
         }
     }
 }
 public function colText_Render(NarroTextComment $objComment)
 {
     return str_replace('?l=' . QApplication::$TargetLanguage->LanguageCode, '?l=' . $objComment->Language->LanguageCode, NarroLink::Translate(0, '', NarroTranslatePanel::SHOW_ALL, "'" . $objComment->Text->TextValue . "'", 0, 0, 10, 0, 0, NarroString::HtmlEntities($objComment->Text->TextValue)));
 }
 public function colText_Render(NarroContextInfo $objContextInfo)
 {
     return str_replace('?l=' . QApplication::$TargetLanguage->LanguageCode, '?l=' . $objContextInfo->Language->LanguageCode, NarroLink::Translate($objContextInfo->Context->ProjectId, '', NarroTranslatePanel::SHOW_ALL, "'" . $objContextInfo->ValidSuggestion->Text->TextValue . "'", 0, 0, 10, 0, 0, NarroString::HtmlEntities($objContextInfo->ValidSuggestion->Text->TextValue)));
 }
Пример #6
0
                                <br />', NarroString::HtmlEntities($objTextComment->Text->TextValue));
                            foreach ($arrProjects as $intProjectId => $strProjectName) {
                                $strProjectLink = __HTTP_URL__ . __VIRTUAL_DIRECTORY__ . __SUBDIRECTORY__ . '/' . NarroLink::ProjectTextList($intProjectId, NarroTranslatePanel::SHOW_ALL, $objTextComment->Text->TextValue);
                                $arrProjectLinks[] = sprintf(t('<a href="%s">%s</a>'), $strProjectLink, $strProjectName);
                            }
                            $strDescription .= join(', ', $arrProjectLinks) . '</small>';
                        }
                    } else {
                        continue;
                    }
                    $objItem = new QRssItem(strlen($objTextComment->CommentText) > 124 ? substr($objTextComment->CommentText, 0, 124) . '...' : $objTextComment->CommentText, $strContextLink);
                    $objItem->Description = $strDescription;
                    $objItem->PubDate = new QDateTime($objTextComment->Created);
                    $objItem->Author = $objTextComment->User->RealName;
                    /**
                     * Damn Google Reader doesn't care about PubDate, so we need this
                     */
                    $objItem->Guid = NarroString::HtmlEntities($strContextLink);
                    $objItem->GuidPermaLink = true;
                    $objRssFeed->AddItem($objItem);
                }
            }
            $objRssFeed->Language = strtolower(QApplication::$TargetLanguage->LanguageCode);
            $objRssFeed->Image = new QRssImage(__HTTP_URL__ . __VIRTUAL_DIRECTORY__ . __SUBDIRECTORY__ . '/assets/images/narro.png', t('Narro - Translate, we\'re open!'), __HTTP_URL__ . __VIRTUAL_DIRECTORY__ . __SUBDIRECTORY__ . '/index.php');
            QApplication::$Cache->save($objRssFeed, $strCacheId, array(), 3600);
        }
        $objRssFeed->Run();
        break;
    default:
        exit;
}