Changeset 3666


Ignore:
Timestamp:
Jul 24, 2009, 11:11:36 AM (15 years ago)
Author:
grum
Message:

Update LMT to 1.0.3
Minor changes (bugs / see main.inc.php file for details)

Location:
extensions/lmt
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • extensions/lmt/admin/plugin_admin_list.tpl

    r3396 r3666  
    1010    $("#nbphotos").attr("innerHTML", tmp.substr(0,tmp.indexOf("#")));
    1111    $("#list").attr("innerHTML", tmp.substr(tmp.indexOf("#")+1));
     12    $("#filter").value("innerHTML", tmp.substr(tmp.indexOf("#")+1));
    1213  }
    1314{/literal}
     
    2728  </div>
    2829 
     30  <form method="POST">
    2931    <p class="lmt_page" style="border-top:1px dotted;padding-top:10px;">
    3032      <span id="nbphotos" style="float:right;"></span>
     
    3739    </p>
    3840
    39   <form method="POST">
    4041    <input type="submit" name="submit_add_to_caddie" value="{'lmt_add_to_caddie'|@translate}">&nbsp;
    4142    <input type="submit" name="submit_replace_caddie" value="{'lmt_replace_caddie'|@translate}">
  • extensions/lmt/admin/plugin_admin_listitems.tpl

    r3396 r3666  
    1212      <td>
    1313        <span>
    14           [ <a href="{$data.catlink}">{$data.catname}</a> ]<br/>
     14          <br/><div class="is_on" id="imgfi{$data.id}" onclick="swap_state('fi{$data.id}');">&nbsp;</div>
    1515          [ <a href="{$data.imglink}">{$data.file}</a> ]<br/>
    16           <img src="{$data.licencei}"/> <br/>
     16          ---<br/>
     17          {foreach from=$data.cat key=catname item=catdata}
     18            [ <a href="{$catdata.link}">{$catdata.name}</a> ]<br/>
     19          {/foreach}
     20          {if $data.licencei!=""}
     21          <img src="{$data.licencei}"/><br/>
    1722          <i>{$data.aut_text1}<br/>
    1823          {$data.aut_text2}</i>
     24          {/if}
    1925        </span>
    2026      </td>
  • extensions/lmt/admin/plugin_admin_manageitems.tpl

    r3396 r3666  
    1515        <span>
    1616          <br/><div class="is_on" id="imgfi{$data.id}" onclick="swap_state('fi{$data.id}');">&nbsp;</div>
    17           [ <a href="{$data.catlink}">{$data.catname}</a> ]<br/>
    1817          [ <a href="{$data.imglink}">{$data.file}</a> ]<br/>
     18          ---<br/>
     19          {foreach from=$data.cat key=catname item=catdata}
     20            [ <a href="{$catdata.link}">{$catdata.name}</a> ]<br/>
     21          {/foreach}
    1922          {if $data.licencei!=""}
    2023          <img src="{$data.licencei}"/><br/>
  • extensions/lmt/lmt_aip.class.inc.php

    r3412 r3666  
    260260    if(isset($_POST["submit_add_to_caddie"]) || isset($_POST["submit_replace_caddie"]))
    261261    {
    262       $sql="REPLACE INTO ".CADDIE_TABLE." SELECT '".$user['id']."', id FROM ".IMAGES_TABLE." WHERE id IN (".implode(",", $img_ids).");";
     262
     263      $sql="REPLACE INTO ".CADDIE_TABLE."
     264        SELECT '".$user['id']."', it.id FROM ".IMAGES_TABLE." it, ".$this->tables["images"]." lmti 
     265        WHERE it.id = lmti.image_id";
     266      if($_REQUEST['filter']!="")
     267      {
     268        $sql.=" AND lmti.licence_type='".$_REQUEST['filter']."'";
     269      }
     270
    263271      $result=pwg_query($sql);
    264272      if((!$results)||(!$result))
     
    784792  }
    785793
     794  protected function make_image_data($tmp)
     795  {
     796    $tmp2=array();
     797    for($i=0;$i<count($tmp['id']);$i++)
     798    {
     799      $tmp2[]=array(
     800        'id' => $tmp['id'][$i],
     801        'name' => $tmp['name'][$i],
     802        'type' => $tmp['type'][$i],
     803        'plinks' => $tmp['plinks'][$i],
     804        'link'=> make_index_url(
     805                          array(
     806                            'category' => array(
     807                              'id' => $tmp['id'][$i],
     808                              'name' => $tmp['name'][$i],
     809                              'permalink' => $tmp['plinks'][$i])
     810                          )
     811                        )
     812      );
     813    }
     814    return($tmp2);
     815  }
    786816
    787817  /* ---------------------------------------------------------------------------
     
    821851    $img_ids=array();
    822852    $img_liste = array();
    823     $sql="SELECT SQL_CALC_FOUND_ROWS lmti.*, img.file, img.path, img.tn_ext, cat.id as catid, cat.name as catname, cat.permalink, lmtla.text1, lmtla.text2   
    824           FROM ".$this->tables["images"]." lmti LEFT OUTER JOIN ".$this->tables["licence_author"]." lmtla ON lmtla.id = lmti.author_id,
    825                ".IMAGES_TABLE." img LEFT OUTER JOIN ".CATEGORIES_TABLE." cat ON img.storage_category_id = cat.id
     853    $sql="SELECT SQL_CALC_FOUND_ROWS lmti.*, img.file, img.path, img.tn_ext,
     854                  GROUP_CONCAT(cat.id) AS catid,
     855                  GROUP_CONCAT(CASE WHEN cat.name IS NULL THEN '' ELSE cat.name END SEPARATOR '@sep@') AS catname,
     856                  GROUP_CONCAT(CASE WHEN cat.permalink IS NULL THEN '' ELSE cat.permalink END SEPARATOR '@sep@') AS catpermalink,
     857                  GROUP_CONCAT(CASE WHEN cat.dir IS NULL THEN 'V' ELSE 'P' END) AS cattype,
     858                  lmtla.text1, lmtla.text2   
     859          FROM ".$this->tables["images"]." lmti
     860                  LEFT OUTER JOIN ".$this->tables["licence_author"]." lmtla ON lmtla.id = lmti.author_id,
     861               ".IMAGES_TABLE." img
     862                  LEFT OUTER JOIN ".IMAGE_CATEGORY_TABLE." imgcat ON img.id = imgcat.image_id
     863                  LEFT OUTER JOIN ".CATEGORIES_TABLE." cat ON imgcat.category_id = cat.id
    826864          WHERE lmti.image_id = img.id ";
    827865    if($_REQUEST['filter']!="")
     
    830868    }
    831869
    832     $sql.=" ORDER BY cat.id, img.id ";
    833  
     870    $sql.=" GROUP BY lmti.image_id ORDER BY cat.id, img.id ";
     871
    834872    if($this->my_config['lmt_list_maxitems']>0)
    835873    {
     
    846884        preg_match("/(.*)\./i", $filenfo["basename"], $tmp);
    847885        $filenfo['filename'] = $tmp[1];
     886
     887        $tmp=array(
     888              'id'=>explode(',',$row['catid']),
     889              'name'=>explode('@sep@',$row['catname']),
     890              'type'=>explode(',',$row['cattype']),
     891              'plinks'=>explode('@sep@',$row['catpermalink']),
     892              'link'=>array()
     893            );
     894        $tmpcat=$this->make_image_data($tmp);
    848895
    849896        $img_ids[]=$row['image_id'];
     
    855902          'aut_text2' => $row['text2'],
    856903          'file' => $row['file'],
    857           'catname' => $row['catname'],
    858           'catlink' => make_index_url(
    859                           array(
    860                             'category' => array(
    861                               'id' => $row['catid'],
    862                               'name' => $row['catname'],
    863                               'permalink' => $row['permalink'])
    864                           )
    865                         ),
     904          'cat' => $tmpcat,
    866905          'imglink' => make_picture_url(
    867906                          array(
    868907                            'image_id' => $row['image_id'],
    869908                            'category' => array(
    870                               'id' => $row['catid'],
    871                               'name' => $row['catname'],
    872                               'permalink' => $row['permalink'])
     909                              'id' => $tmp['id'][0],
     910                              'name' => $tmp['name'][0],
     911                              'permalink' => $tmp['plinks'][0])
    873912                          )
    874913                        ),
     
    916955
    917956    $img_liste = array();
    918     $sql="SELECT SQL_CALC_FOUND_ROWS img.id as image_id, img.file, img.path, img.tn_ext, cat.id as catid, cat.name as catname, cat.permalink,
     957    $sql="SELECT SQL_CALC_FOUND_ROWS img.id as image_id, img.file, img.path, img.tn_ext,
     958                  GROUP_CONCAT(cat.id) AS catid,
     959                  GROUP_CONCAT(CASE WHEN cat.name IS NULL THEN '' ELSE cat.name END SEPARATOR '@sep@') AS catname,
     960                  GROUP_CONCAT(CASE WHEN cat.permalink IS NULL THEN '' ELSE cat.permalink END SEPARATOR '@sep@') AS catpermalink,
     961                  GROUP_CONCAT(CASE WHEN cat.dir IS NULL THEN 'V' ELSE 'P' END) AS cattype,
    919962                 lmti.licence_type, lmtla.text1, lmtla.text2
    920           FROM ".CADDIE_TABLE." caddie, (".IMAGES_TABLE." img
    921             LEFT OUTER JOIN ".CATEGORIES_TABLE." cat ON img.storage_category_id = cat.id)
    922             LEFT OUTER JOIN ".$this->tables["images"]." AS lmti
    923               ON img.id = lmti.image_id 
    924             LEFT OUTER JOIN ".$this->tables["licence_author"]." lmtla
    925               ON lmtla.id = lmti.author_id
     963          FROM ".CADDIE_TABLE." caddie,
     964              (".IMAGES_TABLE." img
     965                  LEFT OUTER JOIN ".IMAGE_CATEGORY_TABLE." imgcat ON img.id = imgcat.image_id
     966                  LEFT OUTER JOIN ".CATEGORIES_TABLE." cat ON imgcat.category_id = cat.id)
     967                LEFT OUTER JOIN ".$this->tables["images"]." AS lmti ON img.id = lmti.image_id
     968                LEFT OUTER JOIN ".$this->tables["licence_author"]." lmtla  ON lmtla.id = lmti.author_id
    926969          WHERE img.id = caddie.element_id
    927970            AND caddie.user_id = '".$user['id']."'
     971          GROUP BY img.id
    928972          ORDER BY cat.id, img.id ";
    929973
     
    943987        preg_match("/(.*)\./i", $filenfo["basename"], $tmp);
    944988        $filenfo['filename'] = $tmp[1];
     989
     990        $tmp=array(
     991              'id'=>explode(',',$row['catid']),
     992              'name'=>explode('@sep@',$row['catname']),
     993              'type'=>explode(',',$row['cattype']),
     994              'plinks'=>explode('@sep@',$row['catpermalink']),
     995              'link'=>array()
     996            );
     997        $tmpcat=$this->make_image_data($tmp);
    945998
    946999        $img_liste[]=array(
     
    9511004          'aut_text2' => $row['text2'],
    9521005          'file' => $row['file'],
    953           'catname' => $row['catname'],
    954           'catlink' => make_index_url(
     1006          'cat' => $tmpcat,
     1007          'imglink' => make_picture_url(
    9551008                          array(
     1009                            'image_id' => $row['image_id'],
    9561010                            'category' => array(
    957                               'id' => $row['catid'],
    958                               'name' => $row['catname'],
    959                               'permalink' => $row['permalink'])
     1011                              'id' => $tmp['id'][0],
     1012                              'name' => $tmp['name'][0],
     1013                              'permalink' => $tmp['plinks'][0])
    9601014                          )
    961                         ),
    962           'imglink' => make_picture_url(
    963                           array('image_id' => $row['image_id'])
    9641015                        ),
    9651016          'thumb' => $filenfo["dirname"]."/thumbnail/".$conf["prefix_thumbnail"].$filenfo["filename"].".".$row["tn_ext"]
  • extensions/lmt/main.inc.php

    r3412 r3666  
    3131|         |            |   on physical categorie ; virtual category management will
    3232|         |            |   be coded for the next release
     33| 1.0.3   | 2009/07/24 | * bug on "list" page when trying to add items in the
     34|         |            |   caddie (==> topic #116263 on french forum)
     35|         |            | * bug when displaying image's categories when image
     36|         |            |   only have virtual categories / now display all image
     37|         |            |   categories (physical & virtual)
     38|         |            |   (==>topic #113337 on french forum) 
     39|         |            |   
    3340|         |            |   
    3441|         |            |   
Note: See TracChangeset for help on using the changeset viewer.