示例#1
0
文件: projects.php 项目: Jobava/narro
 protected function Form_Create()
 {
     parent::Form_Create();
     $this->pnlTab = new QTabs($this);
     /**
      * Create the project list panel and set the filter from the url.
      * The filter is used to show only projects of a given status based on their progress
      * (finished, empty, in progress).
      */
     $this->pnlProjectList = new NarroProjectListPanel($this->pnlTab);
     $this->pnlTop = new NarroTopPanel(date(sprintf('Y-m-%d 00:00:00', date('d') - date('N') + 1)), $this);
     $pnlDummy = new QPanel($this->pnlTab);
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders = array(t('Projects'), NarroLink::Translate(0, '', NarroTranslatePanel::SHOW_NOT_TRANSLATED, '', 0, 0, 10, 0, 0, t('Translate')), NarroLink::Review(0, '', NarroTranslatePanel::SHOW_NOT_APPROVED, '', 0, 0, 10, 0, 0, t('Review')));
     /**
      * Do not show the langauge tab if only two languages are active (source and target
      * Unless the user is an administrator and might want to set another one active
      */
     if (NarroLanguage::CountAllActive() > 2 || QApplication::HasPermission('Administrator')) {
         $pnlDummy = new QPanel($this->pnlTab);
         $arrHeaders[] = NarroLink::LanguageList(t('Languages'));
     }
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::UserList('', t('Users'));
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::RoleList(0, '', t('Roles'));
     if (QApplication::HasPermissionForThisLang('Administrator')) {
         $pnlDummy = new QPanel($this->pnlTab);
         $arrHeaders[] = NarroLink::Log('', t('Application Log'));
     }
     $this->pnlTab->Headers = $arrHeaders;
 }
示例#2
0
 protected function Form_Create()
 {
     parent::Form_Create();
     $this->pnlTab = new QTabs($this);
     $pnlDummy = new QPanel($this->pnlTab);
     $pnlDummy = new QPanel($this->pnlTab);
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders = array(NarroLink::ProjectList(t('Projects')), NarroLink::Translate(0, '', NarroTranslatePanel::SHOW_ALL, '', 0, 0, 10, 0, 0, t('Translate')), NarroLink::Translate(0, '', NarroTranslatePanel::SHOW_NOT_APPROVED, '', 0, 0, 10, 0, 0, t('Review')));
     /**
      * Do not show the langauge tab if only two languages are active (source and target
      * Unless the user is an administrator and might want to set another one active
      */
     if (NarroLanguage::CountAllActive() > 2 || QApplication::HasPermission('Administrator')) {
         $this->pnlLanguageTab = new QTabs($this->pnlTab);
         $pnlDummy = new QPanel($this->pnlLanguageTab);
         $arrLangHeaders[] = t('List');
         if (QApplication::HasPermissionForThisLang('Can add language')) {
             $this->pnlLanguageEdit = new NarroLanguageEditPanel($this->pnlLanguageTab, NarroLanguage::Load(QApplication::QueryString('lid')));
             $arrLangHeaders[] = QApplication::QueryString('lid') ? t('Edit') : t('Add');
         }
         $this->pnlLanguageTab->Headers = $arrLangHeaders;
         $this->pnlLanguageTab->Selected = 1;
         $arrHeaders[] = t('Languages');
         $this->pnlTab->Selected = count($arrHeaders) - 1;
     }
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::UserList('', t('Users'));
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::RoleList(0, '', t('Roles'));
     if (QApplication::HasPermissionForThisLang('Administrator')) {
         $pnlDummy = new QPanel($this->pnlTab);
         $arrHeaders[] = NarroLink::Log('', t('Application Log'));
     }
     $this->pnlTab->Headers = $arrHeaders;
 }
示例#3
0
文件: users.php 项目: Jobava/narro
 protected function Form_Create()
 {
     parent::Form_Create();
     $this->pnlTab = new QTabs($this);
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::ProjectList(t('Projects'));
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::Translate(0, '', NarroTranslatePanel::SHOW_NOT_TRANSLATED, '', 0, 0, 10, 0, 0, t('Translate'));
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::Review(0, '', NarroTranslatePanel::SHOW_NOT_APPROVED, '', 0, 0, 10, 0, 0, t('Translate'));
     if (NarroLanguage::CountAllActive() > 2 || QApplication::HasPermission('Administrator')) {
         $pnlDummy = new QPanel($this->pnlTab);
         $arrHeaders[] = NarroLink::LanguageList(t('Languages'));
     }
     $this->pnlUserList = new NarroUserListPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::UserList('', t('Users'));
     $this->pnlTab->Selected = count($arrHeaders) - 1;
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::RoleList(0, '', t('Roles'));
     if (QApplication::HasPermissionForThisLang('Administrator')) {
         $pnlDummy = new QPanel($this->pnlTab);
         $arrHeaders[] = NarroLink::Log('', t('Application Log'));
     }
     $this->pnlTab->Headers = $arrHeaders;
 }
