Support Forum Project Downloads FAQ Documentation About Demo Tutorials Blog Plugins
November 21, 2009, 01:02:18 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Private messages disabled
Caused by the massive abuse of the PM system in the past, the sending of personal messages has been disabled for all regular users on the Coppermine forum.
[more]
   Home   Help Search Board rules Login Register  
Pages: 1 2 3 4 [5] 6 7   Go Down
  Send this topic  |  Print  
Author Topic: Flikr style image annotations  (Read 50540 times)
0 Members and 1 Guest are viewing this topic.
Nibbler Topic starter
Dev Team member
****
Gender: Male
United Kingdom United Kingdom

Posts: 19445



WWW
« Reply #80 on: October 23, 2008, 02:39:33 pm »

Updated to 1.1. See first post.
Logged

I don't care about what they say, I won't live or die that way.
ksawery
Coppermine novice
*
Posts: 21


« Reply #81 on: October 27, 2008, 08:11:01 pm »

Great. Thanks!
Logged
gtgillis
Contributor
***
Posts: 3


« Reply #82 on: November 11, 2008, 10:13:56 pm »

Updated to 1.1. See first post.

Is there any chance that you will be adding annotation search capabilities?
Logged
Αndré
Dev Team member
****
Gender: Male
Germany Germany

Posts: 2014



« Reply #83 on: November 12, 2008, 07:20:09 am »

Is there any chance that you will be adding annotation search capabilities?
I've written an extra search for my purposes. It consists of an extra file (for the search form) and a new meta album (for the search results). It's NOT integrated in the standard search of cpg. If you are interested, I can give you the code as it is. The search form is hard-coded in german.
Logged

Pascal YAP
Dev Team member
****
Gender: Male
Armenia Armenia

Posts: 3791


He's me, and She's Moon


WWW
« Reply #84 on: November 12, 2008, 08:29:57 am »

eenemeenemuu,
 It would be nice to see your work  Grin
Logged

! Pas de PM please ! No PM s'il vous plait !
Αndré
Dev Team member
****
Gender: Male
Germany Germany

Posts: 2014



« Reply #85 on: November 12, 2008, 09:04:28 am »

This is for the search form. Create a new file and copy this into it:
Code:
<?php

define
('IN_COPPERMINE'true);
require(
'include/init.inc.php');

pageheader("Suche");

function 
div_start($tag)
{
  echo 
"<div id=\"$tag\" style=\"display:none;\">";
  
starttable("100%"$tag2);
}

function 
div_end()
{
  
endtable();
  echo 
"</div>";
}

starttable("100%""Auswahl",2);
echo 
"
  <tr>
    <td class=\"tableb\" width=\"200\">
      Ich suche nach:
    </td>
    <td class=\"tableb\">
      <input type=\"radio\" name=\"albfile\" onclick=\"document.getElementById('Bildersuche').style.display = 'none'; document.getElementById('Albensuche').style.display = 'block'; document.getElementById('album').focus();\" /> Alben
      <input type=\"radio\" name=\"albfile\" onclick=\"document.getElementById('Bildersuche').style.display = 'block'; document.getElementById('Albensuche').style.display = 'none';\" /> Dateien (Bilder, Videos)
    </td>
  </tr>
"
;
endtable();

div_start("Albensuche");
echo 
"
  <script type=\"text/javascript\">
    var alertTimerId = 0;

    function doSearch ( )
    {
      clearTimeout ( alertTimerId );
      document.getElementById('album').style.color = '#FF0000';
      alertTimerId = setTimeout ( 'DoShowResult()', 500 );
    }

    function DoShowResult ( )
    {
      document.getElementById('album').style.color = '#000000';
      clearTimeout ( alertTimerId );
      showResult(document.getElementById('album').value);
    }
  </script>

  <tr>
    <td class=\"tableb\">
      <form method=\"get\" action=\"thumbnails.php\">
        <input type=\"text\" id=\"album\" name=\"alb_title\" class=\"textinput\" size=\"50\" onkeyup=\"doSearch()\" />
        <input type=\"hidden\" name=\"album\" value=\"search_alb\" />
        <input type=\"submit\" name=\"Submit\" value=\"Suchen\" class=\"button\" />
        <div align=\"left\" id=\"livesearch\" style=\"position:absolute;background-color: #ffffff;\" />
      </form>
    </td>
  </tr>
"
;
div_end();

div_start("Bildersuche");
echo 
"</table><form method=\"get\" action=\"thumbnails.php\"><input type=\"hidden\" name=\"album\" value=\"search_pic\" />";

