Sugar CRM theme wont change - php

I am trying to override the default Sugar5 theme and I believe it worked. But its not picking up on my css. My theme directory looks like this
themes/mytheme
themes/mytheme/themedef.php
themes/mytheme/css/
themes/mytheme/css/style.css
themes/mytheme/themedef.php
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
[ legal boiler plate removed ]
********************************************************************************/
$themedef = array(
'parentTheme' => "Sugar5",
'name' => "mytheme",
'description' => "Enhanced Brands",
'version' => array(
'regex_matches' => array('6\.*.*'),
),
);
But its not picking up on my css folder
So I went into config.php and changed the default_theme to mytheme
Still nothing. any ideas whats next ??

First off, you'll want to do a 'Quick Rebuild and Repair' in the Admin -> Repair section to pick up your new theme and any changes to it. Also, clearing out your browser cache will help as well.
Also, make sure the permission on your css file and css/ folder both allow read access to the webserver user.

some suggestions:
Isn't the parentTheme called "Classic"? (And not "Sugar5")
Rebuild SugarCRM via the admin->Repair to rebuild files
Make sure you clean any browser cache (since css usually are cached)
Enable developer mode in Sugar to disable any caching
Use Firebug or similar to ensure the css is loaded properly
Hope it helps.

#Kåre W. Storgaard /themes/Sugar5 is the correct theme to be changing code wise, its called "Classic" in the Interface.
However you really shouldn't be doing it in the /themes folder as this may be over written in future updates.
Instead copy the classic theme to /custom/themes/{your new theme name}, then switch the theme over to it in the user control panel.
Another thing to watch is some css in the default theme is declared twice!

Related

How to add comments to each forum post in yii, using bbii forum module and comments-module

