Browse Source

! update search template to use progress bar graphic in place of xx% done text
! update news templates to use progress bar graphic in place of xx% done text
! update style of progress bar(s), move inline styles to css, several templates

Signed-off-by: Spuds <[email protected]>

Spuds 12 years ago
parent
commit
f29876b0ef

+ 6 - 2
Sources/ManageSearch.php

@@ -556,6 +556,10 @@ function CreateMessageIndex()
 		);
 		$context['start'] = isset($_REQUEST['start']) ? (int) $_REQUEST['start'] : 0;
 		$context['step'] = isset($_REQUEST['step']) ? (int) $_REQUEST['step'] : 0;
+		
+		// admin timeouts are painful when building these long indexes
+		if ($_SESSION['admin_time'] + 3300 < time() && $context['step'] >= 1)
+			$_SESSION['admin_time'] = time();
 	}
 
 	if ($context['step'] !== 0)
@@ -676,7 +680,7 @@ function CreateMessageIndex()
 					updateSettings(array('search_custom_index_resume' => serialize(array_merge($context['index_settings'], array('resume_at' => $context['start'])))));
 			}
 
-			// Since there are still two steps to go, 90% is the maximum here.
+			// Since there are still two steps to go, 80% is the maximum here.
 			$context['percentage'] = round($num_messages['done'] / ($num_messages['done'] + $num_messages['todo']), 3) * 80;
 		}
 	}
@@ -732,7 +736,7 @@ function CreateMessageIndex()
 			$context['percentage'] = 80 + round($context['start'] / $index_properties[$context['index_settings']['bytes_per_word']]['max_size'], 3) * 20;
 		}
 	}
-
+	
 	// Step 3: remove words not distinctive enough.
 	if ($context['step'] === 3)
 	{

+ 44 - 38
Sources/SearchAPI-Custom.php

@@ -210,9 +210,9 @@ class custom_search
 
 		return $ignoreRequest;
 	}
-
+	
 	/**
-	 * After a post is made, we update the database.
+	 * After a post is made, we update the search index database.
 	 */
 	public function postCreated($msgOptions, $topicOptions, $posterOptions)
 	{
@@ -234,48 +234,54 @@ class custom_search
 	}
 
 	/**
-	 * After a post is modified, we update the database.
+	 * After a post is modified, we update the search index database.
 	 */
 	public function postModified($msgOptions, $topicOptions, $posterOptions)
 	{
 		global $modSettings, $smcFunc;
-
-		$customIndexSettings = unserialize($modSettings['search_custom_index_config']);
-
-		$stopwords = empty($modSettings['search_stopwords']) ? array() : explode(',', $modSettings['search_stopwords']);
-		$old_index = text2words($msgOptions['old_body'], $customIndexSettings['bytes_per_word'], true);
-		$new_index = text2words($msgOptions['body'], $customIndexSettings['bytes_per_word'], true);
-
-		// Calculate the words to be added and removed from the index.
-		$removed_words = array_diff(array_diff($old_index, $new_index), $stopwords);
-		$inserted_words = array_diff(array_diff($new_index, $old_index), $stopwords);
-		// Delete the removed words AND the added ones to avoid key constraints.
-		if (!empty($removed_words))
+		
+		if (isset($msgOptions['body']))
 		{
-			$removed_words = array_merge($removed_words, $inserted_words);
-			$smcFunc['db_query']('', '
-				DELETE FROM {db_prefix}log_search_words
-				WHERE id_msg = {int:id_msg}
-					AND id_word IN ({array_int:removed_words})',
-				array(
-					'removed_words' => $removed_words,
-					'id_msg' => $msgOptions['id'],
-				)
-			);
-		}
+			$customIndexSettings = unserialize($modSettings['search_custom_index_config']);
+			$stopwords = empty($modSettings['search_stopwords']) ? array() : explode(',', $modSettings['search_stopwords']);
+			$old_body = isset($msgOptions['old_body']) ? $msgOptions['old_body'] : '';
+			
+			// create thew new and old index
+			$old_index = text2words($old_body, $customIndexSettings['bytes_per_word'], true);
+			$new_index = text2words($msgOptions['body'], $customIndexSettings['bytes_per_word'], true);
+			
+			// Calculate the words to be added and removed from the index.
+			$removed_words = array_diff(array_diff($old_index, $new_index), $stopwords);
+			$inserted_words = array_diff(array_diff($new_index, $old_index), $stopwords);
+			
+			// Delete the removed words AND the added ones to avoid key constraints.
+			if (!empty($removed_words))
+			{
+				$removed_words = array_merge($removed_words, $inserted_words);
+				$smcFunc['db_query']('', '
+					DELETE FROM {db_prefix}log_search_words
+					WHERE id_msg = {int:id_msg}
+						AND id_word IN ({array_int:removed_words})',
+					array(
+						'removed_words' => $removed_words,
+						'id_msg' => $msgOptions['id'],
+					)
+				);
+			}
 
-		// Add the new words to be indexed.
-		if (!empty($inserted_words))
-		{
-			$inserts = array();
-			foreach ($inserted_words as $word)
-				$inserts[] = array($word, $msgOptions['id']);
-			$smcFunc['db_insert']('insert',
-				'{db_prefix}log_search_words',
-				array('id_word' => 'string', 'id_msg' => 'int'),
-				$inserts,
-				array('id_word', 'id_msg')
-			);
+			// Add the new words to be indexed.
+			if (!empty($inserted_words))
+			{
+				$inserts = array();
+				foreach ($inserted_words as $word)
+					$inserts[] = array($word, $msgOptions['id']);
+				$smcFunc['db_insert']('insert',
+					'{db_prefix}log_search_words',
+					array('id_word' => 'string', 'id_msg' => 'int'),
+					$inserts,
+					array('id_word', 'id_msg')
+				);
+			}
 		}
 	}
 }

