Author: dgoette Date: Mon Nov 24 10:12:48 2008 New Revision: 37617
URL: http://svn.reactos.org/svn/reactos?rev=37617&view=rev Log: * implemented list of depencies * some minor bugfixes
Modified: branches/danny-web/reactos.org/htdocs/roscms/js/cms_website.js branches/danny-web/reactos.org/htdocs/roscms/lib/Data.class.php branches/danny-web/reactos.org/htdocs/roscms/lib/Editor_Website.class.php branches/danny-web/reactos.org/htdocs/roscms/lib/Export_HTML.class.php branches/danny-web/reactos.org/htdocs/roscms/lib/Log.class.php
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] Mon Nov 24 10:12:48 2008 @@ -1061,6 +1061,10 @@
function bshowhistory(did, drid) { makeRequest('?page=data_out&d_f=text&d_u=mef&d_fl=showhistory&d_id='+did+'&d_r_id='+drid, 'mef', 'frmedittagsc2', 'html', 'GET', ''); + } + + function bshowdepencies(did, drid) { + makeRequest('?page=data_out&d_f=text&d_u=mef&d_fl=showdepencies&d_id='+did+'&d_r_id='+drid, 'mef', 'frmedittagsc2', 'html', 'GET', ''); }
function balterfields(did, drid, dusr) {
Modified: branches/danny-web/reactos.org/htdocs/roscms/lib/Data.class.php URL: http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/ros... ============================================================================== --- branches/danny-web/reactos.org/htdocs/roscms/lib/Data.class.php [iso-8859-1] (original) +++ branches/danny-web/reactos.org/htdocs/roscms/lib/Data.class.php [iso-8859-1] Mon Nov 24 10:12:48 2008 @@ -504,7 +504,7 @@ $stmt->bindParam('id',$data_id,PDO::PARAM_INT); $stmt->execute();
- Log::writeMedium('data-name changed: '.$data['data_name'].' => '.$data_name.Log::prepareInfo($data_id, $rev_id).'{altersecurityfields}'); + Log::writeMedium('data-name changed: '.$data['data_name'].' => '.$data_name.Log::prepareInfo($data_id).'{altersecurityfields}');
if ($update_links == true) { if ($data_type == '') { @@ -558,7 +558,7 @@ } } // while
- Log::writeMedium('data-interlinks updated due data-name change'.Log::prepareInfo($data_id, $rev_id).'{altersecurityfields}'); + Log::writeMedium('data-interlinks updated due data-name change'.Log::prepareInfo($data_id).'{altersecurityfields}'); } } // end data_name changes
@@ -567,7 +567,7 @@ $stmt->bindParam('type_new',$data_type,PDO::PARAM_STR); $stmt->bindParam('data_id',$data_id,PDO::PARAM_INT); $stmt->execute(); - Log::writeMedium('data-type changed: '.$data['data_type'].' => '.$data_type.Log::prepareInfo($data_id, $rev_id).'{altersecurityfields}'); + Log::writeMedium('data-type changed: '.$data['data_type'].' => '.$data_type.Log::prepareInfo($data_id).'{altersecurityfields}'); } // end data_type changes
if ($data_acl != '' && $data_acl != $data['data_acl']) { @@ -575,7 +575,7 @@ $stmt->bindParam('acl_new',$data_acl); $stmt->bindParam('data_id',$data_id); $stmt->execute(); - Log::writeMedium('data-acl changed: '.$data['data_acl'].' => '.$data_acl.Log::prepareInfo($data_id, $rev_id).'{altersecurityfields}'); + Log::writeMedium('data-acl changed: '.$data['data_acl'].' => '.$data_acl.Log::prepareInfo($data_id).'{altersecurityfields}'); } // end data_acl changes
} // end of member function getCookieDomain
Modified: branches/danny-web/reactos.org/htdocs/roscms/lib/Editor_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/Editor_Website.class.php [iso-8859-1] (original) +++ branches/danny-web/reactos.org/htdocs/roscms/lib/Editor_Website.class.php [iso-8859-1] Mon Nov 24 10:12:48 2008 @@ -32,6 +32,7 @@ const HISTORY = 2; const SECURITY = 3; const ENTRY = 4; + const DEPENCIES= 5;
// types of new entries const SINGLE = 0; @@ -104,6 +105,11 @@ $this->showEntryDetails(self::HISTORY); break;
+ // show Depencies + case 'showdepencies': + $this->showEntryDetails(self::DEPENCIES); + break; + // show Field details case 'alterfields': $this->showEntryDetails(self::FIELDS); @@ -616,7 +622,7 @@ else { echo '<span class="detailmenu" onclick="'."bshowtag(".$this->data_id.",".$this->rev_id.",'a','b', '".$thisuser->id()."')".'">Metadata</span>'; } - echo " | "; + echo ' | ';
// History if ($mode == self::HISTORY) { @@ -625,10 +631,19 @@ else { echo '<span class="detailmenu" onclick="'."bshowhistory(".$this->data_id.",".$this->rev_id.",'a','b', '".$thisuser->id()."')".'">History</span>'; } + echo ' | '; + + // Depencies + if ($mode == self::DEPENCIES) { + echo '<strong>Depencies</strong>'; + } + else { + echo '<span class="detailmenu" onclick="'."bshowdepencies(".$this->data_id.",".$this->rev_id.", '".$thisuser->id()."')".'">Depencies</span>'; + }
// allowed only for someone with "add" rights if (Security::hasRight($this->data_id, 'add')) { - echo " | "; + echo ' | ';
// Fields if ($mode == self::FIELDS) { @@ -637,7 +652,7 @@ else { echo '<span class="detailmenu" onclick="'."balterfields(".$this->data_id.",".$this->rev_id.", '".$thisuser->id()."')".'">Fields</span>'; } - echo " | "; + echo ' | ';
if ($mode == self::ENTRY) { echo '<strong>Entry</strong>'; @@ -649,8 +664,9 @@
// allowed only for related super administrators if ($thisuser->isMemberOfGroup('ros_sadmin') || (Security::hasRight($this->data_id, 'add') && $thisuser->isMemberOfGroup('ros_admin'))) { - echo " | "; - + echo ' | '; + + // Security if ($mode == self::SECURITY) { echo '<strong>Security</strong>'; } @@ -658,6 +674,7 @@ echo '<span class="detailmenu" onclick="'."bshowsecurity(".$this->data_id.",".$this->rev_id.", '".$thisuser->id()."')".'">Security</span>'; } } + echo_strip(' </div> </div>'); @@ -669,6 +686,9 @@ break; case self::HISTORY: $this->showEntryDetailsHistory(); + break; + case self::DEPENCIES: + $this->showEntryDepencies($this->data_id); break; case self::SECURITY: $this->showEntryDetailsSecurity(); @@ -814,6 +834,64 @@ echo '</ul>'; }
+ /** + * + * + * @access private + */ + private function showEntryDepencies( $data_id ) + { + $stmt=DBConnection::getInstance()->prepare("SELECT data_name,data_type FROM data_ WHERE data_id = :data_id LIMIT 1"); + $stmt->bindParam('data_id',$data_id,PDO::PARAM_INT); + $stmt->execute(); + $data = $stmt->fetchOnce(PDO::FETCH_ASSOC); + + // get Data type + switch ($data['data_type']) { + case 'template': + $type_short = 'templ'; + break; + case 'content': + $type_short = 'cont'; + break; + case 'script': + $type_short = 'inc'; + break; + default: + echo '----this should not happen.<br />'; + var_dump($data); + return; + break; + } + + echo_strip(' + <br /> + <div class="frmeditheadline">Data Depencies</div> + <br />'); + + // search for depencies + $stmt=DBConnection::getInstance()->prepare("SELECT d.data_name, d.data_type, r.data_id, r.rev_id, r.rev_language FROM data_ d JOIN data_revision r ON r.data_id = d.data_id JOIN data_text t ON r.rev_id = t.data_rev_id WHERE t.text_content LIKE :content_phrase AND r.rev_version > 0 ORDER BY r.rev_language, d.data_name, d.data_type"); + $stmt->bindValue('content_phrase','%[#'.$type_short.'_'.$data['data_name'].']%',PDO::PARAM_STR); + $stmt->execute(); + + $last_language = null; + + // handle Depencies + while ($depency = $stmt->fetch(PDO::FETCH_ASSOC)) { + if ($depency['rev_language'] != $last_language) { + if ($last_language !== null) { + echo '</ul>'; + } + + echo '<h3>'.$depency['rev_language'].'</h3><ul>'; + $last_language = $depency['rev_language']; + } + + echo '<li>'.$depency['data_name'].' ('.$depency['data_type'].')</li>'; + } + echo '</ul>'; + } +
/** * @@ -863,7 +941,7 @@ <br /> <br /> <button type="button" id="beditsavefields" onclick="'."editsavesecuritychanges('".$this->data_id."','".$this->rev_id."')".'">Save Changes</button> - <button type="button" id="beditclear" onclick="'."bshowsecurity(".$this->data_id.",".$this->rev_id.", '".$thisuser->id()."')".'">Clear</button>'); + <button type="button" id="beditclear" onclick="'."bshowsecurity(".$this->data_id.",".$this->rev_id.", '".ThisUser::getInstance()->id()."')".'">Clear</button>'); }
@@ -931,7 +1009,7 @@ </span> <br /><br /><br /> <button type="button" id="beditsavefields" onclick="'."editsavefieldchanges('".$this->data_id."','".$this->rev_id."')".'">Save Changes</button> - <button type="button" id="beditclear" onclick="'."balterfields(".$this->data_id.",".$this->rev_id.", '".$thisuser->id()."')".'">Clear</button>'); + <button type="button" id="beditclear" onclick="'."balterfields(".$this->data_id.",".$this->rev_id.", '".ThisUser::getInstance()->id()."')".'">Clear</button>'); }
@@ -992,7 +1070,7 @@ <br /> <br /> <button type="button" id="beditsaveentry" onclick="editsaveentrychanges('.$this->data_id.','.$this->rev_id.')">Save Changes</button> - <button type="button" id="beditclear" onclick="'."bshowentry(".$this->data_id.",".$this->rev_id.", '".$thisuser->id()."')".'">Clear</button>'); + <button type="button" id="beditclear" onclick="'."bshowentry(".$this->data_id.",".$this->rev_id.", '".ThisUser::getInstance()->id()."')".'">Clear</button>'); }
Modified: branches/danny-web/reactos.org/htdocs/roscms/lib/Export_HTML.class.php URL: http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/ros... ============================================================================== --- branches/danny-web/reactos.org/htdocs/roscms/lib/Export_HTML.class.php [iso-8859-1] (original) +++ branches/danny-web/reactos.org/htdocs/roscms/lib/Export_HTML.class.php [iso-8859-1] Mon Nov 24 10:12:48 2008 @@ -139,7 +139,7 @@ while ($lang = $stmt->fetch(PDO::FETCH_ASSOC)) {
// display language - echo '<p><b><u>'.$lang['lang_name'].'</u></b></p>'; + echo '<h3 style="text-decoration:underlien;>'.$lang['lang_name'].'</h3>';
// switch sql statement by generation mode if ($mode == 'single') { @@ -193,11 +193,11 @@ $html_content = $this->processTextByName($page['data_name'], $lang['lang_id'], $content['dynamic_num'], 'output');
// write content to filename, if possible - $fh = @fopen($destination_folder.$file_name, "w"); - if ($fh!==false){ + $fh = @fopen($destination_folder.$file_name, 'w'); + if ($fh !== false){ flock($fh,2); fputs($fh,$html_content); - fputs($fh,"\n\n<!-- Generated with ".$roscms_extern_brand." ".$roscms_extern_version.' ('.$roscms_extern_version_detail.') - '.date('Y-m-d H:i:s').' [RosCMS_v3] -->'); + fputs($fh,'<!-- Generated with '.$roscms_extern_brand.' '.$roscms_extern_version.' ('.$roscms_extern_version_detail.') - '.date('Y-m-d H:i:s').' [RosCMS_v3] -->'); flock($fh,3); fclose($fh);
@@ -317,7 +317,7 @@ $page = $results[1]; }
- $this->processText($page['rev_id'], $output_type); + return $this->processText($page['rev_id'], $output_type); }
@@ -399,7 +399,7 @@ $stmt->execute(); $user_name = $stmt->fetchColumn(); $content = str_replace('[#roscms_user]', $user_name, $content); // account that generate - $content = str_replace("[#roscms_inc_author]", $user_name, $content); // account that changed the include text + $content = str_replace('[#roscms_inc_author]', $user_name, $content); // account that changed the include text
// page version $content = str_replace('[#roscms_page_version]', $page['rev_version'], $content); @@ -495,7 +495,7 @@ $page_link = $roscms_intern_webserver_roscms.'?page=data_out&d_f=page&d_u=show&d_val=index&d_val2='.$this->lang.'&d_val3='; } else { - $page_link = $roscms_intern_webserver_roscms."?page=data_out&d_f=page&d_u=show&d_val=".$page_name_with_num."&d_val2=".$this->lang."&d_val3=".$dynamic_num; + $page_link = $roscms_intern_webserver_roscms.'?page=data_out&d_f=page&d_u=show&d_val='.$page_name_with_num.'&d_val2='.$this->lang.'&d_val3='.$dynamic_num; }
if ($mode == 'edit') { @@ -518,7 +518,7 @@ }
// get page link - if ($g_link_page_name == '') { + if ($page_name == '') { $page_link = $roscms_intern_webserver_pages.$this->lang.'/404.html'; } else{
Modified: branches/danny-web/reactos.org/htdocs/roscms/lib/Log.class.php URL: http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/ros... ============================================================================== --- branches/danny-web/reactos.org/htdocs/roscms/lib/Log.class.php [iso-8859-1] (original) +++ branches/danny-web/reactos.org/htdocs/roscms/lib/Log.class.php [iso-8859-1] Mon Nov 24 10:12:48 2008 @@ -42,7 +42,7 @@ * @return * @access public */ - public static function prepareInfo( $data_id, $rev_id ) + public static function prepareInfo( $data_id, $rev_id = 'unknown' ) { return ' [dataid: '.$data_id.'; revid: '.$rev_id.'; userid: '.ThisUser::getInstance()->id().'; security: '.Security::rightsOverview($data_id).'] '; } // end of member function prepare_info