gsoc:2009:phdoe

PhD O.E. - Online editor for the PHP Manual

Details

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…

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
    1. success (ExtJsController.getSuccess)
    2. failure (ExtJsController.getFailure)
    3. response (ExtJsController.getResponse)
  • DBConnection created for manipulating database connection
    1. singleton
    2. query (mysqli→query)
    3. insert_id (mysqli→insert_id)
    4. real_escape_string (mysqli→real_escape_string)
  • AccountManager created for manipulating user account
    1. singleton
    2. updateLastConnect
    3. isLogged
    4. login
    5. register
    6. updateConf
    7. eraseData
    8. email
  • VCSFactory created for replacing VCS specific operation
    1. getInstance (obtain VCS client based on config DOC_EDITOR_VCS)
  • CvsClient created for cvs i/o
    1. singleton
    2. passwdEncode
    3. authenticate
    4. checkout
    5. update
    6. log
    7. diff
    8. commit
  • SvnClient created for svn i/o
    1. singleton
    2. authenticate
    3. checkout
    4. update
    5. log
    6. diff
    7. commit
  • RepositoryFetcher created for fetching phpdoc-all repository
    1. singleton
    2. getLastUpdate
    3. getModifies (get all modified files in pending commit)
    4. getModifiesById (get modified files in pending commit queue by id)
    5. getPendingUpdate
    6. getPendingReview
    7. getNotInEn
    8. getPendingPatch
    9. getPendingCommit
    10. getFilesByExtension
    11. getFileByXmlID
    12. getFileByKeyword (perform searching on file-path)
    13. getFilesByDirectory
  • RepositoryManager created for managing phpdoc-all repository
    1. singleton
    2. checkoutRepository (exec cvs checkout, called in install/firstRun.php)
    3. cleanUp
    4. updateRepository (exec cvs update)
    5. checkbuild (exec php configure.php)
    6. addPendingCommit
    7. delPendingCommit
    8. addPendingPatch
    9. addPendingDelete
    10. commitChanges
    11. clearLocalChange
    12. setLastUpdate
    13. postPatchAccept
    14. postPatchReject
    15. updateFileInfo
    16. updateTranslatorInfo
    17. updateNotInEN
    18. applyRevCheck
  • File created for modeling php-doc files
    1. isModified
    2. read (read original/modified file content, depends on passed param & file state)
    3. save
    4. parseAttribute (class.php - revParseAttrString)
    5. getEncoding
    6. getInfo
    7. rawDiff (exec 'diff -uN file file.ext' with stdout output)
    8. htmlDiff (exec php-file-diff with html output)
    9. cvsDiff (exec cvs diff with html output)
  • TranslatorStatistic created for computing statistic about translator
    1. singleton
    2. getTranslators (get info about all translators for lang)
    3. getUptodateFileCount (count up-to-date file contributed by every translator)
    4. getOldFileCount (count out-dated file contributed by every translator)
    5. getCriticalFileCount (count critical file contributed by every translator)
    6. getSummary (summary of the statistic about translators)
  • TranslationStatistic created for computing statistic about translation
    1. singleton
    2. getFileCount (count all file)
    3. getTransFileCount (count translated files for lang)
    4. getOldFileCount (count out-dated files for lang)
    5. getCriticalFileCount (count critical files for lang)
    6. getNoTransFileCount (count not translated files for lang)
    7. getMissedFileCount (count not translated files for lang TODO… merge with getNoTransFileCount)
    8. getNoTagFileCount (count files with no revcheck tag for lang)
    9. getSummary (summary of the statistic about translation)
  • LogManager created for handling all logging activities
    1. singleton
    2. getCommitLog
    3. addCommitLog
    4. saveOutputLog
    5. readOutputLog
    6. saveBuildLogStatus
    7. getBuildLogStatus
  • Utility (a namespace) created for different utility task
    1. 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

Concerns

  • Is wymeditor support doc-book xml ↔ html mapping and additional element for its parser?
gsoc/2009/phdoe.txt · Last modified: 2011/04/17 11:28 by mrkschan