Commit c8c7ae0d05e107014d3627deace64bebb4a1f89c

Authored by kevin_fourie
1 parent 281b04f1

Merged in from STABLE trunk...

KTS-3545
"Need i18n for WebDAVDashlet titie, 'WebDAV Connection Information'"
Fixed. Added i18n tags and regenerated i18n files.

Committed By: Kevin Fourie
Reviewed By: Conrad Vermeulen


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/branches/3.5.3-Release-Branch@8941 c91229c3-7414-0410-bfa2-8a42b809f60b
i18n/knowledgeTree.pot
... ... @@ -8,7 +8,7 @@ msgid ""
8 8 msgstr ""
9 9 "Project-Id-Version: PACKAGE VERSION\n"
10 10 "Report-Msgid-Bugs-To: \n"
11   -"POT-Creation-Date: 2008-07-30 17:05+0200\n"
  11 +"POT-Creation-Date: 2008-08-02 17:09+0200\n"
12 12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13 13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14 14 "Language-Team: LANGUAGE <LL@li.org>\n"
... ... @@ -16,22 +16,22 @@ msgstr &quot;&quot;
16 16 "Content-Type: text/plain; charset=CHARSET\n"
17 17 "Content-Transfer-Encoding: 8bit\n"
18 18  
19   -#: lib/util/ktutil.inc:154
  19 +#: lib/util/ktutil.inc:162
20 20 #, php-format
21 21 msgid " %d day(s)"
22 22 msgstr ""
23 23  
24   -#: lib/util/ktutil.inc:155
  24 +#: lib/util/ktutil.inc:163
25 25 #, php-format
26 26 msgid " %d hour(s)"
27 27 msgstr ""
28 28  
29   -#: lib/util/ktutil.inc:156
  29 +#: lib/util/ktutil.inc:164
30 30 #, php-format
31 31 msgid " %d minute(s)"
32 32 msgstr ""
33 33  
34   -#: lib/util/ktutil.inc:157
  34 +#: lib/util/ktutil.inc:165
35 35 #, php-format
36 36 msgid " %d second(s)"
37 37 msgstr ""
... ... @@ -45,6 +45,10 @@ msgstr &quot;&quot;
45 45 msgid " Note: group is set as unit administrator, but is not assigned to a unit."
46 46 msgstr ""
47 47  
  48 +#: plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php:319
  49 +msgid " View All"
  50 +msgstr ""
  51 +
48 52 #: lib/browse/Criteria.inc:964
49 53 msgid " ago"
50 54 msgstr ""
... ... @@ -264,7 +268,7 @@ msgstr &quot;&quot;
264 268 msgid "(Closed at metadata version: #ver#)"
265 269 msgstr ""
266 270  
267   -#: config/dmsDefaults.php:601
  271 +#: config/dmsDefaults.php:602
268 272 msgid "(Community Edition)"
269 273 msgstr ""
270 274  
... ... @@ -321,6 +325,11 @@ msgid &quot;&quot;
321 325 "</p>"
322 326 msgstr ""
323 327  
  328 +#: plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php:204
  329 +#: plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php:248
  330 +msgid "<span class=\"descriptiveText\"> You do not have any dropped documents </span><br><br><br>"
  331 +msgstr ""
  332 +
324 333 #: i18n/templates.c:2540
325 334 msgid "<strong>Deleted</strong>, which completely removes the selected items from the lookup. Note that this may not be possible if some other aspect of the system depends on a particular lookup."
326 335 msgstr ""
... ... @@ -1553,7 +1562,7 @@ msgstr &quot;&quot;
1553 1562 msgid "Available Workflows"
1554 1563 msgstr ""
1555 1564  
1556   -#: lib/util/ktutil.inc:205
  1565 +#: lib/util/ktutil.inc:213
1557 1566 msgid "B"
1558 1567 msgstr ""
1559 1568  
... ... @@ -2189,7 +2198,8 @@ msgstr &quot;&quot;
2189 2198 msgid "Clicking on a given behaviour below will show you which fields and values can be selected when the clicked behaviour is active."
2190 2199 msgstr ""
2191 2200  
2192   -#: plugins/ktcore/admin/configSettings.php:153
  2201 +#: plugins/ktcore/admin/configSettings.php:277
  2202 +#: plugins/ktcore/admin/configSettings.php:281
2193 2203 #: plugins/ktcore/KTCorePlugin.php:334
2194 2204 msgid "Client Tools Settings"
2195 2205 msgstr ""
... ... @@ -2569,16 +2579,16 @@ msgstr &quot;&quot;
2569 2579 msgid "Could change permission on exec script: "
2570 2580 msgstr ""
2571 2581  
2572   -#: setup/upgrade.php:297
  2582 +#: setup/upgrade.php:301
2573 2583 msgid "Could not authenticate administrative user"
2574 2584 msgstr ""
2575 2585  
2576   -#: lib/util/ktutil.inc:596 lib/util/ktutil.inc:627 lib/util/ktutil.inc:632
  2586 +#: lib/util/ktutil.inc:604 lib/util/ktutil.inc:635 lib/util/ktutil.inc:640
2577 2587 #, php-format
2578 2588 msgid "Could not copy to destination: %s"
2579 2589 msgstr ""
2580 2590  
2581   -#: lib/util/ktutil.inc:503
  2591 +#: lib/util/ktutil.inc:511
2582 2592 #, php-format
2583 2593 msgid "Could not create destination directory: %s"
2584 2594 msgstr ""
... ... @@ -2677,12 +2687,12 @@ msgstr &quot;&quot;
2677 2687 msgid "Could not find user in LDAP server"
2678 2688 msgstr ""
2679 2689  
2680   -#: lib/util/ktutil.inc:605
  2690 +#: lib/util/ktutil.inc:613
2681 2691 #, php-format
2682 2692 msgid "Could not move to destination: %s"
2683 2693 msgstr ""
2684 2694  
2685   -#: lib/util/ktutil.inc:499
  2695 +#: lib/util/ktutil.inc:507
2686 2696 #, php-format
2687 2697 msgid "Could not open source directory: %s"
2688 2698 msgstr ""
... ... @@ -2706,7 +2716,7 @@ msgstr &quot;&quot;
2706 2716 msgid "Could not remove link"
2707 2717 msgstr ""
2708 2718  
2709   -#: lib/util/ktutil.inc:600
  2719 +#: lib/util/ktutil.inc:608
2710 2720 #, php-format
2711 2721 msgid "Could not remove source: %s"
2712 2722 msgstr ""
... ... @@ -2737,17 +2747,17 @@ msgstr &quot;&quot;
2737 2747 msgid "Couldn't create folder"
2738 2748 msgstr ""
2739 2749  
2740   -#: lib/util/ktutil.inc:589
  2750 +#: lib/util/ktutil.inc:597
2741 2751 #, php-format
2742 2752 msgid "Couldn't move file to destination: %s"
2743 2753 msgstr ""
2744 2754  
2745   -#: lib/util/ktutil.inc:584 lib/util/ktutil.inc:622
  2755 +#: lib/util/ktutil.inc:592 lib/util/ktutil.inc:630
2746 2756 #, php-format
2747 2757 msgid "Couldn't stat destination location: %s"
2748 2758 msgstr ""
2749 2759  
2750   -#: lib/util/ktutil.inc:580 lib/util/ktutil.inc:618
  2760 +#: lib/util/ktutil.inc:588 lib/util/ktutil.inc:626
2751 2761 #, php-format
2752 2762 msgid "Couldn't stat source file: %s"
2753 2763 msgstr ""
... ... @@ -3074,6 +3084,10 @@ msgstr &quot;&quot;
3074 3084 msgid "Date Created Delta"
3075 3085 msgstr ""
3076 3086  
  3087 +#: plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php:260
  3088 +msgid "Date Dropped"
  3089 +msgstr ""
  3090 +
3077 3091 #: lib/browse/Criteria.inc:713
3078 3092 msgid "Date Modified"
3079 3093 msgstr ""
... ... @@ -3267,11 +3281,11 @@ msgstr &quot;&quot;
3267 3281 msgid "Description"
3268 3282 msgstr ""
3269 3283  
3270   -#: lib/util/ktutil.inc:480
  3284 +#: lib/util/ktutil.inc:488
3271 3285 msgid "Destination directory already exists."
3272 3286 msgstr ""
3273 3287  
3274   -#: lib/util/ktutil.inc:494
  3288 +#: lib/util/ktutil.inc:502
3275 3289 msgid "Destination of move is within source"
3276 3290 msgstr ""
3277 3291  
... ... @@ -3379,6 +3393,7 @@ msgstr &quot;&quot;
3379 3393 msgid "Do you still wish to continue with deleting this item?"
3380 3394 msgstr ""
3381 3395  
  3396 +#: plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php:259
3382 3397 #: i18n/templates.c:476 i18n/templates.c:578 i18n/templates.c:677
3383 3398 #: i18n/templates.c:755 i18n/templates.c:845 i18n/templates.c:911
3384 3399 #: i18n/templates.c:7103
... ... @@ -3824,6 +3839,7 @@ msgstr &quot;&quot;
3824 3839 msgid "Document must be a symbolic link entity"
3825 3840 msgstr ""
3826 3841  
  3842 +#: plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php:516
3827 3843 #: plugins/network/extendedtransactioninfo/adminReports.php:243
3828 3844 #: plugins/network/extendedtransactioninfo/latestchanges.php:78
3829 3845 #: plugins/network/extendedtransactioninfo/latestchanges.php:91
... ... @@ -4409,7 +4425,8 @@ msgstr &quot;&quot;
4409 4425 msgid "Email Plugin"
4410 4426 msgstr ""
4411 4427  
4412   -#: plugins/ktcore/admin/configSettings.php:173
  4428 +#: plugins/ktcore/admin/configSettings.php:291
  4429 +#: plugins/ktcore/admin/configSettings.php:295
4413 4430 #: plugins/ktcore/KTCorePlugin.php:322
4414 4431 msgid "Email Settings"
4415 4432 msgstr ""
... ... @@ -4590,6 +4607,39 @@ msgstr &quot;&quot;
4590 4607 msgid "Error updating user"
4591 4608 msgstr ""
4592 4609  
  4610 +#: plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php:480
  4611 +msgid "Error: Cannot create WorkSpaceOwner role allocation on personal folder"
  4612 +msgstr ""
  4613 +
  4614 +#: plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php:92
  4615 +#: plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php:136
  4616 +msgid "Error: Failed to create WorkSpaceOwner Role"
  4617 +msgstr ""
  4618 +
  4619 +#: plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php:218
  4620 +msgid "Error: WorkSpaceOwner Role does not exist"
  4621 +msgstr ""
  4622 +
  4623 +#: plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php:177
  4624 +msgid "Error: WorkSpaceOwner Role not setup, cannot assign to Personal Folder"
  4625 +msgstr ""
  4626 +
  4627 +#: plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php:383
  4628 +msgid "Error: cannot create WorkSpaceOwner role allocation"
  4629 +msgstr ""
  4630 +
  4631 +#: plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php:424
  4632 +msgid "Error: cannot find WorkSpaceOwner role allocation"
  4633 +msgstr ""
  4634 +
  4635 +#: plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php:191
  4636 +msgid "Error: cannot set personal folder role permissions: more than one role named 'WorkSpaceOwner' exists"
  4637 +msgstr ""
  4638 +
  4639 +#: plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php:109
  4640 +msgid "Error: cannot set user role permissions: more than one role named 'WorkSpaceOwner' exists"
  4641 +msgstr ""
  4642 +
