Subversion Repositories SmartDukaan

Rev

Rev 9155 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    
<html>
#set ($bannerType = $action.getBannerType())
#set ($banner = $action.getUpdates($bannerType))
#set ($mapdetails = $action.getbannermapdetail($bannerType))
#set ($uriMap = $action.getUriMapping($bannerType))
<head>
<link href="/css/imgareaselect-default.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="/js/jquery-1.4.2.js"></script>
<script type="text/javascript" src="/js/jquery.validate.js"></script>
<script type="text/javascript" src="/js/jquery.js"></script>
<script src="/js/jquery.imgareaselect.pack.js" type="text/javascript"></script>
<script type="text/javascript">
 function showHide(option) {
 if (option.value == 'True') {
     document.getElementById('image-map-div').style.display = 'block';
    }
    else{
    document.getElementById('image-map-div').style.display = 'none';
    }
 }
</script>
<script type="text/javascript">
function validateForm()
{
var x=document.forms["uploadFileToMyFolder"]["bannerName"].value;
if (x==null || x=="")
  {
  alert("Banner name must be filled out");
  return false;
  }
}
</script>
<script type="text/javascript">
        $(function() {
        $('#add-map').live('click', function(){
                $('<br/><br/><label>Coordinates : </label> <input id="mapCoordinates" name = "mapCoordinates" type = "textbox"/>'
                                +'<br/><br/><label>Link : </label> <input id="mapLink" name = "mapLink" type = "textbox"/>').appendTo('#image-map-container');
        });
   });
   $(document).ready(function() {
  $('#cancelbutton').click(function(e) {
    window.location.href = '/user-image';
  });
});
</script>
<script type="text/javascript">
function preview(img, selection) {
    if (!selection.width || !selection.height)
        return;
    
    var scaleX = 100 / selection.width;
    var scaleY = 100 / selection.height;

    $('#preview img').css({
        width: Math.round(scaleX * 300),
        height: Math.round(scaleY * 300),
        marginLeft: -Math.round(scaleX * selection.x1),
        marginTop: -Math.round(scaleY * selection.y1)
    });

    $('#x1').val((Math.round(selection.x1*1.29)));
    $('#y1').val((Math.round(selection.y1*1.34)));
    $('#x2').val((Math.round(selection.x2*1.29)));
    $('#y2').val((Math.round(selection.y2*1.34)));  
}

$(function () {
    $('#photo').imgAreaSelect({ handles: true,
        fadeSpeed: 200, onSelectChange: preview });
});
</script>
<script>
$(function() {
        $('#add-uri').live('click', function(){
                $('<br/><br/><label>On Page: </label> <input id="uri" name = "uri" type = "textbox"/>'
                +'<br><br><label>Acitive / InActive : </label><select id ="isActive" name="isActive"><option selected="selected" value="False">InActive</option><option value="True">Active</option></select><br><br><label>Target: </label><select id ="linkTarget" name="linkTarget"><option selected="selected" value="False">Same Window</option><option value="True">New Window</option></select>').appendTo('#uri-container');
         });
        });
</script>
        
        #if (!$banner.isHasMap())
                <style>
                        #image-map-div {
                        display : none
                        }
                        </style>
        #end
<style>
* { font-family: Verdana; font-size: 96%; }
                label {
    float: left;
    width: 150px;
}
select {
    width: 100px;
}
</style>
<title>Edit $action.getBannerName()</title>
</head>
<body>
<a href="/user-image">Back to listing</a>
<h2>Edit $action.getBannerName()</h2>
<div id="image" style="padding-bottom: 10px; height: 175px;">
        <img src='/images/banners/$banner.getImageName()' id="photo" style="float: left; width: 550px; height: 150px;">
                <div style="float: left; width: 18%; margin-bottom: 10px; margin-left: 10px;">
    <table style="">
      <thead>
        <tr>
          <th colspan="2" style="font-size: 110%; font-weight: bold; text-align: left; padding-left: 0.1em;">
            Coordinates
          </th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td style="width: 10%;"><b>X<sub>1</sub>:</b></td>
                      <td style="width: 30%;"><input type="text" id="x1" value="-"></td>
        </tr>
        <tr>
          <td><b>Y<sub>1</sub>:</b></td>
          <td><input type="text" id="y1" value="-"></td>
        </tr>
        <tr>
          <td><b>X<sub>2</sub>:</b></td>
          <td><input type="text" id="x2" value="-"></td>
          <td></td>
          <td></td>
        </tr>
        <tr>
          <td><b>Y<sub>2</sub>:</b></td>
          <td><input type="text" id="y2" value="-"></td>
          <td></td>
          <td></td>
        </tr>
      </tbody>
    </table>
  </div>
        </div>
