- Timestamp:
- Dec 9, 2009, 11:14:01 PM (15 years ago)
- Location:
- branches/2.0
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0/include/ws_functions.inc.php
r4444 r4459 1666 1666 } 1667 1667 1668 // name1669 // category_id1670 // file_content1671 // file_sum1672 // thumbnail_content1673 // thumbnail_sum1674 1675 1668 $params['image_id'] = (int)$params['image_id']; 1676 1669 if ($params['image_id'] <= 0) … … 1692 1685 1693 1686 // database registration 1694 $update = array( 1695 'id' => $params['image_id'], 1696 ); 1687 $update = array(); 1697 1688 1698 1689 $info_columns = array( … … 1704 1695 ); 1705 1696 1706 $perform_update = false;1707 1697 foreach ($info_columns as $key) 1708 1698 { 1709 1699 if (isset($params[$key])) 1710 1700 { 1711 $perform_update = true; 1712 $update[$key] = $params[$key]; 1713 } 1714 } 1715 1716 if ($perform_update) 1717 { 1701 if ('fill_if_empty' == $params['single_value_mode']) 1702 { 1703 if (empty($image_row[$key])) 1704 { 1705 $update[$key] = $params[$key]; 1706 } 1707 } 1708 elseif ('replace' == $params['single_value_mode']) 1709 { 1710 $update[$key] = $params[$key]; 1711 } 1712 else 1713 { 1714 new PwgError( 1715 500, 1716 '[ws_images_setInfo]' 1717 .' invalid parameter single_value_mode "'.$params['single_value_mode'].'"' 1718 .', possible values are {fill_if_empty, replace}.' 1719 ); 1720 exit(); 1721 } 1722 } 1723 } 1724 1725 if (count(array_keys($update)) > 0) 1726 { 1727 $update['id'] = $params['image_id']; 1728 1718 1729 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); 1719 1730 mass_updates( … … 1732 1743 $params['image_id'], 1733 1744 $params['categories'], 1734 $params['replace_mode']1745 ('replace' == $params['multiple_value_mode'] ? true : false) 1735 1746 ); 1736 1747 } … … 1743 1754 $tag_ids = explode(',', $params['tag_ids']); 1744 1755 1745 if ( $params['replace_mode'])1756 if ('replace' == $params['multiple_value_mode']) 1746 1757 { 1747 1758 set_tags( … … 1750 1761 ); 1751 1762 } 1752 else 1763 elseif ('append' == $params['multiple_value_mode']) 1753 1764 { 1754 1765 add_tags( … … 1756 1767 array($params['image_id']) 1757 1768 ); 1769 } 1770 else 1771 { 1772 new PwgError( 1773 500, 1774 '[ws_images_setInfo]' 1775 .' invalid parameter multiple_value_mode "'.$params['multiple_value_mode'].'"' 1776 .', possible values are {replace, append}.' 1777 ); 1778 exit(); 1758 1779 } 1759 1780 } -
branches/2.0/ws.php
r4444 r4459 290 290 'maxValue' => $conf['available_permission_levels'] 291 291 ), 292 'replace_mode' => array('default' => false), 292 'single_value_mode' => array('default' => 'fill_if_empty'), 293 'multiple_value_mode' => array('default' => 'append'), 293 294 ), 294 295 'POST method only. Admin only 295 <br/><b>categories</b> is a string list "category_id[,rank];category_id[,rank]" The rank is optional and is equivalent to "auto" if not given.' 296 <br/><b>categories</b> is a string list "category_id[,rank];category_id[,rank]" The rank is optional and is equivalent to "auto" if not given. 297 <br/><b>single_value_mode</b> can be "fill_if_empty" (only use the input value if the corresponding values is currently empty) or "replace" (overwrite any existing value) and applies to single values properties like name/author/date_creation/comment 298 <br/><b>multiple_value_mode</b> can be "append" (no change on existing values, add the new values) or "replace" and applies to multiple values properties like tag_ids/categories' 296 299 ); 297 300
Note: See TracChangeset
for help on using the changeset viewer.