* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with this program; if not, write to the * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ require_once dirname(__FILE__) . '/../configuration/prepend.inc.php'; if (!isset($argv)) { exit; } QFirebug::setEnabled(false); if (array_search('--help', $argv) !== false) { echo sprintf("php %s [options]\n" . "--project project id instead of exporting all projects\n" . "--language language code instead of importing all languages\n" . "--disable-plugins disable plugins during import/export\n" . " suggestions, optional, defaults to anonymous\n" . "--exported-suggestion 1 for approved,\n" . " 2 - approved, then most voted,\n" . " 3 - approved, then most recent,\n" . " 4 - approved, most voted, most recent,\n" . " 5 - approved, my suggestion\n" . "--skip-untranslated skip lines that don't have translated texts\n", basename(__FILE__), NarroLanguage::SOURCE_LANGUAGE_CODE); exit; } foreach (NarroProject::LoadArrayByActive(1) as $objProject) { if (in_array('--project', $argv) && $objProject->ProjectId != $argv[array_search('--project', $argv) + 1]) { continue; } foreach (NarroLanguage::LoadAllActive() as $objLanguage) { if (in_array('--language', $argv) && $objLanguage->LanguageCode != $argv[array_search('--language', $argv) + 1]) { continue; } QApplication::$TargetLanguage = $objLanguage; $objProjectProgress = NarroProjectProgress::LoadByProjectIdLanguageId($objProject->ProjectId, $objLanguage->LanguageId); if (!$objProjectProgress || $objProjectProgress->Active) { try { $objNarroImporter = new NarroProjectImporter(); $objNarroImporter->SkipUntranslated = (bool) array_search('--skip-untranslated', $argv); NarroPluginHandler::$blnEnablePlugins = !(bool) array_search('--disable-plugins', $argv); if (array_search('--exported-suggestion', $argv)) {
public function lstProject_Create() { $this->lstProject = new QListBox($this); $this->lstProject->AddItem(t('all projects')); foreach (NarroProject::LoadArrayByActive(1, array(QQ::OrderBy(QQN::NarroProject()->ProjectName))) as $objProject) { $this->lstProject->AddItem($objProject->ProjectName, $objProject->ProjectId); } $this->lstProject->AddAction(new QChangeEvent(), new QAjaxControlAction($this, 'btnSearch_Click', $this->objWaitIcon)); if (QApplication::QueryString('p') > 0) { $this->lstProject->SelectedValue = QApplication::QueryString('p'); } }
protected function dtgReviews_Create() { $dtgReviews = new NarroContextInfoDataGrid($this->tabActivity); $dtgReviews->SetCustomStyle('padding', '5px'); $dtgReviews->Title = sprintf(t('Translations approved by <b>%s</b>'), $this->objUser->RealName); $colText = $dtgReviews->MetaAddColumn(QQN::NarroContextInfo()->ValidSuggestion->Text->TextValue); $colText->Name = t('Original text'); $colText->Html = '<?= $_CONTROL->colText_Render($_ITEM); ?>'; $colText->HtmlEntities = false; $colSuggestion = $dtgReviews->MetaAddColumn(QQN::NarroContextInfo()->ValidSuggestion->SuggestionValue); $colSuggestion->Name = t('Approved translation'); $colSuggestion->Html = '<?= $_CONTROL->colSuggestion_Render($_ITEM); ?>'; $colProject = $dtgReviews->MetaAddColumn(QQN::NarroContextInfo()->Context->Project->ProjectName); $colProject->Name = t('Project'); $colProject->Filter = null; foreach (NarroProject::LoadArrayByActive(1) as $objProject) { $colProject->FilterAddListItem($objProject->ProjectName, QQ::Equal(QQN::NarroContextInfo()->Context->ProjectId, $objProject->ProjectId)); } $colProject->Html = '<?= $_CONTROL->colProject_Render($_ITEM); ?>'; $colProject->HtmlEntities = false; $colLanguage = $dtgReviews->MetaAddColumn(QQN::NarroContextInfo()->Language->LanguageName); $colLanguage->Name = t('Language'); $colLanguage->Filter = null; foreach (NarroLanguage::LoadAllActive() as $objLanguage) { $colLanguage->FilterAddListItem($objLanguage->LanguageName, QQ::Equal(QQN::NarroContextInfo()->LanguageId, $objLanguage->LanguageId)); } $colLanguage->FilterActivate(QApplication::$TargetLanguage->LanguageName); $colLanguage->Html = '<?= $_CONTROL->colLanguage_Render($_ITEM); ?>'; $colModified = $dtgReviews->MetaAddColumn(QQN::NarroContextInfo()->Modified); $colModified->Name = t('Approved'); $colModified->FilterType = QFilterType::None; $colModified->Html = '<?= $_CONTROL->colModified_Render($_ITEM); ?>'; $colModified->HtmlEntities = false; $colModified->Wrap = false; // Datagrid Paginator $dtgReviews->Paginator = new QPaginator($dtgReviews); $dtgReviews->ItemsPerPage = QApplication::$User->GetPreferenceValueByName('Items per page'); // Specify Whether or Not to Refresh using Ajax $dtgReviews->UseAjax = true; $dtgReviews->SortColumnIndex = 4; $dtgReviews->SortDirection = true; $dtgReviews->AdditionalClauses = array(QQ::Expand(QQN::NarroContextInfo()->ValidSuggestion), QQ::Expand(QQN::NarroContextInfo()->Language)); $dtgReviews->AdditionalConditions = QQ::AndCondition(QQ::IsNotNull(QQN::NarroContextInfo()->ValidSuggestionId), QQ::Equal(QQN::NarroContextInfo()->ValidatorUserId, $this->objUser->UserId)); $dtgReviews->btnFilter_Click($this->Form->FormId, $dtgReviews->FilterButton->ControlId, ''); }
require_once dirname(__FILE__) . '/../configuration/prepend.inc.php'; if (!isset($argv)) { exit; } QFirebug::setEnabled(false); if (array_search('--help', $argv) !== false) { echo sprintf("php %s [options]\n" . "--user user id that will be used for the added translations\n" . "--project project id instead of importing all projects\n" . "--language language code instead of importing all languages\n" . "--disable-plugins disable plugins during import/export\n" . "--do-not-clear-logs doesn't clear the logs before starting\n" . " suggestions, optional, defaults to anonymous\n" . "--do-not-check-equal don't check if the translation is equal to the original\n" . " text and don't import it\n" . "--skip-untranslated skip likes that don't have translated texts\n" . "--approve approve the imported suggestions\n" . "--approve-already-approved overwrite translations approved in Narro\n" . "--import-unchanged-files import files marked unchanged after the last import\n" . "--only-suggestions import only suggestions, don't add files, texts\n" . " or contexts\n" . "--no-suggestions do not import suggestions\n", basename(__FILE__), NarroLanguage::SOURCE_LANGUAGE_CODE); exit; } $intProjCnt = NarroProject::CountByActive(1); $intLangCnt = NarroLanguage::CountAllActive(); if (!in_array('--do-not-clear-logs', $argv)) { NarroLog::Truncate(); } $intStartTime = time(); foreach (NarroProject::LoadArrayByActive(1) as $intProjIdx => $objProject) { if (in_array('--project', $argv) && $objProject->ProjectId != $argv[array_search('--project', $argv) + 1]) { continue; } foreach (NarroLanguage::LoadAllActive() as $intLangIdx => $objLanguage) { if (in_array('--language', $argv) && $objLanguage->LanguageCode != $argv[array_search('--language', $argv) + 1]) { continue; } if (in_array('--progress', $argv)) { $strProjectProgress = ''; for ($i = 1; $i < 11; $i++) { if ($intProjIdx * 10 / $intProjCnt <= $i) { $strProjectProgress .= '-'; } else { $strProjectProgress .= '+'; }