<thead>
<tr>
<th class="columnID columnPackageID" colspan="3">{lang}wcf.global.objectID{/lang}</th>
+ <th class="columnMark columnPrimaryApplication">{lang}wcf.acp.application.primaryApplication{/lang}</th>
<th class="columnText columnPackageName">{lang}wcf.acp.package.name{/lang}</th>
<th class="columnText columnDomainName">{lang}wcf.acp.application.domainName{/lang}</th>
<th class="columnText columnDomainPath">{lang}wcf.acp.application.domainPath{/lang}</th>
<td class="columnMark"><input type="checkbox" name="applications[]" value="{@$application->packageID}"{if $application->packageID|in_array:$applications} checked="checked"{/if} /></td>
<td class="columnIcon"><a href="{link controller='ApplicationEdit' id=$application->packageID}{/link}"><img src="{@RELATIVE_WCF_DIR}icon/edit.svg" alt="" class="icon16 jsTooltip" title="{lang}wcf.global.button.edit{/lang}" /></a></td>
<td class="columnID columnPackageID">{#$application->packageID}</td>
+ <td class="columnMark columnPrimaryApplication"><input type="radio" name="primaryApplication" value="{@$application->packageID}" required="required"{if $primaryApplication == $application->packageID} checked="checked"{/if} /></td>
<td class="columnText columnPackageName"><a href="{link controller='PackageView' id=$application->packageID}{/link}">{lang}{$application->getPackage()->getName()}{/lang}</a></td>
<td class="columnText columnDomainName">{$application->domainName}</td>
<td class="columnText columnDomainPath">{$application->domainPath}</td>
<tr>
<td class="columnIcon"><a href="{link controller='ApplicationEdit' id=$application->packageID}{/link}"><img src="{@RELATIVE_WCF_DIR}icon/edit.svg" alt="" class="icon16 jsTooltip" title="{lang}wcf.global.button.edit{/lang}" /></a></td>
<td class="columnID columnPackageID">{#$application->packageID}</td>
- <td class="columnText columnPackageName"><a href="{link controller='PackageView' id=$application->packageID}{/link}">{lang}{$application->getPackage()->getName()}{/lang}</a></td>
+ <td class="columnText columnPackageName">
+ <a href="{link controller='PackageView' id=$application->packageID}{/link}">{lang}{$application->getPackage()->getName()}{/lang}</a>
+
+ {if $application->isPrimary}
+ <aside class="statusDisplay">
+ <ul class="statusIcons">
+ <li><img src="{@RELATIVE_WCF_DIR}icon/check.svg" alt="" class="icon16 jsTooltip" title="{lang}{lang}wcf.acp.application.primaryApplication{/lang}{/lang}" /></li>
+ </ul>
+ </aside>
+ {/if}
+ </td>
<td class="columnText columnDomainName">{$application->domainName}</td>
<td class="columnText columnDomainPath">{$application->domainPath}</td>
<td class="columnText columnCookieDomain">{$application->cookieDomain}</td>
*/
public $neededPermissions = array('admin.system.canManageApplication');
+ /**
+ * primary application's package id
+ * @var integer
+ */
+ public $primaryApplication = 0;
+
/**
* @see wcf\page\IPage::readParameters()
*/
if (isset($_POST['applications']) && is_array($_POST['applications'])) $this->applications = ArrayUtil::toIntegerArray($_POST['applications']);
if (isset($_POST['groupName'])) $this->groupName = StringUtil::trim($_POST['groupName']);
+ if (isset($_POST['primaryApplication'])) $this->primaryApplication = intval($_POST['primaryApplication']);
}
/**
$packages[] = $application->getPackage()->package;
}
}
+
+ if ($this->primaryApplication == 0) {
+ throw new UserInputException('applications', 'primaryApplication.empty');
+ }
+ else {
+ if (!in_array($this->primaryApplication, $this->applications)) {
+ throw new UserInputException('applications', 'primaryApplication.notValid');
+ }
+ }
}
/**
'applications' => $this->applications,
'data' => array(
'groupName' => $this->groupName
- )
+ ),
+ 'primaryApplication' => $this->primaryApplication
));
$this->objectAction->executeAction();
$this->saved();
// reset values
$this->applications = array();
$this->groupName = '';
+ $this->primaryApplication = 0;
// reload available applications
$this->readAvailableApplications();
'action' => 'add',
'applications' => $this->applications,
'availableApplications' => $this->availableApplications,
- 'groupName' => $this->groupName
+ 'groupName' => $this->groupName,
+ 'primaryApplication' => $this->primaryApplication,
));
}
}
if (empty($_POST)) {
$this->groupName = $this->applicationGroup->groupName;
+
+ foreach ($this->availableApplications as $application) {
+ if ($application->isPrimary) {
+ $this->primaryApplication = $application->packageID;
+ break;
+ }
+ }
}
}
'applications' => $this->applications,
'data' => array(
'groupName' => $this->groupName
- )
+ ),
+ 'primaryApplication' => $this->primaryApplication
));
$this->objectAction->executeAction();
$this->saved();
$sql = "UPDATE wcf".WCF_N."_application
SET groupID = ?,
cookieDomain = ?,
- cookiePath = ?
+ cookiePath = ?,
+ isPrimary = ?
WHERE packageID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$path = FileUtil::addLeadingSlash(FileUtil::addTrailingSlash(implode('/', $path)));
foreach (array_keys($data) as $packageID) {
+ $isPrimary = ($this->parameters['primaryApplication'] == $packageID) ? 1 : 0;
+
$statement->execute(array(
$this->parameters['groupID'],
$domainName,
$path,
+ $isPrimary,
$packageID
));
}
$sql = "UPDATE wcf".WCF_N."_application
SET groupID = ?,
cookieDomain = domainName,
- cookiePath = domainPath
+ cookiePath = domainPath,
+ isPrimary = 0
WHERE packageID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
public function create() {
$applicationGroup = parent::create();
- if (isset($this->parameters['applications'])) {
- $applicationAction = new ApplicationAction($this->parameters['applications'], 'group', array('groupID' => $applicationGroup->groupID));
- $applicationAction->executeAction();
- }
+ $applicationAction = new ApplicationAction($this->parameters['applications'], 'group', array(
+ 'groupID' => $applicationGroup->groupID,
+ 'primaryApplication' => $this->parameters['primaryApplication']
+ ));
+ $applicationAction->executeAction();
return $applicationGroup;
}
parent::update();
// read list of currently associated applications
- $applicationGroup = current($this->objects);
+ $applicationGroup = current(reset($this->objects));
$applicationList = new ApplicationList();
$applicationList->getConditionBuilder()->add("application.groupID = ?", array($applicationGroup->groupID));
$applicationList->sqlLimit = 0;
}
// rebuild current group
- $applicationAction = new ApplicationAction($updateApplications, 'group', array('groupID' => $applicationGroup->groupID));
+ $applicationAction = new ApplicationAction($updateApplications, 'group', array(
+ 'groupID' => $applicationGroup->groupID,
+ 'primaryApplication' => $this->parameters['primaryApplication']
+ ));
$applicationAction->executeAction();
// remove applications from group
}
// step 2) run each application
- foreach ($loadedApplications as $application) {
- $application->__run();
+ if (!class_exists('wcf\system\WCFACP', false)) {
+ foreach ($loadedApplications as $application) {
+ $application->__run();
+ }
}
}
<item name="wcf.acp.application.group.title"><![CDATA[Anwendungsgruppe: „{$applicationGroup->groupName}“]]></item>
<item name="wcf.acp.application.independentApplications"><![CDATA[Unabhängige Anwendungen]]></item>
<item name="wcf.acp.application.management"><![CDATA[Anwendungen verwalten]]></item>
+ <item name="wcf.acp.application.primaryApplication"><![CDATA[Primäre Anwendung]]></item>
</category>
<category name="wcf.acp.cache">