Ignore:
Timestamp:
Jan 30, 2010, 11:50:34 PM (15 years ago)
Author:
plg
Message:

feature 1407 added: set the privacy level at upload time

Location:
extensions/upload_form
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • extensions/upload_form/include/functions_upload.inc.php

    r4783 r4805  
    2626$page['source_file'] = '/home/pierrick/public_html/test/resize/phpthumb/examples/statue_small.jpg';
    2727
    28 function add_uploaded_file($source_filepath, $original_filename=null, $categories=null)
     28function add_uploaded_file($source_filepath, $original_filename=null, $categories=null, $level=null)
    2929{
    3030  global $page;
     
    9696    $insert['high_filesize'] = $high_infos['filesize'];
    9797  }
     98
     99  if (isset($level))
     100  {
     101    $insert['level'] = $level;
     102  }
    98103 
    99104  mass_inserts(
  • extensions/upload_form/upload.php

    r4796 r4805  
    8181      $source_filepath = $_FILES['image_upload']['tmp_name'][$idx];
    8282      $original_filename = $_FILES['image_upload']['name'][$idx];
    83       add_uploaded_file($source_filepath, $original_filename, array($category_id));
     83      add_uploaded_file($source_filepath, $original_filename, array($category_id), $_POST['level']);
    8484    }
    8585  }
     
    117117  'category_options'
    118118  );
     119
     120// image level options
     121$tpl_options = array();
     122foreach ($conf['available_permission_levels'] as $level)
     123{
     124  $tpl_options[$level] = l10n( sprintf('Level %d', $level) ).' ('.$level.')';
     125}
     126$selected_level = isset($_POST['level']) ? $_POST['level'] : 0;
     127$template->assign(
     128    array(
     129      'level_options'=> $tpl_options,
     130      'level_options_selected' => array($selected_level)
     131    )
     132  );
     133
    119134
    120135// +-----------------------------------------------------------------------+
  • extensions/upload_form/upload.tpl

    r4796 r4805  
    4545    <table>
    4646      <tr>
    47         <td>{'Drop into category'|@translate}</td>
     47        <th>{'Drop into category'|@translate}</th>
    4848        <td>
    4949          <label><input type="radio" name="category_type" value="existing" checked="checked"> {'existing category'|@translate}</label>
     
    8080
    8181      <tr>
     82        <th>{'Minimum privacy level'|@translate}</th>
     83        <td>
     84          <select name="level" size="1">
     85            {html_options options=$level_options selected=$level_options_selected}
     86          </select>
     87        </td>
     88      </tr>
     89
     90      <tr>
    8291        <td colspan="2">
    8392          <div id="uploadBoxes">
Note: See TracChangeset for help on using the changeset viewer.