示例#4
0
文件: review.php 项目: Jobava/narro
 protected function Form_Create()
 {
     parent::Form_Create();
     if (QApplication::QueryString('p') == 0) {
         $this->pnlMainTab = new QTabs($this);
         $pnlDummy = new QPanel($this->pnlMainTab);
         $arrHeaders[] = NarroLink::ProjectList(t('Projects'));
         $pnlDummy = new QPanel($this->pnlMainTab);
         $arrHeaders[] = NarroLink::Translate(0, '', NarroTranslatePanel::SHOW_NOT_APPROVED, '', 0, 0, 10, 0, 0, t('Translate'));
         $this->pnlReview = new NarroTranslatePanel($this->pnlMainTab);
         $arrHeaders[] = t('Review');
         $this->pnlMainTab->Selected = count($arrHeaders) - 1;
         if (NarroLanguage::CountAllActive() > 2 || QApplication::HasPermission('Administrator')) {
             $pnlDummy = new QPanel($this->pnlMainTab);
             $arrHeaders[] = NarroLink::LanguageList(t('Languages'));
         }
         $pnlDummy = new QPanel($this->pnlMainTab);
         $arrHeaders[] = NarroLink::UserList('', t('Users'));
         $pnlDummy = new QPanel($this->pnlMainTab);
         $arrHeaders[] = NarroLink::RoleList(0, '', t('Roles'));
         if (QApplication::HasPermissionForThisLang('Administrator')) {
             $pnlDummy = new QPanel($this->pnlMainTab);
             $arrHeaders[] = NarroLink::Log('', t('Application Log'));
         }
         $this->pnlMainTab->Headers = $arrHeaders;
     } else {
         $pnlDummy = new QPanel($this->pnlMainTab);
         $arrHeaders[] = NarroLink::Project($this->objProject->ProjectId, t('Overview'));
         if ($this->objProject instanceof NarroProject && QApplication::HasPermissionForThisLang('Can edit project', $this->objProject->ProjectId)) {
             $pnlDummy = new QPanel($this->pnlMainTab);
             $arrHeaders[] = NarroLink::ProjectEdit($this->objProject->ProjectId, t('Edit'));
         }
         $pnlDummy = new QPanel($this->pnlMainTab);
         $arrHeaders[] = NarroLink::Translate($this->objProject->ProjectId, '', NarroTranslatePanel::SHOW_NOT_TRANSLATED, '', 0, 0, 10, 0, 0, t('Translate'));
         $this->pnlReview = new NarroTranslatePanel($this->pnlMainTab);
         $arrHeaders[] = t('Review');
         $this->pnlMainTab->Selected = count($arrHeaders) - 1;
         $pnlDummy = new QPanel($this->pnlMainTab);
         $arrHeaders[] = NarroLink::ProjectFileList($this->objProject->ProjectId, '', '', t('Files'));
         $pnlDummy = new QPanel($this->pnlMainTab);
         $arrHeaders[] = NarroLink::ProjectLanguages($this->objProject->ProjectId, t('Languages'));
         if (QApplication::HasPermissionForThisLang('Can import project', $this->objProject->ProjectId)) {
             $pnlDummy = new QPanel($this->pnlMainTab);
             $arrHeaders[] = NarroLink::ProjectImport($this->objProject->ProjectId, t('Import'));
         }
         if (QApplication::HasPermissionForThisLang('Can export project', $this->objProject->ProjectId)) {
             $pnlDummy = new QPanel($this->pnlMainTab);
             $arrHeaders[] = NarroLink::ProjectExport($this->objProject->ProjectId, t('Export'));
         }
         $this->pnlMainTab->Headers = $arrHeaders;
     }
 }