4593 4643 #: i18n/templates.c:3596
4594 4644 msgid "Estimated completion time:"
4595 4645 msgstr ""
... ... @@ -4989,6 +5039,7 @@ msgid &quot;Failure resolving child folder with id = %d.&quot;
4989 5039 msgstr ""
4990 5040  
4991 5041 #: plugins/ktcore/KTPermissions.php:787
  5042 +#: plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php:631
4992 5043 msgid "Failure to generate folderlisting."
4993 5044 msgstr ""
4994 5045  
... ... @@ -5365,7 +5416,7 @@ msgstr &quot;&quot;
5365 5416 msgid "Full-text Content Indexing"
5366 5417 msgstr ""
5367 5418  
5368   -#: lib/util/ktutil.inc:193
  5419 +#: lib/util/ktutil.inc:201
5369 5420 msgid "GB"
5370 5421 msgstr ""
5371 5422  
... ... @@ -5377,7 +5428,8 @@ msgstr &quot;&quot;
5377 5428 msgid "General Metadata"
5378 5429 msgstr ""
5379 5430  
5380   -#: plugins/ktcore/admin/configSettings.php:191
  5431 +#: plugins/ktcore/admin/configSettings.php:305
  5432 +#: plugins/ktcore/admin/configSettings.php:309
5381 5433 #: plugins/ktcore/KTCorePlugin.php:338
5382 5434 msgid "General Settings"
5383 5435 msgstr ""
... ... @@ -5841,7 +5893,7 @@ msgstr &quot;&quot;
5841 5893 msgid "Index Date"
5842 5894 msgstr ""
5843 5895  
5844   -#: plugins/ktcore/KTDashlets.php:221
  5896 +#: plugins/ktcore/KTDashlets.php:226
5845 5897 msgid "Indexer Status"
5846 5898 msgstr ""
5847 5899  
... ... @@ -5926,7 +5978,8 @@ msgstr &quot;&quot;
5926 5978 msgid "Inter-document linking"
5927 5979 msgstr ""
5928 5980  
5929   -#: plugins/ktcore/admin/configSettings.php:210
  5981 +#: plugins/ktcore/admin/configSettings.php:319
  5982 +#: plugins/ktcore/admin/configSettings.php:323
5930 5983 #: plugins/ktcore/KTCorePlugin.php:342
5931 5984 msgid "Internationalisation Settings"
5932 5985 msgstr ""
... ... @@ -6118,7 +6171,7 @@ msgstr &quot;&quot;
6118 6171 msgid "Item updated"
6119 6172 msgstr ""
6120 6173  
6121   -#: plugins/ktcore/KTDashlets.php:135 plugins/ktcore/KTMiscPages.php:82
  6174 +#: plugins/ktcore/KTDashlets.php:140 plugins/ktcore/KTMiscPages.php:82
6122 6175 #: i18n/templates.c:2375
6123 6176 msgid "Items that require your attention"
6124 6177 msgstr ""
... ... @@ -6147,7 +6200,7 @@ msgstr &quot;&quot;
6147 6200 msgid "Jump To Document"
6148 6201 msgstr ""
6149 6202  
6150   -#: lib/util/ktutil.inc:201
  6203 +#: lib/util/ktutil.inc:209
6151 6204 msgid "KB"
6152 6205 msgstr ""
6153 6206  
... ... @@ -6474,7 +6527,7 @@ msgstr &quot;&quot;
6474 6527 msgid "Lucene Migration Status"
6475 6528 msgstr ""
6476 6529  
6477   -#: lib/util/ktutil.inc:197
  6530 +#: lib/util/ktutil.inc:205
6478 6531 msgid "MB"
6479 6532 msgstr ""
6480 6533  
... ... @@ -6482,7 +6535,7 @@ msgstr &quot;&quot;
6482 6535 msgid "MD5 Checksum of files (used to ensure files have not been tampered with)"
6483 6536 msgstr ""
6484 6537  
6485   -#: plugins/ktcore/KTDashlets.php:288
  6538 +#: plugins/ktcore/KTDashlets.php:293
6486 6539 msgid "Mail Server Status"
6487 6540 msgstr ""
6488 6541  
... ... @@ -6961,6 +7014,14 @@ msgstr &quot;&quot;
6961 7014 msgid "Must select a field to edit."
6962 7015 msgstr ""
6963 7016  
  7017 +#: plugins/MyDropDocumentsPlugin/MyDropDocumentsPlugin.php:41
  7018 +msgid "My Drop Documents"
  7019 +msgstr ""
  7020 +
  7021 +#: plugins/MyDropDocumentsPlugin/MyDropDocumentsDashlet.php:44
  7022 +msgid "My Dropped Documents"
  7023 +msgstr ""
  7024 +
6964 7025 #: plugins/search2/MigrationDashlet.php:81
6965 7026 #: search2/indexing/indexerCore.inc.php:927
6966 7027 #: search2/indexing/indexerCore.inc.php:941 i18n/templates.c:1139
... ... @@ -7260,7 +7321,7 @@ msgstr &quot;&quot;
7260 7321 msgid "No body provided"
7261 7322 msgstr ""
7262 7323  
7263   -#: lib/templating/smartytemplate.inc.php:328
  7324 +#: lib/templating/smartytemplate.inc.php:330
7264 7325 msgid "No breadcrumbs available"
7265 7326 msgstr ""
7266 7327  
... ... @@ -7781,7 +7842,7 @@ msgstr &quot;&quot;
7781 7842 msgid "No workflow selected."
7782 7843 msgstr ""
7783 7844  
7784   -#: lib/util/ktutil.inc:658 lib/util/ktutil.inc:665 lib/util/ktutil.inc:678
  7845 +#: lib/util/ktutil.inc:666 lib/util/ktutil.inc:673 lib/util/ktutil.inc:686
7785 7846 msgid "Non-entity object"
7786 7847 msgstr ""
7787 7848  
... ... @@ -7797,7 +7858,7 @@ msgstr &quot;&quot;
7797 7858 msgid "Non-true and non-error return value"
7798 7859 msgstr ""
7799 7860  
7800   -#: lib/templating/smartytemplate.inc.php:199
  7861 +#: lib/templating/smartytemplate.inc.php:201
7801 7862 #: plugins/ktcore/admin/documentFieldsv2.php:235
7802 7863 #: plugins/rssplugin/KTrss.inc.php:362
7803 7864 msgid "None"
... ... @@ -8110,7 +8171,7 @@ msgstr &quot;&quot;
8110 8171 msgid "Ownership changed."
8111 8172 msgstr ""
8112 8173  
8113   -#: lib/util/ktutil.inc:185
  8174 +#: lib/util/ktutil.inc:193
8114 8175 msgid "PB"
8115 8176 msgstr ""
8116 8177  
... ... @@ -8884,6 +8945,10 @@ msgstr &quot;&quot;
8884 8945 msgid "Recently Added/Changed Documents"
8885 8946 msgstr ""
8886 8947  
  8948 +#: plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php:254
  8949 +msgid "Recently Dropped Documents"
  8950 +msgstr ""
  8951 +
8887 8952 #: plugins/network/userhistory/UserHistoryDashlet.inc.php:34
8888 8953 msgid "Recently Viewed Items"
8889 8954 msgstr ""
... ... @@ -9430,7 +9495,8 @@ msgstr &quot;&quot;
9430 9495 msgid "Search and Indexing"
9431 9496 msgstr ""
9432 9497  
9433   -#: plugins/ktcore/admin/configSettings.php:229
  9498 +#: plugins/ktcore/admin/configSettings.php:333
  9499 +#: plugins/ktcore/admin/configSettings.php:337
9434 9500 #: plugins/ktcore/KTCorePlugin.php:240 plugins/ktcore/KTCorePlugin.php:330
9435 9501 msgid "Search and Indexing Settings"
9436 9502 msgstr ""
... ... @@ -10171,7 +10237,7 @@ msgstr &quot;&quot;
10171 10237 msgid "System Temporary Folder"
10172 10238 msgstr ""
10173 10239  
10174   -#: lib/util/ktutil.inc:189
  10240 +#: lib/util/ktutil.inc:197
10175 10241 msgid "TB"
10176 10242 msgstr ""
10177 10243  
... ... @@ -10385,6 +10451,10 @@ msgstr &quot;&quot;
10385 10451 msgid "The condition required for this trigger has been deleted, so it is always available."
10386 10452 msgstr ""
10387 10453  
  10454 +#: plugins/ktcore/admin/configSettings.php:233
  10455 +msgid "The configuration settings have been updated."
  10456 +msgstr ""
  10457 +
10388 10458 #: plugins/ktcore/folder/addDocument.php:120
10389 10459 msgid "The contents of the document to be added to the document management system."
10390 10460 msgstr ""
... ... @@ -11932,6 +12002,10 @@ msgstr &quot;&quot;
11932 12002 msgid "Unable to find workflow trigger: %s"
11933 12003 msgstr ""
11934 12004  
  12005 +#: plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php:647
  12006 +msgid "Unable to get documents in folder "
  12007 +msgstr ""
  12008 +
11935 12009 #: plugins/ktcore/KTPermissions.php:801
11936 12010 #, php-format
11937 12011 msgid "Unable to get documents in folder %s: %s"
... ... @@ -11951,6 +12025,7 @@ msgid &quot;Unable to load trigger.&quot;
11951 12025 msgstr ""
11952 12026  
11953 12027 #: plugins/ktcore/KTPermissions.php:795
  12028 +#: plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php:640
11954 12029 msgid "Unable to locate folder: "
11955 12030 msgstr ""
11956 12031  
... ... @@ -12006,7 +12081,7 @@ msgstr &quot;&quot;
12006 12081 msgid "Unable to retrieve parent folder."
12007 12082 msgstr ""
12008 12083  
12009   -#: lib/util/ktutil.inc:1076
  12084 +#: lib/util/ktutil.inc:1084
12010 12085 #, php-format
12011 12086 msgid "Unable to retrieve system setting %s: %s"
12012 12087 msgstr ""
... ... @@ -12186,15 +12261,15 @@ msgstr &quot;&quot;
12186 12261 msgid "Unknown op: %s"
12187 12262 msgstr ""
12188 12263  
12189   -#: lib/database/dbutil.inc:175
  12264 +#: lib/database/dbutil.inc:177
12190 12265 msgid "Unknown return value for autoInsert"
12191 12266 msgstr ""
12192 12267  
12193   -#: lib/database/dbutil.inc:191
  12268 +#: lib/database/dbutil.inc:193
12194 12269 msgid "Unknown return value for autoUpdate"
12195 12270 msgstr ""
12196 12271  
12197   -#: lib/database/dbutil.inc:216
  12272 +#: lib/database/dbutil.inc:218