+ 13 - 14
Themes/default/Admin.template.php

@@ -236,8 +236,7 @@ function template_credits()
 	echo '
 			</div>
 			<span class="botslice"><span></span></span>
-		</div>
-	';
+		</div>';
 
 	// Point the admin to common support resources.
 	echo '
@@ -710,27 +709,26 @@ function template_not_done()
 
 	if (!empty($context['continue_percent']))
 		echo '
-				<div style="padding-left: 20%; padding-right: 20%; margin-top: 1ex;">
-					<div style="font-size: 8pt; height: 12pt; border: 1px solid black; background-color: white; padding: 1px; position: relative;">
-						<div style="padding-top: ', isBrowser('is_webkit') || isBrowser('is_konqueror') ? '2pt' : '1pt', '; width: 100%; z-index: 2; color: black; position: absolute; text-align: center; font-weight: bold;">', $context['continue_percent'], '%</div>
-						<div style="width: ', $context['continue_percent'], '%; height: 12pt; z-index: 1; background-color: red;">&nbsp;</div>
-					</div>
+				<br /><br />
+				<div class="progress_bar">
+					<div class="full_bar">', $context['continue_percent'], '%</div>
+					<div class="green_percent" style="width: ', $context['continue_percent'], '%;">&nbsp;</div>
 				</div>';
 
 	if (!empty($context['substep_enabled']))
 		echo '
-				<div style="padding-left: 20%; padding-right: 20%; margin-top: 1ex;">
-					<span class="smalltext">', $context['substep_title'], '</span>
-					<div style="font-size: 8pt; height: 12pt; border: 1px solid black; background-color: white; padding: 1px; position: relative;">
-						<div style="padding-top: ', isBrowser('is_webkit') || isBrowser('is_konqueror') ? '2pt' : '1pt', '; width: 100%; z-index: 2; color: black; position: absolute; text-align: center; font-weight: bold;">', $context['substep_continue_percent'], '%</div>
-						<div style="width: ', $context['substep_continue_percent'], '%; height: 12pt; z-index: 1; background-color: blue;">&nbsp;</div>
-					</div>
+				<br /><br />
+				<div class="progress_bar">
+					<div class="full_bar">', $context['substep_title'], ' (', $context['substep_continue_percent'], '%)</div>
+					<div class="blue_percent" style="width: ', $context['substep_continue_percent'], '%;">&nbsp;</div>
 				</div>';
 
 	echo '
 				<form action="', $scripturl, $context['continue_get_data'], '" method="post" accept-charset="', $context['character_set'], '" style="margin: 0;" name="autoSubmit" id="autoSubmit">
-					<div style="margin: 1ex; text-align: right;"><input type="submit" name="cont" value="', $txt['not_done_continue'], '" class="button_submit" /></div>
+					<hr class="hrcolor" />
+					<input type="submit" name="cont" value="', $txt['not_done_continue'], '" class="button_submit" />
 					', $context['continue_post_data'], '
+					<br class="clear_right" />
 				</form>
 			</div>
 			<span class="botslice"><span></span></span>