示例#5
0
文件: role.php 项目: Jobava/narro
 protected function Form_Create()
 {
     parent::Form_Create();
     $this->pnlTab = new QTabPanel($this);
     $this->pnlTab->UseAjax = false;
     $this->pnlRoleTab = new QTabPanel($this->pnlTab);
     $this->pnlRoleEdit = new NarroRoleEditPanel($this->pnlRoleTab, NarroRole::Load(QApplication::QueryString('rid')));
     $this->pnlRoleTab->addTab(new QPanel($this->pnlRoleTab), t('List'), NarroLink::RoleList());
     $this->pnlRoleTab->addTab($this->pnlRoleEdit, QApplication::QueryString('lid') ? t('Edit') : t('Add'));
     $this->pnlTab->addTab(new QPanel($this->pnlTab), t('Projects'), NarroLink::ProjectList());
     $this->pnlTab->addTab(new QPanel($this->pnlTab), t('Translate'), NarroLink::Translate(0, '', NarroTranslatePanel::SHOW_ALL, '', 0, 0, 10, 0, 0));
     $this->pnlTab->addTab(new QPanel($this->pnlTab), t('Languages'), NarroLink::LanguageList());
     $this->pnlTab->addTab(new QPanel($this->pnlTab), t('Users'), NarroLink::UserList());
     $this->pnlTab->addTab($this->pnlRoleTab, t('Roles'));
     $this->pnlTab->SelectedTab = 4;
     $this->pnlRoleTab->SelectedTab = 1;
     $this->pnlTab = new QTabs($this);
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::ProjectList(t('Projects'));
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::Translate(0, '', NarroTranslatePanel::SHOW_NOT_TRANSLATED, '', 0, 0, 10, 0, 0, t('Translate'));
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::Review(0, '', NarroTranslatePanel::SHOW_NOT_APPROVED, '', 0, 0, 10, 0, 0, t('Translate'));
     if (NarroLanguage::CountAllActive() > 2 || QApplication::HasPermission('Administrator')) {
         $pnlDummy = new QPanel($this->pnlTab);
         $arrHeaders[] = NarroLink::LanguageList(t('Languages'));
     }
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::UserList('', t('Users'));
     $this->pnlRoleTab = new QTabs($this->pnlTab);
     new QPanel($this->pnlRoleTab);
     $arrRoleHeaders[] = NarroLink::RoleList(0, '', t('List'));
     if (QApplication::HasPermissionForThisLang('Can add role')) {
         $pnlDummy = new NarroRoleEditPanel($this->pnlRoleTab, NarroRole::Load(QApplication::QueryString('rid')));
         $arrRoleHeaders[] = NarroLink::RoleEdit(null, t('Add'));
         $this->pnlRoleTab->Selected = count($arrRoleHeaders) - 1;
     }
     $this->pnlRoleTab->Headers = $arrRoleHeaders;
     $arrHeaders[] = t('Roles');
     $this->pnlTab->Selected = count($arrHeaders) - 1;
     if (QApplication::HasPermissionForThisLang('Administrator')) {
         $pnlDummy = new QPanel($this->pnlTab);
         $arrHeaders[] = NarroLink::Log('', t('Application Log'));
     }
     $this->pnlTab->Headers = $arrHeaders;
 }
