Changeset 20407


Ignore:
Timestamp:
Jan 26, 2013, 2:50:41 PM (11 years ago)
Author:
mistic100
Message:

option to save website URL in photo description

Location:
extensions/url_uploader
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • extensions/url_uploader/admin.php

    r20064 r20407  
    8383          );
    8484       
     85        $updates = array();
    8586        if (!empty($_POST['photo_name']))
    8687        {
    87           single_update(
    88             IMAGES_TABLE,
    89             array('name'=>$_POST['photo_name']),
    90             array('id' => $image_id)
    91             );
     88          $updates['name'] = $_POST['photo_name'];
    9289        }
     90        if (isset($_POST['url_in_comment']))
     91        {
     92          $url = parse_url($_POST['file_url']);
     93          $url = $url['scheme'].'://'.$url['host'];
     94          $updates['comment'] = '<a href="'. $url . '">'. $url .'</a>';
     95        }
     96       
     97        single_update(
     98          IMAGES_TABLE,
     99          $updates,
     100          array('id' => $image_id)
     101          );
    93102       
    94103        $image_ids = array($image_id);
  • extensions/url_uploader/include/ws_functions.inc.php

    r19804 r20407  
    1818        'maxValue' => $conf['available_permission_levels']
    1919        ),
     20      'url_in_comment' => array('default' => true),
    2021      ),
    2122    'Add image from remote URL.'
     
    8485    );
    8586 
     87  $updates = array();
    8688  if (!empty($params['name']))
    8789  {
    88     single_update(
    89       IMAGES_TABLE,
    90       array('name'=>$params['name']),
    91       array('id' => $image_id)
    92       );
     90    $updates['name'] = $params['name'];
    9391  }
     92  if ($params['url_in_comment']=='true')
     93  {
     94    $url = parse_url($params['file_url']);
     95    $url = $url['scheme'].'://'.$url['host'];
     96    $updates['comment'] = '<a href="'. $url . '">'. $url .'</a>';
     97  }
     98 
     99  single_update(
     100    IMAGES_TABLE,
     101    $updates,
     102    array('id' => $image_id)
     103    );
    94104 
    95105 
  • extensions/url_uploader/language/en_UK/plugin.lang.php

    r19804 r20407  
    1212$lang['One link by line, separate photo name and url with a &laquo; | &raquo;. Photo name is optional.'] = 'One link by line, separate photo name and url with a &laquo; | &raquo;. Photo name is optional.';
    1313$lang['Add links'] = 'Add links';
     14$lang['Add website URL in photo description'] = 'Add website URL in photo description';
    1415
    1516?>
  • extensions/url_uploader/language/fr_FR/plugin.lang.php

    r19804 r20407  
    1212$lang['One link by line, separate photo name and url with a &laquo; | &raquo;. Photo name is optional.'] = 'Un seul lien par ligne, séparez le nom et l\'URL par un &laquo; | &raquo;. Le nom de la photo est optionel.';
    1313$lang['Add links'] = 'Ajouter les liens';
     14$lang['Add website URL in photo description'] = 'Ajouter l\'URL du site web dans la description de la photo';
    1415
    1516?>
  • extensions/url_uploader/template/photos_add.tpl

    r19805 r20407  
    159159});
    160160
    161 function performImport(file_url, category, name, level, $target) {
     161function performImport(file_url, category, name, level, url_in_comment, $target) {
    162162  queuedManager.add({
    163163    type: 'GET',
    164164    dataType: 'json',
    165165    url: 'ws.php',
    166     data: { method: 'pwg.images.addRemote', file_url: file_url, category: category, name: name, level: level, format: 'json' },
     166    data: { method: 'pwg.images.addRemote', file_url: file_url, category: category, name: name, level: level, url_in_comment: url_in_comment, format: 'json' },
    167167    success: function(data) {
    168168      if (data['stat'] == 'ok') {
     
    223223      $(this).data('name'),
    224224      $("select[name=level] option:selected").val(),
     225      $("input[name=url_in_comment]").is(":checked"),
    225226      $(this)
    226227      );
     
    392393          </label>
    393394        </li>
     395        <li>
     396          <label>
     397            <span class="property"><input type="checkbox" name="url_in_comment" checked="checked"></span>
     398            {'Add website URL in photo description'|@translate}
     399          </label>
     400        </li>
    394401      </ul>     
    395402     
     
    410417        <tbody>
    411418        </tbody>
     419        <tfoot>
     420          <tr><th colspan="4">
     421          <label>
     422            <input type="checkbox" name="url_in_comment" checked="checked">
     423            {'Add website URL in photo description'|@translate}
     424          </label>
     425          </th></tr>
     426        </tfoot>
    412427      </table>
    413428     
Note: See TracChangeset for help on using the changeset viewer.