starttable("100%""Kriterien",2);
//$disabled = isfriend() ? "" : "disabled=\"disabled\"";
echo "
  <!--
  <tr>
    <td class=\"tableb\" width=\"200\">
      Alles <br />
    </td>
    <td class=\"tableb\">
      <input type=\"radio\" name=\"all\" value=\"on\" onclick=\" 
        document.getElementById('cat_on').click();
        document.getElementById('alb_on').click();
        document.getElementById('file_on').click();
        document.getElementById('com_on').click();
        document.getElementById('pers_on').click();
      \" /> Anzeigen
      <input type=\"radio\" name=\"all\" value=\"off\" onclick=\" 
        document.getElementById('cat_off').click();
        document.getElementById('alb_off').click();
        document.getElementById('file_off').click();
        document.getElementById('com_off').click();
        document.getElementById('pers_off').click();
      \" /> Nicht anzeigen
    </td>
  </tr>
  -->

  <tr>
    <td class=\"tableb\" width=\"200\">
      <b>Kategorie</b> -> Monat / Jahr <br />
    </td>
    <td class=\"tableb\">
      <input type=\"radio\" name=\"cat\" id=\"cat_on\" value=\"on\" onclick=\"document.getElementById('Kategorie').style.display = 'block'; document.getElementById('cat_month').focus();\" /> Anzeigen
      <input type=\"radio\" name=\"cat\" id=\"cat_off\" value=\"off\" onclick=\"document.getElementById('Kategorie').style.display = 'none';\" checked=\"checked\" /> Nicht anzeigen
    </td>
  </tr>

  <tr>
    <td class=\"tableb\" width=\"200\">
      <b>Album</b> -> Titel / Beschreibung
    </td>
    <td class=\"tableb\">
      <input type=\"radio\" name=\"alb\" id=\"alb_on\" value=\"on\" onclick=\"document.getElementById('Album').style.display = 'block'; document.getElementById('alb_title').focus();\" /> Anzeigen
      <input type=\"radio\" name=\"alb\" id=\"alb_off\" value=\"off\" onclick=\"document.getElementById('Album').style.display = 'none';\" checked=\"checked\" /> Nicht anzeigen
    </td>
  </tr>

  <tr>
    <td class=\"tableb\" width=\"200\">
      <b>Datei</b> -> Name / Endung
    </td>
    <td class=\"tableb\">
      <input type=\"radio\" name=\"file\" id=\"file_on\" value=\"on\" onclick=\"document.getElementById('Datei').style.display = 'block'; document.getElementById('file_name').focus();\" /> Anzeigen
      <input type=\"radio\" name=\"file\" id=\"file_off\" value=\"off\" onclick=\"document.getElementById('Datei').style.display = 'none';\" checked=\"checked\" /> Nicht anzeigen
    </td>
  </tr>

  <tr>
    <td class=\"tableb\" width=\"200\">
      <b>Kommentar</b> -> Autor / Text
    </td>
    <td class=\"tableb\">
      <input type=\"radio\" name=\"com\" id=\"com_on\" value=\"on\" onclick=\"document.getElementById('Kommentar').style.display = 'block'; document.getElementById('com_aut').focus();\" /> Anzeigen
      <input type=\"radio\" name=\"com\" id=\"com_off\" value=\"off\" onclick=\"document.getElementById('Kommentar').style.display = 'none';\" checked=\"checked\" /> Nicht anzeigen
    </td>
  </tr>

  <tr>
    <td class=\"tableb\" width=\"200\">
      <b>Person</b> -> Name
    </td>
    <td class=\"tableb\">
      <input type=\"radio\" name=\"pers\" id=\"pers_on\" value=\"on\" $disabled onclick=\"document.getElementById('Person').style.display = 'block'; document.getElementById('pers_name').focus();\" /> Anzeigen
      <input type=\"radio\" name=\"pers\" id=\"pers_off\" value=\"off\" onclick=\"document.getElementById('Person').style.display = 'none';\" checked=\"checked\" /> Nicht anzeigen
    </td>
  </tr>
"
;
endtable();

div_start("Kategorie");
$first_year mysql_result(cpg_db_query("SELECT MIN(name) FROM {$CONFIG['TABLE_CATEGORIES']}"),0);
$years "";
for (
$i=$first_year$i<=date("Y"); $i++)
  
$years .= "<option>$i</option>";
echo 
"
  <tr>
    <td class=\"tableb\" width=\"200\">
      Monat:
    </td>
    <td class=\"tableb\">
      <select id=\"cat_month\" name=\"cat_month\" class=\"button\" size=\"1\" style=\"width:300px;\">
        <option selected=\"selected\"></option>
        <option>Januar</option>
        <option>Februar</option>
        <option>M&auml;rz</option>
        <option>April</option>
        <option>Mai</option>
        <option>Juni</option>
        <option>Juli</option>
        <option>August</option>
        <option>September</option>
        <option>Oktober</option>
        <option>November</option>
        <option>Dezember</option>
      </select><br />
    </td>
  </tr>

  <tr>
    <td class=\"tableb\" width=\"200\">
      Jahr:
    </td>
    <td class=\"tableb\">
      <select name=\"cat_year\" class=\"button\" size=\"1\" style=\"width:300px;\">
        <option selected=\"selected\"></option> $years
      </selected>
    </td>
  </tr>
"
;
div_end();

div_start("Album");
echo 
"
  <tr>
    <td class=\"tableb\" width=\"200\">
      Titel:
    </td>
    <td class=\"tableb\">
      <input type=\"input\" id=\"alb_title\" name=\"alb_title\" class=\"textinput\" style=\"width:300px;\" />
    </td>
  </tr>

  <tr>
    <td class=\"tableb\" width=\"200\">
      Beschreibung:
    </td>
    <td class=\"tableb\">
      <input type=\"input\" name=\"alb_desc\" class=\"textinput\" style=\"width:300px;\" />
    </td>
  </tr>
"
;
div_end();

div_start("Datei");
echo 
"
  <tr>
    <td class=\"tableb\" width=\"200\">
      Name:
    </td>
    <td class=\"tableb\">
      <input type=\"input\" id=\"file_name\" name=\"file_name\" class=\"textinput\" style=\"width:300px;\" />
    </td>
  </tr>

  <tr>
    <td class=\"tableb\" width=\"200\">
      Endung:
    </td>
    <td class=\"tableb\">
      <input type=\"input\" name=\"file_ext\" class=\"textinput\" style=\"width:300px;\" /> (z.B. \"flv\" f&uuml;r alle Videos)
    </td>
  </tr>
"
;
div_end();

div_start("Kommentar");
echo 
"
  <tr>
    <td class=\"tableb\" width=\"200\">
      Autor:
    </td>
    <td class=\"tableb\">
      <input type=\"input\" id=\"com_aut\" name=\"com_aut\" class=\"textinput\" style=\"width:300px;\" />
    </td>
  </tr>

  <tr>
    <td class=\"tableb\" width=\"200\">
      Text:
    </td>
    <td class=\"tableb\">
      <input type=\"input\" name=\"com_text\" class=\"textinput\" style=\"width:300px;\" />
    </td>
  </tr>
"
;
div_end();

//if (isfriend())
//{
  
div_start("Person");
  echo 
