From d3948f2c172f67a95ecd0c9bdb6635981abf33ab Mon Sep 17 00:00:00 2001
From: Jay Allen
File not found.
"; } } - $html - .= " \n"; + $html .= " \n" . + " \n"; + + $html .= "\n"; + return $html; } ## end sub type_file @@ -1011,7 +1015,7 @@ sub _hdlr_field_category_list { my ( $ctx, $args, $cond ) = @_; my $field = $ctx->stash('field') or return _no_field($ctx); my $value = _get_field_value($ctx); - my @ids = ref($value) eq 'ARRAY' ? @$value : ($value); + my @ids = ref($value) eq 'ARRAY' ? @$value : ($value); my $class = $ctx->stash('obj_class'); my @categories = MT->model($class)->load( { id => \@ids } ); diff --git a/addons/ConfigAssistant.pack/lib/ConfigAssistant/Static.pm b/addons/ConfigAssistant.pack/lib/ConfigAssistant/Static.pm index aaf348285..51f67bee9 100644 --- a/addons/ConfigAssistant.pack/lib/ConfigAssistant/Static.pm +++ b/addons/ConfigAssistant.pack/lib/ConfigAssistant/Static.pm @@ -28,7 +28,6 @@ sub upgrade { # The saved version my $ver = MT->config('PluginStaticVersion'); - # $ver = undef; ### UNCOMMENT TO TEST STATIC UPGRADE ### # Check to see if $plugin->id is valid. If it's not, we need to @@ -69,13 +68,13 @@ sub upgrade { $cfg->set( 'PluginStaticVersion', $plugin_id . '=' . $static_version, 1 ); $self->progress( - $self->translate_escape( - "Plugin '[_1]' upgraded successfully to " - . "version [_2] (static version [_3]).", - $plugin->label, - $plugin->version || '-', - $static_version - ) + $self->translate_escape( + "Plugin '[_1]' upgraded successfully to " + . "version [_2] (static version [_3]).", + $plugin->label, + $plugin->version || '-', + $static_version + ) ); } ## end if ( $static_version >...) } ## end for my $sig ( keys %MT::Plugins) diff --git a/addons/ConfigAssistant.pack/lib/ConfigAssistant/Util.pm b/addons/ConfigAssistant.pack/lib/ConfigAssistant/Util.pm index 08aecb756..78f03169c 100644 --- a/addons/ConfigAssistant.pack/lib/ConfigAssistant/Util.pm +++ b/addons/ConfigAssistant.pack/lib/ConfigAssistant/Util.pm @@ -3,9 +3,11 @@ package ConfigAssistant::Util; use strict; use warnings; use base 'Exporter'; -our @EXPORT_OK = qw( find_theme_plugin find_template_def find_option_def - find_option_plugin process_file_upload - ERROR SUCCESS OVERWRITE NO_UPLOAD ); +our @EXPORT_OK + = qw( find_theme_plugin find_template_def find_option_def + find_option_plugin process_file_upload + plugin_static_web_path plugin_static_file_path + ERROR SUCCESS OVERWRITE NO_UPLOAD ); use MT::Util qw( encode_url ); @@ -14,6 +16,21 @@ sub SUCCESS () {1} sub OVERWRITE () {2} sub NO_UPLOAD () {3} +sub plugin_static_web_path { + my ($plugin) = @_; + my $url = MT->instance->static_path; + $url .= '/' unless $url =~ m!/$!; + $url .= 'support/plugins/' . $plugin->id . '/'; + return $url; +} + +sub plugin_static_file_path { + my ($plugin) = @_; + return File::Spec->catdir( MT->instance->static_file_path, + 'support', 'plugins', $plugin->id ); + +} + sub process_file_upload { my $app = shift; my ( $param_name, $scope, $extra_path, %upload_param ) = @_; diff --git a/addons/ConfigAssistant.pack/static/js/app.js b/addons/ConfigAssistant.pack/static/js/app.js index 34d935862..bceebfae4 100644 --- a/addons/ConfigAssistant.pack/static/js/app.js +++ b/addons/ConfigAssistant.pack/static/js/app.js @@ -1,19 +1,19 @@ $(document).ready( function() { - var active = $('#content-nav ul li.active a').attr('id'); - $('#' + active + '-content').show(); $('h2#page-title span').html( $('#content-nav ul li.active a b').html() ); $('#fieldsets input, #fieldsets select, #fieldsets textarea').change( function () { var changed = $(this).parent().parent().parent().attr('id'); $('#content-nav ul li.'+changed).addClass('changed'); }); $('#content-nav ul li a').click( function() { - var newactive = $(this).attr('id'); + var active = $(this).parents('ul').find('li.active a').attr('id').replace(/-tab$/,''); + var newactive = $(this).attr('id').replace(/-tab$/,''); $('#content-nav li.active').removeClass('active'); - $('#' + active + '-content').hide(); - $('#content-nav li.' + newactive).addClass('active'); - $('#' + newactive + '-content').show(); - $('h2#page-title span').html( $('#content-nav ul li.'+newactive+' a b').html() ); - active = newactive; + $('#' + active + '-tab-content').hide(); + $('#content-nav li.' + newactive+'-tab').addClass('active'); + $('#' + newactive + '-tab-content').show(); + $('h2#page-title span').html( $('#content-nav ul li.'+newactive+'-tab a b').html() ); + document.title = $(this).attr('title'); + window.location.hash = newactive; }); $('.field-type-radio-image li input:checked').each( function() { $(this).parent().addClass('selected'); }); $('.field-type-radio-image li').click( function() { @@ -24,4 +24,10 @@ $(document).ready( function() { var changed = $(this).parent().parent().parent().parent().attr('id'); $('#content-nav ul li.'+changed).addClass('changed'); }); + $.history.init(function(hash){ + if (hash == "") { + hash = $('#content-nav ul li:first-child a').attr('id').replace(/-tab$/,''); + } + $('#content-nav ul li.'+hash+'-tab a').click(); + }); }); diff --git a/addons/ConfigAssistant.pack/static/js/jquery.history.js b/addons/ConfigAssistant.pack/static/js/jquery.history.js new file mode 100644 index 000000000..7f91079d4 --- /dev/null +++ b/addons/ConfigAssistant.pack/static/js/jquery.history.js @@ -0,0 +1,194 @@ +/* + * jQuery history plugin + * + * The MIT License + * + * Copyright (c) 2006-2009 Taku Sano (Mikage Sawatari) + * Copyright (c) 2010 Takayuki Miwa + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +(function($) { + var locationWrapper = { + put: function(hash, win) { + (win || window).location.hash = this.encoder(hash); + }, + get: function(win) { + var hash = ((win || window).location.hash).replace(/^#/, ''); + try { + return $.browser.mozilla ? hash : decodeURIComponent(hash); + } + catch (error) { + return hash; + } + }, + encoder: encodeURIComponent + }; + + var iframeWrapper = { + id: "__jQuery_history", + init: function() { + var html = ''; + $("body").prepend(html); + return this; + }, + _document: function() { + return $("#"+ this.id)[0].contentWindow.document; + }, + put: function(hash) { + var doc = this._document(); + doc.open(); + doc.close(); + locationWrapper.put(hash, doc); + }, + get: function() { + return locationWrapper.get(this._document()); + } + }; + + function initObjects(options) { + options = $.extend({ + unescape: false + }, options || {}); + + locationWrapper.encoder = encoder(options.unescape); + + function encoder(unescape_) { + if(unescape_ === true) { + return function(hash){ return hash; }; + } + if(typeof unescape_ == "string" && + (unescape_ = partialDecoder(unescape_.split(""))) + || typeof unescape_ == "function") { + return function(hash) { return unescape_(encodeURIComponent(hash)); }; + } + return encodeURIComponent; + } + + function partialDecoder(chars) { + var re = new RegExp($.map(chars, encodeURIComponent).join("|"), "ig"); + return function(enc) { return enc.replace(re, decodeURIComponent); }; + } + } + + var implementations = {}; + + implementations.base = { + callback: undefined, + type: undefined, + + check: function() {}, + load: function(hash) {}, + init: function(callback, options) { + initObjects(options); + self.callback = callback; + self._options = options; + self._init(); + }, + + _init: function() {}, + _options: {} + }; + + implementations.timer = { + _appState: undefined, + _init: function() { + var current_hash = locationWrapper.get(); + self._appState = current_hash; + self.callback(current_hash); + setInterval(self.check, 100); + }, + check: function() { + var current_hash = locationWrapper.get(); + if(current_hash != self._appState) { + self._appState = current_hash; + self.callback(current_hash); + } + }, + load: function(hash) { + if(hash != self._appState) { + locationWrapper.put(hash); + self._appState = hash; + self.callback(hash); + } + } + }; + + implementations.iframeTimer = { + _appState: undefined, + _init: function() { + var current_hash = locationWrapper.get(); + self._appState = current_hash; + iframeWrapper.init().put(current_hash); + self.callback(current_hash); + setInterval(self.check, 100); + }, + check: function() { + var iframe_hash = iframeWrapper.get(), + location_hash = locationWrapper.get(); + + if (location_hash != iframe_hash) { + if (location_hash == self._appState) { // user used Back or Forward button + self._appState = iframe_hash; + locationWrapper.put(iframe_hash); + self.callback(iframe_hash); + } else { // user loaded new bookmark + self._appState = location_hash; + iframeWrapper.put(location_hash); + self.callback(location_hash); + } + } + }, + load: function(hash) { + if(hash != self._appState) { + locationWrapper.put(hash); + iframeWrapper.put(hash); + self._appState = hash; + self.callback(hash); + } + } + }; + + implementations.hashchangeEvent = { + _init: function() { + self.callback(locationWrapper.get()); + $(window).bind('hashchange', self.check); + }, + check: function() { + self.callback(locationWrapper.get()); + }, + load: function(hash) { + locationWrapper.put(hash); + } + }; + + var self = $.extend({}, implementations.base); + + if($.browser.msie && ($.browser.version < 8 || document.documentMode < 8)) { + self.type = 'iframeTimer'; + } else if("onhashchange" in window) { + self.type = 'hashchangeEvent'; + } else { + self.type = 'timer'; + } + + $.extend(self, implementations[self.type]); + $.history = self; +})(jQuery); diff --git a/addons/ConfigAssistant.pack/static/js/options.js b/addons/ConfigAssistant.pack/static/js/options.js index 117d1cbf1..53b4ae0e0 100644 --- a/addons/ConfigAssistant.pack/static/js/options.js +++ b/addons/ConfigAssistant.pack/static/js/options.js @@ -27,6 +27,10 @@ function handle_save_click() { function handle_delete_click() { $(this).parent().remove(); return false; }; +function handle_remove_file() { + $(this).parents('.field-content').find('.clear-file').val(1); + $(this).parent().remove(); return false; +}; function render_link_form(label,url) { var dom = '