package galConf;

### Web gallery configuration file

@admin_addresses = ("127.0.0.1", "192.168.1.", "::1");     ## IP addresses of machines 
                                                           ## allowed admin privileges

$default_location = "/Gallery";                ## The default vfolder location

%web_translation = ('/www', '');  ## Web server address translation--
                                  ## Maps local filesystem locations to 
                                  ## their corresponding website locations
                                  ## --Most people will want to map "/var/www" to ""

                                       
### File locations:


$web_dir  = "/art";                 ## Web root of gallery 
$base_dir = "/www$web_dir";                     ## Local filesystem root of gallery

$common_base   = "/usr/local/photoGallery";     ## you can have many galleries in many different
                                                ## locations, but this directory
                                                ## should be the same for all of them, since
                                                ## it contains some common code and
                                                ## other shared files

$common_script = "$common_base/common.pl";
$util_script   = "$common_base/util.pl";
$script_dir    = "$common_base/scripts";
$sync_script   = "$script_dir/sync_gallery";
$import_script = "$script_dir/import_files";

$cache_dir     = "/mnt/ram/gallery_cache";      ## Storage location for cached data,
                                                ## preferrably a ramdisk location.
                                                ## This is not required, but should
                                                ## speed things up considerably.

$vfolder_file     = "$base_dir/vfolders.xml";       
$keywords_file    = "$base_dir/keywords.xml";
$image_file       = "$base_dir/images.xml";
$cgi_url          = "$web_dir/index.cgi";
$stylesheet       = "$web_dir/style.css";
$thumbnail_suffix = "/.thumbnails";
$preview_suffix   = "/.thumbnails";


### Thumbnail settings:

$thumbs_per_row  = 3;
$thumb_size      = 200;
$thumb_quality   = 95;
$preview_size    = 600;
$preview_quality = 90;


### Utility script settings:

$write_group = "docs";                    ## The webserver must be in this group
                                          ## to have write access to thumbnail
                                          ## directories and xml files.
                         
$camera_download_command = "gphoto2 --get-all-files";   ## Self-explanatory, no?

$auto_import_dir = "/sasha/graphics/Mine";  ## Location to send newly imported photos
                                              ## --will be sorted by date into directories

$import_tmp_dir = "/tmp/get_photos";      ## Temporary holding area for images about 
                                          ## to be imported to the gallery

$image_viewer = "gqview $import_tmp_dir"; ## Image viewer used to preview images in the
                                          ## temporary holding area and make quick edits
                                          ## (rotate, crop, delete, etc..)

$defaultPhotographer = "Luke Campagnola";                                          
                                          
###########################
####  HTML Generation  ####
###########################

                                          

### Icon definitions:

$icon_dir = "$web_dir/images";
$search_icon = "$icon_dir/search.png";

  # Thumbnail icons
$folder_lg_icon         = "$icon_dir/dir_lg.png";
$broken_icon            = "$icon_dir/broken.png";
$comment_icon           = "$icon_dir/comment.png";
$movie_icon             = "$icon_dir/movie.png";

  # Tree icons
$folder_icon            = "$icon_dir/dir.png";
$folder_plus_icon       = "$icon_dir/dir_plus.png";
$folder_open_icon       = "$icon_dir/dir_open.png";
$spacer_icon            = "$icon_dir/spacer.png";
$spacer_bottom_icon     = "$icon_dir/spacer_bottom.png";
$spacer_conn_icon       = "$icon_dir/spacer_connected.png";
$spacer_empty_icon      = "$icon_dir/spacer_empty.png";

  # Toolbar icons
$folder_up_icon         = "$icon_dir/dir_up.png";
$prev_image_icon        = "$icon_dir/prev_image.png";
$next_image_icon        = "$icon_dir/next_image.png";
$prev_folder_icon       = "$icon_dir/prev_folder.png";
$next_folder_icon       = "$icon_dir/next_folder.png";
$admin_icon             = "$icon_dir/admin.png";

  ### For turning an image name into
  ### an html icon