"
    <tr>
      <td class=\"tableb\" width=\"200\">
        Name:
      </td>
      <td class=\"tableb\">
        <input type=\"input\" id=\"pers_name\" name=\"pers_name\" id=\"pers_name\" class=\"textinput\" style=\"width:300px;\" />
      </td>
    </tr>
  "
;
  
$result cpg_db_query("SELECT note FROM {$CONFIG['TABLE_PREFIX']}notes GROUP BY note ORDER BY note ASC");
  if (
mysql_num_rows($result))
  {
    echo 
"<tr><td class=\"tableb\" colspan=\"2\">";
    while (
$row mysql_fetch_array($resultMYSQL_NUM))
      echo 
"<span class=\"button\" style=\"cursor: pointer;\" onclick=\"document.getElementById('pers_name').value += ' '+'{$row[0]}'+' ';document.getElementById('search').focus();return false;\">&nbsp;{$row[0]}&nbsp;</span> ";
    echo 
"</td></tr>" ;
    echo 
"<tr><td class=\"tableb\" colspan=\"2\" align=\"center\">";
    echo 
"Obenstehende Liste enth&auml;lt alle bisher verlinkten Personen und k&ouml;nnen per Klick zur Suche hinzugef&uuml;gt werden.";
    echo 
"</td></tr>";
  }
  
div_end();
//}

starttable("100%""<input type=\"submit\" value=\"Suchen\" class=\"button\" />");
endtable();
echo 
"</form></div>";

pagefooter();

?>

FYI:
1. The field "Person" is for the annotations. I modified the plugin a little bit. In my gallery you mark persons that are on the picture, that's why it's called "Person".
2. The function isfriend() checks, if someone has the rights to access the person search (= search for annotations). I have disabled the check in this example, because it's only relevant in my gallery.
3. I have an AJAX script for pre searching the albums. If you get an error or something at the album search, the needed files are missing.


