Changeset 3702:7f0243dc7876
- Timestamp:
- 02/15/18 13:06:24 (8 years ago)
- Branch:
- default
- Location:
- admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/js/_media_item.js
r3701 r3702 1 1 $(function() { 2 3 4 5 6 7 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 } 9 9 10 // Preview media 11 $('.modal-image').magnificPopup({ type:'image' }); 10 // Preview media 11 $('.modal-image').magnificPopup({ 12 type: 'image' 13 }); 12 14 13 14 15 16 17 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); 18 20 19 20 21 22 21 a.href = '#'; 22 $(a).text(dotclear.msg.zip_file_content); 23 self.before(a); 24 $(a).wrap('<p></p>'); 23 25 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]; 27 32 28 29 30 31 33 if (rsp.attributes[0].value == 'ok') { 34 var div = document.createElement('div'); 35 var list = document.createElement('ul'); 36 var expanded = false; 32 37 33 34 35 36 37 38 39 40 41 42 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>'); 43 48 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 }); 58 65 59 60 61 62 63 64 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 }); 66 73 67 68 69 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 }); 71 78 72 73 74 75 76 77 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 }); 79 86 80 87 // Set focus if in popup mode -
admin/popup_posts.php
r3701 r3702 11 11 # -- END LICENSE BLOCK ----------------------------------------- 12 12 13 require dirname(__FILE__) .'/../inc/admin/prepend.php';13 require dirname(__FILE__) . '/../inc/admin/prepend.php'; 14 14 15 15 dcPage::check('usage,contentadmin'); 16 16 17 $q = !empty($_GET['q']) ? $_GET['q'] : null;17 $q = !empty($_GET['q']) ? $_GET['q'] : null; 18 18 $plugin_id = !empty($_GET['plugin_id']) ? html::sanitizeURL($_GET['plugin_id']) : ''; 19 19 20 $page = !empty($_GET['page']) ? max(1,(integer) $_GET['page']) : 1;21 $nb_per_page = 20 $page = !empty($_GET['page']) ? max(1, (integer) $_GET['page']) : 1; 21 $nb_per_page = 10; 22 22 23 23 $type = !empty($_GET['type']) ? $_GET['type'] : null; … … 25 25 $post_types = $core->getPostTypes(); 26 26 foreach ($post_types as $k => $v) { 27 27 $type_combo[__($k)] = (string) $k; 28 28 } 29 29 if (!in_array($type, $type_combo)) { 30 30 $type = null; 31 31 } 32 32 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); 35 35 $params['no_content'] = true; 36 $params['order'] = 'post_dt DESC';36 $params['order'] = 'post_dt DESC'; 37 37 38 38 if ($q) { 39 39 $params['search'] = $q; 40 40 } 41 41 42 42 if ($type) { 43 43 $params['post_type'] = $type; 44 44 } 45 45 46 46 dcPage::openPopup(__('Add a link to an entry'), 47 dcPage::jsLoad('js/_posts_list.js').48 dcPage::jsLoad('js/_popup_posts.js') .49 47 dcPage::jsLoad('js/_posts_list.js') . 48 dcPage::jsLoad('js/_popup_posts.js') . 49 $core->callBehavior('adminPopupPosts', $plugin_id)); 50 50 51 echo '<h2 class="page-title">' .__('Add a link to an entry').'</h2>';51 echo '<h2 class="page-title">' . __('Add a link to an entry') . '</h2>'; 52 52 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 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>'; 58 58 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 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>'; 65 65 66 66 try { 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)); 70 70 } catch (Exception $e) { 71 71 $core->error->add($e->getMessage()); 72 72 } 73 73 74 74 echo '<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); 76 76 echo '</div>'; 77 77 78 echo '<p><button type="button" id="link-insert-cancel">' .__('cancel').'</button></p>';78 echo '<p><button type="button" id="link-insert-cancel">' . __('cancel') . '</button></p>'; 79 79 80 80 dcPage::closePopup();
Note: See TracChangeset
for help on using the changeset viewer.