diff --git a/admin/assets/css/um-admin-columns.css b/admin/assets/css/um-admin-columns.css index 6f0f02d7..5bac6216 100644 --- a/admin/assets/css/um-admin-columns.css +++ b/admin/assets/css/um-admin-columns.css @@ -3,7 +3,7 @@ -moz-osx-font-smoothing: grayscale; } -.um-admin.post-type-um_form .manage-column.column-id {width: 40px} +.um-admin.post-type-um_form .manage-column.column-id {width: 60px} .um-admin.post-type-um_form .manage-column.column-mode {width: 100px} .um-admin.post-type-um_form .manage-column.column-title {width: 200px} .um-admin.post-type-um_form .manage-column.column-shortcode {width: 200px} @@ -32,7 +32,7 @@ .um-admin.post-type-um_directory td.column-shortcode, .um-admin.post-type-um_directory td.column-id, .um-admin.post-type-um_role td.column-count -{color: #aaa;font-size: 14px;} +{font-size: 14px;} .um-admin.users-php td.column-um_actions {padding-top: 12px} diff --git a/admin/assets/css/um-admin-misc.css b/admin/assets/css/um-admin-misc.css index 48d22ab8..11e05f7d 100644 --- a/admin/assets/css/um-admin-misc.css +++ b/admin/assets/css/um-admin-misc.css @@ -1,5 +1,15 @@ /* - - Columns + - Welcome +*/ + +.um-badge { + color: #fff; + background: none !important; + background: #3ba1da url(../img/logo_small.png) no-repeat center 0px !important; +} + +/* + - General */ body.um-admin-modal-open { @@ -8,9 +18,6 @@ body.um-admin-modal-open { .um-admin #major-publishing-actions{background-color: #fff !important;border-top:0} -.um-admin .postbox h3 { -background: #f9f9f9; -} .um-admin .postbox h3 i { font-size: 1.3em !important; vertical-align: middle !important; diff --git a/admin/assets/img/logo.png b/admin/assets/img/logo.png new file mode 100644 index 00000000..98a578c7 Binary files /dev/null and b/admin/assets/img/logo.png differ diff --git a/admin/assets/img/logo_small.png b/admin/assets/img/logo_small.png new file mode 100644 index 00000000..43b514bf Binary files /dev/null and b/admin/assets/img/logo_small.png differ diff --git a/admin/core/lib/ReduxFramework/ReduxCore/framework.php b/admin/core/lib/ReduxFramework/ReduxCore/framework.php index dbae4d20..9614712b 100644 --- a/admin/core/lib/ReduxFramework/ReduxCore/framework.php +++ b/admin/core/lib/ReduxFramework/ReduxCore/framework.php @@ -1299,6 +1299,9 @@ * @return void */ public function _options_page() { + + $um_admin = new UM_Admin_API(); + $this->import_export->in_field(); if ( $this->args['menu_type'] == 'submenu' ) { @@ -1307,7 +1310,11 @@ add_menu_page( __('Ultimate Member', $this->slug), __('Ultimate Member', $this->slug), 'manage_options', $this->slug, array(&$this, 'admin_page'), 'dashicons-admin-users', '50.78578'); - add_submenu_page( '_welcome_to_um', __('Welcome to Ultimate Member!', $this->slug), __('Welcome to Ultimate Member!', $this->slug), 'manage_options', $this->slug . '-welcome', array(&$this, 'admin_page') ); + foreach( $um_admin->about_tabs as $k => $tab ) { + + add_submenu_page( '_'. $k . '_um', sprintf(__('%s | Ultimate Member', $this->slug), $tab), sprintf(__('%s | Ultimate Member', $this->slug), $tab), 'manage_options', $this->slug . '-' . $k, array(&$this, 'admin_page') ); + + } add_submenu_page( $this->slug, __('Dashboard', $this->slug), __('Dashboard', $this->slug), 'manage_options', $this->slug, array(&$this, 'admin_page') ); @@ -1321,11 +1328,11 @@ add_submenu_page( $this->slug, __('Forms', $this->slug), __('Forms', $this->slug), 'manage_options', 'edit.php?post_type=um_form', '', '' ); - add_submenu_page( $this->slug, __('Roles', $this->slug), __('Roles', $this->slug), 'manage_options', 'edit.php?post_type=um_role', '', '' ); + add_submenu_page( $this->slug, __('Member Levels', $this->slug), __('Member Levels', $this->slug), 'manage_options', 'edit.php?post_type=um_role', '', '' ); + + add_submenu_page( $this->slug, __('Member Directories', $this->slug), __('Member Directories', $this->slug), 'manage_options', 'edit.php?post_type=um_directory', '', '' ); add_submenu_page( $this->slug, __('Members', $this->slug), __('Members', $this->slug), 'manage_options', 'users.php', '', '' ); - - add_submenu_page( $this->slug, __('Directories', $this->slug), __('Directories', $this->slug), 'manage_options', 'edit.php?post_type=um_directory', '', '' ); } else { $this->page = add_menu_page( @@ -4311,11 +4318,26 @@ public function admin_page(){ + $um_admin = new UM_Admin_API(); + $page = $_REQUEST['page']; - if ( $page == 'ultimatemember') - + if ( $page == 'ultimatemember' ) { include_once um_path . 'admin/templates/dashboard.php'; + } + + if ( strstr( $page, 'ultimatemember-' ) ) { + + $template = str_replace('ultimatemember-','',$page); + $file = um_path . 'admin/templates/'. $template . '.php'; + + if ( file_exists( $file ) ){ + include_once um_path . 'admin/templates/'. $template . '.php'; + } else { + echo '

' . __('Please create a team.php template in admin templates.','ultimatemember') . '

'; + } + + } } diff --git a/admin/core/um-admin-columns.php b/admin/core/um-admin-columns.php index aecae9c3..596d72fc 100644 --- a/admin/core/um-admin-columns.php +++ b/admin/core/um-admin-columns.php @@ -22,10 +22,10 @@ class UM_Admin_Columns { $admin = new UM_Admin_Metabox(); $new_columns['cb'] = ''; - $new_columns['id'] = __('ID'); + $new_columns['id'] = __('ID') . $admin->_tooltip( 'Unique ID for each form' ); $new_columns['title'] = __('Title'); - $new_columns['mode'] = __('Type'); - $new_columns['shortcode'] = __('Shortcode') . $admin->_tooltip( 'Copy this shortcode to any post/page to display the relevant form' ); + $new_columns['mode'] = __('Type') . $admin->_tooltip( 'This is the type of the form' ); + $new_columns['shortcode'] = __('Shortcode') . $admin->_tooltip( 'Use this shortcode to display the form' ); $new_columns['impressions'] = __('Impressions') . $admin->_tooltip( 'The total number of times this form has been viewed' ); $new_columns['conversions'] = __('Conversions') . $admin->_tooltip( 'The total number of conversions. e.g. Successful sign-ups' ); $new_columns['date'] = __('Date'); @@ -33,6 +33,23 @@ class UM_Admin_Columns { return $new_columns; } + + /*** + *** @Custom columns for Directory + ***/ + function manage_edit_um_directory_columns($columns) { + + $admin = new UM_Admin_Metabox(); + + $new_columns['cb'] = ''; + $new_columns['id'] = __('ID') . $admin->_tooltip( 'Unique ID for each form' ); + $new_columns['title'] = __('Title'); + $new_columns['shortcode'] = __('Shortcode') . $admin->_tooltip( 'Use this shortcode to display the member directory' ); + $new_columns['date'] = __('Date'); + + return $new_columns; + + } /*** *** @Display cusom columns for Form @@ -75,18 +92,6 @@ class UM_Admin_Columns { } } - - /*** - *** @Custom columns for Directory - ***/ - function manage_edit_um_directory_columns($columns) { - $new_columns['cb'] = ''; - $new_columns['id'] = __('ID'); - $new_columns['title'] = __('Title'); - $new_columns['shortcode'] = __('Shortcode'); - $new_columns['date'] = __('Date'); - return $new_columns; - } /*** *** @Display cusom columns for Directory diff --git a/admin/core/um-admin-enqueue.php b/admin/core/um-admin-enqueue.php index c9e16b69..5b5d27ba 100644 --- a/admin/core/um-admin-enqueue.php +++ b/admin/core/um-admin-enqueue.php @@ -12,10 +12,25 @@ class UM_Admin_Enqueue { add_filter('admin_body_class', array(&$this, 'admin_body_class'), 9 ); - add_filter( 'enter_title_here', array(&$this, 'enter_title_here') ); + add_filter('enter_title_here', array(&$this, 'enter_title_here') ); + add_filter('admin_footer_text', array(&$this, 'admin_footer_text') ); + } + /*** + *** @Show footer text + ***/ + function admin_footer_text() { + $copyright = sprintf(__('Thank you for creating with Ultimate Member and WordPress.','ultimatemember')); + + if ( um_get_option('admin_load_time') == 1 ) { + $copyright .= '
' . sprintf(__('%1$s queries made in %2$s seconds','ultimatemember'), get_num_queries(), timer_stop(0) ); + } + + return '' . $copyright . ''; + } + /*** *** @enter title placeholder ***/ @@ -42,8 +57,8 @@ class UM_Admin_Enqueue { if ( strstr($screen_id, 'um_form') ) $highlighted_id = 3; if ( strstr($screen_id, 'um_role') ) $highlighted_id = 4; - if ( strstr($screen_id, 'um_directory') ) $highlighted_id = 6; - if ( strstr($screen_id, 'user') || strstr($screen_id, 'profile') ) $highlighted_id = 5; + if ( strstr($screen_id, 'um_directory') ) $highlighted_id = 5; + if ( strstr($screen_id, 'user') || strstr($screen_id, 'profile') ) $highlighted_id = 6; if ( isset($highlighted_id) ) { ?> diff --git a/admin/core/um-admin-notices.php b/admin/core/um-admin-notices.php index 3c47a5d7..20446390 100644 --- a/admin/core/um-admin-notices.php +++ b/admin/core/um-admin-notices.php @@ -5,9 +5,6 @@ class UM_Admin_Notices { function __construct() { add_action('admin_notices', array(&$this, 'admin_notices')); - - add_action('admin_notices', array(&$this, 'um_admin_notices')); - } /*** @@ -47,21 +44,4 @@ class UM_Admin_Notices { } - /*** - *** @For custom-styled notices - ***/ - function um_admin_notices() { - - $notices = get_option('um_admin_notices'); - if ( $notices ) { - - foreach($notices as $notice){ - echo "
-
$notice
-
"; - } - - } - } - } \ No newline at end of file diff --git a/admin/core/um-admin-redux.php b/admin/core/um-admin-redux.php index 3386a451..a9cee43a 100644 --- a/admin/core/um-admin-redux.php +++ b/admin/core/um-admin-redux.php @@ -61,7 +61,7 @@ 'google_api_key' => '', // Must be defined to add google fonts to the typography module 'async_typography' => true, // Use a asynchronous font on the front end or font string - 'admin_bar' => true, // Show the panel pages on the admin bar + 'admin_bar' => false, // Show the panel pages on the admin bar 'global_variable' => '', // Set a different name for your global variable other than the opt_name 'dev_mode' => false, // Show the time the page took to load, etc 'customizer' => false, // Enable basic customizer support diff --git a/admin/templates/about.php b/admin/templates/about.php new file mode 100644 index 00000000..9cb27749 --- /dev/null +++ b/admin/templates/about.php @@ -0,0 +1,99 @@ +
+ + + +
+

Introducing Twenty Fifteen

+ + +
+
+

Our newest default theme, Twenty Fifteen, is a blog-focused theme designed for clarity.

+

Twenty Fifteen has flawless language support, with help from Google’s Noto font family.

+

The straightforward typography is readable on any screen size.

+

Your content always takes center stage, whether viewed on a phone, tablet, laptop, or desktop computer.

+
+
+ +
+
+ +
+
+ +
+ +
+

Distraction-free writing

+
+
+ +
+

Just write.

+

Sometimes, you just need to concentrate on putting your thoughts into words. Try turning on distraction-free writing mode. When you start typing, all the distractions will fade away, letting you focus solely on your writing. All your editing tools instantly return when you need them.

+
+
+ +
+ +
+

The Finer Points

+ +
+
+

Choose a language

+

Right now, WordPress 4.1 is already translated into 40 languages, with more always in progress. You can switch to any translation on the General Settings screen.

+
+ +
+

Vine embeds

+

Embedding videos from Vine is as simple as pasting a URL onto its own line in a post. See the full list of supported embeds.

+
+ +
+

Log out everywhere

+

If you’ve ever worried you forgot to sign out from a shared computer, you can now go to your profile and log out everywhere.

+
+ +
+

Plugin recommendations

+

The plugin installer suggests plugins for you to try. Recommendations are based on the plugins you and other users have installed.

+
+ +
+ +
+ +
+ +
+

Under the Hood

+ +
+
+

Complex Queries

+

Metadata, date, and term queries now support advanced conditional logic, like nested clauses and multiple operators — A AND ( B OR C ).

+ +

Customizer API

+

Expanded JavaScript APIs in the customizer enable a new media experience as well as dynamic and contextual controls, sections, and panels.

+
+
+

<title> tags in themes

+

add_theme_support( 'title-tag' ) tells WordPress to handle the complexities of document titles.

+ +

Developer Reference

+

Continued improvements to inline code documentation have made the developer reference more complete than ever.

+
+
+ +
+ + + +
+ +
\ No newline at end of file diff --git a/admin/templates/about_header.php b/admin/templates/about_header.php new file mode 100644 index 00000000..97f0cbc7 --- /dev/null +++ b/admin/templates/about_header.php @@ -0,0 +1,24 @@ + +

Welcome to Ultimate Member

+ +
Thank you for installing! Ultimate Member is a powerful community and membership plugin that allows you to create beautiful community and membership sites with WordPress.
+ +
Version
+ + \ No newline at end of file diff --git a/admin/templates/start.php b/admin/templates/start.php new file mode 100644 index 00000000..edf8b46d --- /dev/null +++ b/admin/templates/start.php @@ -0,0 +1,99 @@ +
+ + + +
+

Introducing Twenty Fifteen

+ + +
+
+

Our newest default theme, Twenty Fifteen, is a blog-focused theme designed for clarity.

+

Twenty Fifteen has flawless language support, with help from Google’s Noto font family.

+

The straightforward typography is readable on any screen size.

+

Your content always takes center stage, whether viewed on a phone, tablet, laptop, or desktop computer.

+
+
+ +
+
+ +
+
+ +
+ +
+

Distraction-free writing

+
+
+ +
+

Just write.

+

Sometimes, you just need to concentrate on putting your thoughts into words. Try turning on distraction-free writing mode. When you start typing, all the distractions will fade away, letting you focus solely on your writing. All your editing tools instantly return when you need them.

+
+
+ +
+ +
+

The Finer Points

+ +
+
+

Choose a language

+

Right now, WordPress 4.1 is already translated into 40 languages, with more always in progress. You can switch to any translation on the General Settings screen.

+
+ +
+

Vine embeds

+

Embedding videos from Vine is as simple as pasting a URL onto its own line in a post. See the full list of supported embeds.

+
+ +
+

Log out everywhere

+

If you’ve ever worried you forgot to sign out from a shared computer, you can now go to your profile and log out everywhere.

+
+ +
+

Plugin recommendations

+

The plugin installer suggests plugins for you to try. Recommendations are based on the plugins you and other users have installed.

+
+ +
+ +
+ +
+ +
+

Under the Hood

+ +
+
+

Complex Queries

+

Metadata, date, and term queries now support advanced conditional logic, like nested clauses and multiple operators — A AND ( B OR C ).

+ +

Customizer API

+

Expanded JavaScript APIs in the customizer enable a new media experience as well as dynamic and contextual controls, sections, and panels.

+
+
+

<title> tags in themes

+

add_theme_support( 'title-tag' ) tells WordPress to handle the complexities of document titles.

+ +

Developer Reference

+

Continued improvements to inline code documentation have made the developer reference more complete than ever.

+
+
+ +
+ + + +
+ +
\ No newline at end of file diff --git a/admin/templates/welcome.php b/admin/templates/welcome.php deleted file mode 100644 index e69de29b..00000000 diff --git a/admin/um-admin-init.php b/admin/um-admin-init.php index 89e7daab..70295881 100644 --- a/admin/um-admin-init.php +++ b/admin/um-admin-init.php @@ -8,6 +8,17 @@ class UM_Admin_API { add_action('admin_init', array(&$this, 'admin_init'), 0); + if ( !class_exists( 'ReduxFramework' ) && file_exists( um_path . 'admin/core/lib/ReduxFramework/ReduxCore/framework.php' ) ) { + require_once( um_path . 'admin/core/lib/ReduxFramework/ReduxCore/framework.php' ); + } + if ( file_exists ( um_path . 'admin/core/um-admin-redux.php' ) ) { + require_once( um_path . 'admin/core/um-admin-redux.php' ); + } + + + $this->about_tabs['about'] = 'About'; + $this->about_tabs['start'] = 'Getting Started'; + } /*** diff --git a/assets/css/um-styles.css b/assets/css/um-styles.css index 1c8fcb33..b6bd28c7 100644 --- a/assets/css/um-styles.css +++ b/assets/css/um-styles.css @@ -26,6 +26,10 @@ box-sizing: content-box; } +.um a:focus { + outline: 0 !important; +} + /* only in admin mode */ .um.um-in-admin { padding-top: 0; diff --git a/assets/js/um-fileupload.js b/assets/js/um-fileupload.js index c5e82d85..9f02a168 100644 --- a/assets/js/um-fileupload.js +++ b/assets/js/um-fileupload.js @@ -5,4 +5,4 @@ * Copyright (c) 2013 Ravishanker Kusuma * http://hayageek.com/ */ -(function(b){if(b.fn.ajaxForm==undefined){b.getScript("http://malsup.github.io/jquery.form.js")}var a={};a.fileapi=b("").get(0).files!==undefined;a.formdata=window.FormData!==undefined;b.fn.uploadFile=function(t){var r=b.extend({url:"",method:"POST",enctype:"multipart/form-data",formData:null,returnType:null,allowedTypes:"*",fileName:"file",formData:{},dynamicFormData:function(){return{}},maxFileSize:-1,maxFileCount:-1,multiple:true,dragDrop:true,autoSubmit:true,showCancel:true,showAbort:true,showDone:true,showDelete:false,showError:true,showStatusAfterSuccess:true,showStatusAfterError:true,showFileCounter:true,fileCounterStyle:"). ",showProgress:false,onSelect:function(s){return true},onSubmit:function(s,u){},onSuccess:function(u,s,v){},onError:function(v,s,u){},deleteCallback:false,afterUploadAll:false,uploadButtonClass:"upload",dragDropStr:"",abortStr:"Abort",cancelStr:"Cancel",deletelStr:"Delete",doneStr:"Done",multiDragErrorStr:"Multiple File Drag & Drop is not allowed.",extErrorStr:"",sizeErrorStr:"",uploadErrorStr:"Upload is not allowed",maxFileCountErrorStr:""},t);this.fileCounter=1;this.selectedFiles=0;this.fCounter=0;this.sCounter=0;this.tCounter=0;var d="upload-"+(new Date().getTime());this.formGroup=d;this.hide();this.errorLog=b("
");this.after(this.errorLog);this.responses=[];if(!a.formdata){r.dragDrop=false}if(!a.formdata){r.multiple=false}var m=this;var e=b("
"+b(this).html()+"
");b(e).addClass(r.uploadButtonClass);(function k(){if(b.fn.ajaxForm){if(r.dragDrop){var s=b('
');b(m).before(s);b(s).append(e);b(s).prepend(b(r.dragDropStr));f(m,r,s)}else{b(m).before(e)}q(m,d,r,e)}else{window.setTimeout(k,10)}})();this.startUpload=function(){b("."+this.formGroup).each(function(u,s){if(b(this).is("form")){b(this).submit()}})};this.stopUpload=function(){b(".upload-red").each(function(u,s){if(b(this).hasClass(m.formGroup)){b(this).click()}})};this.getResponses=function(){return this.responses};var g=false;function j(){if(r.afterUploadAll&&!g){g=true;(function s(){if(m.sCounter!=0&&(m.sCounter+m.fCounter==m.tCounter)){r.afterUploadAll(m);g=false}else{window.setTimeout(s,100)}})()}}function f(w,u,v){v.on("dragenter",function(s){s.stopPropagation();s.preventDefault();b(this).css("border","3px dashed #ddd")});v.on("dragover",function(s){s.stopPropagation();s.preventDefault()});v.on("drop",function(x){b(this).css("border","3px dashed #ddd");x.preventDefault();w.errorLog.html("");var s=x.originalEvent.dataTransfer.files;if(!u.multiple&&s.length>1){if(u.showError){b("
"+u.multiDragErrorStr+"
").appendTo(w.errorLog)}return}if(u.onSelect(s)==false){return}l(u,w,s)});b(document).on("dragenter",function(s){s.stopPropagation();s.preventDefault()});b(document).on("dragover",function(s){s.stopPropagation();s.preventDefault();v.css("border","3px dashed #ddd")});b(document).on("drop",function(s){s.stopPropagation();s.preventDefault();v.css("border","3px dashed #ddd")})}function i(s){var v="";var u=s/1024;if(parseInt(u)>1024){var w=u/1024;v=w.toFixed(2)+" MB"}else{v=u.toFixed(2)+" KB"}return v}function o(x){var y=[];if(jQuery.type(x)=="string"){y=x.split("&")}else{y=b.param(x).split("&")}var u=y.length;var s=[];var w,v;for(w=0;w"+H.extErrorStr+"").appendTo(B.errorLog)}continue}if(H.maxFileSize!=-1&&u[C].size>H.maxFileSize){if(H.showError){b("
"+H.sizeErrorStr+"
").appendTo(B.errorLog)}continue}if(H.maxFileCount!=-1&&B.selectedFiles>=H.maxFileCount){if(H.showError){b("
"+H.maxFileCountErrorStr+"
").appendTo(B.errorLog)}continue}B.selectedFiles++;var D=H;var w=new FormData();var A=H.fileName.replace("[]","");w.append(A,u[C]);var y=H.formData;if(y){var F=o(y);for(var z=0;z");v.appendTo("body");var x=[];x.push(u[C].name);n(v,D,E,x,B);B.fileCounter++}}function c(w,v,y){var x=v.allowedTypes.toLowerCase().split(",");var u=y.split(".").pop().toLowerCase();if(v.allowedTypes!="*"&&jQuery.inArray(u,x)<0){return false}return true}function h(u,w){if(u.showFileCounter){var v=b(".upload-filename").length;w.fileCounter=v+1;b(".upload-filename").each(function(A,y){var s=b(this).html().split(u.fileCounterStyle);var x=parseInt(s[0])-1;var z=v+u.fileCounterStyle+s[1];b(this).html(z);v--})}}function q(y,B,D,u){var A="ajax-upload-id-"+(new Date().getTime());var w=b("
");var v="";if(D.multiple){if(D.fileName.indexOf("[]")!=D.fileName.length-2){D.fileName+="[]"}v=""}var z=b(v).appendTo(w);z.change(function(){y.errorLog.html("");var K=D.allowedTypes.toLowerCase().split(",");var G=[];if(this.files){for(H=0;H"+D.extErrorStr+"").appendTo(y.errorLog)}return}F.push({name:I,size:"NA"});if(D.onSelect(F)==false){return}}h(D,y);u.unbind("click");w.hide();q(y,B,D,u);w.addClass(B);if(a.fileapi&&a.formdata){w.removeClass(B);var J=this.files;l(D,y,J)}else{var E="";for(var H=0;H"}else{E+=G[H]+"
"}y.fileCounter++}if(D.maxFileCount!=-1&&(y.selectedFiles+G.length)>D.maxFileCount){if(D.showError){b("
"+D.maxFileCountErrorStr+"
").appendTo(y.errorLog)}return}y.selectedFiles+=G.length;var s=new p(y,D);s.filename.html(E);n(w,D,s,G,y)}});w.css({margin:0,padding:0});var C=b(u).width()+10;if(C==10){C=120}var x=u.height()+10;if(x==10){x=35}u.css({position:"relative",overflow:"hidden",cursor:"default"});z.css({position:"absolute",cursor:"pointer",top:"0px",width:'100%',height:'34px',left:"0px","z-index":"100",opacity:"0.0",filter:"alpha(opacity=0)","-ms-filter":"alpha(opacity=0)","-khtml-opacity":"0.0","-moz-opacity":"0.0"});w.appendTo(u)}function p(v,u){this.statusbar=b("
");this.filename=b("
").appendTo(this.statusbar);this.progressDiv=b("
").appendTo(this.statusbar).hide();this.progressbar=b("
").appendTo(this.progressDiv);this.abort=b("
"+u.abortStr+"
").appendTo(this.statusbar).hide();this.cancel=b("
"+u.cancelStr+"
").appendTo(this.statusbar).hide();this.done=b("
"+u.doneStr+"
").appendTo(this.statusbar).hide();this.del=b("
"+u.deletelStr+"
").appendTo(this.statusbar).hide();v.errorLog.after(this.statusbar);return this}function n(z,y,u,w,A){var x=null;var v={cache:false,contentType:false,processData:false,forceSync:false,data:y.formData,formData:y.fileData,dataType:y.returnType,beforeSubmit:function(F,C,E){if(y.onSubmit.call(this,w)!=false){var B=y.dynamicFormData();if(B){var s=o(B);if(s){for(var D=0;D"+y.uploadErrorStr+"
");u.cancel.show();z.remove();u.cancel.click(function(){u.statusbar.remove()});return false},beforeSend:function(B,s){u.progressDiv.show();u.cancel.hide();u.done.hide();if(y.showAbort){u.abort.show();u.abort.click(function(){B.abort();A.selectedFiles-=w.length})}if(!a.formdata){u.progressbar.width("5%")}else{u.progressbar.width("1%")}},uploadProgress:function(E,s,D,C){if(C>98){C=98}var B=C+"%";if(C>1){u.progressbar.width(B)}if(y.showProgress){u.progressbar.html(B);u.progressbar.css("text-align","center")}},success:function(B,s,C){A.responses.push(B);u.progressbar.width("100%");if(y.showProgress){u.progressbar.html("100%");u.progressbar.css("text-align","center")}u.abort.hide();y.onSuccess.call(this,w,B,C);if(y.showStatusAfterSuccess){if(y.showDone){u.done.show();u.done.click(function(){u.statusbar.hide("slow");u.statusbar.remove()})}else{u.done.hide()}if(y.showDelete){u.del.show();u.del.click(function(){u.statusbar.hide().remove();if(y.deleteCallback){y.deleteCallback.call(this,B,u)}A.selectedFiles-=w.length;h(y,A)})}else{u.del.hide()}}else{u.statusbar.hide("slow");u.statusbar.remove()}z.remove();A.sCounter+=w.length},error:function(C,s,B){u.abort.hide();if(C.statusText=="abort"){u.statusbar.hide("slow").remove();h(y,A)}else{y.onError.call(this,w,s,B);if(y.showStatusAfterError){u.progressDiv.hide();u.statusbar.append("ERROR: "+B+"")}else{u.statusbar.hide();u.statusbar.remove()}A.selectedFiles-=w.length}z.remove();A.fCounter+=w.length}};if(y.autoSubmit){z.ajaxSubmit(v)}else{if(y.showCancel){u.cancel.show();u.cancel.click(function(){z.remove();u.statusbar.remove();A.selectedFiles-=w.length;h(y,A)})}z.ajaxForm(v)}}return this}}(jQuery)); \ No newline at end of file +(function(b){if(b.fn.ajaxForm==undefined){}var a={};a.fileapi=b("").get(0).files!==undefined;a.formdata=window.FormData!==undefined;b.fn.uploadFile=function(t){var r=b.extend({url:"",method:"POST",enctype:"multipart/form-data",formData:null,returnType:null,allowedTypes:"*",fileName:"file",formData:{},dynamicFormData:function(){return{}},maxFileSize:-1,maxFileCount:-1,multiple:true,dragDrop:true,autoSubmit:true,showCancel:true,showAbort:true,showDone:true,showDelete:false,showError:true,showStatusAfterSuccess:true,showStatusAfterError:true,showFileCounter:true,fileCounterStyle:"). ",showProgress:false,onSelect:function(s){return true},onSubmit:function(s,u){},onSuccess:function(u,s,v){},onError:function(v,s,u){},deleteCallback:false,afterUploadAll:false,uploadButtonClass:"upload",dragDropStr:"",abortStr:"Abort",cancelStr:"Cancel",deletelStr:"Delete",doneStr:"Done",multiDragErrorStr:"Multiple File Drag & Drop is not allowed.",extErrorStr:"",sizeErrorStr:"",uploadErrorStr:"Upload is not allowed",maxFileCountErrorStr:""},t);this.fileCounter=1;this.selectedFiles=0;this.fCounter=0;this.sCounter=0;this.tCounter=0;var d="upload-"+(new Date().getTime());this.formGroup=d;this.hide();this.errorLog=b("
");this.after(this.errorLog);this.responses=[];if(!a.formdata){r.dragDrop=false}if(!a.formdata){r.multiple=false}var m=this;var e=b("
"+b(this).html()+"
");b(e).addClass(r.uploadButtonClass);(function k(){if(b.fn.ajaxForm){if(r.dragDrop){var s=b('
');b(m).before(s);b(s).append(e);b(s).prepend(b(r.dragDropStr));f(m,r,s)}else{b(m).before(e)}q(m,d,r,e)}else{window.setTimeout(k,10)}})();this.startUpload=function(){b("."+this.formGroup).each(function(u,s){if(b(this).is("form")){b(this).submit()}})};this.stopUpload=function(){b(".upload-red").each(function(u,s){if(b(this).hasClass(m.formGroup)){b(this).click()}})};this.getResponses=function(){return this.responses};var g=false;function j(){if(r.afterUploadAll&&!g){g=true;(function s(){if(m.sCounter!=0&&(m.sCounter+m.fCounter==m.tCounter)){r.afterUploadAll(m);g=false}else{window.setTimeout(s,100)}})()}}function f(w,u,v){v.on("dragenter",function(s){s.stopPropagation();s.preventDefault();b(this).css("border","3px dashed #ddd")});v.on("dragover",function(s){s.stopPropagation();s.preventDefault()});v.on("drop",function(x){b(this).css("border","3px dashed #ddd");x.preventDefault();w.errorLog.html("");var s=x.originalEvent.dataTransfer.files;if(!u.multiple&&s.length>1){if(u.showError){b("
"+u.multiDragErrorStr+"
").appendTo(w.errorLog)}return}if(u.onSelect(s)==false){return}l(u,w,s)});b(document).on("dragenter",function(s){s.stopPropagation();s.preventDefault()});b(document).on("dragover",function(s){s.stopPropagation();s.preventDefault();v.css("border","3px dashed #ddd")});b(document).on("drop",function(s){s.stopPropagation();s.preventDefault();v.css("border","3px dashed #ddd")})}function i(s){var v="";var u=s/1024;if(parseInt(u)>1024){var w=u/1024;v=w.toFixed(2)+" MB"}else{v=u.toFixed(2)+" KB"}return v}function o(x){var y=[];if(jQuery.type(x)=="string"){y=x.split("&")}else{y=b.param(x).split("&")}var u=y.length;var s=[];var w,v;for(w=0;w"+H.extErrorStr+"").appendTo(B.errorLog)}continue}if(H.maxFileSize!=-1&&u[C].size>H.maxFileSize){if(H.showError){b("
"+H.sizeErrorStr+"
").appendTo(B.errorLog)}continue}if(H.maxFileCount!=-1&&B.selectedFiles>=H.maxFileCount){if(H.showError){b("
"+H.maxFileCountErrorStr+"
").appendTo(B.errorLog)}continue}B.selectedFiles++;var D=H;var w=new FormData();var A=H.fileName.replace("[]","");w.append(A,u[C]);var y=H.formData;if(y){var F=o(y);for(var z=0;z");v.appendTo("body");var x=[];x.push(u[C].name);n(v,D,E,x,B);B.fileCounter++}}function c(w,v,y){var x=v.allowedTypes.toLowerCase().split(",");var u=y.split(".").pop().toLowerCase();if(v.allowedTypes!="*"&&jQuery.inArray(u,x)<0){return false}return true}function h(u,w){if(u.showFileCounter){var v=b(".upload-filename").length;w.fileCounter=v+1;b(".upload-filename").each(function(A,y){var s=b(this).html().split(u.fileCounterStyle);var x=parseInt(s[0])-1;var z=v+u.fileCounterStyle+s[1];b(this).html(z);v--})}}function q(y,B,D,u){var A="ajax-upload-id-"+(new Date().getTime());var w=b("
");var v="";if(D.multiple){if(D.fileName.indexOf("[]")!=D.fileName.length-2){D.fileName+="[]"}v=""}var z=b(v).appendTo(w);z.change(function(){y.errorLog.html("");var K=D.allowedTypes.toLowerCase().split(",");var G=[];if(this.files){for(H=0;H"+D.extErrorStr+"").appendTo(y.errorLog)}return}F.push({name:I,size:"NA"});if(D.onSelect(F)==false){return}}h(D,y);u.unbind("click");w.hide();q(y,B,D,u);w.addClass(B);if(a.fileapi&&a.formdata){w.removeClass(B);var J=this.files;l(D,y,J)}else{var E="";for(var H=0;H"}else{E+=G[H]+"
"}y.fileCounter++}if(D.maxFileCount!=-1&&(y.selectedFiles+G.length)>D.maxFileCount){if(D.showError){b("
"+D.maxFileCountErrorStr+"
").appendTo(y.errorLog)}return}y.selectedFiles+=G.length;var s=new p(y,D);s.filename.html(E);n(w,D,s,G,y)}});w.css({margin:0,padding:0});var C=b(u).width()+10;if(C==10){C=120}var x=u.height()+10;if(x==10){x=35}u.css({position:"relative",overflow:"hidden",cursor:"default"});z.css({position:"absolute",cursor:"pointer",top:"0px",width:'100%',height:'34px',left:"0px","z-index":"100",opacity:"0.0",filter:"alpha(opacity=0)","-ms-filter":"alpha(opacity=0)","-khtml-opacity":"0.0","-moz-opacity":"0.0"});w.appendTo(u)}function p(v,u){this.statusbar=b("
");this.filename=b("
").appendTo(this.statusbar);this.progressDiv=b("
").appendTo(this.statusbar).hide();this.progressbar=b("
").appendTo(this.progressDiv);this.abort=b("
"+u.abortStr+"
").appendTo(this.statusbar).hide();this.cancel=b("
"+u.cancelStr+"
").appendTo(this.statusbar).hide();this.done=b("
"+u.doneStr+"
").appendTo(this.statusbar).hide();this.del=b("
"+u.deletelStr+"
").appendTo(this.statusbar).hide();v.errorLog.after(this.statusbar);return this}function n(z,y,u,w,A){var x=null;var v={cache:false,contentType:false,processData:false,forceSync:false,data:y.formData,formData:y.fileData,dataType:y.returnType,beforeSubmit:function(F,C,E){if(y.onSubmit.call(this,w)!=false){var B=y.dynamicFormData();if(B){var s=o(B);if(s){for(var D=0;D"+y.uploadErrorStr+"
");u.cancel.show();z.remove();u.cancel.click(function(){u.statusbar.remove()});return false},beforeSend:function(B,s){u.progressDiv.show();u.cancel.hide();u.done.hide();if(y.showAbort){u.abort.show();u.abort.click(function(){B.abort();A.selectedFiles-=w.length})}if(!a.formdata){u.progressbar.width("5%")}else{u.progressbar.width("1%")}},uploadProgress:function(E,s,D,C){if(C>98){C=98}var B=C+"%";if(C>1){u.progressbar.width(B)}if(y.showProgress){u.progressbar.html(B);u.progressbar.css("text-align","center")}},success:function(B,s,C){A.responses.push(B);u.progressbar.width("100%");if(y.showProgress){u.progressbar.html("100%");u.progressbar.css("text-align","center")}u.abort.hide();y.onSuccess.call(this,w,B,C);if(y.showStatusAfterSuccess){if(y.showDone){u.done.show();u.done.click(function(){u.statusbar.hide("slow");u.statusbar.remove()})}else{u.done.hide()}if(y.showDelete){u.del.show();u.del.click(function(){u.statusbar.hide().remove();if(y.deleteCallback){y.deleteCallback.call(this,B,u)}A.selectedFiles-=w.length;h(y,A)})}else{u.del.hide()}}else{u.statusbar.hide("slow");u.statusbar.remove()}z.remove();A.sCounter+=w.length},error:function(C,s,B){u.abort.hide();if(C.statusText=="abort"){u.statusbar.hide("slow").remove();h(y,A)}else{y.onError.call(this,w,s,B);if(y.showStatusAfterError){u.progressDiv.hide();u.statusbar.append("ERROR: "+B+"")}else{u.statusbar.hide();u.statusbar.remove()}A.selectedFiles-=w.length}z.remove();A.fCounter+=w.length}};if(y.autoSubmit){z.ajaxSubmit(v)}else{if(y.showCancel){u.cancel.show();u.cancel.click(function(){z.remove();u.statusbar.remove();A.selectedFiles-=w.length;h(y,A)})}z.ajaxForm(v)}}return this}}(jQuery)); \ No newline at end of file diff --git a/assets/js/um-jquery-form.js b/assets/js/um-jquery-form.js new file mode 100644 index 00000000..591ad6f1 --- /dev/null +++ b/assets/js/um-jquery-form.js @@ -0,0 +1,1277 @@ +/*! + * jQuery Form Plugin + * version: 3.51.0-2014.06.20 + * Requires jQuery v1.5 or later + * Copyright (c) 2014 M. Alsup + * Examples and documentation at: http://malsup.com/jquery/form/ + * Project repository: https://github.com/malsup/form + * Dual licensed under the MIT and GPL licenses. + * https://github.com/malsup/form#copyright-and-license + */ +/*global ActiveXObject */ + +// AMD support +(function (factory) { + "use strict"; + if (typeof define === 'function' && define.amd) { + // using AMD; register as anon module + define(['jquery'], factory); + } else { + // no AMD; invoke directly + factory( (typeof(jQuery) != 'undefined') ? jQuery : window.Zepto ); + } +} + +(function($) { +"use strict"; + +/* + Usage Note: + ----------- + Do not use both ajaxSubmit and ajaxForm on the same form. These + functions are mutually exclusive. Use ajaxSubmit if you want + to bind your own submit handler to the form. For example, + + $(document).ready(function() { + $('#myForm').on('submit', function(e) { + e.preventDefault(); // <-- important + $(this).ajaxSubmit({ + target: '#output' + }); + }); + }); + + Use ajaxForm when you want the plugin to manage all the event binding + for you. For example, + + $(document).ready(function() { + $('#myForm').ajaxForm({ + target: '#output' + }); + }); + + You can also use ajaxForm with delegation (requires jQuery v1.7+), so the + form does not have to exist when you invoke ajaxForm: + + $('#myForm').ajaxForm({ + delegation: true, + target: '#output' + }); + + When using ajaxForm, the ajaxSubmit function will be invoked for you + at the appropriate time. +*/ + +/** + * Feature detection + */ +var feature = {}; +feature.fileapi = $("").get(0).files !== undefined; +feature.formdata = window.FormData !== undefined; + +var hasProp = !!$.fn.prop; + +// attr2 uses prop when it can but checks the return type for +// an expected string. this accounts for the case where a form +// contains inputs with names like "action" or "method"; in those +// cases "prop" returns the element +$.fn.attr2 = function() { + if ( ! hasProp ) { + return this.attr.apply(this, arguments); + } + var val = this.prop.apply(this, arguments); + if ( ( val && val.jquery ) || typeof val === 'string' ) { + return val; + } + return this.attr.apply(this, arguments); +}; + +/** + * ajaxSubmit() provides a mechanism for immediately submitting + * an HTML form using AJAX. + */ +$.fn.ajaxSubmit = function(options) { + /*jshint scripturl:true */ + + // fast fail if nothing selected (http://dev.jquery.com/ticket/2752) + if (!this.length) { + log('ajaxSubmit: skipping submit process - no element selected'); + return this; + } + + var method, action, url, $form = this; + + if (typeof options == 'function') { + options = { success: options }; + } + else if ( options === undefined ) { + options = {}; + } + + method = options.type || this.attr2('method'); + action = options.url || this.attr2('action'); + + url = (typeof action === 'string') ? $.trim(action) : ''; + url = url || window.location.href || ''; + if (url) { + // clean url (don't include hash vaue) + url = (url.match(/^([^#]+)/)||[])[1]; + } + + options = $.extend(true, { + url: url, + success: $.ajaxSettings.success, + type: method || $.ajaxSettings.type, + iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank' + }, options); + + // hook for manipulating the form data before it is extracted; + // convenient for use with rich editors like tinyMCE or FCKEditor + var veto = {}; + this.trigger('form-pre-serialize', [this, options, veto]); + if (veto.veto) { + log('ajaxSubmit: submit vetoed via form-pre-serialize trigger'); + return this; + } + + // provide opportunity to alter form data before it is serialized + if (options.beforeSerialize && options.beforeSerialize(this, options) === false) { + log('ajaxSubmit: submit aborted via beforeSerialize callback'); + return this; + } + + var traditional = options.traditional; + if ( traditional === undefined ) { + traditional = $.ajaxSettings.traditional; + } + + var elements = []; + var qx, a = this.formToArray(options.semantic, elements); + if (options.data) { + options.extraData = options.data; + qx = $.param(options.data, traditional); + } + + // give pre-submit callback an opportunity to abort the submit + if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) { + log('ajaxSubmit: submit aborted via beforeSubmit callback'); + return this; + } + + // fire vetoable 'validate' event + this.trigger('form-submit-validate', [a, this, options, veto]); + if (veto.veto) { + log('ajaxSubmit: submit vetoed via form-submit-validate trigger'); + return this; + } + + var q = $.param(a, traditional); + if (qx) { + q = ( q ? (q + '&' + qx) : qx ); + } + if (options.type.toUpperCase() == 'GET') { + options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q; + options.data = null; // data is null for 'get' + } + else { + options.data = q; // data is the query string for 'post' + } + + var callbacks = []; + if (options.resetForm) { + callbacks.push(function() { $form.resetForm(); }); + } + if (options.clearForm) { + callbacks.push(function() { $form.clearForm(options.includeHidden); }); + } + + // perform a load on the target only if dataType is not provided + if (!options.dataType && options.target) { + var oldSuccess = options.success || function(){}; + callbacks.push(function(data) { + var fn = options.replaceTarget ? 'replaceWith' : 'html'; + $(options.target)[fn](data).each(oldSuccess, arguments); + }); + } + else if (options.success) { + callbacks.push(options.success); + } + + options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg + var context = options.context || this ; // jQuery 1.4+ supports scope context + for (var i=0, max=callbacks.length; i < max; i++) { + callbacks[i].apply(context, [data, status, xhr || $form, $form]); + } + }; + + if (options.error) { + var oldError = options.error; + options.error = function(xhr, status, error) { + var context = options.context || this; + oldError.apply(context, [xhr, status, error, $form]); + }; + } + + if (options.complete) { + var oldComplete = options.complete; + options.complete = function(xhr, status) { + var context = options.context || this; + oldComplete.apply(context, [xhr, status, $form]); + }; + } + + // are there files to upload? + + // [value] (issue #113), also see comment: + // https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219 + var fileInputs = $('input[type=file]:enabled', this).filter(function() { return $(this).val() !== ''; }); + + var hasFileInputs = fileInputs.length > 0; + var mp = 'multipart/form-data'; + var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp); + + var fileAPI = feature.fileapi && feature.formdata; + log("fileAPI :" + fileAPI); + var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI; + + var jqxhr; + + // options.iframe allows user to force iframe mode + // 06-NOV-09: now defaulting to iframe mode if file input is detected + if (options.iframe !== false && (options.iframe || shouldUseFrame)) { + // hack to fix Safari hang (thanks to Tim Molendijk for this) + // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d + if (options.closeKeepAlive) { + $.get(options.closeKeepAlive, function() { + jqxhr = fileUploadIframe(a); + }); + } + else { + jqxhr = fileUploadIframe(a); + } + } + else if ((hasFileInputs || multipart) && fileAPI) { + jqxhr = fileUploadXhr(a); + } + else { + jqxhr = $.ajax(options); + } + + $form.removeData('jqxhr').data('jqxhr', jqxhr); + + // clear element array + for (var k=0; k < elements.length; k++) { + elements[k] = null; + } + + // fire 'notify' event + this.trigger('form-submit-notify', [this, options]); + return this; + + // utility fn for deep serialization + function deepSerialize(extraData){ + var serialized = $.param(extraData, options.traditional).split('&'); + var len = serialized.length; + var result = []; + var i, part; + for (i=0; i < len; i++) { + // #252; undo param space replacement + serialized[i] = serialized[i].replace(/\+/g,' '); + part = serialized[i].split('='); + // #278; use array instead of object storage, favoring array serializations + result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]); + } + return result; + } + + // XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz) + function fileUploadXhr(a) { + var formdata = new FormData(); + + for (var i=0; i < a.length; i++) { + formdata.append(a[i].name, a[i].value); + } + + if (options.extraData) { + var serializedData = deepSerialize(options.extraData); + for (i=0; i < serializedData.length; i++) { + if (serializedData[i]) { + formdata.append(serializedData[i][0], serializedData[i][1]); + } + } + } + + options.data = null; + + var s = $.extend(true, {}, $.ajaxSettings, options, { + contentType: false, + processData: false, + cache: false, + type: method || 'POST' + }); + + if (options.uploadProgress) { + // workaround because jqXHR does not expose upload property + s.xhr = function() { + var xhr = $.ajaxSettings.xhr(); + if (xhr.upload) { + xhr.upload.addEventListener('progress', function(event) { + var percent = 0; + var position = event.loaded || event.position; /*event.position is deprecated*/ + var total = event.total; + if (event.lengthComputable) { + percent = Math.ceil(position / total * 100); + } + options.uploadProgress(event, position, total, percent); + }, false); + } + return xhr; + }; + } + + s.data = null; + var beforeSend = s.beforeSend; + s.beforeSend = function(xhr, o) { + //Send FormData() provided by user + if (options.formData) { + o.data = options.formData; + } + else { + o.data = formdata; + } + if(beforeSend) { + beforeSend.call(this, xhr, o); + } + }; + return $.ajax(s); + } + + // private function for handling file uploads (hat tip to YAHOO!) + function fileUploadIframe(a) { + var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle; + var deferred = $.Deferred(); + + // #341 + deferred.abort = function(status) { + xhr.abort(status); + }; + + if (a) { + // ensure that every serialized input is still enabled + for (i=0; i < elements.length; i++) { + el = $(elements[i]); + if ( hasProp ) { + el.prop('disabled', false); + } + else { + el.removeAttr('disabled'); + } + } + } + + s = $.extend(true, {}, $.ajaxSettings, options); + s.context = s.context || s; + id = 'jqFormIO' + (new Date().getTime()); + if (s.iframeTarget) { + $io = $(s.iframeTarget); + n = $io.attr2('name'); + if (!n) { + $io.attr2('name', id); + } + else { + id = n; + } + } + else { + $io = $('