12198 12273 msgid "Unknown return value for whereUpdate"
12199 12274 msgstr ""
12200 12275  
... ... @@ -12446,7 +12521,7 @@ msgstr &quot;&quot;
12446 12521 msgid "User Information: #username# in \"#folder#\""
12447 12522 msgstr ""
12448 12523  
12449   -#: plugins/ktcore/admin/configSettings.php:135
  12524 +#: plugins/ktcore/admin/configSettings.php:263
12450 12525 #: plugins/ktcore/KTCorePlugin.php:326
12451 12526 msgid "User Interface Settings"
12452 12527 msgstr ""
... ... @@ -12775,11 +12850,15 @@ msgstr &quot;&quot;
12775 12850 msgid "Warning: Database is inconsistent with the contents of the repository."
12776 12851 msgstr ""
12777 12852  
  12853 +#: plugins/ktstandard/KTWebDAVDashletPlugin.php:66
  12854 +msgid "WebDAV Connection Information"
  12855 +msgstr ""
  12856 +
12778 12857 #: plugins/ktstandard/KTWebDAVDashletPlugin.php:50
12779 12858 msgid "WebDAV Dashlet Plugin"
12780 12859 msgstr ""
12781 12860  
12782   -#: lib/util/ktutil.inc:364
  12861 +#: lib/util/ktutil.inc:372
12783 12862 msgid "Weird WhereClause passed"
12784 12863 msgstr ""
12785 12864  
... ... @@ -13422,7 +13501,7 @@ msgstr &quot;&quot;
13422 13501 msgid "You're not authorized to delete this shortcut"
13423 13502 msgstr ""
13424 13503  
13425   -#: plugins/ktcore/KTDashlets.php:181
  13504 +#: plugins/ktcore/KTDashlets.php:186
13426 13505 msgid "Your Checked-out Documents"
13427 13506 msgstr ""
13428 13507  
... ... @@ -13554,7 +13633,7 @@ msgstr &quot;&quot;
13554 13633 msgid "after "
13555 13634 msgstr ""
13556 13635  
13557   -#: lib/util/ktutil.inc:145
  13636 +#: lib/util/ktutil.inc:153
13558 13637 msgid "ago"
13559 13638 msgstr ""
13560 13639  
... ...
plugins/MyDropDocumentsPlugin/MyDropDocumentsDashlet.php
1   -<?php
2   -/**
3   - * $Id: $
4   - *
5   - * KnowledgeTree Community Edition
6   - * Document Management Made Simple
7   - * Copyright (C) 2008 KnowledgeTree Inc.
8   - * Portions copyright The Jam Warehouse Software (Pty) Limited
9   - *
10   - * This program is free software; you can redistribute it and/or modify it under
11   - * the terms of the GNU General Public License version 3 as published by the
12   - * Free Software Foundation.
13   - *
14   - * This program is distributed in the hope that it will be useful, but WITHOUT
15   - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16   - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17   - * details.
18   - *
19   - * You should have received a copy of the GNU General Public License
20   - * along with this program. If not, see <http://www.gnu.org/licenses/>.
21   - *
22   - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
23   - * California 94120-7775, or email info@knowledgetree.com.
24   - *
25   - * The interactive user interfaces in modified source and object code versions
26   - * of this program must display Appropriate Legal Notices, as required under
27   - * Section 5 of the GNU General Public License version 3.
28   - *
29   - * In accordance with Section 7(b) of the GNU General Public License version 3,
30   - * these Appropriate Legal Notices must retain the display of the "Powered by
31   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
32   - * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
33   - * must display the words "Powered by KnowledgeTree" and retain the original
34   - * copyright notice.
35   - * Contributor( s): ______________________________________
36   - *
37   - */
38   -
39   -class MyDropDocumentsDashlet extends KTBaseDashlet {
40   - var $oUser;
41   - //var $sClass = 'ktError';
42   -
43   - function MyDropDocumentsDashlet(){
44   - $this->sTitle = _kt('My Dropped Documents');
45   - }
46   -
47   - function is_active($oUser) {
48   - $this->oUser = $oUser;
49   - return true;
50   - }
51   -
52   -
53   -/*
54   - function is_active($oUser) {
55   - $this->oUser = $oUser;
56   - return Permission::userIsSystemAdministrator($oUser);
57   - }
58   -*/
59   -
60   - function render() {
61   - global $main;
62   - $main->requireJSResource("plugins/MyDropDocumentsPlugin/js/update.js");
63   -
64   - $oPlugin =& $this->oPlugin;
65   -
66   - $oTemplating =& KTTemplating::getSingleton();
67   - $oTemplate = $oTemplating->loadTemplate('MyDropDocumentsPlugin/dashlet');
68   -
69   - $aTemplateData = array(
70   - 'context' => $this,
71   - 'url' => $oPlugin->getPagePath('MyDropDocuments'),
72   -
73   - );
74   -
75   -
76   - return $oTemplate->render($aTemplateData);
77   - }
78   -}
79   -?>
  1 +<?php
  2 +/**
  3 + * $Id: $
  4 + *
  5 + * KnowledgeTree Community Edition
  6 + * Document Management Made Simple
  7 + * Copyright (C) 2008 KnowledgeTree Inc.
  8 + * Portions copyright The Jam Warehouse Software (Pty) Limited
  9 + *
  10 + * This program is free software; you can redistribute it and/or modify it under
  11 + * the terms of the GNU General Public License version 3 as published by the
  12 + * Free Software Foundation.
  13 + *
  14 + * This program is distributed in the hope that it will be useful, but WITHOUT
  15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 + * details.
  18 + *
  19 + * You should have received a copy of the GNU General Public License
  20 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 + *
  22 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 + * California 94120-7775, or email info@knowledgetree.com.
  24 + *
  25 + * The interactive user interfaces in modified source and object code versions
  26 + * of this program must display Appropriate Legal Notices, as required under
  27 + * Section 5 of the GNU General Public License version 3.
  28 + *
  29 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  30 + * these Appropriate Legal Notices must retain the display of the "Powered by
  31 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 + * must display the words "Powered by KnowledgeTree" and retain the original
  34 + * copyright notice.
  35 + * Contributor( s): ______________________________________
  36 + *
  37 + */
  38 +
  39 +class MyDropDocumentsDashlet extends KTBaseDashlet {
  40 + var $oUser;
  41 + //var $sClass = 'ktError';
  42 +
  43 + function MyDropDocumentsDashlet(){
  44 + $this->sTitle = _kt('My Dropped Documents');
  45 + }
  46 +
  47 + function is_active($oUser) {
  48 + $this->oUser = $oUser;
  49 + return true;
  50 + }
  51 +
  52 +
  53 +/*
  54 + function is_active($oUser) {
  55 + $this->oUser = $oUser;
  56 + return Permission::userIsSystemAdministrator($oUser);
  57 + }
  58 +*/
  59 +
  60 + function render() {
  61 + global $main;
  62 + $main->requireJSResource("plugins/MyDropDocumentsPlugin/js/update.js");
  63 +
  64 + $oPlugin =& $this->oPlugin;
  65 +
  66 + $oTemplating =& KTTemplating::getSingleton();
  67 + $oTemplate = $oTemplating->loadTemplate('MyDropDocumentsPlugin/dashlet');
  68 +
  69 + $aTemplateData = array(
  70 + 'context' => $this,
  71 + 'url' => $oPlugin->getPagePath('MyDropDocuments'),
  72 +
  73 + );
  74 +
  75 +
  76 + return $oTemplate->render($aTemplateData);
  77 + }
  78 +}
  79 +?>