sub iconHtml() {
  my $image = shift;
  return "<img src=\"$image\" class=\"icon\">";
}
 

  #### The following are html files which
  ##   I like to include on my site, but
  ##   which you probably do not have.
  

 ### Include a warning about defective browsers
$ieWarning = `cat /www/include/ieWarning.html`;

 ### Include a little global navigation
$global_nav = `cat /www/include/nav_small.html`;

 ### Include a list of recent galleries
#$recent_galleries = `cat $base_dir/recent_galleries.html`;

 ### Include support for cursor information
$cursor_info = `cat /www/include/cursor_info.html`;




  ## Quick stats
#$num_images = ($images_xml->getAttribute("next_id") - 1);
#$money_saved = ($num_images / 24 * 8);


  ## Function to print out the beginning
  ## of the web page. Errors generated 
  ## during page generation will appear after this text.
sub start_web_page() {
  print <<EOT;
Content-type: text/html

<html>
  <head>
    <link rel="stylesheet" href="$stylesheet">
    <title>Digital Photography - Luke Campagnola</title>
  </head>
  <body>
    $ieWarning
    <div class="messages">
EOT
}


  ### All content is generated after 
  ### start_web_page() and before print_web_page()


  ## Function to print the rest of the web page
  ## There are a lot of variables available to you here:
  ##
  ##    $search_bar  : The search input field and button
  ##    $tree_text   : The tree of folders that usually appears on the left
  ##    $content     : Content for the main section--thumbnails, previews, etc.
  ##    $toolbar     : Prev, next, and up buttons as well as administrative functions
  ##    $folder_info : Form for editing folder info (admin only)
  ##    $image_info  : Form for editing image info (admin only)
  ##
  ## In addition, you get to use any other variables that may have 
  ## been defined before now, such as $num_images or $global_nav
  
sub print_web_page() {
print <<EOT;
    </div>
    $global_nav
    <div style="text-align: center; height: 105px; font-size: 20pt;">Art<br><span style="font-size: 9pt;">(loosely defined)</span></div>
    <table class="main">
      <tr>
        <td class="folders">
          $tree_text
          <div class="about">
            Gallery software by <a href="/">Luke Campagnola</a> and <a href="http://jeffc.zapto.org">Jeff Cleary</a> 
          </div>
        </td>
        <td rowspan="2">
          <div class="content">
            $content
            <div class="toolbar">
              $toolbar
            </div>
            $folder_info
            $image_info
          </div>
        </td>
      </tr>
    </table>
    <div style="text-align: center;">Luke Campagnola - lcampagn\@mines.edu</div>
  </body>
</html>
EOT
}
  
# sub print_web_page() {
# print <<EOT;
#     </div>
#     $cursor_info
#     $global_nav
#     <div style="text-align: center; height: 105px;"></div>
#     <table class="main">
#       <tr>
#         <td class="folders">
#           <div style="text-align: center">
#             $search_bar
#           </div>
#           $recent_galleries
#           $tree_text
#           <div class="about">
#             Gallery software by <a href="/">Luke Campagnola</a> and <a href="http://jeffc.zapto.org">Jeff Cleary</a> 
#           </div>
#         </td>
#         <td rowspan="2">
#           <div class="content">
#             $content
#             <div class="toolbar">
#               $toolbar
#             </div>
#             $folder_info
#             $image_info
#           </div>
#         </td>
#       </tr>
#     </table>
#     <div style="text-align: center;">Luke Campagnola - lcampagn\@mines.edu</div>
#   </body>
# </html>
# EOT
# }


  ### Defines the object types associated with
  ### different filename extensions

%extTypes = (
  'jpg',  'image',  
  'png',  'image',  
  'gif',  'image',  
  'tga',  'image',
  'wav',  'audio',  
  'mp3',  'audio',  
  'ogg',  'audio',  
  'mpg',  'video',  
  'mpeg', 'video',  
  'avi',  'video'
);
  
  

return 1;
