PATH:
home
/
letacommog
/
letaweb
/
admin
/
modules
/
share_buttons
define(['module/base'],function(base) { return createModuleDefinition([base], function($file_manager,$dialog,popup) { this.initializeData = {layout_type: 0,buttons: ['facebook_like','tweet','google_plusone' ]}; this.map = [ {buttontype:1, buttonstyle:'horizontal'}, {buttontype:0, buttonstyle:'horizontal'}, {buttontype:0, buttonstyle:'horizontal'}, {buttontype:3}, {buttontype:1, buttonstyle:'vertical'}, {buttontype:0, buttonstyle:'vertical'}, {buttontype:0, buttonstyle:'vertical'} ]; this.replace_p0 = { 'compact2':'compact', 'hyves_respect':'hyves', 'linkedin_counter':'linkedin', 'stumbleupon_badge':'stumbleupon', 'facebook_like':'facebook', 'tweet':'twitter', 'google_plusone':'google_plusone_share', 'pinterest_pinit':'pinterest_share', }; this.replace_p1 = { 'compact':'compact2', 'hyves':'hyves_respect', 'linkedin':'linkedin_counter', 'stumbleupon':'stumbleupon_badge', 'facebook':'facebook_like', 'twitter':'tweet', 'google_plusone_share':'google_plusone', 'pinterest_share':'pinterest_pinit' }; this.multi_button = {'compact':[1,2],}; this.changelayout_type = function() { var buttons = this.module_data.buttons; var map = this.map; var replace_p0 = this.replace_p0; var replace_p1 = this.replace_p1; var l = this.module_data.layout_type || 0; l = map[l].buttontype; var r = l == 0 ? replace_p0 : replace_p1; for(var i = 0;i < buttons.length;i++) { if(r [ buttons[i] ] ) { buttons[i] = r [ buttons[i] ]; } } this.loadHtml(); }; this.controller = function($scope, $moduleInstance,communication) { $scope.changeLayout = function() { $moduleInstance.module_data = $scope.data; $moduleInstance.changelayout_type(); } $scope.openConfigButtonDialog = function() { popup.open({ name:'shareButtonConfig', controller: function($scope, $modalInstance) { $scope.ok = function() { // $scope.shareButtonConfigForm.submit(); $scope.$dismiss(); } } }) } $scope.openEditButtonDialog = function() { var modalInstance = $dialog.open({ templateUrl:getRelativeUrl() + 'api?path=content&action=getHtml&name=modules/share_buttons/edit_buttons', controller: function($scope,$modalInstance) { $scope.buttons=[]; $scope.sortableOptions = { connectWith: '.customize_buttons' }; $scope.ok = function() { $modalInstance.close($scope.buttons); } $scope.cancel = function() { $modalInstance.dismiss('cancel'); } communication.getSocialShareButtonList().then(function(json) { $scope.avaiable_buttons = json; var map = $scope.map; var layout_type = $moduleInstance.module_data.layout_type || 0; var map = $moduleInstance.map; var replace_p0 = $moduleInstance.replace_p0; var replace_p1 = $moduleInstance.replace_p1; var l = map[layout_type].buttontype; var r = l == 0 ? replace_p0 : replace_p1; var that = this; for(var j = 0;j < $moduleInstance.module_data.buttons.length;j++) { var flag = false; var ij = false; for(var i = 0;i < json.length;i++) { if($moduleInstance.module_data.buttons[j] == json[i].name) { flag = true; ij = i; } } if(flag) { $scope.buttons.push(angular.copy(json[ij])); $scope.avaiable_buttons.splice(ij,1); } } }); } }); modalInstance.result.then(function(data) { $moduleInstance.module_data.buttons = []; for(var i = 0;i < data.length;i++) { $moduleInstance.module_data.buttons.push(data[i].name); } }) } }; }); });
[+]
..
[-] frontend_script.php
[edit]
[-] frontend_view.php
[edit]
[-] frontend_class.php
[edit]
[-] backend.php
[edit]
[-] backend.js
[edit]