Thursday, December 19, 2013

AUI Script Number Validation

The below example is to validate the number,which will accept only numbers and  .0 or .5 ,not more than 4 digits.

<aui:input name="" label="">
<aui:validator name="required"></aui:validator>
<aui:validator name="custom" errorMessage="This field should be in correct NumberFormat only!!">
function(val, fieldNode, ruleValue)
{ var a= val;
if(/^([1-4]{0,1})([0-9]{1})(\.[0,5])?$/.test(a))
return true;
else
return false;
}
</aui:validator>
</aui:input>

Friday, December 13, 2013

Color schemes in Liferay Theme

liferay-look-and-feel.xml :-  In this file we have to mention the color scheme details ,In color-scheme tags we have to mention the color-scheme details .In below example i mentioned sampleGreen and sampleBlue to color-schemes

    <theme id="sample" name="sample" >
        <settings>
            <setting key="my-setting" value="my-value" />
        </settings>
        <color-scheme id="sampleGreen" name="sampleGreen">
            <css-class>sampleGreen</css-class> //css file should be with this name
            <color-scheme-images-path>${images-path}/color_schemes/${css-class}
               </color-scheme-images-path>// images path from where we have to add images
        </color-scheme>
       
        <color-scheme id="sampleBlue" name="sampleBlue">
            <css-class>sampleBlue</css-class>
            <color-scheme-images-path>${images-path}/color_schemes/${css-class}</color-scheme-images-path>
        </color-scheme>
    </theme>

css file Path :-       _diffs/css/color_schemes/
In this path we have to create our css files for above example we have to create css file with the name as follows
                         sampleGreen.css
                         sampleBlue.css  

images folder Path :-       _diffs/images/color_schemes/
 In this path we have to create our images folder above example we have to create images folder with the name as follows
                         sampleBlue
                         sampleGreen
In this folder we have to save the images which we are using for color schemes.

Hope this is Help for you.

If you have any type of Querries you can write a comments.  

Tuesday, December 10, 2013

Drag and Drop functionality


<script>
            window.onload = function() {
            var A = AUI();
                var dropbox = document.getElementById("droppingArea"); // id of tag where you want drag and drop
                dropbox.addEventListener("dragenter", dragging, false); // calling dragging method when drag enter
                dropbox.addEventListener("dragexit", dragging, false);
                dropbox.addEventListener("dragover", dragging, false);
                dropbox.addEventListener("drop", dropping, false);      // calling dropping method when dropping a file
            }
         function dragging(event) {
                event.stopPropagation();
                event.preventDefault();
                dropping();
            }

      function dropping(event) {
               event.stopPropagation();
               event.preventDefault();
               var files = event.dataTransfer.files;

                for (var i = 0; i < files.length; i++) {
                    upload(files[i]);
                }
            }

    function upload(file) {
            var formData = new FormData();
                formData.append("fileToUpload", file);
                formData.append("cmd",'cmd'); // these are the parameters which we want in any type of method
          // call to ajax
                sendFileToServer(formData);
      }
           function sendFileToServer(formData){
            // here example of ajax to hit the URL
            $.ajax({
            url: '<%=url of method%>',
            dataType:'text' ,
                    type: "POST",
                    contentType:false,
                    processData: false,
                    cache: false,
                    data: formData,
                    success: function(data){
                    if(data!=""){
               
                    }else{
           
                    }
                    },
                    error: function(){
                    alert("error --- > ");
                    }
            });
           
            }

</script>


Liferay DXP JNDI Data Source Cofiguration

 This Blog will help us to learn about the JNDI Data Source Configuration in Liferay DXP. We have tested this with Liferay 7.3 with Tomcat. ...