Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Tue, Jun 24, 11:30 PM

in-portal

Index: branches/unlabeled/unlabeled-1.15.2/kernel/units/configuration/configuration_event_handler.php
===================================================================
--- branches/unlabeled/unlabeled-1.15.2/kernel/units/configuration/configuration_event_handler.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.15.2/kernel/units/configuration/configuration_event_handler.php (revision 5497)
@@ -0,0 +1,201 @@
+<?php
+
+ class ConfigurationEventHandler extends InpDBEventHandler {
+
+
+ /**
+ * Changes permission section to one from REQUEST, not from config
+ *
+ * @param kEvent $event
+ */
+ function CheckPermission(&$event)
+ {
+ $event->setEventParam('PermSection', $this->Application->GetVar('section'));
+ return parent::CheckPermission($event);
+ }
+
+
+ /**
+ * Apply any custom changes to list's sql query
+ *
+ * @param kEvent $event
+ * @access protected
+ * @see OnListBuild
+ */
+ function SetCustomQuery(&$event)
+ {
+ $object =& $event->getObject();
+
+ $module = $this->Application->GetVar('module');
+ $section = $this->Application->GetVar('section');
+
+ $object->addFilter('module_filter', '%1$s.ModuleOwner = '.$this->Conn->qstr($module));
+ $object->addFilter('section_filter', '%1$s.Section = '.$this->Conn->qstr($section));
+ }
+
+ /**
+ * Enter description here...
+ *
+ * @param kEvent $event
+ */
+ function OnBeforeItemUpdate(&$event)
+ {
+ $object =& $event->getObject();
+
+ // if password field is empty, then don't update
+ if ($object->GetDBField('element_type') == 'password') {
+ if (trim($object->GetDBField('VariableValue')) == '') {
+ $field_options = $object->GetFieldOptions('VariableValue');
+ $field_options['skip_empty'] = 1;
+ $object->SetFieldOptions('VariableValue', $field_options);
+ }else {
+ $object->SetDBField('VariableValue', md5($object->GetDBField('VariableValue')));
+ }
+ }
+
+ $field_values = $this->Application->GetVar($event->getPrefixSpecial(true));
+
+ $state_country_hash = Array(
+ 'Comm_State' => 'Comm_Country',
+ 'Comm_Shipping_State' => 'Comm_Shipping_Country'
+ );
+
+ $field_name = $object->GetDBField('VariableName');
+ if (isset($state_country_hash[$field_name])) {
+ // if this is state field
+ $check_state = $object->GetDBField('VariableValue');
+ $check_country = $field_values[ $state_country_hash[$field_name] ]['VariableValue'];
+
+ if (!($check_country && $check_state)) {
+ return true;
+ }
+
+ $cs_helper =& $this->Application->recallObject('CountryStatesHelper');
+ $state_iso = $cs_helper->CheckState($check_state, $check_country);
+ if ($state_iso !== false) {
+ $object->SetDBField('VariableValue', $state_iso);
+ }
+ else
+ {
+ $errormsgs = $this->Application->GetVar('errormsgs');
+ $errors = !$errormsgs || !isset($errormsgs[$event->Prefix_Special]) ? Array() : $errormsgs[$event->Prefix_Special];
+
+ $errors[$field_name] = 'la_InvalidState';
+ $errormsgs[$event->Prefix_Special] = $errors;
+
+ $this->Application->SetVar('errormsgs', $errormsgs);
+ $event->status = erFAIL;
+ }
+ }
+
+ }
+
+ /**
+ * Enter description here...
+ *
+ * @param kEvent $event
+ */
+ function OnAfterItemUpdate(&$event)
+ {
+ $object =& $event->getObject();
+ if ($object->GetDBField('element_type') == 'password') {
+ if (trim($object->GetDBField('VariableValue')) == '') {
+ $field_options = $object->GetFieldOptions('VariableValue');
+ unset($field_options['skip_empty']);
+ $object->SetFieldOptions('VariableValue', $field_options);
+ }
+ }
+ }
+
+ /**
+ * Enter description here...
+ *
+ * @param kEvent $event
+ */
+ function OnUpdate(&$event)
+ {
+ if (!$this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) {
+
+ // 1. save user selected module root category
+ $items_info = $this->Application->GetVar($event->getPrefixSpecial(true));
+ $new_category_id = getArrayValue($items_info, 'ModuleRootCategory', 'VariableValue');
+ if ($new_category_id) {
+ unset($items_info['ModuleRootCategory']);
+ $this->Application->SetVar($event->getPrefixSpecial(true), $items_info);
+ }
+
+ parent::OnUpdate($event);
+
+ if ($event->status == erSUCCESS && $new_category_id !== false) {
+ // root category was submitted
+ $module = $this->Application->GetVar('module');
+ $root_category_id = $this->Application->findModule('Name', $module, 'RootCat');
+
+ if ($root_category_id != $new_category_id) {
+ // root category differs from one in db
+ $fields_hash = Array('RootCat' => $new_category_id);
+ $this->Conn->doUpdate($fields_hash, TABLE_PREFIX.'Modules', 'Name = '.$this->Conn->qstr($module));
+ }
+ }
+
+ if ($event->status == erSUCCESS) { // reset cache
+ $this->Application->UnitConfigReader->ResetParsedData();
+ }
+ }
+
+ if ($this->Application->GetVar('errormsgs')) {
+ // because we have list out there, and this is item
+ $this->Application->removeObject($event->getPrefixSpecial());
+ $event->redirect = false;
+ }
+ }
+
+ /**
+ * Enter description here...
+ *
+ * @param kEvent $event
+ */
+ /*function OnChangeCountry(&$event)
+ {
+ $event->setPseudoClass('_List');
+ $object = &$event->getObject( Array('per_page'=>-1) );
+ $object->Query();
+ $array_records =& $object->Records;
+ foreach($array_records as $i=>$record){
+ if ($record['VariableName']=='Comm_Country'){
+ $values = $this->Application->GetVar('conf');
+ $array_records[$i]['VariableValue'] = $values['Comm_Country']['VariableValue'];
+ }
+ }
+
+ $event->redirect_params = Array('opener' => 's', 'pass'=>'all,conf'); //stay!
+ $event->redirect = false;
+ }*/
+
+ /**
+ * Allows to process module root category selection
+ *
+ * @param kEvent $event
+ */
+ function OnSelectItems(&$event)
+ {
+ $object =& $event->getObject( Array('skip_autoload' => true) );
+
+ $items_info = $this->Application->GetVar('c');
+ list($resource_id, $field_values) = each($items_info);
+
+ if ($resource_id) {
+ $sql = 'SELECT CategoryId
+ FROM '.TABLE_PREFIX.'Category
+ WHERE ResourceId = '.$resource_id;
+ $category_id = $this->Conn->GetOne($sql);
+ $this->Application->StoreVar('ModuleRootCategory', $category_id);
+ }
+ $this->finalizePopup($event);
+ }
+
+ }
+
+
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.15.2/kernel/units/configuration/configuration_event_handler.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.15
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.15.2/kernel/units/general/inp1_parser.php
===================================================================
--- branches/unlabeled/unlabeled-1.15.2/kernel/units/general/inp1_parser.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.15.2/kernel/units/general/inp1_parser.php (revision 5497)
@@ -0,0 +1,156 @@
+<?php
+
+class Inp1Parser extends kHelper {
+
+ var $InportalInited = false;
+
+ var $InpParsetInited = false;
+
+ function Parse($tname, $template_body)
+ {
+ global $objTemplate, $var_list, $var_list_update;
+
+ if ( !$this->InportalInited) {
+ //$save_t = $this->Application->GetVar('t');
+ $this->InitInPortal();
+ $var_list['t'] = $this->cutTPL($var_list['t']);
+ if($var_list['t'] != $this->Application->GetVar('t'))
+ {
+ $get = $_GET;
+ unset($get['env'], $get['Action'], $get['_mod_rw_url_'], $get['rewrite']);
+ $this->Application->StoreVar('K4_Template_Referer', $this->Application->GetVar('t') );
+
+ $this->Application->Redirect($var_list['t'], $get);
+ }
+ }
+
+ $var_list['t'] = $this->cutTPL($var_list['t']);
+
+ if ($var_list['t'] != $this->Application->GetVar('t')) {
+ //$var_list['t'] = rtrim($var_list['t'],'.tpl');
+ $t = $var_list['t'];
+ $this->Application->SetVar('t', $t);
+ $template_cache =& $this->Application->recallObject('TemplatesCache');
+ $template_body = $this->Application->Parser->Parse( $template_cache->GetTemplateBody($t), $t, 0 );
+ }
+ else {
+ $this->InitParser();
+ $template_body = $objTemplate->ParseTemplateFromBuffer($tname, $template_body);
+ }
+ return $template_body;
+ }
+
+ function cutTPL($tname)
+ {
+ if( substr($tname,-4) == '.tpl' )
+ {
+ return substr($tname, 0, strlen($tname)-4 );
+ }
+ return $tname;
+ }
+
+ function InitParser()
+ {
+ global $objTemplate, $CurrentTheme, $objThemes, $objLanguageCache, $var_list;
+ if ($this->InpParsetInited) return true;
+
+ $theme_id = $this->Application->GetVar('m_theme');
+ if ($theme_id) {
+ $CurrentTheme = $objThemes->GetItem($theme_id);
+
+ $timeout = $CurrentTheme->Get('CacheTimeout');
+ $objLanguageCache->LoadTemplateCache($var_list['t'], $timeout, $theme_id);
+ $objLanguageCache->LoadCachedVars($this->Application->GetVar('m_lang'));
+
+ $objTemplate = new clsTemplateList(FULL_PATH.THEMES_PATH.'/');
+ }
+
+ $this->InpParsetInited = true;
+ }
+
+ function InitInPortal()
+ {
+ $this->InportalInited = true;
+ /*global $pathtoroot, $FrontEnd, $indexURL, $rootURL, $secureURL, $var_list, $CurrentTheme,
+ $objThemes, $objConfig, $m_var_list, $timeout, $objLanguages, $objLanguageCache,
+ $TemplateRoot, $objTemplate, $html, $objSession, $Errors, $objCatList, $objUsers,
+ $env, $mod_prefix, $ExtraVars, $timestart, $timeend, $timeout, $sqlcount, $totalsql,
+ $template_path, $modules_loaded, $mod_root_cats, $objModules, $objItemTypes;*/
+
+
+ global $sec, $usec, $timestart, $pathtoroot, $FrontEnd, $indexURL, $kernel_version, $FormError,
+ $FormValues, $ItemTables, $KeywordIgnore, $debuglevel,
+ $LogLevel, $LogFile, $rq_value, $rq_name, $dbg_constMap, $dbg_constValue, $dbg_constName,
+ $debugger, $g_LogFile, $LogData, $Errors,
+ $g_DebugMode, $totalsql, $sqlcount, $objConfig, $ItemTypePrefixes, $ItemTagFiles, $objModules,
+ $objSystemCache, $objBanList, $objItemTypes, $objThemes, $objLanguages, $objImageList, $objFavorites,
+ $objUsers, $objGroups, $DownloadId, $objPermissions, $objPermCache, $m_var_list, $objCatList,
+ $objCustomFieldList, $objCustomDataList, $objCountCache, $CRLF, $objMessageList, $objEmailQueue,
+ $ExtraVars, $adodbConnection, $sql, $rs, $mod_prefix, $modules_loaded, $name,
+ $template_path, $mod_root_cats, $value, $mod, $ItemTypes,
+ $ParserFiles, $SessionQueryString, $var_list, $objSession,
+ $orderByClause, $TemplateRoot, $ip, $UseSession, $Action, $CookieTest, $sessionId,
+ $var_list_update, $CurrentTheme, $UserID, $objCurrentUser, $objLanguageCache,
+ $folder_name, $objLinkList, $tag_override, $timeZones, $siteZone, $serverZone,
+ $lastExpire, $diffZone, $date, $nowDate, $lastExpireDate, $SearchPerformed,
+ $TotalMessagesSent, $ado, $adminDir, $rootURL, $secureURL, $html, $timeout,
+ $pathchar, $objTemplate, $objTopicList, $objArticleList, $objPostingList, $objCensorList,
+ $objSmileys, $objPMList, $SubscribeAddress, $SubscribeError, $SubscribeResult, $application;
+
+ $pathtoroot = $this->Application->IsAdmin() ? '../' : './';
+ $pathtoroot = realpath($pathtoroot)."/";
+
+ if (!file_exists($pathtoroot."config.php")) {
+ echo "In-Portal is probably not installed, or configuration file is missing.<br>";
+ echo "Please use the installation script to fix the problem.<br><br>";
+ echo "<a href='admin/install.php'>Go to installation script</a><br><br>";
+ flush();
+ die();
+ }
+
+ //ob_start();
+ $FrontEnd=1;
+
+ $indexURL="../../index.php"; //Set to relative URL from the theme directory
+
+ /* initalize the in-portal system */
+ include_once(FULL_PATH."/kernel/startup.php");
+
+ $rootURL="http://".ThisDomain().$objConfig->Get("Site_Path");
+ $secureURL = $rootURL;
+
+ if( !$var_list['t'] ) $var_list['t'] = 'index';
+
+ $this->InitParser();
+
+ // process referer in session: begin
+ if (is_object($objSession)) {
+ $k4_referer = $objSession->GetVariable('K4_Template_Referer');
+ if ($k4_referer) {
+ $_local_t = $k4_referer;
+ $this->Application->RemoveVar('K4_Template_Referer');
+ }
+ $objSession->SetVariable('Template_Referer', $_local_t);
+ }
+ // process referer in session: end
+
+ if ($this->Application->isDebugMode() && $Action) {
+ $this->Application->Debugger->setHTMLByIndex(1, 'Front Action: <b>'.$Action.'</b>', 'append');
+ }
+
+ LogEntry("Output Complete\n");
+ $objLanguageCache->SaveTemplateCache();
+ LogEntry("Templates Cached\n");
+
+ $timeend = getmicrotime();
+ $diff = $timeend - $timestart;
+
+ LogEntry("\nTotal Queries Executed: $sqlcount in $totalsql seconds\n");
+ LogEntry("\nPage Execution Time: $diff seconds\n", true);
+ if ($LogFile) {
+ fclose($LogFile);
+ }
+ }
+}
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.15.2/kernel/units/general/inp1_parser.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.15
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.15.2/kernel/admin_templates/xml/categories_list.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.15.2/kernel/admin_templates/xml/categories_list.tpl (nonexistent)
+++ branches/unlabeled/unlabeled-1.15.2/kernel/admin_templates/xml/categories_list.tpl (revision 5497)
@@ -0,0 +1,72 @@
+<inp2:m_include t="incs/blocks"/>
+<inp2:m_include t="incs/grid_blocks"/>
+<inp2:c_InitList no_special="1" per_page="-1"/>
+Grids['c'] = new Grid('c', 'table_white_selected', ':original', edit, a_toolbar);
+Grids['c'].AddItemsByIdMask('td', /^c_([0-9-]+)/, 'c[$$ID$$][CategoryId]');
+Grids['c'].InitItems();
+Grids['c'].SetDependantToolbarButtons( new Array('edit','delete','approve','decline','sep3','cut','copy','move_up','move_down','sep6'));
+<inp2:c_ViewMenu block="viewmenu_declaration" grid="Default" no_special="1" menu_perpage="no" menu_filters="yes" ajax="1"/>
+
+<!-- substiture form action, like from was created from here -->
+document.getElementById('categories_form').action = '<inp2:m_t pass="all" js_escape="1"/>';
+$Catalog.setItemCount('c', '<inp2:c_TotalRecords no_special="1"/>');
+$Catalog.ParentCategoryID = <inp2:c_GetParentCategory/>;
+document.getElementById('c_search_warning').style.display = '<inp2:m_if check="m_RecallEquals" var="c_search_keyword" value="" inverse="inverse">block<inp2:m_else/>none</inp2:m_if>';
+document.getElementById('c_search_keyword').value = '<inp2:c_SearchKeyword no_special="1" js_escape="1"/>';
+<inp2:m_DefineElement name="root_cat_caption">
+ <span class="NAV_CURRENT_ITEM">
+ <inp2:m_if check="m_ParamEquals" name="current" value="1">
+ <inp2:c_RootCategoryName />
+ <inp2:m_else/>
+ <a class="control_link" href="javascript:$Catalog.go_to_cat(0);"><inp2:c_RootCategoryName /></a>
+ </inp2:m_if>
+ </span>
+</inp2:m_DefineElement>
+
+<inp2:m_DefineElement name="category_caption">
+ <span class="NAV_CURRENT_ITEM">
+ <inp2:m_param name="separator"/>
+ <inp2:m_if check="m_ParamEquals" name="current" value="1" inverse="1">
+ <a class="control_link" href="javascript:$Catalog.go_to_cat(<inp2:m_param name="cat_id"/>);"><inp2:m_param name="cat_name"/></a>
+ <inp2:m_else/>
+ <inp2:m_param name="cat_name"/>
+ </inp2:m_if>
+ </span>
+</inp2:m_DefineElement>
+setInnerHTML('category_path', '<inp2:c_CategoryPath separator="&gt;" rootcatblock="root_cat_caption" rootmoduleblock="category_caption" currentblock="category_caption" block="category_caption" js_escape="1"/>');
+<inp2:m_if check="m_GetEquals" name="m_cat_id" value="0">
+ a_toolbar.DisableButton('upcat');
+ a_toolbar.DisableButton('homecat');
+<inp2:m_else/>
+ a_toolbar.EnableButton('upcat');
+ a_toolbar.EnableButton('homecat');
+</inp2:m_if>
+#separator#
+<inp2:c_UpdateLastTemplate template="catalog"/>
+<inp2:m_include t="categories/ci_blocks"/>
+<br />
+<table border="0" width="100%">
+ <inp2:m_DefineElement name="category_td">
+ <td valign="top" class="table_white text" id="<inp2:m_param name="PrefixSpecial"/>_<inp2:Field field="CategoryId"/>">
+ <input type="checkbox" name="<inp2:InputName field="$IdField"/>" id="<inp2:InputName field="$IdField"/>">
+ <img src="<inp2:ModulePath />img/itemicons/<inp2:ItemIcon grid="Default"/>">&nbsp;<span class="priority"><inp2:m_if check="FieldEquals" field="Priority" value="0" inverse="inverse"><sup><inp2:Field field="Priority"/></sup></inp2:m_if></span>
+ <a class="link" href="javascript:$Catalog.go_to_cat(<inp2:m_get name="c_id"/>);"><b><inp2:Field name="Name"/></b></a><span class="cat_desc">:</span>
+ <inp2:m_RenderElement name="status_mark" field="EditorsPick" type="pick" PrefixSpecial="$PrefixSpecial"/>
+ <inp2:m_RenderElement name="status_mark" field="IsNew" type="new" PrefixSpecial="$PrefixSpecial"/>
+ <span class="cats_stats">(<inp2:SubCatCount/> / <inp2:ItemCount/>)</span><br>
+ <div style="padding-left: 3px;">
+ <span class="cat_desc"><inp2:Field field="Description"/></span><br>
+ <span class="cats_stats">(<inp2:Field field="CreatedOn" format="_regional_DateFormat"/>)</span>
+ </div>
+ </td>
+ </inp2:m_DefineElement>
+ <inp2:m_if check="c_TotalRecords" no_special="1">
+ <inp2:c_CategoryList no_special="1" block_main="category_td" per_page="-1" columns="2" direction="V" IdField="CategoryId" />
+ <inp2:m_else/>
+ <tr>
+ <td class="text">
+ <inp2:m_phrase name="la_text_NoCategories"/>
+ </td>
+ </tr>
+ </inp2:m_if>
+</table></br>
Property changes on: branches/unlabeled/unlabeled-1.15.2/kernel/admin_templates/xml/categories_list.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.15
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.15.2/kernel/admin_templates/incs/ajax.js
===================================================================
--- branches/unlabeled/unlabeled-1.15.2/kernel/admin_templates/incs/ajax.js (nonexistent)
+++ branches/unlabeled/unlabeled-1.15.2/kernel/admin_templates/incs/ajax.js (revision 5497)
@@ -0,0 +1,256 @@
+// Main AJAX classs
+function Request() {}
+
+Request.timeout = 5000; //5 seconds
+Request.method = 'GET';
+Request.headers = new Array();
+Request.params = null;
+
+Request.makeRequest = function(p_url, p_busyReq, p_progId, p_successCallBack, p_errorCallBack, p_pass, p_object) {
+ //p_url: the web service url
+ //p_busyReq: is a request for this object currently in progress?
+ //p_progId: element id where progress HTML should be shown
+ //p_successCallBack: callback function for successful response
+ //p_errorCallBack: callback function for erroneous response
+ //p_pass: string of params to pass to callback functions
+ //p_object: object of params to pass to callback functions
+
+ if (p_busyReq) return;
+ var req = Request.getRequest();
+ if (req != null) {
+ p_busyReq = true;
+ Request.showProgress(p_progId);
+ req.onreadystatechange = function() {
+ if (req.readyState == 4) {
+ p_busyReq = false;
+ window.clearTimeout(toId);
+ if (req.status == 200) {
+ p_successCallBack(req, p_pass, p_object);
+ } else {
+ p_errorCallBack(req, p_pass, p_object);
+ }
+ Request.hideProgress(p_progId);
+ }
+ }
+ var $ajax_mark = (p_url.indexOf('?') ? '&' : '?') + 'ajax=yes';
+ req.open(Request.method, p_url + $ajax_mark, true);
+
+ if (Request.method == 'POST') {
+ Request.headers['Content-type'] = 'application/x-www-form-urlencoded';
+ Request.headers['referer'] = p_url;
+ }
+ else {
+ Request.headers['If-Modified-Since'] = 'Sat, 1 Jan 2000 00:00:00 GMT';
+ }
+
+ Request.sendHeaders(req);
+ if (Request.method == 'POST') {
+ req.send(Request.params);
+ Request.method = 'GET'; // restore method back to GET
+ }
+ else {
+ req.send(null);
+ }
+
+ var toId = window.setTimeout( function() {if (p_busyReq) req.abort();}, Request.timeout );
+ }
+}
+
+Request.sendHeaders = function($request) {
+ for (var $header_name in Request.headers) {
+ $request.setRequestHeader($header_name, Request.headers[$header_name]);
+ }
+ Request.headers = new Array(); // reset header afterwards
+}
+
+Request.getRequest = function() {
+ var xmlHttp;
+ try { xmlHttp = new ActiveXObject('MSXML2.XMLHTTP'); return xmlHttp; } catch (e) {}
+ try { xmlHttp = new ActiveXObject('Microsoft.XMLHTTP'); return xmlHttp; } catch (e) {}
+ try { xmlHttp = new XMLHttpRequest(); return xmlHttp; } catch(e) {}
+ return null;
+}
+
+Request.showProgress = function(p_id) {
+ if (p_id != '') {
+ Request.setOpacity(20, p_id);
+
+ if (!document.getElementById(p_id + '_progress')) {
+ document.body.appendChild(Request.getProgressObject(p_id));
+ }
+ else {
+ var $progress_div = document.getElementById(p_id + '_progress');
+ $progress_div.style.top = getRealTop(p_id) + 'px';
+ $progress_div.style.height = document.getElementById(p_id).clientHeight;
+ $progress_div.style.display = 'block';
+ }
+// document.getElementById(p_id).innerHTML = Request.getProgressHtml();
+ }
+}
+
+Request.hideProgress = function(p_id) {
+ if (p_id != '') {
+ document.getElementById(p_id + '_progress').style.display = 'none';
+ Request.setOpacity(100, p_id);
+ }
+}
+
+Request.setOpacity = function (opacity, id) {
+ var object = document.getElementById(id).style;
+ object.opacity = (opacity / 100);
+ object.MozOpacity = (opacity / 100);
+ object.KhtmlOpacity = (opacity / 100);
+ object.filter = "alpha(opacity=" + opacity + ")";
+}
+
+Request.getProgressHtml = function() {
+ return "<p class='progress'>" + Request.progressText + "<br /><img src='img/ajax_progress.gif' align='absmiddle' width='100' height='7' alt='" + Request.progressText + "'/></p>";
+}
+
+Request.getProgressObject = function($id) {
+ var $div = document.createElement('DIV');
+ var $parent_div = document.getElementById($id);
+
+ $div.id = $id + '_progress';
+
+ $div.style.width = $parent_div.clientWidth + 'px';
+ $div.style.height = '150px'; // default height if div is empty (first ajax request for div)
+ $div.style.left = getRealLeft($parent_div) + 'px';
+ $div.style.top = getRealTop($parent_div) + 'px';
+ $div.style.position = 'absolute';
+
+ /*$div.style.border = '1px solid green';
+ $div.style.backgroundColor = '#FF0000';*/
+
+ var $image_base = img_path.replace('#MODULE#', 'kernel');
+ $div.innerHTML = '<table style="width: 100%; height: 100%;"><tr><td style="text-align: center;">'+Request.progressText+'<br /><img src="'+$image_base+'/ajax_progress.gif" align="absmiddle" width="100" height="7" alt="'+escape(Request.progressText)+'" /></td></tr></table>';
+ return $div;
+}
+
+Request.getErrorHtml = function(p_req) {
+ //TODO: implement accepted way to handle request error
+ return "<p>" + "(" + p_req.status + ") " + p_req.statusText + "</p>"
+}
+
+Request.serializeForm = function(theform) {
+ if (typeof(theform) == 'string') {
+ theform = document.getElementById(theform);
+ }
+
+ var els = theform.elements;
+ var len = els.length;
+ var queryString = '';
+
+ Request.addField = function(name, value) {
+ if (queryString.length > 0) queryString += '&';
+ queryString += encodeURIComponent(name) + '=' + encodeURIComponent(value);
+ };
+
+ for (var i = 0; i<len; i++) {
+ var el = els[i];
+ if (el.disabled) continue;
+
+ switch(el.type) {
+ case 'text':
+ case 'password':
+ case 'hidden':
+ case 'textarea':
+ Request.addField(el.name, el.value);
+ break;
+
+ case 'select-one':
+ if (el.selectedIndex >= 0) {
+ Request.addField(el.name, el.options[el.selectedIndex].value);
+ }
+ break;
+
+ case 'select-multiple':
+ for (var j = 0; j < el.options.length; j++) {
+ if (!el.options[j].selected) continue;
+ Request.addField(el.name, el.options[j].value);
+ }
+ break;
+
+ case 'checkbox':
+ case 'radio':
+ if (!el.checked) continue;
+ Request.addField(el.name,el.value);
+ break;
+ }
+ }
+ return queryString;
+};
+
+// AJAX ProgressBar classs
+function AjaxProgressBar($url) {
+ this.WindowTitle = this.GetWindow().document.title;
+ this.URL = $url;
+ this.BusyRequest = false;
+ this.LastResponceTime = this.GetMicroTime();
+ this.ProgressPercent = 0; // progress percent
+ this.ProgressTime = new Array();
+ this.Query();
+}
+
+AjaxProgressBar.prototype.GetWindow = function() {
+ return window.parent ? window.parent : window;
+}
+
+AjaxProgressBar.prototype.GetMicroTime = function() {
+ var $now = new Date();
+ return Math.round($now.getTime() / 1000); // because miliseconds are returned too
+}
+
+AjaxProgressBar.prototype.Query = function() {
+ Request.makeRequest(this.URL, this.BusyRequest, '', this.successCallback, this.errorCallback, '', this);
+}
+
+// return time needed for progress to finish
+AjaxProgressBar.prototype.GetEstimatedTime = function() {
+ return Math.ceil((100 - this.ProgressPercent) * Math.sum(this.ProgressTime) / this.ProgressPercent);
+}
+
+AjaxProgressBar.prototype.successCallback = function($request, $params, $object) {
+ var $responce = $request.responseText;
+ var $match_redirect = new RegExp('^#redirect#(.*)').exec($responce);
+ if ($match_redirect != null) {
+ $object.showProgress(100);
+ // redirect to external template requested
+ window.location.href = $match_redirect[1];
+ return false;
+ }
+
+ $object.showProgress($responce);
+ $object.Query();
+}
+
+AjaxProgressBar.prototype.errorCallback = function($request, $params, $object) {
+ alert('AJAX ERROR: ' + Request.getErrorHtml($request));
+}
+
+AjaxProgressBar.prototype.FormatTime = function ($seconds) {
+ $seconds = parseInt($seconds);
+
+ var $minutes = Math.floor($seconds / 60);
+ if ($minutes < 10) $minutes = '0' + $minutes;
+ $seconds = $seconds % 60;
+ if ($seconds < 10) $seconds = '0' + $seconds;
+
+ return $minutes + ':' + $seconds;
+}
+
+AjaxProgressBar.prototype.showProgress = function ($percent) {
+ this.ProgressPercent = $percent;
+ var $now = this.GetMicroTime();
+ this.ProgressTime[this.ProgressTime.length] = $now - this.LastResponceTime;
+ this.LastResponceTime = $now;
+
+ var $display_progress = parseInt(this.ProgressPercent);
+ this.GetWindow().document.title = $display_progress + '% - ' + this.WindowTitle;
+ document.getElementById('progress_display[percents_completed]').innerHTML = $display_progress + '%';
+ document.getElementById('progress_display[elapsed_time]').innerHTML = this.FormatTime( Math.sum(this.ProgressTime) );
+ document.getElementById('progress_display[Estimated_time]').innerHTML = this.FormatTime( this.GetEstimatedTime() );
+
+ document.getElementById('progress_bar[done]').style.width = $display_progress + '%';
+ document.getElementById('progress_bar[left]').style.width = (100 - $display_progress) + '%';
+}
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.15.2/kernel/admin_templates/incs/ajax.js
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.15
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.15.2/core/kernel/utility/event.php
===================================================================
--- branches/unlabeled/unlabeled-1.15.2/core/kernel/utility/event.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.15.2/core/kernel/utility/event.php (revision 5497)
@@ -0,0 +1,301 @@
+<?php
+
+ class kEvent extends kBase {
+
+ /**
+ * Event reference, that
+ * created this event
+ *
+ * @var kEvent
+ * @access public
+ */
+ var $MasterEvent;
+
+ /**
+ * Event name
+ *
+ * @var string
+ * @access public
+ */
+ var $Name;
+
+ /**
+ * Pseudo class name
+ *
+ * @var string
+ * @access public
+ */
+ //var $Prefix;
+
+ /**
+ * Special, that is recognized
+ * by class with pseudo class
+ * equals to $Prefix attrbute.
+ *
+ * @var string
+ * @access public
+ */
+ //var $Special;
+
+ /**
+ * Joined prefix and special,
+ * usually taken directly from
+ * tag beeing processes, to use
+ * in recallObject method
+ *
+ * @var string
+ */
+ var $Prefix_Special;
+
+ /**
+ * Do not execute Before hooks
+ * while processing main event
+ *
+ * @var bool
+ * @access public
+ */
+ var $SkipBeforeHooks = false;
+
+ /**
+ * Do not execute After hooks
+ * while processing main event
+ *
+ * @var bool
+ * @access public
+ */
+ var $SkipAfterHooks = false;
+
+ /**
+ * Redirect is allowed after
+ * this event
+ *
+ * @var bool
+ * @access public
+ */
+ var $redirect = true;
+
+ /**
+ * Params passed to redirect on succsessfull event
+ *
+ * @var bool
+ * @access public
+ */
+ var $redirect_params = null;
+
+ /**
+ * php file to redirect to
+ *
+ * @var string
+ * @access public
+ */
+ var $redirect_script = null;
+
+ /**
+ * Event processing result
+ *
+ * @var int
+ * @access public
+ */
+ var $status = erSUCCESS;
+
+ /**
+ * Each event specific only params,
+ * that they use for communication
+ *
+ * @var Array
+ * @access public
+ */
+ var $specificParams = Array();
+
+ /**
+ * Pseudo class used to create object,
+ * in case if one is not already created
+ *
+ * @var string
+ * @access public
+ */
+ var $pseudoClass = '';
+
+ /**
+ * Create event based on params passed
+ *
+ * @param Array $params
+ * @return kEvent
+ * @access public
+ */
+ function kEvent($params=Array(), $specificParams=null)
+ {
+ parent::kBase();
+ if($params && is_array($params))
+ {
+ $prefix = getArrayValue($params,'prefix');
+ $special = getArrayValue($params,'special');
+ if($prefix) $this->Init($prefix,$special);
+ $this->Name = getArrayValue($params,'name');
+ }
+ elseif ($params && is_string($params)) {
+ if (preg_match('/([^.:]*)[.]{0,1}([^:]*):(.*)/', $params, $regs)) {
+ $prefix = $regs[1];
+ $special = $regs[2];
+ if($prefix) $this->Init($prefix,$special);
+ $this->Name = $regs[3];
+ }
+ else {
+ trigger_error('Invalid event string '.$params.' should be prefix[.special]:OnEvent ', E_USER_ERROR);
+ }
+ }
+ if (isset($specificParams)) $this->specificParams = $specificParams;
+ }
+
+ function setEventParam($name,$value)
+ {
+ $this->specificParams[$name]=$value;
+ }
+
+ function getEventParam($name)
+ {
+ $args = func_get_args();
+ array_unshift($args, $this->specificParams);
+ return call_user_func_array('getArrayValue', $args); // getArrayValue($this->specificParams, $name);
+ }
+
+ function getPrefixSpecial($from_submit=false)
+ {
+ $separator=!$from_submit?'.':'_';
+ $ret=$this->Prefix.$separator.$this->Special;
+ return rtrim($ret,$separator);
+ }
+
+ /**
+ * Set's pseudo class that differs from
+ * the one specified in $Prefix
+ *
+ * @param string $appendix
+ * @access public
+ */
+ function setPseudoClass($appendix)
+ {
+ $this->pseudoClass = $this->Prefix.$appendix;
+ }
+
+ function Init($prefix, $special = '')
+ {
+ $this->Prefix = $prefix;
+ $this->pseudoClass = $prefix; // default value
+ $this->Special = $special;
+ $this->Prefix_Special = rtrim($this->Prefix.'.'.$this->Special,'.');
+ }
+
+ /**
+ * Returns object used in event
+ *
+ * @access public
+ * @return kDBBase
+ */
+ function &getObject($params = Array())
+ {
+ $object =& $this->Application->recallObject($this->Prefix_Special, $this->pseudoClass, $params);
+ return $object;
+ }
+
+ /**
+ * Calls passed event by name in current prefix/special environment
+ * Called event gets this event as MasterEvent,
+ * but its results (status and redirect* properties are copied back to current event)
+ *
+ * @param string $name EventName to call
+ */
+ function CallSubEvent($name)
+ {
+ $child_event = new kEvent();
+ $child_event->MasterEvent =& $this;
+ $child_event->Prefix = $this->Prefix;
+ $child_event->Special = $this->Special;
+ $child_event->Prefix_Special = $this->Prefix_Special;
+ $child_event->redirect = $this->redirect;
+ $child_event->redirect_params = $this->redirect_params;
+ $child_event->redirect_script = $this->redirect_script;
+ $child_event->Name = $name;
+
+ $this->Application->HandleEvent( $child_event );
+
+ $this->status = $child_event->status;
+ $this->redirect = $child_event->redirect;
+ $this->redirect_params = $child_event->redirect_params;
+ $this->redirect_script = $child_event->redirect_script;
+ }
+
+ /**
+ * Set's redirect param for event
+ *
+ * @param string $name
+ * @param string $value
+ * @access public
+ */
+ function SetRedirectParam($name, $value)
+ {
+ $this->redirect_params[$name] = $value;
+ }
+
+ /**
+ * Allows to merge passed redirect params hash with existing ones
+ *
+ * @param Array $params
+ * @access public
+ */
+ function setRedirectParams($params)
+ {
+ $this->redirect_params = array_merge_recursive2($this->redirect_params, $params);
+ }
+
+ /**
+ * Returns Master event name if any
+ *
+ * @return mixed
+ * @access public
+ */
+ function hasMasterEvent()
+ {
+ return is_object($this->MasterEvent) ? $this->MasterEvent->Name : false;
+ }
+
+ /**
+ * Allows to tell if this event was called some how (e.g. subevent, hook) from event requested
+ *
+ * @param string $event_key event key in format [prefix[.special]:]event_name
+ * @return unknown
+ */
+ function hasAncestor($event_key)
+ {
+ $event_manager =& $this->Application->recallObject('EventManager');
+ if (strpos($event_key, ':') === false) {
+ $event_key = $this->getPrefixSpecial().':'.$event_key;
+ }
+
+ return $event_manager->eventRunning($event_key);
+ }
+
+ /**
+ * Returns section for current event
+ *
+ * @return string
+ */
+ function getSection()
+ {
+ $perm_section = $this->getEventParam('PermSection');
+ if ($perm_section) {
+ return $perm_section;
+ }
+
+ $top_prefix = $this->getEventParam('top_prefix');
+ $section = $this->Application->getUnitOption($top_prefix.'.main', 'PermSection');
+
+ if (!$section) {
+ trigger_error('Permission <b>section</b> not specified for prefix <b>'.$top_prefix.'</b>', E_USER_ERROR);
+ }
+ return $section;
+ }
+
+ }
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.15.2/core/kernel/utility/event.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.15
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.15.2/core/kernel/languages/phrases_cache.php
===================================================================
--- branches/unlabeled/unlabeled-1.15.2/core/kernel/languages/phrases_cache.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.15.2/core/kernel/languages/phrases_cache.php (revision 5497)
@@ -0,0 +1,220 @@
+<?php
+
+class PhrasesCache extends kBase {
+
+ /**
+ * Connection to database
+ *
+ * @var kDBConnection
+ * @access public
+ */
+ var $Conn;
+
+ var $Phrases = Array();
+ var $Ids = Array();
+ var $OriginalIds = Array(); //for comparing cache
+
+ var $LanguageId = 1;
+
+ var $fromTag = false;
+
+ function PhrasesCache()
+ {
+ parent::kBase();
+ $this->Conn =& $this->Application->GetADODBConnection();
+ }
+
+ function Init($prefix, $special = '')
+ {
+ $this->LanguageId = $this->Application->GetVar('m_lang');
+ if (isset($this->Application->Caches['PhraseList'])) {
+ $this->LoadPhrases( $this->Application->Caches['PhraseList'] );
+ }
+ }
+
+ function GetCachedIds()
+ {
+ $query = sprintf("SELECT PhraseList, ConfigVariables FROM %s WHERE Template = %s",
+ TABLE_PREFIX.'PhraseCache',
+ $this->Conn->Qstr(md5($this->Application->GetVar('t').$this->Application->GetVar('m_theme').$this->Application->GetVar('m_lang'))));
+ $res = $this->Conn->GetRow($query);
+
+ if ($res && $res['ConfigVariables']) {
+ $this->Application->OriginalConfigCacheIds = explode(',', $res['ConfigVariables']);
+ $this->Application->ConfigCacheIds = $this->Application->OriginalConfigCacheIds;
+ }
+
+ return ($res === false) ? Array() : explode(',', $res['PhraseList']);
+ }
+
+ function LoadPhrases($ids)
+ {
+ if ( !is_array($ids) || !implode('', $ids) ) return;
+ $query = sprintf("SELECT Translation,UPPER(Phrase) AS Phrase FROM %s WHERE LanguageId = %s AND PhraseId IN (%s)",
+ TABLE_PREFIX.'Phrase',
+ $this->LanguageId,
+ join(',', $ids));
+ $this->Phrases = $this->Conn->GetCol($query,'Phrase');
+ /*foreach($phrases as $phrase => $tanslation)
+ {
+ $this->AddCachedPhrase(strtoupper($phrase), $tanslation);
+ }*/
+ $this->Ids = $ids;
+ $this->OriginalIds = $ids;
+ }
+
+ function AddCachedPhrase($label, $value)
+ {
+ $label = strtoupper($label);
+ $this->Phrases[$label] = $value;
+ }
+
+ function NeedsCacheUpdate()
+ {
+ return is_array($this->Ids) && count($this->Ids) > 0 && $this->Ids != $this->OriginalIds;
+ }
+
+ function UpdateCache()
+ {
+ $update = false;
+ //something changed
+ $update = $update || (is_array($this->Ids) && count($this->Ids) > 0 && $this->Ids != $this->OriginalIds);
+ $update = $update || (count($this->Application->ConfigCacheIds) && $this->Application->ConfigCacheIds != $this->Application->OriginalConfigCacheIds);
+ if ($update) {
+ $query = sprintf("REPLACE %s (PhraseList, CacheDate, Template, ConfigVariables)
+ VALUES (%s, %s, %s, %s)",
+ TABLE_PREFIX.'PhraseCache',
+ $this->Conn->Qstr(join(',', $this->Ids)),
+ adodb_mktime(),
+ $this->Conn->Qstr(md5($this->Application->GetVar('t').$this->Application->GetVar('m_theme').$this->Application->GetVar('m_lang'))),
+ $this->Conn->qstr(implode(',', array_unique($this->Application->ConfigCacheIds))));
+ $this->Conn->Query($query);
+ }
+ }
+
+ function GetPhrase($label)
+ {
+ if (ereg("^!.+!$", $label) > 0)
+ {
+ $label = substr($label, 1, -1); //cut exclamation marks
+ }
+
+ if( strlen($label) == 0 ) return '';
+
+ $original_label = $label;
+ $label = strtoupper($label);
+ if(isset($this->Phrases[$label])) {
+ $translated_label = $this->Phrases[$label];
+ // debug mode is checked directly to improve performance
+ if (defined('DEBUG_MODE') && DEBUG_MODE && constOn('DBG_PHRASES_HIGHLIGHT')) {
+ if (!$this->Application->isDebugMode()) return $translated_label;
+
+ if ($this->Application->IsAdmin()) {
+ $sql = 'SELECT Module
+ FROM '.TABLE_PREFIX.'Phrase
+ WHERE (LanguageId = '.$this->LanguageId.') AND (Phrase = '.$this->Conn->qstr($label).')';
+ $this->Application->Debugger->appendHTML('Phrase: <b>'.$label.'</b>; Module: <b>'.$this->Conn->GetOne($sql).'</b>');
+// $translated_label = $translated_label.' [m: '.$this->Conn->GetOne($sql).'; l: '.$label.']';
+ }
+ else {
+ // highlight text created via translated phrase (used to detect if text on screen is phrase or not)
+ $translated_label = '<span style="border: 1px solid #999999; background-color: #cccccc; color: #999999; ">'.$translated_label.'</span></a> <span style="color: red; background-color:#ffffcc">'.$original_label.'</span>';
+ }
+
+ }
+ return $translated_label;
+ }
+
+ $this->LoadPhraseByLabel($label, $original_label);
+ return $this->GetPhrase($label);
+ }
+
+ function LoadPhraseByLabel($label, $original_label)
+ {
+ $query = sprintf("SELECT PhraseId, Translation FROM %s WHERE LanguageId = %s AND UPPER(Phrase) = UPPER(%s)",
+ TABLE_PREFIX.'Phrase',
+ $this->LanguageId,
+ $this->Conn->qstr($label));
+ $res = $this->Conn->GetRow($query);
+ if ($res === false || count($res) == 0)
+ {
+ $translation = '!'.$label.'!';
+ if($this->Application->isDebugMode() && constOn('DBG_PHRASES')) {
+ list($edit_tpl, $index_file) = $this->Application->IsAdmin() ? Array('regional/phrases_edit', 'index4.php') : Array('phrases_edit', 'index.php');
+
+ $edit_url = $this->Application->HREF($edit_tpl,'',Array('m_opener'=>'d','phrases_label'=>$original_label,'phrases_event'=>'OnNew', 'pass'=>'all,phrases'), $index_file );
+ $translation = '<a href="'.$edit_url.'">!'.$label.'!</a>';
+ if($this->fromTag) $translation = $this->escapeTagReserved($translation);
+ }
+ $this->AddCachedPhrase($label, $translation); //add it as already cached, as long as we dont need to cache not found phrase
+ return false;
+ }
+
+ $this->Phrases[$label] = $res['Translation'];
+ array_push($this->Ids, $res['PhraseId']);
+ $this->Ids = array_unique($this->Ids); //just to make sure
+ return true;
+ }
+
+ /**
+ * Sort params by name and then by length
+ *
+ * @param string $a
+ * @param string $b
+ * @return int
+ * @access private
+ */
+ function CmpParams($a, $b)
+ {
+ $a_len = strlen($a);
+ $b_len = strlen($b);
+ if ($a_len == $b_len) return 0;
+ return $a_len > $b_len ? -1 : 1;
+ }
+
+ /**
+ * Replace language tags in exclamation marks found in text
+ *
+ * @param string $text
+ * @param bool $force_escape force escaping, not escaping of resulting string
+ * @return string
+ * @access public
+ */
+ function ReplaceLanguageTags($text,$forse_escaping=null)
+ {
+ $this->fromTag = true;
+ if( isset($forse_escaping) ) $this->fromTag = $forse_escaping;
+ preg_match_all("(!(la|lu)[^!]+!)", $text, $res, PREG_PATTERN_ORDER);
+ $language_tags = $res[0];
+ uasort($language_tags, Array(&$this, 'CmpParams') );
+
+ $values = Array();
+ $i = 0;
+ foreach ($language_tags as $label) {
+ array_push($values, $this->GetPhrase($label) );
+ //array_push($values, $this->Application->Phrase($label) );
+ $language_tags[$i] = '/' . $language_tags[$i] . '/';
+ $i++;
+ }
+ $this->fromTag = false;
+ return preg_replace($language_tags, $values, $text);
+ }
+
+ /**
+ * Escape chars in phrase translation, that could harm parser to process tag
+ *
+ * @param string $text
+ * @return string
+ * @access private
+ */
+ function escapeTagReserved($text)
+ {
+ $reserved = Array('"',"'"); // =
+ $replacement = Array('\"',"\'"); // \=
+ return str_replace($reserved,$replacement,$text);
+ }
+
+}
+
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.15.2/core/kernel/languages/phrases_cache.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.15
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.15.2/core/units/configuration/configuration_config.php
===================================================================
--- branches/unlabeled/unlabeled-1.15.2/core/units/configuration/configuration_config.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.15.2/core/units/configuration/configuration_config.php (revision 5497)
@@ -0,0 +1,78 @@
+<?php
+
+$config = Array(
+ 'Prefix' => 'conf',
+ 'ItemClass' => Array('class'=>'ConfigurationItem','file'=>'configuration.php','build_event'=>'OnItemBuild'),
+ 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
+ 'EventHandlerClass' => Array('class'=>'ConfigurationEventHandler','file'=>'configuration_event_handler.php','build_event'=>'OnBuild'),
+ 'TagProcessorClass' => Array('class'=>'ConfigurationTagProcessor','file'=>'configuration_tag_processor.php','build_event'=>'OnBuild'),
+ 'AutoLoad' => true,
+ 'Hooks' => Array(),
+ 'QueryString' => Array(
+ 1 => 'id',
+ 2 => 'page',
+ 3 => 'event',
+ ),
+
+ 'IDField' => 'VariableName',
+
+ 'TitlePresets' => Array(
+ 'default' => Array('tag_params' => Array('conf' => Array('per_page' => -1))),
+
+ 'config_list_general' => Array('prefixes' => Array('conf_List'), 'format' => "!la_updating_config!"),
+ 'config_list_output' => Array('prefixes' => Array('conf_List'), 'format' => "!la_updating_config!"),
+ 'config_list_contacts' => Array('prefixes' => Array('conf_List'), 'format' => "!la_updating_config!"),
+
+ 'config_list_categories' => Array('prefixes' => Array('conf_List'), 'format' => "!la_updating_config!"),
+ 'config_list_users' => Array('prefixes' => Array('conf_List'), 'format' => "!la_updating_config!"),
+ ),
+
+ 'TableName' => TABLE_PREFIX.'ConfigurationValues',
+
+ 'ListSQLs' => Array('' => ' SELECT %1$s.* %2$s
+ FROM '.TABLE_PREFIX.'ConfigurationAdmin ca
+ LEFT JOIN %1$s USING(VariableName)'),
+
+ 'ItemSQLs' => Array('' => ' SELECT %1$s.* %2$s
+ FROM '.TABLE_PREFIX.'ConfigurationAdmin ca
+ LEFT JOIN %1$s USING(VariableName)'),
+
+ 'ListSortings' => Array(
+ '' => Array(
+ 'Sorting' => Array('DisplayOrder' => 'asc', 'GroupDisplayOrder' => 'asc'),
+ )
+ ),
+
+ 'CalculatedFields' => Array (
+ '' => Array (
+ 'heading' => 'ca.heading',
+ 'prompt' => 'ca.prompt',
+ 'element_type' => 'ca.element_type',
+ 'ValueList' => 'ca.ValueList',
+ 'DisplayOrder' => 'ca.DisplayOrder',
+ 'GroupDisplayOrder' => 'ca.GroupDisplayOrder',
+ 'Install' => 'ca.Install',
+ ),
+ ),
+
+ 'Fields' => Array(
+ 'VariableName' => Array('type' => 'string','not_null' => '1','default' => ''),
+ 'VariableValue' => array('type'=>'string', 'default'=>''),
+ 'ModuleOwner' => array('type'=>'string', 'default'=>'In-Portal'),
+ 'Section' => array('type'=>'string','not_null' => '1','default'=>''),
+ ),
+
+ 'VirtualFields' => Array(
+ 'heading' => Array('type' => 'string', 'default' => ''),
+ 'prompt' => Array('type' => 'string', 'default' => ''),
+ 'element_type' => Array('type' => 'string', 'not_null' => '1', 'default' => ''),
+ 'ValueList' => Array('type' => 'string', 'default' => ''),
+ 'DisplayOrder' => Array('type' => 'double', 'not_null' => '1', 'default' => 0),
+ 'GroupDisplayOrder' => Array('type' => 'double', 'not_null' => '1', 'default' => 0),
+ 'Install' => Array('type' => 'int', 'not_null' => '1', 'default' => 1),
+ ),
+
+ 'Grids' => Array(),
+ );
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.15.2/core/units/configuration/configuration_config.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.15
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.15.2/core/units/configuration/configuration_event_handler.php
===================================================================
--- branches/unlabeled/unlabeled-1.15.2/core/units/configuration/configuration_event_handler.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.15.2/core/units/configuration/configuration_event_handler.php (revision 5497)
@@ -0,0 +1,201 @@
+<?php
+
+ class ConfigurationEventHandler extends InpDBEventHandler {
+
+
+ /**
+ * Changes permission section to one from REQUEST, not from config
+ *
+ * @param kEvent $event
+ */
+ function CheckPermission(&$event)
+ {
+ $event->setEventParam('PermSection', $this->Application->GetVar('section'));
+ return parent::CheckPermission($event);
+ }
+
+
+ /**
+ * Apply any custom changes to list's sql query
+ *
+ * @param kEvent $event
+ * @access protected
+ * @see OnListBuild
+ */
+ function SetCustomQuery(&$event)
+ {
+ $object =& $event->getObject();
+
+ $module = $this->Application->GetVar('module');
+ $section = $this->Application->GetVar('section');
+
+ $object->addFilter('module_filter', '%1$s.ModuleOwner = '.$this->Conn->qstr($module));
+ $object->addFilter('section_filter', '%1$s.Section = '.$this->Conn->qstr($section));
+ }
+
+ /**
+ * Enter description here...
+ *
+ * @param kEvent $event
+ */
+ function OnBeforeItemUpdate(&$event)
+ {
+ $object =& $event->getObject();
+
+ // if password field is empty, then don't update
+ if ($object->GetDBField('element_type') == 'password') {
+ if (trim($object->GetDBField('VariableValue')) == '') {
+ $field_options = $object->GetFieldOptions('VariableValue');
+ $field_options['skip_empty'] = 1;
+ $object->SetFieldOptions('VariableValue', $field_options);
+ }else {
+ $object->SetDBField('VariableValue', md5($object->GetDBField('VariableValue')));
+ }
+ }
+
+ $field_values = $this->Application->GetVar($event->getPrefixSpecial(true));
+
+ $state_country_hash = Array(
+ 'Comm_State' => 'Comm_Country',
+ 'Comm_Shipping_State' => 'Comm_Shipping_Country'
+ );
+
+ $field_name = $object->GetDBField('VariableName');
+ if (isset($state_country_hash[$field_name])) {
+ // if this is state field
+ $check_state = $object->GetDBField('VariableValue');
+ $check_country = $field_values[ $state_country_hash[$field_name] ]['VariableValue'];
+
+ if (!($check_country && $check_state)) {
+ return true;
+ }
+
+ $cs_helper =& $this->Application->recallObject('CountryStatesHelper');
+ $state_iso = $cs_helper->CheckState($check_state, $check_country);
+ if ($state_iso !== false) {
+ $object->SetDBField('VariableValue', $state_iso);
+ }
+ else
+ {
+ $errormsgs = $this->Application->GetVar('errormsgs');
+ $errors = !$errormsgs || !isset($errormsgs[$event->Prefix_Special]) ? Array() : $errormsgs[$event->Prefix_Special];
+
+ $errors[$field_name] = 'la_InvalidState';
+ $errormsgs[$event->Prefix_Special] = $errors;
+
+ $this->Application->SetVar('errormsgs', $errormsgs);
+ $event->status = erFAIL;
+ }
+ }
+
+ }
+
+ /**
+ * Enter description here...
+ *
+ * @param kEvent $event
+ */
+ function OnAfterItemUpdate(&$event)
+ {
+ $object =& $event->getObject();
+ if ($object->GetDBField('element_type') == 'password') {
+ if (trim($object->GetDBField('VariableValue')) == '') {
+ $field_options = $object->GetFieldOptions('VariableValue');
+ unset($field_options['skip_empty']);
+ $object->SetFieldOptions('VariableValue', $field_options);
+ }
+ }
+ }
+
+ /**
+ * Enter description here...
+ *
+ * @param kEvent $event
+ */
+ function OnUpdate(&$event)
+ {
+ if (!$this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) {
+
+ // 1. save user selected module root category
+ $items_info = $this->Application->GetVar($event->getPrefixSpecial(true));
+ $new_category_id = getArrayValue($items_info, 'ModuleRootCategory', 'VariableValue');
+ if ($new_category_id) {
+ unset($items_info['ModuleRootCategory']);
+ $this->Application->SetVar($event->getPrefixSpecial(true), $items_info);
+ }
+
+ parent::OnUpdate($event);
+
+ if ($event->status == erSUCCESS && $new_category_id !== false) {
+ // root category was submitted
+ $module = $this->Application->GetVar('module');
+ $root_category_id = $this->Application->findModule('Name', $module, 'RootCat');
+
+ if ($root_category_id != $new_category_id) {
+ // root category differs from one in db
+ $fields_hash = Array('RootCat' => $new_category_id);
+ $this->Conn->doUpdate($fields_hash, TABLE_PREFIX.'Modules', 'Name = '.$this->Conn->qstr($module));
+ }
+ }
+
+ if ($event->status == erSUCCESS) { // reset cache
+ $this->Application->UnitConfigReader->ResetParsedData();
+ }
+ }
+
+ if ($this->Application->GetVar('errormsgs')) {
+ // because we have list out there, and this is item
+ $this->Application->removeObject($event->getPrefixSpecial());
+ $event->redirect = false;
+ }
+ }
+
+ /**
+ * Enter description here...
+ *
+ * @param kEvent $event
+ */
+ /*function OnChangeCountry(&$event)
+ {
+ $event->setPseudoClass('_List');
+ $object = &$event->getObject( Array('per_page'=>-1) );
+ $object->Query();
+ $array_records =& $object->Records;
+ foreach($array_records as $i=>$record){
+ if ($record['VariableName']=='Comm_Country'){
+ $values = $this->Application->GetVar('conf');
+ $array_records[$i]['VariableValue'] = $values['Comm_Country']['VariableValue'];
+ }
+ }
+
+ $event->redirect_params = Array('opener' => 's', 'pass'=>'all,conf'); //stay!
+ $event->redirect = false;
+ }*/
+
+ /**
+ * Allows to process module root category selection
+ *
+ * @param kEvent $event
+ */
+ function OnSelectItems(&$event)
+ {
+ $object =& $event->getObject( Array('skip_autoload' => true) );
+
+ $items_info = $this->Application->GetVar('c');
+ list($resource_id, $field_values) = each($items_info);
+
+ if ($resource_id) {
+ $sql = 'SELECT CategoryId
+ FROM '.TABLE_PREFIX.'Category
+ WHERE ResourceId = '.$resource_id;
+ $category_id = $this->Conn->GetOne($sql);
+ $this->Application->StoreVar('ModuleRootCategory', $category_id);
+ }
+ $this->finalizePopup($event);
+ }
+
+ }
+
+
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.15.2/core/units/configuration/configuration_event_handler.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.15
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.15.2/core/units/general/inp1_parser.php
===================================================================
--- branches/unlabeled/unlabeled-1.15.2/core/units/general/inp1_parser.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.15.2/core/units/general/inp1_parser.php (revision 5497)
@@ -0,0 +1,156 @@
+<?php
+
+class Inp1Parser extends kHelper {
+
+ var $InportalInited = false;
+
+ var $InpParsetInited = false;
+
+ function Parse($tname, $template_body)
+ {
+ global $objTemplate, $var_list, $var_list_update;
+
+ if ( !$this->InportalInited) {
+ //$save_t = $this->Application->GetVar('t');
+ $this->InitInPortal();
+ $var_list['t'] = $this->cutTPL($var_list['t']);
+ if($var_list['t'] != $this->Application->GetVar('t'))
+ {
+ $get = $_GET;
+ unset($get['env'], $get['Action'], $get['_mod_rw_url_'], $get['rewrite']);
+ $this->Application->StoreVar('K4_Template_Referer', $this->Application->GetVar('t') );
+
+ $this->Application->Redirect($var_list['t'], $get);
+ }
+ }
+
+ $var_list['t'] = $this->cutTPL($var_list['t']);
+
+ if ($var_list['t'] != $this->Application->GetVar('t')) {
+ //$var_list['t'] = rtrim($var_list['t'],'.tpl');
+ $t = $var_list['t'];
+ $this->Application->SetVar('t', $t);
+ $template_cache =& $this->Application->recallObject('TemplatesCache');
+ $template_body = $this->Application->Parser->Parse( $template_cache->GetTemplateBody($t), $t, 0 );
+ }
+ else {
+ $this->InitParser();
+ $template_body = $objTemplate->ParseTemplateFromBuffer($tname, $template_body);
+ }
+ return $template_body;
+ }
+
+ function cutTPL($tname)
+ {
+ if( substr($tname,-4) == '.tpl' )
+ {
+ return substr($tname, 0, strlen($tname)-4 );
+ }
+ return $tname;
+ }
+
+ function InitParser()
+ {
+ global $objTemplate, $CurrentTheme, $objThemes, $objLanguageCache, $var_list;
+ if ($this->InpParsetInited) return true;
+
+ $theme_id = $this->Application->GetVar('m_theme');
+ if ($theme_id) {
+ $CurrentTheme = $objThemes->GetItem($theme_id);
+
+ $timeout = $CurrentTheme->Get('CacheTimeout');
+ $objLanguageCache->LoadTemplateCache($var_list['t'], $timeout, $theme_id);
+ $objLanguageCache->LoadCachedVars($this->Application->GetVar('m_lang'));
+
+ $objTemplate = new clsTemplateList(FULL_PATH.THEMES_PATH.'/');
+ }
+
+ $this->InpParsetInited = true;
+ }
+
+ function InitInPortal()
+ {
+ $this->InportalInited = true;
+ /*global $pathtoroot, $FrontEnd, $indexURL, $rootURL, $secureURL, $var_list, $CurrentTheme,
+ $objThemes, $objConfig, $m_var_list, $timeout, $objLanguages, $objLanguageCache,
+ $TemplateRoot, $objTemplate, $html, $objSession, $Errors, $objCatList, $objUsers,
+ $env, $mod_prefix, $ExtraVars, $timestart, $timeend, $timeout, $sqlcount, $totalsql,
+ $template_path, $modules_loaded, $mod_root_cats, $objModules, $objItemTypes;*/
+
+
+ global $sec, $usec, $timestart, $pathtoroot, $FrontEnd, $indexURL, $kernel_version, $FormError,
+ $FormValues, $ItemTables, $KeywordIgnore, $debuglevel,
+ $LogLevel, $LogFile, $rq_value, $rq_name, $dbg_constMap, $dbg_constValue, $dbg_constName,
+ $debugger, $g_LogFile, $LogData, $Errors,
+ $g_DebugMode, $totalsql, $sqlcount, $objConfig, $ItemTypePrefixes, $ItemTagFiles, $objModules,
+ $objSystemCache, $objBanList, $objItemTypes, $objThemes, $objLanguages, $objImageList, $objFavorites,
+ $objUsers, $objGroups, $DownloadId, $objPermissions, $objPermCache, $m_var_list, $objCatList,
+ $objCustomFieldList, $objCustomDataList, $objCountCache, $CRLF, $objMessageList, $objEmailQueue,
+ $ExtraVars, $adodbConnection, $sql, $rs, $mod_prefix, $modules_loaded, $name,
+ $template_path, $mod_root_cats, $value, $mod, $ItemTypes,
+ $ParserFiles, $SessionQueryString, $var_list, $objSession,
+ $orderByClause, $TemplateRoot, $ip, $UseSession, $Action, $CookieTest, $sessionId,
+ $var_list_update, $CurrentTheme, $UserID, $objCurrentUser, $objLanguageCache,
+ $folder_name, $objLinkList, $tag_override, $timeZones, $siteZone, $serverZone,
+ $lastExpire, $diffZone, $date, $nowDate, $lastExpireDate, $SearchPerformed,
+ $TotalMessagesSent, $ado, $adminDir, $rootURL, $secureURL, $html, $timeout,
+ $pathchar, $objTemplate, $objTopicList, $objArticleList, $objPostingList, $objCensorList,
+ $objSmileys, $objPMList, $SubscribeAddress, $SubscribeError, $SubscribeResult, $application;
+
+ $pathtoroot = $this->Application->IsAdmin() ? '../' : './';
+ $pathtoroot = realpath($pathtoroot)."/";
+
+ if (!file_exists($pathtoroot."config.php")) {
+ echo "In-Portal is probably not installed, or configuration file is missing.<br>";
+ echo "Please use the installation script to fix the problem.<br><br>";
+ echo "<a href='admin/install.php'>Go to installation script</a><br><br>";
+ flush();
+ die();
+ }
+
+ //ob_start();
+ $FrontEnd=1;
+
+ $indexURL="../../index.php"; //Set to relative URL from the theme directory
+
+ /* initalize the in-portal system */
+ include_once(FULL_PATH."/kernel/startup.php");
+
+ $rootURL="http://".ThisDomain().$objConfig->Get("Site_Path");
+ $secureURL = $rootURL;
+
+ if( !$var_list['t'] ) $var_list['t'] = 'index';
+
+ $this->InitParser();
+
+ // process referer in session: begin
+ if (is_object($objSession)) {
+ $k4_referer = $objSession->GetVariable('K4_Template_Referer');
+ if ($k4_referer) {
+ $_local_t = $k4_referer;
+ $this->Application->RemoveVar('K4_Template_Referer');
+ }
+ $objSession->SetVariable('Template_Referer', $_local_t);
+ }
+ // process referer in session: end
+
+ if ($this->Application->isDebugMode() && $Action) {
+ $this->Application->Debugger->setHTMLByIndex(1, 'Front Action: <b>'.$Action.'</b>', 'append');
+ }
+
+ LogEntry("Output Complete\n");
+ $objLanguageCache->SaveTemplateCache();
+ LogEntry("Templates Cached\n");
+
+ $timeend = getmicrotime();
+ $diff = $timeend - $timestart;
+
+ LogEntry("\nTotal Queries Executed: $sqlcount in $totalsql seconds\n");
+ LogEntry("\nPage Execution Time: $diff seconds\n", true);
+ if ($LogFile) {
+ fclose($LogFile);
+ }
+ }
+}
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.15.2/core/units/general/inp1_parser.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.15
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.15.2/core/admin_templates/categories/xml/categories_list.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.15.2/core/admin_templates/categories/xml/categories_list.tpl (nonexistent)
+++ branches/unlabeled/unlabeled-1.15.2/core/admin_templates/categories/xml/categories_list.tpl (revision 5497)
@@ -0,0 +1,72 @@
+<inp2:m_include t="incs/blocks"/>
+<inp2:m_include t="incs/grid_blocks"/>
+<inp2:c_InitList no_special="1" per_page="-1"/>
+Grids['c'] = new Grid('c', 'table_white_selected', ':original', edit, a_toolbar);
+Grids['c'].AddItemsByIdMask('td', /^c_([0-9-]+)/, 'c[$$ID$$][CategoryId]');
+Grids['c'].InitItems();
+Grids['c'].SetDependantToolbarButtons( new Array('edit','delete','approve','decline','sep3','cut','copy','move_up','move_down','sep6'));
+<inp2:c_ViewMenu block="viewmenu_declaration" grid="Default" no_special="1" menu_perpage="no" menu_filters="yes" ajax="1"/>
+
+<!-- substiture form action, like from was created from here -->
+document.getElementById('categories_form').action = '<inp2:m_t pass="all" js_escape="1"/>';
+$Catalog.setItemCount('c', '<inp2:c_TotalRecords no_special="1"/>');
+$Catalog.ParentCategoryID = <inp2:c_GetParentCategory/>;
+document.getElementById('c_search_warning').style.display = '<inp2:m_if check="m_RecallEquals" var="c_search_keyword" value="" inverse="inverse">block<inp2:m_else/>none</inp2:m_if>';
+document.getElementById('c_search_keyword').value = '<inp2:c_SearchKeyword no_special="1" js_escape="1"/>';
+<inp2:m_DefineElement name="root_cat_caption">
+ <span class="NAV_CURRENT_ITEM">
+ <inp2:m_if check="m_ParamEquals" name="current" value="1">
+ <inp2:c_RootCategoryName />
+ <inp2:m_else/>
+ <a class="control_link" href="javascript:$Catalog.go_to_cat(0);"><inp2:c_RootCategoryName /></a>
+ </inp2:m_if>
+ </span>
+</inp2:m_DefineElement>
+
+<inp2:m_DefineElement name="category_caption">
+ <span class="NAV_CURRENT_ITEM">
+ <inp2:m_param name="separator"/>
+ <inp2:m_if check="m_ParamEquals" name="current" value="1" inverse="1">
+ <a class="control_link" href="javascript:$Catalog.go_to_cat(<inp2:m_param name="cat_id"/>);"><inp2:m_param name="cat_name"/></a>
+ <inp2:m_else/>
+ <inp2:m_param name="cat_name"/>
+ </inp2:m_if>
+ </span>
+</inp2:m_DefineElement>
+setInnerHTML('category_path', '<inp2:c_CategoryPath separator="&gt;" rootcatblock="root_cat_caption" rootmoduleblock="category_caption" currentblock="category_caption" block="category_caption" js_escape="1"/>');
+<inp2:m_if check="m_GetEquals" name="m_cat_id" value="0">
+ a_toolbar.DisableButton('upcat');
+ a_toolbar.DisableButton('homecat');
+<inp2:m_else/>
+ a_toolbar.EnableButton('upcat');
+ a_toolbar.EnableButton('homecat');
+</inp2:m_if>
+#separator#
+<inp2:c_UpdateLastTemplate template="catalog"/>
+<inp2:m_include t="categories/ci_blocks"/>
+<br />
+<table border="0" width="100%">
+ <inp2:m_DefineElement name="category_td">
+ <td valign="top" class="table_white text" id="<inp2:m_param name="PrefixSpecial"/>_<inp2:Field field="CategoryId"/>">
+ <input type="checkbox" name="<inp2:InputName field="$IdField"/>" id="<inp2:InputName field="$IdField"/>">
+ <img src="<inp2:ModulePath />img/itemicons/<inp2:ItemIcon grid="Default"/>">&nbsp;<span class="priority"><inp2:m_if check="FieldEquals" field="Priority" value="0" inverse="inverse"><sup><inp2:Field field="Priority"/></sup></inp2:m_if></span>
+ <a class="link" href="javascript:$Catalog.go_to_cat(<inp2:m_get name="c_id"/>);"><b><inp2:Field name="Name"/></b></a><span class="cat_desc">:</span>
+ <inp2:m_RenderElement name="status_mark" field="EditorsPick" type="pick" PrefixSpecial="$PrefixSpecial"/>
+ <inp2:m_RenderElement name="status_mark" field="IsNew" type="new" PrefixSpecial="$PrefixSpecial"/>
+ <span class="cats_stats">(<inp2:SubCatCount/> / <inp2:ItemCount/>)</span><br>
+ <div style="padding-left: 3px;">
+ <span class="cat_desc"><inp2:Field field="Description"/></span><br>
+ <span class="cats_stats">(<inp2:Field field="CreatedOn" format="_regional_DateFormat"/>)</span>
+ </div>
+ </td>
+ </inp2:m_DefineElement>
+ <inp2:m_if check="c_TotalRecords" no_special="1">
+ <inp2:c_CategoryList no_special="1" block_main="category_td" per_page="-1" columns="2" direction="V" IdField="CategoryId" />
+ <inp2:m_else/>
+ <tr>
+ <td class="text">
+ <inp2:m_phrase name="la_text_NoCategories"/>
+ </td>
+ </tr>
+ </inp2:m_if>
+</table></br>
Property changes on: branches/unlabeled/unlabeled-1.15.2/core/admin_templates/categories/xml/categories_list.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.15
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property

Event Timeline