From d3abf62c3b8aaedd845ef9d7b9cd8201f72cb01a Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Mon, 6 Jun 2016 17:41:02 -0600 Subject: [PATCH 01/26] Move the view page into the main index.php. Prepare for viewing individual words. --- .htaccess | 12 +++- index.php | 169 ++++++++++++++++++++++++++++++++++------------ php/display.php | 11 +++ php/functions.php | 1 + view/index.php | 169 ---------------------------------------------- 5 files changed, 147 insertions(+), 215 deletions(-) create mode 100644 php/display.php delete mode 100644 view/index.php diff --git a/.htaccess b/.htaccess index 78e1d27..7320c0a 100644 --- a/.htaccess +++ b/.htaccess @@ -1,3 +1,9 @@ -RewriteEngine On # Turn on the rewriting engine -RewriteRule ^view/([0-9]+)/?$ view/index.php?dict=$1 [NC,L] # Handle dictionary ids. -RewriteRule ^([0-9]+)/?$ view/index.php?dict=$1 [NC,L] # Handle dictionary ids. \ No newline at end of file +RewriteEngine On # Turn on the rewriting engine + +RewriteRule ^view/([0-9]+)/([0-9]+)/?$ index.php?dict=$1&word=$2 [NC,L] # Handle word ids. + +RewriteRule ^([0-9]+)/([0-9]+)/?$ index.php?dict=$1&word=$2 [NC,L] # Handle word ids. + +RewriteRule ^view/([0-9]+)/?$ index.php?dict=$1 [NC,L] # Handle dictionary ids. + +RewriteRule ^([0-9]+)/?$ index.php?dict=$1 [NC,L] # Handle dictionary ids. \ No newline at end of file diff --git a/index.php b/index.php index 4138407..b63e575 100644 --- a/index.php +++ b/index.php @@ -4,6 +4,16 @@ require_once('required.php'); session_start(); $current_user = isset($_SESSION['user']) ? $_SESSION['user'] : 0; +$dictionary_to_load = (isset($_GET['dict'])) ? intval($_GET['dict']) : 0; +$the_public_dictionary = '"That dictionary doesn\'t exist."'; +$dictionary_name = 'ERROR'; +$dictionary_creator = 'nobody'; +$is_viewing = $dictionary_to_load > 0; + +$word_to_load = (isset($_GET['word'])) ? intval($_GET['word']) : 0; +$the_public_word = '"That word doesn\'t exist."'; +$word_name = 'ERROR'; + $announcement = get_include_contents(SITE_LOCATION . '/announcement.php'); $notificationMessage = ""; @@ -17,6 +27,37 @@ if ($current_user > 0 || !isset($_SESSION['loginfailures']) || (isset($_SESSION[ require_once(SITE_LOCATION . '/php/notificationconditiontree.php'); +if ($is_viewing) { + $query = "SELECT `d`.`id`, `d`.`name`, `d`.`description`, `u`.`public_name`, `d`.`words`, `d`.`parts_of_speech`, `d`.`is_complete` "; + $query .= "FROM `dictionaries` AS `d` LEFT JOIN `users` AS `u` ON `d`.`user`=`u`.`id` WHERE `d`.`is_public`=1 AND `d`.`id`=" . $dictionary_to_load . ";"; + + $dbconnection = new PDO('mysql:host=' . DATABASE_SERVERNAME . ';dbname=' . DATABASE_NAME . ';charset=utf8', DATABASE_USERNAME, DATABASE_PASSWORD); + $dbconnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + $dbconnection->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); + $dbconnection->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); + try { + $queryResults = $dbconnection->prepare($query); + $queryResults->execute(); + if ($queryResults) { + if (num_rows($queryResults) === 1) { + while ($dict = fetch($queryResults)) { + $dictionary_name = $dict['name']; + $dictionary_creator = $dict['public_name']; + $the_public_dictionary = '{"name":"' . $dict['name'] . '",'; + $the_public_dictionary .= '"description":"' . $dict['description'] . '",'; + $the_public_dictionary .= '"createdBy":"' . $dict['public_name'] . '",'; + $the_public_dictionary .= '"words":' . $dict['words'] . ','; + $the_public_dictionary .= '"settings":{'; + $the_public_dictionary .= '"partsOfSpeech":"' . $dict['parts_of_speech'] . '",'; + $the_public_dictionary .= '"isComplete":' . (($dict['is_complete'] == 1) ? 'true' : 'false') . '},'; + $the_public_dictionary .= '}'; + } + } + } + } + catch (PDOException $ex) {} +} + ?> @@ -24,7 +65,17 @@ require_once(SITE_LOCATION . '/php/notificationconditiontree.php'); - Lexiconga Dictionary Builder + + <?php echo $dictionary_name; ?> Dictionary on Lexiconga + + + + + + + + Lexiconga Dictionary Builder + @@ -48,6 +99,7 @@ require_once(SITE_LOCATION . '/php/notificationconditiontree.php'); +
;margin-bottom:10px;"> Close
@@ -57,60 +109,68 @@ require_once(SITE_LOCATION . '/php/notificationconditiontree.php');
-
-
🔒
- - - - - - - -
- -
- - -
- + +
+
🔒
+ + + + + + + +
+ +
+ + +
+
+
+ Settings - +

