$sContent .= '         <td>' . i18n("Search for", $plugin_name) . '</td>' . chr(10);
 $sContent .= '         <td>' . $oTxtFilter->render() . '</td>' . chr(10);
 $sContent .= '      </tr>' . chr(10);
 $sContent .= '      <tr>' . chr(10);
 $sContent .= '         <td>' . i18n("Search in", $plugin_name) . '</td>' . chr(10);
 $sContent .= '         <td>' . $oSelSearchIn->render() . '</td>' . chr(10);
 $sContent .= '      </tr>' . chr(10);
 $sContent .= '      <tr>' . chr(10);
 $sContent .= '         <td>&nbsp;</td>' . chr(10);
 $sContent .= '         <td>' . $oSubmit->render() . '</td>' . chr(10);
 $sContent .= '      </tr>' . chr(10);
 $sContent .= '   </table>' . chr(10);
 $sContent .= '</div>' . chr(10);
 $oMemberListOptionRow->setContentData($sContent);
 // Members
 $oAddedRecipientList = new UI_List();
 $oAddedRecipientList->setWidth("100%");
 $oAddedRecipientList->setBorder(1);
 $oAddedRecipientList->setCell(0, 1, "<strong>" . i18n("Name", $plugin_name) . "</strong>");
 $oImgDel = new cHTMLImage("images/but_invert_selection.gif");
 $sLnkDelIcon = '<a title="' . i18n("Check all", $plugin_name) . '" href="javascript://" onclick="fncCheckDel(\'deluser[]\');">' . $oImgDel->render() . '</a>';
 $oAddedRecipientList->setCell(0, 2, $sLnkDelIcon);
 $oAddedRecipientList->setCellAlignment(0, 2, "right");
 $oInsiders = new RecipientCollection();
 $oInsiders->link("RecipientGroupMemberCollection");
 $oInsiders->setWhere("recipientcollection.idclient", $client);
 $oInsiders->setWhere("recipientcollection.idlang", $lang);
 $oInsiders->setWhere("RecipientGroupMemberCollection.idnewsgroup", $_REQUEST["idrecipientgroup"]);
 // Get insiders for outsiders list (*sigh!*)
 // TODO: Ask user to have at least mySQL 4.1...
 $oInsiders->query();
             $aPluginDisplay = call_user_func("recipients_" . $sPlugin . "_display", $recipient);
             if (is_array($aPluginTitle) && is_array($aPluginDisplay)) {
                 foreach ($aPluginTitle as $sKey => $sValue) {
                     $oForm->add($sValue, $aPluginDisplay[$sKey]);
                 }
             } else {
                 if (is_array($aPluginTitle) || is_array($aPluginDisplay)) {
                     $oForm->add(i18n("WARNING", $plugin_name), sprintf(i18n("The plugin %s delivered an array for the displayed titles, but did not return an array for the contents.", $plugin_name), $sPlugin));
                 } else {
                     $oForm->add($aPluginTitle, $aPluginDisplay);
                 }
             }
         }
     }
 }
 $oGroupList = new UI_List();
 $oGroupList->setWidth("100%");
 $oGroupList->setBorder(1);
 $oAssocGroups = new RecipientGroupMemberCollection();
 $oAssocGroups->link("RecipientGroupCollection");
 $oAssocGroups->setWhere("recipientgroupmembercollection.idnewsrcp", $recipient->get("idnewsrcp"));
 $oAssocGroups->setOrder("recipientgroupcollection.groupname");
 $oAssocGroups->query();
 if ($oAssocGroups->count() == 0) {
     $oGroupList->setCell(0, 1, i18n("Recipient is not member of any group", $plugin_name));
 } else {
     // Headline
     $oGroupList->setCell(0, 1, "<strong>" . i18n("Groupname", $plugin_name) . "</strong>");
     $oImgDel = new cHTMLImage("images/delete.gif");
     $oGroupList->setCell(0, 2, $oImgDel->render());
     $oGroupList->setCellAlignment(0, 2, "right");
Example #3
0
 public static function getPage_Phrase($contents, $containers)
 {
     $repositoryID = self::validateID(self::getDataGET('project'), true);
     $languageID = self::validateID(self::getDataGET('language'), true);
     $phraseID = self::validateID(self::getDataGET('phrase'), true);
     $repositoryData = Database::getRepositoryData($repositoryID);
     $phraseData = Database::getPhraseData($repositoryID, $phraseID);
     if (empty($repositoryData) || empty($phraseData)) {
         self::addBreadcrumbItem(URL::toProject($repositoryID), 'Phrase not found');
         self::setTitle('Phrase not found');
         $contents[] = new UI_Heading('Phrase not found', true);
         $contents[] = new UI_Paragraph('We\'re sorry, but we could not find the phrase that you requested.');
         $contents[] = new UI_Paragraph('Please check if you have made any typing errors.');
     } else {
         self::addBreadcrumbItem(URL::toProject($repositoryID), htmlspecialchars($repositoryData['name']));
         self::addBreadcrumbItem(URL::toLanguage($repositoryID, $languageID), Language::getLanguageNameFull($languageID));
         Authentication::saveCachedRepository($repositoryID, $repositoryData['name']);
         $repository = new Repository($repositoryID, $repositoryData['name'], $repositoryData['visibility'], $repositoryData['defaultLanguage']);
         $role = Database::getRepositoryRole(Authentication::getUserID(), $repositoryID);
         $permissions = $repository->getPermissions(Authentication::getUserID(), $role);
         if (Authentication::getUserID() <= 0) {
             self::setTitle($repositoryData['name']);
             $contents[] = new UI_Heading(htmlspecialchars($repositoryData['name']), true);
             $contents[] = self::getLoginForm();
         } elseif ($permissions->isInvitationMissing()) {
             self::setTitle($repositoryData['name']);
             $contents[] = new UI_Heading(htmlspecialchars($repositoryData['name']), true);
             $contents[] = self::getInvitationForm($repositoryID);
         } else {
             $mayMovePhrases = Repository::isRoleAllowedToMovePhrases($role);
             $currentPageURL = URL::toPhraseDetails($repositoryID, $languageID, $phraseID);
             self::addBreadcrumbItem($currentPageURL, $phraseData['phraseKey']);
             $phraseObject = Phrase::create($phraseID, $phraseData['phraseKey'], $phraseData['payload']);
             $phraseObjectEntries = $phraseObject->getPhraseValues();
             $phraseEntries = new UI_List();
             foreach ($phraseObjectEntries as $phraseObjectEntry) {
                 $phraseEntries->addItem(nl2br(htmlspecialchars($phraseObjectEntry)));
             }
             if ($mayMovePhrases) {
                 $formMove = new UI_Form($currentPageURL, false);
                 $formMove->addContent(new UI_Form_Hidden('phraseMove[phraseKey]', $phraseData['phraseKey']));
                 $phraseGroupSelection = new UI_Form_Select('New group', 'phraseMove[groupID]');
                 $phraseGroupSelection->addOption('(Default group)', Phrase::GROUP_NONE);
                 $phraseGroups = Database::getPhraseGroups($repositoryID, $repositoryData['defaultLanguage']);
                 foreach ($phraseGroups as $phraseGroup) {
                     $phraseGroupSelection->addOption($phraseGroup['name'], $phraseGroup['id']);
                 }
                 $phraseGroupSelection->addDefaultOption($phraseData['groupID']);
                 $formMove->addContent($phraseGroupSelection);
                 $formButtonList = array(new UI_Form_Button('Update group', UI_Link::TYPE_SUCCESS), new UI_Link('Manage groups', URL::toEditProject($repositoryID, true), UI_Link::TYPE_UNIMPORTANT), new UI_Link('Cancel', URL::toLanguage($repositoryID, $languageID), UI_Link::TYPE_UNIMPORTANT));
                 $formMove->addContent(new UI_Form_ButtonGroup($formButtonList));
             } else {
                 $formMove = NULL;
             }
             if ($mayMovePhrases) {
                 $formChange = new UI_Form($currentPageURL, false);
                 $formChange->addContent(new UI_Form_Hidden('phraseChange[phraseKey]', $phraseData['phraseKey']));
                 $actionTypeSelection = new UI_Form_Select('Operation', 'phraseChange[action]');
                 $actionTypeSelection->addOption('— Please choose —', '');
                 $actionTypeSelection->addOption('Untranslate: Remove all translations of this phrase only', 'untranslate');
                 $actionTypeSelection->addOption('Delete: Completely remove this phrase from the project', 'delete');
                 $formChange->addContent($actionTypeSelection);
                 $formButtonList = array(new UI_Form_Button('Execute', UI_Link::TYPE_DANGER, UI_Form_Button::ACTION_SUBMIT, '', '', 'return confirm(\'Are you sure you want to execute the selected operation? This cannot be undone!\');'), new UI_Link('Cancel', URL::toLanguage($repositoryID, $languageID), UI_Link::TYPE_UNIMPORTANT));
                 $formChange->addContent(new UI_Form_ButtonGroup($formButtonList));
             } else {
                 $formChange = NULL;
             }
             self::setTitle('Phrase: ' . $phraseData['phraseKey']);
             $contents[] = new UI_Heading('Phrase: ' . $phraseData['phraseKey'], true);
             $contents[] = new UI_Heading('Contents', false, 3);
             $contents[] = $phraseEntries;
             if (isset($formMove)) {
                 $contents[] = new UI_Heading('Move phrase to another group', false, 3);
                 $contents[] = $formMove;
             }
             if (isset($formChange)) {
                 $contents[] = new UI_Heading('Untranslate or delete phrase', false, 3);
                 $contents[] = $formChange;
             }
         }
     }
     $cell = new UI_Cell($contents);
     $row = new UI_Row(array($cell));
     $containers[] = new UI_Container(array($row));
     return new UI_Group($containers);
 }