Guest User

cgfile

a guest
Apr 10th, 2017
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.34 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. //success:jQuery("#aitcg-control-panel").show();
  79.  
  80. },
  81. Text: {
  82. requestUrl : '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/ajax/addText')); ?>',
  83. textLength : <?php echo (int)$_option->getTextLength() ?>,
  84. fontOptions : '<?php echo Mage::helper('aitcg/font')->getFontOptionHtml(); ?>',
  85. fontPreviewUrl : '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/ajax/fontPreview'))?>',
  86. useOutline : <?php echo (int)Mage::getStoreConfig('catalog/aitcg/aitcg_font_outline'); ?>,
  87. useShadow : <?php echo (int)Mage::getStoreConfig('catalog/aitcg/aitcg_font_shadow'); ?>,
  88. useColorpick : <?php echo (int)$_option->getAllowColorpick() ?>,
  89. onlyPredefColor: <?php echo (int)$this->getAllowPredefinedColors()?>,
  90. colorSet : '<?php echo $this->getColorset()->getValue();?>',
  91. placeBehind : <?php echo (int)$this->getAllowPlaceBehind()?>,
  92. DefaultImageBehind: <?php echo (int)$_option->getDefImgBehindText() ?>
  93. },
  94. Social: {
  95. imgCreatePath : '<?php echo Mage::helper('aitcg')->getImgCreatePath() ?>',
  96. reservedImgId : '<?php echo $sharedImgId ?>',
  97. imgViewUrl : '<?php echo $sharedImgUrl ?>',
  98. wasCreatedUrl : '<?php echo $sharedImgWasCreatedUrl ?>',
  99. allowChecking : <?php echo $_defaultValues['img_data'] != '' ? 'true' : 'false' ?>
  100. },
  101. Save: {
  102. saveSvgUrl : '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/index/svg')); ?>',
  103. normalizateSvgToPngUrl: '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/index/svgtopng')); ?>',
  104. //getPrint - to update
  105. savePdfUrl : '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl($this->getSavePdfUrl()); ?>',
  106. saveImageDefaultUrl : '<?php echo Mage::helper('aitcg')->getSecureUnsecureUrl(Mage::getUrl('aitcg/ajax/createImageDefault',array('id' => Mage::registry("current_product")->getId()))); ?>',
  107. isShow : <?php echo (int)$_option->getAllowSaveGraphics() ?>,
  108. /* createDuplicateProductUrl: '<?php echo Mage::getUrl("example/amasty/createSimpleProductAndRedirect", array('id' => Mage::registry("current_product")->getId())); ?>' */
  109. }
  110. },
  111.  
  112. jsUrl: '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);?>',
  113. editorEnabled: true,
  114. isUserLoggedIn : '<?php echo (Mage::getSingleton('customer/session')->isLoggedIn())? "true": "false"; ?>',
  115.  
  116. <?php else: ?>
  117. editorEnabled: false,
  118. isUserLoggedIn : '<?php echo (Mage::getSingleton('customer/session')->isLoggedIn())? "true": "false"; ?>',
  119.  
  120. <?php endif; ?>
  121. viewType: '<?php echo ucfirst(Mage::getStoreConfig('catalog/aitcg/aitcg_editor_position')); ?>',
  122. rand: '<?php echo $_rand; ?>',
  123. checkboxEnabled: <?php echo (int)$checkboxEnabled; ?>,
  124. allowUploadUnderTemplate: 1,
  125.  
  126. product_id : '<?php echo $_option->getProductId(); ?>',
  127. optionId : <?php echo $_option->getId() ?>,
  128. distortion : <?php echo $this->isObjectDistortionAllowed()?>,
  129. previewContainer : 'preview_container<?php echo $_option->getId(); ?>',
  130.  
  131. toolboxStyle: '<?php echo Mage::getStoreConfig('catalog/aitcg/aitcg_toolbox_style'); ?>'
  132. };
  133. Object.extend(aitcgConfig<?php echo $_rand; ?>, aitcgBaseConfig);
  134. //]]>
  135. </script>
  136. <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>
  137. <?php echo $this->getFormatedPrice() ?></dt>
  138. <dd<?php if ($_option->decoratedIsLast){?> class="last"<?php }?>>
  139. <div>
  140. <div class="aitcg_error" style="display: none;">
  141. <?php echo $this->__('Sorry, but your browser does NOT support HTML5 elements and this feature is not working or may work incorrectly.');?><br />
  142. <span class="error_default" style="display: none"><?php echo $this->__('Please, try using different browser.');?></span>
  143. <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>
  144. </div>
  145. <?php //echo $this->__('Click on the thumbnail to choose the product image for editing.'); ?>
  146. <div class="aitcg_image_div" style="float:none;display:none;" id="preview_container<?php echo $_option->getId(); ?>"></div>
  147. <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'])?>' />
  148. <?php if ($checkboxEnabled == 1): ?>
  149. <p class="no-margin">
  150. <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; ?>/>
  151. <?php if($fullCheckboxEnabled == 1): ?>
  152. <a href="#" onClick="return opCimage<?php echo $_rand; ?>.checkConfirmBox(this);"><?php echo Mage::getStoreConfig('catalog/aitcg/aitcg_confirm_text'); ?></a>
  153. <?php else: ?>
  154. <label for="<?php echo $_fileOption; ?>_checkbox"><?php echo Mage::getStoreConfig('catalog/aitcg/aitcg_confirm_text'); ?></label>
  155. <?php endif; ?>
  156. </p>
  157. <?php endif; ?>
  158. </div>
  159. </dd>
  160. <script type="text/javascript">
  161. //<![CDATA[
  162. var opCimage<?php echo $_rand; ?> = null;
  163. aitcgWindowOnload.push( function(){
  164. opCimage<?php echo $_rand; ?> = new Aitcg_Option( aitcgConfig<?php echo $_rand; ?> );
  165. opCimage<?php echo $_rand; ?>.view.initPreview();
  166. <?php if(Mage::helper('aitcg')->isVYAEnabled()): ?>
  167. if(typeof objectsCPPVYA == 'undefined'){
  168. objectsCPPVYA = [];
  169. }
  170. objectsCPPVYA.unshift(opCimage<?php echo $_rand; ?>);
  171. <?php endif; ?>
  172. });
  173. //]]>
  174. </script>
  175. <img class='techimg' style="display:none;">
  176.  
  177. <?php if(Mage::getStoreConfig('catalog/aitcg/aitcg_use_social_networks_sharing')) : ?>
  178. <div id="socialWidgetsTip<?php echo $_option->getId() ?>" style="display:none;">
  179. <a href="#" onclick="return false;"><?php echo $this->__('Click to share your customized image'); ?></a>
  180. </div>
  181. <div id="imgSizeError<?php echo $_option->getId() ?>" style="display:none;">
  182. <?php echo $this->__('You image exceeds maximum allowed size'); echo ' (' .
  183. Mage::getStoreConfig('catalog/aitcg/aitcg_social_networks_sharing_max_img_width') . 'x' .
  184. Mage::getStoreConfig('catalog/aitcg/aitcg_social_networks_sharing_max_img_height') . ')';?>
  185. </div>
  186. <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>
  187. <div id="gaitcgWrapper<?php echo $_option->getId() ?>" style="display:inline;"> </div>
  188. <?php if ($this->canEmailToFriend()): ?>
  189. <?php $emailToFriendUrl = Mage::helper('aitcg')->getEmailToFriendUrl($this->getProduct(), $sharedImgId) ?>
  190. <div id="emailToFriend<?php echo $_option->getId() ?>" style="display:none;">
  191. <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>
  192. </div>
  193. <?php endif; ?>
  194. <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>
  195. <?php endif; ?>
  196. <script type="text/javascript">
  197. function openCustimage(id)
  198. {
  199. if(id=="UserImage"){
  200. jQuery('#aitcg-control-panel').css('bottom','145px');
  201. jQuery('#customproductrelay').css('display','block');
  202. jQuery('#fancyusercustimg').fadeIn(1000);
  203.  
  204. }
  205. else{jQuery('#aitcg-control-panel').css('bottom','74px');}
  206. }
  207. function closePopup() {
  208.  
  209. jQuery('#fancyusercustimg').fadeOut(1000);
  210. jQuery('#customproductrelay').css('display','none');
  211. jQuery("#aitcg-control-panel").show();
  212.  
  213. }
  214. function openfiletoupload() {
  215. jQuery('.newcustomimage').trigger("click");
  216. }
  217. function opencolorpalate() {
  218. jQuery('.jscolorpicker').trigger("focus");
  219. }
  220. function updatecolor(jscolorpicker) {
  221. jQuery('.aitcg_image_container').css("background","#"+jscolorpicker);
  222. }
  223. function testtect() {
  224. jQuery('button[id^="submit-text-edit"]').trigger('click');
  225.  
  226. }
  227. jQuery('#colorfield431527072').change(function() {
  228. alert("dfg");
  229. jQuery('button[id^="submit-text-edit"]').trigger('click');
  230. });
  231.  
  232.  
  233. // to dislay image preview 1
  234.  
  235.  
  236. $(".newcustomimage").change(function() {
  237. var input = this;
  238. if (input.files && input.files[0]) {
  239. var reader = new FileReader();
  240. reader.onload = function(e) {
  241. $("#imgcontaner").empty();
  242. $('<img/>').appendTo("#imgcontaner")
  243. .attr('src', e.target.result);
  244. }
  245.  
  246. reader.readAsDataURL(input.files[0]);
  247. }
  248. });
  249.  
  250.  
  251.  
  252.  
  253. function readURL(input) {
  254. if (input.files && input.files[0]) {
  255.  
  256. var reader = new FileReader();
  257. reader.onload = function(e) {
  258. jQuery('#previewImg').attr('src', e.target.result);
  259. jQuery('#previewImg').show();
  260. };
  261. reader.readAsDataURL(input.files[0]);
  262. }
  263. }
  264.  
  265.  
  266.  
  267. </script>
Add Comment
Please, Sign In to add comment