[ros-diffs] [dgoette] 422: * fix renaming of an entry * fix changing type of an entry * put a visible comment to entry details, that these changes are applied as you click the button

dgoette at svn.reactos.org dgoette at svn.reactos.org
Mon May 25 09:27:36 CEST 2009


Author: dgoette
Date: Mon May 25 11:27:35 2009
New Revision: 422

URL: http://svn.reactos.org/svn/reactos?rev=422&view=rev
Log:
* fix renaming of an entry
* fix changing type of an entry
* put a visible comment to entry details, that these changes are applied as you click the button

Modified:
    branches/danny-web/www/www.reactos.org/roscms/css/cms_website.css
    branches/danny-web/www/www.reactos.org/roscms/js/cms_website.js
    branches/danny-web/www/www.reactos.org/roscms/lib/backend/Backend_ViewEditor.class.php
    branches/danny-web/www/www.reactos.org/roscms/lib/om/Entry.class.php

Modified: branches/danny-web/www/www.reactos.org/roscms/css/cms_website.css
URL: http://svn.reactos.org/svn/reactos/branches/danny-web/www/www.reactos.org/roscms/css/cms_website.css?rev=422&r1=421&r2=422&view=diff
==============================================================================
--- branches/danny-web/www/www.reactos.org/roscms/css/cms_website.css [iso-8859-1] (original)
+++ branches/danny-web/www/www.reactos.org/roscms/css/cms_website.css [iso-8859-1] Mon May 25 11:27:35 2009
@@ -91,3 +91,6 @@
 .deletebutton { cursor:pointer; color:#006090; font-weight: bold; }
 
 #previewzone {background-color: white;min-height: 300px;padding-top: 10px;}
+
+/* comments */
+.comment { color: gray;font-size:smaller; }

Modified: branches/danny-web/www/www.reactos.org/roscms/js/cms_website.js
URL: http://svn.reactos.org/svn/reactos/branches/danny-web/www/www.reactos.org/roscms/js/cms_website.js?rev=422&r1=421&r2=422&view=diff
==============================================================================
--- branches/danny-web/www/www.reactos.org/roscms/js/cms_website.js [iso-8859-1] (original)
+++ branches/danny-web/www/www.reactos.org/roscms/js/cms_website.js [iso-8859-1] Mon May 25 11:27:35 2009
@@ -971,14 +971,13 @@
     var d_name_str = beautifystr2(document.getElementById('secdataname').value);
     var d_type_str = document.getElementById('cbmdatatype').value;
     var d_acl_str = document.getElementById('cbmdataacl').value;
-    var d_name_update = document.getElementById('chdname').checked;
 
     // remove leading space character
     if (d_name_str.substr(0, 1) === ' ') {
       d_name_str = d_name_str.substr(1, d_name_str.length-1); 
     }
 
-    makeRequest('?page=backend&type=text&subtype=mef&d_fl=altersecurity&d_id='+did+'&d_r_id='+drid+'&d_val='+d_name_str+'&d_val2='+d_type_str+'&d_val3='+d_acl_str+'&d_val4='+d_name_update, 'mef', 'editaltersecurity', 'html', 'GET', '');
+    makeRequest('?page=backend&type=text&subtype=mef&d_fl=altersecurity&d_id='+did+'&d_r_id='+drid+'&d_val='+d_name_str+'&d_val2='+d_type_str+'&d_val3='+d_acl_str, 'mef', 'editaltersecurity', 'html', 'GET', '');
   }
 } // end of function saveSecurityData
 

Modified: branches/danny-web/www/www.reactos.org/roscms/lib/backend/Backend_ViewEditor.class.php
URL: http://svn.reactos.org/svn/reactos/branches/danny-web/www/www.reactos.org/roscms/lib/backend/Backend_ViewEditor.class.php?rev=422&r1=421&r2=422&view=diff
==============================================================================
--- branches/danny-web/www/www.reactos.org/roscms/lib/backend/Backend_ViewEditor.class.php [iso-8859-1] (original)
+++ branches/danny-web/www/www.reactos.org/roscms/lib/backend/Backend_ViewEditor.class.php [iso-8859-1] Mon May 25 11:27:35 2009
@@ -163,7 +163,7 @@
 
       // update Security details
       case 'altersecurity':