Here is the code for the meta albums. It has to copied into include/functions.inc.php:
Code:
        case 'search_pic': // Search pictures
                if ($META_ALBUM_SET && $CURRENT_CAT_NAME) {
                        $album_name = "Suchergebnisse - $CURRENT_CAT_NAME";
                } else {
                        $album_name = "Suchergebnisse";
                }

                $META_ALBUM_SET = str_replace("AND aid NOT IN","AND a.aid NOT IN",$META_ALBUM_SET);

                $get_array = array("file", "file_name", "file_ext", "com", "com_aut", "com_text", "alb", "alb_title", "alb_desc", "pers", "pers_name", "cat", "cat_month", "cat_year");
                foreach($get_array as $key)
                {
                  $_GET[$key] = isset($_GET[$key]) ? trim(preg_replace("[\s+]"," ",$_GET[$key])) : $_COOKIE[$key];
                  setcookie($key, $_GET[$key]);
                }

                $columns = "";
                $tables = "{$CONFIG['TABLE_PICTURES']} p INNER JOIN {$CONFIG['TABLE_ALBUMS']} a ON p.aid = a.aid";
                $where = "";
                $suffix = "";
                $order = "p.pid";

                if ($_GET['file'] == "on")
                {
                  $where .= "AND (";
                  if ($_GET['file_name'] != "")
                  {
                    $file_name_parts = explode(" ", $_GET['file_name']);
                    foreach ($file_name_parts as $value)
                      $where .= "p.filename LIKE '%$value%' AND ";
                  }
                  if (trim($_GET['file_ext']) != "")
                    $where .= "p.filename LIKE '%.".trim($_GET['file_ext'])."' AND ";
                  $where .= "1) ";
                }

                if ($_GET['com'] == "on")
                {
                  $tables .= " INNER JOIN {$CONFIG['TABLE_COMMENTS']} c ON c.pid = p.pid";
                  $where .= "AND (";
                  $order = "c.msg_id";
                  if ($_GET['com_text'] != "")
                  {
                    $com_text_parts = explode(" ", $_GET['com_text']);
                    foreach ($com_text_parts as $value)
                      $where .= "c.msg_body LIKE '%$value%' AND ";
                  }
                  if ($_GET['com_aut'] != "")
                    $where .= "c.msg_author LIKE '%{$_GET['com_aut']}%' AND ";
                  $where .= "1) ";
                }

                if ($_GET['alb'] == "on")
                {
                  $where .= "AND (";
                  if ($_GET['alb_title'] != "")
                  {
                    $alb_title_parts = explode(" ", $_GET['alb_title']);
                    foreach ($alb_title_parts as $value)
                      $where .= "a.title LIKE '%$value%' AND ";
                  }
                  if ($_GET['alb_desc'] != "")
                  {
                    $alb_desc_parts = explode(" ", $_GET['alb_desc']);
                    foreach ($alb_desc_parts as $value)
                      $where .= "a.description LIKE '%$value%' AND ";
                  }
                  $where .= "1) ";
                }

                if ($_GET['pers'] == "on")
                {
                  if ($_GET['pers_name'] != "")
                  {
                    $columns .= ", COUNT(DISTINCT note) AS anzahl";
                    $tables .= " INNER JOIN {$CONFIG['TABLE_PREFIX']}notes n ON p.pid = n.pid";
                    $where .= "AND (";
                    $pers_name_parts = explode(" ", $_GET['pers_name']);
                    $pcount = count($pers_name_parts);
                    for ($i=0;$i<$pcount-1;$i++)
                      $where .= "n.note = '{$pers_name_parts[$i]}' OR ";
                    $where .= "n.note = '{$pers_name_parts[$i]}' AND ";
                    $where .= "1) ";
                    $suffix = "GROUP BY p.pid HAVING anzahl = $pcount";
                  }
                }

                if ($_GET['cat'] == "on")
                {
                  $tables .= " INNER JOIN {$CONFIG['TABLE_CATEGORIES']} cm ON cm.cid = a.category";
                  $where .= "AND (";
                  if ($_GET['cat_month'] != "")
                    $where .= "cm.name LIKE '{$_GET['cat_month']}' AND ";
                  if ($_GET['cat_year'] != "")
                  {
                    $tables .= " INNER JOIN {$CONFIG['TABLE_CATEGORIES']} cy ON cm.parent = cy.cid";
                    $where .= "cy.name LIKE '{$_GET['cat_year']}' AND ";
                  }
                  $where .= "1) ";
                }

                $query = "SELECT DISTINCT(p.pid) $columns FROM $tables WHERE approved = 'YES' $where $META_ALBUM_SET $suffix";
                $result = cpg_db_query($query);
                $count = mysql_num_rows($result);
                mysql_free_result($result);

                $select_columns = 'DISTINCT p.*, a.title';
                $query = "SELECT $select_columns $columns FROM $tables WHERE approved = 'YES' $where $META_ALBUM_SET $suffix ORDER BY $order DESC $limit";
                $result = cpg_db_query($query);

                $rowset = array();
                while($row = mysql_fetch_array($result)){
                        $rowset[-$row['pid']] = $row;
                }
                mysql_free_result($result);

                if ($set_caption) build_caption($rowset);

                $rowset = CPGPluginAPI::filter('thumb_caption_search_pic',$rowset);

                return $rowset;
                break;

        case 'search_alb': // Search albums
                if ($META_ALBUM_SET && $CURRENT_CAT_NAME) {
                        $album_name = "Suchergebnisse - $CURRENT_CAT_NAME";
                } else {
                        $album_name = "Suchergebnisse";
                }

                if (isset($_GET['alb_title']))
                  $alb_title = trim(preg_replace("[\s+]"," ",$_GET['alb_title']));
                else
                  $alb_title = $_COOKIE['alb_title'];

                setcookie('alb_title', $alb_title);

                $where = "";
                $alb_title_parts = explode(" ", $alb_title);
                foreach ($alb_title_parts as $key => $value)
                  $where .= "{$CONFIG['TABLE_ALBUMS']}.title LIKE '%$value%' AND ";

                $META_ALBUM_SET = str_replace("aid", $CONFIG['TABLE_PICTURES'].".aid", $META_ALBUM_SET);

                $query = "SELECT count({$CONFIG['TABLE_ALBUMS']}.aid) FROM {$CONFIG['TABLE_PICTURES']},{$CONFIG['TABLE_ALBUMS']} WHERE $where {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND approved = 'YES' $META_ALBUM_SET GROUP BY {$CONFIG['TABLE_PICTURES']}.aid";

                $result = cpg_db_query($query);
                $count = mysql_num_rows($result);
                mysql_free_result($result);

                //$query = "SELECT *,{$CONFIG['TABLE_ALBUMS']}.title AS title,{$CONFIG['TABLE_ALBUMS']}.aid AS aid FROM {$CONFIG['TABLE_PICTURES']},{$CONFIG['TABLE_ALBUMS']} WHERE {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND approved = 'YES' $META_ALBUM_SET GROUP BY {$CONFIG['TABLE_PICTURES']}.aid ORDER BY {$CONFIG['TABLE_PICTURES']}.ctime DESC $limit";
                //display album thumbnail // by muu
                $query = "SELECT *,{$CONFIG['TABLE_ALBUMS']}.title AS title,{$CONFIG['TABLE_ALBUMS']}.aid AS aid FROM {$CONFIG['TABLE_PICTURES']},{$CONFIG['TABLE_ALBUMS']} WHERE $where {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND approved = 'YES' AND {$CONFIG['TABLE_PICTURES']}.pid = {$CONFIG['TABLE_ALBUMS']}.thumb $META_ALBUM_SET ORDER BY {$CONFIG['TABLE_PICTURES']}.ctime DESC $limit"; // by muu
                $result = cpg_db_query($query);
                $rowset = cpg_db_fetch_rowset($result);
                mysql_free_result($result);

                if ($set_caption) build_caption($rowset,array('ctime'));

                $rowset = CPGPluginAPI::filter('thumb_caption_lastalb',$rowset);

                return $rowset;
                break;

For HTML titles you have to add the 2 meta albums in your language file ($lang_meta_album_names[])


I suppose that's all you have to know Cheesy
Logged

paquets
Coppermine novice
*
Posts: 35


« Reply #86 on: December 08, 2008, 01:24:47 pm »

This plugin is really cool and a search function would make it even greater...

Would it be possible to have a search function that gives the search results in the same output as the traditional coppermine search? Do you think it would be possible to use the plugin "Seach Albums" and tweak it accordingly?
Logged
Αndré
Dev Team member
****
Gender: Male
Germany Germany

Posts: 2014



« Reply #87 on: December 08, 2008, 01:34:45 pm »

