- http://haineault.com
-
- MIT License (http://www.opensource.org/licenses/mit-license.php)
-
-*/
-
-(function($){
- $.extend($.fn, {
- delayedObserver: function(callback, delay, options){
- return this.each(function(){
- var el = $(this);
- var op = options || {};
- el.data('oldval', el.val())
- .data('delay', delay || 0.5)
- .data('condition', op.condition || function() { return ($(this).data('oldval') == $(this).val()); })
- .data('callback', callback)
- [(op.event||'keyup')](function(){
- if (el.data('condition').apply(el)) { return; }
- else {
- if (el.data('timer')) { clearTimeout(el.data('timer')); }
- el.data('timer', setTimeout(function(){
- el.data('callback').apply(el);
- }, el.data('delay') * 1000));
- el.data('oldval', el.val());
- }
- });
- });
- }
- });
-})(jQuery);
-/**
- * Flash (http://jquery.lukelutman.com/plugins/flash)
- * A jQuery plugin for embedding Flash movies.
- *
- * Version 1.0
- * November 9th, 2006
- *
- * Copyright (c) 2006 Luke Lutman (http://www.lukelutman.com)
- * Dual licensed under the MIT and GPL licenses.
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.opensource.org/licenses/gpl-license.php
- *
- * Inspired by:
- * SWFObject (http://blog.deconcept.com/swfobject/)
- * UFO (http://www.bobbyvandersluis.com/ufo/)
- * sIFR (http://www.mikeindustries.com/sifr/)
- *
- * IMPORTANT:
- * The packed version of jQuery breaks ActiveX control
- * activation in Internet Explorer. Use JSMin to minifiy
- * jQuery (see: http://jquery.lukelutman.com/plugins/flash#activex).
- *
- **/
-;(function(){
-
-var $$;
-
-/**
- *
- * @desc Replace matching elements with a flash movie.
- * @author Luke Lutman
- * @version 1.0.1
- *
- * @name flash
- * @param Hash htmlOptions Options for the embed/object tag.
- * @param Hash pluginOptions Options for detecting/updating the Flash plugin (optional).
- * @param Function replace Custom block called for each matched element if flash is installed (optional).
- * @param Function update Custom block called for each matched if flash isn't installed (optional).
- * @type jQuery
- *
- * @cat plugins/flash
- *
- * @example $('#hello').flash({ src: 'hello.swf' });
- * @desc Embed a Flash movie.
- *
- * @example $('#hello').flash({ src: 'hello.swf' }, { version: 8 });
- * @desc Embed a Flash 8 movie.
- *
- * @example $('#hello').flash({ src: 'hello.swf' }, { expressInstall: true });
- * @desc Embed a Flash movie using Express Install if flash isn't installed.
- *
- * @example $('#hello').flash({ src: 'hello.swf' }, { update: false });
- * @desc Embed a Flash movie, don't show an update message if Flash isn't installed.
- *
-**/
-$$ = jQuery.fn.flash = function(htmlOptions, pluginOptions, replace, update) {
-
- // Set the default block.
- var block = replace || $$.replace;
-
- // Merge the default and passed plugin options.
- pluginOptions = $$.copy($$.pluginOptions, pluginOptions);
-
- // Detect Flash.
- if(!$$.hasFlash(pluginOptions.version)) {
- // Use Express Install (if specified and Flash plugin 6,0,65 or higher is installed).
- if(pluginOptions.expressInstall && $$.hasFlash(6,0,65)) {
- // Add the necessary flashvars (merged later).
- var expressInstallOptions = {
- flashvars: {
- MMredirectURL: location,
- MMplayerType: 'PlugIn',
- MMdoctitle: jQuery('title').text()
- }
- };
- // Ask the user to update (if specified).
- } else if (pluginOptions.update) {
- // Change the block to insert the update message instead of the flash movie.
- block = update || $$.update;
- // Fail
- } else {
- // The required version of flash isn't installed.
- // Express Install is turned off, or flash 6,0,65 isn't installed.
- // Update is turned off.
- // Return without doing anything.
- return this;
- }
- }
-
- // Merge the default, express install and passed html options.
- htmlOptions = $$.copy($$.htmlOptions, expressInstallOptions, htmlOptions);
-
- // Invoke $block (with a copy of the merged html options) for each element.
- return this.each(function(){
- block.call(this, $$.copy(htmlOptions));
- });
-
-};
-/**
- *
- * @name flash.copy
- * @desc Copy an arbitrary number of objects into a new object.
- * @type Object
- *
- * @example $$.copy({ foo: 1 }, { bar: 2 });
- * @result { foo: 1, bar: 2 };
- *
-**/
-$$.copy = function() {
- var options = {}, flashvars = {};
- for(var i = 0; i < arguments.length; i++) {
- var arg = arguments[i];
- if(arg == undefined) continue;
- jQuery.extend(options, arg);
- // don't clobber one flash vars object with another
- // merge them instead
- if(arg.flashvars == undefined) continue;
- jQuery.extend(flashvars, arg.flashvars);
- }
- options.flashvars = flashvars;
- return options;
-};
-/*
- * @name flash.hasFlash
- * @desc Check if a specific version of the Flash plugin is installed
- * @type Boolean
- *
-**/
-$$.hasFlash = function() {
- // look for a flag in the query string to bypass flash detection
- if(/hasFlash\=true/.test(location)) return true;
- if(/hasFlash\=false/.test(location)) return false;
- var pv = $$.hasFlash.playerVersion().match(/\d+/g);
- var rv = String([arguments[0], arguments[1], arguments[2]]).match(/\d+/g) || String($$.pluginOptions.version).match(/\d+/g);
- for(var i = 0; i < 3; i++) {
- pv[i] = parseInt(pv[i] || 0);
- rv[i] = parseInt(rv[i] || 0);
- // player is less than required
- if(pv[i] < rv[i]) return false;
- // player is greater than required
- if(pv[i] > rv[i]) return true;
- }
- // major version, minor version and revision match exactly
- return true;
-};
-/**
- *
- * @name flash.hasFlash.playerVersion
- * @desc Get the version of the installed Flash plugin.
- * @type String
- *
-**/
-$$.hasFlash.playerVersion = function() {
- // ie
- try {
- try {
- // avoid fp6 minor version lookup issues
- // see: http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
- var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');
- try { axo.AllowScriptAccess = 'always'; }
- catch(e) { return '6,0,0'; }
- } catch(e) {}
- return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
- // other browsers
- } catch(e) {
- try {
- if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){
- return (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
- }
- } catch(e) {}
- }
- return '0,0,0';
-};
-/**
- *
- * @name flash.htmlOptions
- * @desc The default set of options for the object or embed tag.
- *
-**/
-$$.htmlOptions = {
- height: 240,
- flashvars: {},
- pluginspage: 'http://www.adobe.com/go/getflashplayer',
- src: '#',
- type: 'application/x-shockwave-flash',
- width: 320
-};
-/**
- *
- * @name flash.pluginOptions
- * @desc The default set of options for checking/updating the flash Plugin.
- *
-**/
-$$.pluginOptions = {
- expressInstall: false,
- update: true,
- version: '6.0.65'
-};
-/**
- *
- * @name flash.replace
- * @desc The default method for replacing an element with a Flash movie.
- *
-**/
-$$.replace = function(htmlOptions) {
- this.innerHTML = ''+this.innerHTML+'
';
- jQuery(this)
- .addClass('flash-replaced')
- .prepend($$.transform(htmlOptions));
-};
-/**
- *
- * @name flash.update
- * @desc The default method for replacing an element with an update message.
- *
-**/
-$$.update = function(htmlOptions) {
- var url = String(location).split('?');
- url.splice(1,0,'?hasFlash=true&');
- url = url.join('');
- var msg = 'This content requires the Flash Player. Download Flash Player. Already have Flash Player? Click here.
';
- this.innerHTML = ''+this.innerHTML+'';
- jQuery(this)
- .addClass('flash-update')
- .prepend(msg);
-};
-/**
- *
- * @desc Convert a hash of html options to a string of attributes, using Function.apply().
- * @example toAttributeString.apply(htmlOptions)
- * @result foo="bar" foo="bar"
- *
-**/
-function toAttributeString() {
- var s = '';
- for(var key in this)
- if(typeof this[key] != 'function')
- s += key+'="'+this[key]+'" ';
- return s;
-};
-/**
- *
- * @desc Convert a hash of flashvars to a url-encoded string, using Function.apply().
- * @example toFlashvarsString.apply(flashvarsObject)
- * @result foo=bar&foo=bar
- *
-**/
-function toFlashvarsString() {
- var s = '';
- for(var key in this)
- if(typeof this[key] != 'function')
- s += key+'='+encodeURIComponent(this[key])+'&';
- return s.replace(/&$/, '');
-};
-/**
- *
- * @name flash.transform
- * @desc Transform a set of html options into an embed tag.
- * @type String
- *
- * @example $$.transform(htmlOptions)
- * @result
- *
- * Note: The embed tag is NOT standards-compliant, but it
- * works in all current browsers. flash.transform can be
- * overwritten with a custom function to generate more
- * standards-compliant markup.
- *
-**/
-$$.transform = function(htmlOptions) {
- htmlOptions.toString = toAttributeString;
- if(htmlOptions.flashvars) htmlOptions.flashvars.toString = toFlashvarsString;
- return '';
-};
-
-/**
- *
- * Flash Player 9 Fix (http://blog.deconcept.com/2006/07/28/swfobject-143-released/)
- *
-**/
-if (window.attachEvent) {
- window.attachEvent("onbeforeunload", function(){
- __flash_unloadHandler = function() {};
- __flash_savedUnloadHandler = function() {};
- });
-}
-
-})();
-(function($){
- $._i18n = { trans: {}, 'default': 'en', language: 'en' };
- $.i18n = function() {
- var getTrans = function(ns, str) {
- var trans = false;
- // check if string exists in translation
- if ($._i18n.trans[$._i18n.language]
- && $._i18n.trans[$._i18n.language][ns]
- && $._i18n.trans[$._i18n.language][ns][str]) {
- trans = $._i18n.trans[$._i18n.language][ns][str];
- }
- // or exists in default
- else if ($._i18n.trans[$._i18n['default']]
- && $._i18n.trans[$._i18n['default']][ns]
- && $._i18n.trans[$._i18n['default']][ns][str]) {
- trans = $._i18n.trans[$._i18n['default']][ns][str];
- }
- // return trans or original string
- return trans || str;
- };
- // Set language (accepted formats: en or en-US)
- if (arguments.length < 2) {
- $._i18n.language = arguments[0];
- return $._i18n.language;
- }
- else {
- // get translation
- if (typeof(arguments[1]) == 'string') {
- var trans = getTrans(arguments[0], arguments[1]);
- // has variables for string formating
- if (arguments[2] && typeof(arguments[2]) == 'object') {
- return $.format(trans, arguments[2]);
- }
- else {
- return trans;
- }
- }
- // set translation
- else {
- var tmp = arguments[0].split('.');
- var lang = tmp[0];
- var ns = tmp[1] || 'jQuery';
- if (!$._i18n.trans[lang]) {
- $._i18n.trans[lang] = {};
- $._i18n.trans[lang][ns] = arguments[1];
- }
- else {
- $.extend($._i18n.trans[lang][ns], arguments[1]);
- }
- }
- }
- };
-})(jQuery);
-/*
- * Copyright (c) 2007-2008 Josh Bush (digitalbush.com)
- *
- * 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.
- */
-
-/*
- * Version: 1.1.3
- * Release: 2008-04-16
- */
-(function($) {
-
- //Helper Function for Caret positioning
- $.fn.caret=function(begin,end){
- if(this.length==0) return;
- if (typeof begin == 'number') {
- end = (typeof end == 'number')?end:begin;
- return this.each(function(){
- if(this.setSelectionRange){
- this.focus();
- this.setSelectionRange(begin,end);
- }else if (this.createTextRange){
- var range = this.createTextRange();
- range.collapse(true);
- range.moveEnd('character', end);
- range.moveStart('character', begin);
- range.select();
- }
- });
- } else {
- if (this[0].setSelectionRange){
- begin = this[0].selectionStart;
- end = this[0].selectionEnd;
- }else if (document.selection && document.selection.createRange){
- var range = document.selection.createRange();
- begin = 0 - range.duplicate().moveStart('character', -100000);
- end = begin + range.text.length;
- }
- return {begin:begin,end:end};
- }
- };
-
- //Predefined character definitions
- var charMap={
- '9':"[0-9]",
- 'a':"[A-Za-z]",
- '*':"[A-Za-z0-9]"
- };
-
- //Helper method to inject character definitions
- $.mask={
- addPlaceholder : function(c,r){
- charMap[c]=r;
- }
- };
-
- $.fn.unmask=function(){
- return this.trigger("unmask");
- };
-
- //Main Method
- $.fn.mask = function(mask,settings) {
- settings = $.extend({
- placeholder: "_",
- completed: null
- }, settings);
-
- //Build Regex for format validation
- var re = new RegExp("^"+
- $.map( mask.split(""), function(c,i){
- return charMap[c]||((/[A-Za-z0-9]/.test(c)?"":"\\")+c);
- }).join('')+
- "$");
-
- return this.each(function(){
- var input=$(this);
- var buffer=new Array(mask.length);
- var locked=new Array(mask.length);
- var valid=false;
- var ignore=false; //Variable for ignoring control keys
- var firstNonMaskPos=null;
-
- //Build buffer layout from mask & determine the first non masked character
- $.each( mask.split(""), function(i,c){
- locked[i]=(charMap[c]==null);
- buffer[i]=locked[i]?c:settings.placeholder;
- if(!locked[i] && firstNonMaskPos==null)
- firstNonMaskPos=i;
- });
-
- function focusEvent(){
- checkVal();
- writeBuffer();
- setTimeout(function(){
- $(input[0]).caret(valid?mask.length:firstNonMaskPos);
- },0);
- };
-
- function keydownEvent(e){
- var pos=$(this).caret();
- var k = e.keyCode;
- ignore=(k < 16 || (k > 16 && k < 32 ) || (k > 32 && k < 41));
-
- //delete selection before proceeding
- if((pos.begin-pos.end)!=0 && (!ignore || k==8 || k==46)){
- clearBuffer(pos.begin,pos.end);
- }
- //backspace and delete get special treatment
- if(k==8){//backspace
- while(pos.begin-->=0){
- if(!locked[pos.begin]){
- buffer[pos.begin]=settings.placeholder;
- if($.browser.opera){
- //Opera won't let you cancel the backspace, so we'll let it backspace over a dummy character.
- s=writeBuffer();
- input.val(s.substring(0,pos.begin)+" "+s.substring(pos.begin));
- $(this).caret(pos.begin+1);
- }else{
- writeBuffer();
- $(this).caret(Math.max(firstNonMaskPos,pos.begin));
- }
- return false;
- }
- }
- }else if(k==46){//delete
- clearBuffer(pos.begin,pos.begin+1);
- writeBuffer();
- $(this).caret(Math.max(firstNonMaskPos,pos.begin));
- return false;
- }else if (k==27){//escape
- clearBuffer(0,mask.length);
- writeBuffer();
- $(this).caret(firstNonMaskPos);
- return false;
- }
- };
-
- function keypressEvent(e){
- if(ignore){
- ignore=false;
- //Fixes Mac FF bug on backspace
- return (e.keyCode == 8)? false: null;
- }
- e=e||window.event;
- var k=e.charCode||e.keyCode||e.which;
- var pos=$(this).caret();
-
- if(e.ctrlKey || e.altKey){//Ignore
- return true;
- }else if ((k>=41 && k<=122) ||k==32 || k>186){//typeable characters
- var p=seekNext(pos.begin-1);
- if(p
+ http://haineault.com
+
+ MIT License (http://www.opensource.org/licenses/mit-license.php)
+
+*/
+
+(function($){
+ $.extend($.fn, {
+ delayedObserver: function(callback, delay, options){
+ return this.each(function(){
+ var el = $(this);
+ var op = options || {};
+ el.data('oldval', el.val())
+ .data('delay', delay || 0.5)
+ .data('condition', op.condition || function() { return ($(this).data('oldval') == $(this).val()); })
+ .data('callback', callback)
+ [(op.event||'keyup')](function(){
+ if (el.data('condition').apply(el)) { return; }
+ else {
+ if (el.data('timer')) { clearTimeout(el.data('timer')); }
+ el.data('timer', setTimeout(function(){
+ el.data('callback').apply(el);
+ }, el.data('delay') * 1000));
+ el.data('oldval', el.val());
+ }
+ });
+ });
+ }
+ });
+})(jQuery);
+/**
+ * Flash (http://jquery.lukelutman.com/plugins/flash)
+ * A jQuery plugin for embedding Flash movies.
+ *
+ * Version 1.0
+ * November 9th, 2006
+ *
+ * Copyright (c) 2006 Luke Lutman (http://www.lukelutman.com)
+ * Dual licensed under the MIT and GPL licenses.
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.opensource.org/licenses/gpl-license.php
+ *
+ * Inspired by:
+ * SWFObject (http://blog.deconcept.com/swfobject/)
+ * UFO (http://www.bobbyvandersluis.com/ufo/)
+ * sIFR (http://www.mikeindustries.com/sifr/)
+ *
+ * IMPORTANT:
+ * The packed version of jQuery breaks ActiveX control
+ * activation in Internet Explorer. Use JSMin to minifiy
+ * jQuery (see: http://jquery.lukelutman.com/plugins/flash#activex).
+ *
+ **/
+;(function(){
+
+var $$;
+
+/**
+ *
+ * @desc Replace matching elements with a flash movie.
+ * @author Luke Lutman
+ * @version 1.0.1
+ *
+ * @name flash
+ * @param Hash htmlOptions Options for the embed/object tag.
+ * @param Hash pluginOptions Options for detecting/updating the Flash plugin (optional).
+ * @param Function replace Custom block called for each matched element if flash is installed (optional).
+ * @param Function update Custom block called for each matched if flash isn't installed (optional).
+ * @type jQuery
+ *
+ * @cat plugins/flash
+ *
+ * @example $('#hello').flash({ src: 'hello.swf' });
+ * @desc Embed a Flash movie.
+ *
+ * @example $('#hello').flash({ src: 'hello.swf' }, { version: 8 });
+ * @desc Embed a Flash 8 movie.
+ *
+ * @example $('#hello').flash({ src: 'hello.swf' }, { expressInstall: true });
+ * @desc Embed a Flash movie using Express Install if flash isn't installed.
+ *
+ * @example $('#hello').flash({ src: 'hello.swf' }, { update: false });
+ * @desc Embed a Flash movie, don't show an update message if Flash isn't installed.
+ *
+**/
+$$ = jQuery.fn.flash = function(htmlOptions, pluginOptions, replace, update) {
+
+ // Set the default block.
+ var block = replace || $$.replace;
+
+ // Merge the default and passed plugin options.
+ pluginOptions = $$.copy($$.pluginOptions, pluginOptions);
+
+ // Detect Flash.
+ if(!$$.hasFlash(pluginOptions.version)) {
+ // Use Express Install (if specified and Flash plugin 6,0,65 or higher is installed).
+ if(pluginOptions.expressInstall && $$.hasFlash(6,0,65)) {
+ // Add the necessary flashvars (merged later).
+ var expressInstallOptions = {
+ flashvars: {
+ MMredirectURL: location,
+ MMplayerType: 'PlugIn',
+ MMdoctitle: jQuery('title').text()
+ }
+ };
+ // Ask the user to update (if specified).
+ } else if (pluginOptions.update) {
+ // Change the block to insert the update message instead of the flash movie.
+ block = update || $$.update;
+ // Fail
+ } else {
+ // The required version of flash isn't installed.
+ // Express Install is turned off, or flash 6,0,65 isn't installed.
+ // Update is turned off.
+ // Return without doing anything.
+ return this;
+ }
+ }
+
+ // Merge the default, express install and passed html options.
+ htmlOptions = $$.copy($$.htmlOptions, expressInstallOptions, htmlOptions);
+
+ // Invoke $block (with a copy of the merged html options) for each element.
+ return this.each(function(){
+ block.call(this, $$.copy(htmlOptions));
+ });
+
+};
+/**
+ *
+ * @name flash.copy
+ * @desc Copy an arbitrary number of objects into a new object.
+ * @type Object
+ *
+ * @example $$.copy({ foo: 1 }, { bar: 2 });
+ * @result { foo: 1, bar: 2 };
+ *
+**/
+$$.copy = function() {
+ var options = {}, flashvars = {};
+ for(var i = 0; i < arguments.length; i++) {
+ var arg = arguments[i];
+ if(arg == undefined) continue;
+ jQuery.extend(options, arg);
+ // don't clobber one flash vars object with another
+ // merge them instead
+ if(arg.flashvars == undefined) continue;
+ jQuery.extend(flashvars, arg.flashvars);
+ }
+ options.flashvars = flashvars;
+ return options;
+};
+/*
+ * @name flash.hasFlash
+ * @desc Check if a specific version of the Flash plugin is installed
+ * @type Boolean
+ *
+**/
+$$.hasFlash = function() {
+ // look for a flag in the query string to bypass flash detection
+ if(/hasFlash\=true/.test(location)) return true;
+ if(/hasFlash\=false/.test(location)) return false;
+ var pv = $$.hasFlash.playerVersion().match(/\d+/g);
+ var rv = String([arguments[0], arguments[1], arguments[2]]).match(/\d+/g) || String($$.pluginOptions.version).match(/\d+/g);
+ for(var i = 0; i < 3; i++) {
+ pv[i] = parseInt(pv[i] || 0);
+ rv[i] = parseInt(rv[i] || 0);
+ // player is less than required
+ if(pv[i] < rv[i]) return false;
+ // player is greater than required
+ if(pv[i] > rv[i]) return true;
+ }
+ // major version, minor version and revision match exactly
+ return true;
+};
+/**
+ *
+ * @name flash.hasFlash.playerVersion
+ * @desc Get the version of the installed Flash plugin.
+ * @type String
+ *
+**/
+$$.hasFlash.playerVersion = function() {
+ // ie
+ try {
+ try {
+ // avoid fp6 minor version lookup issues
+ // see: http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
+ var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');
+ try { axo.AllowScriptAccess = 'always'; }
+ catch(e) { return '6,0,0'; }
+ } catch(e) {}
+ return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
+ // other browsers
+ } catch(e) {
+ try {
+ if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){
+ return (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
+ }
+ } catch(e) {}
+ }
+ return '0,0,0';
+};
+/**
+ *
+ * @name flash.htmlOptions
+ * @desc The default set of options for the object or embed tag.
+ *
+**/
+$$.htmlOptions = {
+ height: 240,
+ flashvars: {},
+ pluginspage: 'http://www.adobe.com/go/getflashplayer',
+ src: '#',
+ type: 'application/x-shockwave-flash',
+ width: 320
+};
+/**
+ *
+ * @name flash.pluginOptions
+ * @desc The default set of options for checking/updating the flash Plugin.
+ *
+**/
+$$.pluginOptions = {
+ expressInstall: false,
+ update: true,
+ version: '6.0.65'
+};
+/**
+ *
+ * @name flash.replace
+ * @desc The default method for replacing an element with a Flash movie.
+ *
+**/
+$$.replace = function(htmlOptions) {
+ this.innerHTML = ''+this.innerHTML+'
';
+ jQuery(this)
+ .addClass('flash-replaced')
+ .prepend($$.transform(htmlOptions));
+};
+/**
+ *
+ * @name flash.update
+ * @desc The default method for replacing an element with an update message.
+ *
+**/
+$$.update = function(htmlOptions) {
+ var url = String(location).split('?');
+ url.splice(1,0,'?hasFlash=true&');
+ url = url.join('');
+ var msg = 'This content requires the Flash Player. Download Flash Player. Already have Flash Player? Click here.
';
+ this.innerHTML = ''+this.innerHTML+'';
+ jQuery(this)
+ .addClass('flash-update')
+ .prepend(msg);
+};
+/**
+ *
+ * @desc Convert a hash of html options to a string of attributes, using Function.apply().
+ * @example toAttributeString.apply(htmlOptions)
+ * @result foo="bar" foo="bar"
+ *
+**/
+function toAttributeString() {
+ var s = '';
+ for(var key in this)
+ if(typeof this[key] != 'function')
+ s += key+'="'+this[key]+'" ';
+ return s;
+};
+/**
+ *
+ * @desc Convert a hash of flashvars to a url-encoded string, using Function.apply().
+ * @example toFlashvarsString.apply(flashvarsObject)
+ * @result foo=bar&foo=bar
+ *
+**/
+function toFlashvarsString() {
+ var s = '';
+ for(var key in this)
+ if(typeof this[key] != 'function')
+ s += key+'='+encodeURIComponent(this[key])+'&';
+ return s.replace(/&$/, '');
+};
+/**
+ *
+ * @name flash.transform
+ * @desc Transform a set of html options into an embed tag.
+ * @type String
+ *
+ * @example $$.transform(htmlOptions)
+ * @result
+ *
+ * Note: The embed tag is NOT standards-compliant, but it
+ * works in all current browsers. flash.transform can be
+ * overwritten with a custom function to generate more
+ * standards-compliant markup.
+ *
+**/
+$$.transform = function(htmlOptions) {
+ htmlOptions.toString = toAttributeString;
+ if(htmlOptions.flashvars) htmlOptions.flashvars.toString = toFlashvarsString;
+ return '';
+};
+
+/**
+ *
+ * Flash Player 9 Fix (http://blog.deconcept.com/2006/07/28/swfobject-143-released/)
+ *
+**/
+if (window.attachEvent) {
+ window.attachEvent("onbeforeunload", function(){
+ __flash_unloadHandler = function() {};
+ __flash_savedUnloadHandler = function() {};
+ });
+}
+
+})();
+(function($){
+ $._i18n = { trans: {}, 'default': 'en', language: 'en' };
+ $.i18n = function() {
+ var getTrans = function(ns, str) {
+ var trans = false;
+ // check if string exists in translation
+ if ($._i18n.trans[$._i18n.language]
+ && $._i18n.trans[$._i18n.language][ns]
+ && $._i18n.trans[$._i18n.language][ns][str]) {
+ trans = $._i18n.trans[$._i18n.language][ns][str];
+ }
+ // or exists in default
+ else if ($._i18n.trans[$._i18n['default']]
+ && $._i18n.trans[$._i18n['default']][ns]
+ && $._i18n.trans[$._i18n['default']][ns][str]) {
+ trans = $._i18n.trans[$._i18n['default']][ns][str];
+ }
+ // return trans or original string
+ return trans || str;
+ };
+ // Set language (accepted formats: en or en-US)
+ if (arguments.length < 2) {
+ $._i18n.language = arguments[0];
+ return $._i18n.language;
+ }
+ else {
+ // get translation
+ if (typeof(arguments[1]) == 'string') {
+ var trans = getTrans(arguments[0], arguments[1]);
+ // has variables for string formating
+ if (arguments[2] && typeof(arguments[2]) == 'object') {
+ return $.format(trans, arguments[2]);
+ }
+ else {
+ return trans;
+ }
+ }
+ // set translation
+ else {
+ var tmp = arguments[0].split('.');
+ var lang = tmp[0];
+ var ns = tmp[1] || 'jQuery';
+ if (!$._i18n.trans[lang]) {
+ $._i18n.trans[lang] = {};
+ $._i18n.trans[lang][ns] = arguments[1];
+ }
+ else {
+ $.extend($._i18n.trans[lang][ns], arguments[1]);
+ }
+ }
+ }
+ };
+})(jQuery);
+/*
+ * Copyright (c) 2007-2008 Josh Bush (digitalbush.com)
+ *
+ * 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.
+ */
+
+/*
+ * Version: 1.1.3
+ * Release: 2008-04-16
+ */
+(function($) {
+
+ //Helper Function for Caret positioning
+ $.fn.caret=function(begin,end){
+ if(this.length==0) return;
+ if (typeof begin == 'number') {
+ end = (typeof end == 'number')?end:begin;
+ return this.each(function(){
+ if(this.setSelectionRange){
+ this.focus();
+ this.setSelectionRange(begin,end);
+ }else if (this.createTextRange){
+ var range = this.createTextRange();
+ range.collapse(true);
+ range.moveEnd('character', end);
+ range.moveStart('character', begin);
+ range.select();
+ }
+ });
+ } else {
+ if (this[0].setSelectionRange){
+ begin = this[0].selectionStart;
+ end = this[0].selectionEnd;
+ }else if (document.selection && document.selection.createRange){
+ var range = document.selection.createRange();
+ begin = 0 - range.duplicate().moveStart('character', -100000);
+ end = begin + range.text.length;
+ }
+ return {begin:begin,end:end};
+ }
+ };
+
+ //Predefined character definitions
+ var charMap={
+ '9':"[0-9]",
+ 'a':"[A-Za-z]",
+ '*':"[A-Za-z0-9]"
+ };
+
+ //Helper method to inject character definitions
+ $.mask={
+ addPlaceholder : function(c,r){
+ charMap[c]=r;
+ }
+ };
+
+ $.fn.unmask=function(){
+ return this.trigger("unmask");
+ };
+
+ //Main Method
+ $.fn.mask = function(mask,settings) {
+ settings = $.extend({
+ placeholder: "_",
+ completed: null
+ }, settings);
+
+ //Build Regex for format validation
+ var re = new RegExp("^"+
+ $.map( mask.split(""), function(c,i){
+ return charMap[c]||((/[A-Za-z0-9]/.test(c)?"":"\\")+c);
+ }).join('')+
+ "$");
+
+ return this.each(function(){
+ var input=$(this);
+ var buffer=new Array(mask.length);
+ var locked=new Array(mask.length);
+ var valid=false;
+ var ignore=false; //Variable for ignoring control keys
+ var firstNonMaskPos=null;
+
+ //Build buffer layout from mask & determine the first non masked character
+ $.each( mask.split(""), function(i,c){
+ locked[i]=(charMap[c]==null);
+ buffer[i]=locked[i]?c:settings.placeholder;
+ if(!locked[i] && firstNonMaskPos==null)
+ firstNonMaskPos=i;
+ });
+
+ function focusEvent(){
+ checkVal();
+ writeBuffer();
+ setTimeout(function(){
+ $(input[0]).caret(valid?mask.length:firstNonMaskPos);
+ },0);
+ };
+
+ function keydownEvent(e){
+ var pos=$(this).caret();
+ var k = e.keyCode;
+ ignore=(k < 16 || (k > 16 && k < 32 ) || (k > 32 && k < 41));
+
+ //delete selection before proceeding
+ if((pos.begin-pos.end)!=0 && (!ignore || k==8 || k==46)){
+ clearBuffer(pos.begin,pos.end);
+ }
+ //backspace and delete get special treatment
+ if(k==8){//backspace
+ while(pos.begin-->=0){
+ if(!locked[pos.begin]){
+ buffer[pos.begin]=settings.placeholder;
+ if($.browser.opera){
+ //Opera won't let you cancel the backspace, so we'll let it backspace over a dummy character.
+ s=writeBuffer();
+ input.val(s.substring(0,pos.begin)+" "+s.substring(pos.begin));
+ $(this).caret(pos.begin+1);
+ }else{
+ writeBuffer();
+ $(this).caret(Math.max(firstNonMaskPos,pos.begin));
+ }
+ return false;
+ }
+ }
+ }else if(k==46){//delete
+ clearBuffer(pos.begin,pos.begin+1);
+ writeBuffer();
+ $(this).caret(Math.max(firstNonMaskPos,pos.begin));
+ return false;
+ }else if (k==27){//escape
+ clearBuffer(0,mask.length);
+ writeBuffer();
+ $(this).caret(firstNonMaskPos);
+ return false;
+ }
+ };
+
+ function keypressEvent(e){
+ if(ignore){
+ ignore=false;
+ //Fixes Mac FF bug on backspace
+ return (e.keyCode == 8)? false: null;
+ }
+ e=e||window.event;
+ var k=e.charCode||e.keyCode||e.which;
+ var pos=$(this).caret();
+
+ if(e.ctrlKey || e.altKey){//Ignore
+ return true;
+ }else if ((k>=41 && k<=122) ||k==32 || k>186){//typeable characters
+ var p=seekNext(pos.begin-1);
+ if(p
@@ -2657,121 +2657,121 @@ $.fn.extend({
}
})(jQuery);
-/*
- * timeago: a jQuery plugin, version: 0.5.1 (08/20/2008)
- * @requires jQuery v1.2 or later
- *
- * Timeago is a jQuery plugin that makes it easy to support automatically
- * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago").
- *
- * For usage and examples, visit:
- * http://timeago.yarp.com/
- *
- * Licensed under the MIT:
- * http://www.opensource.org/licenses/mit-license.php
- *
- * Copyright (c) 2008, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org)
- */
-(function($) {
- $.timeago = function(timestamp) {
- if (timestamp instanceof Date) return inWords(timestamp);
- else if (typeof timestamp == "string") return inWords($.timeago.parse(timestamp));
- else return inWords($.timeago.parse($(timestamp).attr("title")));
- };
- var $t = $.timeago;
-
- $.extend($.timeago, {
- settings: {
- refreshMillis: 60000,
- allowFuture: false,
- strings: {
- ago: "ago",
- fromNow: "from now",
- seconds: "less than a minute",
- minute: "about a minute",
- minutes: "%d minutes",
- hour: "about an hour",
- hours: "about %d hours",
- day: "a day",
- days: "%d days",
- month: "about a month",
- months: "%d months",
- year: "about a year",
- years: "%d years"
- }
- },
- inWords: function(distanceMillis) {
- var $l = this.settings.strings;
- var suffix = $l.ago;
- if (this.settings.allowFuture) {
- if (distanceMillis < 0) suffix = $l.fromNow;
- distanceMillis = Math.abs(distanceMillis);
- }
-
- var seconds = distanceMillis / 1000;
- var minutes = seconds / 60;
- var hours = minutes / 60;
- var days = hours / 24;
- var years = days / 365;
-
- var words = seconds < 45 && sprintf($l.seconds, Math.round(seconds)) ||
- seconds < 90 && $l.minute ||
- minutes < 45 && sprintf($l.minutes, Math.round(minutes)) ||
- minutes < 90 && $l.hour ||
- hours < 24 && sprintf($l.hours, Math.round(hours)) ||
- hours < 48 && $l.day ||
- days < 30 && sprintf($l.days, Math.floor(days)) ||
- days < 60 && $l.month ||
- days < 365 && sprintf($l.months, Math.floor(days / 30)) ||
- years < 2 && $l.year ||
- sprintf($l.years, Math.floor(years));
-
- return words + " " + suffix;
- },
- parse: function(iso8601) {
- var s = $.trim(iso8601);
- s = s.replace(/-/,"/").replace(/-/,"/");
- s = s.replace(/T/," ").replace(/Z/," UTC");
- s = s.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400
- return new Date(s);
- }
- });
-
- $.fn.timeago = function() {
- var self = this;
- self.each(refresh);
-
- var $s = $t.settings;
- if ($s.refreshMillis > 0) {
- setInterval(function() { self.each(refresh); }, $s.refreshMillis);
- }
- return self;
- };
-
- function refresh() {
- var date = $t.parse(this.title);
- if (!isNaN(date)) {
- $(this).text(inWords(date));
- }
- return this;
- }
-
- function inWords(date) {
- return $t.inWords(distance(date));
- }
-
- function distance(date) {
- return (new Date().getTime() - date.getTime());
- }
-
- // lame sprintf implementation
- function sprintf(string, value) {
- return string.replace(/%d/i, value);
- }
-
- // fix for IE6 suckage
- if ($.browser.msie && $.browser.version < 7.0) {
- document.createElement('abbr');
- }
-})(jQuery);
-
+/*
+ * timeago: a jQuery plugin, version: 0.5.1 (08/20/2008)
+ * @requires jQuery v1.2 or later
+ *
+ * Timeago is a jQuery plugin that makes it easy to support automatically
+ * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago").
+ *
+ * For usage and examples, visit:
+ * http://timeago.yarp.com/
+ *
+ * Licensed under the MIT:
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ * Copyright (c) 2008, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org)
+ */
+(function($) {
+ $.timeago = function(timestamp) {
+ if (timestamp instanceof Date) return inWords(timestamp);
+ else if (typeof timestamp == "string") return inWords($.timeago.parse(timestamp));
+ else return inWords($.timeago.parse($(timestamp).attr("title")));
+ };
+ var $t = $.timeago;
+
+ $.extend($.timeago, {
+ settings: {
+ refreshMillis: 60000,
+ allowFuture: false,
+ strings: {
+ ago: "ago",
+ fromNow: "from now",
+ seconds: "less than a minute",
+ minute: "about a minute",
+ minutes: "%d minutes",
+ hour: "about an hour",
+ hours: "about %d hours",
+ day: "a day",
+ days: "%d days",
+ month: "about a month",
+ months: "%d months",
+ year: "about a year",
+ years: "%d years"
+ }
+ },
+ inWords: function(distanceMillis) {
+ var $l = this.settings.strings;
+ var suffix = $l.ago;
+ if (this.settings.allowFuture) {
+ if (distanceMillis < 0) suffix = $l.fromNow;
+ distanceMillis = Math.abs(distanceMillis);
+ }
+
+ var seconds = distanceMillis / 1000;
+ var minutes = seconds / 60;
+ var hours = minutes / 60;
+ var days = hours / 24;
+ var years = days / 365;
+
+ var words = seconds < 45 && sprintf($l.seconds, Math.round(seconds)) ||
+ seconds < 90 && $l.minute ||
+ minutes < 45 && sprintf($l.minutes, Math.round(minutes)) ||
+ minutes < 90 && $l.hour ||
+ hours < 24 && sprintf($l.hours, Math.round(hours)) ||
+ hours < 48 && $l.day ||
+ days < 30 && sprintf($l.days, Math.floor(days)) ||
+ days < 60 && $l.month ||
+ days < 365 && sprintf($l.months, Math.floor(days / 30)) ||
+ years < 2 && $l.year ||
+ sprintf($l.years, Math.floor(years));
+
+ return words + " " + suffix;
+ },
+ parse: function(iso8601) {
+ var s = $.trim(iso8601);
+ s = s.replace(/-/,"/").replace(/-/,"/");
+ s = s.replace(/T/," ").replace(/Z/," UTC");
+ s = s.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400
+ return new Date(s);
+ }
+ });
+
+ $.fn.timeago = function() {
+ var self = this;
+ self.each(refresh);
+
+ var $s = $t.settings;
+ if ($s.refreshMillis > 0) {
+ setInterval(function() { self.each(refresh); }, $s.refreshMillis);
+ }
+ return self;
+ };
+
+ function refresh() {
+ var date = $t.parse(this.title);
+ if (!isNaN(date)) {
+ $(this).text(inWords(date));
+ }
+ return this;
+ }
+
+ function inWords(date) {
+ return $t.inWords(distance(date));
+ }
+
+ function distance(date) {
+ return (new Date().getTime() - date.getTime());
+ }
+
+ // lame sprintf implementation
+ function sprintf(string, value) {
+ return string.replace(/%d/i, value);
+ }
+
+ // fix for IE6 suckage
+ if ($.browser.msie && $.browser.version < 7.0) {
+ document.createElement('abbr');
+ }
+})(jQuery);
+
diff --git a/lib/jquery-utils/ui.timepickr.js b/lib/jquery-utils/ui.timepickr.js
index 8aaf02f2b..ca0da3c1c 100644
--- a/lib/jquery-utils/ui.timepickr.js
+++ b/lib/jquery-utils/ui.timepickr.js
@@ -1,59 +1,59 @@
-/*
- jQuery ui.timepickr - @VERSION
- http://code.google.com/p/jquery-utils/
-
- (c) Maxime Haineault
- http://haineault.com
-
- MIT License (http://www.opensource.org/licenses/mit-license.php
-
- Note: if you want the original experimental plugin checkout the rev 224
-
- Dependencies
- ------------
- - jquery.utils.js
- - jquery.strings.js
- - jquery.ui.js
-
-*/
-
+/*
+ jQuery ui.timepickr - @VERSION
+ http://code.google.com/p/jquery-utils/
+
+ (c) Maxime Haineault
+ http://haineault.com
+
+ MIT License (http://www.opensource.org/licenses/mit-license.php
+
+ Note: if you want the original experimental plugin checkout the rev 224
+
+ Dependencies
+ ------------
+ - jquery.utils.js
+ - jquery.strings.js
+ - jquery.ui.js
+
+*/
+
(function($) {
$.tpl('timepickr.menu', ''); //todo: (heskew) make the corner an option just like the items
$.tpl('timepickr.row', '
');
$.tpl('timepickr.button', '{label:s}');
-
+
$.widget('ui.timepickr', {
- options: {
- convention: 12, // 24, 12
- trigger: 'focus',
- format12: '{h:02.d}:{m:02.d} {z}',
- format24: '{h:02.d}:{m:02.d}',
- hours: true,
- prefix: ['AM', 'PM'],
- suffix: ['AM', 'PM'],
- prefixVal: false,
- suffixVal: true,
- rangeHour12: $.range(1, 13),
- rangeHour24: [$.range(0, 12), $.range(12, 24)],
- rangeMin: $.range(0, 60, 15),
- rangeSec: $.range(0, 60, 15),
- corners: 'all',
- // plugins
- core: true,
- minutes: true,
- seconds: false,
- val: false,
- updateLive: true,
- resetOnBlur: true,
- keyboardnav: true,
- handle: false,
- handleEvent: 'click'
- },
+ options: {
+ convention: 12, // 24, 12
+ trigger: 'focus',
+ format12: '{h:02.d}:{m:02.d} {z}',
+ format24: '{h:02.d}:{m:02.d}',
+ hours: true,
+ prefix: ['AM', 'PM'],
+ suffix: ['AM', 'PM'],
+ prefixVal: false,
+ suffixVal: true,
+ rangeHour12: $.range(1, 13),
+ rangeHour24: [$.range(0, 12), $.range(12, 24)],
+ rangeMin: $.range(0, 60, 15),
+ rangeSec: $.range(0, 60, 15),
+ corners: 'all',
+ // plugins
+ core: true,
+ minutes: true,
+ seconds: false,
+ val: false,
+ updateLive: true,
+ resetOnBlur: true,
+ keyboardnav: true,
+ handle: false,
+ handleEvent: 'click'
+ },
plugins: {},
-
- _create: function() {
+
+ _create: function() {
this._dom = {
menu: $.tpl('timepickr.menu'),
row: $.tpl('timepickr.menu')
@@ -131,10 +131,10 @@
},
_formatVal: function(ival) {
- var val = ival || this._getVal();
-
- if (!val.h) return;
-
+ var val = ival || this._getVal();
+
+ if (!val.h) return;
+
val.c = this.options.convention;
val.f = val.c === 12 && this.options.format12 || this.options.format24;
return (new Time(val)).getTime();
@@ -384,4 +384,4 @@
}
};
-})(jQuery);
+})(jQuery);
diff --git a/src/Orchard.Azure/Orchard.Azure.CloudService/ServiceDefinition.csdef b/src/Orchard.Azure/Orchard.Azure.CloudService/ServiceDefinition.csdef
index 8f0eaaa8b..429b612ec 100644
--- a/src/Orchard.Azure/Orchard.Azure.CloudService/ServiceDefinition.csdef
+++ b/src/Orchard.Azure/Orchard.Azure.CloudService/ServiceDefinition.csdef
@@ -28,7 +28,7 @@
-
diff --git a/src/Orchard.Web/Core/Navigation/Controllers/AdminController.cs b/src/Orchard.Web/Core/Navigation/Controllers/AdminController.cs
index da5c05a9d..6ec840d85 100644
--- a/src/Orchard.Web/Core/Navigation/Controllers/AdminController.cs
+++ b/src/Orchard.Web/Core/Navigation/Controllers/AdminController.cs
@@ -154,7 +154,7 @@ namespace Orchard.Core.Navigation.Controllers {
ModelState.AddModelError(key, errorMessage.ToString());
}
- public ActionResult CreateMenuItem(string id, int menuId, string returnUrl, string parentMenuItemPosition = null) {
+ public ActionResult CreateMenuItem(string id, int menuId, string returnUrl, string parentMenuItemPosition = null) {
if (!Services.Authorizer.Authorize(Permissions.ManageMenus, _menuService.GetMenu(menuId), T("Couldn't manage the main menu")))
return new HttpUnauthorizedResult();
@@ -163,31 +163,31 @@ namespace Orchard.Core.Navigation.Controllers {
if (menuPart == null)
return HttpNotFound();
-
+
// load the menu
var menu = Services.ContentManager.Get(menuId);
if (menu == null)
return HttpNotFound();
-
- try {
- if (!String.IsNullOrEmpty(parentMenuItemPosition)) {
- var menuEntries = _menuService.GetMenuParts(menuId).Select(CreateMenuItemEntries);
- menuPart.MenuPosition = GetNextChildPosition(menuEntries, parentMenuItemPosition);
- }
- else {
- // filter the content items for this specific menu
- menuPart.MenuPosition = Position.GetNext(_navigationManager.BuildMenu(menu));
- }
-
+
+ try {
+ if (!String.IsNullOrEmpty(parentMenuItemPosition)) {
+ var menuEntries = _menuService.GetMenuParts(menuId).Select(CreateMenuItemEntries);
+ menuPart.MenuPosition = GetNextChildPosition(menuEntries, parentMenuItemPosition);
+ }
+ else {
+ // filter the content items for this specific menu
+ menuPart.MenuPosition = Position.GetNext(_navigationManager.BuildMenu(menu));
+ }
+
var model = Services.ContentManager.BuildEditor(menuPart);
-
+
return View(model);
}
catch (Exception exception) {
if (exception.IsFatal()) {
throw;
- }
+ }
Logger.Error(T("Creating menu item failed: {0}", exception.Message).Text);
Services.Notifier.Error(T("Creating menu item failed: {0}", exception.Message));
@@ -196,7 +196,7 @@ namespace Orchard.Core.Navigation.Controllers {
}
[HttpPost, ActionName("CreateMenuItem")]
- public ActionResult CreateMenuItemPost(string id, int menuId, string returnUrl, string parentMenuItemPosition = null) {
+ public ActionResult CreateMenuItemPost(string id, int menuId, string returnUrl, string parentMenuItemPosition = null) {
if (!Services.Authorizer.Authorize(Permissions.ManageMenus, _menuService.GetMenu(menuId), T("Couldn't manage the main menu")))
return new HttpUnauthorizedResult();
@@ -210,17 +210,17 @@ namespace Orchard.Core.Navigation.Controllers {
if (menu == null)
return HttpNotFound();
-
+
var model = Services.ContentManager.UpdateEditor(menuPart, this);
- if (!String.IsNullOrEmpty(parentMenuItemPosition)) {
- var menuEntries = _menuService.GetMenuParts(menuId).Select(CreateMenuItemEntries);
- menuPart.MenuPosition = GetNextChildPosition(menuEntries, parentMenuItemPosition);
- }
- else {
- menuPart.MenuPosition = Position.GetNext( _navigationManager.BuildMenu(menu));
- }
-
+ if (!String.IsNullOrEmpty(parentMenuItemPosition)) {
+ var menuEntries = _menuService.GetMenuParts(menuId).Select(CreateMenuItemEntries);
+ menuPart.MenuPosition = GetNextChildPosition(menuEntries, parentMenuItemPosition);
+ }
+ else {
+ menuPart.MenuPosition = Position.GetNext( _navigationManager.BuildMenu(menu));
+ }
+
menuPart.Menu = menu;
Services.ContentManager.Create(menuPart);
@@ -233,23 +233,23 @@ namespace Orchard.Core.Navigation.Controllers {
return this.RedirectLocal(returnUrl, () => RedirectToAction("Index"));
}
-
- private static string GetNextChildPosition(IEnumerable menuItems, string parentMenuItemPosition) {
- var parentMenuItemPositionPlusDot = parentMenuItemPosition + ".";
- var childElements = menuItems.Where(childElement => childElement.Position.StartsWith(parentMenuItemPositionPlusDot));
- if (childElements.Any()) {
- var result = childElements
- .Select(childElement => {
- var positionParts = childElement.Position.Substring(parentMenuItemPositionPlusDot.Length).Split(new[] { '.' }, 2, StringSplitOptions.RemoveEmptyEntries);
-
- return positionParts.Any() ? int.Parse(positionParts[0]) : 0;
- })
- .Max();
-
- return parentMenuItemPositionPlusDot + (result + 1);
- }
-
- return parentMenuItemPositionPlusDot + "1";
- }
+
+ private static string GetNextChildPosition(IEnumerable menuItems, string parentMenuItemPosition) {
+ var parentMenuItemPositionPlusDot = parentMenuItemPosition + ".";
+ var childElements = menuItems.Where(childElement => childElement.Position.StartsWith(parentMenuItemPositionPlusDot));
+ if (childElements.Any()) {
+ var result = childElements
+ .Select(childElement => {
+ var positionParts = childElement.Position.Substring(parentMenuItemPositionPlusDot.Length).Split(new[] { '.' }, 2, StringSplitOptions.RemoveEmptyEntries);
+
+ return positionParts.Any() ? int.Parse(positionParts[0]) : 0;
+ })
+ .Max();
+
+ return parentMenuItemPositionPlusDot + (result + 1);
+ }
+
+ return parentMenuItemPositionPlusDot + "1";
+ }
}
}
diff --git a/src/Orchard.Web/Core/Navigation/Scripts/navigation-admin.js b/src/Orchard.Web/Core/Navigation/Scripts/navigation-admin.js
index a90905408..46f350c22 100644
--- a/src/Orchard.Web/Core/Navigation/Scripts/navigation-admin.js
+++ b/src/Orchard.Web/Core/Navigation/Scripts/navigation-admin.js
@@ -52,27 +52,27 @@
}
});
- $(function () {
- $(".navigation-menu-item > div").on("click", function () {
- if ($(".navigation-menu-item > div.menu-item-selected").length) {
- if ($(this).hasClass("menu-item-selected")) {
- $(this).removeClass("menu-item-selected");
- }
- else {
- $(".navigation-menu-item > div").removeClass("menu-item-selected");
- $(this).addClass("menu-item-selected")
- }
- }
- else {
- $(this).addClass("menu-item-selected");
- }
- });
-
- $(".menu-item-actions > .button").on("click", function (e) {
- if ($(".navigation-menu-item > div.menu-item-selected").length) {
- e.originalEvent.currentTarget.href = $(this).attr("href") + "&parentMenuItemPosition=" + $(".navigation-menu-item > div.menu-item-selected > .navigation-position > input").val();
- }
- });
- });
+ $(function () {
+ $(".navigation-menu-item > div").on("click", function () {
+ if ($(".navigation-menu-item > div.menu-item-selected").length) {
+ if ($(this).hasClass("menu-item-selected")) {
+ $(this).removeClass("menu-item-selected");
+ }
+ else {
+ $(".navigation-menu-item > div").removeClass("menu-item-selected");
+ $(this).addClass("menu-item-selected")
+ }
+ }
+ else {
+ $(this).addClass("menu-item-selected");
+ }
+ });
+
+ $(".menu-item-actions > .button").on("click", function (e) {
+ if ($(".navigation-menu-item > div.menu-item-selected").length) {
+ e.originalEvent.currentTarget.href = $(this).attr("href") + "&parentMenuItemPosition=" + $(".navigation-menu-item > div.menu-item-selected > .navigation-position > input").val();
+ }
+ });
+ });
})(jQuery);
diff --git a/src/Orchard.Web/Core/Navigation/Styles/navigation-admin.css b/src/Orchard.Web/Core/Navigation/Styles/navigation-admin.css
index da095754e..74a7d5472 100644
--- a/src/Orchard.Web/Core/Navigation/Styles/navigation-admin.css
+++ b/src/Orchard.Web/Core/Navigation/Styles/navigation-admin.css
@@ -172,13 +172,13 @@
.dir-rtl div.menu-item-actions {
left:10px;
right: inherit;
- }
-
-.navigation-menu li div.menu-item-selected {
- background-color: #6a7b42;
- color: #fff;
-}
-
-.navigation-menu li div.menu-item-selected a {
- color: #edf9f5;
+ }
+
+.navigation-menu li div.menu-item-selected {
+ background-color: #6a7b42;
+ color: #fff;
+}
+
+.navigation-menu li div.menu-item-selected a {
+ color: #edf9f5;
}
\ No newline at end of file
diff --git a/src/Orchard.Web/Core/Navigation/Views/Admin/Index.cshtml b/src/Orchard.Web/Core/Navigation/Views/Admin/Index.cshtml
index 8841f4c23..2891f4a3c 100644
--- a/src/Orchard.Web/Core/Navigation/Views/Admin/Index.cshtml
+++ b/src/Orchard.Web/Core/Navigation/Views/Admin/Index.cshtml
@@ -46,8 +46,8 @@