Changeset 2429
- Timestamp:
- Jul 12, 2008, 2:30:27 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/ws_functions.inc.php
r2413 r2429 281 281 } 282 282 283 function ws_caddie_add($params, &$service) 284 { 285 if (!is_admin()) 286 { 287 return new PwgError(401, 'Access denied'); 288 } 289 if ( empty($params['image_id']) ) 290 { 291 return new PwgError(WS_ERR_INVALID_PARAM, "Invalid image_id"); 292 } 293 global $user; 294 $query = ' 295 SELECT id 296 FROM '.IMAGES_TABLE.' LEFT JOIN '.CADDIE_TABLE.' ON id=element_id AND user_id='.$user['id'].' 297 WHERE id IN ('.implode(',',$params['image_id']).') 298 AND element_id IS NULL'; 299 $datas = array(); 300 foreach ( array_from_query($query, 'id') as $id ) 301 { 302 array_push($datas, array('element_id'=>$id, 'user_id'=>$user['id']) ); 303 } 304 if (count($datas)) 305 { 306 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); 307 mass_inserts(CADDIE_TABLE, array('element_id','user_id'), $datas); 308 } 309 return count($datas); 310 } 283 311 284 312 /** -
trunk/template-common/scripts.js
r2413 r2429 5 5 for( i = 0; i < len; i++) 6 6 { 7 8 9 10 formulaire.elements[i].checked = true;11 7 if ( formulaire.elements[i].type=='checkbox' 8 && formulaire.elements[i].name != 'copie') 9 { 10 formulaire.elements[i].checked = true; 11 } 12 12 } 13 13 } … … 19 19 for( i = 0; i < len; i++) 20 20 { 21 22 23 21 if ( formulaire.elements[i].type=='checkbox' 22 && formulaire.elements[i].name != 'copie') 23 { 24 24 formulaire.elements[i].checked = false; 25 25 } 26 26 } 27 27 } … … 33 33 for( i=0; i<len; i++) 34 34 { 35 36 37 35 if ( formulaire.elements[i].type=='checkbox' 36 && formulaire.elements[i].name != 'copie') 37 { 38 38 formulaire.elements[i].checked = !formulaire.elements[i].checked; 39 39 } 40 40 } 41 41 } … … 43 43 function phpWGOpenWindow(theURL,winName,features) 44 44 { 45 46 47 48 49 50 51 52 53 54 55 56 57 58 45 img = new Image(); 46 img.src = theURL; 47 if (img.complete) 48 { 49 var width=img.width +40; 50 var height=img.height +40; 51 } 52 else 53 { 54 var width=640; 55 var height=480; 56 img.onload = resizeWindowToFit; 57 } 58 newWin = window.open(theURL,winName,features+',left=2,top=1,width=' + width + ',height=' + height); 59 59 } 60 60 61 61 function resizeWindowToFit() 62 62 { 63 63 newWin.resizeTo( img.width+50, img.height+100); 64 64 } 65 65 66 66 function popuphelp(url) 67 67 { 68 window.open( 69 url, 70 'dc_popup', 71 'alwaysRaised=yes,dependent=yes,toolbar=no,height=420,width=500,menubar=no,resizable=yes,scrollbars=yes,status=no' 72 ); 68 window.open( url, 'dc_popup', 69 'alwaysRaised=yes,dependent=yes,toolbar=no,height=420,width=500,menubar=no,resizable=yes,scrollbars=yes,status=no' 70 ); 73 71 } 74 72 … … 155 153 catch (e) 156 154 { 157 this.dispatchError( 200, e.message + '\n' + transport.responseText.substr(0, 256).escapeHTML() );155 this.dispatchError( 200, e.message + '\n' + transport.responseText.substr(0,512) ); 158 156 } 159 157 if (resp!=null) -
trunk/template/yoga/picture.tpl
r2413 r2429 55 55 <a href="{$U_ADMIN}" title="{'link_info_image'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/preferences.png" class="button" alt="{'edit'|@translate}"></a> 56 56 {/if} 57 {if isset($U_CADDIE) } 58 <a href="{$U_CADDIE}" title="{'add to caddie'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/caddie_add.png" class="button" alt="{'caddie'|@translate}"></a> 59 {/if} 57 {if isset($U_CADDIE) }{*caddie management BEGIN*} 58 <script type="text/javascript"> 59 {literal}function addToCadie(aElement, rootUrl, id) 60 { 61 if (aElement.disabled) return; 62 aElement.disabled=true; 63 var y = new PwgWS(rootUrl); 64 65 y.callService( 66 "pwg.caddie.add", {image_id: id} , 67 { 68 onFailure: function(num, text) { alert(num + " " + text); document.location=aElement.href; }, 69 onSuccess: function(result) { aElement.disabled = false; } 70 } 71 ); 72 }{/literal} 73 </script> 74 <a href="{$U_CADDIE}" onclick="addToCadie(this, '{$ROOT_URL|@escape:'javascript'}', {$current.id}); return false;" title="{'add to caddie'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/caddie_add.png" class="button" alt="{'caddie'|@translate}"></a> 75 {/if}{*caddie management END*} 60 76 </div> 61 77 {include file=$FILE_PICTURE_NAV_BUTTONS} -
trunk/ws.php
r2413 r2429 43 43 $service->addMethod('pwg.getVersion', 'ws_getVersion', null, 44 44 'retrieves the PWG version'); 45 46 $service->addMethod('pwg.caddie.add', 'ws_caddie_add', 47 array( 48 'image_id'=> array( 'flags'=>WS_PARAM_FORCE_ARRAY ), 49 ), 50 'adds the elements to the caddie'); 45 51 46 52 $service->addMethod('pwg.categories.getImages', 'ws_categories_getImages',
Note: See TracChangeset
for help on using the changeset viewer.