Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:ucfopen/UDOIT into issue/492-empty-t…
Browse files Browse the repository at this point in the history
…ables
  • Loading branch information
taheralfayad committed Jul 29, 2024
2 parents 8891ead + e62f3a2 commit 19c9368
Show file tree
Hide file tree
Showing 34 changed files with 1,878 additions and 1,464 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ env:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.2']
node-version: [16.19.0]
steps:
- uses: actions/checkout@v2

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/udoit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.1']
php-versions: ['8.2']
node-version: [16.19.0]
steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.1-fpm
FROM php:8.2-fpm
ARG ENVIRONMENT_TYPE

#Install dependencies and php extensions
Expand Down
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The system requirements depend on how you install UDOIT. If you use Docker, the

### Manual Installation Method
* Apache or Nginx webserver
* PHP 8.1+
* PHP 8.1, 8.2
* MySQL, MariaDB or PostgreSQL
* Git (If you are using The Git Method below) or if you plan on contributing to UDOIT
* Node v16 is supported; other versions may work
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ UDOIT enables faculty to identify accessibility issues in Canvas by Instructure.
UDOIT was originally developed by the University of Central Florida (UCF) in 2014. In 2020, UDOIT was in need of a code refresh and UCF partnered with Cidi Labs to rewrite UDOIT from the ground up.

## Prerequisites
- PHP 8.1+
- PHP 8.1, 8.2
- Symfony
- Composer
- Node v16 is supported; other versions may work
- Yarn
- MYSQL v5.7 / MariaDB
- MYSQL 5.7+ / MariaDB

## Skills Needed for Installation
To complete this installation you will need the following skills:
Expand Down Expand Up @@ -46,7 +46,7 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Primary Contact: Jacob Bates (jacob.bates@ucf.edu)
Primary Contact: Daniel Molares (dm@ucf.edu)

