123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385 |
- {template 'common/header'}
- <script type="text/javascript">
- <!--
- var packet = {php echo ($packet ? json_encode($packet) : 'null');};
- angular.module('cloudApp');
- angular.module('cloudApp')
- .controller('FileProcessorCtrl', function($scope, $http, config) {
- $scope.files = config.files;
- $scope.fails = [];
- var total = $scope.files.length;
- var i = 1;
- var errormsg = '';
- var tasknum = config.tasknum && config.type != '' ? config.tasknum : 1;
- if (tasknum > total) {
- tasknum = 1;
- }
- var proc = function() {
- var path = $scope.files.pop();
- if(!path && i >= total) {
- if ($scope.fails && $scope.fails.length > 0) {
- util.message('文件同步失败,可能是目录权限问题,请重试同步成功后继续。', './index.php?c=cloud&a=upgrade&', 'info');
- } else {
- var targetUrl = '';
- if (config.type == 'theme') {
- targetUrl = './index.php?c=cloud&a=process&step=schemas&t=' + config.appname + '&is_upgrade=' + config.is_upgrade;
- } else if (config.type == 'webtheme') {
- targetUrl = './index.php?c=cloud&a=process&step=schemas&w=' + config.appname + '&is_upgrade=' + config.is_upgrade;
- } else {
- targetUrl = './index.php?c=cloud&a=process&step=schemas&m=' + config.appname + '&is_upgrade=' + config.is_upgrade + '&batch=1&support=' + config.account_type + '&has_new_support={$has_new_support}';
- }
- util.message('文件同步完成,正在处理数据同步......', targetUrl, 'success');
- }
- return;
- }
- $scope.file = path;
- $scope.pragress = i + '/' + total;
- $scope.pragressPer = Math.floor((i / total) * 100);
- $scope.topPragress = $scope.pragressPer < 50 ? $scope.pragressPer * 3.6 - 135 : 45;
- $scope.bottomPragress = $scope.pragressPer > 50 ? ($scope.pragressPer - 50) * 3.6 - 135 : -135;
- var params = {path: path, type : config.type};
- $http.post(location.href, params).success(function(dat){
- i++;
- if(dat != 'success') {
- $scope.fails.push('['+dat+'] ' + path);
- errormsg = dat;
- }
- proc();
- }).error(function(){
- i++;
- $scope.fails.push(path);
- proc();
- });
- }
- for (j = 0; j < tasknum; j++) {
- proc();
- }
- })
- .controller('SchemasProcessorCtrl', function($scope, $http, config){
- if (packet && (packet.files.length > 0)) {
- util.message('请先完成文件同步', './index.php?c=cloud&a=upgrade');
- return false;
- }
- $scope.schemas = config.schemas;
- $scope.fails = [];
- var is_m_install = config.is_module_install;
- var total = $scope.schemas.length;
- var i = 1;
- var error = function() {
- util.message('未能成功执行处理数据库, 请联系开发商解决. ');
- }
- var proc = function() {
- var schema = $scope.schemas.pop();
- if(!schema) {
- if($scope.fails.length > 0) {
- error();
- return;
- } else {
- if(is_m_install == 1) {
- location.href = '';
- } else {
- location.href = '';
- }
- return;
- }
- }
- $scope.schema = schema;
- $scope.pragress = i + '/' + total;
- $scope.pragressPer = Math.floor((i / total) * 100);
- $scope.topPragress = $scope.pragressPer < 50 ? $scope.pragressPer * 3.6 - 135 : 45;
- $scope.bottomPragress = $scope.pragressPer > 50 ? ($scope.pragressPer - 50) * 3.6 - 135 : -135;
- var params = {table: schema};
- $http.post(location.href, params).success(function(dat){
- i++;
- if(dat != 'success') {
- $scope.fails.push(schema)
- }
- if (dat['message']) {
- util.message(dat['message']);
- return;
- }
- proc();
- }).error(function(){
- i++;
- $scope.fails.push(schema);
- proc();
- });
- }
- proc();
- })
- .controller('processor', function($scope, $http){
- if (packet && (packet.files.length > 0 || packet.files.schemas > 0)) {
- util.message('请先完成文件或是数据库同步', './index.php?c=cloud&a=upgrade');
- return false;
- }
- $scope.scripts = {php echo json_encode($scripts);};
- $scope.fails = [];
-
- var is_upgrade = "{php echo $is_upgrade}";
- var total = $scope.scripts.length;
- var i = 1;
- var error = function() {
- util.message('未能成功执行清理升级操作, 请联系开发者. ');
- }
- var proc = function() {
- var script = $scope.scripts.shift();
- if(!script) {
- if($scope.fails.length > 0) {
- error();
- } else {
- if(is_upgrade == 1) {
- {if $_GPC['batch']}
- location.href = '{url "system/module/upgrade" array("m" => $m, "flag" => 1, "batch_from_cloud" => 1)}';
- {else}
- location.href = '{url "system/module/upgrade" array("m" => $m, "flag" => 1)}';
- {/if}
- return;
- }
-
- var is_confirm = "{php echo $_GPC['is_confirm']}";
- if(is_confirm == 1) {
- if(confirm('已经成功执行升级操作! '+"\n"+' 由于数据库更新, 可能会产生多余的字段. 你可以按照需要删除')) {
- location.href = '{url "cloud/upgrade"}';
- } else {
- location.href = '{url "cloud/upgrade"}';
- }
- } else {
- util.message('已经成功执行升级操作! '+"\n"+' 由于数据库更新, 可能会产生多余的字段. 你可以按照需要删除.', '{url "cloud/upgrade"}');
- }
- return;
- }
- }
- $scope.script = script.fname;
- $scope.message = script.message;
- $scope.pragress = i + '/' + total;
- $scope.pragressPer = Math.floor((i / total) * 100);
- $scope.topPragress = $scope.pragressPer < 50 ? $scope.pragressPer * 3.6 - 135 : 45;
- $scope.bottomPragress = $scope.pragressPer > 50 ? ($scope.pragressPer - 50) * 3.6 - 135 : -135;
- var params = {fname: script.fname};
- $http.post(location.href, params).success(function(dat){
- i++;
- if(dat != 'success') {
- $scope.fails.push(script.fname)
- error();
- return;
- }
- proc();
- }).error(function(){
- i++;
- $scope.fails.push(script.fname);
- error();
- });
- }
- proc();
- });
- //-->
- </script>
- {if $step == 'files'}
- {if !empty($_GPC['m'])}
- <ul class="we7-step">
- <li class="active"><span class="content">1 安装应用</span></li>
- <li ><span class="content">2 分配应用权限</span> </li>
- <li><span class="content">3 安装成功</span> </li>
- </ul>
- {/if}
- <div class="clearfix js-processor" ng-controller="FileProcessorCtrl" ng-cloak>
- <div class="upgrade-pragress we7-margin-bottom">
- <div class="wrapper top">
- <div class="circleProgress topcircle" ng-style="{transform: 'rotate('+ topPragress +'deg)'}"></div>
- </div>
- <div class="wrapper bottom">
- <div class="circleProgress bottomcircle" ng-style="{transform: 'rotate('+ bottomPragress +'deg)'}"></div>
- </div>
- <div class="circle">
- <img src="./resource/images/upgrade.png" alt="">
- <div class="pragress">
- {{pragressPer}}%
- </div>
- </div>
- </div>
- <div class="alert we7-page-alert">
- 正在更新系统文件, 请不要关闭窗口
- </div>
- <div class="alert we7-page-alert">
- 如果下载文件失败,可能造成的原因:写入失败,请仔细检查写入权限是否正确。
- </div>
- <div class="alert alert-info form-horizontal ng-cloak" >
- <dl class="dl-horizontal">
- <dt>整体进度</dt>
- <dd>{{pragress}}</dd>
- <dt>正在下载文件</dt>
- <dd class="text-over">{{file}}</dd>
- </dl>
- <dl class="dl-horizontal" ng-show="fails.length > 0">
- <dt>下载失败的文件</dt>
- <dd>
- <p class="text-danger text-over" ng-repeat="file in fails" style="margin:0;">{{file}}</p>
- </dd>
- </dl>
- </div>
- <script type="text/javascript">
- angular.module('cloudApp').value('config', {
- files : {php echo $packet['files'] ? json_encode($packet['files']) : '[]'},
- type : '{$type}',
- appname : '{$m}',
- is_upgrade : '{$is_upgrade}',
- account_type : "{$_GPC['support']}",
- tasknum : "{$packet['task']}",
- });
- angular.bootstrap($('.js-processor'), ['cloudApp']);
- </script>
- </div>
- {/if}
- {if $step == 'schemas'}
- <div class="clearfix js-processor" ng-cloak ng-controller="SchemasProcessorCtrl">
- {if empty($packet['schemas'])}
- <!-- 如果是安装模块,数据库操作完成后,不处理script,直接跳转到system/module/install -->
- <!-- 安装 -->
- {if !empty($packet['install'])}
- {if $packet['type'] == 'theme'}
- <script>
- location.href = '{url "system/template/install" array("templateid" => $m, "flag" => 1)}';
- </script>
- {elseif $packet['type'] == 'webtheme'}
- <script>
- location.href = '{url "system/webtheme/install" array("webtheme" => $m, "flag" => 1)}';
- </script>
- {else}
- <script>
- location.href = '{url "module/manage-system/install" array("module_name" => $m, "flag" => 1, "support" => $_GPC["support"])}';
- </script>
- {/if}
- {/if}
- <!-- 升级 -->
- {if $packet['type'] == 'theme'}
- <script>
- location.href = '{url "cloud/process" array("step" => "scripts", "t" => $m, "is_upgrade" => $is_upgrade)}';
- </script>
- {elseif $packet['type'] == 'webtheme'}
- <script>
- location.href = '{url "cloud/process" array("step" => "scripts", "w" => $m, "is_upgrade" => $is_upgrade)}';
- </script>
- {else}
- <script>
- {if $_GPC['batch']}
- location.href = '{url "cloud/process" array("step" => "scripts", "m" => $m, "is_upgrade" => $is_upgrade, "batch" => 1, "support" => $_GPC["support"], "has_new_support" => $has_new_support)}';
- {else}
- location.href = '{url "cloud/process" array("step" => "scripts", "m" => $m, "is_upgrade" => $is_upgrade, "support" => $_GPC["support"], "has_new_support" => $has_new_support)}';
- {/if}
- </script>
- {/if}
- {/if}
- <div class="upgrade-pragress we7-margin-bottom">
- <div class="wrapper top">
- <div class="circleProgress topcircle" ng-style="{transform: 'rotate('+ topPragress +'deg)'}"></div>
- </div>
- <div class="wrapper bottom">
- <div class="circleProgress bottomcircle" ng-style="{transform: 'rotate('+ bottomPragress +'deg)'}"></div>
- </div>
- <div class="circle">
- <img src="./resource/images/upgrade.png" alt="">
- <div class="pragress">
- {{pragressPer}}%
- </div>
- </div>
- </div>
- <div class="alert alert-warning we7-page-alert">
- 正在更新数据库, 请不要关闭窗口.
- </div>
- <div class="alert alert-info form-horizontal" >
- <dl class="dl-horizontal">
- <dt>整体进度</dt>
- <dd>{{pragress}}</dd>
- <dt>正在处理数据表</dt>
- <dd>{{schema}}</dd>
- </dl>
- <dl class="dl-horizontal" ng-show="fails.length > 0">
- <dt>处理失败的数据表</dt>
- <dd>
- <p class="text-danger" ng-repeat="schema in fails" style="margin:0;">{{schema}}</p>
- </dd>
- </dl>
- </div>
- <script type="text/javascript">
- angular.module('cloudApp').value('config', {
- schemas : {php echo $schemas ? json_encode($schemas) : '[]'},
- is_module_install : {php echo !empty($packet['install']) ? 'true' : 'false'},
- });
- angular.bootstrap($('.js-processor'), ['cloudApp']);
- </script>
- </div>
- {/if}
- {if $step == 'scripts'}
- <div class="clearfix js-processor" ng-cloak ng-controller="processor">
- {if empty($packet['scripts']) || !empty($packet['type'])}
- <!-- 如果是更新模块,跳转到system/module/upgrade -->
- {if $is_upgrade == 1}
- {if $packet['type'] == 'theme'}
- <script>
- location.href = '{url "system/template/upgrade" array("templateid" => $m, "flag" => 1)}';
- </script>
- {elseif $packet['type'] == 'webtheme'}
- <script>
- location.href = '{url "system/webtheme/upgrade" array("webthemeid" => $m, "flag" => 1)}';
- </script>
- {else}
- <script>
- location.href = '{url "module/manage-system/upgrade" array("module_name" => $m, "flag" => 1, "support" => $_GPC["support"], "has_new_support" => $has_new_support)}';
- </script>
- {/if}
-
- {/if}
- <script>
- var is_confirm = "{php echo $_GPC['is_confirm']}";
- if(is_confirm == 1) {
- if(confirm('已经成功执行升级操作! '+"\n"+' 由于数据库更新, 可能会产生多余的字段. 你可以按照需要删除')) {
- location.href = '{url "cloud/upgrade"}';
- } else {
- location.href = '{url "cloud/upgrade"}';
- }
- } else {
- require(['util'], function(u){
- u.message('已经成功执行升级操作! '+"\n"+' 由于数据库更新, 可能会产生多余的字段. 你可以按照需要删除.', '{url "cloud/upgrade"}');
- });
- }
- </script>
- {/if}
- <div class="upgrade-pragress we7-margin-bottom">
- <div class="wrapper top">
- <div class="circleProgress topcircle" ng-style="{transform: 'rotate('+ topPragress +'deg)'}"></div>
- </div>
- <div class="wrapper bottom">
- <div class="circleProgress bottomcircle" ng-style="{transform: 'rotate('+ bottomPragress +'deg)'}"></div>
- </div>
- <div class="circle">
- <img src="./resource/images/upgrade.png" alt="">
- <div class="pragress">
- {{pragressPer}}%
- </div>
- </div>
- </div>
- <div class="alert alert-warning we7-page-alert">
- 正在数据迁移及清理操作, 请不要关闭窗口.
- </div>
- <div class="alert alert-info form-horizontal " >
- <dl class="dl-horizontal">
- <dt>整体进度</dt>
- <dd>{{pragress}}</dd>
- <dt>正在处理</dt>
- <dd>{{script}}<br />{{message}}</dd>
- </dl>
- <dl class="dl-horizontal" ng-show="fails.length > 0">
- <dt>处理失败的操作</dt>
- <dd>
- <p class="text-danger" ng-repeat="script in fails" style="margin:0;">{{script}}</p>
- </dd>
- </dl>
- </div>
- <script>
- angular.bootstrap($('.js-processor'), ['cloudApp']);
- </script>
- </div>
- {/if}
- {template 'common/footer'}
|