@@ -1617,6 +1615,7 @@ function template_repair_boards()
 	}
 }
 
+// Retrieves info from the php_info function, scrubs and preps it for display
 function template_php_info()
 {
 	global $context, $txt;

+ 6 - 3
Themes/default/ManageNews.template.php

@@ -491,9 +491,11 @@ function template_email_members_send()
 			<div class="windowbg">
 				<span class="topslice"><span></span></span>
 				<div class="content">
-					<p>
-						<strong>', $context['percentage_done'], '% ', $txt['email_done'], '</strong>
-					</p>
+					<div class="progress_bar">
+						<div class="full_bar">', $context['percentage_done'], '% ', $txt['email_done'], '</div>
+						<div class="green_percent" style="width: ', $context['percentage_done'], '%;">&nbsp;</div>
+					</div>
+					<hr class="hrcolor" />
 					<input type="submit" name="b" value="', $txt['email_continue'], '" class="button_submit" />
 					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
 					<input type="hidden" name="subject" value="', $context['subject'], '" />
@@ -511,6 +513,7 @@ function template_email_members_send()
 					<input type="hidden" name="', $key, '" value="', implode(($key == 'emails' ? ';' : ','), $values), '" />';
 
 	echo '
+				<br class="clear_right" />
 				</div>
 				<span class="botslice"><span></span></span>
 			</div>

+ 11 - 9
Themes/default/ManageSearch.template.php

@@ -248,10 +248,11 @@ function template_create_index()
 							</select>
 						</dd>
 					</dl>
+					<hr class="hrcolor" />
 					<input type="submit" name="save" value="', $txt['search_create_index_start'], '" class="button_submit" />
 					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
+					<br class="clear_right" />
 				</div>
-				<br class="clear" />
 				<span class="botslice"><span></span></span>
 			</div>
 	</form>
@@ -270,22 +271,23 @@ function template_create_index_progress()
 			<div class="windowbg">
 				<span class="topslice"><span></span></span>
 				<div class="content">
-					<p>
-						', $txt['search_create_index_not_ready'], '
-					</p>
-					<p>
-						<strong>', $txt['search_create_index_progress'], ': ', $context['percentage'], '%</strong>
-					</p>
+					<div><p>',
+						$txt['search_create_index_not_ready'], '</p>
+						<div class="progress_bar">
+							<div class="full_bar">', $context['percentage'], '%</div>
+							<div class="green_percent" style="width: ', $context['percentage'], '%;">&nbsp;</div>
+						</div>
+					</div>
+					<hr class="hrcolor" />
 					<input type="submit" name="b" value="', $txt['search_create_index_continue'], '" class="button_submit" />
+					<br class="clear_right" />
 				</div>
-				<br class="clear" />
 				<span class="botslice"><span></span></span>
 			</div>
 			<input type="hidden" name="step" value="', $context['step'], '" />
 			<input type="hidden" name="start" value="', $context['start'], '" />
 			<input type="hidden" name="bytes_per_word" value="', $context['index_settings']['bytes_per_word'], '" />
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
-			<input type="hidden" name="', $context['admin-msmpost_token_var'], '" value="', $context['admin-msmpost_token'], '" />
 		</form>
 	</div>
 	<br class="clear" />

+ 10 - 10
Themes/default/Packages.template.php

@@ -1773,11 +1773,11 @@ function template_action_permissions()
 			<div class="windowbg">
 				<span class="topslice"><span></span></span>
 				<div class="content">
-					<div style="padding-left: 20%; padding-right: 20%; margin-top: 1ex;">
-						<strong>', $progress_message, '</strong>
-						<div style="font-size: 8pt; height: 12pt; border: 1px solid black; background-color: white; padding: 1px; position: relative;">
-							<div style="padding-top: ', isBrowser('is_webkit') || isBrowser('is_konqueror') ? '2pt' : '1pt', '; width: 100%; z-index: 2; color: black; position: absolute; text-align: center; font-weight: bold;">', $progress_percent, '%</div>
-							<div style="width: ', $progress_percent, '%; height: 12pt; z-index: 1; background-color: #98b8f4;">&nbsp;</div>
+					<div>
+						<strong>', $progress_message, '</strong><br /><br />
+						<div class="progress_bar">
+							<div class="full_bar">', $progress_percent, '%</div>
+							<div class="blue_percent" style="width: ', $progress_percent, '%;">&nbsp;</div>
 						</div>
 					</div>';
 
@@ -1789,11 +1789,11 @@ function template_action_permissions()
 
 		echo '
 					<br />
-					<div style="padding-left: 20%; padding-right: 20%; margin-top: 1ex;">
-						<strong>', $file_progress_message, '</strong>
-						<div style="font-size: 8pt; height: 12pt; border: 1px solid black; background-color: white; padding: 1px; position: relative;">
-							<div style="padding-top: ', isBrowser('is_webkit') || isBrowser('is_konqueror') ? '2pt' : '1pt', '; width: 100%; z-index: 2; color: black; position: absolute; text-align: center; font-weight: bold;">', $file_progress_percent, '%</div>
-							<div style="width: ', $file_progress_percent, '%; height: 12pt; z-index: 1; background-color: #c1ffc1;">&nbsp;</div>
+					<div>
+						<strong>', $file_progress_message, '</strong><br /><br />
+						<div class="progress_bar">
+							<div class="full_bar">', $file_progress_percent, '%</div>
+							<div class="green_percent" style="width: ', $file_progress_percent, '%;">&nbsp;</div>
 						</div>
 					</div>';
 	}