## Supported Languages
UDOIT currently offers support for both English (en) and Spanish (es). This can be configured either across the entire UDOIT instance or for a specific institution.
3 changes: 1 addition & 2 deletions assets/js/Components/Admin/UsersPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ class UsersPage extends React.Component {
.then((responseStr) => responseStr.json())
.then((response) => {
let users = this.state.users
console.log('response', response);
if (response && response.id) {
const ind = users.findIndex((el) => { el.id === response.id })
users[ind] = response
Expand All @@ -183,4 +182,4 @@ class UsersPage extends React.Component {
}
}

export default UsersPage;
export default UsersPage;
32 changes: 27 additions & 5 deletions assets/js/Components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class App extends React.Component {
this.handleIssueSave = this.handleIssueSave.bind(this)
this.handleFileSave = this.handleFileSave.bind(this)
this.handleCourseRescan = this.handleCourseRescan.bind(this)
this.handleFullCourseRescan = this.handleFullCourseRescan.bind(this)
this.handleNewReport = this.handleNewReport.bind(this)
this.resizeFrame = this.resizeFrame.bind(this)
}
Expand All @@ -53,6 +54,7 @@ class App extends React.Component {
navigation={this.state.navigation}
handleNavigation={this.handleNavigation}
handleCourseRescan={this.handleCourseRescan}
handleFullCourseRescan={this.handleFullCourseRescan}
handleModal={this.handleModal} />

{(('welcome' !== this.state.navigation) && ('summary' !== this.state.navigation)) &&
Expand Down Expand Up @@ -148,6 +150,11 @@ class App extends React.Component {
return api.scanCourse(this.settings.course.id)
}

fullRescan() {
let api = new Api(this.settings)
return api.fullRescan(this.settings.course.id)
}

disableReview = () => {
return this.state.syncComplete && !this.state.disableReview
}
Expand All @@ -162,6 +169,16 @@ class App extends React.Component {
this.forceUpdate()
}

handleFullCourseRescan() {
if (this.state.hasNewReport) {
this.setState({ hasNewReport: false, syncComplete: false })
this.fullRescan()
.then((response) => response.json())
.then(this.handleNewReport)
}
this.forceUpdate()
}

handleNewReport(data) {
let report = this.state.report
let hasNewReport = this.state.hasNewReport
Expand All @@ -184,7 +201,6 @@ class App extends React.Component {
});
}
if (data.data && data.data.id) {
console.log('new data', data.data)
report = data.data
hasNewReport = true
}
Expand Down Expand Up @@ -217,14 +233,20 @@ class App extends React.Component {
}

handleIssueSave(newIssue, newReport) {
let { report } = this.state
report = {...report, ...newReport}
const oldReport = this.state.report;

const report = { ...oldReport, ...newReport };

if (report && Array.isArray(report.issues)) {
report.issues = report.issues.map(issue => (issue.id == newIssue.id) ? newIssue : issue)
// Combine backend issues with frontend issue state
report.issues = report.issues.map((issue) => {
if (issue.id === newIssue.id) return newIssue;
const oldIssue = oldReport.issues.find((oldReportIssue) => oldReportIssue.id === issue.id);
return oldIssue !== undefined ? { ...oldIssue, ...issue } : issue;
});
}

this.setState({ report })
this.setState({ report });
}

handleFileSave(newFile, newReport) {
Expand Down
21 changes: 9 additions & 12 deletions assets/js/Components/ContentPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,6 @@ class ContentPage extends React.Component {
}
}

static getDerivedStateFromProps(props, state) {
const stateActiveIssue = state.activeIssue
const propsActiveIssue = stateActiveIssue && props.report.issues[stateActiveIssue.id]
if(propsActiveIssue && propsActiveIssue.status !== stateActiveIssue.status) {
return {
activeIssue: propsActiveIssue
}
}
return null
}

handleSearchTerm = (e, val) => {
this.setState({searchTerm: val, filteredIssues: [], tableSettings: Object.assign({}, this.state.tableSettings, {pageNum: 0})});
}
Expand All @@ -102,9 +91,17 @@ class ContentPage extends React.Component {
}

handleCloseButton = () => {
const newReport = { ...this.props.report };
newReport.issues = newReport.issues.map((issue) => {
issue.recentlyResolved = false;
issue.recentlyUpdated = false;
return issue;
});

this.setState({
report: newReport,
modalOpen: false
})
});
}

handleTrayToggle = (e, val) => {
Expand Down
53 changes: 51 additions & 2 deletions assets/js/Components/FilesModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class FilesModal extends React.Component {
this.handleDropAccept = this.handleDropAccept.bind(this)
this.handleDropReject = this.handleDropReject.bind(this)
this.handleFilePost = this.handleFilePost.bind(this)
this.setAcceptType = this.setAcceptType.bind(this)
}

componentDidUpdate(prevProps, prevState) {
Expand All @@ -59,6 +60,46 @@ class FilesModal extends React.Component {
return -1;
}

setAcceptType(file) {
let accept = []

switch(file.fileType) {
case "doc":
accept = ["doc", "docx"]
break

case "ppt":
accept = ["ppt", "pptx"]
break

case "xls":
accept = ["xls", "xlsx"]
break

default:
accept = file.fileType
break
}

let extension = file.fileName.slice(-4)

switch(extension) {
case "xlsx":
accept = "xlsx"
break

case "pptx":
accept = "pptx"
break

case "docx":
accept = "docx"
break
}

return accept
}

// Handler for the previous and next buttons on the modal
// Will wrap around if the index goes out of bounds
handleFileChange(newIndex) {
Expand All @@ -80,7 +121,8 @@ class FilesModal extends React.Component {
}

render() {
const { activeFile } = this.props
let { activeFile } = this.props
activeFile.acceptType = this.setAcceptType(activeFile)
let activeIndex = this.findActiveIndex()

return (
Expand Down Expand Up @@ -121,7 +163,7 @@ class FilesModal extends React.Component {
<Text display="block" weight="bold">{this.props.t('label.replace')}</Text>
<Text as="p">{this.props.t('label.replace.desc')}</Text>
<FileDrop
accept={activeFile.fileType}
accept={activeFile.acceptType}
onDropAccepted={this.handleDropAccept}
onDropRejected={this.handleDropReject}
renderLabel={
Expand Down Expand Up @@ -207,6 +249,13 @@ class FilesModal extends React.Component {
return
}

if(file.size > 1024 * 1024 * 10) {
this.addMessage({severity: 'error', message: this.props.t('msg.file.replace.file_size'), timeout: 5000})
this.setState({ replaceFileObj: null })
this.forceUpdate()
return
}

this.setState({ replaceFileObj: file })
}

Expand Down
2 changes: 1 addition & 1 deletion assets/js/Components/FilesPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,4 +328,4 @@ class FilesPage extends React.Component {
}
}

export default FilesPage;
export default FilesPage;
6 changes: 2 additions & 4 deletions assets/js/Components/Forms/HeadingEmptyForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,15 @@ export default class HeadingEmptyForm extends React.Component {
if(!this.state.deleteHeader) {
this.checkTextNotEmpty()
}


if (this.formErrors.length > 0) {
this.setState({ textInputErrors: this.formErrors })
}
}

else {
this.setState({ textInputErrors: []})
let issue = this.props.activeIssue
issue.newHtml = this.processHtml()
console.log(issue.newHtml)
this.props.handleIssueSave(issue)
}
}
Expand Down
1 change: 0 additions & 1 deletion assets/js/Components/Forms/TableHeaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export default class TableHeaders extends React.Component {
}

handleSubmit() {
console.log('activeIssue', this.props.activeIssue)
let issue = this.props.activeIssue
issue.newHtml = this.fixHeaders()
this.props.handleIssueSave(issue)
Expand Down
1 change: 1 addition & 0 deletions assets/js/Components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class Header extends React.Component {
{/* <Menu.Item onClick={() => this.handleMoreNav('settings')}>{this.props.t('menu.settings')}</Menu.Item> */}
<Menu.Separator />
<Menu.Item onClick={this.props.handleCourseRescan}>{this.props.t('menu.scan_course')}</Menu.Item>
<Menu.Item onClick={this.props.handleFullCourseRescan}>{this.props.t('menu.full_rescan')}</Menu.Item>
<Menu.Separator />
<Menu.Item href={pdfUrl}>{this.props.t('menu.download_pdf')}</Menu.Item>
</Menu>
Expand Down
16 changes: 16 additions & 0 deletions assets/js/Services/Api.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default class Api {
adminCourses: '/api/admin/courses/account/{account}/term/{term}',
scanContent: '/api/sync/content/{contentItem}',
scanCourse: '/api/sync/{course}',
fullRescan: '/api/sync/rescan/{course}',
scanIssue: '/api/issues/{issue}/scan',
adminReport: '/api/admin/courses/{course}/reports/latest',
adminReportHistory: '/api/admin/reports/account/{account}/term/{term}',
Expand Down Expand Up @@ -233,6 +234,21 @@ export default class Api {
})
}

fullRescan(courseId)
{
const authToken = this.getAuthToken()
let url = `${this.apiUrl}${this.endpoints.fullRescan}`
url = url.replace('{course}', courseId)

return fetch(url, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'X-AUTH-TOKEN': authToken,
},
})
}

scanContent(contentId)
{
const authToken = this.getAuthToken()
Expand Down
2 changes: 0 additions & 2 deletions assets/js/Services/Html.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ export function setInnerText(element, newText) {
const children = element.childNodes
let textNodeFound = false

console.log(children)

children.forEach(node => {
if(node.nodeType === Node.TEXT_NODE) {
if(textNodeFound != true) {
Expand Down
2 changes: 1 addition & 1 deletion assets/js/getInitialData.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function getInitialData() {
data = JSON.parse(settingsElement.textContent)

if (Object.keys(data).length > 0) {
console.log('data', data)
console.log('Data was found and loaded!')
} else {
console.error('No data loaded!')
}
Expand Down
2 changes: 1 addition & 1 deletion build/nginx/Dockerfile.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.1-fpm
FROM php:8.2-fpm

RUN apt-get update -y \
&& apt-get install -y nginx libpng-dev zlib1g-dev git unzip
Expand Down
4 changes: 2 additions & 2 deletions build/nginx/Dockerfile.php.pdo.mysql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM php:8.1-fpm
FROM php:8.2-fpm

# PHP extensions
RUN apt-get update && apt-get install -y libpng-dev zlib1g-dev git unzip
RUN docker-php-ext-install gd pdo pdo_mysql
RUN docker-php-ext-install gd pdo pdo_mysql
Loading

0 comments on commit 19c9368

Please sign in to comment.