-        Entry::update($_GET['d_id'], $_GET['d_val'], $_GET['d_val2'], $_GET['d_val3'], $_GET['d_val4']=='true');
+        Entry::update($_GET['d_id'], $_GET['d_val'], $_GET['d_val2'], $_GET['d_val3']);
         $this->show();
         break;
 
@@ -472,10 +472,10 @@
 
       // Fields
       if ($mode == self::FIELDS) {
-        echo '<strong>Fields</strong>';
+        echo '<strong>Text Fields</strong>';
       }
       else {
-        echo '<span class="detailmenu" onclick="'."showEditorTabFields(".$this->rev_id.")".'">Fields</span>';
+        echo '<span class="detailmenu" onclick="'."showEditorTabFields(".$this->rev_id.")".'">Text Fields</span>';
       }
     }
 
@@ -498,14 +498,17 @@
 
       // Security
       if ($mode == self::SECURITY) {
-        echo '<strong>Security</strong>';
+        echo '<strong>Entry</strong>';
       }
       else {
-        echo '<span class="detailmenu" onclick="'."showEditorTabSecurity(".$this->rev_id.")".'">Security</span>';
-      }
-    }
-
-    echo_strip('
+        echo '<span class="detailmenu" onclick="'."showEditorTabSecurity(".$this->rev_id.")".'">Entry</span>';
+      }
+    }
+
+    echo_strip('
+        </div>
+        <div class="comment">
+          Changes in details are applied as you click the button, there is no need to save another draft.
         </div>
       </div>');
 

Modified: branches/danny-web/www/www.reactos.org/roscms/lib/om/Entry.class.php
URL: http://svn.reactos.org/svn/reactos/branches/danny-web/www/www.reactos.org/roscms/lib/om/Entry.class.php?rev=422&r1=421&r2=422&view=diff
==============================================================================
--- branches/danny-web/www/www.reactos.org/roscms/lib/om/Entry.class.php [iso-8859-1] (original)
+++ branches/danny-web/www/www.reactos.org/roscms/lib/om/Entry.class.php [iso-8859-1] Mon May 25 11:27:35 2009
@@ -76,6 +76,11 @@
   {
     $type_update = false;
     $name_update = false;
+
+    // call old data types as array index to get the short version
+    $convert = array(
+      'content'=>'cont',
+      'script'=>'inc');
   
     // get entry
     $stmt=&DBConnection::getInstance()->prepare("SELECT name, type, access_id FROM ".ROSCMST_ENTRIES." WHERE id = :data_id LIMIT 1");
@@ -89,47 +94,48 @@
     }
 
     // update data type
-    if ($data_type != '' && $data_type != $data['type']) {
+    if (isset($convert[$type]) && $type != $data['type']) {
       $type_update = true;
 
       $stmt=&DBConnection::getInstance()->prepare("UPDATE ".ROSCMST_ENTRIES." SET type = :type_new WHERE id = :data_id LIMIT 1");
-      $stmt->bindParam('type_new',$data_type,PDO::PARAM_STR);
+      $stmt->bindParam('type_new',$type,PDO::PARAM_STR);
       $stmt->bindParam('data_id',$data_id,PDO::PARAM_INT);
       $stmt->execute();
-      Log::writeMedium('data-type changed: '.$data['type'].' =&gt; '.$data_type);
-      $new_data_type = $data_type;
+      Log::writeMedium('data-type changed: '.$data['type'].' =&gt; '.$type);
+      $new_type = $type;
     }
 
     // update data name
-    if ($data_name != '' && $data_name != $data['name']) {
+    if ($name != '' && $name != $data['name']) {
       $name_update = true;
 
       $stmt=&DBConnection::getInstance()->prepare("UPDATE ".ROSCMST_ENTRIES." SET name = :name_new WHERE id = :id LIMIT 1");
-      $stmt->bindParam('name_new',$data_name,PDO::PARAM_STR);
+      $stmt->bindParam('name_new',$name,PDO::PARAM_STR);
       $stmt->bindParam('id',$data_id,PDO::PARAM_INT);
       $stmt->execute();
-
-      Log::writeMedium('data-name changed: '.$data['name'].' =&gt; '.$data_name);
+      Log::writeMedium('data-name changed: '.$data['name'].' =&gt; '.$name);
+      $new_name = $name;
     }
 
     // update dependent entries
     if ($type_update || $name_update) {
 
-      // call old data types as array index to get the short version
-      $convert = array(
-        'content'=>'cont',
-        'script'=>'inc');
 
       // if the datatype has not changed, use the old one
-      if ($new_data_type == '') {
-        $new_data_type = $data['type'];
+      if (!isset($new_type)) {
+        $new_type = $data['type'];
+      }
+
+      // if the dataname has not changed, use the old one
+      if (!isset($new_name)) {
+        $new_name = $data['name'];
       }
 
       // update text content with new name and or types
       $stmt=&DBConnection::getInstance()->prepare("UPDATE ".ROSCMST_TEXT." SET content = REPLACE(content, :old_type_name, :new_type_name) WHERE content LIKE :search");
-      $stmt->bindParam('search','%[#'.$convert[$data['type']].'_'.$data['name'].']%',PDO::PARAM_STR);
-      $stmt->bindParam('old_type_name','[#'.$convert[$data['type']].'_'.$data['name'].']',PDO::PARAM_STR);
-      $stmt->bindParam('new_type_name','[#'.$convert[$new_type_short].'_'.$data_name.']',PDO::PARAM_STR);
+      $stmt->bindValue('search','%[#'.$convert[$data['type']].'_'.$data['name'].']%',PDO::PARAM_STR);
+      $stmt->bindValue('old_type_name','[#'.$convert[$data['type']].'_'.$data['name'].']',PDO::PARAM_STR);
+      $stmt->bindValue('new_type_name','[#'.$convert[$new_type].'_'.$new_name.']',PDO::PARAM_STR);
       $stmt->execute();
 
       Log::writeMedium('data-interlinks updated due data-name change');
@@ -138,19 +144,19 @@
     // update page links
     if ($name_update && ($data['type'] == 'page' || $data['type'] == 'dynamic')) {
       $stmt=&DBConnection::getInstance()->prepare("UPDATE ".ROSCMST_TEXT." SET content = REPLACE(content, :old_link, :new_link) WHERE content LIKE :search");
-      $stmt->bindParam('search','%[#link_'.$data['name'].']%',PDO::PARAM_STR);
-      $stmt->bindParam('old_link','[#link_'.$data['name'].']',PDO::PARAM_STR);
-      $stmt->bindParam('new_link','[#link_'.$data_name.']',PDO::PARAM_STR);
+      $stmt->bindValue('search','%[#link_'.$data['name'].']%',PDO::PARAM_STR);
+      $stmt->bindValue('old_link','[#link_'.$data['name'].']',PDO::PARAM_STR);
+      $stmt->bindValue('new_link','[#link_'.$name.']',PDO::PARAM_STR);
       $stmt->execute();
     }
 
     // change ACL
-    if ($data_acl != '' && $data_acl != $data['access_id']) {
+    if ($acl != '' && $acl != $data['access_id']) {
       $stmt=&DBConnection::getInstance()->prepare("UPDATE ".ROSCMST_ENTRIES." SET access_id = :acl_new WHERE id = :data_id LIMIT 1");
-      $stmt->bindParam('acl_new',$data_acl);
+      $stmt->bindParam('acl_new',$acl);
       $stmt->bindParam('data_id',$data_id);
       $stmt->execute();
-      Log::writeMedium('data-acl changed: '.$data['access_id'].' =&gt; '.$data_acl);
+      Log::writeMedium('data-acl changed: '.$data['access_id'].' =&gt; '.$acl);
     } 
 
   } // end of member function update



More information about the Ros-diffs mailing list