how to display text in ckeditor status bar? - ckeditor

I just want to know how to display text in the ckeditor status bar.
At the bottom of the ckeditor displays the elements path I just want to display text in that elements path like status bar.
Foe example, when the user finds and replaces a text in the editor, I want to display to the user the number of instances replaced in the text.
Any help is useful, thanks in advance.

You can disable the elementspath plugin:
config.removePlugins = 'elementspath';
Then make a custom plugin by copying _source/plugins/elementspath to plugins/elementspath.
Then rename the directory to your custom name and change line 33 of the plugin.js file to use the new name (the CkEditor styleguide calls for all lowercase letters for plugin names):
CKEDITOR.plugins.add( 'newname',
Then add the new plugin in your config:
config.extraPlugins = 'newname';
The editor.on( 'selectionChange', function( ev ) section is where the majority of the work is done to create the content for that line. The main section is this:
html.unshift(
'<a' +
' id="', idBase, index, '"' +
' href="javascript:void(\'', name, '\')"' +
' tabindex="-1"' +
' title="', label, '"' +
( ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 ) ?
' onfocus="event.preventBubble();"' : '' ) +
' hidefocus="true" ' +
' onkeydown="return CKEDITOR.tools.callFunction(', onKeyDownHandler, ',', index, ', event );"' +
extra ,
' onclick="CKEDITOR.tools.callFunction('+ onClickHanlder, ',', index, '); return false;"',
' role="button" aria-labelledby="' + idBase + index + '_label">',
name,
'<span id="', idBase, index, '_label" class="cke_label">eee' + label + '</span>',
'rrrr</a>' );
You can modify it to display whatever content you like.
You'll need to look through the rest of the code to understand everything that's happening and make any other changes needed for your specific goals.

Related

VFP CHR(9) not outputting TAB as expected

I need to create a tab-delimited file from a cursor. I would normally just use COPY TO but in this case I need to a header row which COPY TO doesn't create.
I thought I could use ?|?? along with CHR(9) but it doesn't put a TAB in the file. I opened the file with notepad++ and word with show special characters turned on. I expected to see the right-arrow for TAB but not there. The file looked more like a fixed width format
Here's my code
LOCAL lcWBSIncFile, lcEACIncHeader
lcEACIncHeader = "EarnedValue" + CRLF +;
"ContrName" + CHR(9) + ;
"StruName" + CHR(9) + ;
"WbsNum" + CHR(9) + ;
"EndDate" + CHR(9) + ;
"UnitName" + CHR(9) + ;
"UnitScale" + CHR(9) + ;
"LRE"
lcWBSIncFile = RTRIM(vpcProgram) + "_" + dtoc(vpdStatusDate,1) + "_" + TTOC(DATETIME(),1) + "_WBS_EAC.inc"
SET ALTERNATE TO ( lcWBSIncFile )
SET ALTER ON
SET CONSOLE OFF
? lcEACIncHeader
SELECT _csrEACUpdateWBSFinal
SCAN
? contrname + CHR(9)
?? struname + CHR(9)
?? wbsnum+ CHR(9)
?? enddate + CHR(9)
?? unitname + CHR(9)
?? unitscale + CHR(9)
?? ALLT(STR(lre,24,2 ))
ENDSCAN
SET ALTERNATE TO
SET ALTERNATE OFF
COPY TO (filename) TYPE DELIMITED WITH TAB works fine, I just don't get a header.
? | ?? didn't work but FPUTS() did. Not sure why.

when using kendo.drawing.exportPDF , text pasted from Word shows wrong

All punctuations in the HTML that was brought over by pasting from MS word, show as a little square instead of " or ' The characters show as "FS" and "GS" in notepad++ and in plain HTML.
I tried to use the "DejaVu Sans" font but it did not help at all.
Any advice?
Ended replacing all offending characters.
String.prototype.replaceAll = function(str1, str2, ignore)
{
return this.replace(new RegExp(str1.replace(/([\,\!\\\^\$\{\}\[\]\(\)\.\*\+\?\|\<\>\-\&])/g, function(c){return "\\" + c;}), "g"+(ignore?"i":"")), str2);
};
Then for each cell of text:
function cleanHTML(input) {
var output = input.replaceAll('“','"');
output = output.replaceAll('”', '"');
output = output.replaceAll("’", "'");
output = output.replaceAll("‘", "'");
output = output.replaceAll("", "'");
output = output.replaceAll("", "-");
output = output.replaceAll("", "'");
return output;
}
Whatever other charter will show as square later, I will add a replace for it.
Hope someone will benefit from that.

Magento: How to remove the price for bundled product options on the shopping cart page, checkout etc

Please help me removing the price for bundled product options on the shopping cart page, checkout, etc. Here is a pic.
What do i need to do?
To remove this edit:
Mage_Bundle_Block_Checkout_Cart_Item_Renderer
Look for the _getBundleOptions() method and at around line 77 change it as follows
//$option['value'][] = $this->_getSelectionQty($bundleSelection->getSelectionId()).' x '. $this->htmlEscape($bundleSelection->getName()). ' ' .Mage::helper('core')->currency($this->_getSelectionFinalPrice($bundleSelection));
//New line
$option['value'][] = $this->_getSelectionQty($bundleSelection->getSelectionId()).' x '. $this->htmlEscape($bundleSelection->getName());
Then edit:
Mage_Bundle_Block_Sales_Order_Items_Renderer
Look for the getValueHtml() method at around line 115 change the code as follows
public function getValueHtml($item)
{
if ($attributes = $this->getSelectionAttributes($item)) {
//Old code
/*
return sprintf('%d', $attributes['qty']) . ' x ' .
$this->htmlEscape($item->getName()) .
" " . $this->getOrder()->formatPrice($attributes['price']);
*/
return sprintf('%d', $attributes['qty']) . ' x ' .
$this->htmlEscape($item->getName());
} else {
return $this->htmlEscape($item->getName());
}
}
The usual caveats about not editing core code and using local or module rewrites apply!
let me know if i can help you more.
OR Also you can hide with css like below
Assuming that you want to remove it from all items regardless of the price, then you could add this css
#shopping-cart-table dd span.price{
display:none;
}
If you only want to remove the price if it is zero,you can also do in this way
/app/design/frontend/default/{theme path}/template/checkout/cart/item/default.phtml (around line # 46)
Figure out where it is add the price and only append the price if it is greater than 0
or
Do a find a replace str_replace("$0.00", "", $_formatedOptionValue['value']) on the string that display that line (make sure to add the currency sign so that $10.00 dont get replace)
I found another way to do it. Hopefully it will help somebody.
1 - Go to /public_html/app/code/core/Mage/Bundle/Helper/Catalog/Product
2 - open the file Configuration.php
3 - from about line 119 till about 127 you will find this code:
foreach ($bundleSelections as $bundleSelection) {
$qty = $this->getSelectionQty($product, $bundleSelection->getSelectionId()) * 1;
if ($qty) {
$option['value'][] = $qty . ' x ' . $this->escapeHtml($bundleSelection->getName())
. ' ' . Mage::helper('core')->currency(
$this->getSelectionFinalPrice($item, $bundleSelection)
);
}
}
Change that with this code:
foreach ($bundleSelections as $bundleSelection) {
$qty = $this->getSelectionQty($product, $bundleSelection->getSelectionId()) * 1;
if ($qty) {
$option['value'][] = $this->escapeHtml($bundleSelection->getName());
}
}
One caution note, be careful about editing the core file. You can also use local or module rewrites.

Fixing sql length error in progress 4gl 10.2B

I'm trying to use the openedge jdbc connector to pull data from an existing progress db but im running into column width issues.
Here is the error that is holding me up.
[DataDirect][OpenEdge JDBC Driver][OpenEdge] Column TabDisplayName in table PUB.Menu has value exceeding its max length or precision.
I've looked at many posts, each offering different advice, and here's what I've given a go this far:
Manually modify the SQL width via the data dictionary.
I ran a quick check on PUB.Menu.TabDisplayName to find a max value of 44 Characters
Set the width to x(50) to no avail and then x(100) out of a fix of irrational rage, again with no luck.
Use the SUBSTR() SQL Function to truncate the field -not optimum but better than nothing
I get weird results with this. It works fine in sqlexp but in a java environment its like the column is never selected.
Use the dbtool to automatically fix width problems with option #2
After selecting all tables and "areas" (not sure what those are...) and submitting the final option I am returned to the proenv cmdline as if nothing ever happened.
Modify the sql width programmatically via 4gl
This is the only option I found that I have yet to try.
I am a little reluctant to try this only because a manual modification failed. Also this is a live development environment(for me only) and Im trying to mess it up too terribly, although i am taking snaps regularly.
Running progress 10.2B on a unix machine.
Any comments and suggestions would be appreciated.
-Thanks
The dbtool option is the best. It is designed for this. From proenv you should see something like this:
proenv> dbtool s2k
DATABASE TOOLS MENU - 10.2B
---------------------------
1. SQL Width & Date Scan w/Report Option
2. SQL Width Scan w/Fix Option
3. Record Validation
4. Record Version Validation
5. Read or Validate Database Block(s)
6. Record Fixup
7. Schema Validation
9. Enable/Disable File Logging
Q. Quit
Choice: 2
: (0=single-user 1=self-service >1=#threads)? 1
Padding % above current max: 100
: (Table number or all)? all
: (Area number or all)? all
: (verbose level 0-3)? 0
Total records read: 31357
SQLWidth errors found: 0, Date errors found: 0
SQLWidth errors fixed: 0
If your db has a server up & running choose "1" at the connect: prompt. If not, choose "0".
Pick 100 for padding to double the width of fields.
Try it on a copy of the "sports" database if you are unsure. Use a higher level of verboseness if you want some insight into what it is doing.
It does not take very long to run on a small development database. (It is basically instantaneous on "sports".)
It is possible to create views with substring (field.name,1,maxlength) option and use PUB2.viewname instead pub.tablename
DROP VIEW PUB2."accounts";
CREATE VIEW PUB2."accounts" (
"ACC-TYPE",
"ACCOUNT-NAME",
ANALITIC,
ARCH,
COUNT1,
CURRENCY,
PLAN,
QUANTITY,
"RID-ANOBJECT",
"RID-APP",
TRANSIT )
AS select "acc-type",
SUBSTRING("account-name", 1, 130),
"analitic",
"arch",
"count1",
"currency",
"plan",
"quantity",
"rid-anobject",
"rid-app",
"transit"
FROM PUB."accounts";
COMMIT;
use sqlexp for automatic creation:
sqlexp account -H localhost -S ' + db-port + ' -user sysprogress -password sysprogress -infile recreateSQLviews.sql -outfile recreateSQLviews.log
here is code:
def var num-port as integer.
for first _Servers where _Servers._Server-Type = "Login" no-lock:
num-port = _Servers._Server-PortNum.
end.
if num-port < 0 then num-port = num-port + 65536.
if num-port = 0 then do:
message "Define -S parameter for Database" view-as alert-box.
RETURN.
end.
message num-port.
/* ttSQLWidth table: SQL WIDTH for all tables */
def var execstr as char.
def var rez-str as char.
def var db-port as char. /* -S port */
db-port = STRING(num-port).
DEFINE TEMP-TABLE ttSQLWidth NO-UNDO
FIELD tableName AS CHARACTER
FIELD tableNum AS INTEGER
FIELD fieldName AS CHARACTER
FIELD sqlWidth AS INTEGER
FIELD requireFix AS LOGICAL INIT FALSE
FIELD actualWidth AS INTEGER
FIELD newWidth AS INTEGER
INDEX tableNum tableNum
INDEX tableName tableName.
FOR EACH _File NO-LOCK WHERE _Tbl-Type = "T":
FOR EACH _Field OF _File WHERE _Field._Data-type = "character":
if _field._extent > 0 then next.
CREATE ttSQLWidth.
ASSIGN tableName = _File._File-name
tableNum = _File._File-num
fieldName = _Field._Field-name
sqlWidth = _Field._Width.
RELEASE ttSQLWidth.
END. /* FOR EACH _Field */
END. /* FOR EACH _File */
DEFINE VARIABLE bTab AS HANDLE NO-UNDO.
DEFINE VARIABLE hQuery AS HANDLE NO-UNDO.
DEFINE VARIABLE queryString AS CHARACTER NO-UNDO.
FOR EACH ttSQLWidth:
CREATE BUFFER bTab FOR TABLE tableName.
CREATE QUERY hQuery.
hQuery:ADD-BUFFER(bTab).
message tablename.
queryString = "FOR EACH " + tableName + " WHERE LENGTH(" + fieldName + ") >= " + STRING(sqlWidth) + " BY LENGTH(" + fieldName + ") DESC".
hQuery:QUERY-PREPARE(queryString).
hQuery:QUERY-OPEN().
IF hQuery:GET-NEXT() THEN DO:
ASSIGN actualWidth = LENGTH(bTab:BUFFER-FIELD(fieldName):BUFFER-VALUE)
requireFix = TRUE.
END. /* IF .. THEN DO */
hQuery:QUERY-CLOSE.
DELETE OBJECT hQuery.
bTab:BUFFER-RELEASE().
DELETE OBJECT bTab.
END. /* FOR EACH ttSQLWidth */
def var add-pr as integer initial 10. /* % from max */
def var maxWidth as integer initial 249. /* maxwidth */
FOR EACH ttSQLWidth WHERE ttSQLWidth.requireFix = TRUE:
ttSQLWidth.newWidth = TRUNCATE ( (ttSQLWidth.actualWidth + add-pr) / add-pr, 0 ) * add-pr.
ttSQLWidth.newWidth = INTEGER( ttSQLWidth.newWidth).
if ttSQLWidth.newWidth > maxWidth then ttSQLWidth.newWidth = maxWidth.
END.
/* sql script generation */
OUTPUT TO value("recreateSQLviews.sql").
def var lst-field as char.
FOR EACH ttSQLWidth WHERE BREAK BY ttSQLWidth.tableName:
IF FIRST-OF(ttSQLWidth.tableName)
THEN run MakeSQLViews(ttSQLWidth.tableName).
END.
OUTPUT CLOSE.
/* sql script execution */
execstr = 'sqlexp account -H localhost -S ' + db-port + ' -user sysprogress -password sysprogress -infile recreateSQLviews.sql -outfile recreateSQLviews.log'.
input through value(execstr).
repeat:
IMPORT UNFORMAT rez-str.
message rez-str.
end.
INPUT CLOSE.
RETURN.
PROCEDURE MakeSQLViews:
define input parameter tableName as character.
def var str_tmp as char.
def var str_tmp1 as char.
def var str as char initial "count,sum,double,row,date,level,area,number,primary".
def var fieldName as char.
def var fieldName1 as char.
FOR EACH _file WHERE _file._file-name = tableName AND
_file._file-num GT 0 AND _file._file-num LT 32000 NO-LOCK:
fieldName = "".
FOR EACH _Field OF _File NO-LOCK:
str_tmp = '"' + _Field._Field-name + '"'.
FOR FIRST ttSQLWidth where ttSQLWidth.tableName = _file._file-name and
ttSQLWidth.fieldName = _Field._Field-name and
ttSQLWidth.requireFix = TRUE:
str_tmp = 'SUBSTRING("' + _Field._Field-name + '", 1, ' + STRING(ttSQLWidth.newWidth) + ')'.
END.
fieldName = fieldName + (IF(fieldName = "") THEN ("") ELSE ("," + chr(10) + chr(9))) + str_tmp.
str_tmp1 = ( IF ( INDEX ( _Field._Field-name, "-" ) = 0 )
THEN ( _Field._Field-name )
ELSE ( '"' + _Field._Field-name + '"' )).
if LOOKUP ( _Field._Field-name, str, "," ) > 0 then str_tmp1 = '"' + _Field._Field-name + '"'.
fieldName1 = fieldName1 + (IF(fieldName1 = "") THEN ("") ELSE ("," + chr(10) + chr(9))) + UPPER(str_tmp1).
END. /* FOR EACH _Field */
PUT UNFORMATTED 'DROP VIEW PUB2."' + _file._file-name + '";' SKIP.
PUT UNFORMATTED 'CREATE VIEW PUB2."' + _file._file-name + '" ( ' + chr(10) chr(9) + fieldName1 + ' ) ' + chr(10) +
'AS select ' + fieldName + chr(10) +
'FROM PUB."' + _file._file-name + '";' SKIP.
PUT UNFORMATTED 'COMMIT;' SKIP(1).
END.
END.

Is it possible to import existing SSRS reports in Visual Studio?

When upgrading a machine, we lost the Visual Studio project that was used to create SSRS reports. The Data Sources and the Reports still exist on the server however. Is there a way to re-create the VS project using what it on the SQL server? Is there a way to create a new Reporting Services project and to import existing Data Sources and Reports in it?
I believe the reports were originally created using VS 2005.
You haven't lost much.
The data sources are not much: the connection string to a database, and possibly settings for caching and authentication. These should be easily recreated.
The report definitions (.rdl files) can be downloaded for each report type, and added to a new Reporting Services project. They will need to be pointed at the newly recreated datasources, but then should be fine.
To download the report files, go to the Reporting Services Report Manager (website.) For a default instance of SQL with default install options this is http://servername/reports/ If you have admin permissions, there you can browse through the reports. Go to the properties of a given report and click the Edit... button. This will download the .rdl through your browser. (In SSRS 2008, the Edit button was changed to "Download...")
You will need to find out what version of SSRS you are running: the different versions of Business Intelligence Developer Studio (BIDS, the SSAS and SSRS version of Visual Studio) create reports for specific versions of SSRS. The reports can be upgraded, but not downgraded or deployed to an older version of SSRS.
There's now a PowerShell module that will do a nice job of this.
out-rsfoldercontent -reportserveruri http://[reportserver name]/reportserver -RsFolder /[path you'd like to export] -Destination c:\test -recurse
Adjust the parameters to suit.
https://github.com/Microsoft/ReportingServicesTools
SSRS doesn't allow you to download all reports from a report folder in 1 go...
However I found and tweaked a simple piece of SQL I found on the net which we use to great effect on our system...
This is it:-
/*
People working on SSRS are well aware that “Report Manager” does not support downloading all the report files (.rdl files) at one go out-of-box.
However take this script, alter the xxx parameters to your bits. Its works great.
If you get a HOST Error - you need to set full permission to the SQL Server Group on your DOS Dir.
on [Our_Prod_Server], this is: SQLServerMSSQLUser$NS226758$MSSQLSERVER
NOTE: You will find a RETURN; statement below, comment it out once you have altered the parameters.
*/
--Replace NULL with keywords of the ReportManager's Report Path,
--if reports from any specific path are to be downloaded
--select * from [ReportServer].[dbo].[Catalog] CL -- this gives you an idea of the Report Directories.
DECLARE #FilterReportPath AS VARCHAR(500) = 'xxx'
--Replace NULL with the keyword matching the Report File Name,
--if any specific reports are to be downloaded
DECLARE #FilterReportName AS VARCHAR(500) = ''
--Replace this path with the Server Location where you want the
--reports to be downloaded..
DECLARE #OutputPath AS VARCHAR(500) = 'C:\Users\[uuuuu]\Documents\Visual Studio 2012\Projects\Report Skeleton\[Report DIR Name]\'
--Used to prepare the dynamic query
DECLARE #TSQL AS NVARCHAR(MAX)
RETURN;
--Reset the OutputPath separator.
SET #OutputPath = REPLACE(#OutputPath,'\','/')
--Simple validation of OutputPath; this can be changed as per ones need.
IF LTRIM(RTRIM(ISNULL(#OutputPath,''))) = ''
BEGIN
SELECT 'Invalid Output Path'
END
ELSE
BEGIN
--Prepare the query for download.
/*
Please note the following points -
1. The BCP command could be modified as per ones need. E.g. Providing UserName/Password, etc.
2. Please update the SSRS Report Database name. Currently, it is set to default - [ReportServer]
3. The BCP does not create missing Directories. So, additional logic could be implemented to handle that.
4. SSRS stores the XML items (Report RDL and Data Source definitions) using the UTF-8 encoding.
It just so happens that UTF-8 Unicode strings do not NEED to have a BOM and in fact ideally would not have one.
However, you will see some report items in your SSRS that begin with a specific sequence of bytes (0xEFBBBF).
That sequence is the UTF-8 Byte Order Mark. It’s character representation is the following three characters, “”.
While it is supported, it can cause problems with the conversion to XML, so it is removed.
*/
SET #TSQL = STUFF((SELECT
';EXEC master..xp_cmdshell ''bcp " ' +
' SELECT ' +
' CONVERT(VARCHAR(MAX), ' +
' CASE ' +
' WHEN LEFT(C.Content,3) = 0xEFBBBF THEN STUFF(C.Content,1,3,'''''''') '+
' ELSE C.Content '+
' END) ' +
' FROM ' +
' [ReportServer].[dbo].[Catalog] CL ' +
' CROSS APPLY (SELECT CONVERT(VARBINARY(MAX),CL.Content) Content) C ' +
' WHERE ' +
' CL.ItemID = ''''' + CONVERT(VARCHAR(MAX), CL.ItemID) + ''''' " queryout "' + #OutputPath + '' + CL.Name + '.rdl" ' + '-T -c -x'''
FROM
[ReportServer].[dbo].[Catalog] CL
WHERE
CL.[Type] = 2 --Report
AND '/' + CL.[Path] + '/' LIKE COALESCE('%/%' + #FilterReportPath + '%/%', '/' + CL.[Path] + '/')
AND CL.Name LIKE COALESCE('%' + #FilterReportName + '%', CL.Name)
FOR XML PATH('')), 1,1,'')
--SELECT #TSQL
--Execute the Dynamic Query
EXEC SP_EXECUTESQL #TSQL
END
I used this piece of code, but I had problems with the polish characters in SSRS 2008 R2.
So I added some replaces with replace this "broken" convert:
SET #TSQL = STUFF((SELECT
';EXEC master..xp_cmdshell ''bcp " ' +
' SELECT ' +
' REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE' +
' (REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(CONVERT(VARCHAR(MAX), ' +
' CASE ' +
' WHEN LEFT(C.Content,3) = 0xEFBBBF THEN STUFF(C.Content,1,3,'''''''') '+
' ELSE C.Content '+
' END), ''''Å'''', ''''l''''), ''''Ä™'''', ''''e''''), ''''l›'''', ''''s'''') '+
' , ''''ć'''', ''''c''''), ''''l¼'''', ''''z''''), ''''lš'''', ''''s'''') ' +
' , ''''ó'''', ''''o''''), ''''Ä…'''', ''''a''''), ''''l»'''', ''''Z'''') '+
' , ''''sÄ'''', ''''S''''), ''''†'''', ''''C''''), ''''l‚'''', ''''l'''') ' +
' , ''''Ó'''', ''''O''''), ''''Ę'''', ''''E''''), ''''lº'''', ''''z'''') ' +
' , ''''Ä„'''', ''''A''''), ''''l¹'''', ''''Z'''') '+
' FROM ' +
' [ReportServer].[dbo].[Catalog] CL ' +
' CROSS APPLY (SELECT CONVERT(VARBINARY(MAX),CL.Content) Content) C ' +
' WHERE ' +
' CL.ItemID = ''''' + CONVERT(VARCHAR(MAX), CL.ItemID) + ''''' " queryout "' + #OutputPath + '' + CL.Name + '.rdl" ' + '-T -c -x'''
FROM
[ReportServer].[dbo].[Catalog] CL
WHERE
CL.[Type] = 2 --Report
AND '/' + CL.[Path] + '/' LIKE COALESCE('%/%' + #FilterReportPath + '%/%', '/' + CL.[Path] + '/')
AND CL.Name LIKE COALESCE('%' + #FilterReportName + '%', CL.Name)
FOR XML PATH('')), 1,1,'')

Resources