}
}
}
+
+ /**
+ * Sets localized error message for given element.
+ *
+ * @param string $name
+ * @param string $error
+ * @param unknown_type $error
+ */
+ public function setError($name, $error) {
+ foreach ($this->container as $container) {
+ $this->containers->setError($name, $error);
+ }
+ }
}
* @return string
*/
public function getHTML($formName);
+
+ /**
+ * Sets localized error message.
+ *
+ * @param string $error
+ */
+ public function setError($error);
+
+ /**
+ * Returns localized error message, empty if no error occured.
+ *
+ * @return string
+ */
+ public function getError();
}
* @return string
*/
public function getHTML($formName);
+
+ /**
+ * Sets localized error message for named element.
+ *
+ * @param string $name
+ * @param string $error
+ */
+ public function setError($name, $error);
}
public function handleRequest(array $variables) {
foreach ($this->children as $element) {
if (!($element instanceof AbstractNamedFormElement)) {
- return;
+ continue;
}
if (isset($variables[$element->getName()])) {
}
}
}
+
+ /**
+ * @see wcf\system\form\IFormElementContainer::setError()
+ */
+ public function setError($name, $error) {
+ foreach ($this->children as $element) {
+ if (!($element instanceof AbstractNamedFormElement)) {
+ continue;
+ }
+
+ if ($element->getName() == $name) {
+ $element->setError($error);
+ }
+ }
+ }
}
*/
protected $description = '';
+ /**
+ * localized error string
+ * @var string
+ */
+ protected $error = '';
+
/**
* element label
* @var string
public function getParent() {
return $this->parent;
}
+
+ /**
+ * @see wcf\system\form\IFormElement::setError()
+ */
+ public function setError($error) {
+ $this->error = $error;
+ }
+
+ /**
+ * @see wcf\system\form\IFormElement::getError()
+ */
+ public function getError() {
+ return $this->error;
+ }
+
+ /**
+ * Returns class attribute if an error occured.
+ *
+ * @return string
+ */
+ protected function getErrorClass() {
+ return ($this->getError()) ? ' class="wcf-formError"' : '';
+ }
+
+ /**
+ * Returns an error message if occured.
+ *
+ * @return string
+ */
+ protected function getErrorField() {
+ return ($this->getError()) ? '<small class="wcf-innerError">'.$this->getError().'</small>' : '';
+ }
}
*/
public function getHTML($formName) {
return <<<HTML
-<dl>
+<dl{$this->getErrorClass()}>
<dt><label>{$this->getLabel()}</label></dt>
<dd>
{$this->getText()}
<small>{$this->getDescription()}</small>
+ {$this->getErrorField()}
</dd>
</dl>
HTML;
*/
public function getHTML($formName) {
return <<<HTML
-<dl>
+<dl{$this->getErrorClass()}>
<dt><label for="{$this->getName()}">{$this->getLabel()}</label></dt>
<dd>
<input type="password" id="{$this->getName()}" name="{$formName}{$this->getName()}" value="{$this->getValue()}" class="medium" />
<small>{$this->getDescription()}</small>
+ {$this->getErrorField()}
</dd>
</dl>
HTML;
*/
public function getHTML($formName) {
return <<<HTML
-<dl>
+<dl{$this->getErrorClass()}>
<dt><label for="{$this->getName()}">{$this->getLabel()}</label></dt>
<dd>
<input type="text" id="{$this->getName()}" name="{$formName}{$this->getName()}" value="{$this->getValue()}" class="long" />
<small>{$this->getDescription()}</small>
+ {$this->getErrorField()}
</dd>
</dl>
HTML;
$packageDir = $document->getValue('packageDir');
if ($packageDir !== null) {
+ // validate package dir
+ if (file_exists(FileUtil::addLeadingSlash($packageDir) . 'global.php')) {
+ $document->setError('packageDir', WCF::getLanguage()->get('wcf.acp.package.packageDir.notAvailable'));
+ return null;
+ }
+
+ // set package dir
$packageEditor = new PackageEditor($this->getPackage());
$packageEditor->update(array(
'packageDir' => FileUtil::getRelativePath(WCF_DIR, $packageDir)
<item name="wcf.acp.package.list.detailed"><![CDATA[Detaillierte Paketliste]]></item>
<item name="wcf.acp.package.name"><![CDATA[Paket]]></item>
<item name="wcf.acp.package.packageDate"><![CDATA[Erstellungsdatum]]></item>
+ <item name="wcf.acp.package.packageDir.notAvailable"><![CDATA[Das angegebene Verzeichnis enthält bereits eine Anwendung.]]></item>
<item name="wcf.acp.package.plugin.installed"><![CDATA[Installierte Pakete]]></item>
<item name="wcf.acp.package.plugin.title"><![CDATA[Erweiterungen]]></item>
<item name="wcf.acp.package.source"><![CDATA[Datenquelle]]></item>
<item name="wcf.acp.package.list.detailed"><![CDATA[Detailed package list]]></item>
<item name="wcf.acp.package.name"><![CDATA[Package]]></item>
<item name="wcf.acp.package.packageDate"><![CDATA[Creation date]]></item>
+ <item name="wcf.acp.package.packageDir.notAvailable"><![CDATA[The given directory already contains an application.]]></item>
<item name="wcf.acp.package.plugin.installed"><![CDATA[Installed packages]]></item>
<item name="wcf.acp.package.plugin.title"><![CDATA[Extensions]]></item>
<item name="wcf.acp.package.source"><![CDATA[Data source]]></item>