Changeset 2320:89c91e538879
- Timestamp:
- 10/09/13 09:30:33 (12 years ago)
- Branch:
- default
- Children:
- 2322:a75984c93a86, 2406:325f49056c79
- Location:
- admin
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/js/_media.js
r2266 r2320 144 144 }); 145 145 146 // attach media 147 $('#form-medias').on('click', '.media-item .attach-media', function(e) { 148 var parts = $(this).prop('href').split('?'); 149 var str_params = parts[1].split('&'); 150 var postData = {}; 151 152 for (var n=0;n<str_params.length;n++) { 153 kv = str_params[n].split('='); 154 postData[kv[0]] = kv[1]; 155 } 156 postData.xd_check = dotclear.nonce; 157 158 $.post(parts[0], postData, function(data) { 159 if (data.url !== undefined) { 160 document.location = data.url; 161 } 162 }); 163 164 e.preventDefault(); 165 }); 166 146 167 // Replace remove links by a POST on hidden form 147 168 fileRemoveAct(); -
admin/media.php
r2263 r2320 584 584 if ($post_id && !$f->d) { 585 585 $act .= 586 '<form action="post_media.php" method="post">'. 587 '<input type="image" src="images/plus.png" alt="'.__('Attach this file to entry').'" '. 588 'title="'.__('Attach this file to entry').'" /> '. 589 form::hidden('media_id',$f->media_id). 590 form::hidden('post_id',$post_id). 591 form::hidden('attach',1). 592 $core->formNonce(). 593 '</form>'; 586 '<a class="attach-media" title="'.__('Attach this file to entry').'" href="post_media.php?media_id='.$f->media_id. 587 '&post_id='.$post_id.'&attach=1">'. 588 '<img src="images/plus.png" alt="'.__('Attach this file to entry').'"/>'. 589 '</a>'; 594 590 } 595 591 … … 622 618 return $res; 623 619 } 624 ?> -
admin/post_media.php
r2256 r2320 27 27 28 28 try { 29 if ($post_id && $media_id && !empty($_ POST['attach']))29 if ($post_id && $media_id && !empty($_REQUEST['attach'])) 30 30 { 31 31 $core->media = new dcMedia($core); 32 32 $core->media->addPostMedia($post_id,$media_id); 33 http::redirect($core->getPostAdminURL($rs->post_type,$post_id,false)); 33 if (!empty($_SERVER['HTTP_X_REQUESTED_WITH'])) { 34 header('Content-type: application/json'); 35 echo json_encode(array('url' => $core->getPostAdminURL($rs->post_type,$post_id,false))); 36 exit(); 37 } else { 38 http::redirect($core->getPostAdminURL($rs->post_type,$post_id,false)); 39 } 34 40 } 35 41 … … 79 85 } 80 86 } 81 ?> -
admin/style/default.css
r2308 r2320 1795 1795 border: none; 1796 1796 } 1797 li.media-action a.attach-media { 1798 margin-right: 5px; 1799 } 1797 1800 li.media-action form { 1798 1801 display: inline;
Note: See TracChangeset
for help on using the changeset viewer.