... ...
plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php
1   -<?php
2   -/**
3   - * $Id: $
4   - *
5   - * KnowledgeTree Community Edition
6   - * Document Management Made Simple
7   - * Copyright (C) 2008 KnowledgeTree Inc.
8   - * Portions copyright The Jam Warehouse Software (Pty) Limited
9   - *
10   - * This program is free software; you can redistribute it and/or modify it under
11   - * the terms of the GNU General Public License version 3 as published by the
12   - * Free Software Foundation.
13   - *
14   - * This program is distributed in the hope that it will be useful, but WITHOUT
15   - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16   - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17   - * details.
18   - *
19   - * You should have received a copy of the GNU General Public License
20   - * along with this program. If not, see <http://www.gnu.org/licenses/>.
21   - *
22   - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
23   - * California 94120-7775, or email info@knowledgetree.com.
24   - *
25   - * The interactive user interfaces in modified source and object code versions
26   - * of this program must display Appropriate Legal Notices, as required under
27   - * Section 5 of the GNU General Public License version 3.
28   - *
29   - * In accordance with Section 7(b) of the GNU General Public License version 3,
30   - * these Appropriate Legal Notices must retain the display of the "Powered by
31   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
32   - * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
33   - * must display the words "Powered by KnowledgeTree" and retain the original
34   - * copyright notice.
35   - * Contributor( s): ______________________________________
36   - *
37   - */
38   -
39   -require_once(KT_DIR . "/ktapi/ktapi.inc.php");
40   -require_once(KT_LIB_DIR . "/plugins/plugin.inc.php");
41   -require_once(KT_LIB_DIR . "/plugins/pluginregistry.inc.php");
42   -require_once(KT_LIB_DIR . "/dashboard/dashlet.inc.php");
43   -require_once(KT_DIR . "/plugins/ktcore/KTFolderActions.php");
44   -require_once(KT_DIR . "/plugins/network/extendedtransactioninfo/simpletransactionutil.inc.php");
45   -require_once(KT_DIR . "/ktapi/KTAPIFolder.inc.php");
46   -require_once(KT_LIB_DIR . "/roles/Role.inc");
47   -require_once(KT_LIB_DIR . "/roles/roleallocation.inc.php");
48   -require_once(KT_LIB_DIR . "/permissions/permissionutil.inc.php");
49   -require_once(KT_LIB_DIR . '/mime.inc.php');
50   -/* This page is run via an AJAX call from the update.js for this plugin.
51   - * It checks to see if both the dropdocuments folder and the users personal folder exist.
52   - * If they don't, it creates them and assigns permission and roles accordingly.
53   - * If the dropdocuments folder does exist it checks if the WorkSpaceOwner role exists.
54   - * If the role exists it assigns the current user to the role on the dropdocuments folder.
55   - * Therefore any users running the plugin after the dropdocuments folder has been created will have access to it too.
56   - * The underlying logic is that everyone is assigned to the WorkSpaceOwner Role, they have all permission except
57   - * Delete, Rename Folder, Manage security and Manage workflow on the dropdocuments folder.
58   - * This role is then assigned to their personal folder too (which is named according to their username) and is overidden
59   - * to give only the current user full rights to their folder.
60   - * Essentially everyone can look at the dropdocuments folder but will only see their own folder within it.
61   - */
62   -
63   -class MyDropDocumentsPage extends KTStandardDispatcher {
64   -
65   - function do_main() {
66   -
67   - $iRootID = (int)1;
68   - $oUser = $this->oUser;
69   - $sUserName = (string)$this->oUser->getUserName();
70   - $this->ktapi = new KTAPI();
71   - $this->session = $this->ktapi->start_system_session();
72   -
73   - if(!Folder::FolderExistsName('DroppedDocuments', $iRootID))
74   - {
75   -
76   - $root=$this->ktapi->get_root_folder();
77   -
78   - //Create dropdocuments folder
79   - $userFolder = $root->add_folder('DroppedDocuments');
80   -
81   - //In order to stop permission inheritance a copy of the parent permission object is created.
82   - //This copy is then used to set separate permissions for this folder.
83   - KTPermissionUtil::copyPermissionObject($userFolder->get_folder());
84   -
85   - //If WorkSpaceOwner role doesn't exist, create it
86   - if(!$this->roleExistsName('WorkSpaceOwner'))
87   - {
88   - $oWorkSpaceOwnerRole = $this->createRole('WorkSpaceOwner');
89   - if ($oWorkSpaceOwnerRole == null)
90   - {
91   - $this->session->logout();
92   - return _kt('Error: Failed to create WorkSpaceOwner Role');
93   - }
94   - }
95   -
96   - //$root=$this->ktapi->get_root_folder();
97   - //$personalFolder = $root->get_folder_by_name('/dropdocuments/'.$sUserName);
98   -
99   - //Get the folder object
100   - $userFolderObject = $userFolder->get_folder();
101   -
102   - //Get the permission object from the dropdocuments folder object
103   - $oUserPO = KTPermissionObject::get($userFolderObject->getPermissionObjectId());
104   -
105   - //Check to see if there are duplicate WorkSpaceOwner roles.
106   - if (count($this->getRoleIdByName('WorkSpaceOwner')) > 1)
107   - {
108   - $this->session->logout();
109   - return _kt('Error: cannot set user role permissions: more than one role named \'WorkSpaceOwner\' exists');
110   -
111   - }
112   -
113   - //call the function to set the permission on the dropdocuments folder
114   - $this->setUserDocsPermissions($oUserPO);
115   -
116   - //Assign the current user to the WorkSpaceOwner role
117   - $this->setUserDocsRoleAllocation($userFolderObject);
118   -
119   - }
120   - else
121   - {
122   -
123   - $root = $this->ktapi->get_root_folder();
124   - $userFolder = $root->get_folder_by_name('/DroppedDocuments');
125   -
126   - //Get the dropdocuments folder object
127   - $userFolderObject = $userFolder->get_folder();
128   -
129   - if(!$this->roleExistsName('WorkSpaceOwner'))
130   - {
131   -
132   - $oWorkSpaceOwnerRole = $this->createRole('WorkSpaceOwner');
133   - if ($oWorkSpaceOwnerRole == null)
134   - {
135   - $this->session->logout();
136   - return _kt('Error: Failed to create WorkSpaceOwner Role');
137   - }
138   -
139   - //set permissions
140   - $oUserPO = KTPermissionObject::get($userFolderObject->getPermissionObjectId());
141   - $this->setUserDocsPermissions($oUserPO);
142   - //assign current user to role
143   - $this->setUserDocsRoleAllocation($userFolderObject);
144   - }
145   - else
146   - {
147   -
148   - //update WrokSpaceOwner role to include current user
149   - $this->updateUserDocsRoleAllocation($userFolderObject);
150   - }
151   -
152   - }
153   -
154   - $iUserDocsFolderID = $this->getFolderID('DroppedDocuments');
155   - $oUserDocsFolder = Folder::get($iUserDocsFolderID);
156   -
157   - if(!Folder::FolderExistsName($sUserName, $iUserDocsFolderID))
158   - {
159   -
160   -
161   - $root=$this->ktapi->get_root_folder();
162   - $userDocsFolder = $root->get_folder_by_name('/DroppedDocuments');
163   -
164   - //create the personal folder. (Use the username to create it)
165   - $personalFolder = $userDocsFolder->add_folder($sUserName);
166   -
167   - //Copy the permission object to stop permission inheritance
168   - KTPermissionUtil::copyPermissionObject($personalFolder->get_folder());
169   -
170   - //The role should exist by now.
171   - //In both the if and else statements for the dropdocuments above the role is created
172   - //If its doesn't exist by now there is an error
173   - if(!$this->roleExistsName('WorkSpaceOwner'))
174   - {
175   -
176   - $this->session->logout();
177   - return _kt('Error: WorkSpaceOwner Role not setup, cannot assign to Personal Folder');
178   -
179   - }
180   -
181   - $personalFolderRole = $root->get_folder_by_name('/DroppedDocuments/'.$sUserName);
182   - $PersonalFolderObject = ($personalFolderRole->get_folder());
183   -
184   - //Get permission object
185   - $oPO = KTPermissionObject::get($PersonalFolderObject->getPermissionObjectId());
186   -
187   - //Check for duplicate WorkSpaceOwner roles
188   - if (count($this->getRoleIdByName('WorkSpaceOwner')) > 1)
189   - {
190   - $this->session->logout();
191   - return _kt('Error: cannot set personal folder role permissions: more than one role named \'WorkSpaceOwner\' exists');
192   -
193   - }
194   -
195   - $this->setPersonalFolderPermissions($oPO);
196   -
197   - $this->updatePersonalFolderRoleAllocation($PersonalFolderObject);
198   -
199   -
200   - //folder just created so no top list of last modified documents
201   -
202   - $iMyDocsFolderID = $this->getFolderID($sUserName);
203   - $this->session->logout();
204   - return _kt('<span class="descriptiveText"> You do not have any dropped documents </span><br><br><br>');
205   -
206   -
207   - }
208   -
209   - else //if personal folder does exist
210   - {
211   - //Getting personal folder id
212   - $iMyDocsFolderID = $this->getFolderID($sUserName);
213   -
214   -
215   - if(!$this->roleExistsName('WorkSpaceOwner'))
216   - {
217   - $this->session->logout();
218   - return _kt('Error: WorkSpaceOwner Role does not exist');
219   - }
220   - else
221   - {
222   -
223   - $oTempPersonalFolder = $root->get_folder_by_name('/DroppedDocuments/'.$sUserName);
224   - $oPersonalFolder = $oTempPersonalFolder->get_folder();
225   - //update WorkSpaceOwner role to include current user
226   -
227   - //Get permission object
228   - $oPO = KTPermissionObject::get($oPersonalFolder->getPermissionObjectId());
229   -
230   - $this->setPersonalFolderPermissions($oPO);
231   -
232   - $this->updatePersonalFolderRoleAllocation($oPersonalFolder);
233   -
234   - }
235   -
236   -
237   -
238   - $aExternalWhereClauses[] = '(DT.transaction_namespace IN (?,?,?) AND (D.parent_folder_ids LIKE "%,'.$iMyDocsFolderID.',%" OR D.parent_folder_ids LIKE "%,'.$iMyDocsFolderID.'"))';
239   - $aExternalWhereParams[] = 'ktcore.transactions.create';
240   - $aExternalWhereParams[] = 'ktcore.transactions.check_in';
241   - $aExternalWhereParams[] = 'ktcore.transactions.event';
242   -
243   -
244   - $aDocumentTransactions = KTSimpleTransactionUtil::getTransactionsMatchingQuery($oUser, '', $aExternalWhereClauses, $aExternalWhereParams);
245   - if (empty($aDocumentTransactions))
246   - {
247   - $this->session->logout();
248   - return _kt('<span class="descriptiveText"> You do not have any dropped documents </span><br><br><br>');
249   - }
250   -
251   - $maxcount = 5;
252   - $aDocumentTransactions = array_slice($aDocumentTransactions, 0, $maxcount);
253   -
254   - $sReturnTable = '<span class="descriptiveText">'._kt('Recently Dropped Documents').'</span>
255   - <table width="100%" class="kt_collection drop_box" cellspacing="0">
256   -
257   - <thead>
258   - <tr>
259   - <th width="100%">'._kt('Document').'</th>
260   - <th width="1%">'._kt('Date Dropped').'</th>
261   - </tr>
262   - </thead>
263   - <tbody>';
264   -
265   - $sOddorEven = '';
266   - $count = 1;
267   - foreach ($aDocumentTransactions as $aRow)
268   - {
269   - $oDocument = Document::get($aRow[document_id]);
270   - $aParentFolders = explode('/',$oDocument->getFullPath());
271   - $sPath = '';
272   -
273   - for($i = 0; $i < count($aParentFolders); $i++)
274   - {
275   - if ($i > 2)
276   - {
277   - $sPath .= '/'.$aParentFolders[$i];
278   - }
279   - }
280   -
281   - $sContentType = KTMime::getIconPath($oDocument->getMimeTypeID());
282   - $aAnchorData = $this->getDocInfo($aRow[document_id]);
283   - $sLink = $aAnchorData[0];
284   - $sDocName = $aAnchorData[1];
285   - $sShortDocName = $sDocName;
286   - if(strlen($sPath) > 0)
287   - {
288   - $sDocName = $sPath.'/'.$sDocName;
289   - }
290   -
291   - $sFullDocName = $sDocName;
292   - $iDocLength = strlen($sDocName);
293   - if ( $iDocLength > 30 )
294   - {
295   - $sDocName = substr($sDocName, ($iDocLength - 30), $iDocLength);
296   - $sDocName = '...'.$sDocName;
297   - }
298   -
299   - if($count%2 == 0)
300   - {
301   - $sOddorEven = 'even';
302   - }
303   - else
304   - {
305   - $sOddorEven = 'odd';
306   - }
307   -
308   - $sReturnTable .= '<tr class="'.$sOddorEven.'">'.
309   - '<td width="100%"><span class="contenttype '.$sContentType.'"><a title="'.$sShortDocName.'" href='.$sLink.'>'.$sDocName.'</a></span></td>'.
310   - '<td width="1%">'.$aRow[datetime].'</td>'.
311   - '</tr>';
312   - $count ++;
313   - }
314   -
315   - $location = 'browse.php?fFolderId='.$iMyDocsFolderID;
316   - $sReturnTable .= '</tbody>'.
317   - '</table>'.
318   - '<br>'.
319   - '<a href="'.$location.'">'._kt(' View All').' </a><br><br>';
320   - $this->session->logout();
321   -
322   - return $sReturnTable;
323   -
324   - }
325   - }
326   -
327   - function handleOutput($sOutput) {
328   - print $sOutput;
329   - }
330   -
331   - //This function is used to set the permission on the dropdocuments folder
332   - function setUserDocsPermissions($oUserPO)
333   - {
334   - //arrays returned from get Role ID's
335   - $aWorkSpaceOwnerRoleID = $this->getRoleIdByName('WorkSpaceOwner');
336   - $aAdminGroupID = $this->getGroupIdByName('System Administrators');
337   -
338   - //arrays used to make integers for $aAllowed array variable
339   - $iWorkSpaceOwnerRoleID = $aWorkSpaceOwnerRoleID[0]['id'];
340   - $iAdminGroupID = $aAdminGroupID[0]['id'];
341   - //$aBothAllowed is used to give permissions to the admin group and the WorkSpaceOwner role
342   - $aBothAllowed = array('group' => array($iAdminGroupID), 'role' => array($iWorkSpaceOwnerRoleID));
343   -
344   - //$aAdminAllowed is used to give permissions to the admin group only
345   - $aAdminAllowed = array('group' => array($iAdminGroupID));
346   -
347   - //Get the list of permissions
348   - $aPermissions = KTPermission::getList();
349   -
350   - foreach ($aPermissions as $oPermission)
351   - {
352   - //If the permission is not one of the below then both are allowed the permission
353   - //Otherwise only the admin group is allowed the permission
354   - if($oPermission->getHumanName() != 'Delete' && $oPermission->getHumanName() != 'Rename Folder'
355   - && $oPermission->getHumanName() != 'Manage security' && $oPermission->getHumanName() != 'Manage workflow')
356   - {
357   - KTPermissionUtil::setPermissionForId($oPermission, $oUserPO, $aBothAllowed);
358   - }
359   - else
360   - {
361   - KTPermissionUtil::setPermissionForId($oPermission, $oUserPO, $aAdminAllowed);
362   - }
363   - }
364   -
365   - //UPdate the permission lookup
366   - KTPermissionUtil::updatePermissionLookupForPO($oUserPO);
367   - }
368   -
369   - //This function is used for allocating the user to the WorkSpaceOwner role only when the dropdocuments folder
370   - //has just been created.
371   - function setUserDocsRoleAllocation($oUserFolderObject)
372   - {
373   - $userFolderID = $oUserFolderObject->getId();
374   -
375   - $tempWorkSpaceOwnerRoleID = $this->getRoleIdByName('WorkSpaceOwner');
376   - $WorkSpaceOwnerRoleID = $tempWorkSpaceOwnerRoleID[0]['id'];
377   -
378   - //create a new role allocation
379   - $oDropdocumentsRoleAllocation = new RoleAllocation();
380   - if ($oDropdocumentsRoleAllocation == null)
381   - {
382   - $this->session->logout();
383   - return _kt('Error: cannot create WorkSpaceOwner role allocation');
384   - }
385   -
386   - //set the folder and role for the allocation
387   - $oDropdocumentsRoleAllocation->setFolderId($userFolderID);
388   - $oDropdocumentsRoleAllocation->setRoleId($WorkSpaceOwnerRoleID);
389   -
390   - $aWorkSpaceOwnerRoleAllowed = array();
391   - $oDropdocumentsRoleAllocation->setAllowed($aWorkSpaceOwnerRoleAllowed);
392   - //It might be a problem that i'm not doing a "start transaction" here.
393   - //Unable to roll back in event of db failure
394   - $res = $oDropdocumentsRoleAllocation->create();
395   -
396   - //The role is created and then updated by adding the current user to the allowed list
397   -
398   - $oPD = $oDropdocumentsRoleAllocation->getPermissionDescriptor();
399   - $aWorkSpaceOwnerRoleAssignAllowed = $oPD->getAllowed();
400   - $aUserId[] = $this->oUser->getId();
401   - $aWorkSpaceOwnerRoleAssignAllowed['user'] = $aUserId;
402   - $oDropdocumentsRoleAllocation->setAllowed($aWorkSpaceOwnerRoleAssignAllowed);
403   - $res = $oDropdocumentsRoleAllocation->update();
404   -
405   - //Update all info linked to the role
406   - $this->renegeratePermissionsForRole($oDropdocumentsRoleAllocation->getRoleId(), $userFolderID);
407   - }
408   -
409   - //This function is used to allocate the current user to the WorkSpaceOwner role after the Dropdocuments folder
410   - //has already been created.
411   - function updateUserDocsRoleAllocation($oUserFolder)
412   - {
413   - $userFolderID = $oUserFolder->getId();
414   - $tempWorkSpaceOwnerRoleID = $this->getRoleIdByName('WorkSpaceOwner');//$oUserRole->getId();
415   - $WorkSpaceOwnerRoleID = $tempWorkSpaceOwnerRoleID[0]['id'];
416   -
417   - //Get the role allocation object for the Dropdocuments folder and the WorkSpaceOwner role
418   - $oDropdocumentsRoleAllocation = $oRoleAllocation = RoleAllocation::getAllocationsForFolderAndRole($userFolderID, $WorkSpaceOwnerRoleID);
419   -
420   - //check that the object is not null
421   - if ($oDropdocumentsRoleAllocation == null)
422   - {
423   - $this->session->logout();
424   - return _kt('Error: cannot find WorkSpaceOwner role allocation');
425   - }
426   -
427   - $oPD = $oDropdocumentsRoleAllocation->getPermissionDescriptor();
428   - $aWorkSpaceOwnerRoleAssignAllowed = $oPD->getAllowed();
429   -
430   - //If the user ID is not in the allowed list already then add it to the list.
431   - if(!in_array($this->oUser->getId(), $aWorkSpaceOwnerRoleAssignAllowed['user']))
432   - {
433   - $aNewAllowed = array();
434   - $aNewAllowed = $aWorkSpaceOwnerRoleAssignAllowed['user'];
435   - $aNewAllowed[] = $this->oUser->getId();
436   - $aWorkSpaceOwnerRoleAssignAllowed['user'] = $aNewAllowed;
437   - $oDropdocumentsRoleAllocation->setAllowed($aWorkSpaceOwnerRoleAssignAllowed);
438   - $res = $oDropdocumentsRoleAllocation->update();
439   - $this->renegeratePermissionsForRole($oDropdocumentsRoleAllocation->getRoleId(), $userFolderID);
440   - }
441   - }
442   -
443   - function setPersonalFolderPermissions($oPO)
444   - {
445   - $aWorkSpaceOwnerRoleID = $this->getRoleIdByName('WorkSpaceOwner');
446   - $aAdminGroupID = $this->getGroupIdByName('System Administrators');
447   -
448   - //arrays used to make integers for $aAllowed array variable
449   - $iWorkSpaceOwnerRoleID = $aWorkSpaceOwnerRoleID[0]['id'];
450   - $iAdminGroupID = $aAdminGroupID[0]['id'];
451   -
452   - //set permissions for the role and the admin group
453   - $aAllowed = array('role' => array($iWorkSpaceOwnerRoleID), 'group' => array($iAdminGroupID));
454   -
455   - //Get the List of all the permissions
456   - $aPersonalFolderPermissions = KTPermission::getList();
457   -
458   - //Iterate through and apply all permissions to the current user and the admin group
459   - foreach ($aPersonalFolderPermissions as $oPersonalFolderPermission)
460   - {
461   - KTPermissionUtil::setPermissionForId($oPersonalFolderPermission, $oPO, $aAllowed);
462   -
463   - }
464   -
465   - //Update permission lookup
466   - KTPermissionUtil::updatePermissionLookupForPO($oPO);
467   - }
468   -
469   - function updatePersonalFolderRoleAllocation($oPersonalFolder)
470   - {
471   - //Assign user to the WorkSpaceOwner role
472   - $personalFolderID = $oPersonalFolder->getId();
473   - $tempWorkSpaceOwnerRoleID = $this->getRoleIdByName('WorkSpaceOwner');
474   - $WorkSpaceOwnerRoleID = $tempWorkSpaceOwnerRoleID[0]['id'];
475   -
476   - $oRoleAllocation = new RoleAllocation();
477   - if ($oRoleAllocation == null)
478   - {
479   - $this->session->logout();
480   - return _kt('Error: Cannot create WorkSpaceOwner role allocation on personal folder');
481   - }
482   - $oRoleAllocation->setFolderId($personalFolderID);
483   - $oRoleAllocation->setRoleId($WorkSpaceOwnerRoleID);
484   -
485   - $aRoleAllowed = array();
486   - $oRoleAllocation->setAllowed($aRoleAllowed);
487   -
488   - //It might be a problem that i'm not doing a "start transaction" here.
489   - //Unable to roll back in event of db failure
490   - $res = $oRoleAllocation->create();
491   -
492   - //The role is first created and then the current user is allocated to the role below
493   -
494   - $oPD = $oRoleAllocation->getPermissionDescriptor();
495   - $aRoleAssignAllowed = $oPD->getAllowed();
496   - $aUserId[] = $this->oUser->getId();
497   - $aRoleAssignAllowed['user'] = $aUserId;
498   - $oRoleAllocation->setAllowed($aRoleAssignAllowed);
499   - $res = $oRoleAllocation->update();
500   - $this->renegeratePermissionsForRole($oRoleAllocation->getRoleId(), $personalFolderID);
501   - }
502   -
503   - //FIXME: Direct Database access
504   - function getFolderID($sFolderName) {
505   - $sQuery = 'SELECT id FROM folders WHERE name = \''.$sFolderName.'\'';
506   -
507   - $id = DBUtil::getResultArray($sQuery);
508   - return $id[0]['id'];
509   - }
510   -
511   - //this function returns the document link and document name to be displayed on the dashlet
512   - function getDocInfo($iDocId) {
513   - $oDocument = Document::get($iDocId);
514   -
515   - if (PEAR::isError($oDocument)) {
516   - return _kt('Document no longer exists.');
517   - }
518   -
519   - $sName = htmlentities($oDocument->getName(), ENT_NOQUOTES, 'UTF-8');
520   - $sLink = KTBrowseUtil::getUrlForDocument($oDocument);
521   -
522   - $aAnchorData = array();
523   - $aAnchorData[] = $sLink;
524   - $aAnchorData[] = $sName;
525   - return $aAnchorData;
526   - }
527   -
528   - //This function is used to create the role, role allocation is done separately
529   - function createRole ($sName)
530   - {
531   - $this->startTransaction();
532   - $oRole = Role::createFromArray(array('name' => $sName));
533   -
534   - if (PEAR::isError($oRole) || ($oRole == false))
535   - {
536   - if ($this->bTransactionStarted)
537   - {
538   - $this->rollbackTransaction();
539   - }
540   - //return null on failure
541   - return null;
542   - }
543   - else
544   - {
545   - return $oRole;
546   -
547   - }
548   - }
549   -
550   - //FIXME: Direct Database access
551   - function roleExistsName ($sName)
552   - {
553   - $sQuery = "SELECT id FROM roles WHERE name = ?";
554   - $aParams = array($sName);
555   - $res = DBUtil::getResultArray(array($sQuery, $aParams));
556   -
557   - if (count($res) != 0)
558   - {
559   - return true;
560   - }
561   - return false;
562   - }
563   -
564   - //FIXME: Direct Database access
565   - function groupExistsName ($sName)
566   - {
567   - $sQuery = "SELECT id FROM groups_lookup WHERE name = ?";
568   - $aParams = array($sName);
569   - $res = DBUtil::getResultArray(array($sQuery, $aParams));
570   -
571   - if (count($res) != 0)
572   - {
573   - return true;
574   - }
575   - return false;
576   - }
577   -
578   - //FIXME: Direct Database access
579   - function getRoleIdByName($sName)
580   - {
581   - $sQuery = "SELECT id FROM roles WHERE name = ?";
582   - $aParams = array($sName);
583   - $res = DBUtil::getResultArray(array($sQuery, $aParams));
584   - return $res;
585   - }
586   -
587   - //FIXME: Direct Database access
588   - function getGroupIdByName ($sName)
589   - {
590   - $sQuery = "SELECT id FROM groups_lookup WHERE name = ?";
591   - $aParams = array($sName);
592   - $res = DBUtil::getResultArray(array($sQuery, $aParams));
593   - return $res;
594   - }
595   -
596   - //function taken from KTPermission.php and edited to work here
597   - function renegeratePermissionsForRole($iRoleId, $iFolderId) {
598   - $iStartFolderId = $iFolderId;
599   - /*
600   - * 1. find all folders & documents "below" this one which use the role
601   - * definition _active_ (not necessarily present) at this point.
602   - * 2. tell permissionutil to regen their permissions.
603   - *
604   - * The find algorithm is:
605   - *
606   - * folder_queue <- (iStartFolderId)
607   - * while folder_queue is not empty:
608   - * active_folder =
609   - * for each folder in the active_folder:
610   - * find folders in _this_ folder without a role-allocation on the iRoleId
611   - * add them to the folder_queue
612   - * update the folder's permissions.
613   - * find documents in this folder:
614   - * update their permissions.
615   - */
616   -
617   - $sRoleAllocTable = KTUtil::getTableName('role_allocations');
618   - $sFolderTable = KTUtil::getTableName('folders');
619   - $sQuery = sprintf('SELECT f.id as id FROM %s AS f LEFT JOIN %s AS ra ON (f.id = ra.folder_id) WHERE ra.id IS NULL AND f.parent_id = ?', $sFolderTable, $sRoleAllocTable);
620   -
621   -
622   - $folder_queue = array($iStartFolderId);
623   - while (!empty($folder_queue)) {
624   - $active_folder = array_pop($folder_queue);
625   -
626   - $aParams = array($active_folder);
627   -
628   - $aNewFolders = DBUtil::getResultArrayKey(array($sQuery, $aParams), 'id');
629   - if (PEAR::isError($aNewFolders)) {
630   - //$this->errorRedirectToMain(_kt('Failure to generate folderlisting.'));
631   - echo _kt('Failure to generate folderlisting.');
632   - }
633   - $folder_queue = kt_array_merge ($folder_queue, (array) $aNewFolders); // push.
634   -
635   -
636   - // update the folder.
637   - $oFolder =& Folder::get($active_folder);
638   - if (PEAR::isError($oFolder) || ($oFolder == false)) {
639   - //$this->errorRedirectToMain(_kt('Unable to locate folder: ') . $active_folder);
640   - echo _kt('Unable to locate folder: ').$active_folder;
641   - }
642   -
643   - KTPermissionUtil::updatePermissionLookup($oFolder);
644   - $aDocList =& Document::getList(array('folder_id = ?', $active_folder));
645   - if (PEAR::isError($aDocList) || ($aDocList === false)) {
646   - //$this->errorRedirectToMain(sprintf(_kt('Unable to get documents in folder %s: %s'), $active_folder, $aDocList->getMessage()));
647   - echo _kt('Unable to get documents in folder ').$active_folder;
648   - }
649   -
650   - foreach ($aDocList as $oDoc) {
651   - if (!PEAR::isError($oDoc)) {
652   - KTPermissionUtil::updatePermissionLookup($oDoc);
653   - }
654   - }
655   - }
656   - }
657   -
658   -}
659   -?>
  1 +<?php
  2 +/**
  3 + * $Id: $
  4 + *
  5 + * KnowledgeTree Community Edition
  6 + * Document Management Made Simple
  7 + * Copyright (C) 2008 KnowledgeTree Inc.
  8 + * Portions copyright The Jam Warehouse Software (Pty) Limited
  9 + *
  10 + * This program is free software; you can redistribute it and/or modify it under
  11 + * the terms of the GNU General Public License version 3 as published by the
  12 + * Free Software Foundation.
  13 + *
  14 + * This program is distributed in the hope that it will be useful, but WITHOUT
  15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 + * details.
  18 + *
  19 + * You should have received a copy of the GNU General Public License
  20 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 + *
  22 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 + * California 94120-7775, or email info@knowledgetree.com.
  24 + *
  25 + * The interactive user interfaces in modified source and object code versions
  26 + * of this program must display Appropriate Legal Notices, as required under
  27 + * Section 5 of the GNU General Public License version 3.
  28 + *
  29 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  30 + * these Appropriate Legal Notices must retain the display of the "Powered by
  31 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 + * must display the words "Powered by KnowledgeTree" and retain the original
  34 + * copyright notice.
  35 + * Contributor( s): ______________________________________
  36 + *
  37 + */
  38 +
  39 +require_once(KT_DIR . "/ktapi/ktapi.inc.php");
  40 +require_once(KT_LIB_DIR . "/plugins/plugin.inc.php");
  41 +require_once(KT_LIB_DIR . "/plugins/pluginregistry.inc.php");
  42 +require_once(KT_LIB_DIR . "/dashboard/dashlet.inc.php");
  43 +require_once(KT_DIR . "/plugins/ktcore/KTFolderActions.php");
  44 +require_once(KT_DIR . "/plugins/network/extendedtransactioninfo/simpletransactionutil.inc.php");
  45 +require_once(KT_DIR . "/ktapi/KTAPIFolder.inc.php");
  46 +require_once(KT_LIB_DIR . "/roles/Role.inc");
  47 +require_once(KT_LIB_DIR . "/roles/roleallocation.inc.php");
  48 +require_once(KT_LIB_DIR . "/permissions/permissionutil.inc.php");
  49 +require_once(KT_LIB_DIR . '/mime.inc.php');
  50 +/* This page is run via an AJAX call from the update.js for this plugin.
  51 + * It checks to see if both the dropdocuments folder and the users personal folder exist.
  52 + * If they don't, it creates them and assigns permission and roles accordingly.
  53 + * If the dropdocuments folder does exist it checks if the WorkSpaceOwner role exists.
  54 + * If the role exists it assigns the current user to the role on the dropdocuments folder.
  55 + * Therefore any users running the plugin after the dropdocuments folder has been created will have access to it too.
  56 + * The underlying logic is that everyone is assigned to the WorkSpaceOwner Role, they have all permission except
  57 + * Delete, Rename Folder, Manage security and Manage workflow on the dropdocuments folder.
  58 + * This role is then assigned to their personal folder too (which is named according to their username) and is overidden
  59 + * to give only the current user full rights to their folder.
  60 + * Essentially everyone can look at the dropdocuments folder but will only see their own folder within it.
  61 + */
  62 +
  63 +class MyDropDocumentsPage extends KTStandardDispatcher {
  64 +
  65 + function do_main() {
  66 +
  67 + $iRootID = (int)1;
  68 + $oUser = $this->oUser;
  69 + $sUserName = (string)$this->oUser->getUserName();
  70 + $this->ktapi = new KTAPI();
  71 + $this->session = $this->ktapi->start_system_session();
  72 +
  73 + if(!Folder::FolderExistsName('DroppedDocuments', $iRootID))
  74 + {
  75 +
  76 + $root=$this->ktapi->get_root_folder();
  77 +
  78 + //Create dropdocuments folder
  79 + $userFolder = $root->add_folder('DroppedDocuments');
  80 +
  81 + //In order to stop permission inheritance a copy of the parent permission object is created.
  82 + //This copy is then used to set separate permissions for this folder.
  83 + KTPermissionUtil::copyPermissionObject($userFolder->get_folder());
  84 +
  85 + //If WorkSpaceOwner role doesn't exist, create it
  86 + if(!$this->roleExistsName('WorkSpaceOwner'))
  87 + {
  88 + $oWorkSpaceOwnerRole = $this->createRole('WorkSpaceOwner');
  89 + if ($oWorkSpaceOwnerRole == null)
  90 + {
  91 + $this->session->logout();
  92 + return _kt('Error: Failed to create WorkSpaceOwner Role');
  93 + }
  94 + }
  95 +
  96 + //$root=$this->ktapi->get_root_folder();
  97 + //$personalFolder = $root->get_folder_by_name('/dropdocuments/'.$sUserName);
  98 +
  99 + //Get the folder object
  100 + $userFolderObject = $userFolder->get_folder();
  101 +
  102 + //Get the permission object from the dropdocuments folder object
  103 + $oUserPO = KTPermissionObject::get($userFolderObject->getPermissionObjectId());
  104 +
  105 + //Check to see if there are duplicate WorkSpaceOwner roles.
  106 + if (count($this->getRoleIdByName('WorkSpaceOwner')) > 1)
  107 + {
  108 + $this->session->logout();
  109 + return _kt('Error: cannot set user role permissions: more than one role named \'WorkSpaceOwner\' exists');
  110 +
  111 + }
  112 +
  113 + //call the function to set the permission on the dropdocuments folder
  114 + $this->setUserDocsPermissions($oUserPO);
  115 +
  116 + //Assign the current user to the WorkSpaceOwner role
  117 + $this->setUserDocsRoleAllocation($userFolderObject);
  118 +
  119 + }
  120 + else
  121 + {
  122 +
  123 + $root = $this->ktapi->get_root_folder();
  124 + $userFolder = $root->get_folder_by_name('/DroppedDocuments');
  125 +
  126 + //Get the dropdocuments folder object
  127 + $userFolderObject = $userFolder->get_folder();
  128 +
  129 + if(!$this->roleExistsName('WorkSpaceOwner'))
  130 + {
  131 +
  132 + $oWorkSpaceOwnerRole = $this->createRole('WorkSpaceOwner');
  133 + if ($oWorkSpaceOwnerRole == null)
  134 + {
  135 + $this->session->logout();
  136 + return _kt('Error: Failed to create WorkSpaceOwner Role');
  137 + }
  138 +
  139 + //set permissions
  140 + $oUserPO = KTPermissionObject::get($userFolderObject->getPermissionObjectId());
  141 + $this->setUserDocsPermissions($oUserPO);
  142 + //assign current user to role
  143 + $this->setUserDocsRoleAllocation($userFolderObject);
  144 + }
  145 + else
  146 + {
  147 +
  148 + //update WrokSpaceOwner role to include current user
  149 + $this->updateUserDocsRoleAllocation($userFolderObject);
  150 + }
  151 +
  152 + }
  153 +
  154 + $iUserDocsFolderID = $this->getFolderID('DroppedDocuments');
  155 + $oUserDocsFolder = Folder::get($iUserDocsFolderID);
  156 +
  157 + if(!Folder::FolderExistsName($sUserName, $iUserDocsFolderID))
  158 + {
  159 +
  160 +
  161 + $root=$this->ktapi->get_root_folder();
  162 + $userDocsFolder = $root->get_folder_by_name('/DroppedDocuments');
  163 +
  164 + //create the personal folder. (Use the username to create it)
  165 + $personalFolder = $userDocsFolder->add_folder($sUserName);
  166 +
  167 + //Copy the permission object to stop permission inheritance
  168 + KTPermissionUtil::copyPermissionObject($personalFolder->get_folder());
  169 +
  170 + //The role should exist by now.
  171 + //In both the if and else statements for the dropdocuments above the role is created
  172 + //If its doesn't exist by now there is an error
  173 + if(!$this->roleExistsName('WorkSpaceOwner'))
  174 + {
  175 +
  176 + $this->session->logout();
  177 + return _kt('Error: WorkSpaceOwner Role not setup, cannot assign to Personal Folder');
  178 +
  179 + }
  180 +
  181 + $personalFolderRole = $root->get_folder_by_name('/DroppedDocuments/'.$sUserName);
  182 + $PersonalFolderObject = ($personalFolderRole->get_folder());
  183 +
  184 + //Get permission object
  185 + $oPO = KTPermissionObject::get($PersonalFolderObject->getPermissionObjectId());
  186 +
  187 + //Check for duplicate WorkSpaceOwner roles
  188 + if (count($this->getRoleIdByName('WorkSpaceOwner')) > 1)
  189 + {
  190 + $this->session->logout();
  191 + return _kt('Error: cannot set personal folder role permissions: more than one role named \'WorkSpaceOwner\' exists');
  192 +
  193 + }
  194 +
  195 + $this->setPersonalFolderPermissions($oPO);
  196 +
  197 + $this->updatePersonalFolderRoleAllocation($PersonalFolderObject);
  198 +
  199 +
  200 + //folder just created so no top list of last modified documents
  201 +
  202 + $iMyDocsFolderID = $this->getFolderID($sUserName);
  203 + $this->session->logout();
  204 + return _kt('<span class="descriptiveText"> You do not have any dropped documents </span><br><br><br>');
  205 +
  206 +
  207 + }
  208 +
  209 + else //if personal folder does exist
  210 + {
  211 + //Getting personal folder id
  212 + $iMyDocsFolderID = $this->getFolderID($sUserName);
  213 +
  214 +
  215 + if(!$this->roleExistsName('WorkSpaceOwner'))
  216 + {
  217 + $this->session->logout();
  218 + return _kt('Error: WorkSpaceOwner Role does not exist');
  219 + }
  220 + else
  221 + {
  222 +
  223 + $oTempPersonalFolder = $root->get_folder_by_name('/DroppedDocuments/'.$sUserName);
  224 + $oPersonalFolder = $oTempPersonalFolder->get_folder();
  225 + //update WorkSpaceOwner role to include current user
  226 +
  227 + //Get permission object
  228 + $oPO = KTPermissionObject::get($oPersonalFolder->getPermissionObjectId());
  229 +
  230 + $this->setPersonalFolderPermissions($oPO);
  231 +
  232 + $this->updatePersonalFolderRoleAllocation($oPersonalFolder);
  233 +
  234 + }
  235 +
  236 +
  237 +
  238 + $aExternalWhereClauses[] = '(DT.transaction_namespace IN (?,?,?) AND (D.parent_folder_ids LIKE "%,'.$iMyDocsFolderID.',%" OR D.parent_folder_ids LIKE "%,'.$iMyDocsFolderID.'"))';
  239 + $aExternalWhereParams[] = 'ktcore.transactions.create';
  240 + $aExternalWhereParams[] = 'ktcore.transactions.check_in';
  241 + $aExternalWhereParams[] = 'ktcore.transactions.event';
  242 +
  243 +
  244 + $aDocumentTransactions = KTSimpleTransactionUtil::getTransactionsMatchingQuery($oUser, '', $aExternalWhereClauses, $aExternalWhereParams);
  245 + if (empty($aDocumentTransactions))
  246 + {
  247 + $this->session->logout();
  248 + return _kt('<span class="descriptiveText"> You do not have any dropped documents </span><br><br><br>');
  249 + }
  250 +
  251 + $maxcount = 5;
  252 + $aDocumentTransactions = array_slice($aDocumentTransactions, 0, $maxcount);
  253 +
  254 + $sReturnTable = '<span class="descriptiveText">'._kt('Recently Dropped Documents').'</span>
  255 + <table width="100%" class="kt_collection drop_box" cellspacing="0">
  256 +
  257 + <thead>
  258 + <tr>
  259 + <th width="100%">'._kt('Document').'</th>
  260 + <th width="1%">'._kt('Date Dropped').'</th>
  261 + </tr>
  262 + </thead>
  263 + <tbody>';
  264 +
  265 + $sOddorEven = '';
  266 + $count = 1;
  267 + foreach ($aDocumentTransactions as $aRow)
  268 + {
  269 + $oDocument = Document::get($aRow[document_id]);
  270 + $aParentFolders = explode('/',$oDocument->getFullPath());
  271 + $sPath = '';
  272 +
  273 + for($i = 0; $i < count($aParentFolders); $i++)
  274 + {
  275 + if ($i > 2)
  276 + {
  277 + $sPath .= '/'.$aParentFolders[$i];
  278 + }
  279 + }
  280 +
  281 + $sContentType = KTMime::getIconPath($oDocument->getMimeTypeID());
  282 + $aAnchorData = $this->getDocInfo($aRow[document_id]);
  283 + $sLink = $aAnchorData[0];
  284 + $sDocName = $aAnchorData[1];
  285 + $sShortDocName = $sDocName;
  286 + if(strlen($sPath) > 0)
  287 + {
  288 + $sDocName = $sPath.'/'.$sDocName;
  289 + }
  290 +
  291 + $sFullDocName = $sDocName;
  292 + $iDocLength = strlen($sDocName);
  293 + if ( $iDocLength > 30 )
  294 + {
  295 + $sDocName = substr($sDocName, ($iDocLength - 30), $iDocLength);
  296 + $sDocName = '...'.$sDocName;
  297 + }
  298 +
  299 + if($count%2 == 0)
  300 + {
  301 + $sOddorEven = 'even';
  302 + }
  303 + else
  304 + {
  305 + $sOddorEven = 'odd';
  306 + }
  307 +
  308 + $sReturnTable .= '<tr class="'.$sOddorEven.'">'.
  309 + '<td width="100%"><span class="contenttype '.$sContentType.'"><a title="'.$sShortDocName.'" href='.$sLink.'>'.$sDocName.'</a></span></td>'.
  310 + '<td width="1%">'.$aRow[datetime].'</td>'.
  311 + '</tr>';
  312 + $count ++;
  313 + }
  314 +
  315 + $location = 'browse.php?fFolderId='.$iMyDocsFolderID;
  316 + $sReturnTable .= '</tbody>'.
  317 + '</table>'.
  318 + '<br>'.
  319 + '<a href="'.$location.'">'._kt(' View All').' </a><br><br>';
  320 + $this->session->logout();
  321 +
  322 + return $sReturnTable;
  323 +
  324 + }
  325 + }
  326 +
  327 + function handleOutput($sOutput) {
  328 + print $sOutput;
  329 + }
  330 +
  331 + //This function is used to set the permission on the dropdocuments folder
  332 + function setUserDocsPermissions($oUserPO)
  333 + {
  334 + //arrays returned from get Role ID's
  335 + $aWorkSpaceOwnerRoleID = $this->getRoleIdByName('WorkSpaceOwner');
  336 + $aAdminGroupID = $this->getGroupIdByName('System Administrators');
  337 +
  338 + //arrays used to make integers for $aAllowed array variable
  339 + $iWorkSpaceOwnerRoleID = $aWorkSpaceOwnerRoleID[0]['id'];
  340 + $iAdminGroupID = $aAdminGroupID[0]['id'];
  341 + //$aBothAllowed is used to give permissions to the admin group and the WorkSpaceOwner role
  342 + $aBothAllowed = array('group' => array($iAdminGroupID), 'role' => array($iWorkSpaceOwnerRoleID));
  343 +
  344 + //$aAdminAllowed is used to give permissions to the admin group only
  345 + $aAdminAllowed = array('group' => array($iAdminGroupID));
  346 +
  347 + //Get the list of permissions
  348 + $aPermissions = KTPermission::getList();
  349 +
  350 + foreach ($aPermissions as $oPermission)
  351 + {
  352 + //If the permission is not one of the below then both are allowed the permission
  353 + //Otherwise only the admin group is allowed the permission
  354 + if($oPermission->getHumanName() != 'Delete' && $oPermission->getHumanName() != 'Rename Folder'
  355 + && $oPermission->getHumanName() != 'Manage security' && $oPermission->getHumanName() != 'Manage workflow')
  356 + {
  357 + KTPermissionUtil::setPermissionForId($oPermission, $oUserPO, $aBothAllowed);
  358 + }
  359 + else
  360 + {
  361 + KTPermissionUtil::setPermissionForId($oPermission, $oUserPO, $aAdminAllowed);
  362 + }
  363 + }
  364 +
  365 + //UPdate the permission lookup
  366 + KTPermissionUtil::updatePermissionLookupForPO($oUserPO);
  367 + }
  368 +
  369 + //This function is used for allocating the user to the WorkSpaceOwner role only when the dropdocuments folder
  370 + //has just been created.
  371 + function setUserDocsRoleAllocation($oUserFolderObject)
  372 + {
  373 + $userFolderID = $oUserFolderObject->getId();
  374 +
  375 + $tempWorkSpaceOwnerRoleID = $this->getRoleIdByName('WorkSpaceOwner');
  376 + $WorkSpaceOwnerRoleID = $tempWorkSpaceOwnerRoleID[0]['id'];
  377 +
  378 + //create a new role allocation
  379 + $oDropdocumentsRoleAllocation = new RoleAllocation();
  380 + if ($oDropdocumentsRoleAllocation == null)
  381 + {
  382 + $this->session->logout();
  383 + return _kt('Error: cannot create WorkSpaceOwner role allocation');
  384 + }
  385 +
  386 + //set the folder and role for the allocation
  387 + $oDropdocumentsRoleAllocation->setFolderId($userFolderID);
  388 + $oDropdocumentsRoleAllocation->setRoleId($WorkSpaceOwnerRoleID);
  389 +
  390 + $aWorkSpaceOwnerRoleAllowed = array();
  391 + $oDropdocumentsRoleAllocation->setAllowed($aWorkSpaceOwnerRoleAllowed);
  392 + //It might be a problem that i'm not doing a "start transaction" here.
  393 + //Unable to roll back in event of db failure
  394 + $res = $oDropdocumentsRoleAllocation->create();
  395 +
  396 + //The role is created and then updated by adding the current user to the allowed list
  397 +
  398 + $oPD = $oDropdocumentsRoleAllocation->getPermissionDescriptor();
  399 + $aWorkSpaceOwnerRoleAssignAllowed = $oPD->getAllowed();
  400 + $aUserId[] = $this->oUser->getId();
  401 + $aWorkSpaceOwnerRoleAssignAllowed['user'] = $aUserId;
  402 + $oDropdocumentsRoleAllocation->setAllowed($aWorkSpaceOwnerRoleAssignAllowed);
  403 + $res = $oDropdocumentsRoleAllocation->update();
  404 +
  405 + //Update all info linked to the role
  406 + $this->renegeratePermissionsForRole($oDropdocumentsRoleAllocation->getRoleId(), $userFolderID);
  407 + }
  408 +
  409 + //This function is used to allocate the current user to the WorkSpaceOwner role after the Dropdocuments folder
  410 + //has already been created.
  411 + function updateUserDocsRoleAllocation($oUserFolder)
  412 + {
  413 + $userFolderID = $oUserFolder->getId();
  414 + $tempWorkSpaceOwnerRoleID = $this->getRoleIdByName('WorkSpaceOwner');//$oUserRole->getId();
  415 + $WorkSpaceOwnerRoleID = $tempWorkSpaceOwnerRoleID[0]['id'];
  416 +
  417 + //Get the role allocation object for the Dropdocuments folder and the WorkSpaceOwner role
  418 + $oDropdocumentsRoleAllocation = $oRoleAllocation = RoleAllocation::getAllocationsForFolderAndRole($userFolderID, $WorkSpaceOwnerRoleID);
  419 +
  420 + //check that the object is not null
  421 + if ($oDropdocumentsRoleAllocation == null)
  422 + {
  423 + $this->session->logout();
  424 + return _kt('Error: cannot find WorkSpaceOwner role allocation');
  425 + }
  426 +
  427 + $oPD = $oDropdocumentsRoleAllocation->getPermissionDescriptor();
  428 + $aWorkSpaceOwnerRoleAssignAllowed = $oPD->getAllowed();
  429 +
  430 + //If the user ID is not in the allowed list already then add it to the list.
  431 + if(!in_array($this->oUser->getId(), $aWorkSpaceOwnerRoleAssignAllowed['user']))
  432 + {
  433 + $aNewAllowed = array();
  434 + $aNewAllowed = $aWorkSpaceOwnerRoleAssignAllowed['user'];
  435 + $aNewAllowed[] = $this->oUser->getId();
  436 + $aWorkSpaceOwnerRoleAssignAllowed['user'] = $aNewAllowed;
  437 + $oDropdocumentsRoleAllocation->setAllowed($aWorkSpaceOwnerRoleAssignAllowed);
  438 + $res = $oDropdocumentsRoleAllocation->update();
  439 + $this->renegeratePermissionsForRole($oDropdocumentsRoleAllocation->getRoleId(), $userFolderID);
  440 + }
  441 + }
  442 +
  443 + function setPersonalFolderPermissions($oPO)
  444 + {
  445 + $aWorkSpaceOwnerRoleID = $this->getRoleIdByName('WorkSpaceOwner');
  446 + $aAdminGroupID = $this->getGroupIdByName('System Administrators');
  447 +
  448 + //arrays used to make integers for $aAllowed array variable
  449 + $iWorkSpaceOwnerRoleID = $aWorkSpaceOwnerRoleID[0]['id'];
  450 + $iAdminGroupID = $aAdminGroupID[0]['id'];
  451 +
  452 + //set permissions for the role and the admin group
  453 + $aAllowed = array('role' => array($iWorkSpaceOwnerRoleID), 'group' => array($iAdminGroupID));
  454 +
  455 + //Get the List of all the permissions
  456 + $aPersonalFolderPermissions = KTPermission::getList();
  457 +
  458 + //Iterate through and apply all permissions to the current user and the admin group
  459 + foreach ($aPersonalFolderPermissions as $oPersonalFolderPermission)
  460 + {
  461 + KTPermissionUtil::setPermissionForId($oPersonalFolderPermission, $oPO, $aAllowed);
  462 +
  463 + }
  464 +
  465 + //Update permission lookup
  466 + KTPermissionUtil::updatePermissionLookupForPO($oPO);
  467 + }
  468 +
  469 + function updatePersonalFolderRoleAllocation($oPersonalFolder)
  470 + {
  471 + //Assign user to the WorkSpaceOwner role
  472 + $personalFolderID = $oPersonalFolder->getId();
  473 + $tempWorkSpaceOwnerRoleID = $this->getRoleIdByName('WorkSpaceOwner');
  474 + $WorkSpaceOwnerRoleID = $tempWorkSpaceOwnerRoleID[0]['id'];
  475 +
  476 + $oRoleAllocation = new RoleAllocation();
  477 + if ($oRoleAllocation == null)
  478 + {
  479 + $this->session->logout();
  480 + return _kt('Error: Cannot create WorkSpaceOwner role allocation on personal folder');
  481 + }
  482 + $oRoleAllocation->setFolderId($personalFolderID);
  483 + $oRoleAllocation->setRoleId($WorkSpaceOwnerRoleID);
  484 +
  485 + $aRoleAllowed = array();
  486 + $oRoleAllocation->setAllowed($aRoleAllowed);
  487 +
  488 + //It might be a problem that i'm not doing a "start transaction" here.
  489 + //Unable to roll back in event of db failure
  490 + $res = $oRoleAllocation->create();
  491 +
  492 + //The role is first created and then the current user is allocated to the role below
  493 +
  494 + $oPD = $oRoleAllocation->getPermissionDescriptor();
  495 + $aRoleAssignAllowed = $oPD->getAllowed();
  496 + $aUserId[] = $this->oUser->getId();
  497 + $aRoleAssignAllowed['user'] = $aUserId;
  498 + $oRoleAllocation->setAllowed($aRoleAssignAllowed);
  499 + $res = $oRoleAllocation->update();
  500 + $this->renegeratePermissionsForRole($oRoleAllocation->getRoleId(), $personalFolderID);
  501 + }
  502 +
  503 + //FIXME: Direct Database access
  504 + function getFolderID($sFolderName) {
  505 + $sQuery = 'SELECT id FROM folders WHERE name = \''.$sFolderName.'\'';
  506 +
  507 + $id = DBUtil::getResultArray($sQuery);
  508 + return $id[0]['id'];
  509 + }
  510 +
  511 + //this function returns the document link and document name to be displayed on the dashlet
  512 + function getDocInfo($iDocId) {
  513 + $oDocument = Document::get($iDocId);
  514 +
  515 + if (PEAR::isError($oDocument)) {
  516 + return _kt('Document no longer exists.');
  517 + }
  518 +
  519 + $sName = htmlentities($oDocument->getName(), ENT_NOQUOTES, 'UTF-8');
  520 + $sLink = KTBrowseUtil::getUrlForDocument($oDocument);
  521 +
  522 + $aAnchorData = array();
  523 + $aAnchorData[] = $sLink;
  524 + $aAnchorData[] = $sName;
  525 + return $aAnchorData;
  526 + }
  527 +
  528 + //This function is used to create the role, role allocation is done separately
  529 + function createRole ($sName)
  530 + {
  531 + $this->startTransaction();
  532 + $oRole = Role::createFromArray(array('name' => $sName));
  533 +
  534 + if (PEAR::isError($oRole) || ($oRole == false))
  535 + {
  536 + if ($this->bTransactionStarted)
  537 + {
  538 + $this->rollbackTransaction();
  539 + }
  540 + //return null on failure
  541 + return null;
  542 + }
  543 + else
  544 + {
  545 + return $oRole;
  546 +
  547 + }
  548 + }
  549 +
  550 + //FIXME: Direct Database access
  551 + function roleExistsName ($sName)
  552 + {
  553 + $sQuery = "SELECT id FROM roles WHERE name = ?";
  554 + $aParams = array($sName);
  555 + $res = DBUtil::getResultArray(array($sQuery, $aParams));
  556 +
  557 + if (count($res) != 0)
  558 + {
  559 + return true;
  560 + }
  561 + return false;
  562 + }
  563 +
  564 + //FIXME: Direct Database access
  565 + function groupExistsName ($sName)
  566 + {
  567 + $sQuery = "SELECT id FROM groups_lookup WHERE name = ?";
  568 + $aParams = array($sName);
  569 + $res = DBUtil::getResultArray(array($sQuery, $aParams));
  570 +
  571 + if (count($res) != 0)
  572 + {
  573 + return true;
  574 + }
  575 + return false;
  576 + }
  577 +
  578 + //FIXME: Direct Database access
  579 + function getRoleIdByName($sName)
  580 + {
  581 + $sQuery = "SELECT id FROM roles WHERE name = ?";
  582 + $aParams = array($sName);
  583 + $res = DBUtil::getResultArray(array($sQuery, $aParams));
  584 + return $res;
  585 + }
  586 +
  587 + //FIXME: Direct Database access
  588 + function getGroupIdByName ($sName)
  589 + {
  590 + $sQuery = "SELECT id FROM groups_lookup WHERE name = ?";
  591 + $aParams = array($sName);
  592 + $res = DBUtil::getResultArray(array($sQuery, $aParams));
  593 + return $res;
  594 + }
  595 +
  596 + //function taken from KTPermission.php and edited to work here
  597 + function renegeratePermissionsForRole($iRoleId, $iFolderId) {
  598 + $iStartFolderId = $iFolderId;
  599 + /*
  600 + * 1. find all folders & documents "below" this one which use the role
  601 + * definition _active_ (not necessarily present) at this point.
  602 + * 2. tell permissionutil to regen their permissions.
  603 + *
  604 + * The find algorithm is:
  605 + *
  606 + * folder_queue <- (iStartFolderId)
  607 + * while folder_queue is not empty:
  608 + * active_folder =
  609 + * for each folder in the active_folder:
  610 + * find folders in _this_ folder without a role-allocation on the iRoleId
  611 + * add them to the folder_queue
  612 + * update the folder's permissions.
  613 + * find documents in this folder:
  614 + * update their permissions.
  615 + */
  616 +
  617 + $sRoleAllocTable = KTUtil::getTableName('role_allocations');
  618 + $sFolderTable = KTUtil::getTableName('folders');
  619 + $sQuery = sprintf('SELECT f.id as id FROM %s AS f LEFT JOIN %s AS ra ON (f.id = ra.folder_id) WHERE ra.id IS NULL AND f.parent_id = ?', $sFolderTable, $sRoleAllocTable);
  620 +
  621 +
  622 + $folder_queue = array($iStartFolderId);
  623 + while (!empty($folder_queue)) {
  624 + $active_folder = array_pop($folder_queue);
  625 +
  626 + $aParams = array($active_folder);
  627 +
  628 + $aNewFolders = DBUtil::getResultArrayKey(array($sQuery, $aParams), 'id');
  629 + if (PEAR::isError($aNewFolders)) {
  630 + //$this->errorRedirectToMain(_kt('Failure to generate folderlisting.'));
  631 + echo _kt('Failure to generate folderlisting.');
  632 + }
  633 + $folder_queue = kt_array_merge ($folder_queue, (array) $aNewFolders); // push.
  634 +
  635 +
  636 + // update the folder.
  637 + $oFolder =& Folder::get($active_folder);
  638 + if (PEAR::isError($oFolder) || ($oFolder == false)) {
  639 + //$this->errorRedirectToMain(_kt('Unable to locate folder: ') . $active_folder);
  640 + echo _kt('Unable to locate folder: ').$active_folder;
  641 + }
  642 +
  643 + KTPermissionUtil::updatePermissionLookup($oFolder);
  644 + $aDocList =& Document::getList(array('folder_id = ?', $active_folder));
  645 + if (PEAR::isError($aDocList) || ($aDocList === false)) {
  646 + //$this->errorRedirectToMain(sprintf(_kt('Unable to get documents in folder %s: %s'), $active_folder, $aDocList->getMessage()));
  647 + echo _kt('Unable to get documents in folder ').$active_folder;
  648 + }
  649 +
  650 + foreach ($aDocList as $oDoc) {
  651 + if (!PEAR::isError($oDoc)) {
  652 + KTPermissionUtil::updatePermissionLookup($oDoc);
  653 + }
  654 + }
  655 + }
  656 + }
  657 +
  658 +}
  659 +?>
... ...
plugins/ktstandard/KTWebDAVDashletPlugin.php
... ... @@ -63,7 +63,7 @@ class KTWebDAVDashlet extends KTBaseDashlet {
63 63 var $sClass = "ktInfo";
64 64  
65 65 function KTWebDAVDashlet( ) {
66   - $this->sTitle = "WebDAV Connection Information";
  66 + $this->sTitle = _kt('WebDAV Connection Information');
67 67 }
68 68  
69 69 function render() {
... ...