+ + +

+
+ - Show Description - + HideShow Description +
- Search/Filter Options - + + + + +
@@ -289,12 +355,29 @@ require_once(SITE_LOCATION . '/php/notificationconditiontree.php'); + + + + diff --git a/php/display.php b/php/display.php new file mode 100644 index 0000000..827f153 --- /dev/null +++ b/php/display.php @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/php/functions.php b/php/functions.php index 51a08bc..3e0a25e 100644 --- a/php/functions.php +++ b/php/functions.php @@ -5,5 +5,6 @@ require_once(SITE_LOCATION . '/php/helpers.php'); require_once(SITE_LOCATION . '/php/plugins/easycrypt.php'); require_once(SITE_LOCATION . '/php/validation.php'); require_once(SITE_LOCATION . '/php/passwordreset.php'); +require_once(SITE_LOCATION . '/php/display.php'); ?> \ No newline at end of file diff --git a/view/index.php b/view/index.php deleted file mode 100644 index 32f540c..0000000 --- a/view/index.php +++ /dev/null @@ -1,169 +0,0 @@ - 0 || !isset($_SESSION['loginfailures']) || (isset($_SESSION['loginlockouttime']) && time() - $_SESSION['loginlockouttime'] >= 3600)) { - // If logged in, never failed, or more than 1 hour has passed, reset login failures. - $_SESSION['loginfailures'] = 0; -} else { - $alertlockoutmessage = "You failed logging in 10 times. To prevent request flooding and hacking attempts, you may not log in or create an account for 1 hour.\\n\\nThe last time this page was loaded, you had been locked out for " . time_elapsed(time() - $_SESSION['loginlockouttime']) . "\\n\\nRefresh the page once the hour has passed."; - $hoverlockoutmessage = str_replace("\\n", "\n", $alertlockoutmessage); -} - -$query = "SELECT `d`.`id`, `d`.`name`, `d`.`description`, `u`.`public_name`, `d`.`words`, `d`.`parts_of_speech`, `d`.`is_complete` "; -$query .= "FROM `dictionaries` AS `d` LEFT JOIN `users` AS `u` ON `d`.`user`=`u`.`id` WHERE `d`.`is_public`=1 AND `d`.`id`=" . $dictionary_to_load . ";"; - -$dbconnection = new PDO('mysql:host=' . DATABASE_SERVERNAME . ';dbname=' . DATABASE_NAME . ';charset=utf8', DATABASE_USERNAME, DATABASE_PASSWORD); -$dbconnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); -$dbconnection->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); -$dbconnection->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); -try { - $queryResults = $dbconnection->prepare($query); - $queryResults->execute(); - if ($queryResults) { - if (num_rows($queryResults) === 1) { - while ($dict = fetch($queryResults)) { - $dictionary_name = $dict['name']; - $dictionary_creator = $dict['public_name']; - $the_public_dictionary = '{"name":"' . $dict['name'] . '",'; - $the_public_dictionary .= '"description":"' . $dict['description'] . '",'; - $the_public_dictionary .= '"createdBy":"' . $dict['public_name'] . '",'; - $the_public_dictionary .= '"words":' . $dict['words'] . ','; - $the_public_dictionary .= '"settings":{'; - $the_public_dictionary .= '"partsOfSpeech":"' . $dict['parts_of_speech'] . '",'; - $the_public_dictionary .= '"isComplete":' . (($dict['is_complete'] == 1) ? 'true' : 'false') . '},'; - $the_public_dictionary .= '}'; - } - } - } -} -catch (PDOException $ex) {} - -?> - - - - - - - <?php echo $dictionary_name; ?> Dictionary on Lexiconga - - - - - - - - - - - - -
-
- -
- About Lexiconga -
-
- Go Home -
-
-
- -
-

-

-
- - Hide Description -
- - Hide Search/Filter Options -
-
- -
- - -
-
- Check All / Uncheck All -
-
- -
- -
-
- - - - - -
-
- Dictionary Builder only guaranteed to work with most up-to-date HTML5 browsers. Report a Problem | Terms Privacy -
- - - - - - - - - - - - - - - - - - - From dec8be6dff9a358ca4f45433fb1aba2b2862135f Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Tue, 7 Jun 2016 11:44:36 -0600 Subject: [PATCH 02/26] Edit words in their dictionary position instead of jumping to word form. It's janky, but it works. --- js/dictionaryBuilder.js | 105 ++++++++++++++++++++++++++-------------- js/ui.js | 17 +++---- 2 files changed, 76 insertions(+), 46 deletions(-) diff --git a/js/dictionaryBuilder.js b/js/dictionaryBuilder.js index c6cbad3..7f19dde 100644 --- a/js/dictionaryBuilder.js +++ b/js/dictionaryBuilder.js @@ -34,7 +34,7 @@ function AddWord() { var partOfSpeech = htmlEntities(document.getElementById("partOfSpeech").value).trim(); var simpleDefinition = htmlEntities(document.getElementById("simpleDefinition").value).trim(); var longDefinition = htmlEntities(document.getElementById("longDefinition").value); - var editIndex = htmlEntities(document.getElementById("editIndex").value); + // var editIndex = htmlEntities(document.getElementById("editIndex").value); var errorMessageArea = document.getElementById("errorMessage"); var errorMessage = ""; var updateConflictArea = document.getElementById("updateConflict"); @@ -42,23 +42,7 @@ function AddWord() { if (word != "" && (simpleDefinition != "" || longDefinition != "")) { var wordIndex = (!currentDictionary.settings.allowDuplicates) ? WordIndex(word) : -1; - if (editIndex != "") { - if (WordAtIndexWasChanged(editIndex, word, pronunciation, partOfSpeech, simpleDefinition, longDefinition)) { - document.getElementById("editWordButtonArea").style.display = "none"; - DisableForm(); - updateConflictArea.style.display = "block"; - updateConflictArea.innerHTML = "Do you really want to change the word \"" + currentDictionary.words[parseInt(editIndex)].name + "\" to what you have set above?"; - updateConflictArea.innerHTML += ''; - updateConflictArea.innerHTML += ''; - } else { - errorMessage = "No change has been made to \"" + word + "\""; - if (currentDictionary.words[parseInt(editIndex)].name != word) { - errorMessage += ". (Your dictionary is currently set to ignore case.)" - } - } - } else if (wordIndex >= 0) { + if (wordIndex >= 0) { if (WordAtIndexWasChanged(wordIndex, word, pronunciation, partOfSpeech, simpleDefinition, longDefinition)) { document.getElementById("newWordButtonArea").style.display = "none"; DisableForm(); @@ -74,7 +58,7 @@ function AddWord() { updateConflictText += ''; - updateConflictText += ' '; + updateConflictText += ' '; updateConflictArea.innerHTML = updateConflictText; } else { @@ -107,23 +91,70 @@ function AddWord() { errorMessageArea.innerHTML = errorMessage; } -function EditWord(index) { - SaveScroll(); - if (wordFormIsLocked()) { - window.scroll(0, 0); +function ShowWordEditForm(index) { + var indexString = index.toString(); // Variable for reduced processing + var word = currentDictionary.words[index]; // Reference for easier reading + var editForm = '
\ +

Editing ' + htmlEntitiesParse(word.name) + '

\ + \ + \ + \ + \ + \ + \ +
\ + \ +
\ + \ +
'; + + document.getElementById("entry" + indexString).innerHTML = editForm; + + SetPartsOfSpeech("partOfSpeech" + indexString); +} + +function CancelEditForm(index) { + document.getElementById("entry" + index.toString()).innerHTML = DictionaryEntry(index).replace("", "").replace("", ""); +} + +function EditWord(indexString) { + var word = htmlEntities(document.getElementById("word" + indexString).value).trim(); + var pronunciation = htmlEntities(document.getElementById("pronunciation" + indexString).value).trim(); + var partOfSpeech = htmlEntities(document.getElementById("partOfSpeech" + indexString).value).trim(); + var simpleDefinition = htmlEntities(document.getElementById("simpleDefinition" + indexString).value).trim(); + var longDefinition = htmlEntities(document.getElementById("longDefinition" + indexString).value); + // var editIndex = htmlEntities(document.getElementById("editIndex").value); + var errorMessageArea = document.getElementById("errorMessage" + indexString); + var errorMessage = ""; + var updateConflictArea = document.getElementById("updateConflict" + indexString); + + if (WordAtIndexWasChanged(indexString, word, pronunciation, partOfSpeech, simpleDefinition, longDefinition)) { + document.getElementById("editWordButtonArea" + indexString).style.display = "none"; + DisableForm(); + updateConflictArea.style.display = "block"; + updateConflictArea.innerHTML = "Do you really want to change the word \"" + currentDictionary.words[parseInt(indexString)].name + "\" to what you have set above?"; + updateConflictArea.innerHTML += ''; + updateConflictArea.innerHTML += ''; + } else { + errorMessage = "No change has been made to \"" + word + "\""; + if (currentDictionary.words[parseInt(indexString)].name != word) { + errorMessage += ". (Your dictionary is currently set to ignore case.)"; + } } - ClearForm(); - - document.getElementById("editIndex").value = index.toString(); - document.getElementById("word").value = htmlEntitiesParse(currentDictionary.words[index].name); - document.getElementById("pronunciation").value = htmlEntitiesParse(currentDictionary.words[index].pronunciation); - document.getElementById("partOfSpeech").value = htmlEntitiesParse(currentDictionary.words[index].partOfSpeech); - document.getElementById("simpleDefinition").value = htmlEntitiesParse(currentDictionary.words[index].simpleDefinition); - document.getElementById("longDefinition").value = htmlEntitiesParse(currentDictionary.words[index].longDefinition); - - document.getElementById("newWordButtonArea").style.display = "none"; - document.getElementById("editWordButtonArea").style.display = "block"; + errorMessageArea.innerHTML = errorMessage; } function UpdateWord(wordIndex, word, pronunciation, partOfSpeech, simpleDefinition, longDefinition) { @@ -219,7 +250,7 @@ function ShowDictionary() { function DictionaryEntry(itemIndex) { displayPublic = (typeof displayPublic !== 'undefined' && displayPublic != null) ? displayPublic : false; - var entryText = "🔗"; + var entryText = "🔗"; var searchTerm = regexParseForSearch(document.getElementById("searchBox").value); var searchByWord = document.getElementById("searchOptionWord").checked; @@ -290,7 +321,7 @@ function DictionaryEntry(itemIndex) { function ManagementArea(itemIndex) { var managementHTML = "
"; - managementHTML += "Edit"; + managementHTML += "Edit"; managementHTML += "Delete"; managementHTML += " diff --git a/css/lexiconga.css b/css/lexiconga.css index 4819c6d..37c3df9 100644 --- a/css/lexiconga.css +++ b/css/lexiconga.css @@ -1,13 +1,16 @@ body { - background: #e6cfaa; + background: #ecf0f1; } header { height: 50px; width: 100%; - background: #eacc9d; - margin-bottom: 3px; - border-bottom: 3px solid #e3bb7d; + background: #8e44ad; + margin-bottom: 10px; + border: none; + -webkit-box-shadow: 3px 3px 10px -1px rgba(0,0,0,0.75); + -moz-box-shadow: 3px 3px 10px -1px rgba(0,0,0,0.75); + box-shadow: 3px 3px 10px -1px rgba(0,0,0,0.75); } /* Smartphones (portrait and landscape) ----------- */ @@ -27,8 +30,9 @@ td, th { } a { - text-decoration: underline; - color: #a01000; + text-decoration: none; + color: #2980b9; + font-weight: bold; } #siteLogo { @@ -42,7 +46,7 @@ a { } #aboutButton { - background: #dcb078; + background: #f1c40f; } #loginoutArea { @@ -86,16 +90,19 @@ and (max-device-width : 480px) { } #wordEntryForm { - background: #c05d5d; - border-color: #c08d8d #b00d0d #b00d0d #c08d8d; + background: #e74c3c; + -webkit-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); + -moz-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); + box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); + border: none; } -input, textarea, select, option, button { - background: #efdfc0; +input, textarea, select, option { + background: #ecf0f1; } #announcementArea { - background:#a0c066; + background: #2ecc71; } #notificationArea { @@ -103,20 +110,21 @@ input, textarea, select, option, button { } #dictionaryContainer { - background: #bd7251; + background: #e67e22; padding: 15px; - border: outset; - border-color: #d09b84 #915237 #915237 #d09b84; + border: none; + -webkit-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); + -moz-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); + box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); } -#dictionaryDescription, .management, #settingsOptions, #infoPage, #loadAfterDeletePage, -#accountSettingsPage, #fullScreenTextboxPage { - background: #f2d5b2; +#dictionaryDescription, #settingsOptions, #infoPage, #loadAfterDeletePage, #accountSettingsPage, #fullScreenTextboxPage { + background: #bdc3c7; } .management { border-width: 2px; - border-color: #ebbe87 #f9ecdd #f9ecdd #ebbe87; + border: none; } #dictionaryName { @@ -127,28 +135,30 @@ input, textarea, select, option, button { width: 90%; } -#loginLink, #logoutLink, -#descriptionToggle, #searchFilterToggle, #settingsButton, -.deleteCancelButton, .deleteConfirmButton, -#settingsScreenCloseButton, #infoScreenCloseButton, -.clickable, .helperlink { - background: #e0c19c; +#loginLink, #logoutLink, #descriptionToggle, #searchFilterToggle, #settingsButton, .deleteCancelButton, .deleteConfirmButton, #settingsScreenCloseButton, #infoScreenCloseButton, .clickable, button { + background: #f1c40f; } entry { - background: #d7ad7d; - border-color: #e7cfb3 #c78b47 #c78b47 #e7cfb3; + background: #bdc3c7; + border: none; + -webkit-box-shadow: 3px 3px 10px -1px rgba(0,0,0,0.75); + -moz-box-shadow: 3px 3px 10px -1px rgba(0,0,0,0.75); + box-shadow: 3px 3px 10px -1px rgba(0,0,0,0.75); } .editButton { - background: #89cb89; + background: #2ecc71; } .deleteButton { - background: #cc8888; + background: #e74c3c; } footer { - background: #d69c42; - border-top: 3px solid #e3bb7d; + background: #e67e22; + border: none; + -webkit-box-shadow: 0px -3px 7px -1px rgba(0,0,0,0.75); + -moz-box-shadow: 0px -3px 7px -1px rgba(0,0,0,0.75); + box-shadow: 0px -3px 7px -1px rgba(0,0,0,0.75); } \ No newline at end of file diff --git a/css/styles.css b/css/styles.css index 7408a05..94a1f05 100644 --- a/css/styles.css +++ b/css/styles.css @@ -1,8 +1,8 @@ -body { +body { padding: 0; margin: 0; border: none; - font-family: Georgia, 'Times New Roman', Times, serif; + font-family: "Helvetica", Arial, sans-serif; } contents { @@ -18,7 +18,7 @@ footer { bottom: 0px; left: 0px; background: #aaaaaa; - padding: 6px; + padding: 8px; max-height: 32px; /* Update Dictionary Container's bottom margin to account for footer */ } @@ -72,10 +72,6 @@ label span { font-weight: bold; } -label span .helperlink { - font-size: 10px; -} - label label { margin-left: 20px; } @@ -141,17 +137,19 @@ input[type=checkbox] { #announcementArea, #notificationArea { text-align:center; padding:10px; - border-radius:5px; margin:0 auto; width:50%; min-width:200px; + -webkit-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); + -moz-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); + box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); } #dictionaryContainer { margin: 15px 0 36px 15px; /* bottom margin must clear footer */ width: 60%; min-width: 260px; - max-width: 600px; + max-width: 800px; float: left; } @@ -168,19 +166,24 @@ input[type=checkbox] { margin: 10px; } -.clickable, .helperlink { +.clickable, button { display: inline; font-weight: bold; font-size: 13px; padding: 4px; + border: none; background: #dddddd; - border-radius: 5px; } -.clickable { +.clickable, button { cursor: pointer; } +.inline-button { + font-size: 11px; + padding: 2px 4px; +} + #descriptionToggle, #searchFilterToggle { display: inline-block; margin: 8px; @@ -323,8 +326,8 @@ searchTerm { left: 0; width: 100%; height: 100%; - background: #aaaaaa; - opacity: 0.75; + background: #000000; + opacity: 0.6; } #settingsOptions, #infoPage, #loadAfterDeletePage, @@ -341,8 +344,10 @@ searchTerm { overflow-x: hidden; background: #ffffff; opacity: 1; - border-radius: 5px; - border: 1px solid black; + border: none; + -webkit-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); + -moz-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); + box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); } #announcementCloseButton, #notificationCloseButton, diff --git a/index.php b/index.php index b63e575..464bd46 100644 --- a/index.php +++ b/index.php @@ -115,7 +115,7 @@ if ($is_viewing) { -

?
From b5da178b79f1b9240a17809964c3b6cd468f8b23 Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Tue, 7 Jun 2016 20:31:52 -0600 Subject: [PATCH 04/26] Subdued the colors a bit. --- css/lexiconga.css | 32 ++++++++++++++++---------------- css/styles.css | 8 +++++--- index.php | 6 +++--- 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/css/lexiconga.css b/css/lexiconga.css index 37c3df9..53fc86e 100644 --- a/css/lexiconga.css +++ b/css/lexiconga.css @@ -1,11 +1,11 @@ body { - background: #ecf0f1; + background: #f2c057; } header { height: 50px; width: 100%; - background: #8e44ad; + background: #607aac; margin-bottom: 10px; border: none; -webkit-box-shadow: 3px 3px 10px -1px rgba(0,0,0,0.75); @@ -31,7 +31,7 @@ td, th { a { text-decoration: none; - color: #2980b9; + color: #2d4262; font-weight: bold; } @@ -46,7 +46,6 @@ a { } #aboutButton { - background: #f1c40f; } #loginoutArea { @@ -90,7 +89,7 @@ and (max-device-width : 480px) { } #wordEntryForm { - background: #e74c3c; + background: #ba5536; -webkit-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); -moz-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); @@ -98,19 +97,19 @@ and (max-device-width : 480px) { } input, textarea, select, option { - background: #ecf0f1; + background: #ffeb94; } #announcementArea { - background: #2ecc71; + background: #a2c523; } #notificationArea { - background:#c0c088; + background: #86ac41; } #dictionaryContainer { - background: #e67e22; + background: #cb6318; padding: 15px; border: none; -webkit-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); @@ -118,8 +117,8 @@ input, textarea, select, option { box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); } -#dictionaryDescription, #settingsOptions, #infoPage, #loadAfterDeletePage, #accountSettingsPage, #fullScreenTextboxPage { - background: #bdc3c7; +#settingsOptions, #infoPage, #loadAfterDeletePage, #accountSettingsPage, #fullScreenTextboxPage { + background: #c9a66b; } .management { @@ -133,14 +132,15 @@ input, textarea, select, option { #dictionaryDescription { width: 90%; + background: #f4cc70; } #loginLink, #logoutLink, #descriptionToggle, #searchFilterToggle, #settingsButton, .deleteCancelButton, .deleteConfirmButton, #settingsScreenCloseButton, #infoScreenCloseButton, .clickable, button { - background: #f1c40f; + background: #fbcd4b; } entry { - background: #bdc3c7; + background: #f4cc70; border: none; -webkit-box-shadow: 3px 3px 10px -1px rgba(0,0,0,0.75); -moz-box-shadow: 3px 3px 10px -1px rgba(0,0,0,0.75); @@ -148,15 +148,15 @@ entry { } .editButton { - background: #2ecc71; + background: #86ac41; } .deleteButton { - background: #e74c3c; + background: #ba5536; } footer { - background: #e67e22; + background: #cb6318; border: none; -webkit-box-shadow: 0px -3px 7px -1px rgba(0,0,0,0.75); -moz-box-shadow: 0px -3px 7px -1px rgba(0,0,0,0.75); diff --git a/css/styles.css b/css/styles.css index 94a1f05..f5e59da 100644 --- a/css/styles.css +++ b/css/styles.css @@ -83,7 +83,9 @@ label span.checkboxlabel { input, textarea { display: block; - padding-left: 5px; + padding: 2px 0 2px 5px; + border: none; + margin: 2px 0; } input[type=checkbox] { @@ -162,7 +164,7 @@ input[type=checkbox] { max-height: 400px; overflow-y: auto; padding: 15px; - border: 1px solid #cacaca; + border: none; margin: 10px; } @@ -170,7 +172,7 @@ input[type=checkbox] { display: inline; font-weight: bold; font-size: 13px; - padding: 4px; + padding: 5px; border: none; background: #dddddd; } diff --git a/index.php b/index.php index 464bd46..247d310 100644 --- a/index.php +++ b/index.php @@ -309,12 +309,12 @@ if ($is_viewing) { - ?


@@ -338,7 +338,7 @@ if ($is_viewing) {

Or

- + From f48ca733f9bb1637b38a4067e9d18d99372b8985 Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Wed, 8 Jun 2016 13:30:36 -0600 Subject: [PATCH 05/26] Moved colors back to the originals but kept the shadows and sharp edges. --- css/lexiconga.css | 25 ++++++++++++------------- index.php | 2 +- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/css/lexiconga.css b/css/lexiconga.css index 53fc86e..0adb96b 100644 --- a/css/lexiconga.css +++ b/css/lexiconga.css @@ -1,11 +1,11 @@ body { - background: #f2c057; + background: #e6cfaa; } header { height: 50px; width: 100%; - background: #607aac; + background: #eacc9d; margin-bottom: 10px; border: none; -webkit-box-shadow: 3px 3px 10px -1px rgba(0,0,0,0.75); @@ -30,9 +30,8 @@ td, th { } a { - text-decoration: none; - color: #2d4262; - font-weight: bold; + text-decoration: underline; + color: #a01000; } #siteLogo { @@ -97,19 +96,19 @@ and (max-device-width : 480px) { } input, textarea, select, option { - background: #ffeb94; + background: #efdfc0; } #announcementArea { - background: #a2c523; + background: #a0c066; } #notificationArea { - background: #86ac41; + background: #c0c088; } #dictionaryContainer { - background: #cb6318; + background: #bd7251; padding: 15px; border: none; -webkit-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); @@ -118,7 +117,7 @@ input, textarea, select, option { } #settingsOptions, #infoPage, #loadAfterDeletePage, #accountSettingsPage, #fullScreenTextboxPage { - background: #c9a66b; + background: #f2d5b2; } .management { @@ -132,15 +131,15 @@ input, textarea, select, option { #dictionaryDescription { width: 90%; - background: #f4cc70; + background: #f2d5b2; } #loginLink, #logoutLink, #descriptionToggle, #searchFilterToggle, #settingsButton, .deleteCancelButton, .deleteConfirmButton, #settingsScreenCloseButton, #infoScreenCloseButton, .clickable, button { - background: #fbcd4b; + background: #dcb078; } entry { - background: #f4cc70; + background: #d7ad7d; border: none; -webkit-box-shadow: 3px 3px 10px -1px rgba(0,0,0,0.75); -moz-box-shadow: 3px 3px 10px -1px rgba(0,0,0,0.75); diff --git a/index.php b/index.php index 247d310..c299847 100644 --- a/index.php +++ b/index.php @@ -269,7 +269,7 @@ if ($is_viewing) {

- +
From f4f9f85a308f48a66cad19a3bff36471162cd88a Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Wed, 8 Jun 2016 13:43:58 -0600 Subject: [PATCH 06/26] Trying to add PapaParse for importing CSV files of words, but for some reason it's not recognizing the Papa object. --- IMPORT.form | 20 + PRIVACY.md | 2 +- README.md | 1 + import_test.csv | 4 + index.php | 9 +- js/dictionaryBuilder.js | 34 + js/min/papaparse.js | 6 + js/papaparse.js | 1423 +++++++++++++++++++++++++++++++++++++++ js/ui.js | 1 + 9 files changed, 1495 insertions(+), 5 deletions(-) create mode 100644 IMPORT.form create mode 100644 import_test.csv create mode 100644 js/min/papaparse.js create mode 100644 js/papaparse.js diff --git a/IMPORT.form b/IMPORT.form new file mode 100644 index 0000000..0865165 --- /dev/null +++ b/IMPORT.form @@ -0,0 +1,20 @@ +
+

Import

+
+ +

This process imports words in a CSV format to the currently loaded dictionary. (You can save an Excel file as a CSV)

+

The CSV file must have a header line in this order: word,pronunciation,part of speech,equivalent,explanation. Your words must be formatted in the appropriate order.

+

Make sure the parts of speech for each word correspond to your dictionary's parts of speech or else it will be lost if you edit the word. If a part of speech is left blank, you can find the blanks using the "Blank" option in the Filter.

+

At a minimum, all of your words must have the "word" field and either the "equivalent" or "explanation" field filled out in the CSV file.

+ + + +
+
diff --git a/PRIVACY.md b/PRIVACY.md index 023dcb1..4781b29 100644 --- a/PRIVACY.md +++ b/PRIVACY.md @@ -42,7 +42,7 @@ Some of the ads may be served by Google. Google's use of the DART cookie enables ### Changes to this privacy policy Lexiconga Dictionary Builder has the discretion to update this privacy policy at any time. When we do, we will post a notification on the main page of our Site. We encourage Users to frequently check this page for any changes to stay informed about how we are helping to protect the personal information we collect. You acknowledge and agree that it is your responsibility to review this privacy policy periodically and become aware of modifications. -###Your acceptance of these terms +### Your acceptance of these terms By using this Site, you signify your acceptance of this policy. If you do not agree to this policy, please do not use our Site. Your continued use of the Site following the posting of changes to this policy will be deemed your acceptance of those changes. This policy was originally generated using PrivacyPolicies.com and modified for our use. ### Contacting us diff --git a/README.md b/README.md index dcff8d1..e09956e 100644 --- a/README.md +++ b/README.md @@ -188,4 +188,5 @@ I hope you enjoy Lexiconga and that it helps you build some awesome languages. ## Libraries Used * [Marked.js](https://github.com/chjj/marked) by Christopher Jeffrey (JJ) (a.k.a. chjj) * [Defiant.js](http://defiantjs.com) by Hakan Bilgin (a.k.a. hbi99) +* [Papa Parse](http://papaparse.com/) by Matt Holt (a.k.a. mholt) * [removeDiacritics.js](http://stackoverflow.com/a/18391901/3508346) by [rdllopes](http://meta.stackoverflow.com/users/1879686/rdllopes) diff --git a/import_test.csv b/import_test.csv new file mode 100644 index 0000000..3f809c9 --- /dev/null +++ b/import_test.csv @@ -0,0 +1,4 @@ +word,pronunciation,part of speech,equivalent,explanation +"test","[tehst]","noun","an example, per se!","no explanation required." +"test","[tehst]","verb","to test, i.e. to try to see if something works","no explanation required." +"tested","[tehst-ehd]","adjective","of or relating to an example","no explanation required." diff --git a/index.php b/index.php index c299847..e8069d2 100644 --- a/index.php +++ b/index.php @@ -256,9 +256,7 @@ if ($is_viewing) { 0) { //If logged in, show the log out button. ?> @@ -353,6 +351,8 @@ if ($is_viewing) { + + @@ -367,7 +367,7 @@ if ($is_viewing) { - - + + diff --git a/js/dictionaryBuilder.js b/js/dictionaryBuilder.js index 038e4d1..4d07205 100644 --- a/js/dictionaryBuilder.js +++ b/js/dictionaryBuilder.js @@ -683,19 +683,31 @@ function ImportWords() { var resultsArea = document.getElementById("importOptions"); resultsArea.innerHTML = ""; + var currentRow = 0; // Because of the header, the first row of data is always on line 2. + var rowsImported = 0; + Papa.parse(file, { header: true, step: function(row, parser) { + currentRow++; if (row.errors.length == 0) { - currentDictionary.words.push({name: row.data["word"], pronunciation: row.data["pronunciation"], partOfSpeech: row.data["part of speech"], simpleDefinition: row.data["equivalent"], longDefinition: row.data["explanation"], wordId: currentDictionary.nextWordId++}); - resultsArea.innerHTML += "

Imported \"" + row.data["word"] + " successfully

"; + currentDictionary.words.push({name: htmlEntities(row.data[0]["word"]).trim(), pronunciation: htmlEntities(row.data[0]["pronunciation"]).trim(), partOfSpeech: htmlEntities(row.data[0]["part of speech"]).trim(), simpleDefinition: htmlEntities(row.data[0]["equivalent"]).trim(), longDefinition: htmlEntities(row.data[0]["explanation"]).trim(), wordId: currentDictionary.nextWordId++}); + resultsArea.innerHTML += "

Imported \"" + htmlEntitiesParse(htmlEntities(row.data[0]["word"])).trim() + "\" successfully

"; + rowsImported++; } else { - resultsArea.innerHTML += "

Error on row " + row.error.row + ": " + row.error.message + "

"; + for (var i = 0; i < row.errors.length; i++) { + resultsArea.innerHTML += "

Error on record #" + currentRow.toString() + ": " + row.errors[i].message + "

"; + } } + // Scroll to the bottom. + document.getElementById("importOptions").scrollTop = document.getElementById("importOptions").scrollHeight; }, complete: function(results) { SaveAndUpdateDictionary(); - resultsArea.innerHTML += "

The file has finished importing.

"; + resultsArea.innerHTML += "

The file has finished importing " + rowsImported.toString() + " words.

"; + // Scroll to the bottom. + document.getElementById("importOptions").scrollTop = document.getElementById("importOptions").scrollHeight; + document.getElementById("numberOfWordsInDictionary").innerHTML = currentDictionary.words.length.toString(); } }); } else { From 9deb9087e6147456a7ed1d875e5677a55e3b7f50 Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Fri, 10 Jun 2016 11:35:57 -0700 Subject: [PATCH 08/26] Added filtering by blank part of speech, fixed part of speech dropdown for edits, added import template CSV to download, updated import test to test blank part of speech. --- IMPORT.form | 20 +++++++++++--------- import_test.csv | 10 ++++------ js/dictionaryBuilder.js | 19 ++++++++++++------- js/ui.js | 20 +++++++++++++++++++- 4 files changed, 46 insertions(+), 23 deletions(-) diff --git a/IMPORT.form b/IMPORT.form index 0865165..2671fa1 100644 --- a/IMPORT.form +++ b/IMPORT.form @@ -1,15 +1,17 @@ -
-

Import

-
+

Import

+
+
-

This process imports words in a CSV format to the currently loaded dictionary. (You can save an Excel file as a CSV)

-

The CSV file must have a header line in this order: word,pronunciation,part of speech,equivalent,explanation. Your words must be formatted in the appropriate order.

-

Make sure the parts of speech for each word correspond to your dictionary's parts of speech or else it will be lost if you edit the word. If a part of speech is left blank, you can find the blanks using the "Blank" option in the Filter.

-

At a minimum, all of your words must have the "word" field and either the "equivalent" or "explanation" field filled out in the CSV file.

- - +

This process imports words in a CSV format to the currently loaded dictionary. (Note: You can save an Excel file as a CSV)

+

The CSV file must have a header line in this order: word,pronunciation,part of speech,equivalent,explanation. Your word data must be in the appropriate order according to the headers. You can use this CSV as a template if you need help.

+

Make sure the parts of speech for each word correspond to your dictionary's parts of speech or else you won't be able to find it using a filter. If a part of speech is left blank, you can find the blanks using the "Blank" option in the Filter so you can clean up.

+

At a minimum, all of your words must have the "word" field and either the "equivalent" or "explanation" field filled out in the CSV file.

+ + +
+
\ \
- +
;margin-bottom:10px;"> Close
@@ -142,35 +183,36 @@ if ($is_viewing) {
- + Settings

- +

- HideShow Description -
+ HideShow Description +
blocknone;">
- Hide Search/Filter Options -
+ + Hide Search/Filter Options +
blocknone;">
@@ -178,25 +220,28 @@ if ($is_viewing) {
- + ;"> Check All   - + ;"> Uncheck All
+ -
+
+ document.write(DictionaryEntryTemplate(" . $the_public_word . "));"; } ?> +
- +