[Linpha-cvs] SF.net SVN: linpha: [4534] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2006-04-14 14:04:22
|
Revision: 4534 Author: fangehrn Date: 2006-04-14 07:03:58 -0700 (Fri, 14 Apr 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4534&view=rev Log Message: ----------- 2006-04-14 flo * startet implementing basket checkout features (download, print, mail) Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/docs/TODO.txt trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/modules/module.basket.php trunk/linpha2/lib/modules/module.search.php trunk/linpha2/templates/default/basket.html.php trunk/linpha2/templates/default/global.html.php trunk/linpha2/templates/default/search.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-04-13 13:30:53 UTC (rev 4533) +++ trunk/linpha2/ChangeLog 2006-04-14 14:03:58 UTC (rev 4534) @@ -1,3 +1,10 @@ +2006-04-14 flo + * startet implementing basket checkout features (download, print, mail) + +2006-04-13 flo + * finished search feature + hope it will work with oracle... ;-) + 2006-04-13 bzrudi <linpha2_AT_tuxpower_DOT_de> * replace all remaining recordCount() with EOF * some oracle related fixes @@ -4,10 +11,6 @@ * Installer: - Oracle related improvements -2006-04-13 flo - * finished search feature - hope it will work with oracle... ;-) - 2006-04-12 flo * replace some recordCount() with EOF * startet implementing search feature Modified: trunk/linpha2/docs/TODO.txt =================================================================== --- trunk/linpha2/docs/TODO.txt 2006-04-13 13:30:53 UTC (rev 4533) +++ trunk/linpha2/docs/TODO.txt 2006-04-14 14:03:58 UTC (rev 4534) @@ -21,7 +21,6 @@ -> an idea: only delete content of tmp, cache and sql folders if they are not changed - DONT add feature to drop tables if they already exists -- Search (copy from linpha1) - Basket (finish) - Support for the Icons @@ -54,7 +53,7 @@ DONE ==== - +- Search (copy from linpha1) - use lightbox http://www.huddletogether.com/projects/lightbox2/ - get_image.php (Image View, Image Cache) Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-04-13 13:30:53 UTC (rev 4533) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-04-14 14:03:58 UTC (rev 4534) @@ -148,7 +148,6 @@ function buildImgView() { $this->filterPhotosNotPermitted(); - $this->setMenu(); /** * doing some special commands @@ -160,6 +159,12 @@ $this->slideshow(); } + /** + * set admin menu and more menu + * this should be done after adminCommands, because of + * "nr images in basket" is changed in adminCommands() + */ + $this->setMenu(); /** * set mode specific things @@ -167,7 +172,7 @@ switch($this->mode) { case 'home': - $this->viewHome_view(); + $this->viewHome(); break; case 'thumb': switch($_SESSION['mode_thumbview']) @@ -281,7 +286,8 @@ $array_sort_orders_links[] = Array('name' => i18n($value), 'value' => $GLOBALS['linpha']->template->URL_full.'&order_by='.$value); } - $open_basket_link = LINPHA_DIR.'?cat=basket&ref_id='.$this->id_current; + $_SESSION['basket_ref_url'] = $GLOBALS['linpha']->template->URL_full; + $open_basket_link = LINPHA_DIR.'/?cat=basket&ref_id='.$this->id_current; switch($this->mode) { @@ -306,10 +312,9 @@ Array( 'name' => i18n("Basket"), 'value' => Array( - Array('name' => i18n("Add all To Basket"), 'value' => $open_basket_link.'&cmd=add_all'), + Array('name' => i18n("Add All To Basket"), 'value' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_all'), Array('name' => i18n("Switch To Basket View"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=basket'), - Array('name' => i18n("Open Basket"), 'value' => $open_basket_link), - Array('name' => i18n("Images In Basket").': '.count($_SESSION['basket_ids']), 'value' => '#') + Array('name' => i18n("Open Basket").' ('.count($_SESSION['basket_ids']).' '.i18n("Images").')', 'value' => $open_basket_link) ) ); @@ -342,9 +347,8 @@ Array( 'name' => i18n("Basket"), 'value' => Array( - Array('name' => i18n("Add To Basket"), 'value' => '#'), - Array('name' => i18n("Open Basket"), 'value' => $open_basket_link), - Array('name' => i18n("Images In Basket").': '.count($_SESSION['basket_ids']), 'value' => '#') + Array('name' => i18n("Add To Basket"), 'value' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_this'), + Array('name' => i18n("Open Basket").' ('.count($_SESSION['basket_ids']).' '.i18n("Images").')', 'value' => $open_basket_link) ) ); $GLOBALS['linpha']->template->output['menu_More']['view'] = @@ -389,17 +393,32 @@ */ function adminCommands() { - if($GLOBALS['linpha']->sql->isAdmin()) + switch($_GET['admin_cmd']) { - switch($_GET['admin_cmd']) + case 'recreate': + if($GLOBALS['linpha']->sql->isAdmin()) { - case 'recreate': - LinImage::createThumbnail($this->id_current,$this->img_type,$force=true); - break; - case 'rotate_left': - case 'rotate_right': - break; + LinImage::createThumbnail($this->id_current,$this->img_type,$force=true); } + break; + case 'rotate_left': + case 'rotate_right': + if($GLOBALS['linpha']->sql->isAdmin()) + { + } + break; + case 'basket_add_all': // coming from imgview, mode=viewThumb + foreach($this->photos_filtered AS $value) + { + if($value['img_type']!=0) + { + $_SESSION['basket_ids'][] = $value['id']; + } + } + break; + case 'basket_add_this': // coming from imgview, mode=viewImg + $_SESSION['basket_ids'][] = $this->id_current; + break; } } @@ -728,7 +747,7 @@ /** * setup main/home view layout */ -function viewHome_view() +function viewHome() { $GLOBALS['linpha']->template->setModuleName('home'); Modified: trunk/linpha2/lib/modules/module.basket.php =================================================================== --- trunk/linpha2/lib/modules/module.basket.php 2006-04-13 13:30:53 UTC (rev 4533) +++ trunk/linpha2/lib/modules/module.basket.php 2006-04-14 14:03:58 UTC (rev 4534) @@ -34,38 +34,12 @@ { switch($_GET['cmd']) { + case 'checkout': + break; /** - * add all - */ - case 'add_all': - - if( isset( $_GET['ref_id'] ) ) - { - $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."photos " . - "WHERE img_type <> '0' " . - "AND parent_id = '".linSql::linAddslashes($_GET['ref_id'])."'"); - - while($data = $query->FetchRow()) - { - if($GLOBALS['linpha']->sql->photoIsAllowed($data[0])) - { - $_SESSION['basket_ids'][] = $data[0]; - } - } - $ref_id = $_GET['ref_id']; - } - else - { - $ref_id = 0; - } - - Header("Location: ".LINPHA_DIR."/?cat=alb&id=".$ref_id."&ref=imgids_added"); - exit(); - - - /** * add ids to session if allowed + * coming from imgview, mode=viewBasket */ case 'add_selected': @@ -79,7 +53,8 @@ } } } - Header("Location: ".LINPHA_DIR."/?cat=alb&id=".$_GET['ref_id']."&ref=imgids_added"); + + Header("Location: ".convert_amp($_SESSION['basket_ref_url'])); exit(); /** Modified: trunk/linpha2/lib/modules/module.search.php =================================================================== --- trunk/linpha2/lib/modules/module.search.php 2006-04-13 13:30:53 UTC (rev 4533) +++ trunk/linpha2/lib/modules/module.search.php 2006-04-14 14:03:58 UTC (rev 4534) @@ -42,7 +42,6 @@ switch($_REQUEST['cmd']) { case 'search': - /** * search string to short */ @@ -71,7 +70,7 @@ break; case 'new': unset($_SESSION['search']); - $_REQUEST['b_all'] = true; + $_REQUEST['button']['meta']['all'] = 1; break; case 'edit': if(isset($_SESSION['search'])) @@ -193,7 +192,13 @@ * get text fields */ $sql_buttons = "(1=2"; - $and_or = get_and_or($_REQUEST['text_and_or']); + + if( !isset($_REQUEST['text_and_or']) OR $_REQUEST['text_and_or'] == "AND") { + $and_or = "AND"; + } else { + $and_or = "OR"; + } + $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."meta_fields WHERE field_type = '1' AND (flags = '5' OR flags = '7')"); while($data = $query->FetchRow(ADODB_FETCH_NUM)) { @@ -277,6 +282,22 @@ } } + /** + * xmp + */ + if($GLOBALS['linpha']->sql->config->value['sys_image_xmp']) + { + $MetaData->setFields('xmp'); + foreach($MetaData->defined_fields['xmp'] AS $key=>$value) + { + if(isset($_REQUEST['button']['xmp'][$key]) OR isset($_REQUEST['button']['xmp']['all'])) + { + $sql_buttons .= " OR ".str_replace('{colname}',PREFIX."meta_xmp.".$key,$search_string); + $need_xmp_table = true; + } + } + } + $sql_buttons .= ") AND "; } //echo $sql_buttons.'<br />'; @@ -297,7 +318,11 @@ */ $value = LinSql::linAddslashesArray($value); - $and_or = get_and_or($_REQUEST['select_and_or'][$key]); + if( !isset($_REQUEST['select_and_or'][$key]) OR $_REQUEST['select_and_or'][$key] == "AND") { + $and_or = "AND"; + } else { + $and_or = "OR"; + } $num = count($value); reset($value); @@ -326,13 +351,13 @@ * date (exif) */ $sql_exif_date = ''; - if( (isset($_REQUEST['date_from_exif']) && $_REQUEST['date_from_exif']!="") - OR (isset($_REQUEST['date_to_exif']) && $_REQUEST['date_to_exif']!="")) + if( (isset($_REQUEST['date_from_exif']) && !empty($_REQUEST['date_from_exif']) ) + OR (isset($_REQUEST['date_to_exif']) && !empty($_REQUEST['date_to_exif']) ) ) { - if($_REQUEST['date_from_exif']=="") { + if( !isset($_REQUEST['date_from_exif']) OR empty($_REQUEST['date_from_exif']) ) { $_REQUEST['date_from_exif'] = "0000:00:00 00:00:00"; } - if($_REQUEST['date_to_exif']=="") { + if( !isset($_REQUEST['date_to_exif']) OR empty($_REQUEST['date_to_exif']) ) { $_REQUEST['date_to_exif'] = "4000:00:00 00:00:00"; } @@ -346,22 +371,27 @@ //echo $sql_exif_date.'<br />'; $sql_date = ''; - foreach($_REQUEST['date_from'] AS $key=>$value) + if(isset($_REQUEST['date_from'])) { - if( !empty($_REQUEST['date_from'][$key]) OR !empty($_REQUEST['date_to'][$key])) + foreach($_REQUEST['date_from'] AS $key=>$value) { - if($_REQUEST['date_from'][$key]=="") { - $_REQUEST['date_from'][$key] = "0000:00:00 00:00:00"; + + if( (isset($_REQUEST['date_from'][$key]) && !empty($_REQUEST['date_from'][$key]) ) + OR (isset($_REQUEST['date_to'][$key]) && !empty($_REQUEST['date_to'][$key]) ) ) + { + if( !isset($_REQUEST['date_from'][$key]) OR empty($_REQUEST['date_from'][$key]) ) { + $_REQUEST['date_from'][$key] = "0000:00:00 00:00:00"; + } + if( !isset($_REQUEST['date_to'][$key]) OR empty($_REQUEST['date_to'][$key]) ) { + $_REQUEST['date_to'][$key] = "4000:00:00 00:00:00"; + } + + $sql_date .= "(".PREFIX."meta_exif.datetimeoriginal BETWEEN ". + "'".LinSql::linAddslashes($_REQUEST['date_from'][$key])." 00:00:00' AND ". + "'".LinSql::linAddslashes($_REQUEST['date_to'][$key])." 23:59:59') AND "; + + $need_exif_table = true; } - if($_REQUEST['date_to'][$key]=="") { - $_REQUEST['date_to'][$key] = "4000:00:00 00:00:00"; - } - - $sql_date .= "(".PREFIX."meta_exif.datetimeoriginal BETWEEN ". - "'".LinSql::linAddslashes($_REQUEST['date_from'][$key])." 00:00:00' AND ". - "'".LinSql::linAddslashes($_REQUEST['date_to'][$key])." 23:59:59') AND "; - - $need_exif_table = true; } } @@ -438,19 +468,6 @@ } - -/** -* validate incoming data from $_GET -*/ -function get_and_or($and_or) -{ - if($and_or == 'AND') { - return 'AND'; - } else { - return 'OR'; - } -} - function build_album_select($with_all_albs_entry) { ?> Modified: trunk/linpha2/templates/default/basket.html.php =================================================================== --- trunk/linpha2/templates/default/basket.html.php 2006-04-13 13:30:53 UTC (rev 4533) +++ trunk/linpha2/templates/default/basket.html.php 2006-04-14 14:03:58 UTC (rev 4534) @@ -1,4 +1,3 @@ -<form name="basket" action="<?php echo $GLOBALS['linpha']->template->URL_full; ?>&cmd=remove_selected" method="POST"> <div id="divnavigation"> <div class="roundtop"> @@ -6,11 +5,176 @@ </div> <div id="navigation"> - <a href="<?php echo LINPHA_DIR.'/?cat=alb&id='.$_GET['ref_id']; ?>"><?php echo i18n("Go Back"); ?></a> - <a href="<?php echo $GLOBALS['linpha']->template->URL_full; ?>&cmd=remove_all"><?php echo i18n("Remove all"); ?></a> - <input type="submit" name="submit" value="<?php echo i18n("Remove selected"); ?>" /> + <a style="float: left; margin-right: 2px;" class="button" href="<?php echo $_SESSION['basket_ref_url']; ?>"><?php echo i18n("Go Back"); ?></a> + <form name="basket_checkout" style="float: left; margin-right: 2px;" action="<?php echo $GLOBALS['linpha']->template->URL_full; ?>" method="POST"> + <select class="button" name="checkout_as" onchange="document.basket_checkout.submit()"> + <option value=""><?php echo i18n("Checkout"); ?></option> + <option value="download"><?php echo i18n("Download"); ?></option> + <option value="mail"><?php echo i18n("Send As Mail"); ?></option> + <option value="print"><?php echo i18n("Print"); ?></option> + </select> + </form> + + <form name="basket_remove" action="<?php echo $GLOBALS['linpha']->template->URL_full; ?>&cmd=remove_selected" method="POST"> + <a class="button" href="<?php echo $GLOBALS['linpha']->template->URL_full; ?>&cmd=remove_all"><?php echo i18n("Remove all"); ?></a> + <input class="button" type="submit" name="submit" value="<?php echo i18n("Remove selected"); ?>" /> <br /><br /> <?php echo i18n("Images in basket");?>: <?php echo count($_SESSION['basket_ids']); ?> + + <?php + if(isset($_POST['checkout_as'])) + { + switch($_POST['checkout_as']) + { + case 'download': + /** + * error handling + */ + if(isset($_GET['error'])) + { + switch($_GET['error']) + { + case 1: linSysLog(i18n("Error").": ".i18n("No Images Selected!")); break; // user tried to download zip, but didn't even select a single image ;-) + case 2: linSysLog(i18n("Error").": ".i18n("The download couldn't be started for some reasons!")); break; // created archive doesn't exists... + case 3: linSysLog(i18n("Error").": ".i18n("Wrong input data")); break; // no valid imgid's + } + } + + echo i18n("Select Type Of Archive"); + ?> + <br /><br /> + <form name="zip_selected" action="<?php echo LINPHA_DIR; ?>/actions/basket_build_zip.php" method="POST"> + <select name="ziptype" size="1" style="width: 175px;"> + <?php + /*include_once(TOP_DIR.'/include/archiver.class.php'); + $apps = new Archive_Applications(); + $apps->searchApps(); + + foreach($apps->found_apps AS $key=>$value) + { + $value = $key.' (.'.$apps->apps[$key]['file_ext'].')'; + echo '<option value="'.$key.'">'.sprintf(i18n("Create %s Archiv"),$value).'</option>'."\n"; + }*/ + ?> + </select><br /> + <?php + /*if(in_group('admin')) + {*/ + echo i18n("Add More Apps"); + //putHelpButton('archive_apps'); + echo "<br />\n\n"; + //} + ?> + <br /> + <input type="submit" name="submit" value="<?php echo i18n("Download Archive"); ?>"> + <?php + break; // end checkout - download + case 'mail': + + $default_text_message = ($GLOBALS['img_view']->mode=='viewer' ? $prev_path."\n"."http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"]).'/viewer.php?albid='.$_REQUEST['albid'].'&stage='.$_REQUEST['stage'].'&pn='.$_REQUEST['pn'] : ''); + + $mail_address = (isset($_SESSION['mail_address']) ? $_SESSION['mail_address'] : ''); + $sender_address = (isset($_SESSION['sender_address']) ? $_SESSION['sender_address'] : ''); + $subject = (isset($_SESSION['subject']) ? $_SESSION['subject'] : ''); + $text_message = (isset($_SESSION['text_message']) ? $_SESSION['text_message'] : $default_text_message); + + (@$_SESSION['mail_mode'] == "html") ? $html = ' checked="checked"' : $txt = ' checked="checked"'; + + if(isset($_GET['error_mail'])) + { + $mail_size = round($_SESSION['tot_filesize']*$_SESSION['overhead_base64']); + echo '<h3><font color="red">'; + switch($_GET['error_mail']) + { + case 0: + echo $mail_sent_to.': <span title="'.$_SESSION['mail_address'].'">'; + echo cut_overloaded_strings($_SESSION['mail_address'],18); + echo '</span>'; + echo '<br /><br />'; + echo i18n("Size Of E-Mail").": ".nice_filesize($mail_size,1); + break; // success + case 1: linSysLog(i18n("Error").": ".i18n("No Images Selected!")); break; // no images selected + case 2: linSysLog(i18n("Error: E-Mail couldn't be sent. Contact the Administrator.")); break; // error in mail() + case 3: linSysLog(sprintf(i18n("Error: The E-Mail is too big.<br /><br />Allowed size: %sBytes. Your selected images use %sBytes.<br /><br />Remove some images or use the download zipped albums feature!"),$max_mail_size,$mail_size)); break; // mail too big + case 4: linSysLog(i18n("Please Fill In All Fields!")); break; + } + echo '</font></h3>'; + } + ?> + <form name="mail_selected" action="<?php echo TOP_DIR; ?>/actions/basket_build_mail.php" method="POST"> + </div><div align="left"> + <?php echo i18n("Recipient"); ?>:<br /> + </div><div align="center"> + <input type="text" name="mail_address" value="<?php echo $mail_address; ?>" style="width:175"><br /> + </div><div align="left"> + <?php echo i18n("Sender"); ?>:<br /> + </div><div align="center"> + <input type="text" name="sender_address" value="<?php echo $sender_address; ?>" style="width:175"><br /> + </div><div align="left"> + <?php echo i18n("Subject"); ?><br /> + </div><div align="center"> + <input type="text" name="subject" value="<?php echo $subject; ?>" style="width:175"><br /> + </div><div align="left"> + <?php echo i18n("Message"); ?><br /> + </div><div align="center"> + <textarea name="text_message" style="width: 175px;" rows="5" cols="40"><?php echo $text_message; ?></textarea><br /> + </div> + <div align="left"> <?php echo i18n("Mail Format"); ?><br/> + <input type="radio" name="mail_mode" value="txt"<?php echo @$txt; ?>><?php echo i18n("TXT (images attached)"); ?><br /> + <input type="radio" name="mail_mode" value="html"<?php echo @$html; ?>><?php echo i18n("HTML (images inline)"); ?><br /> + </div><br> + <div align="center"> + <input type="submit" value="<?php echo i18n("Send Mail"); ?>"> + + <?php + break; // end checkout - mail + case 'print': + ?> + <script language="JavaScript" type="text/javascript"> + function update_quality_settings() + { + switch(document.print_selected.images.value) + { + case '2': + document.print_selected.l_or_h_quality.selectedIndex = '1'; + break; + case '4': + break; + case '8': + break; + case '16': + document.print_selected.l_or_h_quality.selectedIndex = '0'; + break; + case '28': + document.print_selected.l_or_h_quality.selectedIndex = '0'; + + checkflag = 0; + document.print_selected.button_check_all.value = check_all(); + break; + } + } + </script> + <form name="print_selected" action="<?php echo TOP_DIR; ?>/actions/basket_build_print.php" method="POST" target="_blank"> + <br/><select name="images" size="1" onchange="update_quality_settings()"> + <option value="2">2 <?php echo i18n("Images/Page"); ?></option> + <option value="4" selected>4 <?php echo i18n("Images/Page"); ?></option> + <option value="8">8 <?php echo i18n("Images/Page"); ?></option> + <option value="16">16 <?php echo i18n("Images/Page"); ?></option> + <option value="28"><?php echo i18n("Images/Page"); ?></option> + </select> + <br/><br/> + <select name="l_or_h_quality"> + <option value="l"><?php echo i18n("Normal Quality"); ?></option> + <option value="h"><?php echo i18n("High Quality (Very Slow!)"); ?></option> + </select> + <br/><br/> + <input type="submit" value="<?php echo i18n("Print Preview"); ?>"> + <br /><hr /> + <strong><?php echo i18n("NOTE:"); ?></strong><?php echo i18n("You may have to adjust your browsers \"page setup\" before printing, to make sure all photos fit on page !!!"); + break; // end checkout - print + } + } + ?> </div> <div class="roundbottom"> Modified: trunk/linpha2/templates/default/global.html.php =================================================================== --- trunk/linpha2/templates/default/global.html.php 2006-04-13 13:30:53 UTC (rev 4533) +++ trunk/linpha2/templates/default/global.html.php 2006-04-14 14:03:58 UTC (rev 4534) @@ -85,7 +85,8 @@ <input type="hidden" name="button[meta][all]" value="1" /> <input type="hidden" name="cmd" value="search" /> <input type="hidden" name="cat" value="search" /> - <input type="submit" name="submit" value="<?php echo i18n("Search"); ?>" /> + <input type="submit" name="submit" value="<?php echo i18n("Search"); ?>" /> + </form> </div> </li> </ul> Modified: trunk/linpha2/templates/default/search.html.php =================================================================== --- trunk/linpha2/templates/default/search.html.php 2006-04-13 13:30:53 UTC (rev 4533) +++ trunk/linpha2/templates/default/search.html.php 2006-04-14 14:03:58 UTC (rev 4534) @@ -14,15 +14,15 @@ <font size="+1"><?php echo i18n("LinPHA Search Page"); ?></font> <hr noshade> <?php -if(isset($error)) +if(isset($GLOBALS['linpha']->template->output['search_error'])) { echo '<div align="center"><b>'; - switch($error) + switch($GLOBALS['linpha']->template->output['search_error']) { case 1: echo i18n("Search string to short, must be at least 2 characters long!"); break; case 2: echo i18n("Error, please check input!"); break; } - echo "</b><br /><br /></div>"; + echo '</b><br /><br /></div>'; } ?> <div id="divmain"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |