Dotclear

Changeset 3707:3a350757c847 for admin


Ignore:
Timestamp:
02/17/18 18:03:29 (7 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Use array form of optionnal parameters for form::checkbox() where is relevant, code formatting (PSR-2)

Location:
admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • admin/post.php

    r3703 r3707  
    522522 
    523523        '<td class="nowrap">' . 
    524         ($has_action ? form::checkbox(array('comments[]'), $rs->comment_id, isset($comments[$rs->comment_id]), '', '', 0, 'title="' . ($tb ? __('select this trackback') : __('select this comment')) . '"') : '') . '</td>' . 
    525         '<td class="maximal">' . html::escapeHTML($rs->comment_author) . '</td>' . 
    526         '<td class="nowrap">' . dt::dt2str(__('%Y-%m-%d %H:%M'), $rs->comment_dt) . '</td>' . 
    527         '<td class="nowrap"><a href="' . $core->adminurl->get("admin.comments", array('ip' => $rs->comment_ip)) . '">' . $rs->comment_ip . '</a></td>' . 
    528         '<td class="nowrap status">' . $img_status . '</td>' . 
    529         '<td class="nowrap status"><a href="' . $comment_url . '">' . 
    530         '<img src="images/edit-mini.png" alt="" title="' . __('Edit this comment') . '" /> ' . __('Edit') . '</a></td>' . 
    531  
    532             '</tr>'; 
    533     } 
    534  
    535     echo '</table></div>'; 
    536 }; 
     524        ($has_action ? form::checkbox(array('comments[]'), $rs->comment_id, 
     525            array( 
     526                'checked'    => isset($comments[$rs->comment_id]), 
     527                'extra_html' => 'title="' . ($tb ? __('select this trackback') : __('select this comment') . '"') 
     528                ) 
     529            ) : '') . '</td>' . 
     530            '<td class="maximal">' . html::escapeHTML($rs->comment_author) . '</td>' . 
     531            '<td class="nowrap">' . dt::dt2str(__('%Y-%m-%d %H:%M'), $rs->comment_dt) . '</td>' . 
     532            '<td class="nowrap"><a href="' . $core->adminurl->get("admin.comments", array('ip' => $rs->comment_ip)) . '">' . $rs->comment_ip . '</a></td>' . 
     533            '<td class="nowrap status">' . $img_status . '</td>' . 
     534            '<td class="nowrap status"><a href="' . $comment_url . '">' . 
     535            '<img src="images/edit-mini.png" alt="" title="' . __('Edit this comment') . '" /> ' . __('Edit') . '</a></td>' . 
     536 
     537                '</tr>'; 
     538        } 
     539 
     540        echo '</table></div>'; 
     541    }; 
    537542 
    538543/* Post form if we can edit post 
    539544-------------------------------------------------------- */ 
    540 if ($can_edit_post) { 
    541     $sidebar_items = new ArrayObject(array( 
    542         'status-box'  => array( 
    543             'title' => __('Status'), 
    544             'items' => array( 
    545                 'post_status' => 
    546                 '<p class="entry-status"><label for="post_status">' . __('Entry status') . ' ' . $img_status . '</label>' . 
    547                 form::combo('post_status', $status_combo, 
    548                     array('default' => $post_status, 'class' => 'maximal', 'disabled' => !$can_publish)) . 
    549                 '</p>', 
    550                 'post_dt'     => 
    551                 '<p><label for="post_dt">' . __('Publication date and hour') . '</label>' . 
    552                 form::field('post_dt', 16, 16, $post_dt, ($bad_dt ? 'invalid' : '')) . 
    553                 '</p>', 
    554                 'post_lang'   => 
    555                 '<p><label for="post_lang">' . __('Entry language') . '</label>' . 
    556                 form::combo('post_lang', $lang_combo, $post_lang) . 
    557                 '</p>', 
    558                 'post_format' => 
    559                 '<div>' . 
    560                 '<h5 id="label_format"><label for="post_format" class="classic">' . __('Text formatting') . '</label></h5>' . 
    561                 '<p>' . form::combo('post_format', $available_formats, $post_format, 'maximal') . '</p>' . 
    562                 '<p class="format_control control_no_xhtml">' . 
    563                 '<a id="convert-xhtml" class="button' . ($post_id && $post_format != 'wiki' ? ' hide' : '') . '" href="' . 
    564                 $core->adminurl->get('admin.post', array('id' => $post_id, 'xconv' => '1')) . 
    565                 '">' . 
    566                 __('Convert to XHTML') . '</a></p></div>')), 
    567         'metas-box'   => array( 
    568             'title' => __('Filing'), 
    569             'items' => array( 
    570                 'post_selected' => 
    571                 '<p><label for="post_selected" class="classic">' . 
    572                 form::checkbox('post_selected', 1, $post_selected) . ' ' . 
    573                 __('Selected entry') . '</label></p>', 
    574                 'cat_id'        => 
    575                 '<div>' . 
    576                 '<h5 id="label_cat_id">' . __('Category') . '</h5>' . 
    577                 '<p><label for="cat_id">' . __('Category:') . '</label>' . 
    578                 form::combo('cat_id', $categories_combo, $cat_id, 'maximal') . 
     545    if ($can_edit_post) { 
     546        $sidebar_items = new ArrayObject(array( 
     547            'status-box'  => array( 
     548                'title' => __('Status'), 
     549                'items' => array( 
     550                    'post_status' => 
     551                    '<p class="entry-status"><label for="post_status">' . __('Entry status') . ' ' . $img_status . '</label>' . 
     552                    form::combo('post_status', $status_combo, 
     553                        array('default' => $post_status, 'class' => 'maximal', 'disabled' => !$can_publish)) . 
     554                    '</p>', 
     555                    'post_dt'     => 
     556                    '<p><label for="post_dt">' . __('Publication date and hour') . '</label>' . 
     557                    form::field('post_dt', 16, 16, $post_dt, ($bad_dt ? 'invalid' : '')) . 
     558                    '</p>', 
     559                    'post_lang'   => 
     560                    '<p><label for="post_lang">' . __('Entry language') . '</label>' . 
     561                    form::combo('post_lang', $lang_combo, $post_lang) . 
     562                    '</p>', 
     563                    'post_format' => 
     564                    '<div>' . 
     565                    '<h5 id="label_format"><label for="post_format" class="classic">' . __('Text formatting') . '</label></h5>' . 
     566                    '<p>' . form::combo('post_format', $available_formats, $post_format, 'maximal') . '</p>' . 
     567                    '<p class="format_control control_no_xhtml">' . 
     568                    '<a id="convert-xhtml" class="button' . ($post_id && $post_format != 'wiki' ? ' hide' : '') . '" href="' . 
     569                    $core->adminurl->get('admin.post', array('id' => $post_id, 'xconv' => '1')) . 
     570                    '">' . 
     571                    __('Convert to XHTML') . '</a></p></div>')), 
     572            'metas-box'   => array( 
     573                'title' => __('Filing'), 
     574                'items' => array( 
     575                    'post_selected' => 
     576                    '<p><label for="post_selected" class="classic">' . 
     577                    form::checkbox('post_selected', 1, $post_selected) . ' ' . 
     578                    __('Selected entry') . '</label></p>', 
     579                    'cat_id'        => 
     580                    '<div>' . 
     581                    '<h5 id="label_cat_id">' . __('Category') . '</h5>' . 
     582                    '<p><label for="cat_id">' . __('Category:') . '</label>' . 
     583                    form::combo('cat_id', $categories_combo, $cat_id, 'maximal') . 
     584                    '</p>' . 
     585                    ($core->auth->check('categories', $core->blog->id) ? 
     586                        '<div>' . 
     587                        '<h5 id="create_cat">' . __('Add a new category') . '</h5>' . 
     588                        '<p><label for="new_cat_title">' . __('Title:') . ' ' . 
     589                        form::field('new_cat_title', 30, 255, '', 'maximal') . '</label></p>' . 
     590                        '<p><label for="new_cat_parent">' . __('Parent:') . ' ' . 
     591                        form::combo('new_cat_parent', $categories_combo, '', 'maximal') . 
     592                        '</label></p>' . 
     593                        '</div>' 
     594                        : '') . 
     595                    '</div>')), 
     596            'options-box' => array( 
     597                'title' => __('Options'), 
     598                'items' => array( 
     599                    'post_open_comment_tb' => 
     600                    '<div>' . 
     601                    '<h5 id="label_comment_tb">' . __('Comments and trackbacks list') . '</h5>' . 
     602                    '<p><label for="post_open_comment" class="classic">' . 
     603                    form::checkbox('post_open_comment', 1, $post_open_comment) . ' ' . 
     604                    __('Accept comments') . '</label></p>' . 
     605                    ($core->blog->settings->system->allow_comments ? 
     606                        ($isContributionAllowed($post_id, strtotime($post_dt), true) ? 
     607                            '' : 
     608                            '<p class="form-note warn">' . 
     609                            __('Warning: Comments are not more accepted for this entry.') . '</p>') : 
     610                        '<p class="form-note warn">' . 
     611                        __('Comments are not accepted on this blog so far.') . '</p>') . 
     612                    '<p><label for="post_open_tb" class="classic">' . 
     613                    form::checkbox('post_open_tb', 1, $post_open_tb) . ' ' . 
     614                    __('Accept trackbacks') . '</label></p>' . 
     615                    ($core->blog->settings->system->allow_trackbacks ? 
     616                        ($isContributionAllowed($post_id, strtotime($post_dt), false) ? 
     617                            '' : 
     618                            '<p class="form-note warn">' . 
     619                            __('Warning: Trackbacks are not more accepted for this entry.') . '</p>') : 
     620                        '<p class="form-note warn">' . __('Trackbacks are not accepted on this blog so far.') . '</p>') . 
     621                    '</div>', 
     622                    'post_password'        => 
     623                    '<p><label for="post_password">' . __('Password') . '</label>' . 
     624                    form::field('post_password', 10, 32, html::escapeHTML($post_password), 'maximal') . 
     625                    '</p>', 
     626                    'post_url'             => 
     627                    '<div class="lockable">' . 
     628                    '<p><label for="post_url">' . __('Edit basename') . '</label>' . 
     629                    form::field('post_url', 10, 255, html::escapeHTML($post_url), 'maximal') . 
     630                    '</p>' . 
     631                    '<p class="form-note warn">' . 
     632                    __('Warning: If you set the URL manually, it may conflict with another entry.') . 
     633                    '</p></div>' 
     634                )))); 
     635 
     636        $main_items = new ArrayObject(array( 
     637            "post_title"   => 
     638            '<p class="col">' . 
     639            '<label class="required no-margin bold" for="post_title"><abbr title="' . __('Required field') . '">*</abbr> ' . __('Title:') . '</label>' . 
     640            form::field('post_title', 20, 255, html::escapeHTML($post_title), 'maximal', '', false, 'required placeholder="' . __('Title') . '"') . 
     641            '</p>', 
     642 
     643            "post_excerpt" => 
     644            '<p class="area" id="excerpt-area"><label for="post_excerpt" class="bold">' . __('Excerpt:') . ' <span class="form-note">' . 
     645            __('Introduction to the post.') . '</span></label> ' . 
     646            form::textarea('post_excerpt', 50, 5, html::escapeHTML($post_excerpt)) . 
     647            '</p>', 
     648 
     649            "post_content" => 
     650            '<p class="area" id="content-area"><label class="required bold" ' . 
     651            'for="post_content"><abbr title="' . __('Required field') . '">*</abbr> ' . __('Content:') . '</label> ' . 
     652            form::textarea('post_content', 50, $core->auth->getOption('edit_size'), html::escapeHTML($post_content), 
     653                '', '', false, 'required placeholder="' . __('Content') . '"') . 
     654            '</p>', 
     655 
     656            "post_notes"   => 
     657            '<p class="area" id="notes-area"><label for="post_notes" class="bold">' . __('Personal notes:') . ' <span class="form-note">' . 
     658            __('Unpublished notes.') . '</span></label>' . 
     659            form::textarea('post_notes', 50, 5, html::escapeHTML($post_notes)) . 
     660            '</p>' 
     661        ) 
     662        ); 
     663 
     664        # --BEHAVIOR-- adminPostFormItems 
     665        $core->callBehavior('adminPostFormItems', $main_items, $sidebar_items, isset($post) ? $post : null, 'post'); 
     666 
     667        echo '<div class="multi-part" title="' . ($post_id ? __('Edit entry') : __('New entry')) . 
     668        sprintf(' &rsaquo; %s', $post_format) . '" id="edit-entry">'; 
     669        echo '<form action="' . $core->adminurl->get('admin.post') . '" method="post" id="entry-form">'; 
     670        echo '<div id="entry-wrapper">'; 
     671        echo '<div id="entry-content"><div class="constrained">'; 
     672 
     673        echo '<h3 class="out-of-screen-if-js">' . __('Edit post') . '</h3>'; 
     674 
     675        foreach ($main_items as $id => $item) { 
     676            echo $item; 
     677        } 
     678 
     679        # --BEHAVIOR-- adminPostForm (may be deprecated) 
     680        $core->callBehavior('adminPostForm', isset($post) ? $post : null, 'post'); 
     681 
     682        echo 
     683        '<p class="border-top">' . 
     684        ($post_id ? form::hidden('id', $post_id) : '') . 
     685        '<input type="submit" value="' . __('Save') . ' (s)" ' . 
     686            'accesskey="s" name="save" /> '; 
     687        if ($post_id) { 
     688            $preview_url = 
     689            $core->blog->url . $core->url->getURLFor('preview', $core->auth->userID() . '/' . 
     690                http::browserUID(DC_MASTER_KEY . $core->auth->userID() . $core->auth->cryptLegacy($core->auth->userID())) . 
     691                '/' . $post->post_url); 
     692            echo '<a id="post-preview" href="' . $preview_url . '" class="button modal" accesskey="p">' . __('Preview') . ' (p)' . '</a>'; 
     693        } else { 
     694            echo 
     695            '<a id="post-cancel" href="' . $core->adminurl->get("admin.home") . '" class="button" accesskey="c">' . __('Cancel') . ' (c)</a>'; 
     696        } 
     697 
     698        echo 
     699        ($can_delete ? ' <input type="submit" class="delete" value="' . __('Delete') . '" name="delete" />' : '') . 
     700        $core->formNonce() . 
     701            '</p>'; 
     702 
     703        echo '</div></div>'; // End #entry-content 
     704        echo '</div>';       // End #entry-wrapper 
     705 
     706        echo '<div id="entry-sidebar" role="complementary">'; 
     707 
     708        foreach ($sidebar_items as $id => $c) { 
     709            echo '<div id="' . $id . '" class="sb-box">' . 
     710                '<h4>' . $c['title'] . '</h4>'; 
     711            foreach ($c['items'] as $e_name => $e_content) { 
     712                echo $e_content; 
     713            } 
     714            echo '</div>'; 
     715        } 
     716 
     717        # --BEHAVIOR-- adminPostFormSidebar (may be deprecated) 
     718        $core->callBehavior('adminPostFormSidebar', isset($post) ? $post : null, 'post'); 
     719        echo '</div>'; // End #entry-sidebar 
     720 
     721        echo '</form>'; 
     722 
     723        # --BEHAVIOR-- adminPostForm 
     724        $core->callBehavior('adminPostAfterForm', isset($post) ? $post : null, 'post'); 
     725 
     726        echo '</div>'; 
     727    } 
     728 
     729    if ($post_id) { 
     730        /* Comments 
     731        -------------------------------------------------------- */ 
     732 
     733        $params = array('post_id' => $post_id, 'order' => 'comment_dt ASC'); 
     734 
     735        $comments = $core->blog->getComments(array_merge($params, array('comment_trackback' => 0))); 
     736 
     737        echo 
     738        '<div id="comments" class="clear multi-part" title="' . __('Comments') . '">'; 
     739        $combo_action = $comments_actions_page->getCombo(); 
     740        $has_action   = !empty($combo_action) && !$comments->isEmpty(); 
     741        echo 
     742        '<p class="top-add"><a class="button add" href="#comment-form">' . __('Add a comment') . '</a></p>'; 
     743 
     744        if ($has_action) { 
     745            echo '<form action="' . $core->adminurl->get('admin.post') . '" id="form-comments" method="post">'; 
     746        } 
     747 
     748        echo '<h3>' . __('Comments') . '</h3>'; 
     749        if (!$comments->isEmpty()) { 
     750            $showComments($comments, $has_action); 
     751        } else { 
     752            echo '<p>' . __('No comments') . '</p>'; 
     753        } 
     754 
     755        if ($has_action) { 
     756            echo 
     757            '<div class="two-cols">' . 
     758            '<p class="col checkboxes-helpers"></p>' . 
     759 
     760            '<p class="col right"><label for="action" class="classic">' . __('Selected comments action:') . '</label> ' . 
     761            form::combo('action', $combo_action) . 
     762            form::hidden(array('section'), 'comments') . 
     763            form::hidden(array('id'), $post_id) . 
     764            $core->formNonce() . 
     765            '<input type="submit" value="' . __('ok') . '" /></p>' . 
     766                '</div>' . 
     767                '</form>'; 
     768        } 
     769        /* Add a comment 
     770        -------------------------------------------------------- */ 
     771 
     772        echo 
     773        '<div class="fieldset clear">' . 
     774        '<h3>' . __('Add a comment') . '</h3>' . 
     775 
     776        '<form action="' . $core->adminurl->get("admin.comment") . '" method="post" id="comment-form">' . 
     777        '<div class="constrained">' . 
     778        '<p><label for="comment_author" class="required"><abbr title="' . __('Required field') . '">*</abbr> ' . __('Name:') . '</label>' . 
     779        form::field('comment_author', 30, 255, html::escapeHTML($core->auth->getInfo('user_cn')), 
     780            '', '', false, 'required placeholder="' . __('Author') . '"') . 
     781        '</p>' . 
     782 
     783        '<p><label for="comment_email">' . __('Email:') . '</label>' . 
     784        form::field('comment_email', 30, 255, html::escapeHTML($core->auth->getInfo('user_email'))) . 
     785        '</p>' . 
     786 
     787        '<p><label for="comment_site">' . __('Web site:') . '</label>' . 
     788        form::field('comment_site', 30, 255, html::escapeHTML($core->auth->getInfo('user_url'))) . 
     789        '</p>' . 
     790 
     791        '<p class="area"><label for="comment_content" class="required"><abbr title="' . __('Required field') . '">*</abbr> ' . 
     792        __('Comment:') . '</label> ' . 
     793        form::textarea('comment_content', 50, 8, '', '', '', false, 'required placeholder="' . __('Comment') . '"') . 
     794        '</p>' . 
     795 
     796        '<p>' . 
     797        form::hidden('post_id', $post_id) . 
     798        $core->formNonce() . 
     799        '<input type="submit" name="add" value="' . __('Save') . '" /></p>' . 
     800        '</div>' . #constrained 
     801 
     802        '</form>' . 
     803        '</div>' . #add comment 
     804        '</div>'; #comments 
     805    } 
     806 
     807    if ($post_id && $post_status == 1) { 
     808        /* Trackbacks 
     809        -------------------------------------------------------- */ 
     810 
     811        $params     = array('post_id' => $post_id, 'order' => 'comment_dt ASC'); 
     812        $trackbacks = $core->blog->getComments(array_merge($params, array('comment_trackback' => 1))); 
     813 
     814        # Actions combo box 
     815        $combo_action = $comments_actions_page->getCombo(); 
     816        $has_action   = !empty($combo_action) && !$trackbacks->isEmpty(); 
     817 
     818        if (!empty($_GET['tb_auto'])) { 
     819            $tb_urls = implode("\n", $TB->discover($post_excerpt_xhtml . ' ' . $post_content_xhtml)); 
     820        } 
     821 
     822        # Display tab 
     823        echo 
     824        '<div id="trackbacks" class="clear multi-part" title="' . __('Trackbacks') . '">'; 
     825 
     826        # tracbacks actions 
     827        if ($has_action) { 
     828            echo '<form action="' . $core->adminurl->get("admin.post") . '" id="form-trackbacks" method="post">'; 
     829        } 
     830 
     831        echo '<h3>' . __('Trackbacks received') . '</h3>'; 
     832 
     833        if (!$trackbacks->isEmpty()) { 
     834            $showComments($trackbacks, $has_action, true); 
     835        } else { 
     836            echo '<p>' . __('No trackback') . '</p>'; 
     837        } 
     838 
     839        if ($has_action) { 
     840            echo 
     841            '<div class="two-cols">' . 
     842            '<p class="col checkboxes-helpers"></p>' . 
     843 
     844            '<p class="col right"><label for="action" class="classic">' . __('Selected trackbacks action:') . '</label> ' . 
     845            form::combo('action', $combo_action) . 
     846            form::hidden('id', $post_id) . 
     847            form::hidden(array('section'), 'trackbacks') . 
     848            $core->formNonce() . 
     849            '<input type="submit" value="' . __('ok') . '" /></p>' . 
     850                '</div>' . 
     851                '</form>'; 
     852        } 
     853 
     854        /* Add trackbacks 
     855        -------------------------------------------------------- */ 
     856        if ($can_edit_post && $post->post_status) { 
     857            echo 
     858                '<div class="fieldset clear">'; 
     859 
     860            echo 
     861            '<h3>' . __('Ping blogs') . '</h3>' . 
     862            '<form action="' . $core->adminurl->get("admin.post", array('id' => $post_id)) . '" id="trackback-form" method="post">' . 
     863            '<p><label for="tb_urls" class="area">' . __('URLs to ping:') . '</label>' . 
     864            form::textarea('tb_urls', 60, 5, $tb_urls) . 
     865            '</p>' . 
     866 
     867            '<p><label for="tb_excerpt" class="area">' . __('Excerpt to send:') . '</label>' . 
     868            form::textarea('tb_excerpt', 60, 5, $tb_excerpt) . '</p>' . 
     869 
     870            '<p>' . 
     871            $core->formNonce() . 
     872            '<input type="submit" name="ping" value="' . __('Ping blogs') . '" />' . 
     873                (empty($_GET['tb_auto']) ? 
     874                '&nbsp;&nbsp;<a class="button" href="' . 
     875                $core->adminurl->get("admin.post", array('id' => $post_id, 'tb_auto' => 1, 'tb' => 1)) . 
     876                '">' . __('Auto discover ping URLs') . '</a>' 
     877                : '') . 
    579878                '</p>' . 
    580                 ($core->auth->check('categories', $core->blog->id) ? 
    581                     '<div>' . 
    582                     '<h5 id="create_cat">' . __('Add a new category') . '</h5>' . 
    583                     '<p><label for="new_cat_title">' . __('Title:') . ' ' . 
    584                     form::field('new_cat_title', 30, 255, '', 'maximal') . '</label></p>' . 
    585                     '<p><label for="new_cat_parent">' . __('Parent:') . ' ' . 
    586                     form::combo('new_cat_parent', $categories_combo, '', 'maximal') . 
    587                     '</label></p>' . 
    588                     '</div>' 
    589                     : '') . 
    590                 '</div>')), 
    591         'options-box' => array( 
    592             'title' => __('Options'), 
    593             'items' => array( 
    594                 'post_open_comment_tb' => 
    595                 '<div>' . 
    596                 '<h5 id="label_comment_tb">' . __('Comments and trackbacks list') . '</h5>' . 
    597                 '<p><label for="post_open_comment" class="classic">' . 
    598                 form::checkbox('post_open_comment', 1, $post_open_comment) . ' ' . 
    599                 __('Accept comments') . '</label></p>' . 
    600                 ($core->blog->settings->system->allow_comments ? 
    601                     ($isContributionAllowed($post_id, strtotime($post_dt), true) ? 
    602                         '' : 
    603                         '<p class="form-note warn">' . 
    604                         __('Warning: Comments are not more accepted for this entry.') . '</p>') : 
    605                     '<p class="form-note warn">' . 
    606                     __('Comments are not accepted on this blog so far.') . '</p>') . 
    607                 '<p><label for="post_open_tb" class="classic">' . 
    608                 form::checkbox('post_open_tb', 1, $post_open_tb) . ' ' . 
    609                 __('Accept trackbacks') . '</label></p>' . 
    610                 ($core->blog->settings->system->allow_trackbacks ? 
    611                     ($isContributionAllowed($post_id, strtotime($post_dt), false) ? 
    612                         '' : 
    613                         '<p class="form-note warn">' . 
    614                         __('Warning: Trackbacks are not more accepted for this entry.') . '</p>') : 
    615                     '<p class="form-note warn">' . __('Trackbacks are not accepted on this blog so far.') . '</p>') . 
    616                 '</div>', 
    617                 'post_password'        => 
    618                 '<p><label for="post_password">' . __('Password') . '</label>' . 
    619                 form::field('post_password', 10, 32, html::escapeHTML($post_password), 'maximal') . 
    620                 '</p>', 
    621                 'post_url'             => 
    622                 '<div class="lockable">' . 
    623                 '<p><label for="post_url">' . __('Edit basename') . '</label>' . 
    624                 form::field('post_url', 10, 255, html::escapeHTML($post_url), 'maximal') . 
    625                 '</p>' . 
    626                 '<p class="form-note warn">' . 
    627                 __('Warning: If you set the URL manually, it may conflict with another entry.') . 
    628                 '</p></div>' 
    629             )))); 
    630  
    631     $main_items = new ArrayObject(array( 
    632         "post_title"   => 
    633         '<p class="col">' . 
    634         '<label class="required no-margin bold" for="post_title"><abbr title="' . __('Required field') . '">*</abbr> ' . __('Title:') . '</label>' . 
    635         form::field('post_title', 20, 255, html::escapeHTML($post_title), 'maximal', '', false, 'required placeholder="' . __('Title') . '"') . 
    636         '</p>', 
    637  
    638         "post_excerpt" => 
    639         '<p class="area" id="excerpt-area"><label for="post_excerpt" class="bold">' . __('Excerpt:') . ' <span class="form-note">' . 
    640         __('Introduction to the post.') . '</span></label> ' . 
    641         form::textarea('post_excerpt', 50, 5, html::escapeHTML($post_excerpt)) . 
    642         '</p>', 
    643  
    644         "post_content" => 
    645         '<p class="area" id="content-area"><label class="required bold" ' . 
    646         'for="post_content"><abbr title="' . __('Required field') . '">*</abbr> ' . __('Content:') . '</label> ' . 
    647         form::textarea('post_content', 50, $core->auth->getOption('edit_size'), html::escapeHTML($post_content), 
    648             '', '', false, 'required placeholder="' . __('Content') . '"') . 
    649         '</p>', 
    650  
    651         "post_notes"   => 
    652         '<p class="area" id="notes-area"><label for="post_notes" class="bold">' . __('Personal notes:') . ' <span class="form-note">' . 
    653         __('Unpublished notes.') . '</span></label>' . 
    654         form::textarea('post_notes', 50, 5, html::escapeHTML($post_notes)) . 
    655         '</p>' 
    656     ) 
    657     ); 
    658  
    659     # --BEHAVIOR-- adminPostFormItems 
    660     $core->callBehavior('adminPostFormItems', $main_items, $sidebar_items, isset($post) ? $post : null, 'post'); 
    661  
    662     echo '<div class="multi-part" title="' . ($post_id ? __('Edit entry') : __('New entry')) . 
    663     sprintf(' &rsaquo; %s', $post_format) . '" id="edit-entry">'; 
    664     echo '<form action="' . $core->adminurl->get('admin.post') . '" method="post" id="entry-form">'; 
    665     echo '<div id="entry-wrapper">'; 
    666     echo '<div id="entry-content"><div class="constrained">'; 
    667  
    668     echo '<h3 class="out-of-screen-if-js">' . __('Edit post') . '</h3>'; 
    669  
    670     foreach ($main_items as $id => $item) { 
    671         echo $item; 
    672     } 
    673  
    674     # --BEHAVIOR-- adminPostForm (may be deprecated) 
    675     $core->callBehavior('adminPostForm', isset($post) ? $post : null, 'post'); 
    676  
    677     echo 
    678     '<p class="border-top">' . 
    679     ($post_id ? form::hidden('id', $post_id) : '') . 
    680     '<input type="submit" value="' . __('Save') . ' (s)" ' . 
    681         'accesskey="s" name="save" /> '; 
    682     if ($post_id) { 
    683         $preview_url = 
    684         $core->blog->url . $core->url->getURLFor('preview', $core->auth->userID() . '/' . 
    685             http::browserUID(DC_MASTER_KEY . $core->auth->userID() . $core->auth->cryptLegacy($core->auth->userID())) . 
    686             '/' . $post->post_url); 
    687         echo '<a id="post-preview" href="' . $preview_url . '" class="button modal" accesskey="p">' . __('Preview') . ' (p)' . '</a>'; 
    688     } else { 
    689         echo 
    690         '<a id="post-cancel" href="' . $core->adminurl->get("admin.home") . '" class="button" accesskey="c">' . __('Cancel') . ' (c)</a>'; 
    691     } 
    692  
    693     echo 
    694     ($can_delete ? ' <input type="submit" class="delete" value="' . __('Delete') . '" name="delete" />' : '') . 
    695     $core->formNonce() . 
    696         '</p>'; 
    697  
    698     echo '</div></div>'; // End #entry-content 
    699     echo '</div>';       // End #entry-wrapper 
    700  
    701     echo '<div id="entry-sidebar" role="complementary">'; 
    702  
    703     foreach ($sidebar_items as $id => $c) { 
    704         echo '<div id="' . $id . '" class="sb-box">' . 
    705             '<h4>' . $c['title'] . '</h4>'; 
    706         foreach ($c['items'] as $e_name => $e_content) { 
    707             echo $e_content; 
    708         } 
    709         echo '</div>'; 
    710     } 
    711  
    712     # --BEHAVIOR-- adminPostFormSidebar (may be deprecated) 
    713     $core->callBehavior('adminPostFormSidebar', isset($post) ? $post : null, 'post'); 
    714     echo '</div>'; // End #entry-sidebar 
    715  
    716     echo '</form>'; 
    717  
    718     # --BEHAVIOR-- adminPostForm 
    719     $core->callBehavior('adminPostAfterForm', isset($post) ? $post : null, 'post'); 
    720  
    721     echo '</div>'; 
    722 } 
    723  
    724 if ($post_id) { 
    725     /* Comments 
    726     -------------------------------------------------------- */ 
    727  
    728     $params = array('post_id' => $post_id, 'order' => 'comment_dt ASC'); 
    729  
    730     $comments = $core->blog->getComments(array_merge($params, array('comment_trackback' => 0))); 
    731  
    732     echo 
    733     '<div id="comments" class="clear multi-part" title="' . __('Comments') . '">'; 
    734     $combo_action = $comments_actions_page->getCombo(); 
    735     $has_action   = !empty($combo_action) && !$comments->isEmpty(); 
    736     echo 
    737     '<p class="top-add"><a class="button add" href="#comment-form">' . __('Add a comment') . '</a></p>'; 
    738  
    739     if ($has_action) { 
    740         echo '<form action="' . $core->adminurl->get('admin.post') . '" id="form-comments" method="post">'; 
    741     } 
    742  
    743     echo '<h3>' . __('Comments') . '</h3>'; 
    744     if (!$comments->isEmpty()) { 
    745         $showComments($comments, $has_action); 
    746     } else { 
    747         echo '<p>' . __('No comments') . '</p>'; 
    748     } 
    749  
    750     if ($has_action) { 
    751         echo 
    752         '<div class="two-cols">' . 
    753         '<p class="col checkboxes-helpers"></p>' . 
    754  
    755         '<p class="col right"><label for="action" class="classic">' . __('Selected comments action:') . '</label> ' . 
    756         form::combo('action', $combo_action) . 
    757         form::hidden(array('section'), 'comments') . 
    758         form::hidden(array('id'), $post_id) . 
    759         $core->formNonce() . 
    760         '<input type="submit" value="' . __('ok') . '" /></p>' . 
    761             '</div>' . 
    762             '</form>'; 
    763     } 
    764     /* Add a comment 
    765     -------------------------------------------------------- */ 
    766  
    767     echo 
    768     '<div class="fieldset clear">' . 
    769     '<h3>' . __('Add a comment') . '</h3>' . 
    770  
    771     '<form action="' . $core->adminurl->get("admin.comment") . '" method="post" id="comment-form">' . 
    772     '<div class="constrained">' . 
    773     '<p><label for="comment_author" class="required"><abbr title="' . __('Required field') . '">*</abbr> ' . __('Name:') . '</label>' . 
    774     form::field('comment_author', 30, 255, html::escapeHTML($core->auth->getInfo('user_cn')), 
    775         '', '', false, 'required placeholder="' . __('Author') . '"') . 
    776     '</p>' . 
    777  
    778     '<p><label for="comment_email">' . __('Email:') . '</label>' . 
    779     form::field('comment_email', 30, 255, html::escapeHTML($core->auth->getInfo('user_email'))) . 
    780     '</p>' . 
    781  
    782     '<p><label for="comment_site">' . __('Web site:') . '</label>' . 
    783     form::field('comment_site', 30, 255, html::escapeHTML($core->auth->getInfo('user_url'))) . 
    784     '</p>' . 
    785  
    786     '<p class="area"><label for="comment_content" class="required"><abbr title="' . __('Required field') . '">*</abbr> ' . 
    787     __('Comment:') . '</label> ' . 
    788     form::textarea('comment_content', 50, 8, '', '', '', false, 'required placeholder="' . __('Comment') . '"') . 
    789     '</p>' . 
    790  
    791     '<p>' . 
    792     form::hidden('post_id', $post_id) . 
    793     $core->formNonce() . 
    794     '<input type="submit" name="add" value="' . __('Save') . '" /></p>' . 
    795     '</div>' . #constrained 
    796  
    797     '</form>' . 
    798     '</div>' . #add comment 
    799     '</div>'; #comments 
    800 } 
    801  
    802 if ($post_id && $post_status == 1) { 
    803     /* Trackbacks 
    804     -------------------------------------------------------- */ 
    805  
    806     $params     = array('post_id' => $post_id, 'order' => 'comment_dt ASC'); 
    807     $trackbacks = $core->blog->getComments(array_merge($params, array('comment_trackback' => 1))); 
    808  
    809     # Actions combo box 
    810     $combo_action = $comments_actions_page->getCombo(); 
    811     $has_action   = !empty($combo_action) && !$trackbacks->isEmpty(); 
    812  
    813     if (!empty($_GET['tb_auto'])) { 
    814         $tb_urls = implode("\n", $TB->discover($post_excerpt_xhtml . ' ' . $post_content_xhtml)); 
    815     } 
    816  
    817     # Display tab 
    818     echo 
    819     '<div id="trackbacks" class="clear multi-part" title="' . __('Trackbacks') . '">'; 
    820  
    821     # tracbacks actions 
    822     if ($has_action) { 
    823         echo '<form action="' . $core->adminurl->get("admin.post") . '" id="form-trackbacks" method="post">'; 
    824     } 
    825  
    826     echo '<h3>' . __('Trackbacks received') . '</h3>'; 
    827  
    828     if (!$trackbacks->isEmpty()) { 
    829         $showComments($trackbacks, $has_action, true); 
    830     } else { 
    831         echo '<p>' . __('No trackback') . '</p>'; 
    832     } 
    833  
    834     if ($has_action) { 
    835         echo 
    836         '<div class="two-cols">' . 
    837         '<p class="col checkboxes-helpers"></p>' . 
    838  
    839         '<p class="col right"><label for="action" class="classic">' . __('Selected trackbacks action:') . '</label> ' . 
    840         form::combo('action', $combo_action) . 
    841         form::hidden('id', $post_id) . 
    842         form::hidden(array('section'), 'trackbacks') . 
    843         $core->formNonce() . 
    844         '<input type="submit" value="' . __('ok') . '" /></p>' . 
    845             '</div>' . 
    846             '</form>'; 
    847     } 
    848  
    849     /* Add trackbacks 
    850     -------------------------------------------------------- */ 
    851     if ($can_edit_post && $post->post_status) { 
    852         echo 
    853             '<div class="fieldset clear">'; 
    854  
    855         echo 
    856         '<h3>' . __('Ping blogs') . '</h3>' . 
    857         '<form action="' . $core->adminurl->get("admin.post", array('id' => $post_id)) . '" id="trackback-form" method="post">' . 
    858         '<p><label for="tb_urls" class="area">' . __('URLs to ping:') . '</label>' . 
    859         form::textarea('tb_urls', 60, 5, $tb_urls) . 
    860         '</p>' . 
    861  
    862         '<p><label for="tb_excerpt" class="area">' . __('Excerpt to send:') . '</label>' . 
    863         form::textarea('tb_excerpt', 60, 5, $tb_excerpt) . '</p>' . 
    864  
    865         '<p>' . 
    866         $core->formNonce() . 
    867         '<input type="submit" name="ping" value="' . __('Ping blogs') . '" />' . 
    868             (empty($_GET['tb_auto']) ? 
    869             '&nbsp;&nbsp;<a class="button" href="' . 
    870             $core->adminurl->get("admin.post", array('id' => $post_id, 'tb_auto' => 1, 'tb' => 1)) . 
    871             '">' . __('Auto discover ping URLs') . '</a>' 
    872             : '') . 
    873             '</p>' . 
    874             '</form>'; 
    875  
    876         $pings = $TB->getPostPings($post_id); 
    877  
    878         if (!$pings->isEmpty()) { 
    879             echo '<h3>' . __('Previously sent pings') . '</h3>'; 
    880  
    881             echo '<ul class="nice">'; 
    882             while ($pings->fetch()) { 
    883                 echo 
    884                 '<li>' . dt::dt2str(__('%Y-%m-%d %H:%M'), $pings->ping_dt) . ' - ' . 
    885                 $pings->ping_url . '</li>'; 
     879                '</form>'; 
     880 
     881            $pings = $TB->getPostPings($post_id); 
     882 
     883            if (!$pings->isEmpty()) { 
     884                echo '<h3>' . __('Previously sent pings') . '</h3>'; 
     885 
     886                echo '<ul class="nice">'; 
     887                while ($pings->fetch()) { 
     888                    echo 
     889                    '<li>' . dt::dt2str(__('%Y-%m-%d %H:%M'), $pings->ping_dt) . ' - ' . 
     890                    $pings->ping_url . '</li>'; 
     891                } 
     892                echo '</ul>'; 
    886893            } 
    887             echo '</ul>'; 
    888         } 
    889  
    890         echo '</div>'; 
    891     } 
    892  
    893     echo '</div>'; #trackbacks 
    894 } 
    895  
    896 dcPage::helpBlock('core_post', 'core_trackbacks', 'core_wiki'); 
    897 dcPage::close(); 
     894 
     895            echo '</div>'; 
     896        } 
     897 
     898        echo '</div>'; #trackbacks 
     899    } 
     900 
     901    dcPage::helpBlock('core_post', 'core_trackbacks', 'core_wiki'); 
     902    dcPage::close(); 
  • admin/user.php

    r3699 r3707  
    248248echo 
    249249'<p><label for="user_super" class="classic">' . 
    250 form::checkbox(($super_disabled ? 'user_super_off' : 'user_super'), '1', $user_super, '', '', $super_disabled) . 
     250form::checkbox(($super_disabled ? 'user_super_off' : 'user_super'), '1', 
     251    array( 
     252        'checked'  => $user_super, 
     253        'disabled' => $super_disabled 
     254    )) . 
    251255' ' . __('Super administrator') . '</label></p>' . 
    252256($super_disabled ? form::hidden(array('user_super'), $user_super) : '') . 
  • admin/users_actions.php

    r3699 r3707  
    204204            '<tr class="line">' . 
    205205            '<td class="nowrap">' . 
    206             form::checkbox(array('blogs[]'), $rs->blog_id, '', '', '', false, 'title="' . __('select') . ' ' . $rs->blog_id . '"') . '</td>' . 
     206            form::checkbox(array('blogs[]'), $rs->blog_id, 
     207                array( 
     208                    'extra_html' => 'title="' . __('select') . ' ' . $rs->blog_id . '"' 
     209                )) . 
     210            '</td>' . 
    207211            '<td class="nowrap">' . $rs->blog_id . '</td>' . 
    208212            '<td class="maximal">' . html::escapeHTML($rs->blog_name) . '</td>' . 
Note: See TracChangeset for help on using the changeset viewer.

Sites map