diff --git a/index.php b/index.php index 2a324b4..23d418f 100644 --- a/index.php +++ b/index.php @@ -18,6 +18,7 @@ dcPage::check(dcCore::app()->auth->makePermissions([dcAuth::PERMISSION_ADMIN])); $o = new dcAliases(); $aliases = $o->getAliases(); +$part = $_REQUEST['part'] ?? 'list'; # Update aliases if (isset($_POST['a']) && is_array($_POST['a'])) { @@ -49,50 +50,80 @@ if (isset($_POST['alias_url'])) { '', - __('Aliases') => '', -]) . -dcPage::notices() . - -'

' . __('Aliases list') . '

'; - -if (empty($aliases)) { - echo '

' . __('No alias') . '

'; +if ($part == 'new') { + echo + dcPage::breadcrumb([ + __('Plugins') => '', + __('Aliases') => dcCore::app()->adminurl->get('admin.plugin.alias', ['part' => 'list']), + __('New alias') => '', + ]) . + dcPage::notices() . + '

' . __('New alias') . '

' . + '
' . + '

' . + '

' . + '

' . sprintf(__('Do not put blog URL "%s" in fields.'), dcCore::app()->blog->url) . '

' . + '

' . + dcCore::app()->formNonce() . + form::hidden('part', 'new') . + '

' . + '
'; } else { echo - '
' . - '' . - '' . - '' . - '' . - ''; + dcPage::breadcrumb([ + __('Plugins') => '', + __('Aliases') => '' + ]) . + dcPage::notices() . + '

' . __('New alias') . '

'; - foreach ($aliases as $k => $v) { + if (empty($aliases)) { + echo '

' . __('No alias') . '

'; + } else { echo + '' . + '
' . + '
' . __('Alias URL') . '' . __('Alias destination') . '' . __('Alias position') . '
' . + '' . + '' . '' . - '' . - '' . - '' . - ''; + '' . + '' . + '' . + '' . + ''; + + foreach ($aliases as $k => $v) { + echo + '' . + '' . + '' . + '' . + ''; + } + + echo + '
' . __('Aliases list') . '
' . form::field(['a[' . $k . '][alias_url]'], 30, 255, html::escapeHTML($v['alias_url'])) . '' . form::field(['a[' . $k . '][alias_destination]'], 50, 255, html::escapeHTML($v['alias_destination'])) . '' . form::field(['a[' . $k . '][alias_position]'], 3, 5, html::escapeHTML($v['alias_position'])) . '
' . __('Alias URL') . '' . __('Alias destination') . '' . __('Alias position') . '
' . + form::field(['a[' . $k . '][alias_url]'], 50, 255, html::escapeHTML($v['alias_url'])) . '' . + form::field(['a[' . $k . '][alias_destination]'], 50, 255, html::escapeHTML($v['alias_destination'])) . '' . + form::number(['a[' . $k . '][alias_position]'], [ + 'min' => 1, + 'max' => count($aliases), + 'default' => (int) $v['alias_position'], + 'class' => 'position', + 'extra_html' => 'title="' . sprintf(__('position of %s'), html::escapeHTML($v['alias_url'])) . '"', + ]) . '
' . + '

' . __('To remove an alias, empty its URL or destination.') . '

' . + '

' . + dcCore::app()->formNonce() . + form::hidden('part', 'list') . + '

' . + '
'; } - - echo '' . - '

' . __('To remove an alias, empty its URL or destination.') . '

' . - '

' . dcCore::app()->formNonce() . - '

' . - ''; } -echo -'

' . __('New alias') . '

' . -'
' . -'

' . -'

' . -'

' . dcCore::app()->formNonce() . '

' . -'
'; - dcPage::helpBlock('alias'); ?>