示例#6
0
文件: log.php 项目: Jobava/narro
 protected function Form_Create()
 {
     parent::Form_Create();
     if (!QApplication::HasPermissionForThisLang('Administrator')) {
         QApplication::Redirect(NarroLink::ProjectList());
     }
     $this->pnlTab = new QTabs($this);
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::ProjectList(t('Projects'));
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::Translate(0, '', NarroTranslatePanel::SHOW_NOT_TRANSLATED, '', 0, 0, 10, 0, 0, t('Translate'));
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::Review(0, '', NarroTranslatePanel::SHOW_NOT_APPROVED, '', 0, 0, 10, 0, 0, t('Review'));
     if (NarroLanguage::CountAllActive() > 2 || QApplication::HasPermission('Administrator')) {
         $pnlDummy = new QPanel($this->pnlTab);
         $arrHeaders[] = NarroLink::LanguageList(t('Languages'));
     }
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::UserList('', t('Users'));
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::RoleList(0, '', t('Roles'));
     if (QApplication::HasPermissionForThisLang('Administrator')) {
         $this->pnlLog = new QPanel($this->pnlTab);
         $this->pnlLog->AutoRenderChildren = true;
         $btnClearLog = new QButton($this->pnlLog);
         $btnClearLog->Text = t('Clear the log');
         $btnClearLog->AddAction(new QClickEvent(), new QConfirmAction(t('Are you sure you want to delete all the logged messages?')));
         $btnClearLog->AddAction(new QClickEvent(), new QAjaxAction('btnClearLog_Click'));
         $this->dtgLog = new NarroLogDataGrid($this->pnlLog);
         // Datagrid Paginator
         $this->dtgLog->Paginator = new QPaginator($this->dtgLog);
         $this->dtgLog->PaginatorAlternate = new QPaginator($this->dtgLog);
         $this->dtgLog->ItemsPerPage = QApplication::$User->GetPreferenceValueByName('Items per page');
         $this->dtgLog->SortColumnIndex = 0;
         $this->dtgLog->SortDirection = 1;
         $colDate = $this->dtgLog->MetaAddColumn(QQN::NarroLog()->Date);
         $colDate->OrderByClause = QQ::OrderBy(QQN::NarroLog()->LogId);
         $colDate->ReverseOrderByClause = QQ::OrderBy(QQN::NarroLog()->LogId, 0);
         if (QApplication::HasPermission('Administrator')) {
             $colLanguage = $this->dtgLog->MetaAddColumn(QQN::NarroLog()->Language->LanguageName);
             $colLanguage->Filter = null;
             $colLanguage->FilterAddListItem(t('-Not set-'), QQ::IsNull(QQN::NarroLog()->LanguageId));
             foreach (NarroLanguage::LoadAll(QQ::OrderBy(QQN::NarroLanguage()->LanguageName)) as $objLanguage) {
                 $colLanguage->FilterAddListItem($objLanguage->LanguageName, QQ::Equal(QQN::NarroLog()->LanguageId, $objLanguage->LanguageId));
             }
         } else {
             $this->dtgLog->AdditionalConditions = QQ::Equal(QQN::NarroLog()->LanguageId, QApplication::GetLanguageId());
         }
         $colProject = $this->dtgLog->MetaAddColumn(QQN::NarroLog()->Project->ProjectName);
         $colProject->Filter = null;
         $colProject->FilterAddListItem(t('-Not set-'), QQ::IsNull(QQN::NarroLog()->ProjectId));
         foreach (NarroProject::LoadAll(QQ::OrderBy(QQN::NarroProject()->ProjectName)) as $objProject) {
             $colProject->FilterAddListItem($objProject->ProjectName, QQ::Equal(QQN::NarroLog()->ProjectId, $objProject->ProjectId));
         }
         $colUser = $this->dtgLog->MetaAddColumn(QQN::NarroLog()->User->Username);
         $colUser->Html = '<?=(($_ITEM->UserId)?NarroLink::UserProfile($_ITEM->UserId, $_ITEM->User->Username):"")?>';
         $colUser->HtmlEntities = false;
         $colPriority = $this->dtgLog->MetaAddColumn(QQN::NarroLog()->Priority);
         $colPriority->Name = 'P';
         $colPriority->Width = 16;
         $colPriority->FilterBoxSize = 1;
         $colPriority->HtmlEntities = false;
         $colMessage = $this->dtgLog->MetaAddColumn(QQN::NarroLog()->Message);
         $colMessage->HtmlEntities = false;
         $colMessage->Html = '<?=$_FORM->dtgLog_colMessage_Render($_ITEM)?>';
         $arrHeaders[] = NarroLink::Log('', t('Application Log'));
         $this->pnlTab->Selected = count($arrHeaders) - 1;
     }
     $this->pnlTab->Headers = $arrHeaders;
 }
示例#7
0
 public function btnViewUsers_Click($strFormId, $strControlId, $strParameter)
 {
     QApplication::Redirect(NarroLink::RoleList($strParameter, 'user'));
 }
示例#8
0
 public function btnDelete_Click($strFormId, $strControlId, $strParameter)
 {
     if (QApplication::HasPermissionForThisLang('Can manage roles', null)) {
         $this->objNarroRole->Delete();
     }
     QApplication::Redirect(NarroLink::RoleList());
 }
示例#9
0
 public function dtgUserRole_RoleColumn_Render(NarroUserRole $objUserRole)
 {
     return NarroLink::RoleList($objUserRole->RoleId, 'user', $objUserRole->Role->RoleName);
 }