Dotclear

Changeset 3702:7f0243dc7876


Ignore:
Timestamp:
02/15/18 13:06:24 (8 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Code formatting

Location:
admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • admin/js/_media_item.js

    r3701 r3702  
    11$(function() { 
    2      // Add datePicker if possible 
    3      var media_dt = document.getElementById('media_dt'); 
    4      if (media_dt != undefined) { 
    5           var post_dtPick = new datePicker(media_dt); 
    6           post_dtPick.img_top = '1.5em'; 
    7           post_dtPick.draw(); 
    8      } 
     2  // Add datePicker if possible 
     3  var media_dt = document.getElementById('media_dt'); 
     4  if (media_dt != undefined) { 
     5    var post_dtPick = new datePicker(media_dt); 
     6    post_dtPick.img_top = '1.5em'; 
     7    post_dtPick.draw(); 
     8  } 
    99 
    10      // Preview media 
    11      $('.modal-image').magnificPopup({ type:'image' }); 
     10  // Preview media 
     11  $('.modal-image').magnificPopup({ 
     12    type: 'image' 
     13  }); 
    1214 
    13      // Display zip file content 
    14      $('#file-unzip').each(function() { 
    15           var a = document.createElement('a'); 
    16           var mediaId = $(this).find('input[name=id]').val(); 
    17           var self = $(this); 
     15  // Display zip file content 
     16  $('#file-unzip').each(function() { 
     17    var a = document.createElement('a'); 
     18    var mediaId = $(this).find('input[name=id]').val(); 
     19    var self = $(this); 
    1820 
    19           a.href = '#'; 
    20           $(a).text(dotclear.msg.zip_file_content); 
    21           self.before(a); 
    22           $(a).wrap('<p></p>'); 
     21    a.href = '#'; 
     22    $(a).text(dotclear.msg.zip_file_content); 
     23    self.before(a); 
     24    $(a).wrap('<p></p>'); 
    2325 
    24           $(a).click(function() { 
    25                $.get('services.php',{f:'getZipMediaContent',id: mediaId},function(data) { 
    26                     var rsp = $(data).children('rsp')[0]; 
     26    $(a).click(function() { 
     27      $.get('services.php', { 
     28        f: 'getZipMediaContent', 
     29        id: mediaId 
     30      }, function(data) { 
     31        var rsp = $(data).children('rsp')[0]; 
    2732 
    28                     if (rsp.attributes[0].value == 'ok') { 
    29                          var div = document.createElement('div'); 
    30                          var list = document.createElement('ul'); 
    31                          var expanded = false; 
     33        if (rsp.attributes[0].value == 'ok') { 
     34          var div = document.createElement('div'); 
     35          var list = document.createElement('ul'); 
     36          var expanded = false; 
    3237 
    33                          $(div).css({ 
    34                               overflow: 'auto', 
    35                               margin: '1em 0', 
    36                               padding: '1px 0.5em' 
    37                          }); 
    38                          $(div).addClass('color-div'); 
    39                          $(div).append(list); 
    40                          self.before(div); 
    41                          $(a).hide(); 
    42                          $(div).before('<h3>' + dotclear.msg.zip_file_content + '</h3>'); 
     38          $(div).css({ 
     39            overflow: 'auto', 
     40            margin: '1em 0', 
     41            padding: '1px 0.5em' 
     42          }); 
     43          $(div).addClass('color-div'); 
     44          $(div).append(list); 
     45          self.before(div); 
     46          $(a).hide(); 
     47          $(div).before('<h3>' + dotclear.msg.zip_file_content + '</h3>'); 
    4348 
    44                          $(rsp).find('file').each(function() { 
    45                               $(list).append('<li>' + $(this).text() + '</li>'); 
    46                               if ($(div).height() > 200 && !expanded) { 
    47                                    $(div).css({height: '200px'}); 
    48                                    expanded = true; 
    49                               } 
    50                          }); 
    51                     } else { 
    52                          alert($(rsp).find('message').text()); 
    53                     } 
    54                }); 
    55                return false; 
    56           }); 
    57      }); 
     49          $(rsp).find('file').each(function() { 
     50            $(list).append('<li>' + $(this).text() + '</li>'); 
     51            if ($(div).height() > 200 && !expanded) { 
     52              $(div).css({ 
     53                height: '200px' 
     54              }); 
     55              expanded = true; 
     56            } 
     57          }); 
     58        } else { 
     59          alert($(rsp).find('message').text()); 
     60        } 
     61      }); 
     62      return false; 
     63    }); 
     64  }); 
    5865 
    59      // Confirm for inflating in current directory 
    60      $('#file-unzip').submit(function() { 
    61           if ($(this).find('#inflate_mode').val() == 'current') { 
    62                return window.confirm(dotclear.msg.confirm_extract_current); 
    63           } 
    64           return true; 
    65      }); 
     66  // Confirm for inflating in current directory 
     67  $('#file-unzip').submit(function() { 
     68    if ($(this).find('#inflate_mode').val() == 'current') { 
     69      return window.confirm(dotclear.msg.confirm_extract_current); 
     70    } 
     71    return true; 
     72  }); 
    6673 
    67      // Confirm for deleting current medoa 
    68      $('#delete-form input[name="delete"]').click(function() { 
    69           return window.confirm(dotclear.msg.confirm_delete_media); 
    70      }); 
     74  // Confirm for deleting current medoa 
     75  $('#delete-form input[name="delete"]').click(function() { 
     76    return window.confirm(dotclear.msg.confirm_delete_media); 
     77  }); 
    7178 
    72      // Get current insertion settings 
    73      $('#save_settings').submit(function() { 
    74           $('input[name="pref_src"]').val($('input[name="src"][type=radio]:checked').attr('value')); 
    75           $('input[name="pref_alignment"]').val($('input[name="alignment"][type=radio]:checked').attr('value')); 
    76           $('input[name="pref_insertion"]').val($('input[name="insertion"][type=radio]:checked').attr('value')); 
    77           $('input[name="pref_legend"]').val($('input[name="legend"][type=radio]:checked').attr('value')); 
    78      }); 
     79  // Get current insertion settings 
     80  $('#save_settings').submit(function() { 
     81    $('input[name="pref_src"]').val($('input[name="src"][type=radio]:checked').attr('value')); 
     82    $('input[name="pref_alignment"]').val($('input[name="alignment"][type=radio]:checked').attr('value')); 
     83    $('input[name="pref_insertion"]').val($('input[name="insertion"][type=radio]:checked').attr('value')); 
     84    $('input[name="pref_legend"]').val($('input[name="legend"][type=radio]:checked').attr('value')); 
     85  }); 
    7986 
    8087  // Set focus if in popup mode 
  • admin/popup_posts.php

    r3701 r3702  
    1111# -- END LICENSE BLOCK ----------------------------------------- 
    1212 
    13 require dirname(__FILE__).'/../inc/admin/prepend.php'; 
     13require dirname(__FILE__) . '/../inc/admin/prepend.php'; 
    1414 
    1515dcPage::check('usage,contentadmin'); 
    1616 
    17 $q = !empty($_GET['q']) ? $_GET['q'] : null; 
     17$q         = !empty($_GET['q']) ? $_GET['q'] : null; 
    1818$plugin_id = !empty($_GET['plugin_id']) ? html::sanitizeURL($_GET['plugin_id']) : ''; 
    1919 
    20 $page = !empty($_GET['page']) ? max(1,(integer) $_GET['page']) : 1; 
    21 $nb_per_page =  10; 
     20$page        = !empty($_GET['page']) ? max(1, (integer) $_GET['page']) : 1; 
     21$nb_per_page = 10; 
    2222 
    2323$type = !empty($_GET['type']) ? $_GET['type'] : null; 
     
    2525$post_types = $core->getPostTypes(); 
    2626foreach ($post_types as $k => $v) { 
    27      $type_combo[__($k)] = (string) $k; 
     27    $type_combo[__($k)] = (string) $k; 
    2828} 
    2929if (!in_array($type, $type_combo)) { 
    30      $type = null; 
     30    $type = null; 
    3131} 
    3232 
    33 $params = array(); 
    34 $params['limit'] = array((($page-1)*$nb_per_page),$nb_per_page); 
     33$params               = array(); 
     34$params['limit']      = array((($page - 1) * $nb_per_page), $nb_per_page); 
    3535$params['no_content'] = true; 
    36 $params['order'] = 'post_dt DESC'; 
     36$params['order']      = 'post_dt DESC'; 
    3737 
    3838if ($q) { 
    39      $params['search'] = $q; 
     39    $params['search'] = $q; 
    4040} 
    4141 
    4242if ($type) { 
    43      $params['post_type'] = $type; 
     43    $params['post_type'] = $type; 
    4444} 
    4545 
    4646dcPage::openPopup(__('Add a link to an entry'), 
    47      dcPage::jsLoad('js/_posts_list.js'). 
    48     dcPage::jsLoad('js/_popup_posts.js'). 
    49      $core->callBehavior('adminPopupPosts', $plugin_id)); 
     47    dcPage::jsLoad('js/_posts_list.js') . 
     48    dcPage::jsLoad('js/_popup_posts.js') . 
     49    $core->callBehavior('adminPopupPosts', $plugin_id)); 
    5050 
    51 echo '<h2 class="page-title">'.__('Add a link to an entry').'</h2>'; 
     51echo '<h2 class="page-title">' . __('Add a link to an entry') . '</h2>'; 
    5252 
    53 echo '<form action="'.$core->adminurl->get('admin.popup_posts').'" method="get">'. 
    54      '<p><label for="type" class="classic">'.__('Entry type:').'</label> '.form::combo('type',$type_combo,$type).''. 
    55      '<noscript><div><input type="submit" value="'.__('Ok').'" /></div></noscript>'. 
    56      form::hidden('plugin_id',html::escapeHTML($plugin_id)).'</p>'. 
    57      '</form>'; 
     53echo '<form action="' . $core->adminurl->get('admin.popup_posts') . '" method="get">' . 
     54'<p><label for="type" class="classic">' . __('Entry type:') . '</label> ' . form::combo('type', $type_combo, $type) . '' . 
     55'<noscript><div><input type="submit" value="' . __('Ok') . '" /></div></noscript>' . 
     56form::hidden('plugin_id', html::escapeHTML($plugin_id)) . '</p>' . 
     57    '</form>'; 
    5858 
    59 echo '<form action="'.$core->adminurl->get('admin.popup_posts').'" method="get">'. 
    60      '<p><label for="q" class="classic">'.__('Search entry:').'</label> '.form::field('q',30,255,html::escapeHTML($q)). 
    61      ' <input type="submit" value="'.__('Search').'" />'. 
    62      form::hidden('plugin_id',html::escapeHTML($plugin_id)). 
    63      form::hidden('type',html::escapeHTML($type)). 
    64      '</p></form>'; 
     59echo '<form action="' . $core->adminurl->get('admin.popup_posts') . '" method="get">' . 
     60'<p><label for="q" class="classic">' . __('Search entry:') . '</label> ' . form::field('q', 30, 255, html::escapeHTML($q)) . 
     61' <input type="submit" value="' . __('Search') . '" />' . 
     62form::hidden('plugin_id', html::escapeHTML($plugin_id)) . 
     63form::hidden('type', html::escapeHTML($type)) . 
     64    '</p></form>'; 
    6565 
    6666try { 
    67      $posts = $core->blog->getPosts($params); 
    68      $counter = $core->blog->getPosts($params,true); 
    69      $post_list = new adminPostMiniList($core,$posts,$counter->f(0)); 
     67    $posts    = $core->blog->getPosts($params); 
     68    $counter   = $core->blog->getPosts($params, true); 
     69    $post_list = new adminPostMiniList($core, $posts, $counter->f(0)); 
    7070} catch (Exception $e) { 
    71      $core->error->add($e->getMessage()); 
     71    $core->error->add($e->getMessage()); 
    7272} 
    7373 
    7474echo '<div id="form-entries">'; # I know it's not a form but we just need the ID 
    75 $post_list->display($page,$nb_per_page); 
     75$post_list->display($page, $nb_per_page); 
    7676echo '</div>'; 
    7777 
    78 echo '<p><button type="button" id="link-insert-cancel">'.__('cancel').'</button></p>'; 
     78echo '<p><button type="button" id="link-insert-cancel">' . __('cancel') . '</button></p>'; 
    7979 
    8080dcPage::closePopup(); 
Note: See TracChangeset for help on using the changeset viewer.

Sites map