Annotation of /trunk/www/admin/zoomthumb.php
Parent Directory
|
Revision Log
Revision 2 - (view) (download)
| 1 : | andphe | 2 | <?php |
| 2 : | //zOOm Media Gallery// | ||
| 3 : | /** | ||
| 4 : | ----------------------------------------------------------------------- | ||
| 5 : | | zOOm Media Gallery! by Mike de Boer - a multi-gallery component | | ||
| 6 : | ----------------------------------------------------------------------- | ||
| 7 : | |||
| 8 : | ----------------------------------------------------------------------- | ||
| 9 : | | | | ||
| 10 : | | Author: Jetze van der Wal | | ||
| 11 : | | Copyright: copyright (C) 2007 by Jetze van der Wal | | ||
| 12 : | | http://mamboforge.net/project/zoomthumb | | ||
| 13 : | | Description: an addition to zOOm Media Gallery; | | ||
| 14 : | | a Joomla! component written by | | ||
| 15 : | | Mike de Boer, <http://www.mikedeboer.nl>. | | ||
| 16 : | | for Joomla!! check the zOOm homepage: | | ||
| 17 : | | http://www.zoomfactory.org | | ||
| 18 : | | License: GPL | | ||
| 19 : | | Filename: zoomthumb.php | | ||
| 20 : | | @Version@: 1.0.beta.1.0. | | ||
| 21 : | | | | ||
| 22 : | ----------------------------------------------------------------------- | ||
| 23 : | * @version $Id:zoomthumb.php 106 2007-02-10 22:30:30Z kevinuru $ | ||
| 24 : | * @package zOOmGallery | ||
| 25 : | * @author Jetze van der Wal | ||
| 26 : | **/ | ||
| 27 : | |||
| 28 : | // MOS Intruder Alerts | ||
| 29 : | |||
| 30 : | defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); | ||
| 31 : | |||
| 32 : | $task = mosGetParam($_REQUEST,'task'); | ||
| 33 : | $altid = mosGetParam($_REQUEST,'altid'); | ||
| 34 : | $Itemid = mosGetParam($_REQUEST,'Itemid'); | ||
| 35 : | switch (strtolower($task)) { | ||
| 36 : | |||
| 37 : | case "step2": //step1 produced galleryid, so now list thumbnails in that gallery | ||
| 38 : | //@version@ make pictures show in 30 max per page// allow sorting, on name, date etc | ||
| 39 : | echo '<div align="left" style="clear: both;">'; | ||
| 40 : | echo '<p><a href="'. (($zoom->_isBackend) ? 'index2.php?option=com_zoom&Itemid='.$Itemid.'&page=zoomthumb&task=step1' : sefReltoAbs('index2.php?option=com_zoom&Itemid='.$Itemid.'&page=zoomthumb&task=step')) .'">(back to step 1:: select gallery)</a></p>'; | ||
| 41 : | echo '<p id="step"><strong>Step 2 :: choose thumbnail</strong></p>'; | ||
| 42 : | $catid = mosGetParam($_REQUEST,'catid'); | ||
| 43 : | if ($catid==''){ | ||
| 44 : | echo '<p>Warning: no gallery id was detected in the url.</p>'; | ||
| 45 : | break; | ||
| 46 : | }; | ||
| 47 : | //get path for gallery | ||
| 48 : | $query = "SELECT catdir FROM #__zoom WHERE catid=".$catid; | ||
| 49 : | $database->setQuery( $query ); | ||
| 50 : | $catdir = $database->loadResult(); | ||
| 51 : | |||
| 52 : | // get all images in this gallery | ||
| 53 : | $database->setQuery("SELECT * FROM #__zoomfiles WHERE catid=".$catid); | ||
| 54 : | $result = $database->query(); | ||
| 55 : | |||
| 56 : | //@version@ upgrade html styling in following urls | ||
| 57 : | while ($row = mysql_fetch_object($result)){ | ||
| 58 : | $filename = '/'.$zoom->_CONFIG['imagepath'].'/'.$catdir.'/thumbs/'.$row->imgfilename; | ||
| 59 : | if (!is_file($mosConfig_absolute_path.$filename)) { | ||
| 60 : | $filename = $mosConfig_live_site.'/components/com_zoom/www/images/filetypes/generic.png'; | ||
| 61 : | } else { | ||
| 62 : | $filename = $mosConfig_live_site.$filename; | ||
| 63 : | } | ||
| 64 : | echo '<div style="clear: both;"><a style="float: left;" href="'. (($zoom->_isBackend) ? 'index2.php?option=com_zoom&Itemid='.$Itemid.'&page=zoomthumb&task=step3&imgid='.$row->imgid : sefReltoAbs('index.php?option=com_zoom&Itemid='.$Itemid.'&page=zoomthumb&task=step3&imgid='.$row->imgid)) .'"><img style="margin: 2px" src="'.$filename.'"></a>Title: '.$row->imgname.'<br />Descr: '.$row->imgdescr.'<br />'.(($row->published==0)?('Warning NOT published'):('Published')).'<br />File: '.$row->imgfilename.'</div>'; | ||
| 65 : | } | ||
| 66 : | |||
| 67 : | break; | ||
| 68 : | case "step3": //select styling | ||
| 69 : | $imgid = mosGetParam($_REQUEST,'imgid'); | ||
| 70 : | if ($imgid==''){ | ||
| 71 : | echo '<p>Warning: no image id was detected in the url.</p>'; | ||
| 72 : | break; | ||
| 73 : | }; | ||
| 74 : | |||
| 75 : | //get image properties using imgid | ||
| 76 : | $query = "SELECT * FROM #__zoomfiles WHERE imgid=".$imgid; | ||
| 77 : | $database->setQuery( $query ); | ||
| 78 : | $result = $database->query(); | ||
| 79 : | $row1 = mysql_fetch_object($result); | ||
| 80 : | |||
| 81 : | //get catdir using catid from img porperties | ||
| 82 : | $query = "SELECT catdir FROM #__zoom WHERE catid=".$row1->catid; | ||
| 83 : | $database->setQuery( $query ); | ||
| 84 : | $result = $database->query(); | ||
| 85 : | $row2 = mysql_fetch_object($result); | ||
| 86 : | |||
| 87 : | //display info | ||
| 88 : | echo '<div align="left" style="clear: both;">'; | ||
| 89 : | echo '<p><a href="'. (($zoom->_isBackend) ? 'index2.php?option=com_zoom&Itemid='.$Itemid.'&page=zoomthumb&task=step1' : sefReltoAbs('index.php?option=com_zoom&Itemid='.$Itemid.'&page=zoomthumb&task=step1')) .'">(back to step 1:: select gallery)</a></p>'; | ||
| 90 : | echo '<p><a href="'. (($zoom->_isBackend) ? 'index2.php?option=com_zoom&Itemid='.$Itemid.'&page=zoomthumb&task=step2&catid='.$row1->catid : sefReltoAbs('index.php?option=com_zoom&Itemid='.$Itemid.'&page=zoomthumb&task=step2&catid='.$row1->catid)) .'">(back to step 2:: select image)</a></p>'; | ||
| 91 : | echo '<p id="step"><strong>Step 3 :: choose styling</strong></p>'; | ||
| 92 : | |||
| 93 : | // display image | ||
| 94 : | echo '<div style="clear: both;"><img style="margin: 2px; float: left" src="'.$mosConfig_live_site.'/'.$zoom->_CONFIG['imagepath'].'/'.$row2->catdir.'/thumbs/'.$row1->imgfilename .'"></a>Title: '.$row1->imgname.'<br />Descr: '.$row1->imgdescr.'<br />'.(($row1->published==0)?('Warning NOT published'):('Published')).'<br />File: '.$row1->imgfilename.'</div>'; | ||
| 95 : | |||
| 96 : | //get some Caption configuration settings defined in the ZoomThumb-Joomla!t-settings | ||
| 97 : | $query = "SELECT id FROM #__mambots WHERE element = 'moszoomthumb' AND folder = 'content'"; | ||
| 98 : | $database->setQuery( $query ); | ||
| 99 : | $id = $database->loadResult(); | ||
| 100 : | $mambot = new mosMambot( $database ); | ||
| 101 : | $mambot->load( $id ); | ||
| 102 : | $param =& new mosParameters( $mambot->params ); | ||
| 103 : | |||
| 104 : | $showZoomcaption = $param->get('caption_show', '1'); //is mambot configured to show caption by default? | ||
| 105 : | $captionlength = $param->get('caption_length', '0'); //max length of caption | ||
| 106 : | |||
| 107 : | $defaultcaption =($captionlength<>'0')?(substr($row1->imgdescr,0,intval($captionlength))):$row1->imgdescr; | ||
| 108 : | //// compute default value | ||
| 109 : | if($showZoomcaption=='1'){ | ||
| 110 : | $defaultcaptionlabel = 'Default, use Zoom Gallery caption : '.$defaultcaption ; | ||
| 111 : | } else { | ||
| 112 : | $defaultcaptionlabel = 'Default, no caption used'; | ||
| 113 : | }; | ||
| 114 : | |||
| 115 : | $captionwarning =($captionlength <> '0')?(':: caption length is limited to '.$captionlength.' characters'):(''); | ||
| 116 : | |||
| 117 : | // create form code for selection of specific mambot codes | ||
| 118 : | echo '<div style="clear: both;">'; | ||
| 119 : | echo '<form name="zoomthumbform" action="'.(($zoom->_isBackend) ? "index2.php?option=com_zoom&Itemid=".$Itemid."&task=step4&catid=".$row1->catid."&imgid=".$imgid."&page=zoomthumb" : sefReltoAbs('index.php?option=com_zoom&Itemid='.$Itemid.'&task=step4&catid='.$row1->catid.'&imgid='.$imgid.'&page=zoomthumb')) .'" method="POST">'; | ||
| 120 : | echo '<p>Select the style for the main box (containing both the image as well as the caption):</p>'; | ||
| 121 : | echo '<input type="radio" name="style_m" value="1" checked> Style 1 (is default)'.$param->get('div_mother_1_descr', '').'<br />'; | ||
| 122 : | echo '<input type="radio" name="style_m" value="2"> Style 2'.$param->get('div_mother_2_descr', '').'<br />'; | ||
| 123 : | echo '<input type="radio" name="style_m" value="3"> Style 3'.$param->get('div_mother_3_descr', '').'<br />'; | ||
| 124 : | echo '<input type="radio" name="style_m" value="4"> Style 4'.$param->get('div_mother_4_descr', '').'<br />'; | ||
| 125 : | echo '<p>Select the style for the image box:</p>'; | ||
| 126 : | echo '<input type="radio" name="style_i" value="1" checked> Style 1 (is default)'.$param->get('image_2_descr', '').'<br />'; | ||
| 127 : | echo '<input type="radio" name="style_i" value="2"> Style 2 '.$param->get('image_2_descr', '').'<br />'; | ||
| 128 : | echo '<p>Select the style for the caption box:</p>'; | ||
| 129 : | echo '<input type="radio" name="style_c" value="1" checked> Style 1 (is default)'.$param->get('div_caption_1_descr', '').'<br />'; | ||
| 130 : | echo '<input type="radio" name="style_c" value="2"> Style 2 '.$param->get('div_caption_1_descr', '').'<br />'; | ||
| 131 : | echo '<p>Caption options '.$captionwarning.'</p>'; | ||
| 132 : | echo '<input type="radio" name="caption" value="1" checked>'.$defaultcaptionlabel.'<br />'; | ||
| 133 : | echo '<input type="radio" name="caption" value="2">Do not use a caption<br />'; | ||
| 134 : | //@nextversion@0.9.0 :: get next onclick javascript to work | ||
| 135 : | //@nextversion@0.9.0 :: maybe allow user to display Zoom Caption despite mambot config says not to? | ||
| 136 : | echo '<input type="radio" name="caption" value="3">Use following caption: <textarea rows="3" cols="25" name="altcaptiontext" ></textarea><br />Note: do not enter any of the following characters: " { } ( ) or =<br />'; | ||
| 137 : | echo '<br /><input type="submit" value="Finish up :: generate mambot code"><br />'; | ||
| 138 : | echo '<p>Note: styles and caption options are both defined in the main configuration settings of the Zoom Thumb mambot.</p>'; | ||
| 139 : | echo ''; | ||
| 140 : | //alternative caption | ||
| 141 : | echo ''; | ||
| 142 : | echo '</form>'; | ||
| 143 : | echo '</div>'; | ||
| 144 : | break; | ||
| 145 : | case "step4":// show mambotcode | ||
| 146 : | echo '<div align="left" style="clear: both;">'; | ||
| 147 : | |||
| 148 : | $imgid= mosGetParam($_REQUEST,'imgid'); | ||
| 149 : | $catid= mosGetParam($_REQUEST,'catid'); | ||
| 150 : | $style_m = mosGetParam($_REQUEST,'style_m'); | ||
| 151 : | $style_i = mosGetParam($_REQUEST,'style_i'); | ||
| 152 : | $style_c = mosGetParam($_REQUEST,'style_c'); | ||
| 153 : | $captionOption = mosGetParam($_REQUEST,'caption'); | ||
| 154 : | $captionAlttext = mosGetParam($_REQUEST,'altcaptiontext'); | ||
| 155 : | |||
| 156 : | echo '<p><a href="'. (($zoom->_isBackend) ? 'index2.php?option=com_zoom&Itemid='.$Itemid.'&page=zoomthumb&task=step1' : sefReltoAbs('index.php?option=com_zoom&Itemid='.$Itemid.'&page=zoomthumb&task=step1')) .'">(back to step 1:: select gallery)</a></p>'; | ||
| 157 : | echo '<p><a href="'. (($zoom->_isBackend) ? 'index2.php?option=com_zoom&Itemid='.$Itemid.'&page=zoomthumb&task=step2&catid='.$catid : sefReltoAbs('index.php?option=com_zoom&Itemid='.$Itemid.'&page=zoomthumb&task=step2&catid='.$catid)) .'">(back to step 2:: select image)</a></p>'; | ||
| 158 : | echo '<p><a href="'. (($zoom->_isBackend) ? 'index2.php?option=com_zoom&Itemid='.$Itemid.'&page=zoomthumb&task=step3&imgid='.$imgid : sefReltoAbs('index.php?option=com_zoom&Itemid='.$Itemid.'&page=zoomthumb&task=step3&imgid='.$imgid )) .'">(back to step 3:: select styling)</a></p>'; | ||
| 159 : | echo '<p id="step"><strong>Step 4 :: the resulting mambot code</strong></p>'; | ||
| 160 : | |||
| 161 : | if ($imgid==''){ | ||
| 162 : | echo '<p>Warning: no image id was detected in the url.</p>'; | ||
| 163 : | break; | ||
| 164 : | }; | ||
| 165 : | |||
| 166 : | echo '<p>Copy Paste the following code into your text</p>'; | ||
| 167 : | |||
| 168 : | |||
| 169 : | $thumbzoomcode = "{moszoomthumb"; | ||
| 170 : | $thumbzoomcode .= " imgid=".$imgid; | ||
| 171 : | $thumbzoomcode .= " itemid=".$Itemid; | ||
| 172 : | |||
| 173 : | $thumbzoomcode .= ($style_m<>'1')?(' style_m='.$style_m):(''); | ||
| 174 : | $thumbzoomcode .= ($style_i<>'1')?(' style_i='.$style_i):(''); | ||
| 175 : | $thumbzoomcode .= ($style_c<>'1')?(' style_c='.$style_c):(''); | ||
| 176 : | |||
| 177 : | switch ($captionOption){ | ||
| 178 : | case '2': | ||
| 179 : | $thumbzoomcode .= ' caption=(none)'; | ||
| 180 : | break; | ||
| 181 : | case '3': | ||
| 182 : | $thumbzoomcode .= ' caption=('.$captionAlttext.')'; | ||
| 183 : | break; | ||
| 184 : | }; | ||
| 185 : | |||
| 186 : | $thumbzoomcode .= '}'; | ||
| 187 : | $thumbzoomcode = stripslashes($thumbzoomcode); | ||
| 188 : | |||
| 189 : | echo '<form name="zoomthumbcode">'; | ||
| 190 : | //@work@ add copytoclipboard button; | ||
| 191 : | echo '<textarea rows="3" cols="25" name="zoomthumbcode">'.$thumbzoomcode.'</textarea>'; | ||
| 192 : | //echo '<input type="text" name="zoomthumbcode" size="40" value="'.$thumbzoomcode.'">'; | ||
| 193 : | echo '</form>'; | ||
| 194 : | |||
| 195 : | |||
| 196 : | |||
| 197 : | break; | ||
| 198 : | |||
| 199 : | case "step1": //select source gallery | ||
| 200 : | default: //step 1 | ||
| 201 : | //@version@: add language, add better list by using mothernames as well | ||
| 202 : | echo '<div align="left"><p id="step"><strong>Step 1 :: choose gallery</strong></p>'; | ||
| 203 : | $zoom->_CAT_LIST = null; | ||
| 204 : | $zoom->_getCatList(0, '> ', '> '); | ||
| 205 : | |||
| 206 : | if(isset($zoom->_CAT_LIST)){ | ||
| 207 : | foreach($zoom->_CAT_LIST as $category){ | ||
| 208 : | echo '<p><a href="'. (($zoom->_isBackend) ? 'index2.php?option=com_zoom&Itemid='.$Itemid.'&page=zoomthumb&task=step2&catid='.$category['id'] : sefReltoAbs('index.php?option=com_zoom&Itemid='.$Itemid.'&page=zoomthumb&task=step2&catid='.$category['id'])) .'">Select:: </a> '.$category['catname']. '</p>'; | ||
| 209 : | } | ||
| 210 : | }else{ | ||
| 211 : | //@version@::get language here | ||
| 212 : | echo '<p>No gallery found.</p>'; | ||
| 213 : | }; | ||
| 214 : | |||
| 215 : | }; | ||
| 216 : | |||
| 217 : | //too much fluf at the bottom of the page right now due to all the embedding. So i add a lot of height to clear things up | ||
| 218 : | echo '<div align="left" style="clear: both; height: 300px;"></div><a href="http://forge.joomla.org/sf/projects/zoomthumb">Zoom Thumb</a>, use your Zoom gallery images in your Joomla! content.<hr></div>'; | ||
| 219 : | |||
| 220 : | |||
| 221 : | |||
| 222 : | |||
| 223 : | ?> |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |
Web Hosting provided by Network Redux.

