Changeset 6107


Ignore:
Timestamp:
May 7, 2010, 10:23:47 PM (10 years ago)
Author:
grum
Message:

Plugin is now in a usable state (color analysis is not yet tuned)

Location:
extensions/ColorStat
Files:
2 added
17 edited

Legend:

Unmodified
Added
Removed
  • extensions/ColorStat/admin/cstat_config.tpl

    r5961 r6107  
     1{known_script id="jquery.ui" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.core.packed.js"}
     2{known_script id="jquery.ui.slider" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.slider.packed.js"}
     3
     4
     5{literal}
     6<style>
     7 .ui-slider {
     8    width:600px;
     9    height:10px;
     10    border-width:1px;
     11    border-style:solid;
     12    margin-right:5px;
     13    padding-right:14px;
     14  }
     15 .ui-slider-handle {
     16    width:12px;
     17    height:12px;
     18    position:relative;
     19    top:-2px;
     20    border-width:1px;
     21    border-style:solid;
     22    display:block;
     23  }
     24</style>
     25<script type="text/javascript">
     26
     27
     28  function init()
     29  {
     30    formatPct({/literal}{$datas.minPct}{literal});
     31    $("#icstat_stat_minPct_slider").slider(
     32      {
     33        min:0.5,
     34        max:60,
     35        step:0.25,
     36        value:{/literal}{$datas.minPct}{literal},
     37        slide: function(event, ui) { formatPct(ui.value); }
     38      });
     39    $("#icstat_stat_minPct_slider a").addClass('gcBgInput');
     40  }
     41
     42  function formatPct(pct)
     43  {
     44    $("#icstat_stat_minPct").val(pct);
     45    $("#icstat_stat_minPct_display").html(pct.toFixed(2)+"%");
     46  }
     47</script>
     48{/literal}
     49
     50
     51
    152<h2>{'cstat_config_plugin'|@translate}</h2>
     53
     54<form id="iConfig" method="post" action="" class="general">
     55
     56  <fieldset>
     57    <legend>{'cstat_stat_and_search'|@translate}</legend>
     58
     59    <table class="formtable">
     60      <tr>
     61        <td colspan="2">{'cstat_percent_min_significant'|@translate}</td>
     62      </tr>
     63      <tr>
     64        <td>
     65          <input type="hidden" name="f_stat_minPct" id="icstat_stat_minPct" value="{$datas.minPct}">
     66          <div id="icstat_stat_minPct_slider" class="gcBgInput gcBorderInput"></div>
     67        </td>
     68        <td width="90px">
     69          <div id="icstat_stat_minPct_display"></div>
     70        </td>
     71      </tr>
     72    </table>
     73
     74  </fieldset>
     75
     76
     77  <fieldset>
     78    <legend>{'cstat_gallery_integration'|@translate}</legend>
     79
     80    <label>
     81      <input type="checkbox" id='idisplay_gallery_showColorsCBox' onclick="$('#idisplay_gallery_showColors').val(($('#idisplay_gallery_showColorsCBox').get(0).checked=='on')?'y':'n');"  {if $datas.showColors=='y'}checked{/if} >
     82      {'cstat_display_colors_on_image'|@translate}
     83      <input type="hidden" id='idisplay_gallery_showColors' name='f_display_gallery_showColors' value='{$datas.showColors}'>
     84    </label>
     85
     86  </fieldset>
     87
     88
     89
     90  <input type="submit" value="{'cstat_apply'|@translate}" name="submit_save_config" style="margin-left:1em;" >
     91
     92</form>
     93
     94
     95<script type="text/javascript">
     96  init();
     97</script>
  • extensions/ColorStat/admin/cstat_database.tpl

    r5961 r6107  
    11{known_script id="jquery.ui" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.core.packed.js"}
    22{known_script id="jquery.ui.dialog" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.dialog.packed.js"}
    3 
    43
    54{literal}
     
    6059
    6160
    62     doAnalyze="<br><form id='iDialogProgress' class='formtable'>"+
     61    doAnalyzeDialog="<br><form id='iDialogProgress' class='formtable'>"+
    6362      "<div id='iprogressbar_contener' class='gcBorderInput'>"+
    6463      "<span id='iprogressbar_bg' class='gcBgInput' style='width:0%;'>&nbsp;</span>"+
     
    8180        title: '{/literal}{"cstat_updating_database"|@translate}{literal}&nbsp;('+modeLabel+')',
    8281      }
    83     ).html(doAnalyze);
     82    ).html(doAnalyzeDialog);
    8483
    8584    NumberOfItemsPerRequest=$("#iNumberOfItemsPerRequest").val();
  • extensions/ColorStat/admin/cstat_install_page.tpl

    r5961 r6107  
     1{known_script id="jquery.ui" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.core.packed.js"}
     2{known_script id="jquery.tipTip" src=$ROOT_URL|@cat:"themes/default/js/plugins/jquery.tipTip.minified.js" }
     3
    14{literal}
    25<script type="text/javascript">
    36var tableSize='small';
     7
     8  function init()
     9  {
     10    $('.tiptip').tipTip(
     11      {
     12        'delay' : 0,
     13        'fadeIn' : 0,
     14        'fadeOut' : 0,
     15        'edgeOffset' : 5,
     16      }
     17    );
     18  }
    419
    520  function displayTable(size)
     
    5267      <table>
    5368        <tr>
    54           <td style="min-width:450px;">{$smallTableColor}</td>
     69          <td style="min-width:350px;">{$smallTableColor}</td>
    5570
    5671          <td style='padding-left:30px;vertical-align:top;'>
     
    85100      <table>
    86101        <tr>
    87           <td style="min-width:450px;">{$largeTableColor}</td>
     102          <td style="min-width:350px;">{$largeTableColor}</td>
    88103
    89104          <td style='padding-left:30px;vertical-align:top;'>
     
    121136</form>
    122137
     138<script type="text/javascript">
     139  init();
     140</script>
    123141
    124 
  • extensions/ColorStat/admin/cstat_search.tpl

    r5961 r6107  
     1{known_script id="jquery.ui" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.core.packed.js"}
     2{known_script id="jquery.ui.dialog" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.dialog.packed.js"}
     3{known_script id="jquery.tipTip" src=$ROOT_URL|@cat:"themes/default/js/plugins/jquery.tipTip.minified.js"}
     4
     5{known_script id="gpc.pagesNavigator" src=$ROOT_URL|@cat:"plugins/GrumPluginClasses/js/pagesNavigator.js"}
     6
     7
     8{literal}
     9<script type="text/javascript">
     10var cb=null;
     11
     12  interfaceManager = function(optionsToSet)
     13  {
     14    var pn=null;
     15    var requestNumber=0;
     16
     17    options =
     18      {
     19        requestCriterionsVisible:'',
     20        requestCriterionsHidden:'',
     21        requestResult:'',
     22        requestResultContent:'',
     23        requestResultNfo:'',
     24        requestResultPagesNavigator:'',
     25        requestResultRequestNumber:0,
     26        onPageChange:null,
     27        numberPerPage:30,
     28      };
     29
     30    /**
     31     *
     32     */
     33    this.doAction = function(fct)
     34    {
     35      switch(fct)
     36      {
     37        case 'queryResult':
     38          /* function 'queryResult' : when query is executed, prepare the interface
     39           */
     40          if(arguments.length==3)
     41          {
     42            displayQueryResult(arguments[1], arguments[2]);
     43          }
     44          break;
     45        case 'queryPage':
     46          /* function 'queryPage' : display returned page
     47           */
     48          if(arguments.length==3)
     49          {
     50            displayQueryPage(arguments[1], arguments[2]);
     51          }
     52          break;
     53        case 'show':
     54          /* function 'show' : show/hide the query/result
     55           */
     56          if(arguments.length==2)
     57          {
     58            show(arguments[1]);
     59          }
     60          break;
     61        case 'setOptions':
     62          /* function 'setOptions' : allows to set options after the object was
     63           *                         created
     64           */
     65          if(arguments.length==2)
     66          {
     67            setOptions(arguments[1]);
     68          }
     69          break;
     70      }
     71    }
     72
     73    /**
     74     * returns the current request number
     75     */
     76    this.getRequestNumber = function ()
     77    {
     78      return(requestNumber);
     79    }
     80
     81    /**
     82     * returns the number of items per page
     83     */
     84    this.getNumberPerPage = function ()
     85    {
     86      return(options.numberPerPage);
     87    }
     88
     89    /**
     90     * this function show/hide the different panels
     91     *  'buildQuery'  : hide the result panel and display the panel to build query
     92     *  'resultQuery' : hide the panel to build query and display the result panel
     93     */
     94    var show = function(mode)
     95    {
     96      switch(mode)
     97      {
     98        case 'buildQuery':
     99          $('.'+options.requestCriterionsVisible).css('display', 'block');
     100          $('.'+options.requestCriterionsHidden).css('display', 'none');
     101          $('.'+options.requestResult).css('display', 'none');
     102          break;
     103        case 'resultQuery':
     104          $('#iResultQueryContent').html("<br><img src='./plugins/GrumPluginClasses/icons/processing.gif'>");
     105          $('.'+options.requestCriterionsVisible).css('display', 'none');
     106          $('.'+options.requestCriterionsHidden).css('display', 'block');
     107          $('.'+options.requestResult).css('display', 'block');
     108          break;
     109      }
     110    }
     111
     112    /**
     113     * this function display the number of items found and prepare the page
     114     * navigator
     115     *
     116     * @param String nfo : 2 information separated with a semi-colon ';'
     117     *                      requestNumber;numberOfItems
     118     */
     119    var displayQueryResult = function (isSuccess, nfo)
     120    {
     121      if(isSuccess)
     122      {
     123        nfo=nfo.split(';');
     124
     125        requestNumber=nfo[0];
     126        $('#iResultQueryNfo').html(nfo[1]);
     127        pn.doAction('setOptions', { numberItem:nfo[1], defaultPage:1 } );
     128        show('resultQuery');
     129      }
     130      else
     131      {
     132        //$('#'+options.requestResultContent).html("");
     133        show('buildQuery');
     134        alert('Something is wrong on the server-side !');
     135      }
     136    }
     137
     138
     139    /**
     140     * this function display the number of items found and prepare the page
     141     * navigator
     142     *
     143     * @param String nfo : 2 information separated with a semi-colon ';'
     144     *                      requestNumber;numberOfItems
     145     */
     146    var displayQueryPage = function (isSuccess, nfo)
     147    {
     148      if(isSuccess)
     149      {
     150        $('#iResultQueryContent').html(nfo);
     151      }
     152      else
     153      {
     154        alert('Something is wrong on the server-side !');
     155      }
     156    }
     157
     158
     159    /**
     160     *
     161     * @param Object optionsToSet : set the given options
     162     */
     163    var setOptions = function(optionsToSet)
     164    {
     165      if(typeof optionsToSet=='object')
     166      {
     167        options = jQuery.extend(options, optionsToSet);
     168      }
     169    }
     170
     171    /**
     172     * initialize the object
     173     */
     174    var init = function (optionsToSet)
     175    {
     176      setOptions(optionsToSet);
     177
     178      pn = new pagesNavigator(options.requestResultPagesNavigator,
     179        {
     180          itemPerPage:options.numberPerPage,
     181          displayNumPage:9,
     182          classActive:'pnActive{/literal}{$datas.themeName}{literal}',
     183          classInactive:'pnInactive{/literal}{$datas.themeName}{literal}',
     184          onPageChange: function (page)
     185            {
     186              if(options.onPageChange!=null && jQuery.isFunction(options.onPageChange))
     187              {
     188                options.onPageChange(requestNumber, page, options.numberPerPage);
     189              }
     190            },
     191        }
     192      );
     193
     194      requestNumber=options.requestResultRequestNumber;
     195    }
     196
     197    init(optionsToSet);
     198  }
     199
     200
     201  function init()
     202  {
     203    im = new interfaceManager(
     204      {
     205        requestCriterionsVisible:'cRequestCriterions',
     206        requestCriterionsHidden:'cModifyRequest',
     207        requestResult:'cResultQuery',
     208        requestResultContent:'iResultQueryContent',
     209        requestResultNfo:'iResultQueryNfo',
     210        requestResultPagesNavigator:'iPagesNavigator',
     211      }
     212    );
     213
     214    requestBuilderOptions.imgEditUrl='{/literal}{$ROOT_URL}{$themeconf.admin_icon_dir}{literal}/edit_s.png';
     215    requestBuilderOptions.imgDeleteUrl='{/literal}{$ROOT_URL}{$themeconf.admin_icon_dir}{literal}/delete.png';
     216    requestBuilderOptions.classGroup='gcBorderInput gcTextInput';
     217    requestBuilderOptions.classItem='gcBgInput gcTextInput';
     218    requestBuilderOptions.classOperator='cbOperator cbOperatorBg{/literal}{$datas.themeName}{literal} gcLinkHover';
     219    requestBuilderOptions.onRequestSuccess = function (msg) { im.doAction('queryResult', true, msg); cb.doAction('getPage', im.getRequestNumber(), 1, im.getNumberPerPage()); };
     220    requestBuilderOptions.onRequestError = function (msg) { im.doAction('queryResult', false, msg); };
     221    requestBuilderOptions.onGetPageSuccess = function (msg) { im.doAction('queryPage', true, msg); };
     222    requestBuilderOptions.onGetPageError = function (msg) { im.doAction('queryPage', false, msg); };
     223
     224    cb = new criteriaBuilder('iListColorsChoosen', requestBuilderOptions);
     225
     226    im.doAction('setOptions',
     227      { onPageChange:
     228          function (requestNumber, page, numberPerPage)
     229          {
     230            $('#iResultQueryContent').html("<br><img src='./plugins/GrumPluginClasses/icons/processing.gif'>");
     231            cb.doAction('getPage', requestNumber, page, numberPerPage);
     232          }
     233      }
     234    );
     235
     236  }
     237
     238
     239
     240</script>
     241{/literal}
     242
     243{$datas.dialogBox}
     244
    1245<h2>{'cstat_search_by_color'|@translate}</h2>
     246
     247<form>
     248  <fieldset>
     249    <legend>{'cstat_search_criterion'|@translate}</legend>
     250
     251    <div id='iRequestCriterions' class='cRequestCriterions'>
     252      <div style='width:100%;min-height:250px;margin-bottom:8px;'>
     253        <ul id='iListColorsChoosen'>
     254        </ul>
     255      </div>
     256
     257      <div class='gcBgInput cbButtons'>{literal}<a onclick="colorBox.show({cBuilder:cb});">{/literal}{'cstat_add_colors'|@translate}</a></div>
     258      <div class='gcBgInput cbButtons'>{literal}<a onclick="cb.doAction('clear');">{/literal}{'cstat_clear_colors'|@translate}</a></div>
     259    </div>
     260    <div class='cModifyRequest' style='display:none;'>
     261      <div class='gcBgInput cbButtons'>{literal}<a onclick="im.doAction('show', 'buildQuery');">{/literal}{'cstat_do_modify_request'|@translate}</a></div>
     262    </div>
     263
     264  </fieldset>
     265
     266  <input type="button" class='cRequestCriterions' style="margin-left:1em;" onclick="cb.doAction('send');" value="{'cstat_search'|@translate}">
     267</form>
     268
     269  <fieldset id='iResultQuery' style='display:none;' class='cResultQuery'>
     270    <legend>{'cstat_result_query'|@translate}</legend>
     271
     272    <div id='iResultQueryContent' style='width:100%;min-height:250px;max-height:450px;overflow:auto;margin-bottom:8px;'></div>
     273
     274    <div class='gcBgInput gcTextInput'>
     275      <div id='iPagesNavigator' style='float:right;'></div>
     276      <div style='text-align:left;padding:4px;'>{'cstat_number_of_item_found'|@translate}&nbsp;:&nbsp;<span id='iResultQueryNfo'></span></div>
     277    </div>
     278
     279  </fieldset>
     280
     281
     282<script type="text/javascript">
     283 init();
     284</script>
  • extensions/ColorStat/admin/cstat_stat.tpl

    r5961 r6107  
     1{known_script id="jquery.ui" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.core.packed.js"}
     2{known_script id="jquery.tipTip" src=$ROOT_URL|@cat:"themes/default/js/plugins/jquery.tipTip.minified.js" }
    13
    24{literal}
     
    79    loadColorList();
    810    displayColorListOrder();
     11    $('.tiptip').tipTip(
     12      {
     13        'delay' : 0,
     14        'fadeIn' : 0,
     15        'fadeOut' : 0,
     16        'edgeOffset' : 5,
     17      }
     18    );
    919  }
    1020
     
    8797          <th style="min-width:180px;" colspan="2"><span id="iHLTOrderColor"></span><a onclick="sortColorList('color');">{'cstat_colors'|@translate}</a></th>
    8898
    89           <th width="60px"><span id="iHLTOrderNumImages"></span><a onclick="sortColorList('img');" title="{'cstat_NumOfImages_help'|@translate}">{'cstat_NumOfImages'|@translate}</a></th>
     99          <th width="60px"><span id="iHLTOrderNumImages"></span><a class="tiptip" onclick="sortColorList('img');" title="{'cstat_NumOfImages_help'|@translate}">{'cstat_NumOfImages'|@translate}</a></th>
    90100          <th width="40px">{'cstat_Pct'|@translate}</th>
    91101          <th width="115px">&nbsp;</th>
    92102
    93           <th width="80px"><span id="iHLTOrderNumPixels"></span><a onclick="sortColorList('pixels');" title="{'cstat_NumOfPixels_help'|@translate}">{'cstat_NumOfPixels'|@translate}</a></th>
     103          <th width="80px"><span id="iHLTOrderNumPixels"></span><a class="tiptip" onclick="sortColorList('pixels');" title="{'cstat_NumOfPixels_help'|@translate}">{'cstat_NumOfPixels'|@translate}</a></th>
    94104          <th width="40px">{'cstat_Pct'|@translate}</th>
    95105          <th width="130px">&nbsp;</th>
  • extensions/ColorStat/cstat.css

    r5961 r6107  
    3232  font-size:130%;
    3333}
     34
     35.cellColorChoose {
     36  width:15px;
     37  height:15px;
     38  margin:2px;
     39  float:left;
     40  cursor:pointer;
     41}
     42
     43
     44#iListColorsChoosen { padding:0px; }
     45
     46#iListColorsChoosen ul li, #dragHelper ul li {
     47  clear:both;
     48  min-height:32px;
     49  list-style-image:none;
     50  list-style-position:outside;
     51  list-style-type:none;
     52  margin:4px;
     53  padding:0px;
     54}
     55
     56#iListColorsChoosen ul { padding:0px; }
     57
     58
     59.cbGroup { border-width:1px; border-style:solid; padding:0px; margin:2px; min-height:30px; list-style:none; }
     60.cbItem {   padding:2px; margin:8px; min-height:34px; list-style:none; }
     61
     62#iListColorsChoosen ul li.cbItem, #dragHelper ul li.cbItem { padding:2px; }
     63
     64.cbItemButtons { padding:2px; }
     65.cbItem img { cursor: pointer; }
     66
     67.cbSortHandle { cursor:move; }
     68
     69div.cbOperator {
     70 cursor:pointer;
     71 padding:4px;
     72 text-align:left;
     73 font-weight:bold;
     74}
     75
     76div.cbOperatorBgroma {
     77 background:#333333;
     78}
     79
     80div.cbOperatorBgclear {
     81 background:#dbe8f3;
     82}
     83
     84.cbButtons {
     85  float:left;
     86  margin:2px;
     87  padding:8px;
     88}
     89
     90.helper {
     91 border:2px dashed #777777;
     92}
     93
     94.cPnActive, .cPnDisabled, .cPnInactive { margin:2px; padding:2px;  min-width:20px; text-align:center; }
     95.pnInactiveclear, .pnInactiveroma { cursor:pointer; }
     96.pnInactiveclear:hover { background:#F1F1F1; }
     97.pnActiveclear { background:#F1F1F1; font-weight:bold; }
     98.pnInactiveroma:hover { background:#999999; color:#444444; }
     99.pnActiveroma { background:#999999; color:#444444; font-weight:bold; }
     100#iPagesNavigator ul { margin:0px; }
     101
     102.color1px { border-spacing:1px; }
     103.color0px { border-spacing:0px; }
     104
  • extensions/ColorStat/cstat_aip.class.inc.php

    r5961 r6107  
    11<?php
    22/* -----------------------------------------------------------------------------
    3   Plugin     : LMT
     3  Plugin     : ColorStat
    44  Author     : Grum
    55    email    : grum@piwigo.org
     
    1010  See main.inc.php for release information
    1111
    12   LMT_AIP : classe to manage plugin admin pages
     12  CStat_AIP : classe to manage plugin admin pages
    1313
    1414  --------------------------------------------------------------------------- */
     15
     16if(!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    1517
    1618include_once('cstat_root.class.inc.php');
    1719include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTables.class.inc.php');
     20include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTabSheet.class.inc.php');
     21include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCRequestBuilder.class.inc.php');
    1822include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
    1923
     
    2529  {
    2630    parent::__construct($prefixeTable, $filelocation);
     31    $this->checkRequest();
     32
    2733    $this->loadConfig();
    2834    $this->initEvents();
     
    5561  {
    5662    parent::initEvents();
     63    if($_REQUEST['f_tabsheet']=='search')
     64    {
     65      // load request builder JS only on the search page
     66      GPCRequestBuilder::loadJSandCSS();
     67    }
    5768    add_event_handler('loc_end_page_header', array(&$this->css, 'applyCSS'));
    5869    GPCCss::applyGpcCss();
     
    6576  {
    6677    global $template;
    67 
    68     $this->checkRequest();
    6978
    7079    $this->returnAjaxContent();
     
    154163      {
    155164        if(!isset($_REQUEST['selectMode'])) $_REQUEST['selectMode']='caddieAdd';
    156         if(!isset($_REQUEST['numOfItems'])) $_REQUEST['numOfItems']=$this->config['analyze.itemPerRequest'];
     165        if(!isset($_REQUEST['numOfItems'])) $_REQUEST['numOfItems']=$this->config['analyze_itemPerRequest'];
    157166
    158167        if(!($_REQUEST['selectMode']=='notAnalyzed' or
     
    181190    }
    182191
     192
    183193  }
    184194
     
    195205    $datas=Array(
    196206      'urlRequest' => $this->getAdminLink(),
    197       'numberOfItemsPerRequest' => $this->config['analyze.itemPerRequest']
     207      'numberOfItemsPerRequest' => $this->config['analyze_itemPerRequest']
    198208    );
    199209    $template->assign('datas', $datas);
     
    211221                dirname($this->getFileLocation()).'/admin/cstat_stat.tpl');
    212222
    213     $generalStats=$this->getGeneralStats();
    214 
    215     $colors=Array();
    216     $sql="SELECT color_id, num_images, num_pixels
    217           FROM ".$this->tables['color_table']."
    218           WHERE num_images > 0
    219           ORDER BY color_id ";
    220     $result=pwg_query($sql);
    221     if($result)
    222     {
    223       while($row=pwg_db_fetch_assoc($result))
    224       {
    225         $colors[$row['color_id']]=Array('num_images' => $row['num_images'], 'num_pixels' => $row['num_pixels']);
    226       }
    227     }
    228 
    229     $colorTable=ColorStat::getColorTable(
    230       $this->colorTableSize[$this->config['analyze.colorTable']][0],
    231       $this->colorTableSize[$this->config['analyze.colorTable']][1]
    232     );
    233     foreach($colorTable as $key=>$val)
    234     {
    235       foreach($val as $key2=>$val2)
    236       {
    237         $rgb=$val2->getRGB()->getHexString();
    238         $colorTable[$key][$key2]=Array(
    239           'color' => $rgb,
    240           'pct'   => (array_key_exists($rgb, $colors))?sprintf("%.2f", round(100*$colors[$rgb]['num_pixels']/$generalStats['pixelsAnalyzedSum'],2)):"",
    241           'num'   => (array_key_exists($rgb, $colors))?$colors[$rgb]['num_images']:"",
    242         );
    243       }
    244     }
     223    $colorTable=$this->getColorTableWithStat();
     224
    245225
    246226    $datas=Array(
     227      //'themeconf' => Array('name' => $template->get_themeconf('name')),
    247228      'colorTable' => $this->htmlColorTable(
    248229                        $colorTable,
    249                         ($this->config['analyze.colorTable']=='small')?19:10
     230                        ($this->config['analyze_colorTable']=='small')?19:10,
     231                        "",
     232                        "color0px"
    250233                      ),
    251234      'urlRequest' => $this->getAdminLink(),
    252       'config_GetListColors_OrderType' => $this->config['display.stat.orderType'],
     235      'config_GetListColors_OrderType' => $this->config['display_stat_orderType'],
    253236    );
    254237    $template->assign('datas', $datas);
     
    267250                dirname($this->getFileLocation()).'/admin/cstat_search.tpl');
    268251
     252    $datas=Array(
     253      'dialogBox' => $this->dialogBoxColor(),
     254      'themeName' => $template->get_themeconf('name'),
     255    );
     256
     257    $template->assign('datas', $datas);
     258
    269259    $template->assign_var_from_handle('CSTAT_BODY_PAGE', 'body_page');
    270260  } //displaySearchPage
     
    276266  protected function displayConfigPage()
    277267  {
    278     /*
     268    $tmpPct=$this->config['stat_minPct'];
     269
    279270    if(!$this->adviser_abort())
    280271    {
     
    283274        foreach($this->config as $key => $val)
    284275        {
    285           if(is_array($val))
     276          if(isset($_REQUEST['f_'.$key]))
    286277          {
    287             foreach($languages as $key2 => $val2)
    288             {
    289               if(isset($_REQUEST[str2url('f_'.$key.'_'.$key2)]))
    290               {
    291                 $this->config[$key][$key2] = htmlspecialchars(stripslashes($_REQUEST[str2url('f_'.$key.'_'.$key2)]), ENT_QUOTES);
    292               }
    293             }
     278            $this->config[$key] = $_REQUEST['f_'.$key];
    294279          }
    295           else
    296           {
    297             if(isset($_REQUEST['f_'.$key]))
    298             {
    299               $this->config[$key] = $_REQUEST['f_'.$key];
    300             }
    301           }
    302 
    303280        }
    304         $this->displayResult(l10n('lmt_save_config'), $this->saveConfig());
    305       }
    306     }*/
     281        $this->displayResult(l10n('cstat_save_config'), $this->saveConfig());
     282      }
     283    }
     284
     285    if($tmpPct!=$this->config['stat_minPct'])
     286    {
     287      $this->updateDatabaseConsolidation();
     288    }
     289
    307290    $this->displayConfig();
    308291  }
     
    317300    $template->set_filename('body_page',
    318301                dirname($this->getFileLocation()).'/admin/cstat_config.tpl');
     302
     303    $datas=Array(
     304      'minPct' => $this->config['stat_minPct'],
     305      'showColors' => $this->config['display_gallery_showColors']
     306    );
     307
     308    $template->assign('datas', $datas);
    319309
    320310    $template->assign_var_from_handle('CSTAT_BODY_PAGE', 'body_page');
     
    353343        'quality' => 8,
    354344        'numColors' => 16,
    355         'maxTime' => $this->config['analyze.maxTime'],
    356         'pps' => $this->config['analyze.pps'],
     345        'maxTime' => $this->config['analyze_maxTime'],
     346        'pps' => $this->config['analyze_pps'],
    357347      )
    358348    );
     
    443433  }
    444434
     435
     436  /**
     437   * make consolidation for the color_table :
     438   *  - count number of images using a color
     439   *  - count number of pixels of a color
     440   */
     441  protected function updateDatabaseConsolidation()
     442  {
     443    $sql="UPDATE ".$this->tables['color_table']." cct
     444          SET cct.num_images=0,
     445              cct.num_pixels=0;";
     446    pwg_query($sql);
     447
     448    $sql="UPDATE ".$this->tables['color_table']." cct,
     449                 (SELECT color_id,
     450                         count(image_id) AS num_images,
     451                         sum(num_pixels) AS num_pixels
     452                  FROM ".$this->tables['images_colors']."
     453                  WHERE pct >= ".$this->config['stat_minPct']."
     454                  GROUP BY color_id) cic
     455          SET cct.num_images=cic.num_images,
     456              cct.num_pixels=cic.num_pixels
     457          WHERE cct.color_id=cic.color_id;";
     458    pwg_query($sql);
     459
     460    $sql="UPDATE ".$this->tables['images']." pci
     461          SET pci.colors = '',
     462              pci.colors_pct = ''";
     463    pwg_query($sql);
     464
     465    $sql="UPDATE ".$this->tables['images']." pci,
     466          (SELECT image_id,
     467                  GROUP_CONCAT(color_id ORDER BY pct DESC SEPARATOR ',') AS colors,
     468                  GROUP_CONCAT(pct ORDER BY pct DESC SEPARATOR ',') AS colors_pct
     469           FROM ".$this->tables['images_colors']."
     470           WHERE pct >= ".$this->config['stat_minPct']."
     471           GROUP BY image_id) pcic
     472          SET pci.colors = pcic.colors,
     473              pci.colors_pct = pcic.colors_pct
     474          WHERE pci.image_id = pcic.image_id;";
     475    pwg_query($sql);
     476  }
     477
    445478  /* ---------------------------------------------------------------------------
    446479    ajax functions
     
    593626      {
    594627        $colorTable=ColorStat::getColorTable(
    595           $this->colorTableSize[$this->config['analyze.colorTable']][0],
    596           $this->colorTableSize[$this->config['analyze.colorTable']][1]
     628          $this->colorTableSize[$this->config['analyze_colorTable']][0],
     629          $this->colorTableSize[$this->config['analyze_colorTable']][1]
    597630        );
    598631
     
    629662  private function ajax_cstat_updateDatabaseConsolidation()
    630663  {
    631     $sql="UPDATE ".$this->tables['color_table']." cct,
    632                  (SELECT color_id,
    633                          count(image_id) AS num_images,
    634                          sum(num_pixels) AS num_pixels
    635                   FROM ".$this->tables['images_colors']."
    636                   GROUP BY color_id) cic
    637           SET cct.num_images=cic.num_images,
    638               cct.num_pixels=cic.num_pixels
    639           WHERE cct.color_id=cic.color_id;";
    640     pwg_query($sql);
     664    $this->updateDatabaseConsolidation();
    641665    return("ok");
    642666  }
     
    657681    global $template;
    658682
    659     $this->config['display.stat.orderType'] = $orderType;
     683    $this->config['display_stat_orderType'] = $orderType;
    660684    $this->saveConfig();
    661685
  • extensions/ColorStat/cstat_aip_install.class.inc.php

    r5961 r6107  
    1010  See main.inc.php for release information
    1111
    12   LMT_AIP : classe to manage plugin admin pages
    13 
    1412  --------------------------------------------------------------------------- */
     13
     14  if(!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    1515
    1616include_once('cstat_root.class.inc.php');
     
    128128    $smallColorTable=ColorStat::getColorTable($this->colorTableSize['small'][0],$this->colorTableSize['small'][1]);
    129129    $largeColorTable=ColorStat::getColorTable($this->colorTableSize['large'][0],$this->colorTableSize['large'][1]);
    130     $template->assign('smallTableColor', $this->htmlColorTable($smallColorTable, 19));
    131     $template->assign('largeTableColor', $this->htmlColorTable($largeColorTable, 10));
     130    $template->assign('smallTableColor', $this->htmlColorTable($smallColorTable, 19, '', 'color0px'));
     131    $template->assign('largeTableColor', $this->htmlColorTable($largeColorTable, 10, '', 'color0px'));
    132132
    133133    $template->assign(
     
    135135      $this->htmlColorList(
    136136        ColorStat::getFileColors(dirname($this->getFileLocation()).'/image/sample1.png', $smallColorTable, Array('quality' => 8, 'numColors' => 16)),
    137         16, 18, '', 'colorListSample'
     137        16, 18, '', 'colorListSample color0px'
    138138      )
    139139    );
     
    144144      $this->htmlColorList(
    145145        ColorStat::getFileColors(dirname($this->getFileLocation()).'/image/sample1.png', $largeColorTable, Array('quality' => 8, 'numColors' => 16)),
    146         16, 18, '', 'colorListSample'
     146        16, 18, '', 'colorListSample color0px'
    147147      )
    148148    );
     
    153153      $this->htmlColorList(
    154154        ColorStat::getFileColors(dirname($this->getFileLocation()).'/image/sample2.png', $smallColorTable, Array('quality' => 8, 'numColors' => 16)),
    155         16, 18, '', 'colorListSample'
     155        16, 18, '', 'colorListSample color0px'
    156156      )
    157157    );
     
    162162      $this->htmlColorList(
    163163        ColorStat::getFileColors(dirname($this->getFileLocation()).'/image/sample2.png', $largeColorTable, Array('quality' => 8, 'numColors' => 16)),
    164         16, 18, '', 'colorListSample'
     164        16, 18, '', 'colorListSample color0px'
    165165      )
    166166    );
     
    170170    unset($largeColorTable);
    171171
    172     $this->config['analyze.pps']=round($pps/4,0);
     172    $this->config['analyze_pps']=round($pps/4,0);
    173173    $this->saveConfig();
    174174
     
    202202  {
    203203    $this->config['newInstall']='n';
    204     $this->config['analyze.colorTable']=$tableSize;
     204    $this->config['analyze_colorTable']=$tableSize;
    205205    $this->saveConfig();
    206206
  • extensions/ColorStat/cstat_colorstat.class.inc.php

    r5961 r6107  
    4545
    4646  --------------------------------------------------------------------------- */
     47
     48  if(!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    4749
    4850/**
  • extensions/ColorStat/cstat_install.class.inc.php

    r5961 r6107  
    1414  --------------------------------------------------------------------------- */
    1515
    16    include_once('cstat_version.inc.php'); // => Don't forget to update this file !!
    17    include_once('cstat_root.class.inc.php');
    18    include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTables.class.inc.php');
     16  if(!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     17
     18  include_once('cstat_version.inc.php'); // => Don't forget to update this file !!
     19  include_once('cstat_root.class.inc.php');
     20  include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTables.class.inc.php');
     21  include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCRequestBuilder.class.inc.php');
    1922
    2023  /* CStat class for install process */
     
    7982  `time` float unsigned NOT NULL default '0',
    8083  `quality` tinyint(4) NOT NULL default '0',
     84  `colors` char(111) NOT NULL default '',
     85  `colors_pct` char(111) NOT NULL default '',
    8186  PRIMARY KEY  (`image_id`),
    8287  KEY `by_analyzed` (`analyzed`)
    8388)",
    84 
    8589      );
    8690
     
    121125                      quality=0;");
    122126      pwg_query("INSERT INTO ".$this->tables['images']."
    123                   SELECT id, 'n', 0, 0, 0, 0, 0, 0
     127                  SELECT id, 'n', 0, 0, 0, 0, 0, 0, ''
    124128                    FROM ".IMAGES_TABLE."
    125129                    WHERE id NOT IN (SELECT image_id FROM ".$this->tables['images'].")");
  • extensions/ColorStat/cstat_pip.class.inc.php

    r5961 r6107  
    11<?php
    22/* -----------------------------------------------------------------------------
    3   Plugin     : LMT
     3  Plugin     : ColorStat
    44  Author     : Grum
    55    email    : grum@piwigo.org
     
    1010  See main.inc.php for release information
    1111
    12   LMT_PIP : classe to manage plugin public pages
     12  CStat_PIP : classe to manage plugin public pages
    1313
    1414  --------------------------------------------------------------------------- */
    1515
    16 include_once('lmt_root.class.inc.php');
     16include_once('cstat_root.class.inc.php');
    1717//include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCPublicIntegration.class.inc.php');
    1818
    19 class LMT_PIP extends LMT_root
     19class CStat_PIP extends CStat_root
    2020{
    2121  protected $section_page;
     
    3636  }
    3737
    38   /*
    39     load language file
    40   */
     38  /**
     39   * load language file
     40   */
    4141  public function load_lang()
    4242  {
    4343    global $lang;
    4444
    45     load_language('plugin.lang', LMT_PATH);
    46 
    47     // ajax is managed here ; this permit to use user&language properties inside
    48     // ajax content
    49     //$this->return_ajax_content();
     45    load_language('plugin.lang', CSTAT_PATH);
    5046  }
    5147
    52   /*
    53     initialize events call for the plugin
    54   */
     48  /**
     49   * initialize events call for the plugin
     50   */
    5551  public function initEvents()
    5652  {
    5753    parent::initEvents();
    58 /*
    59     add_event_handler('blockmanager_apply', array(&$this, 'blockmanager_apply') );
    60     add_event_handler('loading_lang', array(&$this, 'load_lang'));
    61 */
    62     if($this->config['lmt_licence_activated']=='y')
     54
     55    if($this->config['display_gallery_showColors']=='y')
    6356    {
    64       add_event_handler('loc_end_page_header', array(&$this->css_icn, 'applyCSS'));
    65       add_event_handler('loc_end_picture', array(&$this, 'manage_licence_element'));
    66 
    67       if($this->config['lmt_warning_visible']=='y')
    68       {
    69         add_event_handler('loc_end_page_tail', array(&$this, 'manage_warning_text'));
    70       }
     57      add_event_handler('loc_begin_picture', array(&$this, 'addColors'));
    7158    }
    7259  }
     
    7562
    7663  /* -------------------------------------------------------------------------
    77     FUNCTIONS TO MANAGE LMT DISPLAY
     64    FUNCTIONS TO MANAGE COLORS DISPLAY
    7865  ------------------------------------------------------------------------- */
    79   public function manage_licence_element()
     66  public function addColors()
    8067  {
    81     global $template, $page, $user;
     68    global $page, $template;
    8269
    83     $licence=$this->get_image_licence($page['image_id']);
    84     if($licence['licence']=="")
     70    $colors=$this->getImageColors($page['image_id']);
     71
     72
     73    if(count($colors['colors'])>0)
    8574    {
    86       return("");
     75      $metadata=$template->get_template_vars('metadata');
     76
     77      $tmp=Array();
     78
     79      for($i=0;$i<count($colors['colors']);$i++)
     80      {
     81        $tmp[$colors['colors'][$i]]['pct']=$colors['colors_pct'][$i];
     82      }
     83
     84      $colorsNfo=Array(
     85        'TITLE' => l10n('cstat_colors'),
     86        'lines' => Array(
     87          l10n('cstat_colors_on_image') => $this->htmlColorList($tmp, 8, 25, "", "color1px", "/"),
     88        )
     89      );
     90
     91      $metadata[]=$colorsNfo;
     92
     93      $template->assign('metadata', $metadata);
    8794    }
    88 
    89     if($this->config['lmt_redirect_activated']=='y')
    90     {
    91       $url=$this->config['lmt_redirect_url-'.strToLower($licence['licence'])][$user['language']];
    92       if($url=='')
    93       {
    94         $url=$this->config['lmt_redirect_url-'.strToLower($licence['licence'])]['en_UK'];
    95       }
    96     }
    97     else
    98     {
    99       $url="";
    100     }
    101 
    102     $style="";
    103     $text="";
    104     $target=($this->config['lmt_redirect_open_target']=="y")?" onclick='window.open(this.href); return false;'":"";
    105     switch($this->config['lmt_licence_logo'])
    106     {
    107       case '80x15':
    108         if($url!="")
    109         {
    110           $text = "<br/><a href='".$url."'".$target."><img class='logo80x15' src='". LMT_PATH."img/".strToLower($licence['licence'])."_80x15.png'></a>".$licence['aut_text1']." ".$licence['aut_text2'];
    111         }
    112         else
    113         {
    114           $text = "<br/><img class='logo80x15' src='". LMT_PATH."img/".strToLower($licence['licence'])."_80x15.png'>".$licence['aut_text1']." ".$licence['aut_text2'];
    115         }
    116       break;
    117       case '88x31';
    118         $style=" style='text-align:left;'";
    119         if($url!="")
    120         {
    121           $text = "<table style='margin:auto;'><tr><td><a href='".$url."'".$target."><img class='logo88x31' style='top:-4px;' src='". LMT_PATH."img/".strToLower($licence['licence'])."_88x31.png'></a></td><td>".$licence['aut_text1']."<br/>".$licence['aut_text2']."</td></tr></table>";
    122         }
    123         else
    124         {
    125           $text = "<table style='margin:auto;'><tr><td><img class='logo88x31' style='top:-4px;' src='". LMT_PATH."img/".strToLower($licence['licence'])."_88x31.png'></td><td>".$licence['aut_text1']."<br/>".$licence['aut_text2']."</td></tr></table>";
    126         }
    127         break;
    128       case 'text';
    129         if($url!="")
    130         {
    131           $text ="<br/>".l10n("lmt_lbl_under-".strToLower($licence['licence']))." <a href='".$url."'".$target.">".l10n("lmt_lbl_cc_s-".strToLower($licence['licence']))."</a> ".$licence['aut_text1']." ".$licence['aut_text2'];
    132         }
    133         else
    134         {
    135           $text ="<br/>".l10n("lmt_lbl_under-".strToLower($licence['licence']))." ".l10n("lmt_lbl_cc_s-".strToLower($licence['licence']))." ".$licence['aut_text1']." ".$licence['aut_text2'];
    136         }
    137         break;
    138     }
    139 
    140     $template->concat('COMMENT_IMG', '<span class="licencetag" '.$style.'>'.$text.'</span>');
    14195  }
    14296
    143   public function manage_warning_text()
    144   {
    145     global $template, $user;
    146 
    147 
    148     if(isset($this->config['lmt_warning_texts'][$user['language']]))
    149     {
    150       $text=$this->config['lmt_warning_texts'][$user['language']];
    151     }
    152     else
    153     {
    154       $text=$this->config['lmt_warning_texts']['en_UK'];
    155     }
    156 
    157     $patterns = array('/\[logo=80x15\]/i', '/\[logo=88x31\]/i', '/\[logo=text\]/i');
    158     $replacements = array(
    159       "<img class='logo80x15' src='". LMT_PATH."img/".strToLower($this->config['lmt_licence_default'])."_80x15.png'>",
    160       "<img class='logo88x31' src='". LMT_PATH."img/".strToLower($this->config['lmt_licence_default'])."_88x31.png'>",
    161       l10n("lmt_lbl_cc_s-".strToLower($this->config['lmt_licence_default']))
    162     );
    163 
    164     if($this->config['lmt_redirect_activated']=='y')
    165     {
    166       $url=$this->config['lmt_redirect_url-'.strToLower($this->config['lmt_licence_default'])][$user['language']];
    167       if($url=='')
    168       {
    169         $url=$this->config['lmt_redirect_url-'.strToLower($this->config['lmt_licence_default'])]['en_UK'];
    170       }
    171       if($url!="")
    172       {
    173         $target=($this->config['lmt_redirect_open_target']=="y")?" onclick='window.open(this.href); return false;'":"";
    174         $replacements[0]="<a href='".$url."'".$target.">".$replacements[0]."</a>";
    175         $replacements[1]="<a href='".$url."'".$target.">".$replacements[1]."</a>";
    176         $replacements[2]="<a href='".$url."'".$target.">".$replacements[2]."</a>";
    177       }
    178     }
    179 
    180     $text = preg_replace($patterns, $replacements, $text);
    181 
    182     $template->append("footer_elements", "<span>".htmlspecialchars_decode($text)."</span>");
    183   }
    18497
    18598
  • extensions/ColorStat/cstat_root.class.inc.php

    r5961 r6107  
    1313
    1414  --------------------------------------------------------------------------- */
     15
     16  if(!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     17
     18
    1519  include_once('cstat_colorstat.class.inc.php');
    1620  include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php');
     
    6367      $this->config=array(
    6468        'newInstall' => 'n',
    65         'analyze.maxTime' => 0.1,
    66         'analyze.colorTable' => 'small',
    67         'analyze.pps' => 0,
    68         'analyze.itemPerRequest' => 10,
    69         'display.stat.orderType' => 'img',
     69        'analyze_maxTime' => 0.1,
     70        'analyze_colorTable' => 'small',
     71        'analyze_pps' => 0,
     72        'analyze_itemPerRequest' => 10,
     73        'display_gallery_showColors' => 'n',
     74        'display_stat_orderType' => 'img',
     75        'stat_minPct' => 3.5,
    7076      );
    7177    }
     
    137143     * @return String : HTML code
    138144     */
    139     public function htmlColorList($colorList, $split=8, $size=5, $id="", $class="")
     145    public function htmlColorList($colorList, $split=8, $size=5, $id="", $class="", $br='<br>')
    140146    {
    141147      global $template;
     
    163169        'size' => $size,
    164170        'id' => $id,
    165         'class' => $class
     171        'class' => $class,
     172        'br' => $br,
    166173      );
    167174
     
    172179    }
    173180
    174 
    175 
    176 
    177     protected function displayResult($action_msg, $result)
    178     {
    179       global $page;
    180 
     181    /**
     182     * returns an array of colors & colors percent of an image
     183     *
     184     * @param Integer $imageId : id of the image
     185     * @return Array('colors' => Array(), 'colors_pct' => Array())
     186     */
     187    public function getImageColors($imageId)
     188    {
     189      $returned=Array(
     190        'colors' => Array(),
     191        'colors_pct' => Array(),
     192      );
     193
     194      $sql="SELECT colors, colors_pct
     195            FROM ".$this->tables['images']."
     196            WHERE image_id='".$imageId."'";
     197      $result=pwg_query($sql);
    181198      if($result)
    182199      {
    183         array_push($page['infos'], $action_msg);
    184       }
    185       else
    186       {
    187         array_push($page['errors'], $action_msg);
    188       }
    189     }
     200        while($row=pwg_db_fetch_assoc($result))
     201        {
     202          $returned['colors']=explode(',', $row['colors']);
     203          $returned['colors_pct']=explode(',', $row['colors_pct']);
     204        }
     205      }
     206      return($returned);
     207    }
     208
     209
     210
     211    /**
     212     *  return all HTML&JS code necessary to display a dialogbox to choose
     213     *  colors
     214     */
     215    protected function dialogBoxColor()
     216    {
     217      global $template;
     218
     219      $template->set_filename('colors_choose',
     220                    dirname($this->getFileLocation()).'/templates/cstat_dialog_colors_choose.tpl');
     221
     222      $colorTable=$this->getColorTableWithStat();
     223
     224      $datas=Array(
     225        'colorTable' => $this->htmlColorTable(
     226                          $colorTable,
     227                          ($this->config['analyze_colorTable']=='small')?16:8,
     228                          "",
     229                          "color0px"
     230                        ),
     231        //'urlRequest' => $this->getAdminLink(),
     232      );
     233
     234      $template->assign('datas', $datas);
     235      unset($data);
     236
     237      return($template->parse('colors_choose', true));
     238    }
     239
     240
     241    /**
     242     * return a color table with stat on color
     243     *
     244     * @return Array : a color table with statistics on colors
     245     */
     246    protected function getColorTableWithStat()
     247    {
     248      $generalStats=$this->getGeneralStats();
     249
     250      $colors=Array();
     251      $sql="SELECT color_id, num_images, num_pixels
     252            FROM ".$this->tables['color_table']."
     253            WHERE num_images > 0
     254            ORDER BY color_id ";
     255      $result=pwg_query($sql);
     256      if($result)
     257      {
     258        while($row=pwg_db_fetch_assoc($result))
     259        {
     260          $colors[$row['color_id']]=Array('num_images' => $row['num_images'], 'num_pixels' => $row['num_pixels']);
     261        }
     262      }
     263
     264      $colorTable=ColorStat::getColorTable(
     265        $this->colorTableSize[$this->config['analyze_colorTable']][0],
     266        $this->colorTableSize[$this->config['analyze_colorTable']][1]
     267      );
     268      foreach($colorTable as $key=>$val)
     269      {
     270        foreach($val as $key2=>$val2)
     271        {
     272          $rgb=$val2->getRGB()->getHexString();
     273          $colorTable[$key][$key2]=Array(
     274            'color' => $rgb,
     275            'pct'   => '', //(array_key_exists($rgb, $colors))?sprintf("%.2f", round(100*$colors[$rgb]['num_pixels']/$generalStats['pixelsAnalyzedSum'],2)):"",
     276            'num'   => (array_key_exists($rgb, $colors))?$colors[$rgb]['num_images']:"",
     277          );
     278        }
     279      }
     280
     281      unset($colors);
     282      return($colorTable);
     283    }
     284
     285
     286
    190287
    191288
  • extensions/ColorStat/language/en_UK/plugin.lang.php

    r5961 r6107  
    5959$lang['cstat_NumOfImages']='Number of images';
    6060$lang['cstat_NumOfPixels']='Number of pixels';
    61 $lang['cstat_NumOfImages_help']="Indicates the number of images in which color is present. The percentage is relative to the number of images analyzed.";
    62 $lang['cstat_NumOfPixels_help']="Indicates the number of pixels for which color has been determined. The percentage is relative to the number of pixels analyzed and represents the 'area' occupied on all photos.";
     61$lang['cstat_NumOfImages_help']="Indicates the number of images in which color is present.<br>The percentage is relative to the number of images analyzed.";
     62$lang['cstat_NumOfPixels_help']="Indicates the number of pixels for which color has been determined.<br>The percentage is relative to the number of pixels analyzed and represents the 'area' occupied on all photos.";
    6363$lang['cstat_images']='images';
    6464$lang['cstat_surface']='surface';
    6565
    6666
     67
    6768$lang['cstat_search']='Search';
     69$lang['cstat_search_by_color']='Search by color';
     70$lang['cstat_choose_colors']='Sélection de couleurs';
     71$lang['cstat_choosen_colors']='Couleurs sélectionnées';
     72$lang['cstat_operator_and']="Toutes les couleurs sélectionnées doivent être présentes dans l'image";
     73$lang['cstat_operator_or']="Au moins une des couleurs sélectionnées doit être présente dans l'image";
     74$lang['cstat_operator_not']="Aucune des couleurs sélectionnées ne doit être présente dans l'image'";
     75$lang['cstat_color_already_choosen']='La couleur est déjà sélectionnée dans la liste';
     76$lang['cstat_add_colors']='Ajouter une sélection de couleurs';
     77$lang['cstat_clear_colors']='Réinitialiser les critères';
     78$lang['cstat_do_modify_request']='Modifier la recherche';
     79$lang['cstat_search_criterion'] = 'Critères de recherche';
     80
     81
    6882$lang['cstat_config']='Configuration';
    6983
    70 $lang['cstat_search_by_color']='Search by color';
    7184$lang['cstat_config_plugin']='Configuring the plugin';
    7285
  • extensions/ColorStat/language/fr_FR/plugin.lang.php

    r5961 r6107  
    99$lang['cstat_release'] = 'v';
    1010$lang['cstat_ok']='OK';
     11$lang['cstat_cancel']='Annuler';
    1112
    1213$lang['cstat_install'] = 'Installation';
     
    6364$lang['cstat_NumOfImages']='Nombre d\'images';
    6465$lang['cstat_NumOfPixels']='Nombre de pixels';
    65 $lang['cstat_NumOfImages_help']="Indique le nombre d'images dans lesquelles la couleur est présente. Le pourcentage est relatif au nombre d'images analysées.";
    66 $lang['cstat_NumOfPixels_help']="Indique le nombre de pixels pour lesquels la couleur a été déterminée. Le pourcentage est relatif au nombre de pixels analysés et représente la 'surface' occupée sur l'ensemble des photos.";
     66$lang['cstat_NumOfImages_help']="Indique le nombre d'images dans lesquelles la couleur est présente.<br>Le pourcentage est relatif au nombre d'images analysées.";
     67$lang['cstat_NumOfPixels_help']="Indique le nombre de pixels pour lesquels la couleur a été déterminée.<br>Le pourcentage est relatif au nombre de pixels analysés et représente la 'surface' occupée sur l'ensemble des photos.";
    6768$lang['cstat_images']='images';
    6869$lang['cstat_surface']='surface';
     
    7071
    7172$lang['cstat_search']='Recherche';
     73$lang['cstat_search_by_color']='Effectuer une recherche par couleur';
     74$lang['cstat_choose_colors']='Sélection de couleurs';
     75$lang['cstat_choosen_colors']='Couleurs sélectionnées';
     76$lang['cstat_operator_and']="Toutes les couleurs sélectionnées doivent être présentes dans l'image";
     77$lang['cstat_operator_or']="Au moins une des couleurs sélectionnées doit être présente dans l'image";
     78$lang['cstat_operator_not']="Aucune des couleurs sélectionnées ne doit être présente dans l'image'";
     79$lang['cstat_color_already_choosen']='La couleur est déjà sélectionnée dans la liste';
     80$lang['cstat_add_colors']='Ajouter une sélection de couleurs';
     81$lang['cstat_clear_colors']='Réinitialiser les critères';
     82$lang['cstat_do_modify_request']='Modifier la recherche';
     83$lang['cstat_search_criterion'] = 'Critères de recherche';
     84$lang['cstat_number_of_item_found']='Nombre d\'images trouvées';
     85$lang['cstat_result_query']='Résultat de la recherche';
     86
    7287$lang['cstat_config']='Configuration';
     88$lang['cstat_gallery_integration']='Intégration dans la galerie';
     89$lang['cstat_apply']='Appliquer';
     90$lang['cstat_stat_and_search']='Statistiques & Recherches';
     91$lang['cstat_save_config']='Configuration enregistrée';
     92$lang['cstat_display_colors_on_image']='Afficher les couleurs associées à l\'image';
     93$lang['cstat_percent_min_significant']='Présence minimum au sein d\'une image pour qu\'une couleur soit considérée comme pertinente lors d\'une recherche :';
    7394
    74 $lang['cstat_search_by_color']='Effectuer une recherche par couleur';
    7595$lang['cstat_config_plugin']='Configuration du plugin';
    7696
     97$lang['cstat_colors_on_image']='Couleurs associées à l\'image';
     98
    7799?>
  • extensions/ColorStat/main.inc.php

    r5961 r6107  
    8585{
    8686  //CStat public interface loaded and active only if in public page
    87   /*include_once("cstat_pip.class.inc.php");
     87  include_once("cstat_pip.class.inc.php");
    8888  $obj=new CStat_PIP($prefixeTable, __FILE__);
    8989  set_plugin_data($plugin['id'], $obj);
    90   */
    9190}
    9291
  • extensions/ColorStat/maintain.inc.php

    r5961 r6107  
    7272    }
    7373    GPCCore::register($obj->getPluginName(), CSTAT_VERSION, $gpcNeeded);
     74    GPCRequestBuilder::register($obj->getPluginName(), dirname($obj->getFileLocation()).'/cstat_rb_callback.class.inc.php');
    7475  }
    7576  else
     
    117118    $obj = new CStat_Install($prefixeTable, __FILE__);
    118119    $obj->uninstall();
     120    GPCRequestBuilder::unregister($obj->getPluginName());
    119121    GPCCore::unregister($obj->getPluginName());
    120122  }
  • extensions/ColorStat/templates/cstat_color_table.tpl

    r5961 r6107  
    1 <table {if $data.id!=''}id="{$datas.id}"{/if} {if $data.class!=''}class="{$data.class}"{/if} style="border-collapse:collapse;">
     1<table {if $data.id!=''}id="{$data.id}"{/if} {if $data.class!=''}class="{$data.class}"{/if} >
    22  {foreach from=$data.colorTable item=row}
    33  <tr>
    44    {foreach from=$row item=col}
    5     <td style="width:{$data.size}px;height:{$data.size}px;background-color:#{$col.color};"
    6         title="{'cstat_color'|@translate}&nbsp;#{$col.color} {if $col.num!=''}&nbsp;-&nbsp;{$col.num}&nbsp;{'cstat_images'|@translate}{/if} {if $col.pct!=''}&nbsp;-&nbsp;{'cstat_surface'|@translate}&nbsp;{$col.pct}%{/if} "></td>
     5    <td id="cellColor_{$col.color}" style="width:{$data.size}px;height:{$data.size}px;background-color:#{$col.color};{if $col.num!=''}cursor:pointer;{/if}" class="tiptip {if $col.num!=''}csSelectable{/if}"
     6        title="{'cstat_color'|@translate}&nbsp;#{$col.color}{if $col.num!=''}&nbsp;:&nbsp;{$col.num}&nbsp;{'cstat_images'|@translate}{/if}{if $col.pct!=''} {$data.br} {'cstat_surface'|@translate}&nbsp;{$col.pct}%{/if}">
     7    </td>
    78    {/foreach}
    89  </tr>
Note: See TracChangeset for help on using the changeset viewer.