Would it be possible to have a search function that gives the search results in the same output as the traditional coppermine search?
Read the post above Roll Eyes This will generate a new search and can't be used with the standard search form from cpg. You just have to delete the functions you don't need (it's a search form, not just for searching annotations).
Logged

paquets
Coppermine novice
*
Posts: 35


« Reply #88 on: December 08, 2008, 01:41:01 pm »

I see,

I guess the fact that I don't speak or read German doesn't help. I'll try and figure it out. Thanks!
Logged
Αndré
Dev Team member
****
Gender: Male
Germany Germany

Posts: 2014



« Reply #89 on: December 08, 2008, 01:49:29 pm »

I've written this search form for my personal gallery and posted my code, because Pascal asked for it.

All you have to know (for testing it) is:
1. at "Ich suche nach:", select "Dateien (Bilder, Videos)"
2. at "Kriterien", "Person -> Name", select "Anzeigen"
-> the search form for the annotations appears
Logged

pukas
Coppermine newbie

Posts: 4


« Reply #90 on: January 10, 2009, 12:23:09 pm »

I've a problem...I've installed the plugin but the search feature doesn't work...the search say to me: no images...
what's the problem?
can you say to me where I've to insert case_image pics in config.inc file?
Logged
Αndré
Dev Team member
****
Gender: Male
Germany Germany

Posts: 2014



« Reply #91 on: January 10, 2009, 12:51:22 pm »

I've a problem...I've installed the plugin but the search feature doesn't work...the search say to me: no images...
what's the problem?
can you say to me where I've to insert case_image pics in config.inc file?
You want to insert what in which file Huh Which search feature do you mean? The plugin doesn't come with a search feature.
Maybe it would be helpful to give us a link to your annotations search page.
Logged

pukas
Coppermine newbie

Posts: 4


« Reply #92 on: January 10, 2009, 01:22:11 pm »

This is for the search form. Create a new file and copy this into it:
Code:
<?php

define
('IN_COPPERMINE'true);
require(
'include/init.inc.php');

pageheader("Suche");

function 
div_start($tag)
{
  echo 
"<div id=\"$tag\" style=\"display:none;\">";
  
starttable("100%"$tag2);
}

function 
div_end()
{
  
endtable();
  echo 
"</div>";
}

starttable("100%""Auswahl",2);
echo 
"
  <tr>
    <td class=\"tableb\" width=\"200\">
      Ich suche nach:
    </td>
    <td class=\"tableb\">
      <input type=\"radio\" name=\"albfile\" onclick=\"document.getElementById('Bildersuche').style.display = 'none'; document.getElementById('Albensuche').style.display = 'block'; document.getElementById('album').focus();\" /> Alben
      <input type=\"radio\" name=\"albfile\" onclick=\"document.getElementById('Bildersuche').style.display = 'block'; document.getElementById('Albensuche').style.display = 'none';\" /> Dateien (Bilder, Videos)
    </td>
  </tr>
"
;
endtable();

div_start("Albensuche");
echo 
"
  <script type=\"text/javascript\">
    var alertTimerId = 0;

    function doSearch ( )
    {
      clearTimeout ( alertTimerId );
      document.getElementById('album').style.color = '#FF0000';
      alertTimerId = setTimeout ( 'DoShowResult()', 500 );
    }

    function DoShowResult ( )
    {
      document.getElementById('album').style.color = '#000000';
      clearTimeout ( alertTimerId );
      showResult(document.getElementById('album').value);
    }
  </script>

  <tr>
    <td class=\"tableb\">
      <form method=\"get\" action=\"thumbnails.php\">
        <input type=\"text\" id=\"album\" name=\"alb_title\" class=\"textinput\" size=\"50\" onkeyup=\"doSearch()\" />
        <input type=\"hidden\" name=\"album\" value=\"search_alb\" />
        <input type=\"submit\" name=\"Submit\" value=\"Suchen\" class=\"button\" />
        <div align=\"left\" id=\"livesearch\" style=\"position:absolute;background-color: #ffffff;\" />
      </form>
    </td>
  </tr>
"
;
div_end();

div_start("Bildersuche");
echo 
"</table><form method=\"get\" action=\"thumbnails.php\"><input type=\"hidden\" name=\"album\" value=\"search_pic\" />";

starttable("100%""Kriterien",2);
//$disabled = isfriend() ? "" : "disabled=\"disabled\"";
echo "
  <!--
  <tr>
    <td class=\"tableb\" width=\"200\">
      Alles <br />
    </td>
    <td class=\"tableb\">
      <input type=\"radio\" name=\"all\" value=\"on\" onclick=\" 
        document.getElementById('cat_on').click();
        document.getElementById('alb_on').click();
        document.getElementById('file_on').click();
        document.getElementById('com_on').click();
        document.getElementById('pers_on').click();
      \" /> Anzeigen
      <input type=\"radio\" name=\"all\" value=\"off\" onclick=\" 
        document.getElementById('cat_off').click();
        document.getElementById('alb_off').click();
        document.getElementById('file_off').click();
        document.getElementById('com_off').click();
        document.getElementById('pers_off').click();
      \" /> Nicht anzeigen
    </td>
  </tr>
  -->

  <tr>
    <td class=\"tableb\" width=\"200\">
      <b>Kategorie</b> -> Monat / Jahr <br />
    </td>
    <td class=\"tableb\">
      <input type=\"radio\" name=\"cat\" id=\"cat_on\" value=\"on\" onclick=\"document.getElementById('Kategorie').style.display = 'block'; document.getElementById('cat_month').focus();\" /> Anzeigen
      <input type=\"radio\" name=\"cat\" id=\"cat_off\" value=\"off\" onclick=\"document.getElementById('Kategorie').style.display = 'none';\" checked=\"checked\" /> Nicht anzeigen
    </td>
  </tr>

  <tr>
    <td class=\"tableb\" width=\"200\">
      <b>Album</b> -> Titel / Beschreibung
    </td>
    <td class=\"tableb\">
      <input type=\"radio\" name=\"alb\" id=\"alb_on\" value=\"on\" onclick=\"document.getElementById('Album').style.display = 'block'; document.getElementById('alb_title').focus();\" /> Anzeigen
      <input type=\"radio\" name=\"alb\" id=\"alb_off\" value=\"off\" onclick=\"document.getElementById('Album').style.display = 'none';\" checked=\"checked\" /> Nicht anzeigen
    </td>
  </tr>

  <tr>
    <td class=\"tableb\" width=\"200\">
      <b>Datei</b> -> Name / Endung
    </td>
    <td class=\"tableb\">
      <input type=\"radio\" name=\"file\" id=\"file_on\" value=\"on\" onclick=\"document.getElementById('Datei').style.display = 'block'; document.getElementById('file_name').focus();\" /> Anzeigen
      <input type=\"radio\" name=\"file\" id=\"file_off\" value=\"off\" onclick=\"document.getElementById('Datei').style.display = 'none';\" checked=\"checked\" /> Nicht anzeigen
    </td>
  </tr>

  <tr>
    <td class=\"tableb\" width=\"200\">
      <b>Kommentar</b> -> Autor / Text
    </td>
    <td class=\"tableb\">
      <input type=\"radio\" name=\"com\" id=\"com_on\" value=\"on\" onclick=\"document.getElementById('Kommentar').style.display = 'block'; document.getElementById('com_aut').focus();\" /> Anzeigen
      <input type=\"radio\" name=\"com\" id=\"com_off\" value=\"off\" onclick=\"document.getElementById('Kommentar').style.display = 'none';\" checked=\"checked\" /> Nicht anzeigen
    </td>
  </tr>

  <tr>
    <td class=\"tableb\" width=\"200\">
      <b>Person</b> -> Name
    </td>
    <td class=\"tableb\">
      <input type=\"radio\" name=\"pers\" id=\"pers_on\" value=\"on\" $disabled onclick=\"document.getElementById('Person').style.display = 'block'; document.getElementById('pers_name').focus();\" /> Anzeigen
      <input type=\"radio\" name=\"pers\" id=\"pers_off\" value=\"off\" onclick=\"document.getElementById('Person').style.display = 'none';\" checked=\"checked\" /> Nicht anzeigen
    </td>
  </tr>
"
;
endtable();

div_start("Kategorie");
$first_year mysql_result(cpg_db_query("SELECT MIN(name) FROM {$CONFIG['TABLE_CATEGORIES']}"),0);
$years "";
for (
$i=$first_year$i<=date("Y"); $i++)
  
$years .= "<option>$i</option>";
echo 
"
  <tr>
    <td class=\"tableb\" width=\"200\">
      Monat:
    </td>
    <td class=\"tableb\">
      <select id=\"cat_month\" name=\"cat_month\" class=\"button\" size=\"1\" style=\"width:300px;\">
        <option selected=\"selected\"></option>
        <option>Januar</option>
        <option>Februar</option>
        <option>M&auml;rz</option>
        <option>April</option>
        <option>Mai</option>
        <option>Juni</option>
        <option>Juli</option>
        <option>August</option>
        <option>September</option>
        <option>Oktober</option>
        <option>November</option>
        <option>Dezember</option>
      </select><br />
    </td>
  </tr>

  <tr>
    <td class=\"tableb\" width=\"200\">
      Jahr:
    </td>
    <td class=\"tableb\">
      <select name=\"cat_year\" class=\"button\" size=\"1\" style=\"width:300px;\">
        <option selected=\"selected\"></option> $years
      </selected>
    </td>
  </tr>
"
;
div_end();

div_start("Album");
echo 
"
  <tr>
    <td class=\"tableb\" width=\"200\">
      Titel:
    </td>
    <td class=\"tableb\">
      <input type=\"input\" id=\"alb_title\" name=\"alb_title\" class=\"textinput\" style=\"width:300px;\" />
    </td>
  </tr>

  <tr>
    <td class=\"tableb\" width=\"200\">
      Beschreibung:
    </td>
    <td class=\"tableb\">
      <input type=\"input\" name=\"alb_desc\" class=\"textinput\" style=\"width:300px;\" />
    </td>
  </tr>
"
;
div_end();

div_start("Datei");
echo 
"
  <tr>
    <td class=\"tableb\" width=\"200\">
      Name:
    </td>
    <td class=\"tableb\">
      <input type=\"input\" id=\"file_name\" name=\"file_name\" class=\"textinput\" style=\"width:300px;\" />
    </td>
  </tr>

  <tr>
    <td class=\"tableb\" width=\"200\">
      Endung:
    </td>
    <td class=\"tableb\">
      <input type=\"input\" name=\"file_ext\" class=\"textinput\" style=\"width:300px;\" /> (z.B. \"flv\" f&uuml;r alle Videos)
    </td>
  </tr>
"
;
div_end();

div_start("Kommentar");
echo 
"
  <tr>
    <td class=\"tableb\" width=\"200\">
      Autor:
    </td>
    <td class=\"tableb\">
      <input type=\"input\" id=\"com_aut\" name=\"com_aut\" class=\"textinput\" style=\"width:300px;\" />
    </td>
  </tr>

  <tr>
    <td class=\"tableb\" width=\"200\">
      Text:
    </td>
    <td class=\"tableb\">
      <input type=\"input\" name=\"com_text\" class=\"textinput\" style=\"width:300px;\" />
    </td>
  </tr>
"
;
div_end();

//if (isfriend())
//{
  
div_start("Person");
  echo 
"
    <tr>
      <td class=\"tableb\" width=\"200\">
        Name:
      </td>
      <td class=\"tableb\">
        <input type=\"input\" id=\"pers_name\" name=\"pers_name\" id=\"pers_name\" class=\"textinput\" style=\"width:300px;\" />
      </td>
    </tr>
  "
;
  
$result cpg_db_query("SELECT note FROM {$CONFIG['TABLE_PREFIX']}notes GROUP BY note ORDER BY note ASC");
  if (
mysql_num_rows($result))
  {
    echo 
"<tr><td class=\"tableb\" colspan=\"2\">";
    while (
$row mysql_fetch_array($resultMYSQL_NUM))
      echo 
"<span class=\"button\" style=\"cursor: pointer;\" onclick=\"document.getElementById('pers_name').value += ' '+'{$row[0]}'+' ';document.getElementById('search').focus();return false;\">&nbsp;{$row[0]}&nbsp;</span> ";
    echo 
"</td></tr>" ;
    echo 
"<tr><td class=\"tableb\" colspan=\"2\" align=\"center\">";
    echo 
"Obenstehende Liste enth&auml;lt alle bisher verlinkten Personen und k&ouml;nnen per Klick zur Suche hinzugef&uuml;gt werden.";
    echo 
"</td></tr>";
  }
  
div_end();
//}

starttable("100%""<input type=\"submit\" value=\"Suchen\" class=\"button\" />");
endtable();
echo 
"</form></div>";

pagefooter();

?>

FYI:
1. The field "Person" is for the annotations. I modified the plugin a little bit. In my gallery you mark persons that are on the picture, that's why it's called "Person".
2. The function isfriend() checks, if someone has the rights to access the person search (= search for annotations). I have disabled the check in this example, because it's only relevant in my gallery.
3. I have an AJAX script for pre searching the albums. If you get an error or something at the album search, the needed files are missing.


Here is the code for the meta albums. It has to copied into include/functions.inc.php:
Code:
        case 'search_pic': // Search pictures
                if ($META_ALBUM_SET && $CURRENT_CAT_NAME) {
                        $album_name = "Suchergebnisse - $CURRENT_CAT_NAME";
                } else {
                        $album_name = "Suchergebnisse";
                }

                $META_ALBUM_SET = str_replace("AND aid NOT IN","AND a.aid NOT IN",$META_ALBUM_SET);

                $get_array = array("file", "file_name", "file_ext", "com", "com_aut", "com_text", "alb", "alb_title", "alb_desc", "pers", "pers_name", "cat", "cat_month", "cat_year");
                foreach($get_array as $key)
                {
                  $_GET[$key] = isset($_GET[$key]) ? trim(preg_replace("[\s+]"," ",$_GET[$key])) : $_COOKIE[$key];
                  setcookie($key, $_GET[$key]);
                }

                $columns = "";
                $tables = "{$CONFIG['TABLE_PICTURES']} p INNER JOIN {$CONFIG['TABLE_ALBUMS']} a ON p.aid = a.aid";
                $where = "";
                $suffix = "";
                $order = "p.pid";

                if ($_GET['file'] == "on")
                {
                  $where .= "AND (";
                  if ($_GET['file_name'] != "")
                  {
                    $file_name_parts = explode(" ", $_GET['file_name']);
                    foreach ($file_name_parts as $value)
                      $where .= "p.filename LIKE '%$value%' AND ";
                  }
                  if (trim($_GET['file_ext']) != "")
                    $where .= "p.filename LIKE '%.".trim($_GET['file_ext'])."' AND ";
                  $where .= "1) ";
                }

                if ($_GET['com'] == "on")
                {
                  $tables .= " INNER JOIN {$CONFIG['TABLE_COMMENTS']} c ON c.pid = p.pid";
                  $where .= "AND (";
                  $order = "c.msg_id";
                  if ($_GET['com_text'] != "")
                  {
                    $com_text_parts = explode(" ", $_GET['com_text']);
                    foreach ($com_text_parts as $value)
                      $where .= "c.msg_body LIKE '%$value%' AND ";
                  }
                  if ($_GET['com_aut'] != "")
                    $where .= "c.msg_author LIKE '%{$_GET['com_aut']}%' AND ";
                  $where .= "1) ";
                }

                if ($_GET['alb'] == "on")
                {
                  $where .= "AND (";
                  if ($_GET['alb_title'] != "")
                  {
                    $alb_title_parts = explode(" ", $_GET['alb_title']);
                    foreach ($alb_title_parts as $value)
                      $where .= "a.title LIKE '%$value%' AND ";
                  }
                  if ($_GET['alb_desc'] != "")
                  {
                    $alb_desc_parts = explode(" ", $_GET['alb_desc']);
                    foreach ($alb_desc_parts as $value)
                      $where .= "a.description LIKE '%$value%' AND ";
                  }
                  $where .= "1) ";
                }

                if ($_GET['pers'] == "on")
                {
                  if ($_GET['pers_name'] != "")
                  {
                    $columns .= ", COUNT(DISTINCT note) AS anzahl";
                    $tables .= " INNER JOIN {$CONFIG['TABLE_PREFIX']}notes n ON p.pid = n.pid";
                    $where .= "AND (";
                    $pers_name_parts = explode(" ", $_GET['pers_name']);
                    $pcount = count($pers_name_parts);
                    for ($i=0;$i<$pcount-1;$i++)
                      $where .= "n.note = '{$pers_name_parts[$i]}' OR ";
                    $where .= "n.note = '{$pers_name_parts[$i]}' AND ";
                    $where .= "1) ";
                    $suffix = "GROUP BY p.pid HAVING anzahl = $pcount";
                  }
                }

                if ($_GET['cat'] == "on")
                {
                  $tables .= " INNER JOIN {$CONFIG['TABLE_CATEGORIES']} cm ON cm.cid = a.category";
                  $where .= "AND (";
                  if ($_GET['cat_month'] != "")
                    $where .= "cm.name LIKE '{$_GET['cat_month']}' AND ";
                  if ($_GET['cat_year'] != "")
                  {
                    $tables .= " INNER JOIN {$CONFIG['TABLE_CATEGORIES']} cy ON cm.parent = cy.cid";
                    $where .= "cy.name LIKE '{$_GET['cat_year']}' AND ";
                  }
                  $where .= "1) ";
                }

                $query = "SELECT DISTINCT(p.pid) $columns FROM $tables WHERE approved = 'YES' $where $META_ALBUM_SET $suffix";
                $result = cpg_db_query($query);
                $count = mysql_num_rows($result);
                mysql_free_result($result);

                $select_columns = 'DISTINCT p.*, a.title';
                $query = "SELECT $select_columns $columns FROM $tables WHERE approved = 'YES' $where $META_ALBUM_SET $suffix ORDER BY $order DESC $limit";
                $result = cpg_db_query($query);

                $rowset = array();
                while($row = mysql_fetch_array($result)){
                        $rowset[-$row['pid']] = $row;
                }
                mysql_free_result($result);

                if ($set_caption) build_caption($rowset);

                $rowset = CPGPluginAPI::filter('thumb_caption_search_pic',$rowset);

                return $rowset;
                break;

        case 'search_alb': // Search albums
                if ($META_ALBUM_SET && $CURRENT_CAT_NAME) {
                        $album_name = "Suchergebnisse - $CURRENT_CAT_NAME";
                } else {
                        $album_name = "Suchergebnisse";
                }

                if (isset($_GET['alb_title']))
                  $alb_title = trim(preg_replace("[\s+]"," ",$_GET['alb_title']));
                else
                  $alb_title = $_COOKIE['alb_title'];

                setcookie('alb_title', $alb_title);

                $where = "";
                $alb_title_parts = explode(" ", $alb_title);
                foreach ($alb_title_parts as $key => $value)
                  $where .= "{$CONFIG['TABLE_ALBUMS']}.title LIKE '%$value%' AND ";

                $META_ALBUM_SET = str_replace("aid", $CONFIG['TABLE_PICTURES'].".aid", $META_ALBUM_SET);

                $query = "SELECT count({$CONFIG['TABLE_ALBUMS']}.aid) FROM {$CONFIG['TABLE_PICTURES']},{$CONFIG['TABLE_ALBUMS']} WHERE $where {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND approved = 'YES' $META_ALBUM_SET GROUP BY {$CONFIG['TABLE_PICTURES']}.aid";

                $result = cpg_db_query($query);
                $count = mysql_num_rows($result);
                mysql_free_result($result);

                //$query = "SELECT *,{$CONFIG['TABLE_ALBUMS']}.title AS title,{$CONFIG['TABLE_ALBUMS']}.aid AS aid FROM {$CONFIG['TABLE_PICTURES']},{$CONFIG['TABLE_ALBUMS']} WHERE {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND approved = 'YES' $META_ALBUM_SET GROUP BY {$CONFIG['TABLE_PICTURES']}.aid ORDER BY {$CONFIG['TABLE_PICTURES']}.ctime DESC $limit";
                //display album thumbnail // by muu
                $query = "SELECT *,{$CONFIG['TABLE_ALBUMS']}.title AS title,{$CONFIG['TABLE_ALBUMS']}.aid AS aid FROM {$CONFIG['TABLE_PICTURES']},{$CONFIG['TABLE_ALBUMS']} WHERE $where {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND approved = 'YES' AND {$CONFIG['TABLE_PICTURES']}.pid = {$CONFIG['TABLE_ALBUMS']}.thumb $META_ALBUM_SET ORDER BY {$CONFIG['TABLE_PICTURES']}.ctime DESC $limit"; // by muu
                $result = cpg_db_query($query);
                $rowset = cpg_db_fetch_rowset($result);
                mysql_free_result($result);

                if ($set_caption) build_caption($rowset,array('ctime'));

                $rowset = CPGPluginAPI::filter('thumb_caption_lastalb',$rowset);

                return $rowset;
                break;

For HTML titles you have to add the 2 meta albums in your language file ($lang_meta_album_names[])


I suppose that's all you have to know Cheesy

I'm asking about it
Logged
Αndré
Dev Team member
****
Gender: Male
Germany Germany

Posts: 2014



« Reply #93 on: January 10, 2009, 01:32:24 pm »

Please give a link to your annotations search form.
Logged

ff
Coppermine regular visitor
**
Gender: Male
Netherlands Netherlands

Posts: 80


WWW
« Reply #94 on: January 16, 2009, 08:23:11 pm »

I tried installing this plugin and got this message.

"There was an error while processing a database query"

Something I can try?
Logged
Nibbler Topic starter
Dev Team member
****
Gender: Male
United Kingdom United Kingdom

Posts: 19445



WWW
« Reply #95 on: January 16, 2009, 08:32:11 pm »

Enable debug mode in config, try again, post error message if it doesn't mean anything to you.
Logged

I don't care about what they say, I won't live or die that way.
ff
Coppermine regular visitor
**
Gender: Male
Netherlands Netherlands

Posts: 80


WWW
« Reply #96 on: January 16, 2009, 09:03:29 pm »

The error message is:
Quote
While executing query "   
CREATE TABLE IF NOT EXISTS `cpg_notes` (
  `nid` smallint(5) unsigned NOT NULL auto_increment,
  `pid` mediumint(Cool unsigned NOT NULL,
  `posx` smallint(5) unsigned NOT NULL,
  `posy` smallint(5) unsigned NOT NULL,
  `width` smallint(5) unsigned NOT NULL,
  `height` smallint(5) unsigned NOT NULL,
  `note` text NOT NULL,
  `user_id` smallint(5) unsigned NOT NULL,
  PRIMARY KEY  (`nid`),
  KEY `pid` (`pid`)
) TYPE=MyISAM ;
" on 0

mySQL error: You have an error in your SQL syntax near ';
' at line 13
File: /var/virtual/fotoalbum/include/functions.inc.php - Line: 250


TYPE=MyISAM is the error?
Logged
Nibbler Topic starter
Dev Team member
****
Gender: Male
United Kingdom United Kingdom

Posts: 19445



WWW
« Reply #97 on: January 16, 2009, 10:00:26 pm »

Shouldn't be. Try creating the table manually using phpMyAdmin if you know how.
Logged

I don't care about what they say, I won't live or die that way.
ff
Coppermine regular visitor
**
Gender: Male
Netherlands Netherlands

Posts: 80


WWW
« Reply #98 on: January 17, 2009, 09:29:02 pm »

Shouldn't be. Try creating the table manually using phpMyAdmin if you know how.

I pasted the same 'query' into de SQL-tab and it worked perfectly.
I don't get why the script couldn't insert the table.
Removed the part from codebase.php and the installation worked also.

Nice plugin Wink

Logged
evildeepblue
Coppermine newbie

Posts: 6


« Reply #99 on: January 19, 2009, 06:40:12 am »

It's really cool !!  Tongue

Has any language translate idea ?  Grin
Logged
Pages: 1 2 3 4 [5] 6 7   Go Up
  Send this topic  |  Print  
 
Jump to:  

Powered by SMF 1.1.10 | SMF © 2006-2009, Simple Machines LLC
Page created in 0.112 seconds with 15 queries.