From: Reini U. <ru...@us...> - 2005-09-26 06:40:03
|
Update of /cvsroot/phpwiki/phpwiki/lib/plugin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27104/lib/plugin Modified Files: PhotoAlbum.php Log Message: re-add lost mode=column|row. by Thomas Harding Index: PhotoAlbum.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/plugin/PhotoAlbum.php,v retrieving revision 1.12 retrieving revision 1.13 diff -u -2 -b -p -d -r1.12 -r1.13 --- PhotoAlbum.php 20 Sep 2005 19:34:51 -0000 1.12 +++ PhotoAlbum.php 26 Sep 2005 06:39:55 -0000 1.13 @@ -31,10 +31,12 @@ rcs_id('$Id$'); * <?plugin PhotoAlbum * src="http://server/textfile" or localfile or localdir - * mode=[normal|thumbs|tiles|list|slide] + * mode=[normal|column|row|thumbs|tiles|list|slide] * desc=true * numcols=3 * height=50% * width=50% + * thumbswidth=80 * align=[center|left|right] + * duration=6 * ?> * @@ -116,4 +118,6 @@ extends WikiPlugin // "tiles" - WinXP tiles style // "list" - WinXP list style + // "row" - inline thumbnails + // "column" - photos full-size, displayed in 1 column // "slide" - slideshow mode, needs javascript on client 'numcols' => 3, // photos per row, columns @@ -146,5 +150,6 @@ extends WikiPlugin 'p' => false, // "displaythissinglephoto.jpg" 'h' => false, // "highlightcolorofthisphoto.jpg" - 'duration' => 6 // in slide mode, in seconds + 'duration' => 6, // in slide mode, in seconds + 'thumbswidth' => 80 //width of thumbnails ); } @@ -185,4 +190,9 @@ extends WikiPlugin } + if ($mode == "column") { + $mode="normal"; + $numcols="1"; + } + // set some fixed properties for each $mode if ($mode == 'thumbs' || $mode == 'tiles') { @@ -311,5 +321,7 @@ display_slides();")); //create url to display single larger version of image on page $url = WikiURL($request->getPage(), - array("p" => basename($value["name"]))); + array("p" => basename($value["name"]))) + . "#" + . basename($value["name"]); $b_url = WikiURL($request->getPage(), @@ -324,5 +336,6 @@ display_slides();")); if(!@empty($params['location'])) $params['src'] = $params['location']; unset ($params['location'],$params['src_tile']); - $url_image = $link ? HTML::a(array("href" => "$url"), HTML::img($params)) : HTML::img($params); + $url_image = $link ? HTML::a(array("id" => basename($value["name"])), + HTML::a(array("href" => "$url"), HTML::img($params))) : HTML::img($params); } else { $keep = $params; @@ -330,6 +343,7 @@ display_slides();")); $params['src'] = $params['src_tile'] ; unset ($params['location'],$params['src_tile']); - $url_image = $link ? HTML::a(array("href" => "$url"), - ImageTile::image_tile($params)) : HTML::img($params); + $url_image = $link ? HTML::a(array("id" => basename($value["name"])), + HTML::a(array("href" => "$url"), + ImageTile::image_tile($params))) : HTML::img($params); $params = $keep; unset ($keep); @@ -338,7 +352,9 @@ display_slides();")); if(!@empty($params['location'])) $params['src'] = $params['location']; unset ($params['location'],$params['src_tile']); - $url_image = $link ? HTML::a(array("href" => "$b_url"), HTML::img($params)) : HTML::img($params); + $url_image = $link ? HTML::a(array("id" => basename($value["name"])), + HTML::a(array("href" => "$b_url"), HTML::img($params))) : HTML::img($params); } - $url_text = HTML::a(array("name" => basename($value["name"])), + if ($mode == 'list') + $url_text = HTML::a(array("id" => basename($value["name"])), $url_text); // here we use different modes @@ -447,4 +463,14 @@ display_slides();")); ))); $count ++; + } elseif ($mode == 'row') { + $desc = ($showdesc != 'none') ? HTML::p($value["desc"]) : ''; + $row->pushContent( + HTML::table(array("style" => "display: inline"), + HTML::tr(HTML::td($url_image)), + HTML::tr(HTML::td(array("class" => "gensmall", + "style" => "text-align: center; " + ."background-color: $color"), + $desc)) + )); } else { return $this->error(fmt("Invalid argument: %s=%s", 'mode', $mode)); @@ -455,4 +481,7 @@ display_slides();")); ($key + 1) == count($photos) || $p) { + if ($mode == 'row') + $html->pushcontent(HTML::span($row)); + else $html->pushcontent(HTML::tr($row)); $row->setContent(''); @@ -469,4 +498,5 @@ display_slides();")); $table_attributes = array_merge($table_attributes, array("height" => $tableheight)); + if ($mode != 'row') $html = HTML::table($table_attributes, $html); // align all @@ -520,4 +550,8 @@ display_slides();")); function fromFile($src, &$photos, $webpath='') { $src_bak = $src; + //there has a big security hole... as loading config/config.ini ! + if (!preg_match('/(\.csv|\.jpg|\.jpeg|\.png|\.gif|\/)$/',$src)) { + return $this->error(_("File extension for csv file has to be '.csv'")); + } if (! IsSafeURL($src)) { return $this->error(_("Bad url in src: remove all of <, >, \"")); @@ -584,5 +618,7 @@ display_slides();")); } while ($data = fgetcsv($fp, 1024, ';')) { - if (count($data) == 0 || empty($data[0]) || preg_match('/^#/',$data[0])) + if (count($data) == 0 || empty($data[0]) + || preg_match('/^#/',$data[0]) + || preg_match('/^[[:space:]]*$/',$data[0])) continue; if (empty($data[1])) $data[1] = ''; @@ -599,8 +635,11 @@ display_slides();")); while (list($key,$value) = each($contents)) { $data = preg_split('/\;/',$value); - if (count($data) == 0 || empty($data[0]) || preg_match('/^#/',$data[0])) + if (count($data) == 0 || empty($data[0]) + || preg_match('/^#/',$data[0]) + || preg_match('/^[[:space:]]*$/',$data[0])) continue; if (empty($data[1])) $data[1] = ''; $photos[] = array ("name" => dirname($src)."/".trim($data[0]), + "src" => dirname($src)."/".trim($data[0]), "desc" => trim($data[1]), "name_tile" => dirname($src)."/".trim($data[0])); @@ -611,4 +650,7 @@ display_slides();")); // $Log$ +// Revision 1.13 2005/09/26 06:39:55 rurban +// re-add lost mode=column|row. by Thomas Harding +// // Revision 1.12 2005/09/20 19:34:51 rurban // slide and thumbs mode by Thomas Harding |