From c1e98dc7c60ae4b6d5342a4dffecf76b58df9e22 Mon Sep 17 00:00:00 2001 From: Artem Osmakov Date: Wed, 26 Jun 2019 23:22:46 +0400 Subject: [PATCH] Web site generator --- admin/setup/website/websiteStarterRecords.hml | 1 + .../setup/website/websiteStarterRecords2.hml | 249 ++++++++ admin/structure/terms/editTerms.php | 42 +- h4styles.css | 46 +- hclient/core/hapi.js | 2 +- hclient/core/utils_ui.js | 17 +- hclient/widgets/dropdownmenus/mainMenu.js | 15 +- .../dropdownmenus/mainMenuWebsite.html | 50 ++ hclient/widgets/editing/editCMS.html | 38 ++ hclient/widgets/editing/editCMS.js | 590 ++++++++++++++++++ hclient/widgets/entity/manageRecords.js | 12 - hclient/widgets/search/search.js | 2 +- hsapi/consts.php | 13 +- hsapi/entity/dbDefRecTypes.php | 1 + hsapi/import/importHeurist.php | 13 +- import/utilities/importRecords.js | 4 +- index.php | 1 + redirects/resolver.php | 5 + viewers/map/mapDocument.js | 29 +- viewers/map/mapManager.js | 6 +- viewers/map/map_leaflet.php | 52 +- viewers/record/websiteRecord.php | 236 +++++++ 22 files changed, 1304 insertions(+), 120 deletions(-) create mode 100644 admin/setup/website/websiteStarterRecords2.hml create mode 100644 hclient/widgets/dropdownmenus/mainMenuWebsite.html create mode 100644 hclient/widgets/editing/editCMS.html create mode 100644 hclient/widgets/editing/editCMS.js create mode 100644 viewers/record/websiteRecord.php diff --git a/admin/setup/website/websiteStarterRecords.hml b/admin/setup/website/websiteStarterRecords.hml index 216d65b69..ad2b99a91 100644 --- a/admin/setup/website/websiteStarterRecords.hml +++ b/admin/setup/website/websiteStarterRecords.hml @@ -1,3 +1,4 @@ + Heurist_Construction_Zone diff --git a/admin/setup/website/websiteStarterRecords2.hml b/admin/setup/website/websiteStarterRecords2.hml new file mode 100644 index 000000000..31b54756e --- /dev/null +++ b/admin/setup/website/websiteStarterRecords2.hml @@ -0,0 +1,249 @@ + + +Heurist_Construction_Zone + +2019-06-25T16:40:41+00:00 +13 + + +99 +https://heuristplus.sydney.edu.au/h5-ao/?recID=5&db=Heurist_Construction_Zone +5 +CMS_Home +HOMEPAGE: Heurist CMS website for #Database Name# [ About, Project Team, Database search ] +2019-01-11 11:17:39 +2019-03-24 11:06:04 +public +Heurist CMS website for #Database Name# +Enter a concise description of the Heurist database / website here, which will be used eg. in lists of websites and in search engine discovery. + +Remember to indicate the institution and/or project, target audience and nature of the content. +<h2>Heading here</h2> +<p>This text is displayed as content of the <strong>home page</strong> generated by this Heurist database and should be edited to create an appropriate homepage.</p> +<p>It may embed images and dynamic components such as facet searches, maps and reports - please see <a href="context_help/website_instructions.html">Heurist website instructions</a> for information (hold down Ctrl or Cmd and click the link to open).</p> + + +polygon +POLYGON((94.72655415534973 -48.144845555263345,94.72655415534973 8.873109977458789,-178.78907084465027 8.873109977458789,-178.78907084465027 -48.144845555263345,94.72655415534973 -48.144845555263345)) + + + + +1 +9988a5549b115d7200781ab06112135bbd9b550e +Health-8.png +image/png +2 +2019-01-11 10:55:05 +https://heuristplus.sydney.edu.au/h5-ao/?db=Heurist_Construction_Zone&file=9988a5549b115d7200781ab06112135bbd9b550e + + +6 +7 +9 +Banner on all pages +Digital Humanities, Heurist, Research, Database, Open Data, + + +99 +https://heuristplus.sydney.edu.au/h5-ao/?recID=6&db=Heurist_Construction_Zone +6 +CMS Menu Entry +Menu: About [ Page: About ] +2019-01-11 11:18:30 +2019-03-24 10:52:22 +public +About +The About page connected to this menu entry describes the project. Please edit the content and supply a project description. +15 +5 + + +99 +https://heuristplus.sydney.edu.au/h5-ao/?recID=9&db=Heurist_Construction_Zone +9 +CMS Menu Entry +Menu: Database search [ Page: Facet searches ] +2019-01-11 11:31:45 +2019-01-12 00:03:06 +public +Database search +Search functions to search the database represented by/in this website +10 +5 + + +99 +https://heuristplus.sydney.edu.au/h5-ao/?recID=8&db=Heurist_Construction_Zone +8 +CMS Menu Entry +Menu: Directors [ Page: Directors ] +2019-01-11 11:25:10 +2019-01-12 00:04:37 +public +Directors +The directors and management staff of the project +16 +7 + + +99 +https://heuristplus.sydney.edu.au/h5-ao/?recID=7&db=Heurist_Construction_Zone +7 +CMS Menu Entry +Menu: Project Team [ Page: Project team ] -:- Directors, Staff, Volunteers +2019-01-11 11:23:47 +2019-03-24 11:58:22 +public +Project Team +A page about members of the team involved in the project. +8 +18 +19 +14 +5 + + +99 +https://heuristplus.sydney.edu.au/h5-ao/?recID=18&db=Heurist_Construction_Zone +18 +CMS Menu Entry +Menu: Staff [ Page: Staff ] +2019-01-11 13:07:12 +2019-01-12 00:07:23 +public +Staff +12 +7 + + +99 +https://heuristplus.sydney.edu.au/h5-ao/?recID=19&db=Heurist_Construction_Zone +19 +CMS Menu Entry +Menu: Volunteers [ Page: Volunteers ] +2019-01-11 13:07:28 +2019-01-12 00:07:47 +public +Volunteers +13 +7 + + +99 +https://heuristplus.sydney.edu.au/h5-ao/?recID=15&db=Heurist_Construction_Zone +15 +CMS Web Page +Page: About +2019-01-11 12:59:19 +2019-06-13 15:13:38 +public +About +<h3>About the Project</h3> +<p>Populate this page with information about the project. Embed images as instructed in the page editing form under Embedded Media.</p> +<p>Embed images as instructed in the page editing form under Embedded Media.</p> +<p>Please see <a href="context_help/website_instructions.html">Heurist website instructions</a> for further information on how to embed images (hold down Ctrl or Cmd and click the link to open).</p> +<p> </p> +6 + + +99 +https://heuristplus.sydney.edu.au/h5-ao/?recID=16&db=Heurist_Construction_Zone +16 +CMS Web Page +Page: Directors +2019-01-11 13:03:20 +2019-06-13 15:13:16 +public +Directors +<h3>Project Directors</h3> +<p>Populate this field with the content of the page describing Directors of the project.</p> +<p>Embed images as instructed in the page editing form under Embedded Media.</p> +<p>Please see <a href="context_help/website_instructions.html">Heurist website instructions</a> for further information on how to embed images (hold down Ctrl or Cmd and click the link to open).</p> +<p> </p> +8 + + +99 +https://heuristplus.sydney.edu.au/h5-ao/?recID=10&db=Heurist_Construction_Zone +10 +CMS Web Page +Page: Facet searches +2019-01-11 11:34:56 +2019-06-13 15:08:36 +public +Facet searches +<p>[[image,100,100]] Embed some facet searches in this page - get the URL by right-clicking on a facet search in the filter tree on the left of the main interface. Note that the path to the Heurist function will be stripped out so that the function will always use the same version of the code as the one running the website.</p> +<h3>Facet searches:</h3> +<p>https://heuristplus.sydney.edu.au/HEURIST/h5-ao/?db=Heurist_Construction_Zone&amp;ll=WebSearch&amp;views=list,map&amp;searchIDs=31</p> +2 + + +2 +76f9d491a8c5e83270a9248fc077df7efe795cc9 +Content-40.png +image/png +1 +2019-01-11 11:43:13 +https://heuristplus.sydney.edu.au/h5-ao/?db=Heurist_Construction_Zone&file=76f9d491a8c5e83270a9248fc077df7efe795cc9 + + +9 + + +99 +https://heuristplus.sydney.edu.au/h5-ao/?recID=14&db=Heurist_Construction_Zone +14 +CMS Web Page +Page: Project team +2019-01-11 12:38:06 +2019-06-13 15:09:40 +public +Project team +A Heurist web page listing members of the project team. +<h2>Project team</h2> +<p>Please edit this page to add photos and descriptions of your project team.</p> +<p>Additional menu entries can link to pages describing different sets of people, eg. Directors, Staff, Volunteers.</p> +<p>Embed images as instructed in the page editing form under Embedded Media.</p> +<p>Please see <a href="context_help/website_instructions.html">Heurist website instructions</a> for further information on how to embed images (hold down Ctrl or Cmd and click the link to open).</p> +<p> </p> +Research team, People, Database, Heurist, Humanities, Digital Humanities, +7 + + +99 +https://heuristplus.sydney.edu.au/h5-ao/?recID=12&db=Heurist_Construction_Zone +12 +CMS Web Page +Page: Staff +2019-01-11 12:24:45 +2019-06-13 15:14:34 +public +Staff +<h3>Project Staff</h3> +<p>Enter description of the staff of the project on this page</p> +<p>Embed images as instructed in the page editing form under Embedded Media.</p> +<p>Please see <a href="context_help/website_instructions.html">Heurist website instructions</a> for further information on how to embed images (hold down Ctrl or Cmd and click the link to open).</p> +<p> </p> +18 + + +99 +https://heuristplus.sydney.edu.au/h5-ao/?recID=13&db=Heurist_Construction_Zone +13 +CMS Web Page +Page: Volunteers +2019-01-11 12:25:15 +2019-06-13 15:15:09 +public +Volunteers +<h3>Project Volunteers</h3> +<p>Enter the list of volunteers on this page</p> +<p>Embed images as instructed in the page editing form under Embedded Media.</p> +<p>Please see <a href="context_help/website_instructions.html">Heurist website instructions</a> for further information on how to embed images (hold down Ctrl or Cmd and click the link to open).</p> +<p> </p> +19 + + +13 + diff --git a/admin/structure/terms/editTerms.php b/admin/structure/terms/editTerms.php index 4e0fe00b5..39b69ba3e 100644 --- a/admin/structure/terms/editTerms.php +++ b/admin/structure/terms/editTerms.php @@ -62,6 +62,9 @@ .save-disabled, #btnSave.save-disabled:hover{ color:lightgray !important; } + span.fancytree-node{ + font-weight:bold !important; + } /* it allows scroll on DnD */ ul.fancytree-container { @@ -77,49 +80,10 @@ background-color: rgb(142, 169, 185); } */ - span.fancytree-node, - span.fancytree-title, - div.svs-contextmenu3 > span.ui-icon{ - vertical-align:bottom; - padding-left:2px; - } - div.svs-contextmenu3{ - cursor:pointer; - position:absolute; - right:5px; - /*min-width: 80px;*/ - /* - color: white !important; - visibility: hidden; - float:right; - padding-left:10px; - */ - padding:3px; - display:none; - background:white; - color:#95A7B7; - border-radius:2px; - } - span.fancytree-node{ - min-width: 300px; - padding:2px !important; - } #term_tree{ background:none; border:none; } - span.fancytree-node { - border: none !important; - font-weight:bold !important; - display: block; - width:100%; - } - - span.fancytree-node.fancytree-active{ - background: #95A7B7 !important; - color: white !important; - } - /* width":"100%","height":"100% diff --git a/h4styles.css b/h4styles.css index 69d7732f6..6afdfd560 100644 --- a/h4styles.css +++ b/h4styles.css @@ -1275,6 +1275,50 @@ div > .svs-contextmenu { float:right; } + + span.fancytree-node, + span.fancytree-title, + div.svs-contextmenu3 > span.ui-icon{ + vertical-align:bottom; + padding-left:2px; + } + div.svs-contextmenu3{ + cursor:pointer; + position:absolute; + right:5px; + margin: 1px; + padding: 2 2 0 2; + display:none; + background:white; + color:#95A7B7; + border-radius:2px; + } + span.fancytree-node{ + min-width: 300px; + padding:2px !important; + border: none !important; + display: block; + width:100%; + } + span.fancytree-node.fancytree-active{ + background: #95A7B7 !important; + color: white !important; + } + div.svs-contextmenu4{ + cursor:pointer; + position:absolute; + right:7px; + width: 16; + height: 16; + margin-top: -16; + display: none; + background-position: 0 0; + background-image: url(external/jquery.fancytree/skin-themeroller/loading.gif); + } + + + + /* ::-webkit-scrollbar-button { background: #8ea9b9 @@ -1325,7 +1369,7 @@ background: #8ea9b9 padding: 1em 1em .3em .4em; } -.ent_wrapper{position:absolute; top:0;bottom:0;left:0;right:1px; overflow:hidden} +.ent_wrapper{position:absolute;top:0;bottom:0;left:0;right:1px;overflow:hidden;} .ent_header, .ent_footer, .ent_content, .ent_content_full{position:absolute; left:0; right:1px;} .ent_header{top:0;height:2.2em; padding:0.2em 0.5em;} /* border-bottom:lightgray solid 1px; background-color:#faa;, .ent_content_full*/ .ent_content{top:2.8em;bottom:3.5em; overflow-y:auto;} diff --git a/hclient/core/hapi.js b/hclient/core/hapi.js index 584bf0077..71905add7 100644 --- a/hclient/core/hapi.js +++ b/hclient/core/hapi.js @@ -1175,7 +1175,7 @@ prof =Profile if(!(lt=='Beyond1914' || lt=='UAdelaide' || lt=='DigitalHarlem' || lt=='DigitalHarlem1935' || lt=='WebSearch' )){ - window.hWin.HEURIST4.ui.onInactiveStart(300000, function(){ //5 minutes + window.hWin.HEURIST4.ui.onInactiveStart(5000, function(){ //300000 5 minutes //check that still logged in window.hWin.HAPI4.SystemMgr.verify_credentials(function(){ //ok we are still loggen in diff --git a/hclient/core/utils_ui.js b/hclient/core/utils_ui.js index 7c1e8f596..30efc8acc 100644 --- a/hclient/core/utils_ui.js +++ b/hclient/core/utils_ui.js @@ -1759,8 +1759,11 @@ window.hWin.HEURIST4.ui = { // // important manageRecords.js and selectRecords.js must be loaded - // if callback is defined it returns added/edited record as recordset - // + // + // rec_ID - record to edit + // query_request - returns set of records that can be edit in bunch (next/prev buttons) + // popup_options['onselect'] - define function that accepts added/edited record as recordset + // openRecordEdit:function(rec_ID, query_request, popup_options){ /* @@ -2371,6 +2374,14 @@ window.hWin.HEURIST4.ui = { //todo optionally load dynamically editSymbology.js editSymbology(current_value, needName, callback); }, + + // + // show record action dialog + // + showEditCMSDialog: function( home_page_record_id, main_callback ){ + //todo optionally load dynamically editCMS.js + editCMS( home_page_record_id, main_callback ); + }, // // show record action dialog @@ -2628,6 +2639,8 @@ window.hWin.HEURIST4.ui = { // // onInactiveStart: function(ms, cb){ + return; //DISABLED + if(!window.hWin.HEURIST4.ui.wait_timeout){ if(!isNaN(ms) && Number(ms)>0){ window.hWin.HEURIST4.wait_terminated = false; diff --git a/hclient/widgets/dropdownmenus/mainMenu.js b/hclient/widgets/dropdownmenus/mainMenu.js index 159a8574e..72f4e0fa9 100644 --- a/hclient/widgets/dropdownmenus/mainMenu.js +++ b/hclient/widgets/dropdownmenus/mainMenu.js @@ -184,6 +184,7 @@ $.widget( "heurist.mainMenu", { if(__include('Structure')) this._initMenu('Structure', 0); if(__include('Verify')) this._initMenu('Verify', 0); if(__include('Import')) this._initMenu('Import', 0); + if(__include('Website')) this._initMenu('Website', 0); if(__include('Export')) { this._initMenu('Export', 2, null, 3); //invisible in main menu //this.menues['btn_Export'].hide(); @@ -466,7 +467,7 @@ console.log('>>>>'+that.divProfileItems.find('.ui-menu-item').css('padding-left' .load( window.hWin.HAPI4.baseURL+'hclient/widgets/dropdownmenus/mainMenu'+name+'.html', function(){ //add ?t=+(new Date().getTime()) to avoid cache in devtime - + that.menues['menu_'+name].find('.list-menu-only').hide(); that.menues['menu_'+name].addClass('menu-or-popup') @@ -652,6 +653,16 @@ console.log('>>>>'+that.divProfileItems.find('.ui-menu-item').css('padding-left' } }); + }else + if(action == "menu-cms-create"){ + + window.hWin.HEURIST4.ui.showEditCMSDialog( -1 ); + + }else + if(action == "menu-cms-edit"){ + + window.hWin.HEURIST4.ui.showEditCMSDialog( 1283 ); + }else if(action == "menu-database-properties"){ @@ -952,7 +963,7 @@ console.log('>>>>'+that.divProfileItems.find('.ui-menu-item').css('padding-left' prefs['userCompetencyLevel'] = window.hWin.HAPI4.get_prefs_def('userCompetencyLevel', 2); prefs['searchQueryInBrowser'] = window.hWin.HAPI4.get_prefs_def('searchQueryInBrowser', 1); prefs['mapcluster_on'] = window.hWin.HAPI4.get_prefs_def('mapcluster_on', 1); - + prefs['entity_btn_on'] = window.hWin.HAPI4.get_prefs_def('entity_btn_on', 1); var map_controls = window.hWin.HAPI4.get_prefs_def('mapcontrols', 'bookmark,geocoder,selector,print,publish'); map_controls = map_controls.split(','); diff --git a/hclient/widgets/dropdownmenus/mainMenuWebsite.html b/hclient/widgets/dropdownmenus/mainMenuWebsite.html new file mode 100644 index 000000000..79dac9ddd --- /dev/null +++ b/hclient/widgets/dropdownmenus/mainMenuWebsite.html @@ -0,0 +1,50 @@ + + +
  • + + Create +
  • + +
  • + + Edit +
  • + +
  • + + URL + +
  • diff --git a/hclient/widgets/editing/editCMS.html b/hclient/widgets/editing/editCMS.html new file mode 100644 index 000000000..4528f9039 --- /dev/null +++ b/hclient/widgets/editing/editCMS.html @@ -0,0 +1,38 @@ +
    +
    + +
    +
    +
    +
    +
    +
    +
    + +
    + +
    + The title of the website, will appear in browser toolbar, specify the name of the current database with #Database Name# +
    +
    + +
    +
    + +
    + +
    + Style of website +
    +
    +
    +
    Edit Home Page
    +
    Refresh
    +
    +
    +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/hclient/widgets/editing/editCMS.js b/hclient/widgets/editing/editCMS.js new file mode 100644 index 000000000..88f3febbc --- /dev/null +++ b/hclient/widgets/editing/editCMS.js @@ -0,0 +1,590 @@ +/* +* editCMS.js - edit map symbol properties +* +* @package Heurist academic knowledge management system +* @link http://HeuristNetwork.org +* @copyright (C) 2005-2019 University of Sydney +* @author Artem Osmakov +* @license http://www.gnu.org/licenses/gpl-3.0.txt GNU License 3.0 +* @version 4.0 +*/ + +/* +* Licensed under the GNU License, Version 3.0 (the "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at http://www.gnu.org/licenses/gpl-3.0.txt +* Unless required by applicable law or agreed to in writing, software distributed under the License is +* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied +* See the License for the specific language governing permissions and limitations under the License. +*/ + +function editCMS(home_page_record_id, main_callback){ + + var RT_CMS_HOME = window.hWin.HAPI4.sysinfo['dbconst']['RT_CMS_HOME'], + RT_CMS_MENU = window.hWin.HAPI4.sysinfo['dbconst']['RT_CMS_MENU'], + RT_CMS_PAGE = window.hWin.HAPI4.sysinfo['dbconst']['RT_CMS_PAGE'], + DT_CMS_TOP_MENU = window.hWin.HAPI4.sysinfo['dbconst']['DT_CMS_TOP_MENU'], + DT_CMS_MENU = window.hWin.HAPI4.sysinfo['dbconst']['DT_CMS_MENU'], + DT_CMS_PAGE = window.hWin.HAPI4.sysinfo['dbconst']['DT_CMS_PAGE'], + DT_NAME = window.hWin.HAPI4.sysinfo['dbconst']['DT_NAME']; + + if(!(RT_CMS_HOME>0 && RT_CMS_MENU>0 && RT_CMS_PAGE>0 && DT_CMS_TOP_MENU>0 && DT_CMS_MENU>0 && DT_CMS_PAGE>0)){ + window.hWin.HEURIST4.msg.showMsgDlg('This function is still in development. You will need record types ' + +'99-51, 99-52 and 99-53 which will be made available as part of Heurist_Reference_Set. ' + +'You may contact ian.johnson@sydney.edu.au if you want to test out this function prior to release in mid July 2019.'); + return; + } + + var edit_dialog = null; + + var popup_dlg = $('#heurist-dialog-editCMS'); + + if(popup_dlg.length>0){ + popup_dlg.empty(); + }else{ + popup_dlg = $('
    ') + .appendTo( $(window.hWin.document).find('body') ); + } + + var edit_buttons = [ + {text:window.hWin.HR('Cancel'), + id:'btnRecCancel', + css:{'float':'right'}, + click: function() { + edit_dialog.dialog('close'); + }}, + {text:window.hWin.HR('Save'), + id:'btnRecSave', + css:{'visibility':'hidden', 'float':'right'}, + click: function() { + /* + var res = _editing_symbology.getValues(); //all values + //remove empty values + var propNames = Object.getOwnPropertyNames(res); + for (var i = 0; i < propNames.length; i++) { + var propName = propNames[i]; + if (window.hWin.HEURIST4.util.isempty(res[propName])) { + delete res[propName]; + } + } + if(res['iconType']=='circle'){ + res['radius'] = (res['iconSize']>0?res['iconSize']:8); + } + _editing_symbology.setModified(false); + */ + edit_dialog.dialog('close'); + + if($.isFunction(main_callback)){ + main_callback.call(this, res); + } + + }} + ]; + + // + // + edit_dialog = popup_dlg.dialog({ + autoOpen: true, + height: 600, + width: 1200, + modal: true, + title: window.hWin.HR('Define Website'), + resizeStop: function( event, ui ) {//fix bug + //that.element.css({overflow: 'none !important','width':that.element.parent().width()-24 }); + }, + beforeClose: function(){ + //show warning in case of modification + if(false && _editing_symbology.isModified()){ + var $dlg, buttons = {}; + buttons['Save'] = function(){ + edit_dialog.parent().find('#btnRecSave').click(); + $dlg.dialog('close'); + }; + buttons['Ignore and close'] = function(){ + //!!!! _editing_symbology.setModified(false); + edit_dialog.dialog('close'); + $dlg.dialog('close'); + }; + + $dlg = window.hWin.HEURIST4.msg.showMsgDlg( + 'You have made changes to the data. Click "Save" otherwise all changes will be lost.', + buttons, + {title:'Confirm',yes:'Save',no:'Ignore and close'}); + return false; + } + return true; + }, + + buttons: edit_buttons + }); + + + var layout_opts = { + applyDefaultStyles: true, + togglerContent_open: '
    ', + togglerContent_closed: '
    ', + west:{ + size: 300, //this.usrPreferences.summary_width + maxWidth:600, + spacing_open:6, + spacing_closed:16, + togglerAlign_open:'center', + togglerAlign_closed:'top', + togglerLength_closed:16, //makes it square + initClosed:false, //(this.usrPreferences.summary_closed==true || this.usrPreferences.summary_closed=='true'), + slidable:false, //otherwise it will be over center and autoclose + contentSelector: '.cms' + }, + center:{ + minWidth:400, + contentSelector: '.preview' + } + }; + + popup_dlg.load(window.hWin.HAPI4.baseURL+'hclient/widgets/editing/editCMS.html', + function(){ + $(popup_dlg.find('.main_cms')).layout( layout_opts ); + } + ); + + // + if(home_page_record_id<0){ + //create new set of records - website template + + var session_id = Math.round((new Date()).getTime()/1000); //for progress + + var request = { action: 'import_records', + filename: 'websiteStarterRecords2.hml', + //session: session_id, + id: window.hWin.HEURIST4.util.random() + }; + + window.hWin.HAPI4.doImportAction(request, function( response ){ + + if(response.status == window.hWin.ResponseStatus.OK){ + $('#spanRecCount2').text(response.data.count_imported); + + _initWebSiteEditor({q:{"ids":response.data.ids}}); + + }else{ + window.hWin.HEURIST4.msg.showMsgErr(response); + edit_dialog.dialog('close'); + } + }); + + }else{ + + _initWebSiteEditor(); + } + + // + // search all website records: home, menu, pages + // create menu tree data + // + function _initWebSiteEditor(request){ + + if(window.hWin.HEURIST4.util.isnull(request)) + { + request = {q:{"ids":home_page_record_id}, + rules: [{"query":'t:'+RT_CMS_MENU+' linkedfrom:'+RT_CMS_HOME+'-'+DT_CMS_TOP_MENU, //top menu + "levels":[{"query":'t:'+RT_CMS_MENU+' linkedfrom:'+RT_CMS_MENU+'-'+DT_CMS_MENU, //other menu + "levels":[{"query":'t:'+RT_CMS_PAGE+' linkedfrom:'+RT_CMS_MENU+'-'+DT_CMS_PAGE}]}]}]}; //pages + } + + request['detail'] = 'detail'; + //perform search + window.hWin.HAPI4.RecordMgr.search(request, + function(response){ + + if(response.status == window.hWin.ResponseStatus.OK){ + var resdata = new hRecordSet(response.data); + + var treedata = []; + + function __getTreeData(parent_id, menuitems){ + + var resitems = []; + + if(!window.hWin.HEURIST4.util.isnull(menuitems)){ + + for(var m=0; m' + +'' + +'' + +'' + +'' + +'
    ').appendTo(parent_span); + + $('
    ').appendTo(parent_span); + + actionspan.find('.ui-icon').click(function(event){ + var ele = $(event.target); + var parent_span = ele.parents('span.fancytree-node'); + + function __in_progress(){ + parent_span.find('.svs-contextmenu4').show(); + parent_span.find('.svs-contextmenu3').hide(); + } + + //timeout need to activate current node + setTimeout(function(){ + var ele2 = ele.parents('.svs-contextmenu3'); + var menuid = ele2.attr('data-menuid'); + var pageid = ele2.attr('data-pageid'); + var parent_id = ele2.attr('data-parentid'); + + if(ele.hasClass('ui-icon-plus')){ //add new menu to + + selectMenuRecord(menuid, function(){ + _initWebSiteEditor(); + }); + + }else if(ele.hasClass('ui-icon-menu')){ + + __in_progress(); + //edit menu item + window.hWin.HEURIST4.ui.openRecordEdit(menuid, null, + {selectOnSave:true, + onClose: function(){ + parent_span.find('.svs-contextmenu4').hide(); + }, + onselect:function(event, data){ + if( window.hWin.HEURIST4.util.isRecordSet(data.selection) ){ + _initWebSiteEditor(); + /*var recset = data.selection; + var rec = recset.getFirstRecord(); + recset.fld(rec, 'rec_ID'); + item.title = + parent_span.find('span.fancytree-title').text( item.title ); + item.removeChildren(); + item.addChildren(); + */ + } + }}); + + + }else if(ele.hasClass('ui-icon-document')){ + __in_progress(); + //edit page + window.hWin.HEURIST4.ui.openRecordEdit(pageid, null, + {selectOnSave:true, + onClose: function(){ + parent_span.find('.svs-contextmenu4').hide(); + }, + onselect:function(event, data){ + if( window.hWin.HEURIST4.util.isRecordSet(data.selection) ){ + _initWebSiteEditor(); + } + }}); + + }else if(ele.hasClass('ui-icon-trash')){ + removeMenuEntry(parent_id, menuid, function(){ + item.remove(); + //@todo + //refresh preview + }); + } + + },500); + }); + + //hide icons on mouse exit + function _onmouseexit(event){ + var node; + if($(event.target).is('li')){ + node = $(event.target).find('.fancytree-node'); + }else if($(event.target).hasClass('fancytree-node')){ + node = $(event.target); + }else{ + //hide icon for parent + node = $(event.target).parents('.fancytree-node'); + if(node) node = $(node[0]); + } + var ele = node.find('.svs-contextmenu3'); + ele.hide(); + } + + $(parent_span).hover( + function(event){ + var node; + if($(event.target).hasClass('fancytree-node')){ + node = $(event.target); + }else{ + node = $(event.target).parents('.fancytree-node'); + } + if(! ($(node).hasClass('fancytree-loading') || $(node).find('.svs-contextmenu4').is(':visible')) ){ + var ele = $(node).find('.svs-contextmenu3'); + ele.css({'display':'inline-block'});//.css('visibility','visible'); + } + } + ); + $(parent_span).mouseleave( + _onmouseexit + ); + } + } //end __defineActionIcons + + var fancytree_options = + { + checkbox: false, + //titlesTabbable: false, // Add all node titles to TAB chain + source: treedata, + quicksearch: false, //true, + selectMode: 1, //1:single, 2:multi, 3:multi-hier (default: 2) + renderNode: function(event, data) { + var item = data.node; + __defineActionIcons( item ); + }, + extensions:["edit", "dnd"], + dnd:{ + preventVoidMoves: true, + preventRecursiveMoves: true, + autoExpandMS: 400, + dragStart: function(node, data) { + return true; + }, + dragEnter: function(node, data) { + //data.otherNode - dragging node + //node - target node + return node.folder ?true :["before", "after"]; + }, + dragDrop: function(node, data) { + //data.otherNode - dragging node + //node - target node + data.otherNode.moveTo(node, data.hitMode); + + //remove from old parent + + //add to new parent and save order + + /* + data.otherNode + + menu_id = item.key, + page_id = item.data.page_id, + is_top = (item.data.parent_id==home_page_record_id); + */ + } + }, + edit:{ + triggerStart: ["clickActive", "dblclick", "f2", "mac+enter", "shift+click"], + close: function(event, data){ + // Editor was removed + if( data.save ) { + // Since we started an async request, mark the node as preliminary + $(data.node.span).addClass("pending"); + } + }, + save:function(event, data){ + if(''!=data.input.val()){ + var new_name = data.input.val(); + renameEntry(data.node.key, new_name, function(){ + $(data.node.span).removeClass("pending"); + data.node.setTitle( new_name ); + __defineActionIcons( data.node ); + }); + }else{ + $(data.node.span).removeClass("pending"); + } + } + } + }; + + tree_element.fancytree(fancytree_options); + } + + } + + else{ + window.hWin.HEURIST4.msg.showMsgErr(response); + edit_dialog.dialog('close'); + } + + } + ); //end searh for cms records + + + } //_initWebSiteEditor + + + // + // Select or create new menu item for website + // + // Opens record selector popup and adds selected menu given mapdoc or other menu + // + function selectMenuRecord(parent_id, callback){ + + var popup_options = { + select_mode: 'select_single', //select_multi + select_return_mode: 'recordset', + edit_mode: 'popup', + selectOnSave: true, //it means that select popup will be closed after add/edit is completed + title: window.hWin.HR('Select or create a website menu record'), + rectype_set: RT_CMS_MENU, + parententity: 0, + + onselect:function(event, data){ + if( window.hWin.HEURIST4.util.isRecordSet(data.selection) ){ + var recordset = data.selection; + var record = recordset.getFirstRecord(); + var menu_id = recordset.fld(record,'rec_ID'); + + addMenuEntry(parent_id, menu_id, callback) + } + } + };//popup_options + + + var usrPreferences = window.hWin.HAPI4.get_prefs_def('select_dialog_records', + {width: null, //null triggers default width within particular widget + height: (window.hWin?window.hWin.innerHeight:window.innerHeight)*0.95 }); + + popup_options.width = Math.max(usrPreferences.width,710); + popup_options.height = usrPreferences.height; + + window.hWin.HEURIST4.ui.showEntityDialog('records', popup_options); + } + + // + // + // + function addMenuEntry(parent_id, menu_id, callback){ + + var request = {a: 'add', + recIDs: parent_id, + dtyID: (parent_id==home_page_record_id)?DT_CMS_TOP_MENU:DT_CMS_MENU, + val: menu_id}; + + window.hWin.HAPI4.RecordMgr.batch_details(request, function(response){ + if(response.status == hWin.ResponseStatus.OK){ + //refresh treeview + if($.isFunction(callback)) callback.call(); + }else{ + hWin.HEURIST4.msg.showMsgErr(response); + } + }); + + } + + function removeMenuEntry(parent_id, menu_id, callback){ + + var request = {a: 'delete', + recIDs: parent_id, + dtyID: (parent_id==home_page_record_id)?DT_CMS_TOP_MENU:DT_CMS_MENU, + sVal: menu_id}; + + window.hWin.HAPI4.RecordMgr.batch_details(request, function(response){ + if(response.status == hWin.ResponseStatus.OK){ + //refresh treeview + if($.isFunction(callback)) callback.call(); + }else{ + hWin.HEURIST4.msg.showMsgErr(response); + } + }); + + } + + function renameEntry(rec_id, newvalue, callback){ + + var request = {a: 'replace', + recIDs: rec_id, + dtyID: DT_NAME, + rVal: newvalue}; + + window.hWin.HAPI4.RecordMgr.batch_details(request, function(response){ + if(response.status == hWin.ResponseStatus.OK){ + //refresh treeview + if($.isFunction(callback)) callback.call(); + }else{ + hWin.HEURIST4.msg.showMsgErr(response); + } + }); + + } + + +}//end editCMS diff --git a/hclient/widgets/entity/manageRecords.js b/hclient/widgets/entity/manageRecords.js index f3a9c8152..2026ac8e3 100644 --- a/hclient/widgets/entity/manageRecords.js +++ b/hclient/widgets/entity/manageRecords.js @@ -396,18 +396,6 @@ $.widget( "heurist.manageRecords", $.heurist.manageEntity, { var that = this; popup_options['onselect'] = function(event, data){ if( window.hWin.HEURIST4.util.isRecordSet(data.selection) ){ - - //save last 25 selected records - /* - var previously_selected_ids = window.hWin.HAPI4.get_prefs('recent_Records'); - if(!window.hWin.HEURIST4.util.isArrayNotEmpty(previously_selected_ids)){ - previously_selected_ids = []; - } - var now_selected = data.selection.getIds(25); - now_selected = now_selected.concat(previously_selected_ids); - */ - var now_selected = data.selection.getIds(25); - window.hWin.HAPI4.save_pref('recent_Records', now_selected, 25); that._trigger( "onselect", null, {selection:data.selection}); that.closeDialog(); diff --git a/hclient/widgets/search/search.js b/hclient/widgets/search/search.js index abc5b1f8a..8d5ef3abd 100644 --- a/hclient/widgets/search/search.js +++ b/hclient/widgets/search/search.js @@ -124,7 +124,7 @@ $.widget( "heurist.search", { } //------------------------------------------- filter by entities - var is_vis = (window.hWin.HAPI4.get_prefs_def('entity_btn_on','0')=='1'); + var is_vis = (window.hWin.HAPI4.get_prefs_def('entity_btn_on','1')=='1'); this.div_entity_btns = $('
    ').addClass('heurist-entity-filter-buttons') .css({ 'float':'left','padding':'5px '+sz_search_padding, diff --git a/hsapi/consts.php b/hsapi/consts.php index 38393fae1..487964a39 100644 --- a/hsapi/consts.php +++ b/hsapi/consts.php @@ -244,7 +244,11 @@ 'RT_QUERY_SOURCE' => array(3, 1021), //RT_MAPABLE_QUERY //Web content - 'RT_WEB_CONTENT' => array(1147, 25) + 'RT_WEB_CONTENT' => array(1147, 25), + + 'RT_CMS_HOME' => array(99, 51), + 'RT_CMS_MENU' => array(99, 52), + 'RT_CMS_PAGE' => array(99, 53) ); /** DETAIL TYPE DEFINITIONS */ @@ -346,7 +350,12 @@ 'DT_DBF_FILE' => array(3, 1070), 'DT_SHX_FILE' => array(3, 1071), - 'DT_EXTRACTED_TEXT' => array(2, 652) //for pdf parser + 'DT_EXTRACTED_TEXT' => array(2, 652), //for pdf parser + + 'DT_CMS_TOP_MENU' => array(99, 742), + 'DT_CMS_MENU' => array(99, 761), + 'DT_CMS_PAGE' => array(99, 945), + 'DT_CMS_KEYWORDS' => array(99, 948) ); //TODO: add email magic numbers diff --git a/hsapi/entity/dbDefRecTypes.php b/hsapi/entity/dbDefRecTypes.php index 13abf323e..bed348983 100644 --- a/hsapi/entity/dbDefRecTypes.php +++ b/hsapi/entity/dbDefRecTypes.php @@ -429,6 +429,7 @@ public function counts(){ { $query = 'SELECT r0.rec_RecTypeID, count(r0.rec_ID) as cnt FROM Records r0 '; + $where = ''; /* LEFT OUTER JOIN usrRecPermissions ON rcp_RecID=r0.rec_ID WHERE diff --git a/hsapi/import/importHeurist.php b/hsapi/import/importHeurist.php index 9bf9b6be2..14063c502 100644 --- a/hsapi/import/importHeurist.php +++ b/hsapi/import/importHeurist.php @@ -55,7 +55,11 @@ private static function readDataFile($filename, $type=null, $validate=true){ $data=null; try{ - $filename = HEURIST_SCRATCH_DIR.$filename; + if(strpos($filename,'websiteStarterRecords')===0){ + $filename = HEURIST_DIR.'admin/setup/website/'.$filename; + }else{ + $filename = HEURIST_SCRATCH_DIR.$filename; + } if(!file_exists($filename)){ @@ -520,6 +524,7 @@ public static function importRecords($filename, $session_id){ break; } + //source rec id => target rec id $records_corr[$record_src['rec_ID']] = $out['data']; //new record id $execution_counter++; @@ -577,8 +582,10 @@ public static function importRecords($filename, $session_id){ }else{ $mysqli->commit(); if($keep_autocommit===true) $mysqli->autocommit(TRUE); - $res = $cnt_imported; - + $res = array('count_imported'=>$cnt_imported); + if(count($records_corr)<1000){ + $res['ids'] = array_values($records_corr); + } } if($session_id!=null){//finish diff --git a/import/utilities/importRecords.js b/import/utilities/importRecords.js index 7e3168c2d..c5ffdad05 100644 --- a/import/utilities/importRecords.js +++ b/import/utilities/importRecords.js @@ -274,7 +274,7 @@ function hImportRecords(_max_upload_size) { function _importRecords(){ //$('#divStep2').hide(); - session_id = Math.round((new Date()).getTime()/1000); + session_id = Math.round((new Date()).getTime()/1000); //for progress var request = { action: 'import_records', filename: upload_file_name, @@ -288,7 +288,7 @@ function hImportRecords(_max_upload_size) { if(response.status == window.hWin.ResponseStatus.OK){ _hideProgress(3); - $('#spanRecCount2').text(response.data); + $('#spanRecCount2').text(response.data.count_imported); //window.hWin.HEURIST4.msg.showMsgDlg('Imported '+response.data+' records'); }else{ _hideProgress(2); diff --git a/index.php b/index.php index b6b1b080f..89d21bf2b 100644 --- a/index.php +++ b/index.php @@ -128,6 +128,7 @@ + diff --git a/redirects/resolver.php b/redirects/resolver.php index 950d49b6f..b5032e0a5 100644 --- a/redirects/resolver.php +++ b/redirects/resolver.php @@ -80,6 +80,11 @@ $redirect = $database_url.'&recID='.$recid.'&fmt'.$format; }else if($format=='html'){ $redirect = '../viewers/record/viewRecord.php?db='.$_REQUEST['db'].'&recID='.$recid; + +}else if($format=='web' || $format=='website'){ + + $redirect = '../viewers/record/websiteRecord.php?db='.$_REQUEST['db'].'&recID='.$recid; + }else if($format=='edit'){ //todo include resolver recordSearchReplacement $redirect = '../hclient/framecontent/recordEdit.php?'.$_SERVER['QUERY_STRING']; diff --git a/viewers/map/mapDocument.js b/viewers/map/mapDocument.js index 18f4598bb..ee755c764 100644 --- a/viewers/map/mapDocument.js +++ b/viewers/map/mapDocument.js @@ -42,6 +42,9 @@ function hMapDocument( _options ) DT_GEO_OBJECT = 0, DT_NAME = 0, + DT_MINIMUM_MAP_ZOOM = 0, //bounds for mapoc and visibility for layers + DT_MAXIMUM_MAP_ZOOM = 0, + map_documents = null, //recordset - all loaded documents map_documents_content = {}, //mapdoc_id=>recordset with all layers and datasources of document @@ -64,6 +67,9 @@ function hMapDocument( _options ) DT_SYMBOLOGY = window.hWin.HAPI4.sysinfo['dbconst']['DT_SYMBOLOGY']; DT_NAME = window.hWin.HAPI4.sysinfo['dbconst']['DT_NAME']; DT_GEO_OBJECT = window.hWin.HAPI4.sysinfo['dbconst']['DT_GEO_OBJECT']; + DT_MINIMUM_MAP_ZOOM = window.hWin.HAPI4.sysinfo['dbconst']['DT_MINIMUM_MAP_ZOOM']; + DT_MAXIMUM_MAP_ZOOM = window.hWin.HAPI4.sysinfo['dbconst']['DT_MAXIMUM_MAP_ZOOM']; + //_loadMapDocuments(); } @@ -141,10 +147,11 @@ function hMapDocument( _options ) // function _loadMapDocumentContent(mapdoc_id, deferred){ -//{"any":[{"ids":11},{"all":{"t":"25","linkedfrom":11}}]} +//{"any":[{"ids":mapdoc_id},{"all":{"t":RT_MAP_LAYER,"linkedfrom":mapdoc_id}}]}, //mapdoc and layer linked to given mapdoc +//{"t":RT_MAP_LAYER,"linkedfrom":mapdoc_id}, //layers linked to given mapdoc var request = { - q: {"t":RT_MAP_LAYER,"linkedfrom":mapdoc_id}, //layers linked to given mapdoc + q:{"t":RT_MAP_LAYER,"linkedfrom":mapdoc_id}, //layers linked to given mapdoc rules:[{"query":"linkedfrom:"+RT_MAP_LAYER+"-"+DT_DATA_SOURCE}], //data sources linked to layers w: 'a', detail: 'detail', @@ -193,10 +200,11 @@ function hMapDocument( _options ) if(idx) { var record = records[idx]; + var recID = resdata.fld(record, 'rec_ID'); if(resdata.fld(record, 'rec_RecTypeID')==RT_MAP_LAYER){ - var recID = resdata.fld(record, 'rec_ID'), - datasource_recID = resdata.fld(record, DT_DATA_SOURCE); + + var datasource_recID = resdata.fld(record, DT_DATA_SOURCE); var datasource_record = resdata.getById( datasource_recID ); @@ -207,6 +215,17 @@ function hMapDocument( _options ) rec_datasource: datasource_record, mapdoc_recordset: resdata, //need to get fields mapwidget: options.mapwidget}); + }else if(resdata.fld(record, 'rec_RecTypeID')==RT_MAP_DOCUMENT){ + + + var record2 = getLayer(recID); //from map_documents + record2['d'] = record['d']; + resdata.fld(record, DT_MINIMUM_MAP_ZOOM); + resdata.fld(record, DT_MAXIMUM_MAP_ZOOM); + resdata.removeRecord(recID); + + //get min and max zoom + } } }//for @@ -214,7 +233,7 @@ function hMapDocument( _options ) if(deferred){ var treedata = _getTreeData(mapdoc_id); - deferred.resolve( treedata ); //returns data t fancytree to render child layers for given mapdocument + deferred.resolve( treedata ); //returns data to fancytree to render child layers for given mapdocument } } diff --git a/viewers/map/mapManager.js b/viewers/map/mapManager.js index 91f7b4b2d..b80eefe50 100644 --- a/viewers/map/mapManager.js +++ b/viewers/map/mapManager.js @@ -568,7 +568,7 @@ function hMapManager( _options ) var ele = $(event.target); var parent_span = ele.parents('span.fancytree-node'); - function __in_porgress(){ + function __in_progress(){ parent_span.find('.svs-contextmenu4').show(); parent_span.find('.svs-contextmenu3').hide(); } @@ -593,7 +593,7 @@ function hMapManager( _options ) }else if(ele.hasClass('ui-icon-plus')){ //add new layer to map document - __in_porgress(); + __in_progress(); if(mapdoc_id>0){ mapDocuments.selectLayerRecord(mapdoc_id, function(data){ @@ -628,7 +628,7 @@ function hMapManager( _options ) if(mapdoc_id>0){ - __in_porgress(); + __in_progress(); //edit layer or mapdocument record window.hWin.HEURIST4.ui.openRecordEdit(recid>0?recid:mapdoc_id, null, {selectOnSave:true, diff --git a/viewers/map/map_leaflet.php b/viewers/map/map_leaflet.php index cd561866a..418cc4064 100644 --- a/viewers/map/map_leaflet.php +++ b/viewers/map/map_leaflet.php @@ -148,60 +148,18 @@ background-color:rgb(142, 169, 185); } - - span.fancytree-node, - span.fancytree-title, - div.svs-contextmenu3 > span.ui-icon{ - vertical-align:bottom; - padding-left:2px; - } - div.svs-contextmenu4{ - cursor:pointer; - position:absolute; - right:7px; - width: 16; - height: 16; - margin-top: -16; - display: none; - background-position: 0 0; - background-image: url(../../external/jquery.fancytree/skin-themeroller/loading.gif); + #term_tree{ + background:none; + border:none; } + div.svs-contextmenu3{ - cursor:pointer; - position:absolute; right:7px; - margin: 1px; - padding: 2 2 0 2; - /* - color: white !important; - visibility: hidden; - float:right; - padding-left:10px; - */ display:none; background:lightgray; color:black;/*#95A7B7;*/ - border-radius:2px; - } - span.fancytree-node{ - min-width: 300px; - padding:2px !important; } - #term_tree{ - background:none; - border:none; - } - span.fancytree-node { - border: none !important; - display: block; - width:100%; - } - - span.fancytree-node.fancytree-active{ - background: #95A7B7 !important; - color: white !important; - } - + leaflet-control-browser-print{ width: 22px !important; height: 22px !important; diff --git a/viewers/record/websiteRecord.php b/viewers/record/websiteRecord.php new file mode 100644 index 000000000..708639c5f --- /dev/null +++ b/viewers/record/websiteRecord.php @@ -0,0 +1,236 @@ + + * @license http://www.gnu.org/licenses/gpl-3.0.txt GNU License 3.0 + * @version 4.0 + */ + + /* + * Licensed under the GNU License, Version 3.0 (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at http://www.gnu.org/licenses/gpl-3.0.txt + * Unless required by applicable law or agreed to in writing, software distributed under the License is + * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied + * See the License for the specific language governing permissions and limitations under the License. + */ +define('PDIR','../../'); //need for proper path to js and css + +require_once(dirname(__FILE__).'/../../hclient/framecontent/initPageMin.php'); //without client hapi +require_once(dirname(__FILE__)."/../../hsapi/dbaccess/db_recsearch.php"); + +$system->defineConstants(); + +$mysqli = $system->get_mysqli(); + +$rec_id = @$_REQUEST['recID']; +if(!($rec_id>0)) +{ + //@todo find first record of 99-51 rectype + $message = 'Parameter recID not defined'; + include ERROR_REDIR; + exit(); +} + +// check if this record has been replaced (merged) +$rec_id = recordSearchReplacement($mysqli, $rec_id, 0); + +//validate permissions +//$rec = mysql__select_row_assoc($mysqli, +// 'select rec_Title, rec_NonOwnerVisibility, rec_OwnerUGrpID from Records where rec_ID='.$rec_id); +$rec = recordSearchByID($system, $rec_id, true); + + +if($rec==null){ + //header('Location: '.ERROR_REDIR.'&msg='.rawurlencode('Record #'.$rec_id.' not found')); + $message = 'Record #'.$rec_id.' not found'; + include ERROR_REDIR; + exit(); +} + +if($rec['rec_RecTypeID']!=RT_CMS_HOME && $rec['rec_RecTypeID']!=RT_CMS_PAGE){ + $message = 'Record #'.$rec_id.' is not allowed record type'; + include ERROR_REDIR; + exit(); +} + +$hasAccess = ($rec['rec_NonOwnerVisibility'] == 'public' || + ($system->get_user_id()>0 && $rec['rec_NonOwnerVisibility'] !== 'hidden') || //visible for logged + $system->is_member($rec['rec_OwnerUGrpID']) ); //owner + +if(!$hasAccess){ + $message = 'You are not a member of the workgroup that owns the Heurist record #' + .$rec_id.', and cannot therefore view this information.'; + include ERROR_REDIR; + exit(); +} + +if($rec['rec_RecTypeID']==RT_CMS_PAGE){ + print __getValue($rec, DT_EXTENDED_DESCRIPTION); + exit(); +} + +$image_icon = __getFile($rec, DT_THUMBNAIL, HEURIST_BASE_URL.'favicon.ico'); +$image_banner = __getFile($rec, DT_FILE_RESOURCE, HEURIST_BASE_URL.'hclient/assets/h4logo.png'); +//$image_background = __getFile($rec, DT_THUMBNAIL, HEURIST_BASE_URL.'favicon.ico'); +$meta_keywords = htmlspecialchars(__getValue($rec, DT_CMS_KEYWORDS)); +$meta_description = htmlspecialchars(__getValue($rec, DT_SHORT_SUMMARY)); + + +$topmenu = $rec['details'][DT_CMS_TOP_MENU]; +$menu_content = __getMenuContent($rec['rec_ID'], $topmenu); + +// +// +// +function __getFile(&$rec, $id, $def){ + + $file = @$rec['details'][$id]; + + if(is_array($file)){ + $file = array_shift($file); + $file = HEURIST_BASE_URL.'?db='.HEURIST_DBNAME.'&file='.$file['fileid']; + }else{ + $file = $def; + } + + return $file; +} + +// +// +// +function __getValue(&$menu_rec, $id){ + + $val = @$menu_rec['details'][$id]; + + if(is_array($val)){ + return array_shift($val); + }else if($val==null){ + return ''; + }else{ + return $val; + } +} + +// +// create menu +// +function __getMenuContent($parent_id, $menuitems) +{ + global $system; + + $res =''; + + foreach ($menuitems as $dtl_ID=>$rd){ + + $menu_rec = recordSearchByID($system, $rd['id'], true); + + $page_id = __getValue($menu_rec,DT_CMS_PAGE); + + $res = $res.'
  • ' + .htmlspecialchars(__getValue($menu_rec,DT_NAME)).''; + + $menuitems2 = @$menu_rec['details'][DT_CMS_MENU]; + if(count($menuitems2)>0){ + $sub = __getMenuContent($rd['id'], $menuitems2); + if($sub!='') + $res = $res. '
      '.$sub.'
    '; + } + $res = $res. '
  • '; + } + return $res; +} //__getMenuContent + +?> + + + <?php print __getValue($rec, DT_NAME);?> + + + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +
    Footer
    + + +