PhD O.E. - Online editor for the PHP Manual
The original application is http://socghop.appspot.com/student_project/show/google/gsoc2009/php/t124024180468
The original proposal is http://mrkschan.blogspot.com/2009/04/my-gsoc-proposal-submitted-to-phpnet.html
Details
- Student: KS Chan
- Mentor: Yannick Torrès
- Timezone: GMT +08:00
- Mailing list: phpdoc@lists.php.net
- Live at: https://edit.php.net
Abstract
Currently, the documentation work is synchronized by cvs. But still, there are potential conflicts due to redundant work. Besides, it's not that easy to share the works or even pipelining the works in a distributed environment. Therefore, a centralized environment is introduced.
The editor is still under development and the source can be found by http://svn.php.net/viewvc/web/doc-editor/trunk/
To checkout: svn co http://svn.php.net/repository/web/doc-editor/trunk doc-editor
Timeline
The Planned one...
- Community Bonding Period - Study current PhD OE architecture. Confirm refactoring procedures and exact deliverables with mentor.
- May 23 ~ June 20 [around 4 man week] - Refactor & Test main.js
- June 20 ~ June 27 [around 1 man week] - Merge Refactored code with trunk + Testing + Documentation
- June 27 ~ July 4 [around 1 man week] - Compile interim report
- July 4 ~ July 18 [around 3 man week] - Refactor & Test class.php
- July 18 ~ July 25 [around 1 man week] - Merge Refactored code with trunk + Testing + Documentation
- July 25 ~ August 15 [around 3 man week] - Implement mod_rewrite, reflect changes in php and js + Testing + Documentation
- August 15 onwards - Compiling final report
The Executing one...
- May 16 - I started looking at the main.js for a study into the main.js.
- May 18 - I was fooled by a bug during abstraction of XHR in main.js. Read the story at http://mrkschan.blogspot.com/2009/05/my-gsoc2009-may-18.html.
- May 24 - I completed the XHR abstraction and reflected changes accordingly. Read the story at http://mrkschan.blogspot.com/2009/05/my-gsoc2009-may-24.html.
- May 31 - I caught a bug during refactoring. Read the story at http://mrkschan.blogspot.com/2009/05/my-gsoc2009-may-31.html. I'm having discussion with Yannick on howto make the code looks good while keep it works.
- June 11 - This morning, I was trying to refactor all code-mirror editor into a reusable component. In the process, I need to allow editor scroll-synchronization ... Read the story at http://mrkschan.blogspot.com/2009/06/my-gsoc2009-june-11.html
- June 21 - It's a GDay! The refactoring work is close to finish... The next task is to complete the rest and wrapping up. Read the story at http://mrkschan.blogspot.com/2009/06/my-gsoc2009-june-21.html
- July 03 - The first milestone is reached =] JS namespace is clear and going to work on the second milestone. Read the story at http://mrkschan.blogspot.com/2009/07/my-gsoc2009-july-03.html
- July 24 - Php files are factored, going to complete a SvnClient for the svn-migration ... Read the story at http://mrkschan.blogspot.com/2009/07/my-gsoc2009-july-24.html
- July 28 - cvs2svn is somehow EVIL!!! I'm digging into how svn authenticate from the Http / WebDav perspective ... Read the story at http://mrkschan.blogspot.com/2009/07/my-gsoc2009-july-28.html
- July 29 - a script is written to simulate “cvs-login” operation with subversion~ Read the story at http://mrkschan.blogspot.com/2009/07/my-gsoc2009-july-29.html
- August 5 - SvnClient has been implemented and testing are made. However, problems still remain. Read section “cvs2svn” in http://svn.php.net/viewvc/web/doc-editor/trunk/TODO?revision=286827&view=markup
- August 13 - I completed the tasks list on my gsoc proposal :p But still... I'm going to keep working on doc-editor ^^ Story at http://mrkschan.blogspot.com/2009/08/my-gsoc2009-august-13.html
UI Structure
The factored Doc-Editor ui structure as follow (in JSON with ExtJS component).
ui = Ext.Viewport { layout : 'border', items : [ { // logo region : 'north' }, { layout : 'accordion', region : 'west', tbar : [ new ui.component.MainMenu() ] items : [ ui.component.StaleFileGrid.getInstance(), ui.component.ErrorFileGrid.getInstance(), ui.component.PendingReviewGrid.getInstance(), ui.component.NotInENGrid.getInstance(), ui.component.RepositoryTree.getInstance(), ui.component.PendingCommitGrid.getInstance(), ui.component.PendingPatchGrid.getInstance() ] }, { // main-panel id : 'main-panel', region : 'center', xtype : 'tabpanel', items : [ { // Home tab xtype : 'panel', items : [ ui.component.SummaryGrid.getInstance(), // show if Non-EN user ui.component.TranslatorGrid.getInstance(), // show if Non-EN user ui.component.LocalMailGrid.getInstance(), ui.component.BugsGrid.getInstance(), // show if Non-EN user ui.component.TranslationGraph.getInstance() // show if Non-EN user ] } ] } ] }
Factored Php Classes
- JsonResponseBuilder (utility class) created for constructing json responses
- success (ExtJsController.getSuccess)
- failure (ExtJsController.getFailure)
- response (ExtJsController.getResponse)
- DBConnection created for manipulating database connection
- singleton
- query (mysqli->query)
- insert_id (mysqli->insert_id)
- real_escape_string (mysqli->real_escape_string)
- AccountManager created for manipulating user account
- singleton
- updateLastConnect
- isLogged
- login
- register
- updateConf
- eraseData
- email
- VCSFactory created for replacing VCS specific operation
- getInstance (obtain VCS client based on config DOC_EDITOR_VCS)
- CvsClient created for cvs i/o
- singleton
- passwdEncode
- authenticate
- checkout
- update
- log
- diff
- commit
- SvnClient created for svn i/o
- singleton
- authenticate
- checkout
- update
- log
- diff
- commit
- RepositoryFetcher created for fetching phpdoc-all repository
- singleton
- getLastUpdate
- getModifies (get all modified files in pending commit)
- getModifiesById (get modified files in pending commit queue by id)
- getPendingUpdate
- getPendingReview
- getNotInEn
- getPendingPatch
- getPendingCommit
- getFilesByExtension
- getFileByXmlID
- getFileByKeyword (perform searching on file-path)
- getFilesByDirectory
- RepositoryManager created for managing phpdoc-all repository
- singleton
- checkoutRepository (exec cvs checkout, called in install/firstRun.php)
- cleanUp
- updateRepository (exec cvs update)
- checkbuild (exec php configure.php)
- addPendingCommit
- delPendingCommit
- addPendingPatch
- addPendingDelete
- commitChanges
- clearLocalChange
- setLastUpdate
- postPatchAccept
- postPatchReject
- updateFileInfo
- updateTranslatorInfo
- updateNotInEN
- applyRevCheck
- File created for modeling php-doc files
- isModified
- read (read original/modified file content, depends on passed param & file state)
- save
- parseAttribute (class.php - revParseAttrString)
- getEncoding
- getInfo
- rawDiff (exec 'diff -uN file file.ext' with stdout output)
- htmlDiff (exec php-file-diff with html output)
- cvsDiff (exec cvs diff with html output)
- TranslatorStatistic created for computing statistic about translator
- singleton
- getTranslators (get info about all translators for lang)
- getUptodateFileCount (count up-to-date file contributed by every translator)
- getOldFileCount (count out-dated file contributed by every translator)
- getCriticalFileCount (count critical file contributed by every translator)
- getSummary (summary of the statistic about translators)
- TranslationStatistic created for computing statistic about translation
- singleton
- getFileCount (count all file)
- getTransFileCount (count translated files for lang)
- getOldFileCount (count out-dated files for lang)
- getCriticalFileCount (count critical files for lang)
- getNoTransFileCount (count not translated files for lang)
- getMissedFileCount (count not translated files for lang TODO... merge with getNoTransFileCount)
- getNoTagFileCount (count files with no revcheck tag for lang)
- getSummary (summary of the statistic about translation)
- LogManager created for handling all logging activities
- singleton
- getCommitLog
- addCommitLog
- saveOutputLog
- readOutputLog
- saveBuildLogStatus
- getBuildLogStatus
- Utility (a namespace) created for different utility task
- debug (*NOTE: under global namespace)
Brainstorming idea
This section list out ideas for future development.
Further re-structuring the entire thing
Ideas
- Create a core module /core, replacing the /php and /js. The core module basically include glues.
- There will be a folder containing all the available modules ... /module-available.
- The core will look for modules from /module-enabled. Modules inside /module-enabled are soft link (or clone) from /module-available.
- /module-available contains the modules available to be used, like /module-available/mod_patch. In each of the module folders... there will be something like /module-available/mod_patch/{view.js, model.sql, controller.php}.
- Core will basically glue (concat) controller.php under /module-enabled/{all}/, and it also glues view.js for the ui
- Installer will become a script that glues the model.sql under /module-enabled/{all}/.
- ui module naming convention? mod-{module_name}-what?
Concerns
- How to handle inter-module interaction? Using central registry?
- For UI, may try having a central registry that register module
- any interaction will be passed through this single agent
- event listener could be used in case for interaction
- if interaction beyond this scope ... may try returning js from XHR that would invoke appropriate handler
WYSIWYG doc-book edit
Ideas
- we may try using http://www.wymeditor.org/. In one of it's demo http://files.wymeditor.org/wymeditor/trunk/src/examples/15-rdfa-editor.html#, the wymeditor parse a RDF for display
- we may supply doc-book elements and attributes, providing appropriate CSS. Plus, doc-book xml <-> html mapping
Concerns
- Is wymeditor support doc-book xml <-> html mapping and additional element for its parser?