+ 8 - 1
Themes/default/Post.template.php

@@ -1021,6 +1021,7 @@ function template_announce()
 							<label for="checkall"><input type="checkbox" id="checkall" class="input_check" onclick="invertAll(this, this.form);" checked="checked" /> <em>', $txt['check_all'], '</em></label>
 						</li>
 					</ul>
+					<hr class="hrcolor" />
 					<div id="confirm_buttons">
 						<input type="submit" value="', $txt['post'], '" class="button_submit" />
 						<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
@@ -1029,6 +1030,7 @@ function template_announce()
 						<input type="hidden" name="goback" value="', $context['go_back'], '" />
 					</div>
 				</div>
+				<br class="clear_right" />
 				<span class="botslice"><span></span></span>
 			</div>
 		</form>
@@ -1047,7 +1049,11 @@ function template_announcement_send()
 				<span class="topslice"><span></span></span>
 				<div class="content">
 					<p>', $txt['announce_sending'], ' <a href="', $scripturl, '?topic=', $context['current_topic'], '.0" target="_blank" class="new_win">', $context['topic_subject'], '</a></p>
-					<p><strong>', $context['percentage_done'], '% ', $txt['announce_done'], '</strong></p>
+					<div class="progress_bar">
+						<div class="full_bar">', $context['percentage_done'], '% ', $txt['announce_done'], '</div>
+						<div class="green_percent" style="width: ', $context['percentage_done'], '%;">&nbsp;</div>
+					</div>
+					<hr class="hrcolor" />
 					<div id="confirm_buttons">
 						<input type="submit" name="b" value="', $txt['announce_continue'], '" class="button_submit" />
 						<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
@@ -1058,6 +1064,7 @@ function template_announcement_send()
 						<input type="hidden" name="membergroups" value="', $context['membergroups'], '" />
 					</div>
 				</div>
+				<br class="clear_right" />
 				<span class="botslice"><span></span></span>
 			</div>
 		</form>

+ 2 - 2
Themes/default/Search.template.php

@@ -308,7 +308,7 @@ function template_results()
 							<input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');" class="input_check" />';
 				echo '
 				</span>
-				<span class="ie6_header floatleft"><img src="' . $settings['images_url'] . '/buttons/search.png" alt="?" />&nbsp;', $txt['mlist_search_results'],':&nbsp;',$context['search_params']['search'],'</span>
+				<span class="ie6_header floatleft"><img src="' . $settings['images_url'] . '/buttons/search.png" alt="?" class="centericon" />&nbsp;', $txt['mlist_search_results'],':&nbsp;',$context['search_params']['search'],'</span>
 			</h3>
 		</div>';
 		
@@ -458,7 +458,7 @@ function template_results()
 		echo '
 		<div class="cat_bar">
 			<h3 class="catbg">
-				<span class="ie6_header floatleft"><img src="' . $settings['images_url'] . '/buttons/search.png" alt="" />&nbsp;', $txt['mlist_search_results'],':&nbsp;',$context['search_params']['search'],'</span>
+				<span class="ie6_header floatleft"><img class="centericon" src="' . $settings['images_url'] . '/buttons/search.png" alt="?" />&nbsp;', $txt['mlist_search_results'],':&nbsp;',$context['search_params']['search'],'</span>
 			</h3>
 		</div>
 		<div class="pagesection">

File diff suppressed because it is too large
+ 190 - 333
Themes/default/css/index.css


Some files were not shown because too many files changed in this diff