I am using Yii bbii forum module and it works fine. But now I want to add comments-module so every forum post could be seperately commented.
At the begining it might look:
I followed instruction what is here, but I can't make it work :(
And why I even need to include this file, if I want to add just comment?
When I added the same widget to user page (just for testing) - I got "This item cann't be commentable" and it's fine because probably I don't have correct configuration in main.php.
Difference between widget in user model view and forum view is data passed in it.
Here:
public function actionPostComment()
{
if(isset($_POST['Comment']) && Yii::app()->request->isAjaxRequest)
{
$comment = new Comment();
$comment->attributes = $_POST['Comment'];
var_dump($comment);
var_dump returned this when tried to submit comment in forum, and here in user view page.
And probably it is not even possible to combine these to modules? I'm really new in Yii.
Updated:
Basically what I have done is:
exstracted comment module (under protected->modules)
in main.php (under protected->config) added all cofiguration in modules array:
'comments'=>array(
//you may override default config for all connecting models
'defaultModelConfig' => array(
//only registered users can post comments
'registeredOnly' => false,
'useCaptcha' => false,
.......
and in view file _post.php added following:
<?php $this->widget('comments.widgets.ECommentsListWidget', array(
'model' => $data,
));
and var_dump($data) gives this (when this is called in controller where post is reseaved).
An error message was given here:
include(BbiiPost.php): failed to open stream: No such file or directory
You said that the Bbii was working with Yii and it broke when you tried to add comments.
The links to your var_dump files are broken, but I did try to read them ;)
It looks like the comments module is interfering with the POST path so that when the form submission comes in it is in a different path from the root which is confusing the YiiBase's autoloader.
You could try explicitly adding the path to BbiiPost.php to the autoloader's search path, or finding where the include("BbiiPost.php") line is and changing it to an absolute path.
Another possibility is that the forum page you are on has links to add comments but the page routing has not been taken from the route. So it might be that the POST link to the comments is actually at /forum/123/comment/add instead of just /comment/add. So when the form is submitted it is trying to the comments/add controller/action but finding that it is in /forum/view and getting confused about the paths to the include files.
I have generally found that the instructions on the Yii (v1) [v2 docs are much better] site for these modules is flaky at best. Quite often the source download link on the page points to an old buggy version of the code as the project has usually moved somewhere else. You generally need to have a pretty good PHP/Yii knowledge to debug these user-submitted modules and get them working.

CakePHP cache i18n translate

When I forget to translate something, somewhere Project VIEW, I change the file /app/Locale/por/LC_MESSAGES/default.po and sending it back to the server.
But mostly, this 'new translation', takes HOURS to be viewed, in short: I just send the file, cleaned the cache and browser CakePHP, press F5, and ... NOTHING HAPPENS.
For what reason?
[EDIT]
<?php echo $this->Form->input('Item.0.description', array('label' => false,
'class' => 'span12', 'div' => array('class' => 'span7'), 'rows' => 3,
'placeholder' => __('Type the description'))); ?>
To force the language to update you can clear the persistent and models directories in the /tmp/cache directory. If view caching is enabled you'll have to clean out views as well.
Caching is disabled when debug is set to 2 (which is the value for using the framework during development) and the persistent directory is populated with new cache files, overwriting the old ones each time a view is loaded. So the debug switch and subsequent browser refresh might clean the old language files for you.
I found a strange solution:
I set (app/Config/core.php)...
Configure::write('debug', 2); // It was 0
Press, F5... wait... and works.
Later, I back...
Configure::write('debug', 0);
Press F5 again, and works.
Why? I no have idea.
Even if Configure::write('debug', 2); I recommend to delete the remote folder containing the translations, refresh with browser (to state that nothing is translated anymore) then reupload the translations folder.
Works perfectly that way for me.

Yii: Creating a Demo Site Without Replicating the Code Base

I need to set up a demo site for users to try a web app before signing up. The demo would be based on production code, however, it would require minor code changes: connection to a demo database, automatic creation/login of a new guest account for each user, etc.
The obvious solution is to replicate my code base as a second demo website and edit as necessary. Keeping the demo code in sync with production code is easy enough by adding a branch in subversion. I'm less than thrilled, however, at the prospect of having to do two updates on my server (production and then demo) every time I push code from development to production.
Initially I thought I might be able to replicate the website through a module. It's unclear if this is possible, however.
Is there a mechanic in Yii to execute an altered version of a website (config file and selected controllers)?
Never do before, so just an idea
solution with few files in other dir
create a separate a demo dir and map it on your demo URL
In this dir put this index.php (may be your .htaccess too)
<?php
$yii=_PRODUCTION_PATH_.'/framework/yii.php';
$config_prod=_PRODUCTION_PATH_.'/protected/config/main.php';
$config_demo=dirname(__FILE__).'/demo_main.php';
require_once($yii);
$config = CMap::mergeArray($config_prod,$config_demo);
Yii::createWebApplication($config)->run();
the demo_main.php override the classes (user, db) to manage a better demo experience:
<?php
return array(
'basePath'=>_PRODUCTION_DIR_.DIRECTORY_SEPARATOR.'..',
'components'=>array(
'user' => array(
// here you override the user class with a DEMO only user
'class'=>'DemoUser',
)
),
solution with all files of prduction site in a different dir
Here follows the index.php in root dir
<?php
$yii='../framework/yii.php';
$configMain = include dirname(__FILE__).'/protected/config/main.php';
$configProd = include dirname(__FILE__).'/protected/config/production.php';
$configDemo = include dirname(__FILE__) . '/protected/config/demo.php';
require_once($yii);
// for the demo version
// instead of the comment can be an *if* or any solution to manage 2 configs
//$config = CMap::mergeArray($configMain,$configProd);
$config = CMap::mergeArray($configMain,$configDemo);
Yii::createWebApplication($config)->run();
demo.php is analogue to "demo_main.php" overridig classes and configs for the demo version of the site.
The testdrive demo app is configured for this - after you install, note the separate index-test.php, and protected/config/test.php.
Unlike #IvanButtinoni's suggestion, you'll need to access index-test.php, instead of index.php, so you may need to modify your .htaccess if you're using clean URLs to allow access to index-test.php.
When I do this, I usually write a custom init in the base controller.php:
public function init() {
// use test layout if using test config
if (isset(Yii::app()->params['test'])) {
$this->layout='//layouts/test';
}
parent::init();
}
Obviously, I have a test parameter in my test.php . . .
The only difference in my two layouts is that one sets the background color to be a bright yellow, just so it's very clear you're on a test site.
If I have understood well (according to the comment answers to original post) then There are several ways. Here is a link that I think can help great deal. It helped me set up and may be will help you!
In Yii 2 it will be inherently supported
http://www.yiiframework.com/wiki/33/

facing cache issue in activecollab routers

I am developing activecollab custom module; facing an issue related to Routers.
I by mistake type wrong action name in Router's action where we need to define in router, but after getting error I updated that action name but activecollabs still reading a previous action i removed files from cache and complie folders but reading previous action.
please share if you ever face this problem in development of activecollab module..
By mistake I did this: (action=>'views')
Router::map('mymodule_view', 'mymodule/view/:request_id', array('controller' => 'mymodule', 'action' => 'views' ), array('req_id' => Router::MATCH_ID) );
but after getting error i update above code by this: (action=>'views')
Router::map('mymodule_view', 'mymodule/view/:request_id', array('controller' => 'mymodule', 'action' => 'view' ), array('req_id' => Router::MATCH_ID) );
First, make sure that your system is in development mode. Open config/config.php and confirm that APPLICATION_MODE is set to in_development:
define('APPLICATION_MODE', 'in_development');
Now that you have that covered, go to activeCollab and you'll have Developer toolbar available in the lower right corner of the application interface, next to activeCollab powered button (it has a red bug icon). Use this tool to clear cache, rebuild images etc.
PS: You can also clear all files from /cache folder, just in case.

How do I override the core jquery file with the externally hosted jquery from google

In Yii, currently all the dependancies for jquery are loading up a local version of jquery, which i believe is 1.6.*, un-minified.
Something along the lines of:
<script src="/assets/2343/js/jquery.js"></script>
I would like to update the core jquery dependancy to use the jquery 1.7.* from google
Basically I would like to include
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
at the bottom of all my pages whenever jquery is a dependancy.
After a bit more googling & looking around, I found the answer:
in the config, under 'components'
'clientScript'=>array(
'packages'=>array(
'jquery'=>array(
'baseUrl'=>'http://ajax.googleapis.com/ajax/libs/jquery/',
'js'=>array('1.7.2/jquery.min.js'),
)
),
),
),
There's also another method seen in yii's docs:
For example, we can include jquery.js from Google servers instead of our own server. To do so, we first configure the scriptMap as follows,
$cs=Yii::app()->clientScript;
$cs->scriptMap=array(
'jquery.js'=>false,
'jquery.ajaxqueue.js'=>false,
'jquery.metadata.js'=>false,
......
);
By mapping these script files to false, we prevent Yii from generating the code to include these files. Instead, we write the following code in our pages to explicitly include the script files from Google,
<head>
<?php echo CGoogleApi::init(); ?>
<?php echo CHtml::script(
CGoogleApi::load('jquery','1.3.2') . "\n" .
CGoogleApi::load('jquery.ajaxqueue.js') . "\n" .
CGoogleApi::load('jquery.metadata.js')
);
?>
......
</head>
First Google hit: http://www.yiiframework.com/wiki/259/serve-jquery-and-jquery-ui-from-google-s-cdn/
Next to overriding the clientScript configuration, you may also want to override the widgetFactory config:
<?php
return array(
// other config
'components'=>array(
'clientScript'=>array(
'packages'=>array(
'jquery'=>array(
'baseUrl'=>'//ajax.googleapis.com/ajax/libs/jquery/1/',
'js'=>array('jquery.min.js'),
)
),
// other clientScript config
),
'widgetFactory'=>array(
'widgets'=>array(
'CJui<WidgetName>'=>array( // where <WidgetName> is the name of the JUI Widget (Tabs, DatePicker, etc.). Each CJuiWidget used must be declared
'scriptUrl'=>'//ajax.googleapis.com/ajax/libs/jqueryui/1/',
'theme'=>JUI-THEME,
'themeUrl'=>'//ajax.googleapis.com/ajax/libs/jqueryui/1/themes/',
),
// Repeat for other CJuiWidgets
),
),
// other component config
),
// other config
);
I know, this thread is rather old. But due to an encoutner I just had, I'd think it'd be important to mention this.
Somewhere in the latest releases of Yii, I fast-forwarded from 1.1.11 to current, a packages mechanism was not just implemented but improved. It had existed previously, but now it actually got to apoint, where the originally stated and ticked method of setting the jquery part to false would no longer work. Though, I found out how to fix it!
$cs->packages["jquery"] = [
"basePath"=>Yii::app()->cdn->basePath,
"baseUrl"=>Yii::app()->cdn->baseUrl,
"js"=>["js/jquery-1.11.1.js"]
];
This is taken straight from my code, but illustrates how I did it. Basically, I added a jQuery entry to the packages list. When Core scripts are resolved, this list is searched up before the actual CoreScripts. Therefore, this will be picked up first and you can add your personal version of jQuery this way.
I hope it helps!

Categories