[dev] [commit] r923 - templates/admin wwwbase/admin wwwbase/elfinder-connector wwwbase/js wwwbase/styles

Cătălin Frâncu cata at francu.com
Thu Aug 8 17:48:05 EEST 2013


În regulă!

On 2013-08-08 16:22, automailer at dexonline.ro wrote:
> Author: grigoroiualex
> Date: Thu Aug  8 16:22:52 2013
> New Revision: 923
> 
> Log:
> Added a button that toggles help text. Added simple validation for
> input fields so that no new tag will be saved blank. For the already
> saved tags, I created a form for each entry (placed the <form> tag
> inside the {foreach} loop). Otherwise, (with all elements nested
> within one <form>) it would delete only the last saved tag whether the
> selection.
> 
> Modified:
>    templates/admin/visualTag.ihtml
>    wwwbase/admin/visualTag.php
>    wwwbase/elfinder-connector/visual_connector.php
>    wwwbase/elfinder-connector/wotd_connector.php
>    wwwbase/js/visualTag.js
>    wwwbase/styles/flex.css
> 
> Modified: templates/admin/visualTag.ihtml
> ==============================================================================
> --- templates/admin/visualTag.ihtml	Fri Aug  2 13:57:39 2013	(r922)
> +++ templates/admin/visualTag.ihtml	Thu Aug  8 16:22:52 2013	(r923)
> @@ -13,22 +13,39 @@
>          Etichetarea este completă
>        </button>
>      </form>
> +    <button type="button" id="toggleHelp">Click pentru Ajutor</button>
> +    <div>
> +      <p id="helpText">
> +      Pasul 1: Selectează textul ținând apăsat click stânga și
> modificând selecția.
> +      Apoi, apasă primul buton „Setează coordonatele”.<br/>
> +      Pasul 2: Click pe imagine în locul în care indică săgeata.
> +      Apoi, apasă cel de-al doilea buton „Setează coordonatele”.<br/>
> +      Pasul 3: Selectează „Da”, dacă lexemul etichetei reprezintă 
> imaginea pe
> +      de-a-ntregul, altfel selectează „Nu” (lexemul reprezintă un 
> subansamblu
> +      al imaginii). Dacă lași neselectat, valoarea implicită va fi 
> „Da”.<br/>
> +      Pasul 4: Click pe butonul „Salvează eticheta” pentru a salva 
> adăugirile
> +      în baza de date. Dacă ai uitat vreun câmp necompletat, vei fi
> anunțat.<br/>
> +      Pasul 5: După ce ai terminat de adăugat toate etichetele, click 
> pe
> +      butonul „Etichetarea este completă” și se va încărca următoare 
> imagine
> +      neetichetată din baza de date, dacă aceasta există.
> +      </p>
> +    </div>
>    </div>
> 
>    <div>
> -    <form action="visualTag.php" method="post">
> +    <form action="visualTag.php" method="post" onsubmit="return 
> validateTag()">
>        <label>Id imagine:
>          <input type="text" size="4" value="{$imageId}" 
> name="imageId"/>
>        </label><br/>
>          <label>Cuvânt:
> -        <input type="text" size="15" name="lexem"/>
> +        <input id="lexem" type="text" size="15" name="lexem"/>
>        </label><br/>
>        <label>Coordonatele centrului etichetei:
>          <input id="xTag" type="text" size="4" name="xTag"/>
>          <input id="yTag" type="text" size="4" name="yTag"/>
>          <button id="setCoordTag" type="button">Setează 
> coordonatele</button>
>        </label><br/>
> -      <label>Coordonatele centrului zonei indicate:
> +      <label>Coordonatele zonei etichetate:
>          <input id="xImg" type="text" size="4" name="xImg"/>
>          <input id="yImg" type="text" size="4" name="yImg"/>
>          <button id="setCoordImg" type="button">Setează 
> coordonatele</button>
> @@ -41,14 +58,14 @@
>      </form>
> 
>      <h3>Etichete salvate</h3>
> -    <form action="visualTag.php" method="post">
> -      {foreach from=$savedTags item=tag}
> +    {foreach from=$savedTags item=tag}
> +      <form action="visualTag.php" method="post">
>          <label>{$tag->label}
>            <input type="hidden" name="savedTagId" value="{$tag->id}"/>
>            <button type="submit" name="action" value="delete">Șterge
> eticheta</button>
> -        </label><br/>
> -      {/foreach}
> -    </form>
> +        </label>
> +      </form>
> +    {/foreach}
>    </div>
>  {else}
>    <p>Toate imaginile au fost revizuite. Mulțumim!</p>
> 
> Modified: wwwbase/admin/visualTag.php
> ==============================================================================
> --- wwwbase/admin/visualTag.php	Fri Aug  2 13:57:39 2013	(r922)
> +++ wwwbase/admin/visualTag.php	Thu Aug  8 16:22:52 2013	(r923)
> @@ -3,7 +3,7 @@
>  require_once '../../phplib/models/Visual.php' ;
>  //util_assertModerator(PRIV_VISUAL);
>  util_assertNotMirror();
> -RecentLink::createOrUpdate('Tăguire Imagini Definiții');
> +RecentLink::createOrUpdate('Etichetare Imagini Definiții');
> 
>  $rootPath = util_getImgRoot() . '/';
>  $savedTags = '';
> @@ -19,7 +19,9 @@
> 
>    $line = Model::factory('VisualTag')->create();
>    $line->imageId = $imageId;
> -  $line->isMain = $isMain;
> +  if(!empty($isMain)) {
> +    $line->isMain = $isMain;
> +  }
>    $line->label = $lexem;
>    $line->textXCoord = $xTag;
>    $line->textYCoord = $yTag;
> @@ -27,6 +29,8 @@
>    $line->imgYCoord = $yImg;
>    $line->save();
> 
> +  util_redirect(util_getWwwRoot() . 'admin/visualTag.php');
> +
>  } else if(util_getRequestParameter('action') == 'delete') {
>    $tagId = util_getRequestParameter('savedTagId');
> 
> @@ -35,15 +39,18 @@
>      $line->delete();
>    }
> 
> +  util_redirect(util_getWwwRoot() . 'admin/visualTag.php');
> +
>  } else if(util_getRequestParameter('action') == 'finishedTagging') {
>    $imageId = util_getRequestParameter('imageId');
> 
>    $line = Visual::get_by_id($imageId);
>    $line->revised = 1;
>    $line->save();
> +
> +  util_redirect(util_getWwwRoot() . 'admin/visualTag.php');
>  }
> 
> -//$line = Model::factory('Visual')->where('revised', 0)->find_one();
>  $line = Visual::get_by_revised(0);
>  SmartyWrap::assign('anyUntaggedImages', !empty($line));
>  if(!empty($line)) {
> 
> Modified: wwwbase/elfinder-connector/visual_connector.php
> ==============================================================================
> --- wwwbase/elfinder-connector/visual_connector.php	Fri Aug  2
> 13:57:39 2013	(r922)
> +++ wwwbase/elfinder-connector/visual_connector.php	Thu Aug  8
> 16:22:52 2013	(r923)
> @@ -11,10 +11,6 @@
>  // Required for FTP connector support
>  // include_once __DIR__ . '/elFinderVolumeFTP.class.php';
> 
> -if(function_exists('date_default_timezone_set')) {
> -  date_default_timezone_set('Europe/Moscow');
> -}
> -
>  include_once __DIR__ . '/../../phplib/util.php';
>  include_once __DIR__ . '/elFinderLogger.class.php';
>  include_once __DIR__ . '/elFinderModToDB.class.php';
> 
> Modified: wwwbase/elfinder-connector/wotd_connector.php
> ==============================================================================
> --- wwwbase/elfinder-connector/wotd_connector.php	Fri Aug  2 13:57:39
> 2013	(r922)
> +++ wwwbase/elfinder-connector/wotd_connector.php	Thu Aug  8 16:22:52
> 2013	(r923)
> @@ -13,10 +13,6 @@
>  // Required for FTP connector support
>  // include_once __DIR__ . '/elFinderVolumeFTP.class.php';
> 
> -if(function_exists('date_default_timezone_set')) {
> -	date_default_timezone_set('Europe/Moscow');
> -}
> -
>  include_once __DIR__ . '/../../phplib/util.php';
> 
>  /**
> 
> Modified: wwwbase/js/visualTag.js
> ==============================================================================
> --- wwwbase/js/visualTag.js	Fri Aug  2 13:57:39 2013	(r922)
> +++ wwwbase/js/visualTag.js	Thu Aug  8 16:22:52 2013	(r923)
> @@ -11,8 +11,7 @@
>        boxHeight: 500,
>        boxWidth: 500,
>        onSelect: showCoords,
> -      onChange: showCoords,
> -      onRelease: resetCoords
> +      onChange: showCoords
>      }, function() {
>        jcrop_api = this;
>      });
> @@ -30,10 +29,6 @@
>      var q = new Array();
>      q = calculateCentre(c);
> 
> -    coords.x = c.x;
> -    coords.y = c.y;
> -    coords.w = c.w;
> -    coords.h = c.h;
>      coords.cx = q[0];
>      coords.cy = q[1];
>    };
> @@ -55,10 +50,6 @@
>    });
> 
>    function resetCoords() {
> -    coords.x = 0;
> -    coords.y = 0;
> -    coords.w = 0;
> -    coords.h = 0;
>      coords.cx = 0;
>      coords.cy = 0;
> 
> @@ -75,4 +66,30 @@
>      $('#xImg').val(coords.cx);
>      $('#yImg').val(coords.cy);
>    });
> +
> +  $('#toggleHelp').click(function() {
> +    $('#helpText').toggle();
> +  });
> +
>  });
> +
> +  function validateTag() {
> +    var lexem = document.getElementById('lexem').value;
> +    var xImg = document.getElementById('xImg').value;
> +    var yImg = document.getElementById('yImg').value;
> +    var xTag = document.getElementById('xTag').value;
> +    var yTag = document.getElementById('yTag').value;
> +
> +    if(!lexem) {
> +      alert('Ai uitat să completezi câmpul Cuvânt');
> +      return false;
> +
> +    } else if(!xImg || !yImg) {
> +      alert('Ai uitat să completezi câmpurile Coordonatele centrului
> etichetei');
> +      return false;
> +
> +    } else if(!xTag || !yTag) {
> +      alert('Ai uitat să completezi câmpurile Coordonatele zonei 
> etichetate');
> +      return false;
> +    }
> +  };
> 
> Modified: wwwbase/styles/flex.css
> ==============================================================================
> --- wwwbase/styles/flex.css	Fri Aug  2 13:57:39 2013	(r922)
> +++ wwwbase/styles/flex.css	Thu Aug  8 16:22:52 2013	(r923)
> @@ -393,4 +393,9 @@
>  /* VisualTag */
>  .visualTagCanvas {
>    float: left;
> +  width: 500px;
> +}
> +
> +#helpText {
> +  display: none;
>  }
> _______________________________________________
> Dev mailing list
> Dev at dexonline.ro
> http://list.dexonline.ro/listinfo/dev


More information about the Dev mailing list