| 1 | <?php |
|---|
| 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
|---|
| 3 | # |
|---|
| 4 | # This file is part of Dotclear 2. |
|---|
| 5 | # |
|---|
| 6 | # Copyright (c) 2003-2010 Olivier Meunier & Association Dotclear |
|---|
| 7 | # Licensed under the GPL version 2.0 license. |
|---|
| 8 | # See LICENSE file or |
|---|
| 9 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
|---|
| 10 | # |
|---|
| 11 | # -- END LICENSE BLOCK ----------------------------------------- |
|---|
| 12 | |
|---|
| 13 | require dirname(__FILE__).'/../inc/admin/prepend.php'; |
|---|
| 14 | |
|---|
| 15 | dcPage::check('usage,contentadmin'); |
|---|
| 16 | |
|---|
| 17 | $href = !empty($_GET['href']) ? $_GET['href'] : ''; |
|---|
| 18 | $hreflang = !empty($_GET['hreflang']) ? $_GET['hreflang'] : ''; |
|---|
| 19 | $title = !empty($_GET['title']) ? $_GET['title'] : ''; |
|---|
| 20 | |
|---|
| 21 | dcPage::openPopup(__('Add a link'),dcPage::jsLoad('js/jsToolBar/popup_link.js')); |
|---|
| 22 | |
|---|
| 23 | echo '<h2>'.__('Add a link').'</h2>'; |
|---|
| 24 | |
|---|
| 25 | # Languages combo |
|---|
| 26 | $rs = $core->blog->getLangs(array('order'=>'asc')); |
|---|
| 27 | $all_langs = l10n::getISOcodes(0,1); |
|---|
| 28 | $lang_combo = array('' => '', __('Most used') => array(), __('Available') => l10n::getISOcodes(1,1)); |
|---|
| 29 | while ($rs->fetch()) { |
|---|
| 30 | if (isset($all_langs[$rs->post_lang])) { |
|---|
| 31 | $lang_combo[__('Most used')][$all_langs[$rs->post_lang]] = $rs->post_lang; |
|---|
| 32 | unset($lang_combo[__('Available')][$all_langs[$rs->post_lang]]); |
|---|
| 33 | } else { |
|---|
| 34 | $lang_combo[__('Most used')][$rs->post_lang] = $rs->post_lang; |
|---|
| 35 | } |
|---|
| 36 | } |
|---|
| 37 | unset($all_langs); |
|---|
| 38 | unset($rs); |
|---|
| 39 | |
|---|
| 40 | echo |
|---|
| 41 | '<form id="link-insert-form" action="#" method="get">'. |
|---|
| 42 | '<p><label class="required" title="'.__('Required field').'">'.__('Link URL:').' '. |
|---|
| 43 | form::field('href',35,512,html::escapeHTML($href)).'</label></p>'. |
|---|
| 44 | '<p><label>'.__('Link title:').' '. |
|---|
| 45 | form::field('title',35,512,html::escapeHTML($title)).'</label></p>'. |
|---|
| 46 | '<p><label>'.__('Link language:').' '. |
|---|
| 47 | form::combo('hreflang',$lang_combo,$hreflang). |
|---|
| 48 | '</label></p>'. |
|---|
| 49 | |
|---|
| 50 | '</form>'. |
|---|
| 51 | |
|---|
| 52 | '<p><a class="button" href="#" id="link-insert-cancel">'.__('cancel').'</a> - '. |
|---|
| 53 | '<strong><a class="button" href="#" id="link-insert-ok">'.__('insert').'</a></strong></p>'."\n". |
|---|
| 54 | |
|---|
| 55 | '<script type="text/javascript">'."\n". |
|---|
| 56 | '//<![CDATA['."\n". |
|---|
| 57 | '$(\'input[name="href"]\').get(0).focus();'."\n". |
|---|
| 58 | '//]]>'."\n". |
|---|
| 59 | '</script>'."\n"; |
|---|
| 60 | |
|---|
| 61 | dcPage::closePopup(); |
|---|
| 62 | ?> |
|---|