Guest User

grgtrt

a guest
Mar 24th, 2017
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.24 KB | None | 0 0
  1. <?php
  2. /**
  3. * @var $this Aitoc_Aitcg_Block_Catalog_Product_View_Options_Type_File
  4. */
  5. $_option = $this->getOption();
  6. $_fileInfo = $this->getFileInfo();
  7. $_image = $this->getImage();
  8. $_rand = rand();
  9. $_fileOption = 'options_' . $_option->getId();
  10. $_preview = $this->getPreview();
  11. $_defaultValues = isset($_preview['img_data']) ?
  12. $_preview :
  13. array('img_data' => '');
  14. $checkboxEnabled = (int)Mage::getStoreConfig('catalog/aitcg/aitcg_confirm_checkbox');
  15. if ($checkboxEnabled) {
  16. $fullCheckboxEnabled = Mage::getStoreConfig('catalog/aitcg/aitcg_confirm_fullcheckbox');
  17. }
  18. $sharedImgId = Mage::helper('aitcg')->getSharedImgId($_rand);
  19. $sharedImgUrl = Mage::helper('aitcg')->getSharedImgUrl($sharedImgId);
  20. $sharedImgWasCreatedUrl = Mage::helper('aitcg')->getSharedImgWasCreatedUrl(); ?>
  21. <link rel="stylesheet" type="text/css" href="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);?>fancybox/jquery.fancybox.css" />
  22. <script type="text/javascript" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);?>fancybox/jquery.fancybox.js"></script>
  23. <script type="text/javascript">
  24. //<![CDATA[
  25. var aitcgConfig<?php echo $_rand; ?> = {
  26. <?php if($_image !== false): ?>
  27. optionIsRequired: <?php echo (int)$_option->getIsRequire(); ?>,
  28.  
  29. productImage: {
  30. fullUrl: '<?php echo $_image["full_image"]; ?>',
  31. sizeX : <?php echo $_image["default_size"][0]; ?>,
  32. sizeY : <?php echo $_image["default_size"][1]; ?>,
  33.  
  34. thumb: {
  35. fullUrl: '<?php echo $_image["thumbnail_url"]; ?>',
  36. sizeX : <?php echo $_image["thumbnail_size"][0]; ?>,
  37. sizeY : <?php echo $_image["thumbnail_size"][1]; ?>
  38. }
  39. },
  40.  
  41. area: {
  42. sizeX : <?php echo $_option->getAreaSizeX() ?>,
  43. sizeY : <?php echo $_option->getAreaSizeY() ?>,
  44. offsetX: <?php echo $_option->getAreaOffsetX() ?>,
  45. offsetY: <?php echo $_option->getAreaOffsetY() ?>
  46. },
  47.  
  48. tools: {
  49. use: {
  50. PredefinedImage: <?php echo (int)$_option->getUsePredefinedImage() ?>,
  51. Mask : <?php echo (int)$_option->getUseMasks() ?>,
  52. UserImage : <?php echo (int)$_option->getUseUserImage() ?>,
  53. Text : <?php echo (int)$_option->getUseText() ?>,
  54. Social : <?php echo (int)Mage::getStoreConfig('catalog/aitcg/aitcg_use_social_networks_sharing') ?>,
  55. Save : 1
  56. },
  57. global: ['Save', 'Social'],
  58. PredefinedImage: {
  59. requestUrl : '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/ajax/addPredefined')); ?>',
  60. options : <?php echo Mage::helper('aitcg/category')->getPredefinedCatsOptionHtml($_option->getPredefinedCats()); ?>'',
  61. categoryPreviewUrl: '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/ajax/categoryPreview'))?>',
  62. placeBehind : <?php echo (int)$this->getAllowPlaceBehind()?>,
  63. DefaultImageBehind: <?php echo (int)$_option->getDefImgBehindClip() ?>
  64. },
  65. Mask: {
  66. requestUrl : '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/ajax/addMask')); ?>',
  67. options : <?php echo Mage::helper('aitcg/mask_category')->getMaskCatsOptionHtml($_option->getMasksCatId()); ?>'',
  68. categoryPreviewUrl: '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/ajax/masksCategory'))?>',
  69. location : <?php echo (int)$_option->getMaskLocation() ?>,
  70. createMaskUrl : '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/ajax/createMask')); ?>',
  71. getMaskUrl : '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/ajax/getMask')); ?>',
  72. delMaskUrl : '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/ajax/delMask')); ?>'
  73. },
  74. UserImage: {
  75. requestUrl: '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/ajax/addImage')); ?>',
  76. placeBehind : <?php echo (int)$this->getAllowPlaceBehind()?>,
  77. DefaultImageBehind: <?php echo (int)$_option->getDefImgBehindImage() ?>
  78. },
  79. Text: {
  80. requestUrl : '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/ajax/addText')); ?>',
  81. textLength : <?php echo (int)$_option->getTextLength() ?>,
  82. fontOptions : '<?php echo Mage::helper('aitcg/font')->getFontOptionHtml(); ?>',
  83. fontPreviewUrl : '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/ajax/fontPreview'))?>',
  84. useOutline : <?php echo (int)Mage::getStoreConfig('catalog/aitcg/aitcg_font_outline'); ?>,
  85. useShadow : <?php echo (int)Mage::getStoreConfig('catalog/aitcg/aitcg_font_shadow'); ?>,
  86. useColorpick : <?php echo (int)$_option->getAllowColorpick() ?>,
  87. onlyPredefColor: <?php echo (int)$this->getAllowPredefinedColors()?>,
  88. colorSet : '<?php echo $this->getColorset()->getValue();?>',
  89. placeBehind : <?php echo (int)$this->getAllowPlaceBehind()?>,
  90. DefaultImageBehind: <?php echo (int)$_option->getDefImgBehindText() ?>
  91. },
  92. Social: {
  93. imgCreatePath : '<?php echo Mage::helper('aitcg')->getImgCreatePath() ?>',
  94. reservedImgId : '<?php echo $sharedImgId ?>',
  95. imgViewUrl : '<?php echo $sharedImgUrl ?>',
  96. wasCreatedUrl : '<?php echo $sharedImgWasCreatedUrl ?>',
  97. allowChecking : <?php echo $_defaultValues['img_data'] != '' ? 'true' : 'false' ?>
  98. },
  99. Save: {
  100. saveSvgUrl : '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/index/svg')); ?>',
  101. normalizateSvgToPngUrl: '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/index/svgtopng')); ?>',
  102. //getPrint - to update
  103. savePdfUrl : '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl($this->getSavePdfUrl()); ?>',
  104. saveImageDefaultUrl : '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/ajax/createImageDefault',array('id' => Mage::registry("current_product")->getId()))); ?>',
  105. isShow : <?php echo (int)$_option->getAllowSaveGraphics() ?>,
  106. /* createDuplicateProductUrl: '<?php echo Mage::getUrl("example/amasty/createSimpleProductAndRedirect", array('id' => Mage::registry("current_product")->getId())); ?>' */
  107. }
  108. },
  109.  
  110. jsUrl: '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);?>',
  111. editorEnabled: true,
  112. isUserLoggedIn : '<?php echo (Mage::getSingleton('customer/session')->isLoggedIn())? "true": "false"; ?>',
  113.  
  114. <?php else: ?>
  115. editorEnabled: false,
  116. isUserLoggedIn : '<?php echo (Mage::getSingleton('customer/session')->isLoggedIn())? "true": "false"; ?>',
  117.  
  118. <?php endif; ?>
  119. viewType: '<?php echo ucfirst(Mage::getStoreConfig('catalog/aitcg/aitcg_editor_position')); ?>',
  120. rand: '<?php echo $_rand; ?>',
  121. checkboxEnabled: <?php echo (int)$checkboxEnabled; ?>,
  122. allowUploadUnderTemplate: 1,
  123.  
  124. product_id : '<?php echo $_option->getProductId(); ?>',
  125. optionId : <?php echo $_option->getId() ?>,
  126. distortion : <?php echo $this->isObjectDistortionAllowed()?>,
  127. previewContainer : 'preview_container<?php echo $_option->getId(); ?>',
  128.  
  129. toolboxStyle: '<?php echo Mage::getStoreConfig('catalog/aitcg/aitcg_toolbox_style'); ?>'
  130. };
  131. Object.extend(aitcgConfig<?php echo $_rand; ?>, aitcgBaseConfig);
  132. //]]>
  133. </script>
  134. <dt><label<?php if ($_option->getIsRequire()) : ?> class="required"<?php endif ?>><?php //echo $this->htmlEscape($_option->getTitle()) ?><?php if($this->isMageGtEq19() && $_option->getIsRequire()) : ?><em>*</em><?php elseif ($_option->getIsRequire()) : ?> <span class="required"><em>*</em></span><?php endif ?></label>
  135. <?php echo $this->getFormatedPrice() ?></dt>
  136. <dd<?php if ($_option->decoratedIsLast){?> class="last"<?php }?>>
  137. <div>
  138. <div class="aitcg_error" style="display: none;">
  139. <?php echo $this->__('Sorry, but your browser does NOT support HTML5 elements and this feature is not working or may work incorrectly.');?><br />
  140. <span class="error_default" style="display: none"><?php echo $this->__('Please, try using different browser.');?></span>
  141. <span class="error_android" style="display: none"><?php echo $this->__('Please, try using different browser (Opera Mini for example) or update your Android to a newer version.');?></span>
  142. </div>
  143. <?php //echo $this->__('Click on the thumbnail to choose the product image for editing.'); ?>
  144. <div class="aitcg_image_div" style="float:none;display:none;" id="preview_container<?php echo $_option->getId(); ?>"></div>
  145. <input type="hidden" id="options_<?php echo $_option->getId() ?>" class="input-text<?php echo $_option->getIsRequire() ? ' aitcg-required' : '' ?> product-custom-option" name="options[<?php echo $_option->getId() ?>]" value='<?php echo $this->htmlEscape($_defaultValues['img_data'])?>' />
  146. <?php if ($checkboxEnabled == 1): ?>
  147. <p class="no-margin">
  148. <input type="checkbox" name="<?php echo $_rand; ?>_checkbox" id="<?php echo $_fileOption; ?>_checkbox" class="product-custom-option <?php if ($_option->getIsRequire()) : ?>required-entry<?php endif ?>" <?php if($fullCheckboxEnabled == 1): ?>onClick="return opCimage<?php echo $_rand; ?>.checkConfirmBox(this);" <?php endif; ?>/>
  149. <?php if($fullCheckboxEnabled == 1): ?>
  150. <a href="#" onClick="return opCimage<?php echo $_rand; ?>.checkConfirmBox(this);"><?php echo Mage::getStoreConfig('catalog/aitcg/aitcg_confirm_text'); ?></a>
  151. <?php else: ?>
  152. <label for="<?php echo $_fileOption; ?>_checkbox"><?php echo Mage::getStoreConfig('catalog/aitcg/aitcg_confirm_text'); ?></label>
  153. <?php endif; ?>
  154. </p>
  155. <?php endif; ?>
  156. </div>
  157. </dd>
  158. <script type="text/javascript">
  159. //<![CDATA[
  160. var opCimage<?php echo $_rand; ?> = null;
  161. aitcgWindowOnload.push( function(){
  162. opCimage<?php echo $_rand; ?> = new Aitcg_Option( aitcgConfig<?php echo $_rand; ?> );
  163. opCimage<?php echo $_rand; ?>.view.initPreview();
  164. <?php if(Mage::helper('aitcg')->isVYAEnabled()): ?>
  165. if(typeof objectsCPPVYA == 'undefined'){
  166. objectsCPPVYA = [];
  167. }
  168. objectsCPPVYA.unshift(opCimage<?php echo $_rand; ?>);
  169. <?php endif; ?>
  170. });
  171. //]]>
  172. </script>
  173. <img class='techimg' style="display:none;">
  174.  
  175. <?php if(Mage::getStoreConfig('catalog/aitcg/aitcg_use_social_networks_sharing')) : ?>
  176. <div id="socialWidgetsTip<?php echo $_option->getId() ?>" style="display:none;">
  177. <a href="#" onclick="return false;"><?php echo $this->__('Click to share your customized image'); ?></a>
  178. </div>
  179. <div id="imgSizeError<?php echo $_option->getId() ?>" style="display:none;">
  180. <?php echo $this->__('You image exceeds maximum allowed size'); echo ' (' .
  181. Mage::getStoreConfig('catalog/aitcg/aitcg_social_networks_sharing_max_img_width') . 'x' .
  182. Mage::getStoreConfig('catalog/aitcg/aitcg_social_networks_sharing_max_img_height') . ')';?>
  183. </div>
  184. <div class="fb-like" style="visibility:hidden;vertical-align:top;" id="fbaitcg<?php echo $_option->getId() ?>" data-layout="button_count" data-href="<?php echo $sharedImgUrl ?>" data-send="true" data-show-faces="false"></div>
  185. <div id="gaitcgWrapper<?php echo $_option->getId() ?>" style="display:inline;"> </div>
  186. <?php if ($this->canEmailToFriend()): ?>
  187. <?php $emailToFriendUrl = Mage::helper('aitcg')->getEmailToFriendUrl($this->getProduct(), $sharedImgId) ?>
  188. <div id="emailToFriend<?php echo $_option->getId() ?>" style="display:none;">
  189. <p style="display:inline;" class="email-friend"><a href="<?php echo $emailToFriendUrl ?>" target="_blank"><img style="widht:107px;height:20px;" src="<?php echo $this->getSkinUrl('aitoc/aitcg/images') . '/email_to_a_friend.gif' ?>" /></a></p>
  190. </div>
  191. <?php endif; ?>
  192. <div id="socialButtonsLoader<?php echo $_option->getId() ?>" style="display:none;"><img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Email to a Friend') ?>" /></div>
  193. <?php endif; ?>
  194. <script type="text/javascript">
  195. function openCustimage(id)
  196. {
  197. if(id=="UserImage"){
  198. jQuery('#aitcg-control-panel').css('bottom','145px');
  199. jQuery('#customproductrelay').css('display','block');
  200. jQuery('#fancyusercustimg').fadeIn(1000);
  201.  
  202. }
  203. else{jQuery('#aitcg-control-panel').css('bottom','74px');}
  204. }
  205. function closePopup() {
  206.  
  207. jQuery('#fancyusercustimg').fadeOut(1000);
  208. jQuery('#customproductrelay').css('display','none');
  209.  
  210. }
  211. function openfiletoupload() {
  212. jQuery('.newcustomimage').trigger("click");
  213. }
  214. function opencolorpalate() {
  215. jQuery('.jscolorpicker').trigger("focus");
  216. }
  217. function updatecolor(jscolorpicker) {
  218. jQuery('.aitcg_image_container').css("background","#"+jscolorpicker);
  219. }
  220. function testtect() {
  221. jQuery('button[id^="submit-text-edit"]').trigger('click');
  222.  
  223. }
  224. jQuery('#colorfield431527072').change(function() {
  225. alert("dfg");
  226. jQuery('button[id^="submit-text-edit"]').trigger('click');
  227. });
  228.  
  229.  
  230. // to dislay image preview 1
  231.  
  232.  
  233. $(".newcustomimage").change(function() {
  234. var input = this;
  235. if (input.files && input.files[0]) {
  236. var reader = new FileReader();
  237. reader.onload = function(e) {
  238. $("#imgcontaner").empty();
  239. $('<img/>').appendTo("#imgcontaner")
  240. .attr('src', e.target.result);
  241. }
  242.  
  243. reader.readAsDataURL(input.files[0]);
  244. }
  245. });
  246.  
  247.  
  248.  
  249.  
  250. function readURL(input) {
  251. if (input.files && input.files[0]) {
  252.  
  253. var reader = new FileReader();
  254. reader.onload = function(e) {
  255. jQuery('#previewImg').attr('src', e.target.result);
  256. jQuery('#previewImg').show();
  257. };
  258. reader.readAsDataURL(input.files[0]);
  259. }
  260. }
  261.  
  262.  
  263.  
  264. </script>
Add Comment
Please, Sign In to add comment