Changeset 10756 for extensions/community


Ignore:
Timestamp:
May 4, 2011, 4:06:56 PM (14 years ago)
Author:
plg
Message:

feature 2294 added: ability to define photo properties before upload (name/author/description).

Because this is more a workaround than a clean way to implement it, webmaster
has to set $confcommunity_ask_for_properties = true in is local configuration file.

Location:
extensions/community
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/community/add_photos.php

    r9583 r10756  
    8787  // reinitialize the informations to display on the result page
    8888  $page['infos'] = array();
     89
     90  if (isset($conf['community_ask_for_properties']) and $conf['community_ask_for_properties'])
     91  {
     92    $data = array();
     93   
     94    $data['name'] = $_POST['name'];
     95    $data['author'] = $_POST['author'];
     96   
     97    if ($conf['allow_html_descriptions'])
     98    {
     99      $data['comment'] = @$_POST['description'];
     100    }
     101    else
     102    {
     103      $data['comment'] = strip_tags(@$_POST['description']);
     104    }
     105
     106    $updates = array();
     107    foreach ($image_ids as $image_id)
     108    {
     109      $update = $data;
     110      $update['id'] = $image_id;
     111
     112      array_push($updates, $update);
     113    }
     114
     115    mass_updates(
     116      IMAGES_TABLE,
     117      array(
     118        'primary' => array('id'),
     119        'update' => array_keys($updates[0])
     120        ),
     121      $updates
     122      );
     123  }
    89124 
    90125  // $category_id is set in the photos_add_direct_process.inc.php included script
     
    300335  );
    301336
     337if (isset($conf['community_ask_for_properties']) and $conf['community_ask_for_properties'])
     338{
     339  $template->assign(
     340    array(
     341      'community_ask_for_properties' => true,
     342      )
     343    );
     344}
    302345
    303346// +-----------------------------------------------------------------------+
  • extensions/community/add_photos.tpl

    r10171 r10756  
    239239}
    240240
     241#photosAddContent fieldset#photoProperties {padding-bottom:0}
     242#photosAddContent fieldset#photoProperties p {text-align:left;margin:0 0 1em 0;line-height:20px;}
     243#photosAddContent fieldset#photoProperties input[type="text"] {width:320px}
     244#photosAddContent fieldset#photoProperties textarea {width:500px; height:100px}
     245
    241246#photosAddContent P {
    242247  /* margin:0; */
     
    376381    </fieldset>
    377382
     383{if $community_ask_for_properties}
     384    <fieldset id="photoProperties">
     385      <legend>{'Photo Properties'|@translate}</legend>
     386
     387      <p>
     388        {'Name'|@translate}<br>
     389        <input type="text" class="large" name="name" value="{$NAME}">
     390      </p>
     391
     392      <p>
     393        {'Author'|@translate}<br>
     394        <input type="text" class="large" name="author" value="{$AUTHOR}">
     395      </p>
     396
     397      <p>
     398        {'Description'|@translate}<br>
     399        <textarea name="description" id="description" class="description" style="margin:0">{$DESCRIPTION}</textarea>
     400      </p>
     401
     402    </fieldset>
     403{/if}
     404
    378405    <fieldset>
    379406      <legend>{'Select files'|@translate}</legend>
Note: See TracChangeset for help on using the changeset viewer.