Author: dgoette Date: Sun Feb 8 18:08:48 2009 New Revision: 39507
URL: http://svn.reactos.org/svn/reactos?rev=39507&view=rev Log: * implement APLs in js * add new APLs * modify standard filter visibility settings * remove some stuff that makes no sense
Modified: branches/danny-web/reactos.org/htdocs/roscms/convert3to4.sql branches/danny-web/reactos.org/htdocs/roscms/js/cms_website.js branches/danny-web/reactos.org/htdocs/roscms/js/cms_website.js.php branches/danny-web/reactos.org/htdocs/roscms/lib/backend/Backend_EntryTable.class.php branches/danny-web/reactos.org/htdocs/roscms/lib/view/HTML_CMS_Website.class.php
Modified: branches/danny-web/reactos.org/htdocs/roscms/convert3to4.sql URL: http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/ros... ============================================================================== --- branches/danny-web/reactos.org/htdocs/roscms/convert3to4.sql [iso-8859-1] (original) +++ branches/danny-web/reactos.org/htdocs/roscms/convert3to4.sql [iso-8859-1] Sun Feb 8 18:08:48 2009 @@ -227,7 +227,7 @@ CREATE TABLE roscms_area ( id bigint(20) NOT NULL auto_increment, `name` varchar(30) NOT NULL, - name_short varchar(15) NOT NULL, + name_short varchar(18) NOT NULL, description varchar(255) NOT NULL, PRIMARY KEY (id), UNIQUE KEY `name` (`name`), @@ -267,7 +267,11 @@ (30, 'add level 3 groups', 'addlvl3group', 'Add memberships with group security level 3'), (31, 'Mix private & public entries', 'mix_priv_pub', 'show private and public type entries together'), (32, 'Entry Details Security', 'entry_security', 'change security settings & name + type of entry'), -(33, 'show system entries', 'show_sys_entry', 'show entries of type ''system'''); +(33, 'show more filter', 'more_filter', 'show more than standard filter'), +(34, 'show admin filter', 'admin_filter', 'special admin filters'), +(35, 'Show all filter', 'dont_hide_filter', 'don''t hide filter from users'), +(36, 'Make Entries Stable', 'make_stable', 'Make Entries Stable'), +(37, 'show system entries', 'show_sys_entry', 'show entries of type ''system''');
@@ -283,10 +287,10 @@ INSERT INTO roscms_rel_groups_area SELECT DISTINCT g.id, a.id FROM roscms_area a JOIN roscms_groups g -WHERE ((a.name_short = 'system_tags' OR a.name_short = 'entry_details' OR a.name_short = 'new_entry' OR a.name_short = 'deltag' OR a.name_short = 'del_entry' OR a.name_short = 'mix_priv_pub' OR a.name_short = 'show_sys_entry' OR a.name_short = 'addlvl1group') +WHERE ((a.name_short = 'system_tags' OR a.name_short = 'entry_details' OR a.name_short = 'new_entry' OR a.name_short = 'deltag' OR a.name_short = 'del_entry' OR a.name_short = 'mix_priv_pub' OR a.name_short = 'show_sys_entry' OR a.name_short = 'addlvl1group' OR a.name_short = 'more_filter' OR a.name_short = 'make_stable' OR a.name_short = 'dont_hide_filter') AND g.security_level > 1)
-OR ((a.name_short = 'delete_file' OR a.name_short = 'delmembership' OR a.name_short = 'disableaccount' OR a.name_short = 'user_details' OR a.name_short = 'other_drafts' OR a.name_short = 'stats' OR a.name_short = 'dynamic_pages' OR a.name_short = 'updatetag' OR a.name_short = 'del_wo_archiv' OR a.name_short = 'addlvl2group' OR a.name_short = 'user' OR a.name_short = 'addmembership' OR a.name_short = 'maintain') +OR ((a.name_short = 'delete_file' OR a.name_short = 'delmembership' OR a.name_short = 'disableaccount' OR a.name_short = 'user_details' OR a.name_short = 'other_drafts' OR a.name_short = 'stats' OR a.name_short = 'dynamic_pages' OR a.name_short = 'updatetag' OR a.name_short = 'del_wo_archiv' OR a.name_short = 'addlvl2group' OR a.name_short = 'user' OR a.name_short = 'addmembership' OR a.name_short = 'maintain' OR a.name_short = 'admin_filter') AND g.security_level = 3)
OR ((a.name_short = 'admin' OR a.name_short = 'logs' OR a.name_short = 'addlvl3group')
Modified: branches/danny-web/reactos.org/htdocs/roscms/js/cms_website.js URL: http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/ros... ============================================================================== --- branches/danny-web/reactos.org/htdocs/roscms/js/cms_website.js [iso-8859-1] (original) +++ branches/danny-web/reactos.org/htdocs/roscms/js/cms_website.js [iso-8859-1] Sun Feb 8 18:08:48 2009 @@ -2174,32 +2174,32 @@ break;
case '2': - filtstring2 = 'k_is_new_0|c_is_type_0|l_is_'+userlang+'_0|i_is_read_0|o_desc_datetime_0'; + filtstring2 = 'k_is_new_0|c_is_type_0|l_is_'+userlang+'_1|i_is_read_0|o_desc_datetime_1'; loadEntryTable('new'); break;
case '3': - filtstring2 = 'y_is_page_0|k_is_stable_0|c_is_language_0|i_is_read_0|o_asc_name_0'; + filtstring2 = 'y_is_page_0|k_is_stable_0|c_is_language_1|i_is_read_0|o_asc_name_1'; loadEntryTable('page'); break;
case '13': - filtstring2 = 'y_is_dynamic_0|k_is_stable_0|c_is_language_0|i_is_read_0|o_asc_name_0'; + filtstring2 = 'y_is_dynamic_0|k_is_stable_0|c_is_language_1|i_is_read_0|o_asc_name_1'; loadEntryTable('dynamic'); break;
case '4': - filtstring2 = 'y_is_content_0|k_is_stable_0|l_is_'+userlang+'_0|i_is_read_0|o_asc_name_0'; + filtstring2 = 'y_is_content_0|k_is_stable_0|l_is_'+userlang+'_1|i_is_read_0|o_asc_name_1'; loadEntryTable('content'); break;
case '5': - filtstring2 = 'y_is_template_0|k_is_stable_0|c_is_language_0|i_is_read_0|o_asc_name_0'; + filtstring2 = 'y_is_template_0|k_is_stable_0|c_is_language_1|i_is_read_0|o_asc_name_1'; loadEntryTable('template'); break;
case '6': - filtstring2 = 'y_is_script_0|k_is_stable_0|c_is_language_0|i_is_read_0|o_asc_name_0'; + filtstring2 = 'y_is_script_0|k_is_stable_0|c_is_language_1|i_is_read_0|o_asc_name_1'; loadEntryTable('script'); break;
@@ -2211,33 +2211,33 @@ else { translang = userlang; } - filtstring2 = 'y_is_content_0|k_is_stable_0|i_is_translate_0|c_is_user_0|l_is_'+roscms_standard_language+'_0|r_is_'+translang+'_0|o_desc_datetime_0'; + filtstring2 = 'y_is_content_1|k_is_stable_0|i_is_translate_0|c_is_user_1|l_is_'+roscms_standard_language+'_0|r_is_'+translang+'_1|o_desc_datetime_1'; loadEntryTable('translate'); break;
case '8': default: - filtstring2 = 'c_is_type_0|l_is_'+userlang+'_0|i_is_read_0|o_desc_datetime_0'; + filtstring2 = 'c_is_type_1|l_is_'+userlang+'_1|i_is_read_0|o_desc_datetime_1'; loadEntryTable('all'); break;
case '9': - filtstring2 = 's_is_true_0|c_is_type_0|l_is_'+userlang+'_0|i_is_read_0|o_desc_datetime_0'; + filtstring2 = 's_is_true_0|c_is_type_1|l_is_'+userlang+'_1|i_is_read_0|o_desc_datetime_1'; loadEntryTable('starred'); break;
case '10': - filtstring2 = 'k_is_draft_0|u_is_'+roscms_intern_login_check_username+'_0|c_is_type_0|i_is_read_0|o_desc_datetime_0'; + filtstring2 = 'k_is_draft_0|u_is_'+roscms_intern_login_check_username+'_0|c_is_type_1|i_is_read_0|o_desc_datetime_1'; loadEntryTable('draft'); break;
case '11': - filtstring2 = 'u_is_'+roscms_intern_login_check_username+'_0|c_is_type_0|i_is_read_0|o_desc_datetime_0'; + filtstring2 = 'u_is_'+roscms_intern_login_check_username+'_0|c_is_type_1|i_is_read_0|o_desc_datetime_1'; loadEntryTable('my'); break;
case '12': - filtstring2 = 'k_is_archive_0|c_is_version_0|c_is_type_0|l_is_'+userlang+'_0|o_asc_name_0|i_is_read_0|o_desc_ver_0'; + filtstring2 = 'k_is_archive_0|c_is_version_1|c_is_type_1|l_is_'+userlang+'_1|o_asc_name_1|i_is_read_0|o_desc_ver_1'; roscms_archive = true; /* activate archive mode*/ loadEntryTable('archive'); break; @@ -2548,16 +2548,18 @@ var cmdhtml_select_va = ''; var cmdhtml_select_xe = '';
- // special commands for access levels - if (roscms_access_level >= 2) { + // mark stable / generate + if (roscms_access['make_stable']) { cmdhtml_stable = '<button type="button" id="cmdstable" onclick="changeSelectedTags(\'ms\')">Stable</button>'+cmdhtml_space; cmdhtml_select_ms = '<option value="ms"> Mark as stable</option>'; cmdhtml_select_ge = '<option value="va"> Generate page</option>';
- if (roscms_access_level === 3) { - cmdhtml_select_va = '<option value="va"> Move to archive</option>'; - cmdhtml_select_xe = '<option value="xe"> Delete</option>'; - } + } + + // delete entries + if (roscms_access['del_entry']) { + cmdhtml_select_va = '<option value="va"> Move to archive</option>'; + cmdhtml_select_xe = '<option value="xe"> Delete</option>'; }
var cmdhtml_select_full = cmdhtml_select_start @@ -2649,20 +2651,16 @@ */ function addFilter( ) { + var new_filter = 'a_is_'; + + // fill filtstring2 with content, if available getActiveFilters();
- if (roscms_access_level > 1) { - tmp_security_new_filter = "k_is_stable"; + if (filtstring2 === '') { + htmlFilterChoices(new_filter); } else { - tmp_security_new_filter = "a_is_"; - } - - if (filtstring2 === '') { - htmlFilterChoices(tmp_security_new_filter); - } - else { - htmlFilterChoices(filtstring2+'|'+tmp_security_new_filter); + htmlFilterChoices(filtstring2+'|'+new_filter); } } // end of function addFilter
@@ -2691,15 +2689,9 @@ for (i=0; i < filtpopstr2.length; i++) { lstfilterstr2 = filtpopstr2[i].split('_');
- if (lstfilterstr2[3] == 0) { + if (lstfilterstr2[3] == 0 && !roscms_access['dont_hide_filter']) { filtvisibility = false; - - if (roscms_access_level > 1) { - lstfilterstr += '<span style="font-style: italic;">'; - } - else { - lstfilterstr += '<span style="display: none">'; - } + lstfilterstr += '<span style="display: none;">'; } else { filtvisibility = true; @@ -2710,15 +2702,15 @@ lstfilterstr += '<div id="filt'+indexid+'" class="filterbar2">and ';
// hidden filter entries don't need a combobox (only for SecLev = 1 user) - if (lstfilterstr2[3] == 0 && roscms_access_level === 1) { + if (lstfilterstr2[3] == 0 && !roscms_access['dont_hide_filter']) { lstfilterstr += '<input type="hidden" name="sfa'+indexid+'" id="sfa'+indexid+'" value="" />'; } else { lstfilterstr += '<select id="sfa'+indexid+'" onchange="isFilterChanged(this.id)">';
- if (roscms_access_level > 1) { - lstfilterstr += '<option value="k"+roscms_cbm_hide+>Status</option>' - + '<option value="y"+roscms_cbm_hide+>Type</option>'; + if (roscms_access['more_filter']) { + lstfilterstr += '<option value="k">Status</option>' + + '<option value="y">Type</option>'; }
lstfilterstr += '<option value="n">Name</option>' @@ -2727,14 +2719,14 @@ + '<option value="a">Tag</option>' + '<option value="l">Language</option>';
- if (roscms_access_level > 1) { - lstfilterstr += '<option value="r"+roscms_cbm_hide+>Translate</option>' - + '<option value="i"+roscms_cbm_hide+>Security</option>' - + '<option value="m"+roscms_cbm_hide+>Metadata</option>' - + '<option value="u"+roscms_cbm_hide+>User</option>'; - - if (roscms_access_level === 3) { - lstfilterstr += '<option value="e"+roscms_cbm_hide+>System</option>'; + if (roscms_access['more_filter']) { + lstfilterstr += '<option value="r">Translate</option>' + + '<option value="i">Security</option>' + + '<option value="m">Metadata</option>' + + '<option value="u">User</option>'; + + if (roscms_access['admin_filter']) { + lstfilterstr += '<option value="e">System</option>'; } }
Modified: branches/danny-web/reactos.org/htdocs/roscms/js/cms_website.js.php URL: http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/ros... ============================================================================== --- branches/danny-web/reactos.org/htdocs/roscms/js/cms_website.js.php [iso-8859-1] (original) +++ branches/danny-web/reactos.org/htdocs/roscms/js/cms_website.js.php [iso-8859-1] Sun Feb 8 18:08:48 2009 @@ -42,7 +42,7 @@ var filtentryselstrs2 = '';
// hidden filter entries don't need a combobox (only for SecLev = 1 user) - if (objidval2 == 0 && roscms_access_level == 1) { + if (objidval2 == 0 && !roscms_access['dont_hide_filter']) { filtentryselstrs1 = '<input type="hidden" name="sfb'+filterid+'" id="sfb'+filterid+'" value="" />'; filtentryselstrs2 = '<input type="hidden" name="sfc'+filterid+'" id="sfc'+filterid+'" value="" />'; } @@ -53,14 +53,14 @@ // kind case 'k': filtentryselstrs1 = '<select id="sfb'+filterid+'"><option value="is">is</option>'; - if (roscms_access_level > 1) { - filtentryselstrs1 += '<option value="no"'+roscms_cbm_hide+'>is not</option>'; + if (roscms_access['more_filter']) { + filtentryselstrs1 += '<option value="no">is not</option>'; } filtentryselstrs1 += '</select>'; filtentryselstrs2 = '<select id="sfc'+filterid+'"><option value="stable">Stable</option><option value="new">New</option><option value="draft">Draft</option><option value="unknown">Unknown or no status</option>';
- if (roscms_access_level > 1) { - filtentryselstrs2 += '<option value="archive"+roscms_cbm_hide+>Archive</option>'; + if (roscms_access['more_filter']) { + filtentryselstrs2 += '<option value="archive">Archive</option>'; }
filtentryselstrs2 += '</select>'; @@ -69,8 +69,8 @@ // type case 'y': filtentryselstrs1 = '<select id="sfb'+filterid+'"><option value="is">is</option>'; - if (roscms_access_level > 1) { - filtentryselstrs1 += '<option value="no"+roscms_cbm_hide+>is not</option>'; + if (roscms_access['more_filter']) { + filtentryselstrs1 += '<option value="no">is not</option>'; } filtentryselstrs1 += '</select>'; filtentryselstrs2 = '<select id="sfc'+filterid+'"><option value="page">Page</option><option value="dynamic">Dynamic Page</option><option value="content">Content</option><option value="template">Template</option><option value="script">Script</option><option value="system">System</option></select>'; @@ -140,8 +140,8 @@ // user case 'u': filtentryselstrs1 = '<select id="sfb'+filterid+'"><option value="is">is</option>'; - if (roscms_access_level > 1) { - filtentryselstrs1 += '<option value="no"+roscms_cbm_hide+>is not</option>'; + if (roscms_access['more_filter']) { + filtentryselstrs1 += '<option value="no">is not</option>'; } filtentryselstrs1 += '</select>'; filtentryselstrs2 = '<input id="sfc'+filterid+'" type="text" value="" size="20" maxlength="50" /> (e.g. John Doe)'; @@ -157,8 +157,8 @@ case 'c': filtentryselstrs1 = '<select id="sfb'+filterid+'"><option value="is">is</option></select>'; filtentryselstrs2 = '<select id="sfc'+filterid+'"><option value="language">Language</option><option value="user">User</option><option value="type">Type</option><option value="version">Version</option>'; - if (roscms_access_level > 1) { - filtentryselstrs2 += '<option value="security"+roscms_cbm_hide+>Security</option><option value="rights"+roscms_cbm_hide+>Rights</option>'; + if (roscms_access['more_filter']) { + filtentryselstrs2 += '<option value="security">Security</option><option value="rights">Rights</option>'; } filtentryselstrs2 += '</select>'; break; @@ -167,8 +167,8 @@ case 'o': filtentryselstrs1 = '<select id="sfb'+filterid+'"><option value="asc">Ascending</option><option value="desc">Descending</option></select>'; filtentryselstrs2 = '<select id="sfc'+filterid+'"><option value="datetime">Date & Time</option><option value="name">Name</option><option value="lang">Language</option><option value="usr">User</option><option value="type">Type</option><option value="ver">Version</option><option value="nbr">Number ("dynamic" entry)</option>'; - if (roscms_access_level > 1) { - filtentryselstrs2 += '<option value="security"+roscms_cbm_hide+>Security</option><option value="revid"+roscms_cbm_hide+>RevID</option><option value="ext"+roscms_cbm_hide+>Extension</option><option value="status"+roscms_cbm_hide+>Status</option><option value="kind"+roscms_cbm_hide+>Kind</option>'; + if (roscms_access['more_filter']) { + filtentryselstrs2 += '<option value="security">Security</option><option value="revid">RevID</option><option value="ext">Extension</option><option value="status">Status</option><option value="kind">Kind</option>'; } filtentryselstrs2 += '</select>'; break; @@ -197,8 +197,8 @@ // name case 'n': filtentryselstrs1 = '<select id="sfb'+filterid+'"><option value="is">is</option>'; - if (roscms_access_level > 1) { - filtentryselstrs1 += '<option value="no"+roscms_cbm_hide+>is not</option><option value="likea"+roscms_cbm_hide+>is like *...*</option>'; + if (roscms_access['more_filter']) { + filtentryselstrs1 += '<option value="no">is not</option><option value="likea">is like *...*</option>'; } filtentryselstrs1 += '<option value="likeb">is like ...*</option></select>'; filtentryselstrs2 = '<input id="sfc'+filterid+'" type="text" value="" size="20" maxlength="50" /> (e.g. about)'; @@ -207,8 +207,8 @@ // tag case 'a': filtentryselstrs1 = '<select id="sfb'+filterid+'"><option value="is">is</option>'; - if (roscms_access_level > 1) { - filtentryselstrs1 += '<option value="no"+roscms_cbm_hide+>is not</option>'; + if (roscms_access['more_filter']) { + filtentryselstrs1 += '<option value="no">is not</option>'; } filtentryselstrs1 +='</select>'; filtentryselstrs2 = '<input id="sfc'+filterid+'" type="text" value="" size="15" maxlength="30" /> (e.g. todo)'; @@ -216,7 +216,7 @@
// system case 'e': - if (roscms_access_level == 3) { + if (roscms_access['admin_filter']) { filtentryselstrs1 = '<select id="sfb'+filterid+'"><option value="dataid">Data-ID</option><option value="revid">Rev-ID</option><option value="usrid">User-ID</option><option value="langid">Lang-ID</option></select>'; filtentryselstrs2 = '<input id="sfc'+filterid+'" type="text" value="" size="15" maxlength="30" />'; }
Modified: branches/danny-web/reactos.org/htdocs/roscms/lib/backend/Backend_EntryTable.class.php URL: http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/ros... ============================================================================== --- branches/danny-web/reactos.org/htdocs/roscms/lib/backend/Backend_EntryTable.class.php [iso-8859-1] (original) +++ branches/danny-web/reactos.org/htdocs/roscms/lib/backend/Backend_EntryTable.class.php [iso-8859-1] Sun Feb 8 18:08:48 2009 @@ -227,6 +227,14 @@ */ private function markStable( $revision ) { + $thisuser=&ThisUser::getInstance(); + + // check if entry is not already stable + if (!$thisuser->hasAccess('make_stable')) { + echo 'You've no rights to publish stable entries.'; + return false; + } + // check if entry is not already stable if ($revision['status'] === 'stable') { echo 'Entry is already stable'; @@ -234,15 +242,15 @@ }
// has user access to modify other languages? - if (!ThisUser::getInstance()->hasAccess('more_lang')) { + if (!$thisuser->hasAccess('more_lang')) {
// check if user has set a language - if (ThisUser::getInstance()->language() == 0) { + if ($thisuser->language() == 0) { die('Set a valid language in your account settings!'); }
// block actions for user with access to one language - elseif (ThisUser::getInstance()->language() != $revision['lang_id']) { + elseif ($thisuser->language() != $revision['lang_id']) { echo 'You can't mark entries of other languages as stable!'; return false; }
Modified: branches/danny-web/reactos.org/htdocs/roscms/lib/view/HTML_CMS_Website.class.php URL: http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/ros... ============================================================================== --- branches/danny-web/reactos.org/htdocs/roscms/lib/view/HTML_CMS_Website.class.php [iso-8859-1] (original) +++ branches/danny-web/reactos.org/htdocs/roscms/lib/view/HTML_CMS_Website.class.php [iso-8859-1] Sun Feb 8 18:08:48 2009 @@ -103,8 +103,14 @@ var roscms_intern_webserver_roscms = '".RosCMS::getInstance()->pathRosCMS()."'; var roscms_intern_page_link = '".RosCMS::getInstance()->pathRosCMS()."?page='; var roscms_get_edit = '".(isset($_GET['edit']) ? $_GET['edit'] : '')."'; - var roscms_access_level = 3"./*$thisuser->securityLevel().*/"; - var roscms_cbm_hide = '"./*(($thisuser->securityLevel() > 1) ? '' : ' disabled="disabled" style="color:#CCCCCC;"').*/"'; // disable combobox entries for novice user + + // access restrictions + var roscms_access = new Object(); + roscms_access['more_filter'] = ".($thisuser->hasAccess('more_filter') ? 'true' : 'false')."; + roscms_access['admin_filter'] = ".($thisuser->hasAccess('admin_filter') ? 'true' : 'false')."; + roscms_access['dont_hide_filter'] = ".($thisuser->hasAccess('dont_hide_filter') ? 'true' : 'false')."; + roscms_access['make_stable'] = ".($thisuser->hasAccess('make_stable') ? 'true' : 'false')."; + roscms_access['del_entry'] = ".($thisuser->hasAccess('del_entry') ? 'true' : 'false').";
// favorite user language ";