Kaynağa Gözat

Merge pull request #208 from emanuele45/master

various fixes
emanuele45 12 yıl önce
ebeveyn
işleme
405ca4a6f9

+ 6 - 6
Sources/Attachments.php

@@ -117,17 +117,17 @@ function automanage_attachments_create_directory($updir)
 {
 	global $modSettings, $initial_error, $context, $boarddir;
 
-	$tree = mama_get_directory_tree_elements($updir);
+	$tree = get_directory_tree_elements($updir);
 	$count = count($tree);
 
-	$directory = mama_init_dir($tree, $count);
+	$directory = attachments_init_dir($tree, $count);
 	if ($directory === false)
 	{
 		// Maybe it's just the folder name
-		$tree = mama_get_directory_tree_elements($boarddir . DIRECTORY_SEPARATOR . $updir);
+		$tree = get_directory_tree_elements($boarddir . DIRECTORY_SEPARATOR . $updir);
 		$count = count($tree);
 	
-		$directory = mama_init_dir($tree, $count);
+		$directory = attachments_init_dir($tree, $count);
 		if ($directory === false)
 			return false;
 	}
@@ -234,7 +234,7 @@ function automanage_attachments_by_space()
 		return false;
 }
 
-function mama_get_directory_tree_elements ($directory)
+function get_directory_tree_elements ($directory)
 {
 	/*
 		In Windows server both \ and / can be used as directory separators in paths
@@ -255,7 +255,7 @@ function mama_get_directory_tree_elements ($directory)
 	return $tree;
 }
 
-function mama_init_dir (&$tree, &$count)
+function attachments_init_dir (&$tree, &$count)
 {
 	$directory = '';
 	// If on Windows servers the first part of the path is the drive (e.g. "C:")

+ 3 - 1
Themes/default/GenericControls.template.php

@@ -58,6 +58,8 @@ function template_control_richedit($editor_id, $smileyContainer = null, $bbcCont
 						{';
 
 				$numRows = count($smileyRows);
+				// This is needed because otherwise the editor will remove all the duplicate (empty) keys and leave only 1 additional line
+				$emptyPlaceholder = 0;
 				foreach ($smileyRows as $smileyRow)
 				{
 					foreach ($smileyRow['smileys'] as $smiley)
@@ -67,7 +69,7 @@ function template_control_richedit($editor_id, $smileyContainer = null, $bbcCont
 					}
 					if (empty($smileyRow['isLast']) && $numRows != 1)
 						echo ',
-						\'\': \'\',';
+						\'-', $emptyPlaceholder++, '\': \'\',';
 				}
 				echo '
 						}', $countLocations != 0 ? ',' : '';

+ 3 - 4
Themes/default/css/index.css

@@ -2442,14 +2442,13 @@ ul.post_options li {
 	padding: 0;
 	padding: 6px;
 }
-#postAttachment dd {
+#postAttachment dd, #postAttachment2 dd {
 	margin: 4px 0 4px 12px;
+}
+#postAttachment dd {
 	width: 45%;
 	float: left;
 }
-#postAttachment2 dd {
-	margin: 4px 0 4px 12px;
-}
 #postAttachment dt, #postAttachment2 dt {
 	font-weight: bold;
 }

+ 4 - 0
Themes/default/index.template.php

@@ -435,6 +435,10 @@ function theme_linktree($force_show = false)
 			echo '
 				<span class="dividers">', $context['right_to_left'] ? ' &#9668; ' : ' &#9658; ', '</span>';
 
+		// Show something before the link?
+		if (isset($tree['extra_before']))
+			echo $tree['extra_before'];
+
 		// Show the link, including a URL if it should have one.
 		echo $settings['linktree_link'] && isset($tree['url']) ? '
 				<a href="' . $tree['url'] . '"><span>' . $tree['name'] . '</span></a>' : '<span>' . $tree['name'] . '</span>';

+ 21 - 21
Themes/default/scripts/jquery.sceditor.bbcode.js

@@ -505,8 +505,8 @@
 
 			var	oldText, replaceBBCodeFunc,
 // Previous				bbcodeRegex = /\[([^\[\s=]*?)(?:([\s=][^\[]*?))?\]((?:[\s\S(?!=\[\\\1)](?!\[\1))*?)\[\/(\1)\]/g,
-				bbcodeRegex = /\[([^\[\s=]+)(?:([\s=][^\[\]]+))?\]((?:[\s\S](?!\[\1))*?)\[\/(\1)\]/g,
-				atribsRegex = /(\S+)=((?:(?:(["'])(?:\\\3|[^\3])*?\3))|(?:[^'"\s]+))/g;
+				bbcodeRegex = /\[([^\[\s=]+)(?:([\s=][^\[\]]+))?\]((?:[\s\S](?!\[\1))*?)\[\/(\1)\]/gi,
+				atribsRegex = /(\S+)=((?:(?:(["'])(?:\\\3|[^\3])*?\3))|(?:[^'"\s]+))/gi;
 
 			replaceBBCodeFunc = function(str, bbcode, attrs, content)
 			{
@@ -1080,26 +1080,26 @@
 					return '[iurl=' + decodeURI(element.attr('href')) + ']' + content + '[/iurl]';
 			},
 			html: function(element, attrs, content) {
-				if(typeof attrs.defaultAttr === "undefined" || attrs.defaultAttr.length === 0)
-					attrs.defaultAttr = content;
+				if(typeof attrs.defaultattr === "undefined" || attrs.defaultattr.length === 0)
+					attrs.defaultattr = content;
 
-				return '<a target="_blank" href="' + encodeURI(attrs.defaultAttr) + '">' + content + '</a>';
+				return '<a target="_blank" href="' + encodeURI(attrs.defaultattr) + '">' + content + '</a>';
 			}
 		},
 		iurl: {
 			html: function(element, attrs, content) {
-				if(typeof attrs.defaultAttr === "undefined" || attrs.defaultAttr.length === 0)
-					attrs.defaultAttr = content;
+				if(typeof attrs.defaultattr === "undefined" || attrs.defaultattr.length === 0)
+					attrs.defaultattr = content;
 
-				return '<a href="' + encodeURI(attrs.defaultAttr) + '">' + content + '</a>';
+				return '<a href="' + encodeURI(attrs.defaultattr) + '">' + content + '</a>';
 			}
 		},
 		ftp: {
 			html: function(element, attrs, content) {
-				if(typeof attrs.defaultAttr === "undefined" || attrs.defaultAttr.length === 0)
-					attrs.defaultAttr = content;
+				if(typeof attrs.defaultattr === "undefined" || attrs.defaultattr.length === 0)
+					attrs.defaultattr = content;
 
-				return '<a target="_blank" href="' + encodeURI(attrs.defaultAttr) + '">' + content + '</a>';
+				return '<a target="_blank" href="' + encodeURI(attrs.defaultattr) + '">' + content + '</a>';
 			}
 		},
 		// END_COMMAND
@@ -1217,8 +1217,8 @@
 			},
 			html:  function(element, attrs, content) {
 				var from = '';
-				if(typeof attrs.defaultAttr !== "undefined")
-					from = '<cite>' + attrs.defaultAttr + '</cite>';
+				if(typeof attrs.defaultattr !== "undefined")
+					from = '<cite>' + attrs.defaultattr + '</cite>';
 
 				return '<code>' + from + content.replace('[', '&#91;') + '</code>'
 			}
@@ -1325,10 +1325,10 @@
 				return '[abbr=' + element.attr('title') + ']' + content + '[/abbr]';
 			},
 			html: function(element, attrs, content) {
-				if(typeof attrs.defaultAttr === "undefined" || attrs.defaultAttr.length === 0)
+				if(typeof attrs.defaultattr === "undefined" || attrs.defaultattr.length === 0)
 					return content;
 
-				return '<abbr title="' + attrs.defaultAttr + '">' + content + '</abbr>';
+				return '<abbr title="' + attrs.defaultattr + '">' + content + '</abbr>';
 			}
 		},
 		acronym: {
@@ -1341,10 +1341,10 @@
 				return '[acronym=' + element.attr('title') + ']' + content + '[/acronym]';
 			},
 			html: function(element, attrs, content) {
-				if(typeof attrs.defaultAttr === "undefined" || attrs.defaultAttr.length === 0)
+				if(typeof attrs.defaultattr === "undefined" || attrs.defaultattr.length === 0)
 					return content;
 
-				return '<acronym title="' + attrs.defaultAttr + '">' + content + '</acronym>';
+				return '<acronym title="' + attrs.defaultattr + '">' + content + '</acronym>';
 			}
 		},
 		bdo: {
@@ -1357,12 +1357,12 @@
 				return '[bdo=' + element.attr('dir') + ']' + content + '[/bdo]';
 			},
 			html: function(element, attrs, content) {
-				if(typeof attrs.defaultAttr === "undefined" || attrs.defaultAttr.length === 0)
+				if(typeof attrs.defaultattr === "undefined" || attrs.defaultattr.length === 0)
 					return content;
-				if (attrs.defaultAttr != 'rtl' && attrs.defaultAttr != 'ltr')
-					return '[bdo=' + attrs.defaultAttr + ']' + content + '[/bdo]';
+				if (attrs.defaultattr != 'rtl' && attrs.defaultattr != 'ltr')
+					return '[bdo=' + attrs.defaultattr + ']' + content + '[/bdo]';
 
-				return '<bdo dir="' + attrs.defaultAttr + '">' + content + '</bdo>';
+				return '<bdo dir="' + attrs.defaultattr + '">' + content + '</bdo>';
 			}
 		},
 		tt: {

+ 28 - 13
Themes/default/scripts/jquery.sceditor.js

@@ -720,7 +720,7 @@
 
 			$.each(emoticons, function (key, url) {
 				// In SMF an empty entry means a new line
-				if (key == '')
+				if (url == '')
 					emoticon = document.createElement('br');
 				else
 				{
@@ -1244,7 +1244,7 @@
 
 			$.each(emoticons, function (key, url) {
 				// In SMF an empty entry means a new line
-				if (key == '')
+				if (url == '')
 					return;
 				// escape the key before using it as a regex
 				// and append the regex to only find emoticons outside
@@ -2098,7 +2098,7 @@
 							if(!description)
 								description = val;
 
-							editor.wysiwygEditorInsertHtml('<a href="' + val + '">' + description + '</a>');
+							editor.wysiwygEditorInsertHtml('<a target="_blank" href="' + val + '">' + description + '</a>');
 						}
 						else
 							editor.execCommand("createlink", val);
@@ -3422,7 +3422,7 @@
 			return current_value;
 		},
 		appendEmoticon: function (code, emoticon) {
-			if (code == '')
+			if (emoticon == '')
 				line.append($('<br />'));
 			else
 				line.append($('<img />')
@@ -3486,13 +3486,15 @@
 							var emoticons = $.extend({}, base.options.emoticons.popup);
 							var popup_position;
 							var titlebar = $('<div class="catbg sceditor-popup-grip"/>');
-								popupContent = $('<div id="sceditor-popup"/>');
-								allowHide = true;
-								popupContent.append(titlebar);
-								line = $('<div />');
-								closeButton = $('<span />').text('[' + base._('Close') + ']').click(function () {
-									$(".sceditor-smileyPopup").fadeOut('fast');
-								});
+							popupContent = $('<div id="sceditor-popup"/>');
+							allowHide = true;
+							line = $('<div id="sceditor-popup-smiley"/>');
+							adjheight = 0;
+
+							popupContent.append(titlebar);
+							closeButton = $('<span />').text('[' + base._('Close') + ']').click(function () {
+								$(".sceditor-smileyPopup").fadeOut('fast');
+							});
 
 							$.each(emoticons, base.appendEmoticon);
 
@@ -3512,16 +3514,29 @@
 
 							$dropdown.appendTo($('body'));
 							dropdownIgnoreLastClick = true;
+							adjheight = closeButton.height() + titlebar.height();
 							$dropdown.css({
 								position: "fixed",
 								top: $(window).height() * 0.2,
-								left: $(window).width() * 0.5 - ($dropdown.width() / 2),
-								"max-width": "50%"
+								left: $(window).width() * 0.5 - ($dropdown.find('#sceditor-popup-smiley').width() / 2),
+								"max-width": "50%",
+								"max-height": "50%",
+							}).find('#sceditor-popup-smiley').css({
+								height: $dropdown.height() - adjheight,
+								"overflow": "auto"
 							});
 
 							$('.sceditor-smileyPopup').animaDrag({ 
 								speed: 150, 
 								interval: 120, 
+								during: function(e) {
+									$(this).height(this.startheight);
+									$(this).width(this.startwidth);
+								},
+								before: function(e) {
+									this.startheight = $(this).innerHeight();
+									this.startwidth = $(this).innerWidth();
+								},
 								grip: '.sceditor-popup-grip' 
 							});
 							// stop clicks within the dropdown from being handled

+ 3 - 1
Themes/default/scripts/theme.js

@@ -66,7 +66,9 @@ function smf_addButton(sButtonStripId, bUseImage, oOptions)
 	// Add the button.
 	var oButtonStripList = oButtonStrip.getElementsByTagName('ul')[0];
 	var oNewButton = document.createElement('li');
-	setInnerHTML(oNewButton, '<a href="' + oOptions.sUrl + '" ' + ('sCustom' in oOptions ? oOptions.sCustom : '') + '><span class="last"' + ('sId' in oOptions ? ' id="' + oOptions.sId + '"': '') + '>' + oOptions.sText + '</span></a>');
+	if ('sId' in oOptions)
+		oNewButton.id = oOptions.sId
+	setInnerHTML(oNewButton, '<a href="' + oOptions.sUrl + '" ' + ('sCustom' in oOptions ? oOptions.sCustom : '') + '><span class="last"' + ('sId' in oOptions ? ' id="' + oOptions.sId + '_text"': '') + '>' + oOptions.sText + '</span></a>');
 
 	oButtonStripList.appendChild(oNewButton);
 }

+ 3 - 3
Themes/default/scripts/topic.js

@@ -636,19 +636,19 @@ InTopicModeration.prototype.handleClick = function(oCheckbox)
 	// Show the number of messages selected in the button.
 	if (this.opt.bCanRemove && !this.opt.bUseImageButton)
 	{
-		setInnerHTML(document.getElementById(this.opt.sSelf + '_remove_button'), this.opt.sRemoveButtonLabel + ' [' + this.iNumSelected + ']');
+		setInnerHTML(document.getElementById(this.opt.sSelf + '_remove_button_text'), this.opt.sRemoveButtonLabel + ' [' + this.iNumSelected + ']');
 		document.getElementById(this.opt.sSelf + '_remove_button').style.display = this.iNumSelected < 1 ? "none" : "";
 	}
 
 	if (this.opt.bCanRestore && !this.opt.bUseImageButton)
 	{
-		setInnerHTML(document.getElementById(this.opt.sSelf + '_restore_button'), this.opt.sRestoreButtonLabel + ' [' + this.iNumSelected + ']');
+		setInnerHTML(document.getElementById(this.opt.sSelf + '_restore_button_text'), this.opt.sRestoreButtonLabel + ' [' + this.iNumSelected + ']');
 		document.getElementById(this.opt.sSelf + '_restore_button').style.display = this.iNumSelected < 1 ? "none" : "";
 	}
 
 	if (this.opt.bCanSplit && !this.opt.bUseImageButton)
 	{
-		setInnerHTML(document.getElementById(this.opt.sSelf + '_split_button'), this.opt.sSplitButtonLabel + ' [' + this.iNumSelected + ']');
+		setInnerHTML(document.getElementById(this.opt.sSelf + '_split_button_text'), this.opt.sSplitButtonLabel + ' [' + this.iNumSelected + ']');
 		document.getElementById(this.opt.sSelf + '_split_button').style.display = this.iNumSelected < 1 ? "none" : "";
 	}