<div style="padding-bottom: 20px;" id="upload-form">
<form id="uploadFileToMyFolder" name="userImage" action="/user-image" onsubmit="return validateForm()" enctype="multipart/form-data" method="post">
          <label for="imagePath">Image Path: </label>
          <input name="userImage" id="file" type="file">
          <br></br>
          <label for="bannerName">Banner Name: </label>
      <input id="bannerName" name="bannerName" value='$banner.getBannerName()'type="text"/>
      <br></br>
          <label for="bannerType">Banner Type : </label>
          <select name="bannerType" id="bannerType">
          #foreach( $bannerType in ['WEBSITE','MOBILE_SITE'] )
                #if ($bannerType == $action.getBannerType())
                                <option value='$bannerType' selected="selected">$bannerType</option>
                        #else
                                <option value='$bannerType'>$bannerType</option>
                        #end    
          #end
          </select>
          <br></br>
          <label for="fileExtenstion">Image Extention : </label>
          <select name="fileExtention" id="fileExtention">
          #foreach( $ext in ['jpg','jpeg','png','gif'] )
                #if ($ext == $action.getFileExtention())
                                <option value='$ext' selected="selected">$ext</option>
                        #else
                                <option value='$ext'>$ext</option>
                        #end    
          #end
          </select>
          <br></br>
      <label for="link">Link: </label>
      <input id="link" name="link" value='$banner.getLink()' type="text"/>
          <br></br>
          <div id="uri-div">
                <div id="uri-container">
                        #foreach ($uri in $uriMap)
                        <label>On Page: </label>
                        <input id="uri" name="uri" value = "$uri.getUri()" type="textbox"/>
                        <br><br>
                        <label>Acitive / InActive : </label>
                        #if ($uri.isIsActive())
                                <select name="isActive"><option selected="selected" value="True">Active</option><option value="False">InActive</option></select>
                        #else
                                <select name="isActive"><option selected="selected" value="False">InActive</option><option value="True">Active</option></select>
                        #end
                        <br><br>
                        <label>Target : </label>
                        #if ($uri.isTarget())
                                <select name="linkTarget"><option selected="selected" value="True">New Window</option><option value="False">Same Window</option></select>
                        #else
                                <select name="linkTarget"><option selected="selected" value="False">Same Window</option><option value="True">New Window</option></select>
                        #end
                        <br><br>
                        #end
                </div>
          <img id = "add-uri" src = "/images/add.png" />
          </div>
      <label for="priority">Priority: </label>
          <select name="priority">
                #foreach( $val in [1..10] )
                        #if ($val == $banner.getPriority())
                                <option value='$val' selected="selected">$val</option>
                        #else
                                <option value='$val'>$val</option>
                        #end    
                #end
                </select>
          <br></br>
          <label for="hasMap">Add Map : </label>
          #if ($banner.isHasMap())
                <select name="hasMap" id="has_Map" onchange="showHide(this)"><option selected="selected" value="True">Yes</option><option value="False">No</option></select>
          #else
                <select name="hasMap" id="has_Map" onchange="showHide(this)"><option selected="selected" value="False">No</option><option value="True">Yes</option></select>
          #end
      <br></br>
          <div id = "image-map-div" align = "left">
                                <h3>Map Details</h5>
                <div id = "image-map-container">
                                        #if (!$banner.isHasMap())
                                                <label>Coordinates : </label>
                                    <input id="mapCoordinates" name = "mapCoordinates" type = "textbox"/>
                                            <br></br>
                                    <label>Link : </label>
                                    <input id="mapLink" name = "mapLink" type = "textbox"/>
                                        #end
                                        #foreach($mapdetail in $mapdetails)
                                <label>Coordinates : </label>
                                <input id="mapCoordinates" name = "mapCoordinates" value="$mapdetail.getCoordinates()" type = "text"/>
                                        <br></br>
                                <label>Link : </label>
                                <input id="mapLink" name = "mapLink" value="$mapdetail.getMapLink()" type = "text"/>
                                        <br></br>
                                        #end
                </div>
                                <img id = "add-map" src = "/images/add.png" />
            </div>
          <br>
          <input style="margin-top: 8px;" name="upload" value="Update" type="submit">
          <input type="button" id="cancelbutton" name="cancel" value="Cancel"/>
          <input id="Action" value="$action.getBannerName()" name="action" style="visibility: hidden;" />
          <input id="ActionType" value="$action.getBannerType()" name="actionType" style="visibility: hidden;">
</form>
</div>
</body>
</html>